mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-26 08:48:34 +01:00
Tiles now save that they're powered by redstone so that they won't be unpowered on re-entering chunks
This commit is contained in:
parent
eb88a33b03
commit
94f84d68b1
2 changed files with 4 additions and 1 deletions
|
@ -125,10 +125,11 @@ public abstract class BlockContainerBase extends BlockContainer{
|
||||||
this.updateRedstoneState(world, x, y, z);
|
this.updateRedstoneState(world, x, y, z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateRedstoneState(World world, int x, int y, int z){
|
public void updateRedstoneState(World world, int x, int y, int z){
|
||||||
TileEntity tile = world.getTileEntity(x, y, z);
|
TileEntity tile = world.getTileEntity(x, y, z);
|
||||||
if(tile instanceof TileEntityBase){
|
if(tile instanceof TileEntityBase){
|
||||||
((TileEntityBase)tile).setRedstonePowered(world.isBlockIndirectlyGettingPowered(x, y, z));
|
((TileEntityBase)tile).setRedstonePowered(world.isBlockIndirectlyGettingPowered(x, y, z));
|
||||||
|
tile.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,12 +76,14 @@ public abstract class TileEntityBase extends TileEntity{
|
||||||
@Override
|
@Override
|
||||||
public final void readFromNBT(NBTTagCompound compound){
|
public final void readFromNBT(NBTTagCompound compound){
|
||||||
super.readFromNBT(compound);
|
super.readFromNBT(compound);
|
||||||
|
this.isRedstonePowered = compound.getBoolean("Redstone");
|
||||||
this.readSyncableNBT(compound, false);
|
this.readSyncableNBT(compound, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void writeToNBT(NBTTagCompound compound){
|
public final void writeToNBT(NBTTagCompound compound){
|
||||||
super.writeToNBT(compound);
|
super.writeToNBT(compound);
|
||||||
|
compound.setBoolean("Redstone", this.isRedstonePowered);
|
||||||
this.writeSyncableNBT(compound, false);
|
this.writeSyncableNBT(compound, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue