mojira.dev
MC-259315

Boats do not push some entities that have a riding cooldown, or when the boat is submerged

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

  1. Place a boat on the ground, and push it to a corner.

  2. Summon a llama (or anything similar) riding a minecraft.

  3. Let the llama disamount near the boat so that it should be pushed by the boat and have a riding cooldown of 3 seconds.

  4. 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))

Attachments

Comments 3

Please provide reliable steps to reproduce this issue, and a video showcasing the behavior if possible.

Can confirm in 24w04a

Thank you for your report!
After consideration, the issue is being closed as Working as Intended.

Please note, that mechanics of the game may change between updates.
Things such as graphics, sounds, world creation, biomes, redstone, villagers, and animals may not work the same in current versions.

Full Version HistorySnapshot Version HistoryThe official Minecraft feedback site

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

lovexyn0827

(Unassigned)

Community Consensus

Entities

1.19.3, 23w03a, 24w04a

Retrieved