Skip to content

Commit

Permalink
Change damping to be a property of definition rather than class (#2731)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomprince authored Jan 12, 2025
1 parent 3ade4a7 commit e24d925
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public class MachineDefinition implements Supplier<IMachineBlock> {
@Getter
@Setter
private Consumer<IRecipeLogicMachine> afterWorking = (machine) -> {};
@Getter
@Setter
private boolean regressWhenWaiting = true;

@Getter
@Setter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ public class MachineBuilder<DEFINITION extends MachineDefinition> extends Builde
@Getter
@Setter
private Consumer<IRecipeLogicMachine> afterWorking = (machine) -> {};
@Getter
@Setter
private boolean regressWhenWaiting = true;

@Setter
private Supplier<BlockState> appearance;
Expand Down Expand Up @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ public MultiblockMachineBuilder afterWorking(Consumer<IRecipeLogicMachine> 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);
Expand Down

0 comments on commit e24d925

Please sign in to comment.