mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 23:28:35 +01:00
Increased ESD performance by making it remember the tiles around
This commit is contained in:
parent
91ca5aa4a1
commit
b8051e6483
6 changed files with 18 additions and 8 deletions
|
@ -90,6 +90,16 @@ public class BlockInputter extends BlockContainerBase{
|
||||||
return EnumRarity.EPIC;
|
return EnumRarity.EPIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block){
|
||||||
|
if(!world.isRemote){
|
||||||
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
|
if(tile instanceof TileEntityInputter){
|
||||||
|
((TileEntityInputter)tile).initVars();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static class TheItemBlock extends ItemBlockBase{
|
public static class TheItemBlock extends ItemBlockBase{
|
||||||
|
|
||||||
private long lastSysTime;
|
private long lastSysTime;
|
||||||
|
|
|
@ -40,7 +40,6 @@ public class BlockItemViewer extends BlockContainerBase{
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityItemViewer){
|
if(tile instanceof TileEntityItemViewer){
|
||||||
((TileEntityItemViewer)tile).saveConnectedRelay();
|
((TileEntityItemViewer)tile).saveConnectedRelay();
|
||||||
System.out.println("------------Saving connected on change " + ((TileEntityItemViewer)tile).connectedRelay);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,11 +118,10 @@ public class BlockLaserRelay extends BlockContainerBase{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block){
|
public void neighborChanged(IBlockState state, World world, BlockPos pos, Block block){
|
||||||
if(!world.isRemote){
|
if((this.type == Type.ITEM || this.type == Type.ITEM_WHITELIST) && !world.isRemote){
|
||||||
TileEntity tile = world.getTileEntity(pos);
|
TileEntity tile = world.getTileEntity(pos);
|
||||||
if(tile instanceof TileEntityLaserRelayItem){
|
if(tile instanceof TileEntityLaserRelayItem){
|
||||||
((TileEntityLaserRelayItem)tile).saveAllHandlersAround();
|
((TileEntityLaserRelayItem)tile).saveAllHandlersAround();
|
||||||
System.out.println("------------Saving around on change " + ((TileEntityLaserRelayItem)tile).handlersAround);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,8 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
private boolean lastPullWhite;
|
private boolean lastPullWhite;
|
||||||
private boolean lastPutWhite;
|
private boolean lastPutWhite;
|
||||||
|
|
||||||
|
private boolean hasCheckedTilesAround;
|
||||||
|
|
||||||
public TileEntityInputter(int slots, String name){
|
public TileEntityInputter(int slots, String name){
|
||||||
super(slots, name);
|
super(slots, name);
|
||||||
}
|
}
|
||||||
|
@ -348,6 +350,7 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
}
|
}
|
||||||
|
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
|
this.initVars();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -380,7 +383,10 @@ public class TileEntityInputter extends TileEntityInventoryBase implements IButt
|
||||||
public void updateEntity(){
|
public void updateEntity(){
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if(!this.worldObj.isRemote){
|
if(!this.worldObj.isRemote){
|
||||||
|
if(!this.hasCheckedTilesAround){
|
||||||
this.initVars();
|
this.initVars();
|
||||||
|
this.hasCheckedTilesAround = true;
|
||||||
|
}
|
||||||
|
|
||||||
//Is Block not powered by Redstone?
|
//Is Block not powered by Redstone?
|
||||||
if(!this.isRedstonePowered){
|
if(!this.isRedstonePowered){
|
||||||
|
|
|
@ -38,8 +38,6 @@ public class TileEntityItemViewer extends TileEntityInventoryBase{
|
||||||
if(!this.worldObj.isRemote && !this.hasCheckedRelayOnLoad){
|
if(!this.worldObj.isRemote && !this.hasCheckedRelayOnLoad){
|
||||||
this.saveConnectedRelay();
|
this.saveConnectedRelay();
|
||||||
this.hasCheckedRelayOnLoad = true;
|
this.hasCheckedRelayOnLoad = true;
|
||||||
|
|
||||||
System.out.println("------------Saving relay on load " + this.connectedRelay);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,8 +48,6 @@ public class TileEntityLaserRelayItem extends TileEntityLaserRelay{
|
||||||
if(!this.worldObj.isRemote && !this.hasCheckedHandlersOnLoad){
|
if(!this.worldObj.isRemote && !this.hasCheckedHandlersOnLoad){
|
||||||
this.saveAllHandlersAround();
|
this.saveAllHandlersAround();
|
||||||
this.hasCheckedHandlersOnLoad = true;
|
this.hasCheckedHandlersOnLoad = true;
|
||||||
|
|
||||||
System.out.println("------------Saving around on load " + this.handlersAround);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue