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) {
return (TileController) tile;
} 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).isConnected()) {
if (visited.size() > 1 && tile instanceof TileRelay && !((TileRelay) tile).mayUpdate()) {
return null;
}

View File

@@ -104,7 +104,12 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
super.update();
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();
machines.removeAll(machinesToRemove);

View File

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