Add optional fix of use item duration, disabled by default (#10247)

This commit is contained in:
Jonathing authored and GitHub committed 2024-12-23 17:15:38 -08:00
1 parent 984cedda5c
commit 9f5a6d716e
4 files changed
+15 -2

No files matched your search

@@ -30,6 +30,8 @@ public class ForgeConfig {
public final BooleanValue advertiseDedicatedServerToLan;
public final BooleanValue useItemWithDurationZero;
Server(ForgeConfigSpec.Builder builder) {
builder.comment("Server configuration settings")
.push("server");
@@ -74,8 +76,17 @@ public class ForgeConfig {
.translation("forge.configgui.advertiseDedicatedServerToLan")
.define("advertiseDedicatedServerToLan", true);
useItemWithDurationZero = builder
.comment("Set this to true to enable living entities to use items with durations of 0. Fixes being able to use Eyes of Ender repeatedly by holding down the use button. Disabled by default as it could change interactions with items of existing mods.")
.translation("forge.configgui.useItemWithDurationZero")
.define("useItemWithDurationZero", false);
builder.pop();
}
public final int getUseItemDuration() {
return useItemWithDurationZero.get() ? 0 : 1;
}
}
/**
@@ -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