From e24d925931b41484d67f7acb3d8010e660c6a48f Mon Sep 17 00:00:00 2001 From: Tom Prince Date: Sun, 12 Jan 2025 13:59:04 -0700 Subject: [PATCH] Change damping to be a property of definition rather than class (#2731) --- .../com/gregtechceu/gtceu/api/machine/MachineDefinition.java | 3 +++ .../gtceu/api/machine/feature/IRecipeLogicMachine.java | 2 +- .../gtceu/api/registry/registrate/MachineBuilder.java | 4 ++++ .../api/registry/registrate/MultiblockMachineBuilder.java | 5 +++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java index 7a2eb0d22a..243c3eecfe 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/MachineDefinition.java @@ -89,6 +89,9 @@ public class MachineDefinition implements Supplier { @Getter @Setter private Consumer afterWorking = (machine) -> {}; + @Getter + @Setter + private boolean regressWhenWaiting = true; @Getter @Setter diff --git a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRecipeLogicMachine.java b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRecipeLogicMachine.java index d82865c0a0..e3b85abe06 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRecipeLogicMachine.java +++ b/src/main/java/com/gregtechceu/gtceu/api/machine/feature/IRecipeLogicMachine.java @@ -108,7 +108,7 @@ default void afterWorking() { * Whether progress decrease when machine is waiting for pertick ingredients. (e.g. lack of EU) */ default boolean dampingWhenWaiting() { - return true; + return self().getDefinition().isRegressWhenWaiting(); } /** diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java index 87d8e01355..648eaa67b6 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MachineBuilder.java @@ -146,6 +146,9 @@ public class MachineBuilder extends Builde @Getter @Setter private Consumer afterWorking = (machine) -> {}; + @Getter + @Setter + private boolean regressWhenWaiting = true; @Setter private Supplier appearance; @@ -365,6 +368,7 @@ public DEFINITION register() { definition.setOnWorking(this.onWorking); definition.setOnWaiting(this.onWaiting); definition.setAfterWorking(this.afterWorking); + definition.setRegressWhenWaiting(this.regressWhenWaiting); if (renderer == null) { renderer = () -> new MachineRenderer(new ResourceLocation(registrate.getModid(), "block/machine/" + name)); diff --git a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java index 2da6530b57..85216242c7 100644 --- a/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java +++ b/src/main/java/com/gregtechceu/gtceu/api/registry/registrate/MultiblockMachineBuilder.java @@ -368,6 +368,11 @@ public MultiblockMachineBuilder afterWorking(Consumer after return (MultiblockMachineBuilder) super.afterWorking(afterWorking); } + @Override + public MultiblockMachineBuilder regressWhenWaiting(boolean dampingWhenWaiting) { + return (MultiblockMachineBuilder) super.regressWhenWaiting(dampingWhenWaiting); + } + @Override public MultiblockMachineBuilder editableUI(@Nullable EditableMachineUI editableUI) { return (MultiblockMachineBuilder) super.editableUI(editableUI);