Backport some 1.8 cleanups

This commit is contained in:
yueh
2015-12-27 12:33:50 +01:00
parent 04b1ca3485
commit a3abc7a1f0
9 changed files with 59 additions and 64 deletions
@@ -102,7 +102,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
this.settings = new ConfigManager( this ); this.settings = new ConfigManager( this );
this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE ); this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.inv.setMaxStackSize( 1 ); this.inv.setMaxStackSize( 1 );
this.getGridProxy().setIdlePowerUsage( 0.0 ); this.getProxy().setIdlePowerUsage( 0.0 );
this.upgrades = new DefinitionUpgradeInventory( assembler, this, this.getUpgradeSlots() ); this.upgrades = new DefinitionUpgradeInventory( assembler, this, this.getUpgradeSlots() );
this.craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 ); this.craftingInv = new InventoryCrafting( new ContainerNull(), 3, 3 );
} }
@@ -152,11 +152,11 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{ {
if( this.isAwake ) if( this.isAwake )
{ {
this.getGridProxy().getTick().wakeDevice( this.getGridProxy().getNode() ); this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
} }
else else
{ {
this.getGridProxy().getTick().sleepDevice( this.getGridProxy().getNode() ); this.getProxy().getTick().sleepDevice( this.getProxy().getNode() );
} }
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
@@ -553,7 +553,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
{ {
try try
{ {
return (int) ( this.getGridProxy().getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax ); return (int) ( this.getProxy().getEnergy().extractAEPower( ticksPassed * bonusValue * acceleratorTax, Actionable.MODULATE, PowerMultiplier.CONFIG ) / acceleratorTax );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -629,7 +629,7 @@ public class TileMolecularAssembler extends AENetworkInvTile implements IUpgrade
try try
{ {
newState = this.getGridProxy().isActive() && this.getGridProxy().getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001; newState = this.getProxy().isActive() && this.getProxy().getEnergy().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.0001;
} }
catch( final GridAccessException ignored ) catch( final GridAccessException ignored )
{ {
@@ -39,19 +39,19 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
@TileEvent( TileEventType.WORLD_NBT_READ ) @TileEvent( TileEventType.WORLD_NBT_READ )
public void readFromNBT_AENetwork( final NBTTagCompound data ) public void readFromNBT_AENetwork( final NBTTagCompound data )
{ {
this.getGridProxy().readFromNBT( data ); this.getProxy().readFromNBT( data );
} }
@TileEvent( TileEventType.WORLD_NBT_WRITE ) @TileEvent( TileEventType.WORLD_NBT_WRITE )
public void writeToNBT_AENetwork( final NBTTagCompound data ) public void writeToNBT_AENetwork( final NBTTagCompound data )
{ {
this.getGridProxy().writeToNBT( data ); this.getProxy().writeToNBT( data );
} }
@Override @Override
public AENetworkProxy getProxy() public AENetworkProxy getProxy()
{ {
return this.getGridProxy(); return this.gridProxy;
} }
@Override @Override
@@ -63,45 +63,40 @@ public abstract class AENetworkInvTile extends AEBaseInvTile implements IActionH
@Override @Override
public IGridNode getGridNode( final ForgeDirection dir ) public IGridNode getGridNode( final ForgeDirection dir )
{ {
return this.getGridProxy().getNode(); return this.getProxy().getNode();
} }
@Override @Override
public void onChunkUnload() public void onChunkUnload()
{ {
super.onChunkUnload(); super.onChunkUnload();
this.getGridProxy().onChunkUnload(); this.getProxy().onChunkUnload();
} }
@Override @Override
public void onReady() public void onReady()
{ {
super.onReady(); super.onReady();
this.getGridProxy().onReady(); this.getProxy().onReady();
} }
@Override @Override
public void invalidate() public void invalidate()
{ {
super.invalidate(); super.invalidate();
this.getGridProxy().invalidate(); this.getProxy().invalidate();
} }
@Override @Override
public void validate() public void validate()
{ {
super.validate(); super.validate();
this.getGridProxy().validate(); this.getProxy().validate();
} }
@Override @Override
public IGridNode getActionableNode() public IGridNode getActionableNode()
{ {
return this.getGridProxy().getNode(); return this.getProxy().getNode();
}
public AENetworkProxy getGridProxy()
{
return this.gridProxy;
} }
} }
@@ -67,7 +67,7 @@ import appeng.util.inv.IInventoryDestination;
public class TileInterface extends AENetworkInvTile implements IGridTickable, ITileStorageMonitorable, IStorageMonitorable, IInventoryDestination, IInterfaceHost, IPriorityHost public class TileInterface extends AENetworkInvTile implements IGridTickable, ITileStorageMonitorable, IStorageMonitorable, IInventoryDestination, IInterfaceHost, IPriorityHost
{ {
private final DualityInterface duality = new DualityInterface( this.getGridProxy(), this ); private final DualityInterface duality = new DualityInterface( this.getProxy(), this );
private ForgeDirection pointAt = ForgeDirection.UNKNOWN; private ForgeDirection pointAt = ForgeDirection.UNKNOWN;
@MENetworkEventSubscribe @MENetworkEventSubscribe
@@ -115,7 +115,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
this.setOrientation( this.pointAt.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP, this.pointAt.getOpposite() ); this.setOrientation( this.pointAt.offsetY != 0 ? ForgeDirection.SOUTH : ForgeDirection.UP, this.pointAt.getOpposite() );
} }
this.getGridProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) ); this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
this.markForUpdate(); this.markForUpdate();
this.markDirty(); this.markDirty();
} }
@@ -141,7 +141,7 @@ public class TileInterface extends AENetworkInvTile implements IGridTickable, IT
@Override @Override
public void onReady() public void onReady()
{ {
this.getGridProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) ); this.getProxy().setValidSides( EnumSet.complementOf( EnumSet.of( this.pointAt ) ) );
super.onReady(); super.onReady();
this.duality.initialize(); this.duality.initialize();
} }
@@ -66,8 +66,8 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
public TileVibrationChamber() public TileVibrationChamber()
{ {
this.getGridProxy().setIdlePowerUsage( 0 ); this.getProxy().setIdlePowerUsage( 0 );
this.getGridProxy().setFlags(); this.getProxy().setFlags();
} }
@Override @Override
@@ -131,7 +131,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
{ {
try try
{ {
this.getGridProxy().getTick().wakeDevice( this.getGridProxy().getNode() ); this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -213,7 +213,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
try try
{ {
final IEnergyGrid grid = this.getGridProxy().getEnergy(); final IEnergyGrid grid = this.getProxy().getEnergy();
final double newPower = timePassed * POWER_PER_TICK; final double newPower = timePassed * POWER_PER_TICK;
final double overFlow = grid.injectPower( newPower, Actionable.SIMULATE ); final double overFlow = grid.injectPower( newPower, Actionable.SIMULATE );
@@ -275,7 +275,7 @@ public class TileVibrationChamber extends AENetworkInvTile implements IGridTicka
{ {
try try
{ {
this.getGridProxy().getTick().wakeDevice( this.getGridProxy().getNode() ); this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -60,15 +60,15 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
public TileWireless() public TileWireless()
{ {
this.getGridProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.getGridProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) ); this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
} }
@Override @Override
public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp ) public void setOrientation( final ForgeDirection inForward, final ForgeDirection inUp )
{ {
super.setOrientation( inForward, inUp ); super.setOrientation( inForward, inUp );
this.getGridProxy().setValidSides( EnumSet.of( this.getForward().getOpposite() ) ); this.getProxy().setValidSides( EnumSet.of( this.getForward().getOpposite() ) );
} }
@MENetworkEventSubscribe @MENetworkEventSubscribe
@@ -99,12 +99,12 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
try try
{ {
if( this.getGridProxy().getEnergy().isNetworkPowered() ) if( this.getProxy().getEnergy().isNetworkPowered() )
{ {
this.setClientFlags( this.getClientFlags() | POWERED_FLAG ); this.setClientFlags( this.getClientFlags() | POWERED_FLAG );
} }
if( this.getGridProxy().getNode().meetsChannelRequirements() ) if( this.getProxy().getNode().meetsChannelRequirements() )
{ {
this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG ); this.setClientFlags( this.getClientFlags() | CHANNEL_FLAG );
} }
@@ -162,7 +162,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
private void updatePower() private void updatePower()
{ {
this.getGridProxy().setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( this.getBoosters() ) ); this.getProxy().setIdlePowerUsage( AEConfig.instance.wireless_getPowerDrain( this.getBoosters() ) );
} }
private int getBoosters() private int getBoosters()
@@ -191,7 +191,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
return this.isPowered() && ( CHANNEL_FLAG == ( this.getClientFlags() & CHANNEL_FLAG ) ); return this.isPowered() && ( CHANNEL_FLAG == ( this.getClientFlags() & CHANNEL_FLAG ) );
} }
return this.getGridProxy().isActive(); return this.getProxy().isActive();
} }
@Override @Override
@@ -199,7 +199,7 @@ public class TileWireless extends AENetworkInvTile implements IWirelessAccessPoi
{ {
try try
{ {
return this.getGridProxy().getGrid(); return this.getProxy().getGrid();
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -68,9 +68,9 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
public TileQuantumBridge() public TileQuantumBridge()
{ {
this.getGridProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) ); this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
this.getGridProxy().setFlags( GridFlags.DENSE_CAPACITY ); this.getProxy().setFlags( GridFlags.DENSE_CAPACITY );
this.getGridProxy().setIdlePowerUsage( 22 ); this.getProxy().setIdlePowerUsage( 22 );
this.internalInventory.setMaxStackSize( 1 ); this.internalInventory.setMaxStackSize( 1 );
} }
@@ -98,7 +98,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
out |= this.hasSingularity; out |= this.hasSingularity;
} }
if( this.getGridProxy().isActive() && this.constructed != -1 ) if( this.getProxy().isActive() && this.constructed != -1 )
{ {
out |= this.powered; out |= this.powered;
} }
@@ -177,7 +177,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
{ {
final ItemStack linkStack = maybeLinkStack.get(); final ItemStack linkStack = maybeLinkStack.get();
this.getGridProxy().setVisualRepresentation( linkStack ); this.getProxy().setVisualRepresentation( linkStack );
} }
} }
@@ -205,7 +205,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
if( affectWorld ) if( affectWorld )
{ {
this.getGridProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) ); this.getProxy().setValidSides( EnumSet.noneOf( ForgeDirection.class ) );
} }
} }
@@ -235,11 +235,11 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
if( this.isCorner() || this.isCenter() ) if( this.isCorner() || this.isCenter() )
{ {
this.getGridProxy().setValidSides( this.getConnections() ); this.getProxy().setValidSides( this.getConnections() );
} }
else else
{ {
this.getGridProxy().setValidSides( EnumSet.allOf( ForgeDirection.class ) ); this.getProxy().setValidSides( EnumSet.allOf( ForgeDirection.class ) );
} }
} }
} }
@@ -288,7 +288,7 @@ public class TileQuantumBridge extends AENetworkInvTile implements IAEMultiBlock
try try
{ {
return this.getGridProxy().getEnergy().isNetworkPowered(); return this.getProxy().getEnergy().isNetworkPowered();
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -58,7 +58,7 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
public TileSpatialIOPort() public TileSpatialIOPort()
{ {
this.getGridProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
} }
@TileEvent( TileEventType.WORLD_NBT_WRITE ) @TileEvent( TileEventType.WORLD_NBT_WRITE )
@@ -127,8 +127,8 @@ public class TileSpatialIOPort extends AENetworkInvTile implements IWorldCallabl
final ItemStack cell = this.getStackInSlot( 0 ); final ItemStack cell = this.getStackInSlot( 0 );
if( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ) == null ) if( this.isSpatialCell( cell ) && this.getStackInSlot( 1 ) == null )
{ {
final IGrid gi = this.getGridProxy().getGrid(); final IGrid gi = this.getProxy().getGrid();
final IEnergyGrid energy = this.getGridProxy().getEnergy(); final IEnergyGrid energy = this.getProxy().getEnergy();
final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem(); final ISpatialStorageCell sc = (ISpatialStorageCell) cell.getItem();
@@ -78,7 +78,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
public TileDrive() public TileDrive()
{ {
this.mySrc = new MachineSource( this ); this.mySrc = new MachineSource( this );
this.getGridProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
} }
@TileEvent( TileEventType.NETWORK_WRITE ) @TileEvent( TileEventType.NETWORK_WRITE )
@@ -93,7 +93,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
this.state &= 0x24924924; // just keep the blinks... this.state &= 0x24924924; // just keep the blinks...
} }
if( this.getGridProxy().isActive() ) if( this.getProxy().isActive() )
{ {
this.state |= 0x80000000; this.state |= 0x80000000;
} }
@@ -160,7 +160,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
return ( this.state & 0x80000000 ) == 0x80000000; return ( this.state & 0x80000000 ) == 0x80000000;
} }
return this.getGridProxy().isActive(); return this.getProxy().isActive();
} }
@Override @Override
@@ -205,7 +205,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
private void recalculateDisplay() private void recalculateDisplay()
{ {
final boolean currentActive = this.getGridProxy().isActive(); final boolean currentActive = this.getProxy().isActive();
if( currentActive ) if( currentActive )
{ {
this.state |= 0x80000000; this.state |= 0x80000000;
@@ -220,7 +220,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
this.wasActive = currentActive; this.wasActive = currentActive;
try try
{ {
this.getGridProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -281,9 +281,9 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
try try
{ {
this.getGridProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
final IStorageGrid gs = this.getGridProxy().getStorage(); final IStorageGrid gs = this.getProxy().getStorage();
Platform.postChanges( gs, removed, added, this.mySrc ); Platform.postChanges( gs, removed, added, this.mySrc );
} }
catch( final GridAccessException ignored ) catch( final GridAccessException ignored )
@@ -349,7 +349,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
} }
} }
this.getGridProxy().setIdlePowerUsage( power ); this.getProxy().setIdlePowerUsage( power );
this.isCached = true; this.isCached = true;
} }
@@ -365,7 +365,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
@Override @Override
public List<IMEInventoryHandler> getCellArray( final StorageChannel channel ) public List<IMEInventoryHandler> getCellArray( final StorageChannel channel )
{ {
if( this.getGridProxy().isActive() ) if( this.getProxy().isActive() )
{ {
this.updateState(); this.updateState();
return (List) ( channel == StorageChannel.ITEMS ? this.items : this.fluids ); return (List) ( channel == StorageChannel.ITEMS ? this.items : this.fluids );
@@ -390,7 +390,7 @@ public class TileDrive extends AENetworkInvTile implements IChestOrDrive, IPrior
try try
{ {
this.getGridProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() ); this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
{ {
@@ -106,7 +106,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Reflected @Reflected
public TileIOPort() public TileIOPort()
{ {
this.getGridProxy().setFlags( GridFlags.REQUIRE_CHANNEL ); this.getProxy().setFlags( GridFlags.REQUIRE_CHANNEL );
this.manager = new ConfigManager( this ); this.manager = new ConfigManager( this );
this.manager.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE ); this.manager.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
this.manager.registerSetting( Settings.FULLNESS_MODE, FullnessMode.EMPTY ); this.manager.registerSetting( Settings.FULLNESS_MODE, FullnessMode.EMPTY );
@@ -158,11 +158,11 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
{ {
if( this.hasWork() ) if( this.hasWork() )
{ {
this.getGridProxy().getTick().wakeDevice( this.getGridProxy().getNode() ); this.getProxy().getTick().wakeDevice( this.getProxy().getNode() );
} }
else else
{ {
this.getGridProxy().getTick().sleepDevice( this.getGridProxy().getNode() ); this.getProxy().getTick().sleepDevice( this.getProxy().getNode() );
} }
} }
catch( final GridAccessException e ) catch( final GridAccessException e )
@@ -313,7 +313,7 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
@Override @Override
public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall ) public TickRateModulation tickingRequest( final IGridNode node, final int ticksSinceLastCall )
{ {
if( !this.getGridProxy().isActive() ) if( !this.getProxy().isActive() )
{ {
return TickRateModulation.IDLE; return TickRateModulation.IDLE;
} }
@@ -335,9 +335,9 @@ public class TileIOPort extends AENetworkInvTile implements IUpgradeableHost, IC
try try
{ {
final IMEInventory<IAEItemStack> itemNet = this.getGridProxy().getStorage().getItemInventory(); final IMEInventory<IAEItemStack> itemNet = this.getProxy().getStorage().getItemInventory();
final IMEInventory<IAEFluidStack> fluidNet = this.getGridProxy().getStorage().getFluidInventory(); final IMEInventory<IAEFluidStack> fluidNet = this.getProxy().getStorage().getFluidInventory();
final IEnergySource energy = this.getGridProxy().getEnergy(); final IEnergySource energy = this.getProxy().getEnergy();
for( int x = 0; x < 6; x++ ) for( int x = 0; x < 6; x++ )
{ {
final ItemStack is = this.cells.getStackInSlot( x ); final ItemStack is = this.cells.getStackInSlot( x );