From f4a568310f310b64d77b4904106e114c69798e39 Mon Sep 17 00:00:00 2001 From: "Brandon Holt (RinRin Blissgreen)" Date: Thu, 16 Apr 2026 18:45:36 -0700 Subject: [PATCH] Fixed cutoff switch state issues when next to multiple cutoff switches --- .../realgrid/blocks/cutoffs/BlockCutoffSwitchBase.java | 2 +- .../realgrid/blocks/cutoffs/TileEntityCutoffSwitch.java | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/micatechnologies/realgrid/blocks/cutoffs/BlockCutoffSwitchBase.java b/src/main/java/com/micatechnologies/realgrid/blocks/cutoffs/BlockCutoffSwitchBase.java index caa3b48..b4db65e 100644 --- a/src/main/java/com/micatechnologies/realgrid/blocks/cutoffs/BlockCutoffSwitchBase.java +++ b/src/main/java/com/micatechnologies/realgrid/blocks/cutoffs/BlockCutoffSwitchBase.java @@ -81,7 +81,7 @@ protected BlockCutoffSwitchBase(String registryName) setResistance(15.0f); setDefaultState(blockState.getBaseState() .withProperty(FACING, EnumFacing.NORTH) - .withProperty(ACTIVE, false)); + .withProperty(ACTIVE, true)); RealGridRegistry.registerBlock(this); } diff --git a/src/main/java/com/micatechnologies/realgrid/blocks/cutoffs/TileEntityCutoffSwitch.java b/src/main/java/com/micatechnologies/realgrid/blocks/cutoffs/TileEntityCutoffSwitch.java index cd86dd4..fb713b5 100644 --- a/src/main/java/com/micatechnologies/realgrid/blocks/cutoffs/TileEntityCutoffSwitch.java +++ b/src/main/java/com/micatechnologies/realgrid/blocks/cutoffs/TileEntityCutoffSwitch.java @@ -313,7 +313,7 @@ public void applyStateChange() { // Secondary render guarantee using non-IE-reserved event IDs. world.addBlockEvent(getPos(), getBlockType(), - active ? EVENT_OPEN : EVENT_CLOSE, 0); + active ? EVENT_CLOSE : EVENT_OPEN, 0); } } finally { stateChanging = false; @@ -352,7 +352,7 @@ public boolean hammerUseSide(EnumFacing side, EntityPlayer player, @Override public boolean receiveClientEvent(int id, int arg) { if (id == EVENT_OPEN || id == EVENT_CLOSE) { - this.active = (id == EVENT_OPEN); + this.active = (id == EVENT_CLOSE); if (world != null) { world.markBlockRangeForRenderUpdate(pos, pos); } @@ -366,7 +366,12 @@ public boolean receiveClientEvent(int id, int arg) { // ----------------------------------------------------------------------- public boolean isRedstonePowered() { + // Only poll the four faces that are NOT the switch's output faces (facing / + // facing.getOpposite()). Polling those two faces reads back the switch's own + // redstone output (canProvidePower=true), creating a feedback loop that forces + // the switch permanently open on every tick. for (EnumFacing side : EnumFacing.VALUES) { + if (side == facing || side == facing.getOpposite()) continue; if (world.getRedstonePower(pos.offset(side), side) > 0) return true; } return false;