Mojira Archive
MC-107185

Eyes of ender utilize the behavior of consumable items causing the player to be slowed down when using them

The Bug:

Eyes of ender utilize the behavior of consumable items causing the player to be slowed down when using them.

Steps to Reproduce:

  1. Obtain several eyes of ender, walk forward at a constant speed, and throw multiple of them into the air.
  2. Observe how fast you're traveling as you do this.
  3. Take note as to whether or not throwing eyes of ender slows down the player.

Observed Behavior:

You are slowed down as if you were eating food.

Expected Behavior:

You would not be slowed down, following the behavior of similar projectiles such as snowballs and eggs.

Code Analysis:

The following is based on 1.12 decompiled using MCP 9.40 PRE 1

The method net.minecraft.item.ItemEnderEye.onItemRightClick(World, EntityPlayer, EnumHand) sets the eye of ender as actively used item stack similar to bows, food or potions. However, since eye of enders do not override net.minecraft.item.Item.getMaxItemUseDuration(ItemStack) their use time is 0. This causes you to slow down in creative mode because the condition for stopping using the active item stack is --this.activeItemStackUseCount == 0, so with 0 as start value the first check is -1 == 0.

Since the method ItemEnderEye.onItemRightClick directly decreases the count in survival the active item stack is reset since its count changed.