Don't interact with other TE's in onChunkUnload, closes #12

(Ported from 1.11)
This commit is contained in:
malte0811 2017-08-13 22:14:56 +02:00
parent ea2355de28
commit fdacf4129f
9 changed files with 9 additions and 15 deletions

View file

@ -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;
{
int[] colors = {
@ -99,6 +100,13 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
}
firstTick = false;
}
if (renderUpdate) {
IBlockState state = world.getBlockState(pos);
world.notifyBlockUpdate(pos, state, state, 3);
world.addBlockEvent(pos, state.getBlock(), 255, 0);
markDirty();
renderUpdate = false;
}
}
}
@ -281,9 +289,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
}
public void triggerRenderUpdate() {
IBlockState state = world.getBlockState(pos);
world.notifyBlockUpdate(pos, state, state, 3);
world.addBlockEvent(pos, state.getBlock(), 255, 0);
renderUpdate = true;
}
public void registerRS(TileEntityRSPanelConn te) {

View file

@ -67,7 +67,6 @@ public class CoveredToggleSwitch extends ToggleSwitch {
state = state.next();
}
setOut(state.active, tile);
tile.markDirty();
tile.triggerRenderUpdate();
}

View file

@ -124,7 +124,6 @@ public class IndicatorLight extends PanelComponent implements IConfigurableCompo
private Consumer<byte[]> handler = (input) -> {
if (input[rsInputChannel] != rsInput) {
rsInput = input[rsInputChannel];
panel.markDirty();
panel.triggerRenderUpdate();
}
};

View file

@ -123,7 +123,6 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
ticksTillOff = 10;
}
}
tile.markDirty();
tile.triggerRenderUpdate();
}
@ -163,7 +162,6 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
private void setOut(boolean on, TileEntityPanel tile) {
active = on;
tile.markDirty();
tile.triggerRenderUpdate();
setOut(rsOutputChannel, active ? 15 : 0);
}

View file

@ -197,7 +197,6 @@ public class Lock extends PanelComponent implements IConfigurableComponent {
ticksTillOff = 10;
}
}
tile.markDirty();
tile.triggerRenderUpdate();
}
@ -208,7 +207,6 @@ public class Lock extends PanelComponent implements IConfigurableComponent {
tile.markDirty();
if (ticksTillOff == 0) {
turned = false;
tile.markDirty();
tile.triggerRenderUpdate();
setOut(tile);
}
@ -245,7 +243,6 @@ public class Lock extends PanelComponent implements IConfigurableComponent {
}
private void setOut(TileEntityPanel tile) {
tile.markDirty();
tile.triggerRenderUpdate();
setOut(rsOutputChannel, turned ? 15 : 0);
}

View file

@ -192,7 +192,6 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
private Consumer<byte[]> handler = (input) -> {
if (input[rsInputChannel] != rsInput) {
rsInput = input[rsInputChannel];
panel.markDirty();
panel.triggerRenderUpdate();
}
};

View file

@ -134,7 +134,6 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
if (newLevel != out) {
setOut(rsChannel, newLevel);
out = newLevel;
tile.markDirty();
tile.triggerRenderUpdate();
}
}

View file

@ -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();
}
@ -166,7 +165,6 @@ public class ToggleSwitch extends PanelComponent implements IConfigurableCompone
protected void setOut(boolean on, TileEntityPanel tile) {
active = on;
tile.markDirty();
tile.triggerRenderUpdate();
setOut(rsOutputChannel, active ? 15 : 0);
}

View file

@ -152,7 +152,6 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
if (newLevel != out) {
setOut(rsChannel, newLevel);
out = newLevel;
tile.markDirty();
tile.triggerRenderUpdate();
}
}