diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineBlock.java index 09629ecf5..5aae6789f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineBlock.java @@ -33,7 +33,7 @@ public class FurnaceEngineBlock extends EngineBlock implements ITE(); + blockActivators = new HashMap<>(); + } - protected Map, Float> blockModifiers = new HashMap<>(); - protected Map, Function> blockActivators = new HashMap<>(); + private final Map, Float> blockModifiers; + private final Map, Function> blockActivators; public void register(IRegistryDelegate block, float modifier) { this.blockModifiers.put(block, modifier); @@ -40,12 +44,22 @@ public class FurnaceEngineModifiers { } public EngineState getEngineState(BlockState state) { - return getEngineStateOrDefault(state, s -> s.getBlock() instanceof AbstractFurnaceBlock && s.hasProperty(AbstractFurnaceBlock.LIT) ? (s.getValue(AbstractFurnaceBlock.LIT) ? EngineState.ACTIVE : EngineState.VALID) : EngineState.EMPTY).apply(state); + return getEngineStateOrDefault(state, + s -> s.getBlock() instanceof AbstractFurnaceBlock && s.hasProperty(AbstractFurnaceBlock.LIT) ? + (s.getValue(AbstractFurnaceBlock.LIT) ? EngineState.ACTIVE : EngineState.VALID) : EngineState.EMPTY).apply(state); } public static void register() { INSTANCE.register(Blocks.BLAST_FURNACE.delegate, 2f); - //INSTANCE.register(Blocks.REDSTONE_LAMP.delegate, 1f, s -> s.getBlock() instanceof RedstoneLampBlock && s.hasProperty(RedstoneLampBlock.LIT) ? (s.getValue(RedstoneLampBlock.LIT) ? EngineState.ACTIVE : EngineState.VALID) : EngineState.EMPTY); + + // Example: + // INSTANCE.register(Blocks.REDSTONE_LAMP.delegate, 1f, + // s -> s.getBlock() instanceof RedstoneLampBlock && s.hasProperty(RedstoneLampBlock.LIT) ? + // (s.getValue(RedstoneLampBlock.LIT) ? EngineState.ACTIVE : EngineState.VALID) : EngineState.EMPTY); + } + + public static FurnaceEngineModifiers get() { + return INSTANCE; } public enum EngineState { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java index 0dbe13f2e..b838b55e6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java @@ -22,11 +22,11 @@ public class FurnaceEngineTileEntity extends EngineTileEntity { public void updateFurnace() { BlockState state = level.getBlockState(EngineBlock.getBaseBlockPos(getBlockState(), worldPosition)); - EngineState engineState = FurnaceEngineModifiers.INSTANCE.getEngineState(state); + EngineState engineState = FurnaceEngineModifiers.get().getEngineState(state); if (engineState.isEmpty()) return; - float modifier = FurnaceEngineModifiers.INSTANCE.getModifier(state); + float modifier = FurnaceEngineModifiers.get().getModifier(state); boolean active = engineState.isActive(); float speed = active ? 16 * modifier : 0; float capacity =