mojira.dev
MC-155758

Endermen don't pick up non collidable blocks

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

Linked issues

Attachments

Comments 5

Thank you for your report!
However, this issue is Invalid.

Minecraft has several different editions, and some features vary from edition to edition. Often this happens when one edition evolves faster than another, and tweaks or balances are made that don't propagate immediately to other editions.

You have posted a feature request. This site is for bugs only. if you want to make a suggestion, please visit the feedback website, or Minecraft Suggestions on Reddit.

Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki

I didn't request this, it is a bug... I've tested it using a data pack: when I add mushrooms, flower pots and torches to the enderman_holdable tag, it doesn't work. When I assign blocks to the tag, endermen will only pick it up when you can collide with the block, and the block's collision shape contains the center point of the full block... However, they should pick up every block in the enderman_holdable tag, which is not the case...

I don't see a feature request in this though... It's on the wiki, and when I extract the default data pack from the jar file, it seems to be defined there too...

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

Thanks for editing your ticket and clarifying the issue is about holdable tag. We will resolve this ticket as a duplicate of MC-145143.

If you would like to add a vote and any extra information to the main ticket it would be appreciated.

Given the obscurity of MC-145143 and the excellent detail of this report, I'm going to forward-resolve to this being the primary ticket. Thank you for your deductions.

Agreed. But @@unknown it would have been easier if you had added the relevant information when you created this ticket. At first, you were talking about parity update between bedrock and java, which is a feature request… Then you answered by coming to the fact with the holdable tag.

✔ Issue confirmed, description restructured and code analysis embeded.

Samū

migrated

Confirmed

Low

Mob behaviour

enderman_holdable, mojang_internal_1

Minecraft 1.13.2, Minecraft 1.14.3

19w45a

Retrieved