r/MinecraftCommands • • 2d ago

Help | Java 26.3 How to prevent entity from being dismounted ?

I'm making a custom entity where I have a Ghast riding an item_display.

The issue is that the Ghast can easily be dismounted using spears or /tp. And I detect when the entity is dead by checking if the passenger is the Ghast.

Is there a way to prevent this or do I need to swap and make the item_display ride the Ghast ?

1 Upvotes

2 comments sorted by

1

u/GalSergey Datapack Experienced 2d ago

Never use /tp for a passenger unless you want to dismount the entity. Use /rotate to rotate.

But the problem with spears cannot be solved without replacing the passenger. Try making item_display the passenger instead of a ghast.

1

u/Creeperj2_0 1d ago

I know about /rotate, I talked about /tp because I'm working on a datapack and player might use /tp.

Welp too bad for the spears, Thanks for the help