Fix relays
This commit is contained in:
@@ -53,10 +53,15 @@ public interface INetworkNode {
|
||||
boolean isConnected();
|
||||
|
||||
/**
|
||||
* @return If {@link INetworkNode#canUpdate()} can get called. Typically checks for connection status and redstone mode.
|
||||
* @return If {@link INetworkNode#canUpdate()} can get called, typically checks for connection status and redstone mode
|
||||
*/
|
||||
boolean canUpdate();
|
||||
|
||||
/**
|
||||
* @return Whether this node can conduct a network signal
|
||||
*/
|
||||
boolean canConduct();
|
||||
|
||||
/**
|
||||
* @return The network
|
||||
*/
|
||||
|
||||
@@ -45,15 +45,15 @@ public abstract class TileNode extends TileBase implements INetworkNode, ISynchr
|
||||
onConnectionChange(network, update);
|
||||
}
|
||||
|
||||
if (isActive()) {
|
||||
updateNode();
|
||||
}
|
||||
|
||||
if (active != isActive() && canSendConnectivityUpdate()) {
|
||||
RefinedStorageUtils.updateBlock(worldObj, pos);
|
||||
|
||||
active = isActive();
|
||||
}
|
||||
|
||||
if (isActive()) {
|
||||
updateNode();
|
||||
}
|
||||
}
|
||||
|
||||
super.update();
|
||||
@@ -80,6 +80,11 @@ public abstract class TileNode extends TileBase implements INetworkNode, ISynchr
|
||||
// NO OP
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConduct() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public INetworkMaster getNetwork() {
|
||||
return network;
|
||||
|
||||
@@ -2,7 +2,6 @@ package refinedstorage.tile;
|
||||
|
||||
import net.minecraft.inventory.Container;
|
||||
import refinedstorage.RefinedStorage;
|
||||
import refinedstorage.RefinedStorageBlocks;
|
||||
import refinedstorage.container.ContainerRelay;
|
||||
import refinedstorage.tile.config.RedstoneMode;
|
||||
|
||||
@@ -25,13 +24,18 @@ public class TileRelay extends TileNode {
|
||||
public void update() {
|
||||
super.update();
|
||||
|
||||
if (connected && couldUpdate != canUpdate()) {
|
||||
if (network != null && couldUpdate != canUpdate()) {
|
||||
couldUpdate = canUpdate();
|
||||
|
||||
worldObj.notifyNeighborsOfStateChange(pos, RefinedStorageBlocks.RELAY);
|
||||
network.rebuildNodes();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConduct() {
|
||||
return canUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends Container> getContainer() {
|
||||
return ContainerRelay.class;
|
||||
|
||||
@@ -383,8 +383,10 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
Queue<BlockPos> toCheck = new ArrayDeque<BlockPos>();
|
||||
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
checked.add(pos.offset(facing));
|
||||
toCheck.add(pos.offset(facing));
|
||||
BlockPos pos = this.pos.offset(facing);
|
||||
|
||||
checked.add(pos);
|
||||
toCheck.add(pos);
|
||||
}
|
||||
|
||||
BlockPos currentPos;
|
||||
@@ -397,14 +399,16 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR
|
||||
|
||||
INetworkNode node = tile.getCapability(RefinedStorageCapabilities.NETWORK_NODE_CAPABILITY, null);
|
||||
|
||||
// @TODO: Care about relays
|
||||
|
||||
newNodes.add(node);
|
||||
newNodesPos.add(node.getPosition());
|
||||
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
if (checked.add(currentPos.offset(facing))) {
|
||||
toCheck.add(currentPos.offset(facing));
|
||||
if (node.canConduct()) {
|
||||
for (EnumFacing facing : EnumFacing.VALUES) {
|
||||
BlockPos pos = currentPos.offset(facing);
|
||||
|
||||
if (checked.add(pos)) {
|
||||
toCheck.add(pos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user