Fix the "other" RS controller not keeping its IO state across world reloads
Fix P:R wires showing as a too low signal strength
This commit is contained in:
parent
961b325111
commit
2f02fc5044
|
@ -72,7 +72,7 @@ public abstract class TileEntityRSPanel extends TileEntityGeneralCP implements I
|
|||
dirty = true;
|
||||
}
|
||||
|
||||
protected void inputUpdate(byte[] newIn) {
|
||||
protected void onInputChanged(byte[] newIn) {
|
||||
if (!Arrays.equals(currInput, newIn)) {
|
||||
ControlPanelNetwork.RSChannelState[] newStates = new ControlPanelNetwork.RSChannelState[16];
|
||||
for (byte i = 0; i < 16; i++) {
|
||||
|
@ -90,7 +90,7 @@ public abstract class TileEntityRSPanel extends TileEntityGeneralCP implements I
|
|||
@Override
|
||||
public void setNetworkAndInit(ControlPanelNetwork newNet) {
|
||||
super.setNetworkAndInit(newNet);
|
||||
inputUpdate(currInput);
|
||||
onInputChanged(currInput);
|
||||
Consumer<ControlPanelNetwork.RSChannelState> listener = state -> {
|
||||
if (out[state.getColor()] != state.getStrength()) {
|
||||
out[state.getColor()] = state.getStrength();
|
||||
|
@ -118,4 +118,15 @@ public abstract class TileEntityRSPanel extends TileEntityGeneralCP implements I
|
|||
|
||||
|
||||
protected abstract void updateOutput();
|
||||
|
||||
protected abstract void updateInput();
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
super.onLoad();
|
||||
if (!world.isRemote) {
|
||||
updateInput();
|
||||
updateOutput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import javax.annotation.Nullable;
|
|||
|
||||
import static blusunrize.immersiveengineering.api.energy.wires.WireType.REDSTONE_CATEGORY;
|
||||
|
||||
public class TileEntityRSPanelIE extends TileEntityRSPanel//TODO what parts of TEIIC do I need?
|
||||
public class TileEntityRSPanelIE extends TileEntityRSPanel
|
||||
implements IRedstoneConnector, IEBlockInterfaces.IDirectionalTile, IBlockBoundsIW {
|
||||
private EnumFacing facing = EnumFacing.NORTH;
|
||||
@Nonnull
|
||||
|
@ -65,6 +65,11 @@ public class TileEntityRSPanelIE extends TileEntityRSPanel//TODO what parts of T
|
|||
wireNetwork.updateValues();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateInput() {
|
||||
updateInput(wireNetwork.channelValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNetwork(@Nonnull RedstoneWireNetwork net) {
|
||||
wireNetwork = net;
|
||||
|
@ -78,7 +83,7 @@ public class TileEntityRSPanelIE extends TileEntityRSPanel//TODO what parts of T
|
|||
|
||||
@Override
|
||||
public void onChange() {
|
||||
inputUpdate(wireNetwork.channelValues);
|
||||
onInputChanged(wireNetwork.channelValues);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -44,6 +44,7 @@ public class TileEntityRSPanelOthers extends TileEntityRSPanel implements IBundl
|
|||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateInput() {
|
||||
byte[] data = new byte[16];
|
||||
for (EnumFacing f:EnumFacing.VALUES) {
|
||||
|
@ -56,7 +57,7 @@ public class TileEntityRSPanelOthers extends TileEntityRSPanel implements IBundl
|
|||
}
|
||||
}
|
||||
}
|
||||
inputUpdate(data);
|
||||
onInputChanged(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -191,7 +191,7 @@ public class Compat {
|
|||
byte[] prIn = ProjectRedAPI.transmissionAPI.getBundledInput(w, p, f);
|
||||
if (prIn!=null) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
oldIn[i] = (byte)((prIn[i]&255)/17);
|
||||
oldIn[i] = (byte) Math.ceil((prIn[i] & 255) / 17.0);
|
||||
}
|
||||
}
|
||||
return oldIn;
|
||||
|
|
Loading…
Reference in a new issue