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

Endermen don't pick up non collidable blocks

    XMLWordPrintable

    Details

    • Confirmation Status:
      Confirmed
    • Category:
      Mob behaviour
    • Mojang Priority:
      Low

      Description

      The bug

      Endermen are not able to pick up any block which is not collidable, for instance flowers or mushrooms, even if those blocks have the enderman_holdable tag.

      How to reproduce

      • Place mushrooms in a stone covered area
      • Spawn a lot of endermen
        Notice endermen are not able to pick up the mushrooms blocks.

      Explanation

      The enderman_holdable tag is added to mushrooms and flowers. Before 1.13, the decompiled source code showed that they had to be able to pick up those blocks and they didn't either. And as I made a data pack that lets them only pick up tall grass, lilypads, and other non-collidable blocks, they just pick up nothing...

      I assigned a data pack I made to test the expected behaviour. The following table shows the current behaviour.

      Block in data packs Grab?
      Soul sand Yes
      Any flower pot, with or without plant No
      Regular torch No
      Any rails No
      Any slab No
      Any button No
      Any carpet No
      Any door No
      End rods Yes
      The blocks below are in the vanilla data pack  
      Grass blocks Yes
      Dirt Yes
      Coarse dirt Yes
      Podzol Yes
      Sand / red sand Yes
      Gravel Yes
      Dandelion No
      Poppy No
      Blue orchid No
      Allium No
      Azure Bluet No
      Red tulip No
      Orange tulip No
      White tulip No
      Pink tulip No
      Oxeye daisy No
      Any mushroom No
      TNT Yes
      Cactus Yes
      Clay Yes
      Pumpkin Yes
      Carved pumkin Yes
      Melon Yes
      Mycelium Yes
      Netherrack Yes

      Eventually, it seems that endermen only pick up collidable blocks of which their shape contains the block-local coordinates [0.5, 0.5, 0.5].

      Code analysis

      In the MCP remapped source code, in the take-block AI, there is this:

            public void tick() {
               Random random = this.enderman.getRNG();
               World world = this.enderman.world;
               int i = MathHelper.floor(this.enderman.posX - 2.0D + random.nextDouble() * 4.0D);
               int j = MathHelper.floor(this.enderman.posY + random.nextDouble() * 3.0D);
               int k = MathHelper.floor(this.enderman.posZ - 2.0D + random.nextDouble() * 4.0D);
               BlockPos blockpos = new BlockPos(i, j, k);
               IBlockState iblockstate = world.getBlockState(blockpos);
               Block block = iblockstate.getBlock();
               RayTraceResult raytraceresult = world.rayTraceBlocks(new Vec3d((double)((float)MathHelper.floor(this.enderman.posX) + 0.5F), (double)((float)j + 0.5F), (double)((float)MathHelper.floor(this.enderman.posZ) + 0.5F)), new Vec3d((double)((float)i + 0.5F), (double)((float)j + 0.5F), (double)((float)k + 0.5F)), RayTraceFluidMode.NEVER, true, false);
               boolean flag = raytraceresult != null && raytraceresult.getBlockPos().equals(blockpos); // It's this rule that causes the bug
               // It should be: raytraceresult == null || raytraceresult.getBlockPos().equals(blockpos);
               if (block.isIn(BlockTags.ENDERMAN_HOLDABLE) && flag) {
                  this.enderman.func_195406_b(iblockstate);
                  world.removeBlock(blockpos);
               }
            }
      

      Original information

      As far as I know, endermen are able to pick up mushrooms, flowers and other non-solid blocks. I've seen them doing that in bedrock edition, but never in java edition. This is a problem that's confusing me for two years now, and it seems that it never showed up here...

      Since endermen could pick up mushrooms, they should start grabbing the mushrooms. In bedrock/pocket edition, this is the case. But in java edition, they only grab the collidable blocks...

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Excited [Mojang] Maria Lemón
                Reporter:
                RGSW RGSW
              • Votes:
                6 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: