Don't interact with other TE's in onChunkUnload, closes #12
(back-ported from 1.11)
This commit is contained in:
parent
2b8263308f
commit
78e468dec8
|
@ -57,6 +57,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
|||
public boolean firstTick = true;
|
||||
// non-rendered properties
|
||||
private Set<TileEntityRSPanelConn> rsPorts = new HashSet<>();
|
||||
private boolean renderUpdate;
|
||||
|
||||
{
|
||||
for (int i = 2; i < 14; i++) {
|
||||
|
@ -100,6 +101,13 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
|||
}
|
||||
firstTick = false;
|
||||
}
|
||||
if (renderUpdate) {
|
||||
IBlockState state = worldObj.getBlockState(pos);
|
||||
worldObj.notifyBlockUpdate(pos, state, state, 3);
|
||||
worldObj.addBlockEvent(pos, state.getBlock(), 255, 0);
|
||||
markDirty();
|
||||
renderUpdate = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -278,9 +286,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
|||
}
|
||||
|
||||
public void triggerRenderUpdate() {
|
||||
IBlockState state = worldObj.getBlockState(pos);
|
||||
worldObj.notifyBlockUpdate(pos, state, state, 3);
|
||||
worldObj.addBlockEvent(pos, state.getBlock(), 255, 0);
|
||||
renderUpdate = true;
|
||||
}
|
||||
|
||||
public void registerRS(TileEntityRSPanelConn te) {
|
||||
|
|
|
@ -67,7 +67,6 @@ public class CoveredToggleSwitch extends ToggleSwitch {
|
|||
state = state.next();
|
||||
}
|
||||
setOut(state.active, tile);
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
}
|
||||
|
||||
|
|
|
@ -126,7 +126,6 @@ public class IndicatorLight extends PanelComponent implements IConfigurableCompo
|
|||
private Consumer<byte[]> handler = (input) -> {
|
||||
if (input[rsInputChannel] != rsInput) {
|
||||
rsInput = input[rsInputChannel];
|
||||
panel.markDirty();
|
||||
panel.triggerRenderUpdate();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -125,7 +125,6 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
|||
if (!latching) {
|
||||
ticksTillOff = 10;
|
||||
}
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
}
|
||||
|
||||
|
@ -160,12 +159,11 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
|||
|
||||
@Override
|
||||
public void invalidate(TileEntityPanel te) {
|
||||
setOut(false, te);
|
||||
setOut(rsOutputChannel, 0);
|
||||
}
|
||||
|
||||
private void setOut(boolean on, TileEntityPanel tile) {
|
||||
active = on;
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
setOut(rsOutputChannel, active ? 15 : 0);
|
||||
}
|
||||
|
|
|
@ -196,7 +196,6 @@ public class Lock extends PanelComponent implements IConfigurableComponent {
|
|||
ticksTillOff = 10;
|
||||
}
|
||||
}
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
}
|
||||
|
||||
|
@ -207,7 +206,6 @@ public class Lock extends PanelComponent implements IConfigurableComponent {
|
|||
tile.markDirty();
|
||||
if (ticksTillOff == 0) {
|
||||
turned = false;
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
setOut(tile);
|
||||
}
|
||||
|
@ -240,11 +238,10 @@ public class Lock extends PanelComponent implements IConfigurableComponent {
|
|||
|
||||
@Override
|
||||
public void invalidate(TileEntityPanel te) {
|
||||
setOut(te);
|
||||
setOut(rsOutputChannel, 0);
|
||||
}
|
||||
|
||||
private void setOut(TileEntityPanel tile) {
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
setOut(rsOutputChannel, turned ? 15 : 0);
|
||||
}
|
||||
|
|
|
@ -134,7 +134,6 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
|
|||
if (newLevel != out) {
|
||||
setOut(rsChannel, newLevel);
|
||||
out = newLevel;
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -119,7 +119,6 @@ public class ToggleSwitch extends PanelComponent implements IConfigurableCompone
|
|||
@Override
|
||||
public void interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) {
|
||||
setOut(!active, tile);
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
}
|
||||
|
||||
|
@ -161,12 +160,11 @@ public class ToggleSwitch extends PanelComponent implements IConfigurableCompone
|
|||
|
||||
@Override
|
||||
public void invalidate(TileEntityPanel te) {
|
||||
setOut(false, te);
|
||||
setOut(rsOutputChannel, 0);
|
||||
}
|
||||
|
||||
protected void setOut(boolean on, TileEntityPanel tile) {
|
||||
active = on;
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
setOut(rsOutputChannel, active ? 15 : 0);
|
||||
}
|
||||
|
|
|
@ -152,7 +152,6 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
|
|||
if (newLevel != out) {
|
||||
setOut(rsChannel, newLevel);
|
||||
out = newLevel;
|
||||
tile.markDirty();
|
||||
tile.triggerRenderUpdate();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue