-
Bug
-
Resolution: Unresolved
-
None
-
1.19.3, 23w03a, 24w04a
-
None
-
Community Consensus
-
Entities
List<Entity> list = this.world.getOtherEntities(this, this.getBoundingBox().expand(0.2f, -0.01f, 0.2f), EntityPredicates.canBePushedBy(this)); if (!list.isEmpty()) { boolean bl = !this.world.isClient && !(this.getPrimaryPassenger() instanceof PlayerEntity); for (int j = 0; j < list.size(); ++j) { Entity entity = list.get(j); if (entity.hasPassenger(this)) continue; if (bl && this.getPassengerList().size() < this.getMaxPassengers() && !entity.hasVehicle() && entity.getWidth() < this.getWidth() && entity instanceof LivingEntity && !(entity instanceof WaterCreatureEntity) && !(entity instanceof PlayerEntity)) { entity.startRiding(this); continue; } this.pushAwayFrom(entity); } }
(From BoatEntity.tick())
When the execution falls into the block where entity.startRiding(this); is in, the boat won't try to push the entity anymore. Normally, the entity should start riding the boat now, but it may fail because of the presence or riding cooldown or that the boat is submerged in water.
How to reproduce
- Place a boat on the ground, and push it to a corner.
- Summon a llama (or anything similar) riding a minecraft.
- Let the llama disamount near the boat so that it should be pushed by the boat and have a riding cooldown of 3 seconds.
- Discover that the llama is not pushed for 3 seconds before it can ride the boat.
Possible Soluton:
Use something like the code below instead.
if (bl && this.getPassengerList().size() < this.getMaxPassengers() && !entity.hasVehicle() && entity.getWidth() < this.getWidth() && entity instanceof LivingEntity && !(entity instanceof WaterCreatureEntity) && !(entity instanceof PlayerEntity) && entity.canStartRiding(this) && this.canAddPassenger(entity))