diff --git a/CHANGELOG.md b/CHANGELOG.md index 976b18b..3818a83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +**Beta 0.1.4** +* Fix Bug Where Off Switches Require Power + **Beta 0.1.3** * Optimizations * Fix Energy Teleporter Y Issues diff --git a/gradle.properties b/gradle.properties index f4ce083..26b27ad 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,7 +10,7 @@ org.gradle.jvmargs = -Xmx1G fabric_loader_version = 0.9.0+build.204 # Mod Properties - mod_version = 0.1.3 + mod_version = 0.1.4 maven_group = com.thebrokenrail # Dependencies diff --git a/src/main/java/com/thebrokenrail/energonrelics/block/entity/SwitchBlockEntity.java b/src/main/java/com/thebrokenrail/energonrelics/block/entity/SwitchBlockEntity.java index 445f66a..4038fc0 100644 --- a/src/main/java/com/thebrokenrail/energonrelics/block/entity/SwitchBlockEntity.java +++ b/src/main/java/com/thebrokenrail/energonrelics/block/entity/SwitchBlockEntity.java @@ -6,6 +6,8 @@ import com.thebrokenrail.energonrelics.block.SwitchBlock; import com.thebrokenrail.energonrelics.config.HardcodedConfig; import net.minecraft.block.entity.BlockEntityType; +import java.util.Objects; + public class SwitchBlockEntity extends EnergyReceiverBlockEntity { public SwitchBlockEntity(BlockEntityType type) { super(type); @@ -13,7 +15,11 @@ public class SwitchBlockEntity extends EnergyReceiverBlockEntity { @Override protected void energyTick() { - addAction(Action.createBlockStatePropertyAction(HardcodedConfig.SWITCH_ENERGY_REQUIRED, SwitchBlock.POWERED, true, false)); + if (getCachedState().get(SwitchBlock.ACTIVE)) { + addAction(Action.createBlockStatePropertyAction(HardcodedConfig.SWITCH_ENERGY_REQUIRED, SwitchBlock.POWERED, true, false)); + } else if (getCachedState().get(SwitchBlock.POWERED)) { + Objects.requireNonNull(getWorld()).setBlockState(getPos(), getCachedState().with(SwitchBlock.POWERED, false)); + } } @Override