Don't interact with other TE's in onChunkUnload, closes #12
(Ported from 1.11)
This commit is contained in:
parent
ea2355de28
commit
fdacf4129f
9 changed files with 9 additions and 15 deletions
|
@ -57,6 +57,7 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
public boolean firstTick = true;
|
public boolean firstTick = true;
|
||||||
// non-rendered properties
|
// non-rendered properties
|
||||||
private Set<TileEntityRSPanelConn> rsPorts = new HashSet<>();
|
private Set<TileEntityRSPanelConn> rsPorts = new HashSet<>();
|
||||||
|
private boolean renderUpdate;
|
||||||
|
|
||||||
{
|
{
|
||||||
int[] colors = {
|
int[] colors = {
|
||||||
|
@ -99,6 +100,13 @@ public class TileEntityPanel extends TileEntityIWBase implements IDirectionalTil
|
||||||
}
|
}
|
||||||
firstTick = false;
|
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() {
|
public void triggerRenderUpdate() {
|
||||||
IBlockState state = world.getBlockState(pos);
|
renderUpdate = true;
|
||||||
world.notifyBlockUpdate(pos, state, state, 3);
|
|
||||||
world.addBlockEvent(pos, state.getBlock(), 255, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void registerRS(TileEntityRSPanelConn te) {
|
public void registerRS(TileEntityRSPanelConn te) {
|
||||||
|
|
|
@ -67,7 +67,6 @@ public class CoveredToggleSwitch extends ToggleSwitch {
|
||||||
state = state.next();
|
state = state.next();
|
||||||
}
|
}
|
||||||
setOut(state.active, tile);
|
setOut(state.active, tile);
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -124,7 +124,6 @@ public class IndicatorLight extends PanelComponent implements IConfigurableCompo
|
||||||
private Consumer<byte[]> handler = (input) -> {
|
private Consumer<byte[]> handler = (input) -> {
|
||||||
if (input[rsInputChannel] != rsInput) {
|
if (input[rsInputChannel] != rsInput) {
|
||||||
rsInput = input[rsInputChannel];
|
rsInput = input[rsInputChannel];
|
||||||
panel.markDirty();
|
|
||||||
panel.triggerRenderUpdate();
|
panel.triggerRenderUpdate();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -123,7 +123,6 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
||||||
ticksTillOff = 10;
|
ticksTillOff = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,7 +162,6 @@ public class LightedButton extends PanelComponent implements IConfigurableCompon
|
||||||
|
|
||||||
private void setOut(boolean on, TileEntityPanel tile) {
|
private void setOut(boolean on, TileEntityPanel tile) {
|
||||||
active = on;
|
active = on;
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
setOut(rsOutputChannel, active ? 15 : 0);
|
setOut(rsOutputChannel, active ? 15 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -197,7 +197,6 @@ public class Lock extends PanelComponent implements IConfigurableComponent {
|
||||||
ticksTillOff = 10;
|
ticksTillOff = 10;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +207,6 @@ public class Lock extends PanelComponent implements IConfigurableComponent {
|
||||||
tile.markDirty();
|
tile.markDirty();
|
||||||
if (ticksTillOff == 0) {
|
if (ticksTillOff == 0) {
|
||||||
turned = false;
|
turned = false;
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
setOut(tile);
|
setOut(tile);
|
||||||
}
|
}
|
||||||
|
@ -245,7 +243,6 @@ public class Lock extends PanelComponent implements IConfigurableComponent {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setOut(TileEntityPanel tile) {
|
private void setOut(TileEntityPanel tile) {
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
setOut(rsOutputChannel, turned ? 15 : 0);
|
setOut(rsOutputChannel, turned ? 15 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -192,7 +192,6 @@ public class PanelMeter extends PanelComponent implements IConfigurableComponent
|
||||||
private Consumer<byte[]> handler = (input) -> {
|
private Consumer<byte[]> handler = (input) -> {
|
||||||
if (input[rsInputChannel] != rsInput) {
|
if (input[rsInputChannel] != rsInput) {
|
||||||
rsInput = input[rsInputChannel];
|
rsInput = input[rsInputChannel];
|
||||||
panel.markDirty();
|
|
||||||
panel.triggerRenderUpdate();
|
panel.triggerRenderUpdate();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -134,7 +134,6 @@ public class Slider extends PanelComponent implements IConfigurableComponent {
|
||||||
if (newLevel != out) {
|
if (newLevel != out) {
|
||||||
setOut(rsChannel, newLevel);
|
setOut(rsChannel, newLevel);
|
||||||
out = newLevel;
|
out = newLevel;
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -119,7 +119,6 @@ public class ToggleSwitch extends PanelComponent implements IConfigurableCompone
|
||||||
@Override
|
@Override
|
||||||
public void interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) {
|
public void interactWith(Vec3d hitRel, TileEntityPanel tile, EntityPlayerMP player) {
|
||||||
setOut(!active, tile);
|
setOut(!active, tile);
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +165,6 @@ public class ToggleSwitch extends PanelComponent implements IConfigurableCompone
|
||||||
|
|
||||||
protected void setOut(boolean on, TileEntityPanel tile) {
|
protected void setOut(boolean on, TileEntityPanel tile) {
|
||||||
active = on;
|
active = on;
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
setOut(rsOutputChannel, active ? 15 : 0);
|
setOut(rsOutputChannel, active ? 15 : 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -152,7 +152,6 @@ public class Variac extends PanelComponent implements IConfigurableComponent {
|
||||||
if (newLevel != out) {
|
if (newLevel != out) {
|
||||||
setOut(rsChannel, newLevel);
|
setOut(rsChannel, newLevel);
|
||||||
out = newLevel;
|
out = newLevel;
|
||||||
tile.markDirty();
|
|
||||||
tile.triggerRenderUpdate();
|
tile.triggerRenderUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue