-2

I am working on a data pack to add airships into Minecraft 1.18.1 (based on re-textured donkeys). I am planning to make it so that the following behaviour occurs:

  • If you hold the “Ascend” item, the airship entity gets the Levitation effect, causing it to rise.
  • If you hold the “Descend” item, the airship entity gets the Slow Falling effect, causing it to descend slowly.
  • If no item is being held, the airship entity gets the NoGravity: 1b tag, preventing it from rising or falling.

I was wondering whether these command would serve as a good starting point. Am I at least on the right track?

testfor @s {SelectedIemSlot:3,Inventory:[{Slot:0b,Count:1b,id:minecraft:player_head{SkullOwner:MHF_ArrowUp,tag:{display:{Name:"Ascend"}}}}]}

testfor @s {SelectedItemSlot:5,Inventory:[{Slot:0b,Count:1b,id:minecraft:player_head{SkullOwner:MHF_ArrowDown,tag:{display:{Name:"Descend"}}}}]}

execute if @s {SelectedItemSlot:3,Inventory:[Slot:0b,Count:1b,id:minecraft:player_head{SkullOwner:MHF_ArrowUp,tag:{display:{Name:"Ascend"}}}}]} run effect @e[type=minecraft:mule,{CustomName:"Airship"}] minecraft:levitation 99999999 1 true

execute if @s {SelectedItemSlot:5,Inventory:[Slot:0b,Count:1b,id:minecraft:player_head{SkullOwner:MHF_ArrowDown,tag:{display:{Name:"Descend"}}}}]} run effect @e[type=minecraft:mule,{CustomName:"Airship"}] minecraft:slow_falling 99999999 1 true
1
  • Have you actually tried out these commands to see if they work? You should always perform some test trials before asking. May 3 at 0:21

0

You must log in to answer this question.

Browse other questions tagged .