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
|
@ -71,8 +71,8 @@ public abstract class TileEntityRSPanel extends TileEntityGeneralCP implements I
|
||||||
protected void markRSDirty() {
|
protected void markRSDirty() {
|
||||||
dirty = true;
|
dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void inputUpdate(byte[] newIn) {
|
protected void onInputChanged(byte[] newIn) {
|
||||||
if (!Arrays.equals(currInput, newIn)) {
|
if (!Arrays.equals(currInput, newIn)) {
|
||||||
ControlPanelNetwork.RSChannelState[] newStates = new ControlPanelNetwork.RSChannelState[16];
|
ControlPanelNetwork.RSChannelState[] newStates = new ControlPanelNetwork.RSChannelState[16];
|
||||||
for (byte i = 0; i < 16; i++) {
|
for (byte i = 0; i < 16; i++) {
|
||||||
|
@ -90,7 +90,7 @@ public abstract class TileEntityRSPanel extends TileEntityGeneralCP implements I
|
||||||
@Override
|
@Override
|
||||||
public void setNetworkAndInit(ControlPanelNetwork newNet) {
|
public void setNetworkAndInit(ControlPanelNetwork newNet) {
|
||||||
super.setNetworkAndInit(newNet);
|
super.setNetworkAndInit(newNet);
|
||||||
inputUpdate(currInput);
|
onInputChanged(currInput);
|
||||||
Consumer<ControlPanelNetwork.RSChannelState> listener = state -> {
|
Consumer<ControlPanelNetwork.RSChannelState> listener = state -> {
|
||||||
if (out[state.getColor()] != state.getStrength()) {
|
if (out[state.getColor()] != state.getStrength()) {
|
||||||
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 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;
|
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 {
|
implements IRedstoneConnector, IEBlockInterfaces.IDirectionalTile, IBlockBoundsIW {
|
||||||
private EnumFacing facing = EnumFacing.NORTH;
|
private EnumFacing facing = EnumFacing.NORTH;
|
||||||
@Nonnull
|
@Nonnull
|
||||||
|
@ -65,6 +65,11 @@ public class TileEntityRSPanelIE extends TileEntityRSPanel//TODO what parts of T
|
||||||
wireNetwork.updateValues();
|
wireNetwork.updateValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void updateInput() {
|
||||||
|
updateInput(wireNetwork.channelValues);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setNetwork(@Nonnull RedstoneWireNetwork net) {
|
public void setNetwork(@Nonnull RedstoneWireNetwork net) {
|
||||||
wireNetwork = net;
|
wireNetwork = net;
|
||||||
|
@ -78,7 +83,7 @@ public class TileEntityRSPanelIE extends TileEntityRSPanel//TODO what parts of T
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onChange() {
|
public void onChange() {
|
||||||
inputUpdate(wireNetwork.channelValues);
|
onInputChanged(wireNetwork.channelValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -44,19 +44,20 @@ public class TileEntityRSPanelOthers extends TileEntityRSPanel implements IBundl
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void updateInput() {
|
public void updateInput() {
|
||||||
byte[] data = new byte[16];
|
byte[] data = new byte[16];
|
||||||
for (EnumFacing f:EnumFacing.VALUES) {
|
for (EnumFacing f:EnumFacing.VALUES) {
|
||||||
byte[] tmp = Compat.getBundledRS.run(world, pos, f);
|
byte[] tmp = Compat.getBundledRS.run(world, pos, f);
|
||||||
if (tmp!=null) {
|
if (tmp!=null) {
|
||||||
for (int i = 0;i<16;i++) {
|
for (int i = 0; i<16; i++) {
|
||||||
if (tmp[i]>data[i]) {
|
if (tmp[i]>data[i]) {
|
||||||
data[i] = tmp[i];
|
data[i] = tmp[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
inputUpdate(data);
|
onInputChanged(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class Compat {
|
||||||
byte[] prIn = ProjectRedAPI.transmissionAPI.getBundledInput(w, p, f);
|
byte[] prIn = ProjectRedAPI.transmissionAPI.getBundledInput(w, p, f);
|
||||||
if (prIn!=null) {
|
if (prIn!=null) {
|
||||||
for (int i = 0; i < 16; i++) {
|
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;
|
return oldIn;
|
||||||
|
|
Loading…
Reference in a new issue