Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-259315

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

XMLWordPrintable

    • Icon: Bug 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

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

            Unassigned Unassigned
            lovexyn0827 lovexyn0827
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: