How can I prevent entity from getting in a boat

Started by zovytadek on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I prevent entity from getting in a boat

So, I'd like to make a boss entity for my mob, but there's one problem. Boats. Player can just put a boat, boss will get in it and it'll be an easy win for a player. How can I prevent an entity from getting in a boat?

Joined Jul 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
every entity enters boats…
Thu, 07/31/2025 - 13:12

every entity enters boats. this is a minecraft rule

Joined Jul 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Adult camels don't so that's…
Sat, 09/06/2025 - 00:03

Adult camels don't so that's false. There's probably a custom code way to do it, but I'm not sure exactly how

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Looks like it's hardcoded…
Sat, 09/06/2025 - 06:10

Looks like it's hardcoded...

:/

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It is possible with a mixin…
Sat, 09/06/2025 - 08:01

It is possible with a mixin though,

@Mixin(AbstractBoat.class)
public class AbstractBoatMixin {
	@Inject(method = "tick", cancellable = true, at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/world/entity/Entity;hasPassenger(Lnet/minecraft/world/entity/Entity;)Z"))
	private static void tick(CallbackInfo ci, @Local Entity entity) {
		if(entity instanceof Zombie) {
			ci.cancel();
		}
	}
}