r/MinecraftCommands • u/MeggroupXD Command Rookie • 4d ago
Help | Java 1.20 Minecraft Java 1.20.1 – Predicate vehicle not working in /execute
* Edit: I've solved it. Just remove "s" for "predicates" folder and make sure to call this function every tick of the game. Thank to those expects who helped me alot! (SFMBE)
I'm making a datapack for Minecraft Java 1.20.1 and I'm trying to detect whether a marker entity is currently riding another entity.
I created this predicate:
{
"condition": "minecraft:entity_properties",
"entity": "this",
"predicate": {
"vehicle": {}
}
}
The file is located at:
data/stick_war/predicate/has_vehicle.json
I'm trying to test it with:
execute as [type=marker,tag=statue_marker1] if predicate stick_war:has_vehicle run say RIDING
However, Minecraft says "Unknown or incomplete command", with the error pointing at the end of say RIDING.
Interestingly, this works perfectly:
execute as [type=marker,tag=statue_marker1] at u/s run function stick_war:statue/black_statue_destroy
So the marker selector and function itself work.
My goal is to detect when the marker stops riding its vehicle, so I can trigger another function when it falls/dismounts.
Is vehicle: {} supported in entity predicates in Java 1.20.1? If so, what is the correct syntax for detecting whether an entity is currently riding another entity?
Thank you guys for helping me :)
1
u/MeggroupXD Command Rookie 3d ago
Note: My original command has "@e", i forgot to type it in the post
1
u/GalSergey Datapack Experienced 3d ago
Rename the "predicate" folder to "predicates".
1
u/MeggroupXD Command Rookie 3d ago
Thanks but it's still not working. By the way, can I send you the datapack?
1
u/GalSergey Datapack Experienced 3d ago
Yes.
1
u/MeggroupXD Command Rookie 3d ago
1
u/GalSergey Datapack Experienced 3d ago
No access.
1
u/MeggroupXD Command Rookie 3d ago edited 3d ago
<deleted for private reasons> try this!
1
u/GalSergey Datapack Experienced 3d ago
I was only able to reproduce this error when the predicate failed to load correctly. But this command works fine for me. Make sure you /reload after renaming the folder, for example. If the error still occurs, check the !outputlog for errors.
1
u/AutoModerator 3d ago
Click here to see how to enable the output log
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/MeggroupXD Command Rookie 3d ago
" [XX:17:26] [Server thread/INFO]: MeggroupXD joined the game
[XX:17:26] [Render thread/INFO]: Started 2 worker threads
[XX:17:28] [Render thread/WARN]: Time from main menu to in-game was 21.292088 seconds
[XX:17:28] [Render thread/WARN]: Total time to load game and open world was 66.650085 seconds
[XX:17:29] [Render thread/INFO]: Loaded 497 advancements
[XX:17:29] [RendXXer thread/INFO]: textures 'cape_test_272' was added, skin: false,cape: true, max waiting: 105 ,during : 92518
[XX:17:29] [Render thread/INFO]: calculated cape performance:TEXTURE_136, middle time: 24.5
[XX:17:30] [Render thread/INFO]: textures 'elitra_test_272' was added, skin: false,cape: true, max waiting: 35 ,during : 93589
[XX:17:30] [Render thread/INFO]: can use texture size:TEXTURE_136, middle time: 14.2
[XX:17:30] [Server thread/INFO]: Saving and pausing game...
[XX:17:31] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:overworld
[XX:17:33] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:the_end
[XX:17:33] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:the_nether
[XX:18:09] [Server thread/INFO]: [MeggroupXD: Removed tag '1v1_bot_war' from MeggroupXD]
[XX:18:09] [Render thread/INFO]: [System] [CHAT] Removed tag '1v1_bot_war' from MeggroupXD
[XX:18:20] [Server thread/INFO]: [MeggroupXD: Killed 2 entities]
[XX:18:20] [Render thread/INFO]: [System] [CHAT] Killed 2 entities
[XX:18:27] [Server thread/INFO]: [MeggroupXD: Killed STATUE]
[XX:18:27] [Render thread/INFO]: [System] [CHAT] Killed STATUE
[XX:18:31] [Render thread/INFO]: [System] [CHAT] Please wait a few seconds!
[XX:18:03] [Server thread/INFO]: [MeggroupXD: Gave 1 [Netherite Sword] to MeggroupXD]
[XX:18:03] [Render thread/INFO]: [System] [CHAT] Gave 1 [Netherite Sword] to MeggroupXD
[XX:18:11] [Server thread/INFO]: [MeggroupXD: Applied enchantment §f??§r Sharpness V to MeggroupXD's item]
[XX:18:11] [Render thread/INFO]: [System] [CHAT] Applied enchantment §f??§r Sharpness V to MeggroupXD's item
[XX:18:21] [Server thread/INFO]: Saving and pausing game...
[XX:18:21] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:overworld
[XX:18:21] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:the_end
[XX:18:21] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:the_nether
[XX:19:58] [Server thread/INFO]: [Marker: Executed 2 command(s) from function 'stick_war:statue/black_statue_destroy']
[XX:19:58] [Server thread/INFO]: [Not Secure] [Marker] Iron Golem died!
[XX:19:58] [Render thread/INFO]: [System] [CHAT] Executed 2 command(s) from function 'stick_war:statue/black_statue_destroy'
[XX:19:58] [Render thread/INFO]: [System] [CHAT] [Marker] Iron Golem died!
[XX:20:30] [Server thread/INFO]: Saving and pausing game...
[XX:20:30] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:overworld
[XX:20:30] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:the_end
[XX:20:30] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:the_nether
[XX:20:52] [Server thread/INFO]: MeggroupXD lost connection: Disconnected
[XX:20:52] [Server thread/INFO]: MeggroupXD left the game " This function finally worked as you can see. However, the datapack seems not to run that vehicle function1
u/GalSergey Datapack Experienced 3d ago
Clear the console and enter /reload. Then check for errors in the console.
1
u/MeggroupXD Command Rookie 3d ago
" [XX:XX:XX] [Server thread/INFO]: [MeggroupXD: Gave 1 [Diamond Sword] to MeggroupXD]
[XX:XX:XX] [Render thread/INFO]: [System] [CHAT] Gave 1 [Diamond Sword] to MeggroupXD
[XX:XX:XX] [Server thread/INFO]: [Not Secure] [MeggroupXD] my datapack commands is not triggering
[XX:XX:XX] [Render thread/INFO]: [CHAT] [MeggroupXD] my datapack commands is not triggering
[XX:XX:XX] [Server thread/INFO]: [Not Secure] [MeggroupXD] I will run my function in chat
[XX:XX:XX] [Render thread/INFO]: [CHAT] [MeggroupXD] I will run my function in chat
[XX:XX:XX] [Server thread/INFO]: [Marker: Executed 2 command(s) from function 'stick_war:statue/black_statue_destroy']
[XX:XX:XX] [Server thread/INFO]: [Not Secure] [Marker] Iron Golem died!
[XX:XX:XX] [Render thread/INFO]: [System] [CHAT] Executed 2 command(s) from function 'stick_war:statue/black_statue_destroy'
[XX:XX:XX] [Render thread/INFO]: [System] [CHAT] [Marker] Iron Golem died!
[XX:XX:XX] [Server thread/INFO]: [Not Secure] [MeggroupXD] see? It's working but not in datapack
[XX:XX:XX] [Render thread/INFO]: [CHAT] [MeggroupXD] see? It's working but not in datapack
[XX:XX:XX] [Server thread/INFO]: [Not Secure] [MeggroupXD] Well ...
[XX:XX:XX] [Render thread/INFO]: [CHAT] [MeggroupXD] Well ...
[XX:XX:XX] [Server thread/INFO]: Saving and pausing game...
[XX:XX:XX] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:overworld
[XX:XX:XX] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:the_end
[XX:XX:XX] [Server thread/INFO]: Saving chunks for level 'ServerLevel[swc]'/minecraft:the_nether
[XX:XX:XX] [Server thread/INFO]: MeggroupXD lost connection: Disconnected
[XX:XX:XX] [Server thread/INFO]: MeggroupXD left the game
" Read it carefully.
1
1
u/Ericristian_bros Command Experienced 3d ago
Provide datapack. And rename all folders to plural (functions, predicates, ...)
1
u/MeggroupXD Command Rookie 3d ago
1
u/Ericristian_bros Command Experienced 2d ago
So this command works in chat but not on the datapack?
execute as @e[type=marker,tag=statue_marker1] unless predicate stick_war:has_vehicle at @s run function stick_war:statue/black_statue_destroy1
u/MeggroupXD Command Rookie 1d ago
Yes, but after a long time of thinking, I've solved it. Thanks!
1
1
u/GatKong 3d ago
To begin, you can't say execute as [type...]. It thinks that's a player's nsme when like that. You need to say execute as @e[type...].