Better fix
This commit is contained in:
@@ -24,7 +24,7 @@ public class MessageMachineConnectedUpdate implements IMessage, IMessageHandler<
|
||||
this.x = machine.getPos().getX();
|
||||
this.y = machine.getPos().getY();
|
||||
this.z = machine.getPos().getZ();
|
||||
this.connected = machine.isConnected();
|
||||
this.connected = machine.isConnected() && machine.mayUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -119,6 +119,9 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
|
||||
|
||||
if (canRun()) {
|
||||
for (TileMachine machine : machines) {
|
||||
if (!machine.mayUpdate()) {
|
||||
continue;
|
||||
}
|
||||
machine.updateMachine();
|
||||
|
||||
if (machine instanceof TileWirelessTransmitter) {
|
||||
@@ -618,22 +621,25 @@ public class TileController extends TileBase implements IEnergyReceiver, ISynchr
|
||||
List<ClientSideMachine> m = new ArrayList<ClientSideMachine>();
|
||||
|
||||
for (TileMachine machine : machines) {
|
||||
IBlockState state = worldObj.getBlockState(machine.getPos());
|
||||
if (machine.mayUpdate()) {
|
||||
IBlockState state = worldObj.getBlockState(machine.getPos());
|
||||
|
||||
ClientSideMachine clientMachine = new ClientSideMachine();
|
||||
ClientSideMachine clientMachine = new ClientSideMachine();
|
||||
|
||||
clientMachine.energyUsage = machine.getEnergyUsage();
|
||||
clientMachine.amount = 1;
|
||||
clientMachine.stack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
|
||||
clientMachine.energyUsage = machine.getEnergyUsage();
|
||||
clientMachine.amount = 1;
|
||||
clientMachine.stack = new ItemStack(state.getBlock(), 1, state.getBlock().getMetaFromState(state));
|
||||
|
||||
if (m.contains(clientMachine)) {
|
||||
for (ClientSideMachine other : m) {
|
||||
if (other.equals(clientMachine)) {
|
||||
other.amount++;
|
||||
if (m.contains(clientMachine)) {
|
||||
for (ClientSideMachine other : m) {
|
||||
if (other.equals(clientMachine)) {
|
||||
other.amount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m.add(clientMachine);
|
||||
}
|
||||
} else {
|
||||
m.add(clientMachine);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,6 @@ public abstract class TileMachine extends TileBase implements ISynchronizedConta
|
||||
} else {
|
||||
if (newController == null) {
|
||||
onDisconnected(world);
|
||||
} else {
|
||||
connected = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -77,16 +75,16 @@ public abstract class TileMachine extends TileBase implements ISynchronizedConta
|
||||
}
|
||||
}
|
||||
|
||||
if (connected && !redstoneMode.isEnabled(worldObj, pos)) {
|
||||
onDisconnected(worldObj, false);
|
||||
}
|
||||
|
||||
if (!(this instanceof TileCable)) {
|
||||
RefinedStorageUtils.sendToAllAround(worldObj, pos, new MessageMachineConnectedUpdate(this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean mayUpdate() {
|
||||
return redstoneMode.isEnabled(worldObj, pos);
|
||||
}
|
||||
|
||||
public void onConnected(World world, TileController controller) {
|
||||
if (tryConnect(controller)) {
|
||||
world.notifyNeighborsOfStateChange(pos, block);
|
||||
@@ -107,13 +105,9 @@ public abstract class TileMachine extends TileBase implements ISynchronizedConta
|
||||
}
|
||||
|
||||
public void onDisconnected(World world) {
|
||||
onDisconnected(world, true);
|
||||
}
|
||||
|
||||
public void onDisconnected(World world, boolean removeController) {
|
||||
this.connected = false;
|
||||
|
||||
if (removeController && this.controller != null) {
|
||||
if (this.controller != null) {
|
||||
this.controller.removeMachine(this);
|
||||
this.controller = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user