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

This commit is contained in:
Jonathing authored and GitHub committed 2024-12-23 15:04:45 -08:00
1 parent 5693e5d11a
commit 1fe85f5396
4 files changed
+16 -5

No files matched your search

@@ -26,6 +26,8 @@ public class ForgeConfig {
public final BooleanValue advertiseDedicatedServerToLan;
public final BooleanValue useItemWithDurationZero;
Server(ForgeConfigSpec.Builder builder) {
builder.comment("Server configuration settings")
.push("server");
@@ -58,8 +60,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