The Bug:
Eyes of ender utilize the behavior of consumable items causing the player to be slowed down when using them.
Steps to Reproduce:
Obtain several eyes of ender, walk forward at a constant speed, and throw multiple of them into the air.
Observe how fast you're traveling as you do this.
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.
Linked issues
is duplicated by 6
relates to 3
Attachments
Comments 24
Thank you for your feedback, @unknown. As the reporter of this bug, you can update the affected version(s) yourself, so please try updating this ticket from time to time.
I am able to confirm this in 21w40a. The expected behavior would be that eye of enders would not slow you down when throwing them.
Can confirm in 1.18.1. Would it be alright if I take ownership of this report since I believe the current reporter's account has been deactivated? 🙂
Confirmed to still exist in 1.20.5-pre1. This issue can be fixed by changing the following code in LivingEntity#updateUsingItem
if(--this.useItemRemaining== 0&& !this.level().isClientSide&& !p_147201_.useOnRelease()) {
this.completeUsingItem();
}
to
if(--this.useItemRemaining<= 0&& !this.level().isClientSide&& !p_147201_.useOnRelease()) {
this.completeUsingItem();
}
The change is switching out `==` for `<=`, which fixes completeUsingItem() not being called for items with a use duration of 0.
Please put only one bug report in each ticket.
Can reproduce slowing down for survival if there are no strongholds in the world.