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

Fishing rod sometimes cannot reel in entities

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 16w43a
    • Minecraft 15w36c, Minecraft 15w44b, Minecraft 15w47c, Minecraft 1.9.2, Minecraft 16w15b, Minecraft 1.9.3 Pre-Release 3, Minecraft 1.9.3, Minecraft 1.9.4, Minecraft 16w20a, Minecraft 1.10.2, Minecraft 16w41a
    • Confirmed

      Introduction

      These behaviours seems to affect survival and creative mode and can be reproduced nearly all the time. There are also other situations which cannot be reproduced that easily.

      Sitatuations

      Catching a mob at the bottom of its hitbox

      It seems like catching a mob (and also Minecarts and ArmorStands) at the bottom of its hitbox and then trying to pull it, will never work (see screenshot).

      Pulling from above

      It seems like trying to pull a mob up often does not work when doing it straight above it.

      The reason

      The following is based on decompiled version of Minecraft 1.9 using MCP 9.24 beta. All method and class names are the names used in the decompiled version.

      When an entity is caught first the field net.minecraft.entity.projectile.EntityFishHook.caughtEntity is set and then the DataParameter net.minecraft.entity.projectile.EntityFishHook.field_184528_c is set to the entity id + 1. The problem is that after that the method net.minecraft.entity.projectile.EntityFishHook.notifyDataManagerChange(DataParameter<?>) is called which sets the caught entity to null if it was not null (which is the case) and the stored entity id + 1 is greater than 0, which means an entity id stored, which is the case as well. This could be solved by only changing the caught entity if its entity id + 1 is not the stored entity id + 1 and then not setting it to null, but instead to the corresponding entity.

      public void notifyDataManagerChange(DataParameter<?> key)
      {
          if (field_184528_c.equals(key))
          {
              int i = ((Integer)this.getDataManager().get(field_184528_c)).intValue();
      
              // Replaced this
              //if (i > 0 && this.caughtEntity != null)
              //{
              //    this.caughtEntity = null;
              //}
              if (i == 0 && this.caughtEntity != null) {
                  this.caughtEntity = null;
              }
              else if (i > 0) {
                  Entity expectedEntity = this.worldObj.getEntityByID(i - 1);
                  if (this.caughtEntity == null || !this.caughtEntity.equals(expectedEntity)) {
                      this.caughtEntity = expectedEntity;
                  }
              }
          }
      
          super.notifyDataManagerChange(key);
      }
      

      The reason why you can sometimes reel in entities is because after the caught entity is set to null, its entity id is still stored. If the fishing hook is still close enough to catch the entity it sets the caught entity and then the entity id + 1. Because the entity id + 1 is still the same, the method net.minecraft.entity.projectile.EntityFishHook.notifyDataManagerChange(DataParameter<?>) is not called and the caught entity remains. As this bug shows this is not always the case and this behaviour is still very likely not the intended one.

            Excited Maria Lemón
            marcono1234 [Mod] Marcono1234
            Votes:
            17 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: