Changed access to use this qualifier
This commit is contained in:
@@ -29,22 +29,22 @@ public class NonNullArrayIterator<E> implements Iterator<E>
|
||||
final E[] g;
|
||||
|
||||
public NonNullArrayIterator(E[] o) {
|
||||
g = o;
|
||||
this.g = o;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext()
|
||||
{
|
||||
while (offset < g.length && g[offset] == null)
|
||||
offset++;
|
||||
while (this.offset < this.g.length && this.g[this.offset] == null)
|
||||
this.offset++;
|
||||
|
||||
return offset != g.length;
|
||||
return this.offset != this.g.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public E next()
|
||||
{
|
||||
return g[offset++];
|
||||
return this.g[this.offset++];
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -76,7 +76,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer)
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||
CableBusTextures.PartPlaneSides.getIcon() );
|
||||
|
||||
rh.setBounds( 1, 1, 15, 15, 15, 16 );
|
||||
@@ -98,38 +98,38 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
ForgeDirection e = rh.getWorldX();
|
||||
ForgeDirection u = rh.getWorldY();
|
||||
|
||||
TileEntity te = getHost().getTile();
|
||||
TileEntity te = this.getHost().getTile();
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
|
||||
minX = 0;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
|
||||
maxX = 16;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
|
||||
minY = 0;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
|
||||
maxY = 16;
|
||||
|
||||
boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG);
|
||||
boolean isActive = (this.clientFlags & (this.POWERED_FLAG | this.CHANNEL_FLAG)) == (this.POWERED_FLAG | this.CHANNEL_FLAG);
|
||||
|
||||
renderCache = rh.useSimplifiedRendering( x, y, z, this, renderCache );
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockAnnihilationPlaneOn.getIcon() : is.getIconIndex(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockAnnihilationPlaneOn.getIcon() : this.is.getIconIndex(),
|
||||
CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() );
|
||||
|
||||
rh.setBounds( minX, minY, 15, maxX, maxY, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockAnnihilationPlaneOn.getIcon() : is.getIconIndex(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockAnnihilationPlaneOn.getIcon() : this.is.getIconIndex(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
|
||||
rh.setBounds( 5, 5, 14, 11, 11, 15 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
}
|
||||
|
||||
private boolean isTransitionPlane(TileEntity blockTileEntity, ForgeDirection side)
|
||||
@@ -150,7 +150,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
int maxX = 15;
|
||||
int maxY = 15;
|
||||
|
||||
IPartHost host = getHost();
|
||||
IPartHost host = this.getHost();
|
||||
if ( host != null )
|
||||
{
|
||||
TileEntity te = host.getTile();
|
||||
@@ -162,16 +162,16 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
ForgeDirection e = bch.getWorldX();
|
||||
ForgeDirection u = bch.getWorldY();
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
|
||||
minX = 0;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
|
||||
maxX = 16;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
|
||||
minY = 0;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
|
||||
maxY = 16;
|
||||
}
|
||||
|
||||
@@ -194,11 +194,11 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
|
||||
data.setInteger( "bufferSize", Buffer.size() );
|
||||
for (int x = 0; x < Buffer.size(); x++)
|
||||
data.setInteger( "bufferSize", this.Buffer.size() );
|
||||
for (int x = 0; x < this.Buffer.size(); x++)
|
||||
{
|
||||
NBTTagCompound pack = new NBTTagCompound();
|
||||
Buffer.get( x ).writeToNBT( pack );
|
||||
this.Buffer.get( x ).writeToNBT( pack );
|
||||
data.setTag( "buffer" + x, pack );
|
||||
}
|
||||
}
|
||||
@@ -209,25 +209,25 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
super.readFromNBT( data );
|
||||
|
||||
int size = data.getInteger( "bufferSize" );
|
||||
Buffer.clear();
|
||||
this.Buffer.clear();
|
||||
for (int x = 0; x < size; x++)
|
||||
{
|
||||
NBTTagCompound pack = (NBTTagCompound) data.getTag( "buffer" + x );
|
||||
IAEItemStack ais = AEItemStack.loadItemStackFromNBT( pack );
|
||||
if ( ais != null )
|
||||
Buffer.add( ais );
|
||||
this.Buffer.add( ais );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAccepting()
|
||||
{
|
||||
return Buffer.isEmpty();
|
||||
return this.Buffer.isEmpty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDrops(List<ItemStack> drops, boolean wrenched)
|
||||
{
|
||||
for (IAEItemStack is : Buffer)
|
||||
for (IAEItemStack is : this.Buffer)
|
||||
if ( is != null )
|
||||
drops.add( is.getItemStack() );
|
||||
}
|
||||
@@ -236,35 +236,35 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
@MENetworkEventSubscribe
|
||||
public void chanRender(MENetworkChannelsChanged c)
|
||||
{
|
||||
onNeighborChanged();
|
||||
getHost().markForUpdate();
|
||||
this.onNeighborChanged();
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
@MENetworkEventSubscribe
|
||||
public void powerRender(MENetworkPowerStatusChange c)
|
||||
{
|
||||
onNeighborChanged();
|
||||
getHost().markForUpdate();
|
||||
this.onNeighborChanged();
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
|
||||
public TickRateModulation EatBlock(boolean eatForReal)
|
||||
{
|
||||
if ( isAccepting() && proxy.isActive() )
|
||||
if ( this.isAccepting() && this.proxy.isActive() )
|
||||
{
|
||||
try
|
||||
{
|
||||
TileEntity te = getTile();
|
||||
TileEntity te = this.getTile();
|
||||
WorldServer w = (WorldServer) te.getWorldObj();
|
||||
|
||||
int x = te.xCoord + side.offsetX;
|
||||
int y = te.yCoord + side.offsetY;
|
||||
int z = te.zCoord + side.offsetZ;
|
||||
int x = te.xCoord + this.side.offsetX;
|
||||
int y = te.yCoord + this.side.offsetY;
|
||||
int z = te.zCoord + this.side.offsetZ;
|
||||
|
||||
Block blk = w.getBlock( x, y, z );
|
||||
|
||||
IStorageGrid storage = proxy.getStorage();
|
||||
IEnergyGrid energy = proxy.getEnergy();
|
||||
IStorageGrid storage = this.proxy.getStorage();
|
||||
IEnergyGrid energy = this.proxy.getEnergy();
|
||||
|
||||
Material mat = blk.getMaterial();
|
||||
boolean ignore = mat == Material.air || mat == Material.lava || mat == Material.water || mat.isLiquid() || blk == Blocks.bedrock
|
||||
@@ -299,30 +299,30 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
if ( !item.isDead )
|
||||
{
|
||||
IAEItemStack storedItem = AEItemStack.create( item.getEntityItem() );
|
||||
storedItem = Platform.poweredInsert( energy, storage.getItemInventory(), storedItem, mySrc );
|
||||
storedItem = Platform.poweredInsert( energy, storage.getItemInventory(), storedItem, this.mySrc );
|
||||
if ( storedItem != null )
|
||||
Buffer.add( storedItem );
|
||||
this.Buffer.add( storedItem );
|
||||
|
||||
item.setDead();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, side, true ) );
|
||||
ServerHelper.proxy.sendToAllNearExcept( null, x, y, z, 64, w, new PacketTransitionEffect( x, y, z, this.side, true ) );
|
||||
|
||||
for (ItemStack snaggedItem : out)
|
||||
{
|
||||
IAEItemStack storedItem = AEItemStack.create( snaggedItem );
|
||||
storedItem = Platform.poweredInsert( energy, storage.getItemInventory(), storedItem, mySrc );
|
||||
storedItem = Platform.poweredInsert( energy, storage.getItemInventory(), storedItem, this.mySrc );
|
||||
if ( storedItem != null )
|
||||
Buffer.add( storedItem );
|
||||
this.Buffer.add( storedItem );
|
||||
}
|
||||
|
||||
return TickRateModulation.URGENT;
|
||||
}
|
||||
else
|
||||
{
|
||||
breaking = true;
|
||||
this.breaking = true;
|
||||
TickHandler.instance.addCallable( this.tile.getWorldObj(), this );
|
||||
return TickRateModulation.URGENT;
|
||||
}
|
||||
@@ -352,7 +352,7 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
{
|
||||
try
|
||||
{
|
||||
proxy.getTick().alertDevice( proxy.getNode() );
|
||||
this.proxy.getTick().alertDevice( this.proxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -363,33 +363,33 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
@Override
|
||||
public void onEntityCollision(Entity entity)
|
||||
{
|
||||
if ( entity instanceof EntityItem && !entity.isDead && isAccepting() )
|
||||
if ( entity instanceof EntityItem && !entity.isDead && this.isAccepting() )
|
||||
{
|
||||
boolean capture = false;
|
||||
|
||||
switch (side)
|
||||
switch (this.side)
|
||||
{
|
||||
case DOWN:
|
||||
case UP:
|
||||
if ( entity.posX > tile.xCoord && entity.posX < tile.xCoord + 1 )
|
||||
if ( entity.posZ > tile.zCoord && entity.posZ < tile.zCoord + 1 )
|
||||
if ( (entity.posY > tile.yCoord + 0.9 && side == ForgeDirection.UP) || (entity.posY < tile.yCoord + 0.1 && side == ForgeDirection.DOWN) )
|
||||
if ( entity.posX > this.tile.xCoord && entity.posX < this.tile.xCoord + 1 )
|
||||
if ( entity.posZ > this.tile.zCoord && entity.posZ < this.tile.zCoord + 1 )
|
||||
if ( (entity.posY > this.tile.yCoord + 0.9 && this.side == ForgeDirection.UP) || (entity.posY < this.tile.yCoord + 0.1 && this.side == ForgeDirection.DOWN) )
|
||||
capture = true;
|
||||
break;
|
||||
case SOUTH:
|
||||
case NORTH:
|
||||
if ( entity.posX > tile.xCoord && entity.posX < tile.xCoord + 1 )
|
||||
if ( entity.posY > tile.yCoord && entity.posY < tile.yCoord + 1 )
|
||||
if ( (entity.posZ > tile.zCoord + 0.9 && side == ForgeDirection.SOUTH)
|
||||
|| (entity.posZ < tile.zCoord + 0.1 && side == ForgeDirection.NORTH) )
|
||||
if ( entity.posX > this.tile.xCoord && entity.posX < this.tile.xCoord + 1 )
|
||||
if ( entity.posY > this.tile.yCoord && entity.posY < this.tile.yCoord + 1 )
|
||||
if ( (entity.posZ > this.tile.zCoord + 0.9 && this.side == ForgeDirection.SOUTH)
|
||||
|| (entity.posZ < this.tile.zCoord + 0.1 && this.side == ForgeDirection.NORTH) )
|
||||
capture = true;
|
||||
break;
|
||||
case EAST:
|
||||
case WEST:
|
||||
if ( entity.posZ > tile.zCoord && entity.posZ < tile.zCoord + 1 )
|
||||
if ( entity.posY > tile.yCoord && entity.posY < tile.yCoord + 1 )
|
||||
if ( (entity.posX > tile.xCoord + 0.9 && side == ForgeDirection.EAST)
|
||||
|| (entity.posX < tile.xCoord + 0.1 && side == ForgeDirection.WEST) )
|
||||
if ( entity.posZ > this.tile.zCoord && entity.posZ < this.tile.zCoord + 1 )
|
||||
if ( entity.posY > this.tile.yCoord && entity.posY < this.tile.yCoord + 1 )
|
||||
if ( (entity.posX > this.tile.xCoord + 0.9 && this.side == ForgeDirection.EAST)
|
||||
|| (entity.posX < this.tile.xCoord + 0.1 && this.side == ForgeDirection.WEST) )
|
||||
capture = true;
|
||||
break;
|
||||
default:
|
||||
@@ -397,16 +397,16 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
break;
|
||||
}
|
||||
|
||||
if ( capture && Platform.isServer() && proxy.isActive() )
|
||||
if ( capture && Platform.isServer() && this.proxy.isActive() )
|
||||
{
|
||||
IAEItemStack stack = AEItemStack.create( ((EntityItem) entity).getEntityItem() );
|
||||
if ( stack != null )
|
||||
{
|
||||
ServerHelper.proxy.sendToAllNearExcept( null, tile.xCoord, tile.yCoord, tile.zCoord, 64, tile.getWorldObj(),
|
||||
new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, side, false ) );
|
||||
ServerHelper.proxy.sendToAllNearExcept( null, this.tile.xCoord, this.tile.yCoord, this.tile.zCoord, 64, this.tile.getWorldObj(),
|
||||
new PacketTransitionEffect( entity.posX, entity.posY, entity.posZ, this.side, false ) );
|
||||
|
||||
Buffer.add( stack );
|
||||
storeBuffer();
|
||||
this.Buffer.add( stack );
|
||||
this.storeBuffer();
|
||||
entity.setDead();
|
||||
}
|
||||
}
|
||||
@@ -416,14 +416,14 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
if ( breaking )
|
||||
if ( this.breaking )
|
||||
return TickRateModulation.URGENT;
|
||||
|
||||
if ( isAccepting() )
|
||||
return EatBlock( false );
|
||||
if ( this.isAccepting() )
|
||||
return this.EatBlock( false );
|
||||
else
|
||||
{
|
||||
storeBuffer();
|
||||
this.storeBuffer();
|
||||
return TickRateModulation.IDLE;
|
||||
}
|
||||
}
|
||||
@@ -432,16 +432,16 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
{
|
||||
try
|
||||
{
|
||||
IStorageGrid storage = proxy.getStorage();
|
||||
IEnergyGrid energy = proxy.getEnergy();
|
||||
IStorageGrid storage = this.proxy.getStorage();
|
||||
IEnergyGrid energy = this.proxy.getEnergy();
|
||||
|
||||
while (!Buffer.isEmpty())
|
||||
while (!this.Buffer.isEmpty())
|
||||
{
|
||||
IAEItemStack storedItem = Buffer.pop();
|
||||
storedItem = Platform.poweredInsert( energy, storage.getItemInventory(), storedItem, mySrc );
|
||||
IAEItemStack storedItem = this.Buffer.pop();
|
||||
storedItem = Platform.poweredInsert( energy, storage.getItemInventory(), storedItem, this.mySrc );
|
||||
if ( storedItem != null )
|
||||
{
|
||||
Buffer.add( storedItem );
|
||||
this.Buffer.add( storedItem );
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -455,8 +455,8 @@ public class PartAnnihilationPlane extends PartBasicState implements IGridTickab
|
||||
@Override
|
||||
public Object call() throws Exception
|
||||
{
|
||||
breaking = false;
|
||||
return EatBlock( true );
|
||||
this.breaking = false;
|
||||
return this.EatBlock( true );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -69,24 +69,24 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
public PartExportBus(ItemStack is)
|
||||
{
|
||||
super( PartExportBus.class, is );
|
||||
settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
settings.registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
settings.registerSetting( Settings.CRAFT_ONLY, YesNo.NO );
|
||||
mySrc = new MachineSource( this );
|
||||
this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
this.settings.registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
this.settings.registerSetting( Settings.CRAFT_ONLY, YesNo.NO );
|
||||
this.mySrc = new MachineSource( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound extra)
|
||||
{
|
||||
super.readFromNBT( extra );
|
||||
cratingTracker.readFromNBT( extra );
|
||||
this.cratingTracker.readFromNBT( extra );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound extra)
|
||||
{
|
||||
super.writeToNBT( extra );
|
||||
cratingTracker.writeToNBT( extra );
|
||||
this.cratingTracker.writeToNBT( extra );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -97,7 +97,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
if ( Platform.isClient() )
|
||||
return true;
|
||||
|
||||
Platform.openGUI( player, getHost().getTile(), side, GuiBridge.GUI_BUS );
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_BUS );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
{
|
||||
|
||||
rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
|
||||
is.getIconIndex(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
|
||||
this.is.getIconIndex(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
|
||||
|
||||
rh.setBounds( 4, 4, 12, 12, 12, 14 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
@@ -126,9 +126,9 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
|
||||
{
|
||||
renderCache = rh.useSimplifiedRendering( x, y, z, this, renderCache );
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
rh.setTexture( CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
|
||||
is.getIconIndex(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
|
||||
this.is.getIconIndex(), CableBusTextures.PartExportSides.getIcon(), CableBusTextures.PartExportSides.getIcon() );
|
||||
|
||||
rh.setBounds( 4, 4, 12, 12, 12, 14 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
@@ -140,13 +140,13 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(), is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
|
||||
rh.setBounds( 6, 6, 11, 10, 10, 12 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -170,70 +170,70 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
@Override
|
||||
TickRateModulation doBusWork()
|
||||
{
|
||||
if ( !proxy.isActive() )
|
||||
if ( !this.proxy.isActive() )
|
||||
return TickRateModulation.IDLE;
|
||||
|
||||
itemToSend = 1;
|
||||
didSomething = false;
|
||||
this.itemToSend = 1;
|
||||
this.didSomething = false;
|
||||
|
||||
switch (getInstalledUpgrades( Upgrades.SPEED ))
|
||||
switch (this.getInstalledUpgrades( Upgrades.SPEED ))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
itemToSend = 1;
|
||||
this.itemToSend = 1;
|
||||
break;
|
||||
case 1:
|
||||
itemToSend = 8;
|
||||
this.itemToSend = 8;
|
||||
break;
|
||||
case 2:
|
||||
itemToSend = 32;
|
||||
this.itemToSend = 32;
|
||||
break;
|
||||
case 3:
|
||||
itemToSend = 64;
|
||||
this.itemToSend = 64;
|
||||
break;
|
||||
case 4:
|
||||
itemToSend = 96;
|
||||
this.itemToSend = 96;
|
||||
break;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
InventoryAdaptor d = getHandler();
|
||||
IMEMonitor<IAEItemStack> inv = proxy.getStorage().getItemInventory();
|
||||
IEnergyGrid energy = proxy.getEnergy();
|
||||
ICraftingGrid cg = proxy.getCrafting();
|
||||
FuzzyMode fzMode = (FuzzyMode) getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
InventoryAdaptor d = this.getHandler();
|
||||
IMEMonitor<IAEItemStack> inv = this.proxy.getStorage().getItemInventory();
|
||||
IEnergyGrid energy = this.proxy.getEnergy();
|
||||
ICraftingGrid cg = this.proxy.getCrafting();
|
||||
FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
|
||||
if ( d != null )
|
||||
{
|
||||
for (int x = 0; x < availableSlots() && itemToSend > 0; x++)
|
||||
for (int x = 0; x < this.availableSlots() && this.itemToSend > 0; x++)
|
||||
{
|
||||
IAEItemStack ais = config.getAEStackInSlot( x );
|
||||
if ( ais == null || itemToSend <= 0 || craftOnly() )
|
||||
IAEItemStack ais = this.config.getAEStackInSlot( x );
|
||||
if ( ais == null || this.itemToSend <= 0 || this.craftOnly() )
|
||||
{
|
||||
if ( isCraftingEnabled() )
|
||||
didSomething = cratingTracker.handleCrafting( x, itemToSend, ais, d, getTile().getWorldObj(), proxy.getGrid(), cg, mySrc )
|
||||
|| didSomething;
|
||||
if ( this.isCraftingEnabled() )
|
||||
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorldObj(), this.proxy.getGrid(), cg, this.mySrc )
|
||||
|| this.didSomething;
|
||||
continue;
|
||||
}
|
||||
|
||||
long before = itemToSend;
|
||||
long before = this.itemToSend;
|
||||
|
||||
if ( getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
{
|
||||
for (IAEItemStack o : ImmutableList.copyOf( inv.getStorageList().findFuzzy( ais, fzMode ) ))
|
||||
{
|
||||
pushItemIntoTarget( d, energy, inv, o );
|
||||
if ( itemToSend <= 0 )
|
||||
this.pushItemIntoTarget( d, energy, inv, o );
|
||||
if ( this.itemToSend <= 0 )
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
pushItemIntoTarget( d, energy, inv, ais );
|
||||
this.pushItemIntoTarget( d, energy, inv, ais );
|
||||
|
||||
if ( itemToSend == before && isCraftingEnabled() )
|
||||
didSomething = cratingTracker.handleCrafting( x, itemToSend, ais, d, getTile().getWorldObj(), proxy.getGrid(), cg, mySrc )
|
||||
|| didSomething;
|
||||
if ( this.itemToSend == before && this.isCraftingEnabled() )
|
||||
this.didSomething = this.cratingTracker.handleCrafting( x, this.itemToSend, ais, d, this.getTile().getWorldObj(), this.proxy.getGrid(), cg, this.mySrc )
|
||||
|| this.didSomething;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,45 +243,45 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
// :P
|
||||
}
|
||||
|
||||
return didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
return this.didSomething ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
|
||||
private boolean craftOnly()
|
||||
{
|
||||
return getConfigManager().getSetting( Settings.CRAFT_ONLY ) == YesNo.YES;
|
||||
return this.getConfigManager().getSetting( Settings.CRAFT_ONLY ) == YesNo.YES;
|
||||
}
|
||||
|
||||
private boolean isCraftingEnabled()
|
||||
{
|
||||
return getInstalledUpgrades( Upgrades.CRAFTING ) > 0;
|
||||
return this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0;
|
||||
}
|
||||
|
||||
private void pushItemIntoTarget(InventoryAdaptor d, IEnergyGrid energy, IMEInventory<IAEItemStack> inv, IAEItemStack ais)
|
||||
{
|
||||
ItemStack is = ais.getItemStack();
|
||||
is.stackSize = (int) itemToSend;
|
||||
is.stackSize = (int) this.itemToSend;
|
||||
|
||||
ItemStack o = d.simulateAdd( is );
|
||||
long canFit = o == null ? itemToSend : itemToSend - o.stackSize;
|
||||
long canFit = o == null ? this.itemToSend : this.itemToSend - o.stackSize;
|
||||
|
||||
if ( canFit > 0 )
|
||||
{
|
||||
ais = ais.copy();
|
||||
ais.setStackSize( canFit );
|
||||
IAEItemStack itemsToAdd = Platform.poweredExtraction( energy, inv, ais, mySrc );
|
||||
IAEItemStack itemsToAdd = Platform.poweredExtraction( energy, inv, ais, this.mySrc );
|
||||
|
||||
if ( itemsToAdd != null )
|
||||
{
|
||||
itemToSend -= itemsToAdd.getStackSize();
|
||||
this.itemToSend -= itemsToAdd.getStackSize();
|
||||
|
||||
ItemStack failed = d.addItems( itemsToAdd.getItemStack() );
|
||||
if ( failed != null )
|
||||
{
|
||||
ais.setStackSize( failed.stackSize );
|
||||
inv.injectItems( ais, Actionable.MODULATE, mySrc );
|
||||
inv.injectItems( ais, Actionable.MODULATE, this.mySrc );
|
||||
}
|
||||
else
|
||||
didSomething = true;
|
||||
this.didSomething = true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -290,13 +290,13 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
@Override
|
||||
public IAEItemStack injectCraftedItems(ICraftingLink link, IAEItemStack items, Actionable mode)
|
||||
{
|
||||
InventoryAdaptor d = getHandler();
|
||||
InventoryAdaptor d = this.getHandler();
|
||||
|
||||
try
|
||||
{
|
||||
if ( d != null && proxy.isActive() )
|
||||
if ( d != null && this.proxy.isActive() )
|
||||
{
|
||||
IEnergyGrid energy = proxy.getEnergy();
|
||||
IEnergyGrid energy = this.proxy.getEnergy();
|
||||
|
||||
double power = items.getStackSize();
|
||||
if ( energy.extractAEPower( power, mode, PowerMultiplier.CONFIG ) > power - 0.01 )
|
||||
@@ -318,37 +318,37 @@ public class PartExportBus extends PartSharedItemBus implements ICraftingRequest
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
return doBusWork();
|
||||
return this.doBusWork();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RedstoneMode getRSMode()
|
||||
{
|
||||
return (RedstoneMode) settings.getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
return (RedstoneMode) this.settings.getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSleeping()
|
||||
{
|
||||
return getHandler() == null || super.isSleeping();
|
||||
return this.getHandler() == null || super.isSleeping();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node)
|
||||
{
|
||||
return new TickingRequest( TickRates.ExportBus.min, TickRates.ExportBus.max, isSleeping(), false );
|
||||
return new TickingRequest( TickRates.ExportBus.min, TickRates.ExportBus.max, this.isSleeping(), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ImmutableSet<ICraftingLink> getRequestedJobs()
|
||||
{
|
||||
return cratingTracker.getRequestedJobs();
|
||||
return this.cratingTracker.getRequestedJobs();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void jobStateChange(ICraftingLink link)
|
||||
{
|
||||
cratingTracker.jobStateChange( link );
|
||||
this.cratingTracker.jobStateChange( link );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -89,8 +89,8 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
|
||||
public PartFormationPlane(ItemStack is) {
|
||||
super( PartFormationPlane.class, is );
|
||||
settings.registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
updateHandler();
|
||||
this.settings.registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
this.updateHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -101,7 +101,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
if ( Platform.isClient() )
|
||||
return true;
|
||||
|
||||
Platform.openGUI( player, getHost().getTile(), side, GuiBridge.GUI_FORMATION_PLANE );
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_FORMATION_PLANE );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
if ( name.equals( "config" ) )
|
||||
return Config;
|
||||
return this.Config;
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
}
|
||||
@@ -127,24 +127,24 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
@MENetworkEventSubscribe
|
||||
public void powerRender(MENetworkPowerStatusChange c)
|
||||
{
|
||||
boolean currentActive = proxy.isActive();
|
||||
if ( wasActive != currentActive )
|
||||
boolean currentActive = this.proxy.isActive();
|
||||
if ( this.wasActive != currentActive )
|
||||
{
|
||||
wasActive = currentActive;
|
||||
updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
getHost().markForUpdate();
|
||||
this.wasActive = currentActive;
|
||||
this.updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void updateChannels(MENetworkChannelsChanged changedChannels)
|
||||
{
|
||||
boolean currentActive = proxy.isActive();
|
||||
if ( wasActive != currentActive )
|
||||
boolean currentActive = this.proxy.isActive();
|
||||
if ( this.wasActive != currentActive )
|
||||
{
|
||||
wasActive = currentActive;
|
||||
updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
getHost().markForUpdate();
|
||||
this.wasActive = currentActive;
|
||||
this.updateHandler();// proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
this.getHost().markForUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer)
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||
CableBusTextures.PartPlaneSides.getIcon() );
|
||||
|
||||
rh.setBounds( 1, 1, 15, 15, 15, 16 );
|
||||
@@ -175,38 +175,38 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
ForgeDirection e = rh.getWorldX();
|
||||
ForgeDirection u = rh.getWorldY();
|
||||
|
||||
TileEntity te = getHost().getTile();
|
||||
TileEntity te = this.getHost().getTile();
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
|
||||
minX = 0;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
|
||||
maxX = 16;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
|
||||
minY = 0;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
|
||||
maxY = 16;
|
||||
|
||||
boolean isActive = (clientFlags & (POWERED_FLAG | CHANNEL_FLAG)) == (POWERED_FLAG | CHANNEL_FLAG);
|
||||
boolean isActive = (this.clientFlags & (this.POWERED_FLAG | this.CHANNEL_FLAG)) == (this.POWERED_FLAG | this.CHANNEL_FLAG);
|
||||
|
||||
renderCache = rh.useSimplifiedRendering( x, y, z, this, renderCache );
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
rh.setTexture( CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : is.getIconIndex(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : this.is.getIconIndex(),
|
||||
CableBusTextures.PartPlaneSides.getIcon(), CableBusTextures.PartPlaneSides.getIcon() );
|
||||
|
||||
rh.setBounds( minX, minY, 15, maxX, maxY, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : is.getIconIndex(),
|
||||
CableBusTextures.PartTransitionPlaneBack.getIcon(), isActive ? CableBusTextures.BlockFormPlaneOn.getIcon() : this.is.getIconIndex(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
|
||||
rh.setBounds( 5, 5, 14, 11, 11, 15 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
}
|
||||
|
||||
private boolean isTransitionPlane(TileEntity blockTileEntity, ForgeDirection side)
|
||||
@@ -227,7 +227,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
int maxX = 15;
|
||||
int maxY = 15;
|
||||
|
||||
IPartHost host = getHost();
|
||||
IPartHost host = this.getHost();
|
||||
if ( host != null )
|
||||
{
|
||||
TileEntity te = host.getTile();
|
||||
@@ -239,16 +239,16 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
ForgeDirection e = bch.getWorldX();
|
||||
ForgeDirection u = bch.getWorldY();
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - e.offsetX, y - e.offsetY, z - e.offsetZ ), this.side ) )
|
||||
minX = 0;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + e.offsetX, y + e.offsetY, z + e.offsetZ ), this.side ) )
|
||||
maxX = 16;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x - u.offsetX, y - u.offsetY, z - u.offsetZ ), this.side ) )
|
||||
minY = 0;
|
||||
|
||||
if ( isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), side ) )
|
||||
if ( this.isTransitionPlane( te.getWorldObj().getTileEntity( x + u.offsetX, y + u.offsetY, z + u.offsetZ ), this.side ) )
|
||||
maxY = 16;
|
||||
}
|
||||
|
||||
@@ -265,10 +265,10 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
@Override
|
||||
public List<IMEInventoryHandler> getCellArray(StorageChannel channel)
|
||||
{
|
||||
if ( proxy.isActive() && channel == StorageChannel.ITEMS )
|
||||
if ( this.proxy.isActive() && channel == StorageChannel.ITEMS )
|
||||
{
|
||||
List<IMEInventoryHandler> Handler = new ArrayList<IMEInventoryHandler>( 1 );
|
||||
Handler.add( myHandler );
|
||||
Handler.add( this.myHandler );
|
||||
return Handler;
|
||||
}
|
||||
return new ArrayList<IMEInventoryHandler>();
|
||||
@@ -277,16 +277,16 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
@Override
|
||||
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||
{
|
||||
updateHandler();
|
||||
host.markForSave();
|
||||
this.updateHandler();
|
||||
this.host.markForSave();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPriority(int newValue)
|
||||
{
|
||||
priority = newValue;
|
||||
host.markForSave();
|
||||
updateHandler();
|
||||
this.priority = newValue;
|
||||
this.host.markForSave();
|
||||
this.updateHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -294,40 +294,40 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
{
|
||||
super.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
||||
|
||||
if ( inv == Config )
|
||||
updateHandler();
|
||||
if ( inv == this.Config )
|
||||
this.updateHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upgradesChanged()
|
||||
{
|
||||
updateHandler();
|
||||
this.updateHandler();
|
||||
}
|
||||
|
||||
private void updateHandler()
|
||||
{
|
||||
myHandler.myAccess = AccessRestriction.WRITE;
|
||||
myHandler.myWhitelist = getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
||||
myHandler.myPriority = priority;
|
||||
this.myHandler.myAccess = AccessRestriction.WRITE;
|
||||
this.myHandler.myWhitelist = this.getInstalledUpgrades( Upgrades.INVERTER ) > 0 ? IncludeExclude.BLACKLIST : IncludeExclude.WHITELIST;
|
||||
this.myHandler.myPriority = this.priority;
|
||||
|
||||
IItemList<IAEItemStack> priorityList = AEApi.instance().storage().createItemList();
|
||||
|
||||
int slotsToUse = 18 + getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
|
||||
for (int x = 0; x < Config.getSizeInventory() && x < slotsToUse; x++)
|
||||
int slotsToUse = 18 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 9;
|
||||
for (int x = 0; x < this.Config.getSizeInventory() && x < slotsToUse; x++)
|
||||
{
|
||||
IAEItemStack is = Config.getAEStackInSlot( x );
|
||||
IAEItemStack is = this.Config.getAEStackInSlot( x );
|
||||
if ( is != null )
|
||||
priorityList.add( is );
|
||||
}
|
||||
|
||||
if ( getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
myHandler.myPartitionList = new FuzzyPriorityList( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) );
|
||||
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
this.myHandler.myPartitionList = new FuzzyPriorityList( priorityList, (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE ) );
|
||||
else
|
||||
myHandler.myPartitionList = new PrecisePriorityList( priorityList );
|
||||
this.myHandler.myPartitionList = new PrecisePriorityList( priorityList );
|
||||
|
||||
try
|
||||
{
|
||||
proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
this.proxy.getGrid().postEvent( new MENetworkCellArrayUpdate() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -339,17 +339,17 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
Config.writeToNBT( data, "config" );
|
||||
data.setInteger( "priority", priority );
|
||||
this.Config.writeToNBT( data, "config" );
|
||||
data.setInteger( "priority", this.priority );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data)
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
Config.readFromNBT( data, "config" );
|
||||
priority = data.getInteger( "priority" );
|
||||
updateHandler();
|
||||
this.Config.readFromNBT( data, "config" );
|
||||
this.priority = data.getInteger( "priority" );
|
||||
this.updateHandler();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -373,7 +373,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
@Override
|
||||
public int getPriority()
|
||||
{
|
||||
return priority;
|
||||
return this.priority;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -385,7 +385,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
TileEntity te = host.getTile();
|
||||
TileEntity te = this.host.getTile();
|
||||
World w = te.getWorldObj();
|
||||
ForgeDirection side = this.side;
|
||||
|
||||
@@ -393,13 +393,13 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
int y = te.yCoord + side.offsetY;
|
||||
int z = te.zCoord + side.offsetZ;
|
||||
|
||||
blocked = !w.getBlock( x, y, z ).isReplaceable( w, x, y, z );
|
||||
this.blocked = !w.getBlock( x, y, z ).isReplaceable( w, x, y, z );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAEItemStack injectItems(IAEItemStack input, Actionable type, BaseActionSource src)
|
||||
{
|
||||
if ( blocked || input == null || input.getStackSize() <= 0 )
|
||||
if ( this.blocked || input == null || input.getStackSize() <= 0 )
|
||||
return input;
|
||||
|
||||
ItemStack is = input.getItemStack();
|
||||
@@ -408,7 +408,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
long maxStorage = Math.min( input.getStackSize(), is.getMaxStackSize() );
|
||||
boolean worked = false;
|
||||
|
||||
TileEntity te = host.getTile();
|
||||
TileEntity te = this.host.getTile();
|
||||
World w = te.getWorldObj();
|
||||
ForgeDirection side = this.side;
|
||||
|
||||
@@ -422,7 +422,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
|| i instanceof ItemReed )
|
||||
{
|
||||
EntityPlayer player = Platform.getPlayer( (WorldServer) w );
|
||||
Platform.configurePlayer( player, side, tile );
|
||||
Platform.configurePlayer( player, side, this.tile );
|
||||
|
||||
if ( i instanceof ItemFirework )
|
||||
{
|
||||
@@ -514,7 +514,7 @@ public class PartFormationPlane extends PartUpgradeable implements ICellContaine
|
||||
}
|
||||
}
|
||||
|
||||
blocked = !w.getBlock( x, y, z ).isReplaceable( w, x, y, z );
|
||||
this.blocked = !w.getBlock( x, y, z ).isReplaceable( w, x, y, z );
|
||||
|
||||
if ( worked )
|
||||
{
|
||||
|
||||
@@ -60,9 +60,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
|
||||
public PartImportBus(ItemStack is) {
|
||||
super( PartImportBus.class, is );
|
||||
settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
settings.registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
mySrc = new MachineSource( this );
|
||||
this.settings.registerSetting( Settings.REDSTONE_CONTROLLED, RedstoneMode.IGNORE );
|
||||
this.settings.registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
this.mySrc = new MachineSource( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,7 +73,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
if ( Platform.isClient() )
|
||||
return true;
|
||||
|
||||
Platform.openGUI( player, getHost().getTile(), side, GuiBridge.GUI_BUS );
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_BUS );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
if ( stack == null || stack.getItem() == null )
|
||||
return false;
|
||||
|
||||
IAEItemStack out = destination.injectItems( lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, mySrc );
|
||||
IAEItemStack out = this.destination.injectItems( this.lastItemChecked = AEApi.instance().storage().createItemStack( stack ), Actionable.SIMULATE, this.mySrc );
|
||||
if ( out == null )
|
||||
return true;
|
||||
return out.getStackSize() != stack.stackSize;
|
||||
@@ -94,7 +94,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
|
||||
private IInventoryDestination configDestination( IMEMonitor<IAEItemStack> itemInventory )
|
||||
{
|
||||
destination = itemInventory;
|
||||
this.destination = itemInventory;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer)
|
||||
{
|
||||
rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
|
||||
is.getIconIndex(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
|
||||
this.is.getIconIndex(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
|
||||
|
||||
rh.setBounds( 3, 3, 15, 13, 13, 16 );
|
||||
rh.renderInventoryBox( renderer );
|
||||
@@ -119,9 +119,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
|
||||
{
|
||||
renderCache = rh.useSimplifiedRendering( x, y, z, this, renderCache );
|
||||
this.renderCache = rh.useSimplifiedRendering( x, y, z, this, this.renderCache );
|
||||
rh.setTexture( CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartMonitorBack.getIcon(),
|
||||
is.getIconIndex(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
|
||||
this.is.getIconIndex(), CableBusTextures.PartImportSides.getIcon(), CableBusTextures.PartImportSides.getIcon() );
|
||||
|
||||
rh.setBounds( 4, 4, 14, 12, 12, 16 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
@@ -132,13 +132,13 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
rh.setBounds( 6, 6, 12, 10, 10, 13 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
rh.setTexture( CableBusTextures.PartMonitorSidesStatus.getIcon(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(), is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorBack.getIcon(), this.is.getIconIndex(), CableBusTextures.PartMonitorSidesStatus.getIcon(),
|
||||
CableBusTextures.PartMonitorSidesStatus.getIcon() );
|
||||
|
||||
rh.setBounds( 6, 6, 11, 10, 10, 12 );
|
||||
rh.renderBlock( x, y, z, renderer );
|
||||
|
||||
renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -158,7 +158,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
@Override
|
||||
public TickingRequest getTickingRequest(IGridNode node)
|
||||
{
|
||||
return new TickingRequest( TickRates.ImportBus.min, TickRates.ImportBus.max, getHandler() == null, false );
|
||||
return new TickingRequest( TickRates.ImportBus.min, TickRates.ImportBus.max, this.getHandler() == null, false );
|
||||
}
|
||||
|
||||
private int itemToSend; // used in tickingRequest
|
||||
@@ -167,52 +167,52 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
@Override
|
||||
TickRateModulation doBusWork()
|
||||
{
|
||||
if ( !proxy.isActive() )
|
||||
if ( !this.proxy.isActive() )
|
||||
return TickRateModulation.IDLE;
|
||||
|
||||
worked = false;
|
||||
this.worked = false;
|
||||
|
||||
InventoryAdaptor myAdaptor = getHandler();
|
||||
FuzzyMode fzMode = (FuzzyMode) getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
InventoryAdaptor myAdaptor = this.getHandler();
|
||||
FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
|
||||
if ( myAdaptor != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
switch (getInstalledUpgrades( Upgrades.SPEED ))
|
||||
switch (this.getInstalledUpgrades( Upgrades.SPEED ))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
itemToSend = 1;
|
||||
this.itemToSend = 1;
|
||||
break;
|
||||
case 1:
|
||||
itemToSend = 8;
|
||||
this.itemToSend = 8;
|
||||
break;
|
||||
case 2:
|
||||
itemToSend = 32;
|
||||
this.itemToSend = 32;
|
||||
break;
|
||||
case 3:
|
||||
itemToSend = 64;
|
||||
this.itemToSend = 64;
|
||||
break;
|
||||
case 4:
|
||||
itemToSend = 96;
|
||||
this.itemToSend = 96;
|
||||
break;
|
||||
}
|
||||
|
||||
itemToSend = Math.min( itemToSend, (int) (0.01 + proxy.getEnergy().extractAEPower( itemToSend, Actionable.SIMULATE, PowerMultiplier.CONFIG )) );
|
||||
IMEMonitor<IAEItemStack> inv = proxy.getStorage().getItemInventory();
|
||||
IEnergyGrid energy = proxy.getEnergy();
|
||||
this.itemToSend = Math.min( this.itemToSend, (int) (0.01 + this.proxy.getEnergy().extractAEPower( this.itemToSend, Actionable.SIMULATE, PowerMultiplier.CONFIG )) );
|
||||
IMEMonitor<IAEItemStack> inv = this.proxy.getStorage().getItemInventory();
|
||||
IEnergyGrid energy = this.proxy.getEnergy();
|
||||
|
||||
boolean Configured = false;
|
||||
for (int x = 0; x < availableSlots(); x++)
|
||||
for (int x = 0; x < this.availableSlots(); x++)
|
||||
{
|
||||
IAEItemStack ais = config.getAEStackInSlot( x );
|
||||
if ( ais != null && itemToSend > 0 )
|
||||
IAEItemStack ais = this.config.getAEStackInSlot( x );
|
||||
if ( ais != null && this.itemToSend > 0 )
|
||||
{
|
||||
Configured = true;
|
||||
while (itemToSend > 0)
|
||||
while (this.itemToSend > 0)
|
||||
{
|
||||
if ( importStuff( myAdaptor, ais, inv, energy, fzMode ) )
|
||||
if ( this.importStuff( myAdaptor, ais, inv, energy, fzMode ) )
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -220,9 +220,9 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
|
||||
if ( !Configured )
|
||||
{
|
||||
while (itemToSend > 0)
|
||||
while (this.itemToSend > 0)
|
||||
{
|
||||
if ( importStuff( myAdaptor, null, inv, energy, fzMode ) )
|
||||
if ( this.importStuff( myAdaptor, null, inv, energy, fzMode ) )
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -235,13 +235,13 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
else
|
||||
return TickRateModulation.SLEEP;
|
||||
|
||||
return worked ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
return this.worked ? TickRateModulation.FASTER : TickRateModulation.SLOWER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TickRateModulation tickingRequest(IGridNode node, int TicksSinceLastCall)
|
||||
{
|
||||
return doBusWork();
|
||||
return this.doBusWork();
|
||||
}
|
||||
|
||||
private boolean importStuff(InventoryAdaptor myAdaptor, IAEItemStack whatToImport, IMEMonitor<IAEItemStack> inv, IEnergySource energy, FuzzyMode fzMode)
|
||||
@@ -252,22 +252,22 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
toSend = 64;
|
||||
|
||||
ItemStack newItems;
|
||||
if ( getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
newItems = myAdaptor.removeSimilarItems( toSend, whatToImport == null ? null : whatToImport.getItemStack(), fzMode, configDestination( inv ) );
|
||||
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
newItems = myAdaptor.removeSimilarItems( toSend, whatToImport == null ? null : whatToImport.getItemStack(), fzMode, this.configDestination( inv ) );
|
||||
else
|
||||
newItems = myAdaptor.removeItems( toSend, whatToImport == null ? null : whatToImport.getItemStack(), configDestination( inv ) );
|
||||
newItems = myAdaptor.removeItems( toSend, whatToImport == null ? null : whatToImport.getItemStack(), this.configDestination( inv ) );
|
||||
|
||||
if ( newItems != null )
|
||||
{
|
||||
newItems.stackSize = (int) (Math.min( newItems.stackSize, energy.extractAEPower( newItems.stackSize, Actionable.SIMULATE, PowerMultiplier.CONFIG ) ) + 0.01);
|
||||
itemToSend -= newItems.stackSize;
|
||||
this.itemToSend -= newItems.stackSize;
|
||||
|
||||
if ( lastItemChecked == null || !lastItemChecked.isSameType( newItems ) )
|
||||
lastItemChecked = AEApi.instance().storage().createItemStack( newItems );
|
||||
if ( this.lastItemChecked == null || !this.lastItemChecked.isSameType( newItems ) )
|
||||
this.lastItemChecked = AEApi.instance().storage().createItemStack( newItems );
|
||||
else
|
||||
lastItemChecked.setStackSize( newItems.stackSize );
|
||||
this.lastItemChecked.setStackSize( newItems.stackSize );
|
||||
|
||||
IAEItemStack failed = Platform.poweredInsert( energy, destination, lastItemChecked, mySrc );
|
||||
IAEItemStack failed = Platform.poweredInsert( energy, this.destination, this.lastItemChecked, this.mySrc );
|
||||
// destination.injectItems( lastItemChecked, Actionable.MODULATE );
|
||||
if ( failed != null )
|
||||
{
|
||||
@@ -275,7 +275,7 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
return true;
|
||||
}
|
||||
else
|
||||
worked = true;
|
||||
this.worked = true;
|
||||
}
|
||||
else
|
||||
return true;
|
||||
@@ -286,13 +286,13 @@ public class PartImportBus extends PartSharedItemBus implements IInventoryDestin
|
||||
@Override
|
||||
public RedstoneMode getRSMode()
|
||||
{
|
||||
return (RedstoneMode) settings.getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
return (RedstoneMode) this.settings.getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isSleeping()
|
||||
{
|
||||
return getHandler() == null || super.isSleeping();
|
||||
return this.getHandler() == null || super.isSleeping();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -94,54 +94,54 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
|
||||
public long getReportingValue()
|
||||
{
|
||||
return reportingValue;
|
||||
return this.reportingValue;
|
||||
}
|
||||
|
||||
public void setReportingValue(long v)
|
||||
{
|
||||
reportingValue = v;
|
||||
if ( getConfigManager().getSetting( Settings.LEVEL_TYPE ) == LevelType.ENERGY_LEVEL )
|
||||
configureWatchers();
|
||||
this.reportingValue = v;
|
||||
if ( this.getConfigManager().getSetting( Settings.LEVEL_TYPE ) == LevelType.ENERGY_LEVEL )
|
||||
this.configureWatchers();
|
||||
else
|
||||
updateState();
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void powerChanged(MENetworkPowerStatusChange c)
|
||||
{
|
||||
updateState();
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
@MENetworkEventSubscribe
|
||||
public void channelChanged(MENetworkChannelsChanged c)
|
||||
{
|
||||
updateState();
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void upgradesChanged()
|
||||
{
|
||||
configureWatchers();
|
||||
this.configureWatchers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||
{
|
||||
configureWatchers();
|
||||
this.configureWatchers();
|
||||
}
|
||||
|
||||
private void updateState()
|
||||
{
|
||||
if ( proxy.isActive() )
|
||||
if ( this.proxy.isActive() )
|
||||
{
|
||||
boolean isOn = isLevelEmitterOn();
|
||||
if ( prevState != isOn )
|
||||
boolean isOn = this.isLevelEmitterOn();
|
||||
if ( this.prevState != isOn )
|
||||
{
|
||||
host.markForUpdate();
|
||||
TileEntity te = host.getTile();
|
||||
prevState = isOn;
|
||||
this.host.markForUpdate();
|
||||
TileEntity te = this.host.getTile();
|
||||
this.prevState = isOn;
|
||||
Platform.notifyBlocksOfNeighbors( te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord );
|
||||
Platform.notifyBlocksOfNeighbors( te.getWorldObj(), te.xCoord + side.offsetX, te.yCoord + side.offsetY, te.zCoord + side.offsetZ );
|
||||
Platform.notifyBlocksOfNeighbors( te.getWorldObj(), te.xCoord + this.side.offsetX, te.yCoord + this.side.offsetY, te.zCoord + this.side.offsetZ );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -150,93 +150,93 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
public void writeToNBT(NBTTagCompound data)
|
||||
{
|
||||
super.writeToNBT( data );
|
||||
data.setLong( "lastReportedValue", lastReportedValue );
|
||||
data.setLong( "reportingValue", reportingValue );
|
||||
data.setBoolean( "prevState", prevState );
|
||||
config.writeToNBT( data, "config" );
|
||||
data.setLong( "lastReportedValue", this.lastReportedValue );
|
||||
data.setLong( "reportingValue", this.reportingValue );
|
||||
data.setBoolean( "prevState", this.prevState );
|
||||
this.config.writeToNBT( data, "config" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound data)
|
||||
{
|
||||
super.readFromNBT( data );
|
||||
lastReportedValue = data.getLong( "lastReportedValue" );
|
||||
reportingValue = data.getLong( "reportingValue" );
|
||||
prevState = data.getBoolean( "prevState" );
|
||||
config.readFromNBT( data, "config" );
|
||||
this.lastReportedValue = data.getLong( "lastReportedValue" );
|
||||
this.reportingValue = data.getLong( "reportingValue" );
|
||||
this.prevState = data.getBoolean( "prevState" );
|
||||
this.config.readFromNBT( data, "config" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int populateFlags(int cf)
|
||||
{
|
||||
return cf | (prevState ? FLAG_ON : 0);
|
||||
return cf | (this.prevState ? this.FLAG_ON : 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWatcher(ICraftingWatcher newWatcher)
|
||||
{
|
||||
myCraftingWatcher = newWatcher;
|
||||
configureWatchers();
|
||||
this.myCraftingWatcher = newWatcher;
|
||||
this.configureWatchers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWatcher(IStackWatcher newWatcher)
|
||||
{
|
||||
myWatcher = newWatcher;
|
||||
configureWatchers();
|
||||
this.myWatcher = newWatcher;
|
||||
this.configureWatchers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateWatcher(IEnergyWatcher newWatcher)
|
||||
{
|
||||
myEnergyWatcher = newWatcher;
|
||||
configureWatchers();
|
||||
this.myEnergyWatcher = newWatcher;
|
||||
this.configureWatchers();
|
||||
}
|
||||
|
||||
// update the system...
|
||||
public void configureWatchers()
|
||||
{
|
||||
IAEItemStack myStack = config.getAEStackInSlot( 0 );
|
||||
IAEItemStack myStack = this.config.getAEStackInSlot( 0 );
|
||||
|
||||
if ( myWatcher != null )
|
||||
myWatcher.clear();
|
||||
if ( this.myWatcher != null )
|
||||
this.myWatcher.clear();
|
||||
|
||||
if ( myEnergyWatcher != null )
|
||||
myEnergyWatcher.clear();
|
||||
if ( this.myEnergyWatcher != null )
|
||||
this.myEnergyWatcher.clear();
|
||||
|
||||
if ( myCraftingWatcher != null )
|
||||
myCraftingWatcher.clear();
|
||||
if ( this.myCraftingWatcher != null )
|
||||
this.myCraftingWatcher.clear();
|
||||
|
||||
try
|
||||
{
|
||||
proxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, proxy.getNode() ) );
|
||||
this.proxy.getGrid().postEvent( new MENetworkCraftingPatternChange( this, this.proxy.getNode() ) );
|
||||
}
|
||||
catch (GridAccessException e1)
|
||||
{
|
||||
// :/
|
||||
}
|
||||
|
||||
if ( getInstalledUpgrades( Upgrades.CRAFTING ) > 0 )
|
||||
if ( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 )
|
||||
{
|
||||
if ( myCraftingWatcher != null && myStack != null )
|
||||
myCraftingWatcher.add( myStack );
|
||||
if ( this.myCraftingWatcher != null && myStack != null )
|
||||
this.myCraftingWatcher.add( myStack );
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ( getConfigManager().getSetting( Settings.LEVEL_TYPE ) == LevelType.ENERGY_LEVEL )
|
||||
if ( this.getConfigManager().getSetting( Settings.LEVEL_TYPE ) == LevelType.ENERGY_LEVEL )
|
||||
{
|
||||
if ( myEnergyWatcher != null )
|
||||
myEnergyWatcher.add( (double) reportingValue );
|
||||
if ( this.myEnergyWatcher != null )
|
||||
this.myEnergyWatcher.add( (double) this.reportingValue );
|
||||
|
||||
try
|
||||
{
|
||||
// update to power...
|
||||
lastReportedValue = (long) proxy.getEnergy().getStoredPower();
|
||||
updateState();
|
||||
this.lastReportedValue = (long) this.proxy.getEnergy().getStoredPower();
|
||||
this.updateState();
|
||||
|
||||
// no more item stuff..
|
||||
proxy.getStorage().getItemInventory().removeListener( this );
|
||||
this.proxy.getStorage().getItemInventory().removeListener( this );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -248,19 +248,19 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
|
||||
try
|
||||
{
|
||||
if ( getInstalledUpgrades( Upgrades.FUZZY ) > 0 || myStack == null )
|
||||
if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 || myStack == null )
|
||||
{
|
||||
proxy.getStorage().getItemInventory().addListener( this, proxy.getGrid() );
|
||||
this.proxy.getStorage().getItemInventory().addListener( this, this.proxy.getGrid() );
|
||||
}
|
||||
else
|
||||
{
|
||||
proxy.getStorage().getItemInventory().removeListener( this );
|
||||
this.proxy.getStorage().getItemInventory().removeListener( this );
|
||||
|
||||
if ( myWatcher != null )
|
||||
myWatcher.add( myStack );
|
||||
if ( this.myWatcher != null )
|
||||
this.myWatcher.add( myStack );
|
||||
}
|
||||
|
||||
updateReportingValue( proxy.getStorage().getItemInventory() );
|
||||
this.updateReportingValue( this.proxy.getStorage().getItemInventory() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -271,8 +271,8 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
||||
{
|
||||
if ( inv == config )
|
||||
configureWatchers();
|
||||
if ( inv == this.config )
|
||||
this.configureWatchers();
|
||||
|
||||
super.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
||||
}
|
||||
@@ -280,7 +280,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
@Override
|
||||
public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource actionSource)
|
||||
{
|
||||
updateReportingValue( (IMEMonitor<IAEItemStack>) monitor );
|
||||
this.updateReportingValue( (IMEMonitor<IAEItemStack>) monitor );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -291,7 +291,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
if ( Platform.isClient() )
|
||||
return true;
|
||||
|
||||
Platform.openGUI( player, getHost().getTile(), side, GuiBridge.GUI_LEVEL_EMITTER );
|
||||
Platform.openGUI( player, this.getHost().getTile(), this.side, GuiBridge.GUI_LEVEL_EMITTER );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -300,32 +300,32 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
|
||||
private void updateReportingValue(IMEMonitor<IAEItemStack> monitor)
|
||||
{
|
||||
IAEItemStack myStack = config.getAEStackInSlot( 0 );
|
||||
IAEItemStack myStack = this.config.getAEStackInSlot( 0 );
|
||||
|
||||
if ( myStack == null )
|
||||
{
|
||||
lastReportedValue = 0;
|
||||
this.lastReportedValue = 0;
|
||||
for (IAEItemStack st : monitor.getStorageList())
|
||||
lastReportedValue += st.getStackSize();
|
||||
this.lastReportedValue += st.getStackSize();
|
||||
}
|
||||
else if ( getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
else if ( this.getInstalledUpgrades( Upgrades.FUZZY ) > 0 )
|
||||
{
|
||||
lastReportedValue = 0;
|
||||
FuzzyMode fzMode = (FuzzyMode) getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
this.lastReportedValue = 0;
|
||||
FuzzyMode fzMode = (FuzzyMode) this.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
Collection<IAEItemStack> fuzzyList = monitor.getStorageList().findFuzzy( myStack, fzMode );
|
||||
for (IAEItemStack st : fuzzyList)
|
||||
lastReportedValue += st.getStackSize();
|
||||
this.lastReportedValue += st.getStackSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack r = monitor.getStorageList().findPrecise( myStack );
|
||||
if ( r == null )
|
||||
lastReportedValue = 0;
|
||||
this.lastReportedValue = 0;
|
||||
else
|
||||
lastReportedValue = r.getStackSize();
|
||||
this.lastReportedValue = r.getStackSize();
|
||||
}
|
||||
|
||||
updateState();
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -333,7 +333,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
{
|
||||
try
|
||||
{
|
||||
return proxy.getGrid() == effectiveGrid;
|
||||
return this.proxy.getGrid() == effectiveGrid;
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -344,41 +344,41 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
@Override
|
||||
public void onRequestChange(ICraftingGrid craftingGrid, IAEItemStack what)
|
||||
{
|
||||
updateState();
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onThresholdPass(IEnergyGrid energyGrid)
|
||||
{
|
||||
lastReportedValue = (long) energyGrid.getStoredPower();
|
||||
updateState();
|
||||
this.lastReportedValue = (long) energyGrid.getStoredPower();
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStackChange(IItemList o, IAEStack fullStack, IAEStack diffStack, BaseActionSource src, StorageChannel chan)
|
||||
{
|
||||
if ( chan == StorageChannel.ITEMS && fullStack.equals( config.getAEStackInSlot( 0 ) ) && getInstalledUpgrades( Upgrades.FUZZY ) == 0 )
|
||||
if ( chan == StorageChannel.ITEMS && fullStack.equals( this.config.getAEStackInSlot( 0 ) ) && this.getInstalledUpgrades( Upgrades.FUZZY ) == 0 )
|
||||
{
|
||||
lastReportedValue = fullStack.getStackSize();
|
||||
updateState();
|
||||
this.lastReportedValue = fullStack.getStackSize();
|
||||
this.updateState();
|
||||
}
|
||||
}
|
||||
|
||||
public PartLevelEmitter(ItemStack is) {
|
||||
super( PartLevelEmitter.class, is );
|
||||
getConfigManager().registerSetting( Settings.REDSTONE_EMITTER, RedstoneMode.HIGH_SIGNAL );
|
||||
getConfigManager().registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
getConfigManager().registerSetting( Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL );
|
||||
getConfigManager().registerSetting( Settings.CRAFT_VIA_REDSTONE, YesNo.NO );
|
||||
this.getConfigManager().registerSetting( Settings.REDSTONE_EMITTER, RedstoneMode.HIGH_SIGNAL );
|
||||
this.getConfigManager().registerSetting( Settings.FUZZY_MODE, FuzzyMode.IGNORE_ALL );
|
||||
this.getConfigManager().registerSetting( Settings.LEVEL_TYPE, LevelType.ITEM_LEVEL );
|
||||
this.getConfigManager().registerSetting( Settings.CRAFT_VIA_REDSTONE, YesNo.NO );
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderInventory(IPartRenderHelper rh, RenderBlocks renderer)
|
||||
{
|
||||
rh.setTexture( is.getIconIndex() );
|
||||
rh.setTexture( this.is.getIconIndex() );
|
||||
Tessellator.instance.startDrawingQuads();
|
||||
renderTorchAtAngle( 0, -0.5, 0 );
|
||||
this.renderTorchAtAngle( 0, -0.5, 0 );
|
||||
Tessellator.instance.draw();
|
||||
// rh.setBounds( 7, 7, 10, 9, 9, 15 );
|
||||
// rh.renderInventoryBox( renderer );
|
||||
@@ -392,17 +392,17 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
{
|
||||
Tessellator var12 = Tessellator.instance;
|
||||
|
||||
x -= centerX;
|
||||
y -= centerY;
|
||||
z -= centerZ;
|
||||
x -= this.centerX;
|
||||
y -= this.centerY;
|
||||
z -= this.centerZ;
|
||||
|
||||
if ( side == ForgeDirection.DOWN )
|
||||
if ( this.side == ForgeDirection.DOWN )
|
||||
{
|
||||
y = -y;
|
||||
z = -z;
|
||||
}
|
||||
|
||||
if ( side == ForgeDirection.EAST )
|
||||
if ( this.side == ForgeDirection.EAST )
|
||||
{
|
||||
double m = x;
|
||||
x = y;
|
||||
@@ -410,14 +410,14 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
y = -y;
|
||||
}
|
||||
|
||||
if ( side == ForgeDirection.WEST )
|
||||
if ( this.side == ForgeDirection.WEST )
|
||||
{
|
||||
double m = x;
|
||||
x = -y;
|
||||
y = m;
|
||||
}
|
||||
|
||||
if ( side == ForgeDirection.SOUTH )
|
||||
if ( this.side == ForgeDirection.SOUTH )
|
||||
{
|
||||
double m = z;
|
||||
z = y;
|
||||
@@ -425,16 +425,16 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
y = -y;
|
||||
}
|
||||
|
||||
if ( side == ForgeDirection.NORTH )
|
||||
if ( this.side == ForgeDirection.NORTH )
|
||||
{
|
||||
double m = z;
|
||||
z = -y;
|
||||
y = m;
|
||||
}
|
||||
|
||||
x += centerX;// + orientation.offsetX * 0.4;
|
||||
y += centerY;// + orientation.offsetY * 0.4;
|
||||
z += centerZ;// + orientation.offsetZ * 0.4;
|
||||
x += this.centerX;// + orientation.offsetX * 0.4;
|
||||
y += this.centerY;// + orientation.offsetY * 0.4;
|
||||
z += this.centerZ;// + orientation.offsetZ * 0.4;
|
||||
|
||||
var12.addVertexWithUV( x, y, z, u, v );
|
||||
}
|
||||
@@ -442,9 +442,9 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random r)
|
||||
{
|
||||
if ( isLevelEmitterOn() )
|
||||
if ( this.isLevelEmitterOn() )
|
||||
{
|
||||
ForgeDirection d = side;
|
||||
ForgeDirection d = this.side;
|
||||
|
||||
double d0 = d.offsetX * 0.45F + (r.nextFloat() - 0.5F) * 0.2D;
|
||||
double d1 = d.offsetY * 0.45F + (r.nextFloat() - 0.5F) * 0.2D;
|
||||
@@ -456,13 +456,13 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
|
||||
public void renderTorchAtAngle(double baseX, double baseY, double baseZ)
|
||||
{
|
||||
boolean isOn = isLevelEmitterOn();
|
||||
IIcon offTexture = is.getIconIndex();
|
||||
boolean isOn = this.isLevelEmitterOn();
|
||||
IIcon offTexture = this.is.getIconIndex();
|
||||
IIcon IIcon = (isOn ? CableBusTextures.LevelEmitterTorchOn.getIcon() : offTexture);
|
||||
//
|
||||
centerX = baseX + 0.5;
|
||||
centerY = baseY + 0.5;
|
||||
centerZ = baseZ + 0.5;
|
||||
this.centerX = baseX + 0.5;
|
||||
this.centerY = baseY + 0.5;
|
||||
this.centerZ = baseZ + 0.5;
|
||||
|
||||
baseY += 7.0 / 16.0;
|
||||
|
||||
@@ -567,31 +567,31 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
private boolean isLevelEmitterOn()
|
||||
{
|
||||
if ( Platform.isClient() )
|
||||
return (clientFlags & FLAG_ON) == FLAG_ON;
|
||||
return (this.clientFlags & this.FLAG_ON) == this.FLAG_ON;
|
||||
|
||||
if ( getInstalledUpgrades( Upgrades.CRAFTING ) > 0 )
|
||||
if ( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 )
|
||||
{
|
||||
try
|
||||
{
|
||||
return proxy.getCrafting().isRequesting( config.getAEStackInSlot( 0 ) );
|
||||
return this.proxy.getCrafting().isRequesting( this.config.getAEStackInSlot( 0 ) );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
return prevState;
|
||||
return this.prevState;
|
||||
}
|
||||
|
||||
boolean flipState = getConfigManager().getSetting( Settings.REDSTONE_EMITTER ) == RedstoneMode.LOW_SIGNAL;
|
||||
return flipState ? reportingValue >= lastReportedValue + 1 : reportingValue < lastReportedValue + 1;
|
||||
boolean flipState = this.getConfigManager().getSetting( Settings.REDSTONE_EMITTER ) == RedstoneMode.LOW_SIGNAL;
|
||||
return flipState ? this.reportingValue >= this.lastReportedValue + 1 : this.reportingValue < this.lastReportedValue + 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void renderStatic(int x, int y, int z, IPartRenderHelper rh, RenderBlocks renderer)
|
||||
{
|
||||
rh.setTexture( is.getIconIndex() );
|
||||
rh.setTexture( this.is.getIconIndex() );
|
||||
// rh.setTexture( CableBusTextures.ItemPartLevelEmitterOn.getIcon() );
|
||||
|
||||
// rh.setBounds( 2, 2, 14, 14, 14, 16 );
|
||||
@@ -606,12 +606,12 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
tess.setBrightness( rh.getBlock().getMixedBrightnessForBlock( this.getHost().getTile().getWorldObj(), x, y, z ) );
|
||||
tess.setColorOpaque_F( 1.0F, 1.0F, 1.0F );
|
||||
|
||||
renderTorchAtAngle( x, y, z );
|
||||
this.renderTorchAtAngle( x, y, z );
|
||||
|
||||
renderer.renderAllFaces = false;
|
||||
|
||||
rh.setBounds( 7, 7, 11, 9, 9, 12 );
|
||||
renderLights( x, y, z, rh, renderer );
|
||||
this.renderLights( x, y, z, rh, renderer );
|
||||
|
||||
// super.renderWorldBlock( world, x, y, z, block, modelId, renderer );
|
||||
}
|
||||
@@ -619,7 +619,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
@Override
|
||||
public IIcon getBreakingTexture()
|
||||
{
|
||||
return is.getIconIndex();
|
||||
return this.is.getIconIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -649,20 +649,20 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
@Override
|
||||
public int isProvidingStrongPower()
|
||||
{
|
||||
return prevState ? 15 : 0;
|
||||
return this.prevState ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int isProvidingWeakPower()
|
||||
{
|
||||
return prevState ? 15 : 0;
|
||||
return this.prevState ? 15 : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
if ( name.equals( "config" ) )
|
||||
return config;
|
||||
return this.config;
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
}
|
||||
@@ -672,7 +672,7 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
{
|
||||
try
|
||||
{
|
||||
updateReportingValue( proxy.getStorage().getItemInventory() );
|
||||
this.updateReportingValue( this.proxy.getStorage().getItemInventory() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -695,11 +695,11 @@ public class PartLevelEmitter extends PartUpgradeable implements IEnergyWatcherH
|
||||
@Override
|
||||
public void provideCrafting(ICraftingProviderHelper craftingTracker)
|
||||
{
|
||||
if ( getInstalledUpgrades( Upgrades.CRAFTING ) > 0 )
|
||||
if ( this.getInstalledUpgrades( Upgrades.CRAFTING ) > 0 )
|
||||
{
|
||||
if ( settings.getSetting( Settings.CRAFT_VIA_REDSTONE ) == YesNo.YES )
|
||||
if ( this.settings.getSetting( Settings.CRAFT_VIA_REDSTONE ) == YesNo.YES )
|
||||
{
|
||||
IAEItemStack what = config.getAEStackInSlot( 0 );
|
||||
IAEItemStack what = this.config.getAEStackInSlot( 0 );
|
||||
if ( what != null )
|
||||
craftingTracker.setEmitable( what );
|
||||
}
|
||||
|
||||
@@ -53,26 +53,26 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
||||
@Override
|
||||
public void upgradesChanged()
|
||||
{
|
||||
updateState();
|
||||
this.updateState();
|
||||
}
|
||||
|
||||
protected int availableSlots()
|
||||
{
|
||||
return Math.min( 1 + getInstalledUpgrades( Upgrades.CAPACITY ) * 4, config.getSizeInventory() );
|
||||
return Math.min( 1 + this.getInstalledUpgrades( Upgrades.CAPACITY ) * 4, this.config.getSizeInventory() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(net.minecraft.nbt.NBTTagCompound extra)
|
||||
{
|
||||
super.writeToNBT( extra );
|
||||
config.writeToNBT( extra, "config" );
|
||||
this.config.writeToNBT( extra, "config" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(net.minecraft.nbt.NBTTagCompound extra)
|
||||
{
|
||||
super.readFromNBT( extra );
|
||||
config.readFromNBT( extra, "config" );
|
||||
this.config.readFromNBT( extra, "config" );
|
||||
}
|
||||
|
||||
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 9 );
|
||||
@@ -82,18 +82,18 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
||||
|
||||
InventoryAdaptor getHandler()
|
||||
{
|
||||
TileEntity self = getHost().getTile();
|
||||
TileEntity target = getTileEntity( self, self.xCoord + side.offsetX, self.yCoord + side.offsetY, self.zCoord + side.offsetZ );
|
||||
TileEntity self = this.getHost().getTile();
|
||||
TileEntity target = this.getTileEntity( self, self.xCoord + this.side.offsetX, self.yCoord + this.side.offsetY, self.zCoord + this.side.offsetZ );
|
||||
|
||||
int newAdaptorHash = Platform.generateTileHash( target );
|
||||
|
||||
if ( adaptorHash == newAdaptorHash && newAdaptorHash != 0 )
|
||||
return adaptor;
|
||||
if ( this.adaptorHash == newAdaptorHash && newAdaptorHash != 0 )
|
||||
return this.adaptor;
|
||||
|
||||
adaptorHash = newAdaptorHash;
|
||||
adaptor = InventoryAdaptor.getAdaptor( target, side.getOpposite() );
|
||||
this.adaptorHash = newAdaptorHash;
|
||||
this.adaptor = InventoryAdaptor.getAdaptor( target, this.side.getOpposite() );
|
||||
|
||||
return adaptor;
|
||||
return this.adaptor;
|
||||
}
|
||||
|
||||
boolean lastRedstone = false;
|
||||
@@ -103,12 +103,12 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
||||
@Override
|
||||
public void onNeighborChanged()
|
||||
{
|
||||
updateState();
|
||||
if ( lastRedstone != host.hasRedstone( side ) )
|
||||
this.updateState();
|
||||
if ( this.lastRedstone != this.host.hasRedstone( this.side ) )
|
||||
{
|
||||
lastRedstone = !lastRedstone;
|
||||
if ( lastRedstone && getRSMode() == RedstoneMode.SIGNAL_PULSE )
|
||||
doBusWork();
|
||||
this.lastRedstone = !this.lastRedstone;
|
||||
if ( this.lastRedstone && this.getRSMode() == RedstoneMode.SIGNAL_PULSE )
|
||||
this.doBusWork();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,10 +116,10 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( !isSleeping() )
|
||||
proxy.getTick().wakeDevice( proxy.getNode() );
|
||||
if ( !this.isSleeping() )
|
||||
this.proxy.getTick().wakeDevice( this.proxy.getNode() );
|
||||
else
|
||||
proxy.getTick().sleepDevice( proxy.getNode() );
|
||||
this.proxy.getTick().sleepDevice( this.proxy.getNode() );
|
||||
}
|
||||
catch (GridAccessException e)
|
||||
{
|
||||
@@ -131,7 +131,7 @@ public abstract class PartSharedItemBus extends PartUpgradeable implements IGrid
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
if ( name.equals( "config" ) )
|
||||
return config;
|
||||
return this.config;
|
||||
|
||||
return super.getInventoryByName( name );
|
||||
}
|
||||
|
||||
@@ -35,18 +35,18 @@ public class PartUpgradeable extends PartBasicState implements IAEAppEngInventor
|
||||
{
|
||||
|
||||
final IConfigManager settings = new ConfigManager( this );
|
||||
private final UpgradeInventory upgrades = new UpgradeInventory( is, this, getUpgradeSlots() );
|
||||
private final UpgradeInventory upgrades = new UpgradeInventory( this.is, this, this.getUpgradeSlots() );
|
||||
|
||||
@Override
|
||||
public int getInstalledUpgrades(Upgrades u)
|
||||
{
|
||||
return upgrades.getInstalledUpgrades( u );
|
||||
return this.upgrades.getInstalledUpgrades( u );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canConnectRedstone()
|
||||
{
|
||||
return upgrades.getMaxInstalled( Upgrades.REDSTONE ) > 0;
|
||||
return this.upgrades.getMaxInstalled( Upgrades.REDSTONE ) > 0;
|
||||
}
|
||||
|
||||
protected int getUpgradeSlots()
|
||||
@@ -57,7 +57,7 @@ public class PartUpgradeable extends PartBasicState implements IAEAppEngInventor
|
||||
@Override
|
||||
public void getDrops(List<ItemStack> drops, boolean wrenched)
|
||||
{
|
||||
for (ItemStack is : upgrades)
|
||||
for (ItemStack is : this.upgrades)
|
||||
if ( is != null )
|
||||
drops.add( is );
|
||||
}
|
||||
@@ -66,34 +66,34 @@ public class PartUpgradeable extends PartBasicState implements IAEAppEngInventor
|
||||
public void writeToNBT(net.minecraft.nbt.NBTTagCompound extra)
|
||||
{
|
||||
super.writeToNBT( extra );
|
||||
settings.writeToNBT( extra );
|
||||
upgrades.writeToNBT( extra, "upgrades" );
|
||||
this.settings.writeToNBT( extra );
|
||||
this.upgrades.writeToNBT( extra, "upgrades" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(net.minecraft.nbt.NBTTagCompound extra)
|
||||
{
|
||||
super.readFromNBT( extra );
|
||||
settings.readFromNBT( extra );
|
||||
upgrades.readFromNBT( extra, "upgrades" );
|
||||
this.settings.readFromNBT( extra );
|
||||
this.upgrades.readFromNBT( extra, "upgrades" );
|
||||
}
|
||||
|
||||
public PartUpgradeable(Class c, ItemStack is) {
|
||||
super( c, is );
|
||||
upgrades.setMaxStackSize( 1 );
|
||||
this.upgrades.setMaxStackSize( 1 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
return settings;
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getInventoryByName(String name)
|
||||
{
|
||||
if ( name.equals( "upgrades" ) )
|
||||
return upgrades;
|
||||
return this.upgrades;
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -112,9 +112,9 @@ public class PartUpgradeable extends PartBasicState implements IAEAppEngInventor
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
||||
{
|
||||
if ( inv == upgrades )
|
||||
if ( inv == this.upgrades )
|
||||
{
|
||||
upgradesChanged();
|
||||
this.upgradesChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,21 +125,21 @@ public class PartUpgradeable extends PartBasicState implements IAEAppEngInventor
|
||||
|
||||
protected boolean isSleeping()
|
||||
{
|
||||
if ( getInstalledUpgrades( Upgrades.REDSTONE ) > 0 )
|
||||
if ( this.getInstalledUpgrades( Upgrades.REDSTONE ) > 0 )
|
||||
{
|
||||
switch (getRSMode())
|
||||
switch (this.getRSMode())
|
||||
{
|
||||
case IGNORE:
|
||||
return false;
|
||||
|
||||
case HIGH_SIGNAL:
|
||||
if ( host.hasRedstone( side ) )
|
||||
if ( this.host.hasRedstone( this.side ) )
|
||||
return false;
|
||||
|
||||
break;
|
||||
|
||||
case LOW_SIGNAL:
|
||||
if ( !host.hasRedstone( side ) )
|
||||
if ( !this.host.hasRedstone( this.side ) )
|
||||
return false;
|
||||
|
||||
break;
|
||||
|
||||
@@ -47,8 +47,8 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
||||
|
||||
public UpgradeInventory(Object itemOrBlock, IAEAppEngInventory _te, int s) {
|
||||
super( null, s );
|
||||
te = this;
|
||||
parent = _te;
|
||||
this.te = this;
|
||||
this.parent = _te;
|
||||
this.itemOrBlock = itemOrBlock;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
||||
Upgrades u = ((IUpgradeModule) it).getType( itemstack );
|
||||
if ( u != null )
|
||||
{
|
||||
return getInstalledUpgrades( u ) < getMaxInstalled( u );
|
||||
return this.getInstalledUpgrades( u ) < this.getMaxInstalled( u );
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@@ -80,17 +80,17 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
||||
Integer max = null;
|
||||
for (ItemStack is : u.getSupported().keySet())
|
||||
{
|
||||
if ( is.getItem() == itemOrBlock )
|
||||
if ( is.getItem() == this.itemOrBlock )
|
||||
{
|
||||
max = u.getSupported().get( is );
|
||||
break;
|
||||
}
|
||||
else if ( is.getItem() instanceof ItemBlock && Block.getBlockFromItem( is.getItem() ) == itemOrBlock )
|
||||
else if ( is.getItem() instanceof ItemBlock && Block.getBlockFromItem( is.getItem() ) == this.itemOrBlock )
|
||||
{
|
||||
max = u.getSupported().get( is );
|
||||
break;
|
||||
}
|
||||
else if ( itemOrBlock instanceof ItemStack && Platform.isSameItem( (ItemStack) itemOrBlock, is ) )
|
||||
else if ( this.itemOrBlock instanceof ItemStack && Platform.isSameItem( (ItemStack) this.itemOrBlock, is ) )
|
||||
{
|
||||
max = u.getSupported().get( is );
|
||||
break;
|
||||
@@ -110,8 +110,8 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
||||
|
||||
private void updateUpgradeInfo()
|
||||
{
|
||||
cached = true;
|
||||
InverterUpgrades = CapacityUpgrades = RedstoneUpgrades = SpeedUpgrades = FuzzyUpgrades = CraftingUpgrades = 0;
|
||||
this.cached = true;
|
||||
this.InverterUpgrades = this.CapacityUpgrades = this.RedstoneUpgrades = this.SpeedUpgrades = this.FuzzyUpgrades = this.CraftingUpgrades = 0;
|
||||
|
||||
for (ItemStack is : this)
|
||||
{
|
||||
@@ -122,55 +122,55 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
||||
switch (myUpgrade)
|
||||
{
|
||||
case CAPACITY:
|
||||
CapacityUpgrades++;
|
||||
this.CapacityUpgrades++;
|
||||
break;
|
||||
case FUZZY:
|
||||
FuzzyUpgrades++;
|
||||
this.FuzzyUpgrades++;
|
||||
break;
|
||||
case REDSTONE:
|
||||
RedstoneUpgrades++;
|
||||
this.RedstoneUpgrades++;
|
||||
break;
|
||||
case SPEED:
|
||||
SpeedUpgrades++;
|
||||
this.SpeedUpgrades++;
|
||||
break;
|
||||
case INVERTER:
|
||||
InverterUpgrades++;
|
||||
this.InverterUpgrades++;
|
||||
break;
|
||||
case CRAFTING:
|
||||
CraftingUpgrades++;
|
||||
this.CraftingUpgrades++;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
CapacityUpgrades = Math.min( CapacityUpgrades, getMaxInstalled( Upgrades.CAPACITY ) );
|
||||
FuzzyUpgrades = Math.min( FuzzyUpgrades, getMaxInstalled( Upgrades.FUZZY ) );
|
||||
RedstoneUpgrades = Math.min( RedstoneUpgrades, getMaxInstalled( Upgrades.REDSTONE ) );
|
||||
SpeedUpgrades = Math.min( SpeedUpgrades, getMaxInstalled( Upgrades.SPEED ) );
|
||||
InverterUpgrades = Math.min( InverterUpgrades, getMaxInstalled( Upgrades.INVERTER ) );
|
||||
CraftingUpgrades = Math.min( CraftingUpgrades, getMaxInstalled( Upgrades.CRAFTING ) );
|
||||
this.CapacityUpgrades = Math.min( this.CapacityUpgrades, this.getMaxInstalled( Upgrades.CAPACITY ) );
|
||||
this.FuzzyUpgrades = Math.min( this.FuzzyUpgrades, this.getMaxInstalled( Upgrades.FUZZY ) );
|
||||
this.RedstoneUpgrades = Math.min( this.RedstoneUpgrades, this.getMaxInstalled( Upgrades.REDSTONE ) );
|
||||
this.SpeedUpgrades = Math.min( this.SpeedUpgrades, this.getMaxInstalled( Upgrades.SPEED ) );
|
||||
this.InverterUpgrades = Math.min( this.InverterUpgrades, this.getMaxInstalled( Upgrades.INVERTER ) );
|
||||
this.CraftingUpgrades = Math.min( this.CraftingUpgrades, this.getMaxInstalled( Upgrades.CRAFTING ) );
|
||||
}
|
||||
|
||||
public int getInstalledUpgrades(Upgrades u)
|
||||
{
|
||||
if ( !cached )
|
||||
updateUpgradeInfo();
|
||||
if ( !this.cached )
|
||||
this.updateUpgradeInfo();
|
||||
|
||||
switch (u)
|
||||
{
|
||||
case CAPACITY:
|
||||
return CapacityUpgrades;
|
||||
return this.CapacityUpgrades;
|
||||
case FUZZY:
|
||||
return FuzzyUpgrades;
|
||||
return this.FuzzyUpgrades;
|
||||
case REDSTONE:
|
||||
return RedstoneUpgrades;
|
||||
return this.RedstoneUpgrades;
|
||||
case SPEED:
|
||||
return SpeedUpgrades;
|
||||
return this.SpeedUpgrades;
|
||||
case INVERTER:
|
||||
return InverterUpgrades;
|
||||
return this.InverterUpgrades;
|
||||
case CRAFTING:
|
||||
return CraftingUpgrades;
|
||||
return this.CraftingUpgrades;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
@@ -180,21 +180,21 @@ public class UpgradeInventory extends AppEngInternalInventory implements IAEAppE
|
||||
public void readFromNBT(NBTTagCompound target)
|
||||
{
|
||||
super.readFromNBT( target );
|
||||
updateUpgradeInfo();
|
||||
this.updateUpgradeInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
||||
{
|
||||
cached = false;
|
||||
if ( parent != null && Platform.isServer() )
|
||||
parent.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
||||
this.cached = false;
|
||||
if ( this.parent != null && Platform.isServer() )
|
||||
this.parent.onChangeInventory( inv, slot, mc, removedStack, newStack );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveChanges()
|
||||
{
|
||||
parent.saveChanges();
|
||||
this.parent.saveChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user