Reduces visibility of internal fields/methods
Reduces the visibility of all fields to private and create setters/getters when necessary. Exceptions are fields with GuiSync as these need to be public. Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
@@ -52,9 +52,9 @@ import appeng.client.texture.IAESprite;
|
||||
public class PartCableAnchor implements IPart
|
||||
{
|
||||
|
||||
ItemStack is = null;
|
||||
IPartHost host = null;
|
||||
AEPartLocation mySide = AEPartLocation.UP;
|
||||
private ItemStack is = null;
|
||||
private IPartHost host = null;
|
||||
private AEPartLocation mySide = AEPartLocation.UP;
|
||||
|
||||
public PartCableAnchor( final ItemStack is )
|
||||
{
|
||||
@@ -94,7 +94,7 @@ public class PartCableAnchor implements IPart
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer )
|
||||
{
|
||||
final IAESprite myIcon = renderer.getIcon( this.is );
|
||||
final IAESprite myIcon = renderer.getIcon( this.is );
|
||||
rh.setTexture( myIcon );
|
||||
if( this.host != null && this.host.getFacadeContainer().getFacade( this.mySide ) != null )
|
||||
{
|
||||
@@ -116,7 +116,7 @@ public class PartCableAnchor implements IPart
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer)
|
||||
public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ import appeng.util.inv.IInventoryDestination;
|
||||
public class PartInterface extends PartBasicState implements IGridTickable, IStorageMonitorable, IInventoryDestination, IInterfaceHost, ISidedInventory, IAEAppEngInventory, ITileStorageMonitorable, IPriorityHost
|
||||
{
|
||||
|
||||
final DualityInterface duality = new DualityInterface( this.proxy, this );
|
||||
private final DualityInterface duality = new DualityInterface( this.getProxy(), this );
|
||||
|
||||
@Reflected
|
||||
public PartInterface( final ItemStack is )
|
||||
@@ -114,7 +114,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer )
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
@@ -136,17 +136,17 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer )
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
||||
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSides.getIcon(), CableBusTextures.PartMonitorSides.getIcon() );
|
||||
|
||||
rh.setBounds( 5, 5, 12, 11, 11, 13 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
|
||||
rh.setBounds( 5, 5, 13, 11, 11, 14 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
@@ -209,16 +209,16 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
||||
|
||||
if( Platform.isServer() )
|
||||
{
|
||||
Platform.openGUI( p, this.getTileEntity(), this.side, GuiBridge.GUI_INTERFACE );
|
||||
Platform.openGUI( p, this.getTileEntity(), this.getSide(), GuiBridge.GUI_INTERFACE );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer)
|
||||
public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer )
|
||||
{
|
||||
return renderer.getIcon( this.is ).getAtlas();
|
||||
return renderer.getIcon( this.getItemStack() ).getAtlas();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -314,13 +314,13 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
||||
@Override
|
||||
public void openInventory( final EntityPlayer player )
|
||||
{
|
||||
this.duality.getStorage().openInventory(player);
|
||||
this.duality.getStorage().openInventory( player );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory( final EntityPlayer player )
|
||||
{
|
||||
this.duality.getStorage().closeInventory(player);
|
||||
this.duality.getStorage().closeInventory( player );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -362,7 +362,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
||||
@Override
|
||||
public EnumSet<EnumFacing> getTargets()
|
||||
{
|
||||
return EnumSet.of( this.side.getFacing() );
|
||||
return EnumSet.of( this.getSide().getFacing() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -437,7 +437,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
||||
final int id,
|
||||
final int value )
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -449,7 +449,7 @@ public class PartInterface extends PartBasicState implements IGridTickable, ISto
|
||||
@Override
|
||||
public void clear()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -29,10 +29,10 @@ public class PartInvertedToggleBus extends PartToggleBus
|
||||
public PartInvertedToggleBus( final ItemStack is )
|
||||
{
|
||||
super( is );
|
||||
this.proxy.setIdlePowerUsage( 0.0 );
|
||||
this.outerProxy.setIdlePowerUsage( 0.0 );
|
||||
this.proxy.setFlags();
|
||||
this.outerProxy.setFlags();
|
||||
this.getProxy().setIdlePowerUsage( 0.0 );
|
||||
this.getOuterProxy().setIdlePowerUsage( 0.0 );
|
||||
this.getProxy().setFlags();
|
||||
this.getOuterProxy().setFlags();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -87,16 +87,19 @@ import appeng.util.prioitylist.PrecisePriorityList;
|
||||
|
||||
// TODO: BC Integration
|
||||
//@Interface( iname = IntegrationType.BuildCraftTransport, iface = "buildcraft.api.transport.IPipeConnection" )
|
||||
public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack> /*, IPipeConnection*/, IPriorityHost
|
||||
public class PartStorageBus extends PartUpgradeable implements IGridTickable, ICellContainer, IMEMonitorHandlerReceiver<IAEItemStack> /*
|
||||
* ,
|
||||
* IPipeConnection
|
||||
*/, IPriorityHost
|
||||
{
|
||||
final BaseActionSource mySrc;
|
||||
final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
|
||||
int priority = 0;
|
||||
boolean cached = false;
|
||||
MEMonitorIInventory monitor = null;
|
||||
MEInventoryHandler handler = null;
|
||||
int handlerHash = 0;
|
||||
boolean wasActive = false;
|
||||
private final BaseActionSource mySrc;
|
||||
private final AppEngInternalAEInventory Config = new AppEngInternalAEInventory( this, 63 );
|
||||
private int priority = 0;
|
||||
private boolean cached = false;
|
||||
private MEMonitorIInventory monitor = null;
|
||||
private MEInventoryHandler handler = null;
|
||||
private int handlerHash = 0;
|
||||
private boolean wasActive = false;
|
||||
private byte resetCacheLogic = 0;
|
||||
|
||||
@Reflected
|
||||
@@ -118,14 +121,14 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
|
||||
private void updateStatus()
|
||||
{
|
||||
final boolean currentActive = this.proxy.isActive();
|
||||
final boolean currentActive = this.getProxy().isActive();
|
||||
if( this.wasActive != currentActive )
|
||||
{
|
||||
this.wasActive = currentActive;
|
||||
try
|
||||
{
|
||||
this.proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
this.host.markForUpdate();
|
||||
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
@@ -150,7 +153,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
|
||||
{
|
||||
this.resetCache( true );
|
||||
this.host.markForSave();
|
||||
this.getHost().markForSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,7 +203,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
|
||||
private void resetCache( final boolean fullReset )
|
||||
{
|
||||
if( this.host == null || this.host.getTile() == null || this.host.getTile().getWorld() == null || this.host.getTile().getWorld().isRemote )
|
||||
if( this.getHost() == null || this.getHost().getTile() == null || this.getHost().getTile().getWorld() == null || this.getHost().getTile().getWorld().isRemote )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -216,7 +219,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
|
||||
try
|
||||
{
|
||||
this.proxy.getTick().alertDevice( this.proxy.getNode() );
|
||||
this.getProxy().getTick().alertDevice( this.getProxy().getNode() );
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
@@ -235,9 +238,9 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
{
|
||||
try
|
||||
{
|
||||
if( this.proxy.isActive() )
|
||||
if( this.getProxy().isActive() )
|
||||
{
|
||||
this.proxy.getStorage().postAlterationOfStoredItems( StorageChannel.ITEMS, change, this.mySrc );
|
||||
this.getProxy().getStorage().postAlterationOfStoredItems( StorageChannel.ITEMS, change, this.mySrc );
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
@@ -264,7 +267,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderInventory( final IPartRenderHelper rh, final ModelGenerator renderer )
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
|
||||
|
||||
rh.setBounds( 3, 3, 15, 13, 13, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
@@ -280,7 +283,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer )
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
|
||||
|
||||
rh.setBounds( 3, 3, 15, 13, 13, 16 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
@@ -288,12 +291,12 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
rh.setBounds( 2, 2, 14, 14, 14, 15 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartStorageSides.getIcon(), CableBusTextures.PartStorageSides.getIcon() );
|
||||
|
||||
rh.setBounds( 5, 5, 12, 11, 11, 13 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
|
||||
rh.setBounds( 5, 5, 13, 11, 11, 14 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
@@ -323,7 +326,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
return true;
|
||||
}
|
||||
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_STORAGEBUS );
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_STORAGEBUS );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -333,7 +336,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
@Override
|
||||
public TickingRequest getTickingRequest( final IGridNode node )
|
||||
{
|
||||
return new TickingRequest( TickRates.StorageBus.min, TickRates.StorageBus.max, this.monitor == null, true );
|
||||
return new TickingRequest( TickRates.StorageBus.getMin(), TickRates.StorageBus.getMax(), this.monitor == null, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -397,8 +400,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
|
||||
this.cached = true;
|
||||
final TileEntity self = this.getHost().getTile();
|
||||
final TileEntity target = self.getWorld().getTileEntity( self.getPos().offset( this.side.getFacing() ) );
|
||||
|
||||
final TileEntity target = self.getWorld().getTileEntity( self.getPos().offset( this.getSide().getFacing() ) );
|
||||
final int newHandlerHash = Platform.generateTileHash( target );
|
||||
|
||||
if( this.handlerHash == newHandlerHash && this.handlerHash != 0 )
|
||||
@@ -409,7 +411,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
try
|
||||
{
|
||||
// force grid to update handlers...
|
||||
this.proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
this.getProxy().getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
{
|
||||
@@ -421,16 +423,16 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
this.monitor = null;
|
||||
if( target != null )
|
||||
{
|
||||
final IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, this.side.getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc );
|
||||
final IExternalStorageHandler esh = AEApi.instance().registries().externalStorage().getHandler( target, this.getSide().getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc );
|
||||
if( esh != null )
|
||||
{
|
||||
final IMEInventory inv = esh.getInventory( target, this.side.getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc );
|
||||
final IMEInventory inv = esh.getInventory( target, this.getSide().getFacing().getOpposite(), StorageChannel.ITEMS, this.mySrc );
|
||||
|
||||
if( inv instanceof MEMonitorIInventory )
|
||||
{
|
||||
final MEMonitorIInventory h = (MEMonitorIInventory) inv;
|
||||
h.mode = (StorageFilter) this.getConfigManager().getSetting( Settings.STORAGE_FILTER );
|
||||
h.mySource = new MachineSource( this );
|
||||
h.setMode( (StorageFilter) this.getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
|
||||
h.setActionSource( new MachineSource( this ) );
|
||||
}
|
||||
|
||||
if( inv instanceof MEMonitorIInventory )
|
||||
@@ -440,7 +442,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
|
||||
if( inv != null )
|
||||
{
|
||||
this.checkInterfaceVsStorageBus( target, this.side.getOpposite() );
|
||||
this.checkInterfaceVsStorageBus( target, this.getSide().getOpposite() );
|
||||
|
||||
this.handler = new MEInventoryHandler( inv, StorageChannel.ITEMS );
|
||||
|
||||
@@ -482,14 +484,14 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
{
|
||||
try
|
||||
{
|
||||
final ITickManager tm = this.proxy.getTick();
|
||||
final ITickManager tm = this.getProxy().getTick();
|
||||
if( this.monitor == null )
|
||||
{
|
||||
tm.sleepDevice( this.proxy.getNode() );
|
||||
tm.sleepDevice( this.getProxy().getNode() );
|
||||
}
|
||||
else
|
||||
{
|
||||
tm.wakeDevice( this.proxy.getNode() );
|
||||
tm.wakeDevice( this.getProxy().getNode() );
|
||||
}
|
||||
}
|
||||
catch( final GridAccessException e )
|
||||
@@ -531,7 +533,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
{
|
||||
if( channel == StorageChannel.ITEMS )
|
||||
{
|
||||
final IMEInventoryHandler out = this.proxy.isActive() ? this.getInternalHandler() : null;
|
||||
final IMEInventoryHandler out = this.getProxy().isActive() ? this.getInternalHandler() : null;
|
||||
if( out != null )
|
||||
{
|
||||
return Collections.singletonList( out );
|
||||
@@ -550,7 +552,7 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
public void setPriority( final int newValue )
|
||||
{
|
||||
this.priority = newValue;
|
||||
this.host.markForSave();
|
||||
this.getHost().markForSave();
|
||||
this.resetCache( true );
|
||||
}
|
||||
|
||||
@@ -561,13 +563,13 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
|
||||
|
||||
// TODO: BC PIPE INTEGRATION
|
||||
/*
|
||||
@Override
|
||||
@Method( iname = IntegrationType.BuildCraftTransport )
|
||||
public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
|
||||
{
|
||||
return type == PipeType.ITEM && with == this.side ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT;
|
||||
}
|
||||
*/
|
||||
* @Override
|
||||
* @Method( iname = IntegrationType.BuildCraftTransport )
|
||||
* public ConnectOverride overridePipeConnection( PipeType type, ForgeDirection with )
|
||||
* {
|
||||
* return type == PipeType.ITEM && with == this.getSide() ? ConnectOverride.CONNECT : ConnectOverride.DISCONNECT;
|
||||
* }
|
||||
*/
|
||||
@Override
|
||||
public void saveChanges( final IMEInventory cellInventory )
|
||||
{
|
||||
|
||||
@@ -54,25 +54,25 @@ import appeng.util.Platform;
|
||||
public class PartToggleBus extends PartBasicState
|
||||
{
|
||||
private static final int REDSTONE_FLAG = 4;
|
||||
final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
|
||||
IGridConnection connection;
|
||||
boolean hasRedstone = false;
|
||||
private final AENetworkProxy outerProxy = new AENetworkProxy( this, "outer", null, true );
|
||||
private IGridConnection connection;
|
||||
private boolean hasRedstone = false;
|
||||
|
||||
@Reflected
|
||||
public PartToggleBus( final ItemStack is )
|
||||
{
|
||||
super( is );
|
||||
|
||||
this.proxy.setIdlePowerUsage( 0.0 );
|
||||
this.outerProxy.setIdlePowerUsage( 0.0 );
|
||||
this.proxy.setFlags();
|
||||
this.outerProxy.setFlags();
|
||||
this.getProxy().setIdlePowerUsage( 0.0 );
|
||||
this.getOuterProxy().setIdlePowerUsage( 0.0 );
|
||||
this.getProxy().setFlags();
|
||||
this.getOuterProxy().setFlags();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColors( final ModelGenerator renderer, final boolean hasChan, final boolean hasPower )
|
||||
{
|
||||
this.hasRedstone = ( this.clientFlags & REDSTONE_FLAG ) == REDSTONE_FLAG;
|
||||
this.hasRedstone = ( this.getClientFlags() & REDSTONE_FLAG ) == REDSTONE_FLAG;
|
||||
super.setColors( renderer, hasChan && this.hasRedstone, hasPower && this.hasRedstone );
|
||||
}
|
||||
|
||||
@@ -84,13 +84,13 @@ public class PartToggleBus extends PartBasicState
|
||||
|
||||
protected boolean getIntention()
|
||||
{
|
||||
return this.getHost().hasRedstone( this.side );
|
||||
return this.getHost().hasRedstone( this.getSide() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getBreakingTexture( final ModelGenerator renderer )
|
||||
{
|
||||
return renderer.getIcon( this.is ).getAtlas();
|
||||
return renderer.getIcon( this.getItemStack() ).getAtlas();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -102,13 +102,13 @@ public class PartToggleBus extends PartBasicState
|
||||
@Override
|
||||
public void securityBreak()
|
||||
{
|
||||
if( this.is.stackSize > 0 )
|
||||
if( this.getItemStack().stackSize > 0 )
|
||||
{
|
||||
final List<ItemStack> items = new ArrayList<ItemStack>();
|
||||
items.add( this.is.copy() );
|
||||
this.host.removePart( this.side, false );
|
||||
Platform.spawnDrops( this.tile.getWorld(), this.tile.getPos(), items );
|
||||
this.is.stackSize = 0;
|
||||
items.add( this.getItemStack().copy() );
|
||||
this.getHost().removePart( this.getSide(), false );
|
||||
Platform.spawnDrops( this.getTile().getWorld(), this.getTile().getPos(), items );
|
||||
this.getItemStack().stackSize = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,7 +124,7 @@ public class PartToggleBus extends PartBasicState
|
||||
{
|
||||
GL11.glTranslated( -0.2, -0.3, 0.0 );
|
||||
|
||||
rh.setTexture( renderer.getIcon( this.is ) );
|
||||
rh.setTexture( renderer.getIcon( this.getItemStack() ) );
|
||||
rh.setBounds( 6, 6, 14 - 4, 10, 10, 16 - 4 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
|
||||
@@ -147,7 +147,7 @@ public class PartToggleBus extends PartBasicState
|
||||
@SideOnly( Side.CLIENT )
|
||||
public void renderStatic( final BlockPos pos, final IPartRenderHelper rh, final ModelGenerator renderer )
|
||||
{
|
||||
rh.setTexture( renderer.getIcon( this.is ) );
|
||||
rh.setTexture( renderer.getIcon( this.getItemStack() ) );
|
||||
|
||||
rh.setBounds( 6, 6, 14, 10, 10, 16 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
@@ -155,7 +155,7 @@ public class PartToggleBus extends PartBasicState
|
||||
rh.setBounds( 6, 6, 11, 10, 10, 13 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.is ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorBack.getIcon(), renderer.getIcon( this.getItemStack() ), CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
|
||||
rh.setBounds( 6, 6, 13, 10, 10, 14 );
|
||||
rh.renderBlock( pos, renderer );
|
||||
@@ -167,7 +167,7 @@ public class PartToggleBus extends PartBasicState
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
final boolean oldHasRedstone = this.hasRedstone;
|
||||
this.hasRedstone = this.getHost().hasRedstone( this.side );
|
||||
this.hasRedstone = this.getHost().hasRedstone( this.getSide() );
|
||||
|
||||
if( this.hasRedstone != oldHasRedstone )
|
||||
{
|
||||
@@ -180,29 +180,29 @@ public class PartToggleBus extends PartBasicState
|
||||
public void readFromNBT( final NBTTagCompound extra )
|
||||
{
|
||||
super.readFromNBT( extra );
|
||||
this.outerProxy.readFromNBT( extra );
|
||||
this.getOuterProxy().readFromNBT( extra );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT( final NBTTagCompound extra )
|
||||
{
|
||||
super.writeToNBT( extra );
|
||||
this.outerProxy.writeToNBT( extra );
|
||||
this.getOuterProxy().writeToNBT( extra );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromWorld()
|
||||
{
|
||||
super.removeFromWorld();
|
||||
this.outerProxy.invalidate();
|
||||
this.getOuterProxy().invalidate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addToWorld()
|
||||
{
|
||||
super.addToWorld();
|
||||
this.outerProxy.onReady();
|
||||
this.hasRedstone = this.getHost().hasRedstone( this.side );
|
||||
this.getOuterProxy().onReady();
|
||||
this.hasRedstone = this.getHost().hasRedstone( this.getSide() );
|
||||
this.updateInternalState();
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ public class PartToggleBus extends PartBasicState
|
||||
@Override
|
||||
public IGridNode getExternalFacingNode()
|
||||
{
|
||||
return this.outerProxy.getNode();
|
||||
return this.getOuterProxy().getNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -229,7 +229,7 @@ public class PartToggleBus extends PartBasicState
|
||||
public void onPlacement( final EntityPlayer player, final ItemStack held, final AEPartLocation side )
|
||||
{
|
||||
super.onPlacement( player, held, side );
|
||||
this.outerProxy.setOwner( player );
|
||||
this.getOuterProxy().setOwner( player );
|
||||
}
|
||||
|
||||
private void updateInternalState()
|
||||
@@ -237,13 +237,13 @@ public class PartToggleBus extends PartBasicState
|
||||
final boolean intention = this.getIntention();
|
||||
if( intention == ( this.connection == null ) )
|
||||
{
|
||||
if( this.proxy.getNode() != null && this.outerProxy.getNode() != null )
|
||||
if( this.getProxy().getNode() != null && this.getOuterProxy().getNode() != null )
|
||||
{
|
||||
if( intention )
|
||||
{
|
||||
try
|
||||
{
|
||||
this.connection = AEApi.instance().createGridConnection( this.proxy.getNode(), this.outerProxy.getNode() );
|
||||
this.connection = AEApi.instance().createGridConnection( this.getProxy().getNode(), this.getOuterProxy().getNode() );
|
||||
}
|
||||
catch( final FailedConnection e )
|
||||
{
|
||||
@@ -258,4 +258,9 @@ public class PartToggleBus extends PartBasicState
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AENetworkProxy getOuterProxy()
|
||||
{
|
||||
return this.outerProxy;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user