Skip to content

Commit edd208f

Browse files
committed
Try even harder not to loop
Another try at #382
1 parent 8da2ba0 commit edd208f

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/main/java/org/dave/compactmachines3/block/BlockBaseTunnel.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ public void neighborChanged(IBlockState state, World world, BlockPos pos, Block
7474
return;
7575
}
7676

77+
BaseTileEntityTunnel tunnel = (BaseTileEntityTunnel)world.getTileEntity(pos);
78+
if(tunnel.alreadyNotifiedOnTick) {
79+
return;
80+
}
81+
82+
tunnel.alreadyNotifiedOnTick = true;
7783
notifyOverworldNeighbor(pos);
7884
}
7985

src/main/java/org/dave/compactmachines3/tile/BaseTileEntityTunnel.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import net.minecraft.item.ItemStack;
55
import net.minecraft.tileentity.TileEntity;
66
import net.minecraft.util.EnumFacing;
7+
import net.minecraft.util.ITickable;
78
import net.minecraft.util.math.BlockPos;
89
import net.minecraft.world.WorldServer;
910
import org.dave.compactmachines3.block.BlockTunnel;
@@ -12,7 +13,9 @@
1213
import org.dave.compactmachines3.world.tools.DimensionTools;
1314
import org.dave.compactmachines3.world.tools.StructureTools;
1415

15-
public class BaseTileEntityTunnel extends TileEntity {
16+
public class BaseTileEntityTunnel extends TileEntity implements ITickable {
17+
public boolean alreadyNotifiedOnTick;
18+
1619
public EnumFacing getMachineSide() {
1720
return this.getWorld().getBlockState(this.getPos()).getValue(BlockTunnel.MACHINE_SIDE);
1821
}
@@ -34,4 +37,9 @@ public ItemStack getConnectedPickBlock() {
3437
IBlockState state = realWorld.getBlockState(outsetPos);
3538
return state.getBlock().getItem(world, outsetPos, state);
3639
}
40+
41+
@Override
42+
public void update() {
43+
alreadyNotifiedOnTick = false;
44+
}
3745
}

0 commit comments

Comments
 (0)