This commit is contained in:
Raoul Van den Berge
2016-05-15 22:05:22 +02:00
parent b4109cd70b
commit b59c36da07
3 changed files with 20 additions and 3 deletions

View File

@@ -20,8 +20,7 @@ public class ControllerSearcher {
if (tile instanceof TileController) { if (tile instanceof TileController) {
return (TileController) tile; return (TileController) tile;
} else if (tile instanceof TileMachine) { } else if (tile instanceof TileMachine) {
// We need to have visited more than 1 tile so that the relay can find a controller for itself if (visited.size() > 1 && tile instanceof TileRelay && !((TileRelay) tile).mayUpdate()) {
if (visited.size() > 1 && tile instanceof TileRelay && !((TileRelay) tile).isConnected()) {
return null; return null;
} }

View File

@@ -104,7 +104,12 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
super.update(); super.update();
if (!worldObj.isRemote) { if (!worldObj.isRemote) {
machines.addAll(machinesToAdd); // Prevent cache from re-adding the block
for (TileMachine machine : machinesToAdd) {
if (!machines.contains(machine)) {
machines.add(machine);
}
}
machinesToAdd.clear(); machinesToAdd.clear();
machines.removeAll(machinesToRemove); machines.removeAll(machinesToRemove);

View File

@@ -1,10 +1,13 @@
package refinedstorage.tile; package refinedstorage.tile;
import net.minecraft.inventory.Container; import net.minecraft.inventory.Container;
import refinedstorage.RefinedStorageBlocks;
import refinedstorage.container.ContainerRelay; import refinedstorage.container.ContainerRelay;
import refinedstorage.tile.config.RedstoneMode; import refinedstorage.tile.config.RedstoneMode;
public class TileRelay extends TileMachine { public class TileRelay extends TileMachine {
private boolean couldUpdate;
public TileRelay() { public TileRelay() {
this.redstoneMode = RedstoneMode.LOW; this.redstoneMode = RedstoneMode.LOW;
} }
@@ -18,6 +21,16 @@ public class TileRelay extends TileMachine {
public void updateMachine() { public void updateMachine() {
} }
public void update() {
super.update();
if (connected && couldUpdate != mayUpdate()) {
couldUpdate = mayUpdate();
worldObj.notifyNeighborsOfStateChange(pos, RefinedStorageBlocks.RELAY);
}
}
@Override @Override
public Class<? extends Container> getContainer() { public Class<? extends Container> getContainer() {
return ContainerRelay.class; return ContainerRelay.class;