mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 02:55:17 +00:00
Fix items with use durations of 0 being repeatedly used when use button is held down. Fixed #10150
This commit is contained in:
2 files changed
+3
-5
No files matched your search
@@ -518,14 +518,12 @@
|
||||
this.completeUsingItem();
|
||||
}
|
||||
}
|
||||
@@ -3134,8 +_,12 @@
|
||||
@@ -3134,8 +_,10 @@
|
||||
public void startUsingItem(InteractionHand p_21159_) {
|
||||
ItemStack itemstack = this.getItemInHand(p_21159_);
|
||||
if (!itemstack.isEmpty() && !this.isUsingItem()) {
|
||||
+ int duration = net.minecraftforge.event.ForgeEventFactory.onItemUseStart(this, itemstack, itemstack.getUseDuration(this));
|
||||
+ if (duration <= 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+ if (duration < 0) return;
|
||||
this.useItem = itemstack;
|
||||
- this.useItemRemaining = itemstack.getUseDuration(this);
|
||||
+ this.useItemRemaining = duration;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class LivingEntityUseItemEvent extends LivingEvent
|
||||
* Drinking Potions/Milk
|
||||
* Guarding with a sword
|
||||
*
|
||||
* Cancel the event, or set the duration or {@literal <=} 0 to prevent it from processing.
|
||||
* Cancel the event, or set the duration or {@literal <} 0 to prevent it from processing.
|
||||
*
|
||||
*/
|
||||
@Cancelable
|
||||
|
||||
Reference in new issue
Block a user