Changed access to use this qualifier
This commit is contained in:
@@ -93,35 +93,35 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
public void postPartial(PacketPartialItem packetPartialItem)
|
||||
{
|
||||
dataChunks.add( packetPartialItem );
|
||||
if ( packetPartialItem.getPageCount() == dataChunks.size() )
|
||||
parsePartials();
|
||||
this.dataChunks.add( packetPartialItem );
|
||||
if ( packetPartialItem.getPageCount() == this.dataChunks.size() )
|
||||
this.parsePartials();
|
||||
}
|
||||
|
||||
private void parsePartials()
|
||||
{
|
||||
int total = 0;
|
||||
for (PacketPartialItem ppi : dataChunks)
|
||||
for (PacketPartialItem ppi : this.dataChunks)
|
||||
total += ppi.getSize();
|
||||
|
||||
byte[] buffer = new byte[total];
|
||||
int cursor = 0;
|
||||
|
||||
for (PacketPartialItem ppi : dataChunks)
|
||||
for (PacketPartialItem ppi : this.dataChunks)
|
||||
cursor = ppi.write( buffer, cursor );
|
||||
|
||||
try
|
||||
{
|
||||
NBTTagCompound data = CompressedStreamTools.readCompressed( new ByteArrayInputStream( buffer ) );
|
||||
if ( data != null )
|
||||
setTargetStack( AEApi.instance().storage().createItemStack( ItemStack.loadItemStackFromNBT( data ) ) );
|
||||
this.setTargetStack( AEApi.instance().storage().createItemStack( ItemStack.loadItemStackFromNBT( data ) ) );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
AELog.error( e );
|
||||
}
|
||||
|
||||
dataChunks.clear();
|
||||
this.dataChunks.clear();
|
||||
}
|
||||
|
||||
public void setTargetStack(IAEItemStack stack)
|
||||
@@ -130,7 +130,7 @@ public abstract class AEBaseContainer extends Container
|
||||
if ( Platform.isClient() )
|
||||
{
|
||||
ItemStack a = stack == null ? null : stack.getItemStack();
|
||||
ItemStack b = clientRequestedTargetItem == null ? null : clientRequestedTargetItem.getItemStack();
|
||||
ItemStack b = this.clientRequestedTargetItem == null ? null : this.clientRequestedTargetItem.getItemStack();
|
||||
|
||||
if ( Platform.isSameItemPrecise( a, b ) )
|
||||
return;
|
||||
@@ -175,17 +175,17 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
}
|
||||
|
||||
clientRequestedTargetItem = stack == null ? null : stack.copy();
|
||||
this.clientRequestedTargetItem = stack == null ? null : stack.copy();
|
||||
}
|
||||
|
||||
public IAEItemStack getTargetStack()
|
||||
{
|
||||
return clientRequestedTargetItem;
|
||||
return this.clientRequestedTargetItem;
|
||||
}
|
||||
|
||||
public BaseActionSource getSource()
|
||||
{
|
||||
return mySrc;
|
||||
return this.mySrc;
|
||||
}
|
||||
|
||||
public void verifyPermissions(SecurityPermissions security, boolean requirePower)
|
||||
@@ -193,17 +193,17 @@ public abstract class AEBaseContainer extends Container
|
||||
if ( Platform.isClient() )
|
||||
return;
|
||||
|
||||
ticksSinceCheck++;
|
||||
if ( ticksSinceCheck < 20 )
|
||||
this.ticksSinceCheck++;
|
||||
if ( this.ticksSinceCheck < 20 )
|
||||
return;
|
||||
|
||||
ticksSinceCheck = 0;
|
||||
isContainerValid = isContainerValid && hasAccess( security, requirePower );
|
||||
this.ticksSinceCheck = 0;
|
||||
this.isContainerValid = this.isContainerValid && this.hasAccess( security, requirePower );
|
||||
}
|
||||
|
||||
protected boolean hasAccess(SecurityPermissions perm, boolean requirePower)
|
||||
{
|
||||
IActionHost host = getActionHost();
|
||||
IActionHost host = this.getActionHost();
|
||||
|
||||
if ( host != null )
|
||||
{
|
||||
@@ -221,7 +221,7 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
|
||||
ISecurityGrid sg = g.getCache( ISecurityGrid.class );
|
||||
if ( sg.hasPermission( invPlayer.player, perm ) )
|
||||
if ( sg.hasPermission( this.invPlayer.player, perm ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -238,17 +238,17 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
public void lockPlayerInventorySlot(int idx)
|
||||
{
|
||||
locked.add( idx );
|
||||
this.locked.add( idx );
|
||||
}
|
||||
|
||||
public Object getTarget()
|
||||
{
|
||||
if ( tileEntity != null )
|
||||
return tileEntity;
|
||||
if ( part != null )
|
||||
return part;
|
||||
if ( obj != null )
|
||||
return obj;
|
||||
if ( this.tileEntity != null )
|
||||
return this.tileEntity;
|
||||
if ( this.part != null )
|
||||
return this.part;
|
||||
if ( this.obj != null )
|
||||
return this.obj;
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -257,38 +257,38 @@ public abstract class AEBaseContainer extends Container
|
||||
}
|
||||
|
||||
public AEBaseContainer(InventoryPlayer ip, TileEntity myTile, IPart myPart, IGuiItemObject gio) {
|
||||
invPlayer = ip;
|
||||
tileEntity = myTile;
|
||||
part = myPart;
|
||||
obj = gio;
|
||||
mySrc = new PlayerSource( ip.player, getActionHost() );
|
||||
prepareSync();
|
||||
this.invPlayer = ip;
|
||||
this.tileEntity = myTile;
|
||||
this.part = myPart;
|
||||
this.obj = gio;
|
||||
this.mySrc = new PlayerSource( ip.player, this.getActionHost() );
|
||||
this.prepareSync();
|
||||
}
|
||||
|
||||
public AEBaseContainer(InventoryPlayer ip, Object anchor) {
|
||||
invPlayer = ip;
|
||||
tileEntity = anchor instanceof TileEntity ? (TileEntity) anchor : null;
|
||||
part = anchor instanceof IPart ? (IPart) anchor : null;
|
||||
obj = anchor instanceof IGuiItemObject ? (IGuiItemObject) anchor : null;
|
||||
this.invPlayer = ip;
|
||||
this.tileEntity = anchor instanceof TileEntity ? (TileEntity) anchor : null;
|
||||
this.part = anchor instanceof IPart ? (IPart) anchor : null;
|
||||
this.obj = anchor instanceof IGuiItemObject ? (IGuiItemObject) anchor : null;
|
||||
|
||||
if ( tileEntity == null && part == null && obj == null )
|
||||
if ( this.tileEntity == null && this.part == null && this.obj == null )
|
||||
throw new RuntimeException( "Must have a valid anchor" );
|
||||
|
||||
mySrc = new PlayerSource( ip.player, getActionHost() );
|
||||
this.mySrc = new PlayerSource( ip.player, this.getActionHost() );
|
||||
|
||||
prepareSync();
|
||||
this.prepareSync();
|
||||
}
|
||||
|
||||
protected IActionHost getActionHost()
|
||||
{
|
||||
if ( obj instanceof IActionHost )
|
||||
return (IActionHost) obj;
|
||||
if ( this.obj instanceof IActionHost )
|
||||
return (IActionHost) this.obj;
|
||||
|
||||
if ( tileEntity instanceof IActionHost )
|
||||
return (IActionHost) tileEntity;
|
||||
if ( this.tileEntity instanceof IActionHost )
|
||||
return (IActionHost) this.tileEntity;
|
||||
|
||||
if ( part instanceof IActionHost )
|
||||
return (IActionHost) part;
|
||||
if ( this.part instanceof IActionHost )
|
||||
return (IActionHost) this.part;
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -301,12 +301,12 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
public InventoryPlayer getPlayerInv()
|
||||
{
|
||||
return invPlayer;
|
||||
return this.invPlayer;
|
||||
}
|
||||
|
||||
public TileEntity getTileEntity()
|
||||
{
|
||||
return tileEntity;
|
||||
return this.tileEntity;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -325,10 +325,10 @@ public abstract class AEBaseContainer extends Container
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer entityplayer)
|
||||
{
|
||||
if ( isContainerValid )
|
||||
if ( this.isContainerValid )
|
||||
{
|
||||
if ( tileEntity instanceof IInventory )
|
||||
return ((IInventory) tileEntity).isUseableByPlayer( entityplayer );
|
||||
if ( this.tileEntity instanceof IInventory )
|
||||
return ((IInventory) this.tileEntity).isUseableByPlayer( entityplayer );
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -374,7 +374,7 @@ public abstract class AEBaseContainer extends Container
|
||||
*/
|
||||
if ( clickSlot.isPlayerSide() )
|
||||
{
|
||||
tis = shiftStoreItem( tis );
|
||||
tis = this.shiftStoreItem( tis );
|
||||
|
||||
// target slots in the container...
|
||||
for (Object inventorySlot : this.inventorySlots)
|
||||
@@ -430,7 +430,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
cs.putStack( tis.copy() );
|
||||
cs.onSlotChanged();
|
||||
updateSlot( cs );
|
||||
this.updateSlot( cs );
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -475,12 +475,12 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
// if ( hasMETiles ) updateClient();
|
||||
|
||||
updateSlot( clickSlot );
|
||||
updateSlot( d );
|
||||
this.updateSlot( clickSlot );
|
||||
this.updateSlot( d );
|
||||
return null;
|
||||
}
|
||||
else
|
||||
updateSlot( d );
|
||||
this.updateSlot( d );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -523,12 +523,12 @@ public abstract class AEBaseContainer extends Container
|
||||
// worldEntity.markDirty();
|
||||
// if ( hasMETiles ) updateClient();
|
||||
|
||||
updateSlot( clickSlot );
|
||||
updateSlot( d );
|
||||
this.updateSlot( clickSlot );
|
||||
this.updateSlot( d );
|
||||
return null;
|
||||
}
|
||||
else
|
||||
updateSlot( d );
|
||||
this.updateSlot( d );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -553,12 +553,12 @@ public abstract class AEBaseContainer extends Container
|
||||
// worldEntity.markDirty();
|
||||
// if ( hasMETiles ) updateClient();
|
||||
|
||||
updateSlot( clickSlot );
|
||||
updateSlot( d );
|
||||
this.updateSlot( clickSlot );
|
||||
this.updateSlot( d );
|
||||
return null;
|
||||
}
|
||||
else
|
||||
updateSlot( d );
|
||||
this.updateSlot( d );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -567,14 +567,14 @@ public abstract class AEBaseContainer extends Container
|
||||
clickSlot.putStack( tis != null ? tis.copy() : null );
|
||||
}
|
||||
|
||||
updateSlot( clickSlot );
|
||||
this.updateSlot( clickSlot );
|
||||
return null;
|
||||
}
|
||||
|
||||
private void updateSlot(Slot clickSlot)
|
||||
{
|
||||
// ???
|
||||
detectAndSendChanges();
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
final HashMap<Integer, SyncData> syncData = new HashMap<Integer, SyncData>();
|
||||
@@ -582,7 +582,7 @@ public abstract class AEBaseContainer extends Container
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
sendCustomName();
|
||||
this.sendCustomName();
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
@@ -590,7 +590,7 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) crafter;
|
||||
|
||||
for (SyncData sd : syncData.values())
|
||||
for (SyncData sd : this.syncData.values())
|
||||
sd.tick( icrafting );
|
||||
}
|
||||
}
|
||||
@@ -601,63 +601,63 @@ public abstract class AEBaseContainer extends Container
|
||||
@Override
|
||||
final public void updateProgressBar(int idx, int value)
|
||||
{
|
||||
if ( syncData.containsKey( idx ) )
|
||||
if ( this.syncData.containsKey( idx ) )
|
||||
{
|
||||
syncData.get( idx ).update( (long) value );
|
||||
this.syncData.get( idx ).update( (long) value );
|
||||
}
|
||||
}
|
||||
|
||||
final public void updateFullProgressBar(int idx, long value)
|
||||
{
|
||||
if ( syncData.containsKey( idx ) )
|
||||
if ( this.syncData.containsKey( idx ) )
|
||||
{
|
||||
syncData.get( idx ).update( value );
|
||||
this.syncData.get( idx ).update( value );
|
||||
return;
|
||||
}
|
||||
|
||||
updateProgressBar( idx, (int) value );
|
||||
this.updateProgressBar( idx, (int) value );
|
||||
}
|
||||
|
||||
public void stringSync(int idx, String value)
|
||||
{
|
||||
if ( syncData.containsKey( idx ) )
|
||||
if ( this.syncData.containsKey( idx ) )
|
||||
{
|
||||
syncData.get( idx ).update( value );
|
||||
this.syncData.get( idx ).update( value );
|
||||
}
|
||||
}
|
||||
|
||||
private void prepareSync()
|
||||
{
|
||||
for (Field f : getClass().getFields())
|
||||
for (Field f : this.getClass().getFields())
|
||||
{
|
||||
if ( f.isAnnotationPresent( GuiSync.class ) )
|
||||
{
|
||||
GuiSync annotation = f.getAnnotation( GuiSync.class );
|
||||
if ( syncData.containsKey( annotation.value() ) )
|
||||
if ( this.syncData.containsKey( annotation.value() ) )
|
||||
AELog.warning( "Channel already in use: " + annotation.value() + " for " + f.getName() );
|
||||
else
|
||||
syncData.put( annotation.value(), new SyncData( this, f, annotation ) );
|
||||
this.syncData.put( annotation.value(), new SyncData( this, f, annotation ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void sendCustomName()
|
||||
{
|
||||
if ( !sentCustomName )
|
||||
if ( !this.sentCustomName )
|
||||
{
|
||||
sentCustomName = true;
|
||||
this.sentCustomName = true;
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
ICustomNameObject name = null;
|
||||
|
||||
if ( part instanceof ICustomNameObject )
|
||||
name = (ICustomNameObject) part;
|
||||
if ( this.part instanceof ICustomNameObject )
|
||||
name = (ICustomNameObject) this.part;
|
||||
|
||||
if ( tileEntity instanceof ICustomNameObject )
|
||||
name = (ICustomNameObject) tileEntity;
|
||||
if ( this.tileEntity instanceof ICustomNameObject )
|
||||
name = (ICustomNameObject) this.tileEntity;
|
||||
|
||||
if ( obj instanceof ICustomNameObject )
|
||||
name = (ICustomNameObject) obj;
|
||||
if ( this.obj instanceof ICustomNameObject )
|
||||
name = (ICustomNameObject) this.obj;
|
||||
|
||||
if ( this instanceof ICustomNameObject )
|
||||
name = (ICustomNameObject) this;
|
||||
@@ -665,13 +665,13 @@ public abstract class AEBaseContainer extends Container
|
||||
if ( name != null )
|
||||
{
|
||||
if ( name.hasCustomName() )
|
||||
customName = name.getCustomName();
|
||||
this.customName = name.getCustomName();
|
||||
|
||||
if ( customName != null )
|
||||
if ( this.customName != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketValueConfig( "CustomName", customName ), (EntityPlayerMP) invPlayer.player );
|
||||
NetworkHandler.instance.sendTo( new PacketValueConfig( "CustomName", this.customName ), (EntityPlayerMP) this.invPlayer.player );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
@@ -687,29 +687,29 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
for (int i = 0; i < 9; i++)
|
||||
{
|
||||
if ( locked.contains( i ) )
|
||||
addSlotToContainer( new SlotDisabled( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||
if ( this.locked.contains( i ) )
|
||||
this.addSlotToContainer( new SlotDisabled( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||
else
|
||||
addSlotToContainer( new SlotPlayerHotBar( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||
this.addSlotToContainer( new SlotPlayerHotBar( inventoryPlayer, i, 8 + i * 18 + offset_x, 58 + offset_y ) );
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
for (int j = 0; j < 9; j++)
|
||||
{
|
||||
if ( locked.contains( j + i * 9 + 9 ) )
|
||||
addSlotToContainer( new SlotDisabled( inventoryPlayer, j + i * 9 + 9, 8 + j * 18 + offset_x, offset_y + i * 18 ) );
|
||||
if ( this.locked.contains( j + i * 9 + 9 ) )
|
||||
this.addSlotToContainer( new SlotDisabled( inventoryPlayer, j + i * 9 + 9, 8 + j * 18 + offset_x, offset_y + i * 18 ) );
|
||||
else
|
||||
addSlotToContainer( new SlotPlayerInv( inventoryPlayer, j + i * 9 + 9, 8 + j * 18 + offset_x, offset_y + i * 18 ) );
|
||||
this.addSlotToContainer( new SlotPlayerInv( inventoryPlayer, j + i * 9 + 9, 8 + j * 18 + offset_x, offset_y + i * 18 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack shiftStoreItem(ItemStack input)
|
||||
{
|
||||
if ( powerSrc == null || cellInv == null )
|
||||
if ( this.powerSrc == null || this.cellInv == null )
|
||||
return input;
|
||||
IAEItemStack ais = Platform.poweredInsert( powerSrc, cellInv, AEApi.instance().storage().createItemStack( input ), mySrc );
|
||||
IAEItemStack ais = Platform.poweredInsert( this.powerSrc, this.cellInv, AEApi.instance().storage().createItemStack( input ), this.mySrc );
|
||||
if ( ais == null )
|
||||
return null;
|
||||
return ais.getItemStack();
|
||||
@@ -717,9 +717,9 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slot, long id)
|
||||
{
|
||||
if ( slot >= 0 && slot < inventorySlots.size() )
|
||||
if ( slot >= 0 && slot < this.inventorySlots.size() )
|
||||
{
|
||||
Slot s = getSlot( slot );
|
||||
Slot s = this.getSlot( slot );
|
||||
|
||||
if ( s instanceof SlotCraftingTerm )
|
||||
{
|
||||
@@ -729,7 +729,7 @@ public abstract class AEBaseContainer extends Container
|
||||
case CRAFT_ITEM:
|
||||
case CRAFT_STACK:
|
||||
((SlotCraftingTerm) s).doClick( action, player );
|
||||
updateHeld( player );
|
||||
this.updateHeld( player );
|
||||
default:
|
||||
}
|
||||
}
|
||||
@@ -796,26 +796,26 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
List<Slot> from = new LinkedList<Slot>();
|
||||
|
||||
for (Object j : inventorySlots)
|
||||
for (Object j : this.inventorySlots)
|
||||
{
|
||||
if ( j instanceof Slot && j.getClass() == s.getClass() )
|
||||
from.add( (Slot) j );
|
||||
}
|
||||
|
||||
for (Slot fr : from)
|
||||
transferStackInSlot( player, fr.slotNumber );
|
||||
this.transferStackInSlot( player, fr.slotNumber );
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// get target item.
|
||||
IAEItemStack slotItem = getTargetStack();
|
||||
IAEItemStack slotItem = this.getTargetStack();
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case SHIFT_CLICK:
|
||||
if ( powerSrc == null || cellInv == null )
|
||||
if ( this.powerSrc == null || this.cellInv == null )
|
||||
return;
|
||||
|
||||
if ( slotItem != null )
|
||||
@@ -832,13 +832,13 @@ public abstract class AEBaseContainer extends Container
|
||||
if ( myItem != null )
|
||||
ais.setStackSize( ais.getStackSize() - myItem.stackSize );
|
||||
|
||||
ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc );
|
||||
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
|
||||
if ( ais != null )
|
||||
adp.addItems( ais.getItemStack() );
|
||||
}
|
||||
break;
|
||||
case ROLL_DOWN:
|
||||
if ( powerSrc == null || cellInv == null )
|
||||
if ( this.powerSrc == null || this.cellInv == null )
|
||||
return;
|
||||
|
||||
int releaseQty = 1;
|
||||
@@ -850,23 +850,23 @@ public abstract class AEBaseContainer extends Container
|
||||
ais.setStackSize( 1 );
|
||||
IAEItemStack extracted = ais.copy();
|
||||
|
||||
ais = Platform.poweredInsert( powerSrc, cellInv, ais, mySrc );
|
||||
ais = Platform.poweredInsert( this.powerSrc, this.cellInv, ais, this.mySrc );
|
||||
if ( ais == null )
|
||||
{
|
||||
InventoryAdaptor ia = new AdaptorPlayerHand( player );
|
||||
|
||||
ItemStack fail = ia.removeItems( 1, extracted.getItemStack(), null );
|
||||
if ( fail == null )
|
||||
cellInv.extractItems( extracted, Actionable.MODULATE, mySrc );
|
||||
this.cellInv.extractItems( extracted, Actionable.MODULATE, this.mySrc );
|
||||
|
||||
updateHeld( player );
|
||||
this.updateHeld( player );
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case ROLL_UP:
|
||||
case PICKUP_SINGLE:
|
||||
if ( powerSrc == null || cellInv == null )
|
||||
if ( this.powerSrc == null || this.cellInv == null )
|
||||
return;
|
||||
|
||||
if ( slotItem != null )
|
||||
@@ -886,22 +886,22 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
IAEItemStack ais = slotItem.copy();
|
||||
ais.setStackSize( 1 );
|
||||
ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc );
|
||||
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
|
||||
if ( ais != null )
|
||||
{
|
||||
InventoryAdaptor ia = new AdaptorPlayerHand( player );
|
||||
|
||||
ItemStack fail = ia.addItems( ais.getItemStack() );
|
||||
if ( fail != null )
|
||||
cellInv.injectItems( ais, Actionable.MODULATE, mySrc );
|
||||
this.cellInv.injectItems( ais, Actionable.MODULATE, this.mySrc );
|
||||
|
||||
updateHeld( player );
|
||||
this.updateHeld( player );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PICKUP_OR_SET_DOWN:
|
||||
if ( powerSrc == null || cellInv == null )
|
||||
if ( this.powerSrc == null || this.cellInv == null )
|
||||
return;
|
||||
|
||||
if ( player.inventory.getItemStack() == null )
|
||||
@@ -910,28 +910,28 @@ public abstract class AEBaseContainer extends Container
|
||||
{
|
||||
IAEItemStack ais = slotItem.copy();
|
||||
ais.setStackSize( ais.getItemStack().getMaxStackSize() );
|
||||
ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc );
|
||||
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
|
||||
if ( ais != null )
|
||||
player.inventory.setItemStack( ais.getItemStack() );
|
||||
else
|
||||
player.inventory.setItemStack( null );
|
||||
updateHeld( player );
|
||||
this.updateHeld( player );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() );
|
||||
ais = Platform.poweredInsert( powerSrc, cellInv, ais, mySrc );
|
||||
ais = Platform.poweredInsert( this.powerSrc, this.cellInv, ais, this.mySrc );
|
||||
if ( ais != null )
|
||||
player.inventory.setItemStack( ais.getItemStack() );
|
||||
else
|
||||
player.inventory.setItemStack( null );
|
||||
updateHeld( player );
|
||||
this.updateHeld( player );
|
||||
}
|
||||
|
||||
break;
|
||||
case SPLIT_OR_PLACE_SINGLE:
|
||||
if ( powerSrc == null || cellInv == null )
|
||||
if ( this.powerSrc == null || this.cellInv == null )
|
||||
return;
|
||||
|
||||
if ( player.inventory.getItemStack() == null )
|
||||
@@ -941,34 +941,34 @@ public abstract class AEBaseContainer extends Container
|
||||
IAEItemStack ais = slotItem.copy();
|
||||
long maxSize = ais.getItemStack().getMaxStackSize();
|
||||
ais.setStackSize( maxSize );
|
||||
ais = cellInv.extractItems( ais, Actionable.SIMULATE, mySrc );
|
||||
ais = this.cellInv.extractItems( ais, Actionable.SIMULATE, this.mySrc );
|
||||
|
||||
if ( ais != null )
|
||||
{
|
||||
long stackSize = Math.min( maxSize, ais.getStackSize() );
|
||||
ais.setStackSize( (stackSize + 1) >> 1 );
|
||||
ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc );
|
||||
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
|
||||
}
|
||||
|
||||
if ( ais != null )
|
||||
player.inventory.setItemStack( ais.getItemStack() );
|
||||
else
|
||||
player.inventory.setItemStack( null );
|
||||
updateHeld( player );
|
||||
this.updateHeld( player );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() );
|
||||
ais.setStackSize( 1 );
|
||||
ais = Platform.poweredInsert( powerSrc, cellInv, ais, mySrc );
|
||||
ais = Platform.poweredInsert( this.powerSrc, this.cellInv, ais, this.mySrc );
|
||||
if ( ais == null )
|
||||
{
|
||||
ItemStack is = player.inventory.getItemStack();
|
||||
is.stackSize--;
|
||||
if ( is.stackSize <= 0 )
|
||||
player.inventory.setItemStack( null );
|
||||
updateHeld( player );
|
||||
this.updateHeld( player );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -979,12 +979,12 @@ public abstract class AEBaseContainer extends Container
|
||||
ItemStack is = slotItem.getItemStack();
|
||||
is.stackSize = is.getMaxStackSize();
|
||||
player.inventory.setItemStack( is );
|
||||
updateHeld( player );
|
||||
this.updateHeld( player );
|
||||
}
|
||||
break;
|
||||
case MOVE_REGION:
|
||||
|
||||
if ( powerSrc == null || cellInv == null )
|
||||
if ( this.powerSrc == null || this.cellInv == null )
|
||||
return;
|
||||
|
||||
if ( slotItem != null )
|
||||
@@ -1004,7 +1004,7 @@ public abstract class AEBaseContainer extends Container
|
||||
if ( myItem != null )
|
||||
ais.setStackSize( ais.getStackSize() - myItem.stackSize );
|
||||
|
||||
ais = Platform.poweredExtraction( powerSrc, cellInv, ais, mySrc );
|
||||
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
|
||||
if ( ais != null )
|
||||
adp.addItems( ais.getItemStack() );
|
||||
else
|
||||
@@ -1036,8 +1036,8 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
public void swapSlotContents(int slotA, int slotB)
|
||||
{
|
||||
Slot a = getSlot( slotA );
|
||||
Slot b = getSlot( slotB );
|
||||
Slot a = this.getSlot( slotA );
|
||||
Slot b = this.getSlot( slotB );
|
||||
|
||||
// NPE protection...
|
||||
if ( a == null || b == null )
|
||||
@@ -1052,10 +1052,10 @@ public abstract class AEBaseContainer extends Container
|
||||
|
||||
// can take?
|
||||
|
||||
if ( isA != null && !a.canTakeStack( invPlayer.player ) )
|
||||
if ( isA != null && !a.canTakeStack( this.invPlayer.player ) )
|
||||
return;
|
||||
|
||||
if ( isB != null && !b.canTakeStack( invPlayer.player ) )
|
||||
if ( isB != null && !b.canTakeStack( this.invPlayer.player ) )
|
||||
return;
|
||||
|
||||
// swap valid?
|
||||
|
||||
@@ -33,14 +33,14 @@ public class ContainerOpenContext
|
||||
|
||||
public ContainerOpenContext(Object myItem) {
|
||||
boolean isWorld = myItem instanceof IPart || myItem instanceof TileEntity;
|
||||
isItem = !isWorld;
|
||||
this.isItem = !isWorld;
|
||||
}
|
||||
|
||||
public TileEntity getTile()
|
||||
{
|
||||
if ( isItem )
|
||||
if ( this.isItem )
|
||||
return null;
|
||||
return w.getTileEntity( x, y, z );
|
||||
return this.w.getTileEntity( this.x, this.y, this.z );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -41,26 +41,26 @@ public class SyncData
|
||||
private final int channel;
|
||||
|
||||
public SyncData(AEBaseContainer container, Field field, GuiSync annotation) {
|
||||
clientVersion = null;
|
||||
this.clientVersion = null;
|
||||
this.source = container;
|
||||
this.field = field;
|
||||
channel = annotation.value();
|
||||
this.channel = annotation.value();
|
||||
}
|
||||
|
||||
public int getChannel()
|
||||
{
|
||||
return channel;
|
||||
return this.channel;
|
||||
}
|
||||
|
||||
public void tick(ICrafting c)
|
||||
{
|
||||
try
|
||||
{
|
||||
Object val = field.get( source );
|
||||
if ( val != null && clientVersion == null )
|
||||
send( c, val );
|
||||
else if ( !val.equals( clientVersion ) )
|
||||
send( c, val );
|
||||
Object val = this.field.get( this.source );
|
||||
if ( val != null && this.clientVersion == null )
|
||||
this.send( c, val );
|
||||
else if ( !val.equals( this.clientVersion ) )
|
||||
this.send( c, val );
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
@@ -80,11 +80,11 @@ public class SyncData
|
||||
{
|
||||
try
|
||||
{
|
||||
Object oldValue = field.get( source );
|
||||
Object oldValue = this.field.get( this.source );
|
||||
if ( val instanceof String )
|
||||
updateString( oldValue, (String) val );
|
||||
this.updateString( oldValue, (String) val );
|
||||
else
|
||||
updateValue( oldValue, (Long) val );
|
||||
this.updateValue( oldValue, (Long) val );
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
@@ -101,7 +101,7 @@ public class SyncData
|
||||
{
|
||||
try
|
||||
{
|
||||
field.set( source, val );
|
||||
this.field.set( this.source, val );
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
@@ -117,35 +117,35 @@ public class SyncData
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( field.getType().isEnum() )
|
||||
if ( this.field.getType().isEnum() )
|
||||
{
|
||||
EnumSet<? extends Enum> valList = EnumSet.allOf( (Class<? extends Enum>) field.getType() );
|
||||
EnumSet<? extends Enum> valList = EnumSet.allOf( (Class<? extends Enum>) this.field.getType() );
|
||||
for (Enum e : valList)
|
||||
{
|
||||
if ( e.ordinal() == val )
|
||||
{
|
||||
field.set( source, e );
|
||||
this.field.set( this.source, e );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( field.getType().equals( int.class ) )
|
||||
field.set( source, (int) val );
|
||||
else if ( field.getType().equals( long.class ) )
|
||||
field.set( source, val );
|
||||
else if ( field.getType().equals( boolean.class ) )
|
||||
field.set( source, val == 1 );
|
||||
else if ( field.getType().equals( Integer.class ) )
|
||||
field.set( source, (int) val );
|
||||
else if ( field.getType().equals( Long.class ) )
|
||||
field.set( source, val );
|
||||
else if ( field.getType().equals( Boolean.class ) )
|
||||
field.set( source, val == 1 );
|
||||
if ( this.field.getType().equals( int.class ) )
|
||||
this.field.set( this.source, (int) val );
|
||||
else if ( this.field.getType().equals( long.class ) )
|
||||
this.field.set( this.source, val );
|
||||
else if ( this.field.getType().equals( boolean.class ) )
|
||||
this.field.set( this.source, val == 1 );
|
||||
else if ( this.field.getType().equals( Integer.class ) )
|
||||
this.field.set( this.source, (int) val );
|
||||
else if ( this.field.getType().equals( Long.class ) )
|
||||
this.field.set( this.source, val );
|
||||
else if ( this.field.getType().equals( Boolean.class ) )
|
||||
this.field.set( this.source, val == 1 );
|
||||
}
|
||||
|
||||
source.onUpdate( field.getName(), oldValue, field.get( source ) );
|
||||
this.source.onUpdate( this.field.getName(), oldValue, this.field.get( this.source ) );
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
{
|
||||
@@ -162,25 +162,25 @@ public class SyncData
|
||||
if ( val instanceof String )
|
||||
{
|
||||
if ( o instanceof EntityPlayerMP )
|
||||
NetworkHandler.instance.sendTo( new PacketValueConfig( "SyncDat." + channel, (String) val ), (EntityPlayerMP) o );
|
||||
NetworkHandler.instance.sendTo( new PacketValueConfig( "SyncDat." + this.channel, (String) val ), (EntityPlayerMP) o );
|
||||
}
|
||||
else if ( field.getType().isEnum() )
|
||||
else if ( this.field.getType().isEnum() )
|
||||
{
|
||||
o.sendProgressBarUpdate( source, channel, ((Enum) val).ordinal() );
|
||||
o.sendProgressBarUpdate( this.source, this.channel, ((Enum) val).ordinal() );
|
||||
}
|
||||
else if ( val instanceof Long || val.getClass() == long.class )
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( channel, (Long) val ), (EntityPlayerMP) o );
|
||||
NetworkHandler.instance.sendTo( new PacketProgressBar( this.channel, (Long) val ), (EntityPlayerMP) o );
|
||||
}
|
||||
else if ( val instanceof Boolean || val.getClass() == boolean.class )
|
||||
{
|
||||
o.sendProgressBarUpdate( source, channel, ((Boolean) val) ? 1 : 0 );
|
||||
o.sendProgressBarUpdate( this.source, this.channel, ((Boolean) val) ? 1 : 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
o.sendProgressBarUpdate( source, channel, (Integer) val );
|
||||
o.sendProgressBarUpdate( this.source, this.channel, (Integer) val );
|
||||
}
|
||||
|
||||
clientVersion = val;
|
||||
this.clientVersion = val;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,33 +52,33 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
|
||||
public IInventory getCellUpgradeInventory()
|
||||
{
|
||||
IInventory ri = workBench.getCellUpgradeInventory();
|
||||
return ri == null ? ni : ri;
|
||||
IInventory ri = this.workBench.getCellUpgradeInventory();
|
||||
return ri == null ? this.ni : ri;
|
||||
}
|
||||
|
||||
public void setFuzzy(FuzzyMode valueOf)
|
||||
{
|
||||
ICellWorkbenchItem cwi = workBench.getCell();
|
||||
ICellWorkbenchItem cwi = this.workBench.getCell();
|
||||
if ( cwi != null )
|
||||
cwi.setFuzzyMode( workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ), valueOf );
|
||||
cwi.setFuzzyMode( this.workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ), valueOf );
|
||||
}
|
||||
|
||||
private FuzzyMode getFuzzyMode()
|
||||
{
|
||||
ICellWorkbenchItem cwi = workBench.getCell();
|
||||
ICellWorkbenchItem cwi = this.workBench.getCell();
|
||||
if ( cwi != null )
|
||||
return cwi.getFuzzyMode( workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ) );
|
||||
return cwi.getFuzzyMode( this.workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ) );
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
|
||||
public void nextCopyMode()
|
||||
{
|
||||
workBench.getConfigManager().putSetting( Settings.COPY_MODE, Platform.nextEnum( getCopyMode() ) );
|
||||
this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, Platform.nextEnum( this.getCopyMode() ) );
|
||||
}
|
||||
|
||||
public CopyMode getCopyMode()
|
||||
{
|
||||
return (CopyMode) workBench.getConfigManager().getSetting( Settings.COPY_MODE );
|
||||
return (CopyMode) this.workBench.getConfigManager().getSetting( Settings.COPY_MODE );
|
||||
}
|
||||
|
||||
class Upgrades implements IInventory
|
||||
@@ -87,19 +87,19 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return getCellUpgradeInventory().getSizeInventory();
|
||||
return ContainerCellWorkbench.this.getCellUpgradeInventory().getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i)
|
||||
{
|
||||
return getCellUpgradeInventory().getStackInSlot( i );
|
||||
return ContainerCellWorkbench.this.getCellUpgradeInventory().getStackInSlot( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j)
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
IInventory inv = ContainerCellWorkbench.this.getCellUpgradeInventory();
|
||||
ItemStack is = inv.decrStackSize( i, j );
|
||||
inv.markDirty();
|
||||
return is;
|
||||
@@ -108,7 +108,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i)
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
IInventory inv = ContainerCellWorkbench.this.getCellUpgradeInventory();
|
||||
ItemStack is = inv.getStackInSlotOnClosing( i );
|
||||
inv.markDirty();
|
||||
return is;
|
||||
@@ -117,7 +117,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack)
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
IInventory inv = ContainerCellWorkbench.this.getCellUpgradeInventory();
|
||||
inv.setInventorySlotContents( i, itemstack );
|
||||
inv.markDirty();
|
||||
}
|
||||
@@ -165,7 +165,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||
{
|
||||
return getCellUpgradeInventory().isItemValidForSlot( i, itemstack );
|
||||
return ContainerCellWorkbench.this.getCellUpgradeInventory().isItemValidForSlot( i, itemstack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
|
||||
public ContainerCellWorkbench(InventoryPlayer ip, TileCellWorkbench te) {
|
||||
super( ip, te );
|
||||
workBench = te;
|
||||
this.workBench = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -191,19 +191,19 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
@Override
|
||||
public int availableUpgrades()
|
||||
{
|
||||
ItemStack is = workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||
if ( prevStack != is )
|
||||
ItemStack is = this.workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||
if ( this.prevStack != is )
|
||||
{
|
||||
prevStack = is;
|
||||
return lastUpgrades = getCellUpgradeInventory().getSizeInventory();
|
||||
this.prevStack = is;
|
||||
return this.lastUpgrades = this.getCellUpgradeInventory().getSizeInventory();
|
||||
}
|
||||
return lastUpgrades;
|
||||
return this.lastUpgrades;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx)
|
||||
{
|
||||
return idx < availableUpgrades();
|
||||
return idx < this.availableUpgrades();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,23 +213,23 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
int y = 29;
|
||||
int offset = 0;
|
||||
|
||||
IInventory cell = upgradeable.getInventoryByName( "cell" );
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, invPlayer ) );
|
||||
IInventory cell = this.upgradeable.getInventoryByName( "cell" );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.invPlayer ) );
|
||||
|
||||
IInventory inv = upgradeable.getInventoryByName( "config" );
|
||||
UpgradeInventoryWrapper = new Upgrades();// Platform.isServer() ? new Upgrades() : new AppEngInternalInventory(
|
||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||
this.UpgradeInventoryWrapper = new Upgrades();// Platform.isServer() ? new Upgrades() : new AppEngInternalInventory(
|
||||
// null, 3 * 8 );
|
||||
|
||||
for (int w = 0; w < 7; w++)
|
||||
for (int z = 0; z < 9; z++)
|
||||
addSlotToContainer( new SlotFakeTypeOnly( inv, offset++, x + z * 18, y + w * 18 ) );
|
||||
this.addSlotToContainer( new SlotFakeTypeOnly( inv, offset++, x + z * 18, y + w * 18 ) );
|
||||
|
||||
for (int zz = 0; zz < 3; zz++)
|
||||
for (int z = 0; z < 8; z++)
|
||||
{
|
||||
int iSLot = zz * 8 + z;
|
||||
addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, UpgradeInventoryWrapper, this, iSLot, 187 + zz * 18,
|
||||
8 + 18 * z, iSLot, invPlayer ) );
|
||||
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.UpgradeInventoryWrapper, this, iSLot, 187 + zz * 18,
|
||||
8 + 18 * z, iSLot, this.invPlayer ) );
|
||||
}
|
||||
/*
|
||||
* if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new
|
||||
@@ -249,7 +249,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
public void onUpdate(String field, Object oldValue, Object newValue)
|
||||
{
|
||||
if ( field.equals( "copyMode" ) )
|
||||
workBench.getConfigManager().putSetting( Settings.COPY_MODE, this.copyMode );
|
||||
this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, this.copyMode );
|
||||
|
||||
super.onUpdate( field, oldValue, newValue );
|
||||
}
|
||||
@@ -257,17 +257,17 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack is = workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||
ItemStack is = this.workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
for (Object crafter : this.crafters)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) crafter;
|
||||
|
||||
if ( prevStack != is )
|
||||
if ( this.prevStack != is )
|
||||
{
|
||||
// if the bars changed an item was probably made, so just send shit!
|
||||
for (Object s : inventorySlots)
|
||||
for (Object s : this.inventorySlots)
|
||||
{
|
||||
if ( s instanceof OptionalSlotRestrictedInput )
|
||||
{
|
||||
@@ -279,28 +279,28 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
}
|
||||
}
|
||||
|
||||
this.copyMode = getCopyMode();
|
||||
this.fzMode = getFuzzyMode();
|
||||
this.copyMode = this.getCopyMode();
|
||||
this.fzMode = this.getFuzzyMode();
|
||||
}
|
||||
|
||||
prevStack = is;
|
||||
standardDetectAndSendChanges();
|
||||
this.prevStack = is;
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
IInventory inv = upgradeable.getInventoryByName( "config" );
|
||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
inv.setInventorySlotContents( x, null );
|
||||
detectAndSendChanges();
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
public void partition()
|
||||
{
|
||||
IInventory inv = upgradeable.getInventoryByName( "config" );
|
||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||
|
||||
IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell()
|
||||
.getCellInventory( upgradeable.getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS );
|
||||
.getCellInventory( this.upgradeable.getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS );
|
||||
|
||||
Iterator<IAEItemStack> i = new NullIterator<IAEItemStack>();
|
||||
if ( cellInv != null )
|
||||
@@ -321,7 +321,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
inv.setInventorySlotContents( x, null );
|
||||
}
|
||||
|
||||
detectAndSendChanges();
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -32,9 +32,9 @@ public class ContainerChest extends AEBaseContainer
|
||||
super( ip, chest, null );
|
||||
this.chest = chest;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, this.chest, 1, 80, 37, invPlayer ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, this.chest, 1, 80, 37, this.invPlayer ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -38,11 +38,11 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv
|
||||
super( ip, condenser, null );
|
||||
this.condenser = condenser;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.TRASH, condenser, 0, 51, 52, ip ) );
|
||||
addSlotToContainer( new SlotOutput( condenser, 1, 105, 52, -1 ) );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_COMPONENT, condenser.getInternalInventory(), 2, 101, 26, ip )).setStackLimit( 1 ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.TRASH, condenser, 0, 51, 52, ip ) );
|
||||
this.addSlotToContainer( new SlotOutput( condenser, 1, 105, 52, -1 ) );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_COMPONENT, condenser.getInternalInventory(), 2, 101, 26, ip )).setStackLimit( 1 ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 197 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 197 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -73,13 +73,13 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv
|
||||
@Override
|
||||
public int getCurrentProgress()
|
||||
{
|
||||
return (int) storedPower;
|
||||
return (int) this.storedPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxProgress()
|
||||
{
|
||||
return (int) requiredEnergy;
|
||||
return (int) this.requiredEnergy;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,17 +42,17 @@ public class ContainerCraftAmount extends AEBaseContainer
|
||||
|
||||
public ContainerCraftAmount(InventoryPlayer ip, ITerminalHost te) {
|
||||
super( ip, te );
|
||||
priHost = te;
|
||||
this.priHost = te;
|
||||
|
||||
craftingItem = new SlotInaccessible( new AppEngInternalInventory( null, 1 ), 0, 34, 53 );
|
||||
addSlotToContainer( craftingItem );
|
||||
this.craftingItem = new SlotInaccessible( new AppEngInternalInventory( null, 1 ), 0, 34, 53 );
|
||||
this.addSlotToContainer( this.craftingItem );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
verifyPermissions( SecurityPermissions.CRAFT, false );
|
||||
this.verifyPermissions( SecurityPermissions.CRAFT, false );
|
||||
}
|
||||
|
||||
public IGrid getGrid()
|
||||
@@ -63,12 +63,12 @@ public class ContainerCraftAmount extends AEBaseContainer
|
||||
|
||||
public World getWorld()
|
||||
{
|
||||
return getPlayerInv().player.worldObj;
|
||||
return this.getPlayerInv().player.worldObj;
|
||||
}
|
||||
|
||||
public BaseActionSource getActionSrc()
|
||||
{
|
||||
return new PlayerSource( getPlayerInv().player, (IActionHost) getTarget() );
|
||||
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -98,51 +98,51 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
|
||||
public ContainerCraftConfirm(InventoryPlayer ip, ITerminalHost te) {
|
||||
super( ip, te );
|
||||
priHost = te;
|
||||
this.priHost = te;
|
||||
}
|
||||
|
||||
private void sendCPUs()
|
||||
{
|
||||
Collections.sort( cpus );
|
||||
Collections.sort( this.cpus );
|
||||
|
||||
if ( selectedCpu >= cpus.size() )
|
||||
if ( this.selectedCpu >= this.cpus.size() )
|
||||
{
|
||||
selectedCpu = -1;
|
||||
cpuBytesAvail = 0;
|
||||
cpuCoProcessors = 0;
|
||||
myName = "";
|
||||
this.selectedCpu = -1;
|
||||
this.cpuBytesAvail = 0;
|
||||
this.cpuCoProcessors = 0;
|
||||
this.myName = "";
|
||||
}
|
||||
else if ( selectedCpu != -1 )
|
||||
else if ( this.selectedCpu != -1 )
|
||||
{
|
||||
myName = cpus.get( selectedCpu ).myName;
|
||||
cpuBytesAvail = cpus.get( selectedCpu ).size;
|
||||
cpuCoProcessors = cpus.get( selectedCpu ).processors;
|
||||
this.myName = this.cpus.get( this.selectedCpu ).myName;
|
||||
this.cpuBytesAvail = this.cpus.get( this.selectedCpu ).size;
|
||||
this.cpuCoProcessors = this.cpus.get( this.selectedCpu ).processors;
|
||||
}
|
||||
}
|
||||
|
||||
public void cycleCpu(boolean next)
|
||||
{
|
||||
if ( next )
|
||||
selectedCpu++;
|
||||
this.selectedCpu++;
|
||||
else
|
||||
selectedCpu--;
|
||||
this.selectedCpu--;
|
||||
|
||||
if ( selectedCpu < -1 )
|
||||
selectedCpu = cpus.size() - 1;
|
||||
else if ( selectedCpu >= cpus.size() )
|
||||
selectedCpu = -1;
|
||||
if ( this.selectedCpu < -1 )
|
||||
this.selectedCpu = this.cpus.size() - 1;
|
||||
else if ( this.selectedCpu >= this.cpus.size() )
|
||||
this.selectedCpu = -1;
|
||||
|
||||
if ( selectedCpu == -1 )
|
||||
if ( this.selectedCpu == -1 )
|
||||
{
|
||||
cpuBytesAvail = 0;
|
||||
cpuCoProcessors = 0;
|
||||
myName = "";
|
||||
this.cpuBytesAvail = 0;
|
||||
this.cpuCoProcessors = 0;
|
||||
this.myName = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
myName = cpus.get( selectedCpu ).myName;
|
||||
cpuBytesAvail = cpus.get( selectedCpu ).size;
|
||||
cpuCoProcessors = cpus.get( selectedCpu ).processors;
|
||||
this.myName = this.cpus.get( this.selectedCpu ).myName;
|
||||
this.cpuBytesAvail = this.cpus.get( this.selectedCpu ).size;
|
||||
this.cpuCoProcessors = this.cpus.get( this.selectedCpu ).processors;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
if ( Platform.isClient() )
|
||||
return;
|
||||
|
||||
ICraftingGrid cc = getGrid().getCache( ICraftingGrid.class );
|
||||
ICraftingGrid cc = this.getGrid().getCache( ICraftingGrid.class );
|
||||
ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
|
||||
|
||||
int matches = 0;
|
||||
@@ -160,11 +160,11 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
for (ICraftingCPU c : cpuSet)
|
||||
{
|
||||
boolean found = false;
|
||||
for (CraftingCPURecord ccr : cpus)
|
||||
for (CraftingCPURecord ccr : this.cpus)
|
||||
if ( ccr.cpu == c )
|
||||
found = true;
|
||||
|
||||
boolean matched = cpuMatches( c );
|
||||
boolean matched = this.cpuMatches( c );
|
||||
|
||||
if ( matched )
|
||||
matches++;
|
||||
@@ -173,50 +173,50 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if ( changed || cpus.size() != matches )
|
||||
if ( changed || this.cpus.size() != matches )
|
||||
{
|
||||
cpus.clear();
|
||||
this.cpus.clear();
|
||||
for (ICraftingCPU c : cpuSet)
|
||||
{
|
||||
if ( cpuMatches( c ) )
|
||||
cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
|
||||
if ( this.cpuMatches( c ) )
|
||||
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
|
||||
}
|
||||
|
||||
sendCPUs();
|
||||
this.sendCPUs();
|
||||
}
|
||||
|
||||
noCPU = cpus.size() == 0;
|
||||
this.noCPU = this.cpus.size() == 0;
|
||||
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if ( job != null && job.isDone() )
|
||||
if ( this.job != null && this.job.isDone() )
|
||||
{
|
||||
try
|
||||
{
|
||||
result = job.get();
|
||||
this.result = this.job.get();
|
||||
|
||||
if ( !result.isSimulation() )
|
||||
if ( !this.result.isSimulation() )
|
||||
{
|
||||
simulation = false;
|
||||
if ( autoStart )
|
||||
this.simulation = false;
|
||||
if ( this.autoStart )
|
||||
{
|
||||
startJob();
|
||||
this.startJob();
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
simulation = true;
|
||||
this.simulation = true;
|
||||
|
||||
try
|
||||
{
|
||||
PacketMEInventoryUpdate a = new PacketMEInventoryUpdate( (byte) 0 );
|
||||
PacketMEInventoryUpdate b = new PacketMEInventoryUpdate( (byte) 1 );
|
||||
PacketMEInventoryUpdate c = result.isSimulation() ? new PacketMEInventoryUpdate( (byte) 2 ) : null;
|
||||
PacketMEInventoryUpdate c = this.result.isSimulation() ? new PacketMEInventoryUpdate( (byte) 2 ) : null;
|
||||
|
||||
IItemList<IAEItemStack> plan = AEApi.instance().storage().createItemList();
|
||||
result.populatePlan( plan );
|
||||
this.result.populatePlan( plan );
|
||||
|
||||
bytesUsed = result.getByteTotal();
|
||||
this.bytesUsed = this.result.getByteTotal();
|
||||
|
||||
for (IAEItemStack out : plan)
|
||||
{
|
||||
@@ -230,13 +230,13 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
p.reset();
|
||||
p.setStackSize( out.getCountRequestable() );
|
||||
|
||||
IStorageGrid sg = getGrid().getCache( IStorageGrid.class );
|
||||
IStorageGrid sg = this.getGrid().getCache( IStorageGrid.class );
|
||||
IMEInventory<IAEItemStack> items = sg.getItemInventory();
|
||||
|
||||
if ( c != null && result.isSimulation() )
|
||||
if ( c != null && this.result.isSimulation() )
|
||||
{
|
||||
m = o.copy();
|
||||
o = items.extractItems( o, Actionable.SIMULATE, mySrc );
|
||||
o = items.extractItems( o, Actionable.SIMULATE, this.mySrc );
|
||||
|
||||
if ( o == null )
|
||||
{
|
||||
@@ -275,27 +275,27 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
}
|
||||
catch (Throwable e)
|
||||
{
|
||||
getPlayerInv().player.addChatMessage( new ChatComponentText( "Error: " + e.toString() ) );
|
||||
this.getPlayerInv().player.addChatMessage( new ChatComponentText( "Error: " + e.toString() ) );
|
||||
AELog.error( e );
|
||||
this.isContainerValid = false;
|
||||
result = null;
|
||||
this.result = null;
|
||||
}
|
||||
|
||||
job = null;
|
||||
this.job = null;
|
||||
}
|
||||
verifyPermissions( SecurityPermissions.CRAFT, false );
|
||||
this.verifyPermissions( SecurityPermissions.CRAFT, false );
|
||||
}
|
||||
|
||||
private boolean cpuMatches(ICraftingCPU c)
|
||||
{
|
||||
return c.getAvailableStorage() >= bytesUsed && !c.isBusy();
|
||||
return c.getAvailableStorage() >= this.bytesUsed && !c.isBusy();
|
||||
}
|
||||
|
||||
public void startJob()
|
||||
{
|
||||
GuiBridge OriginalGui = null;
|
||||
|
||||
IActionHost ah = getActionHost();
|
||||
IActionHost ah = this.getActionHost();
|
||||
if ( ah instanceof WirelessTerminalGuiObject )
|
||||
OriginalGui = GuiBridge.GUI_WIRELESS_TERM;
|
||||
|
||||
@@ -308,17 +308,17 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
if ( ah instanceof PartPatternTerminal )
|
||||
OriginalGui = GuiBridge.GUI_PATTERN_TERMINAL;
|
||||
|
||||
if ( result != null && !simulation )
|
||||
if ( this.result != null && !this.simulation )
|
||||
{
|
||||
ICraftingGrid cc = getGrid().getCache( ICraftingGrid.class );
|
||||
ICraftingLink g = cc.submitJob( result, null, selectedCpu == -1 ? null : cpus.get( selectedCpu ).cpu, true, getActionSrc() );
|
||||
autoStart = false;
|
||||
if ( g != null && OriginalGui != null && openContext != null )
|
||||
ICraftingGrid cc = this.getGrid().getCache( ICraftingGrid.class );
|
||||
ICraftingLink g = cc.submitJob( this.result, null, this.selectedCpu == -1 ? null : this.cpus.get( this.selectedCpu ).cpu, true, this.getActionSrc() );
|
||||
this.autoStart = false;
|
||||
if ( g != null && OriginalGui != null && this.openContext != null )
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketSwitchGuis( OriginalGui ), (EntityPlayerMP) invPlayer.player );
|
||||
NetworkHandler.instance.sendTo( new PacketSwitchGuis( OriginalGui ), (EntityPlayerMP) this.invPlayer.player );
|
||||
|
||||
TileEntity te = openContext.getTile();
|
||||
Platform.openGUI( invPlayer.player, te, openContext.side, OriginalGui );
|
||||
TileEntity te = this.openContext.getTile();
|
||||
Platform.openGUI( this.invPlayer.player, te, this.openContext.side, OriginalGui );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -327,10 +327,10 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
super.onContainerClosed( par1EntityPlayer );
|
||||
if ( job != null )
|
||||
if ( this.job != null )
|
||||
{
|
||||
job.cancel( true );
|
||||
job = null;
|
||||
this.job.cancel( true );
|
||||
this.job = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,10 +338,10 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
public void removeCraftingFromCrafters(ICrafting c)
|
||||
{
|
||||
super.removeCraftingFromCrafters( c );
|
||||
if ( job != null )
|
||||
if ( this.job != null )
|
||||
{
|
||||
job.cancel( true );
|
||||
job = null;
|
||||
this.job.cancel( true );
|
||||
this.job = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -353,11 +353,11 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
|
||||
public World getWorld()
|
||||
{
|
||||
return getPlayerInv().player.worldObj;
|
||||
return this.getPlayerInv().player.worldObj;
|
||||
}
|
||||
|
||||
public BaseActionSource getActionSrc()
|
||||
{
|
||||
return new PlayerSource( getPlayerInv().player, (IActionHost) getTarget() );
|
||||
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,25 +61,25 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
|
||||
if ( host != null )
|
||||
{
|
||||
findNode( host, ForgeDirection.UNKNOWN );
|
||||
this.findNode( host, ForgeDirection.UNKNOWN );
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
|
||||
findNode( host, d );
|
||||
this.findNode( host, d );
|
||||
}
|
||||
|
||||
if ( te instanceof TileCraftingTile )
|
||||
setCPU( (ICraftingCPU) ((TileCraftingTile) te).getCluster() );
|
||||
this.setCPU( (ICraftingCPU) ((TileCraftingTile) te).getCluster() );
|
||||
|
||||
if ( network == null && Platform.isServer() )
|
||||
isContainerValid = false;
|
||||
if ( this.network == null && Platform.isServer() )
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
|
||||
protected void setCPU(ICraftingCPU c)
|
||||
{
|
||||
if ( c == monitor )
|
||||
if ( c == this.monitor )
|
||||
return;
|
||||
|
||||
if ( monitor != null )
|
||||
monitor.removeListener( this );
|
||||
if ( this.monitor != null )
|
||||
this.monitor.removeListener( this );
|
||||
|
||||
for (Object g : this.crafters)
|
||||
{
|
||||
@@ -98,38 +98,38 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
|
||||
if ( c instanceof CraftingCPUCluster )
|
||||
{
|
||||
cpuName = c.getName();
|
||||
this.cpuName = c.getName();
|
||||
|
||||
monitor = (CraftingCPUCluster) c;
|
||||
if ( monitor != null )
|
||||
this.monitor = (CraftingCPUCluster) c;
|
||||
if ( this.monitor != null )
|
||||
{
|
||||
list.resetStatus();
|
||||
monitor.getListOfItem( list, CraftingItemList.ALL );
|
||||
monitor.addListener( this, null );
|
||||
this.list.resetStatus();
|
||||
this.monitor.getListOfItem( this.list, CraftingItemList.ALL );
|
||||
this.monitor.addListener( this, null );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
monitor = null;
|
||||
cpuName = "";
|
||||
this.monitor = null;
|
||||
this.cpuName = "";
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelCrafting()
|
||||
{
|
||||
if ( monitor != null )
|
||||
if ( this.monitor != null )
|
||||
{
|
||||
monitor.cancel();
|
||||
this.monitor.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
private void findNode(IGridHost host, ForgeDirection d)
|
||||
{
|
||||
if ( network == null )
|
||||
if ( this.network == null )
|
||||
{
|
||||
IGridNode node = host.getGridNode( d );
|
||||
if ( node != null )
|
||||
network = node.getGrid();
|
||||
this.network = node.getGrid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,8 +139,8 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
public void onContainerClosed(EntityPlayer player)
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
if ( monitor != null )
|
||||
monitor.removeListener( this );
|
||||
if ( this.monitor != null )
|
||||
this.monitor.removeListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -148,14 +148,14 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
{
|
||||
super.removeCraftingFromCrafters( c );
|
||||
|
||||
if ( this.crafters.isEmpty() && monitor != null )
|
||||
monitor.removeListener( this );
|
||||
if ( this.crafters.isEmpty() && this.monitor != null )
|
||||
this.monitor.removeListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
if ( Platform.isServer() && monitor != null && !list.isEmpty() )
|
||||
if ( Platform.isServer() && this.monitor != null && !this.list.isEmpty() )
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -163,14 +163,14 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
PacketMEInventoryUpdate b = new PacketMEInventoryUpdate( (byte) 1 );
|
||||
PacketMEInventoryUpdate c = new PacketMEInventoryUpdate( (byte) 2 );
|
||||
|
||||
for (IAEItemStack out : list)
|
||||
for (IAEItemStack out : this.list)
|
||||
{
|
||||
a.appendItem( monitor.getItemStack( out, CraftingItemList.STORAGE ) );
|
||||
b.appendItem( monitor.getItemStack( out, CraftingItemList.ACTIVE ) );
|
||||
c.appendItem( monitor.getItemStack( out, CraftingItemList.PENDING ) );
|
||||
a.appendItem( this.monitor.getItemStack( out, CraftingItemList.STORAGE ) );
|
||||
b.appendItem( this.monitor.getItemStack( out, CraftingItemList.ACTIVE ) );
|
||||
c.appendItem( this.monitor.getItemStack( out, CraftingItemList.PENDING ) );
|
||||
}
|
||||
|
||||
list.resetStatus();
|
||||
this.list.resetStatus();
|
||||
|
||||
for (Object g : this.crafters)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
{
|
||||
is = is.copy();
|
||||
is.setStackSize( 1 );
|
||||
list.add( is );
|
||||
this.list.add( is );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,12 +222,12 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
|
||||
@Override
|
||||
public String getCustomName()
|
||||
{
|
||||
return cpuName;
|
||||
return this.cpuName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomName()
|
||||
{
|
||||
return cpuName != null && cpuName.length() > 0;
|
||||
return this.cpuName != null && this.cpuName.length() > 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,34 +45,34 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
|
||||
|
||||
private void sendCPUs()
|
||||
{
|
||||
Collections.sort( cpus );
|
||||
Collections.sort( this.cpus );
|
||||
|
||||
if ( selectedCpu >= cpus.size() )
|
||||
if ( this.selectedCpu >= this.cpus.size() )
|
||||
{
|
||||
selectedCpu = -1;
|
||||
myName = "";
|
||||
this.selectedCpu = -1;
|
||||
this.myName = "";
|
||||
}
|
||||
else if ( selectedCpu != -1 )
|
||||
else if ( this.selectedCpu != -1 )
|
||||
{
|
||||
myName = cpus.get( selectedCpu ).myName;
|
||||
this.myName = this.cpus.get( this.selectedCpu ).myName;
|
||||
}
|
||||
|
||||
if ( selectedCpu == -1 && cpus.size() > 0 )
|
||||
selectedCpu = 0;
|
||||
if ( this.selectedCpu == -1 && this.cpus.size() > 0 )
|
||||
this.selectedCpu = 0;
|
||||
|
||||
if ( selectedCpu != -1 )
|
||||
if ( this.selectedCpu != -1 )
|
||||
{
|
||||
if ( cpus.get( selectedCpu ).cpu != monitor )
|
||||
setCPU( cpus.get( selectedCpu ).cpu );
|
||||
if ( this.cpus.get( this.selectedCpu ).cpu != this.monitor )
|
||||
this.setCPU( this.cpus.get( this.selectedCpu ).cpu );
|
||||
}
|
||||
else
|
||||
setCPU( null );
|
||||
this.setCPU( null );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ICraftingGrid cc = network.getCache( ICraftingGrid.class );
|
||||
ICraftingGrid cc = this.network.getCache( ICraftingGrid.class );
|
||||
ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
|
||||
|
||||
int matches = 0;
|
||||
@@ -80,11 +80,11 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
|
||||
for (ICraftingCPU c : cpuSet)
|
||||
{
|
||||
boolean found = false;
|
||||
for (CraftingCPURecord ccr : cpus)
|
||||
for (CraftingCPURecord ccr : this.cpus)
|
||||
if ( ccr.cpu == c )
|
||||
found = true;
|
||||
|
||||
boolean matched = cpuMatches( c );
|
||||
boolean matched = this.cpuMatches( c );
|
||||
|
||||
if ( matched )
|
||||
matches++;
|
||||
@@ -93,19 +93,19 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if ( changed || cpus.size() != matches )
|
||||
if ( changed || this.cpus.size() != matches )
|
||||
{
|
||||
cpus.clear();
|
||||
this.cpus.clear();
|
||||
for (ICraftingCPU c : cpuSet)
|
||||
{
|
||||
if ( cpuMatches( c ) )
|
||||
cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
|
||||
if ( this.cpuMatches( c ) )
|
||||
this.cpus.add( new CraftingCPURecord( c.getAvailableStorage(), c.getCoProcessors(), c ) );
|
||||
}
|
||||
|
||||
sendCPUs();
|
||||
this.sendCPUs();
|
||||
}
|
||||
|
||||
noCPU = cpus.size() == 0;
|
||||
this.noCPU = this.cpus.size() == 0;
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
@@ -122,27 +122,27 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
|
||||
public void cycleCpu(boolean next)
|
||||
{
|
||||
if ( next )
|
||||
selectedCpu++;
|
||||
this.selectedCpu++;
|
||||
else
|
||||
selectedCpu--;
|
||||
this.selectedCpu--;
|
||||
|
||||
if ( selectedCpu < -1 )
|
||||
selectedCpu = cpus.size() - 1;
|
||||
else if ( selectedCpu >= cpus.size() )
|
||||
selectedCpu = -1;
|
||||
if ( this.selectedCpu < -1 )
|
||||
this.selectedCpu = this.cpus.size() - 1;
|
||||
else if ( this.selectedCpu >= this.cpus.size() )
|
||||
this.selectedCpu = -1;
|
||||
|
||||
if ( selectedCpu == -1 && cpus.size() > 0 )
|
||||
selectedCpu = 0;
|
||||
if ( this.selectedCpu == -1 && this.cpus.size() > 0 )
|
||||
this.selectedCpu = 0;
|
||||
|
||||
if ( selectedCpu == -1 )
|
||||
if ( this.selectedCpu == -1 )
|
||||
{
|
||||
myName = "";
|
||||
setCPU( null );
|
||||
this.myName = "";
|
||||
this.setCPU( null );
|
||||
}
|
||||
else
|
||||
{
|
||||
myName = cpus.get( selectedCpu ).myName;
|
||||
setCPU( cpus.get( selectedCpu ).cpu );
|
||||
this.myName = this.cpus.get( this.selectedCpu ).myName;
|
||||
this.setCPU( this.cpus.get( this.selectedCpu ).cpu );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,26 +53,26 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
||||
InventoryCrafting ic = new InventoryCrafting( cn, 3, 3 );
|
||||
|
||||
for (int x = 0; x < 9; x++)
|
||||
ic.setInventorySlotContents( x, craftingSlots[x].getStack() );
|
||||
ic.setInventorySlotContents( x, this.craftingSlots[x].getStack() );
|
||||
|
||||
outputSlot.putStack( CraftingManager.getInstance().findMatchingRecipe( ic, getPlayerInv().player.worldObj ) );
|
||||
this.outputSlot.putStack( CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.worldObj ) );
|
||||
}
|
||||
|
||||
public ContainerCraftingTerm(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super( ip, monitorable, false );
|
||||
ct = (PartCraftingTerminal) monitorable;
|
||||
this.ct = (PartCraftingTerminal) monitorable;
|
||||
|
||||
IInventory crafting = ct.getInventoryByName( "crafting" );
|
||||
IInventory crafting = this.ct.getInventoryByName( "crafting" );
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 3; x++)
|
||||
addSlotToContainer( craftingSlots[x + y * 3] = new SlotCraftingMatrix( this, crafting, x + y * 3, 37 + x * 18, -72 + y * 18 ) );
|
||||
this.addSlotToContainer( this.craftingSlots[x + y * 3] = new SlotCraftingMatrix( this, crafting, x + y * 3, 37 + x * 18, -72 + y * 18 ) );
|
||||
|
||||
addSlotToContainer( outputSlot = new SlotCraftingTerm( getPlayerInv().player, mySrc, powerSrc, monitorable, crafting, crafting, output, 131, -72 + 18, this ) );
|
||||
this.addSlotToContainer( this.outputSlot = new SlotCraftingTerm( this.getPlayerInv().player, this.mySrc, this.powerSrc, monitorable, crafting, crafting, this.output, 131, -72 + 18, this ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 0 );
|
||||
this.bindPlayerInventory( ip, 0, 0 );
|
||||
|
||||
onCraftMatrixChanged( crafting );
|
||||
this.onCraftMatrixChanged( crafting );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,9 +92,9 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
||||
{
|
||||
if (name.equals("player"))
|
||||
{
|
||||
return invPlayer;
|
||||
return this.invPlayer;
|
||||
}
|
||||
return ct.getInventoryByName( name );
|
||||
return this.ct.getInventoryByName( name );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,10 +35,10 @@ public class ContainerDrive extends AEBaseContainer
|
||||
for (int y = 0; y < 5; y++)
|
||||
for (int x = 0; x < 2; x++)
|
||||
{
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, drive, x + y * 2, 71 + x * 18, 14 + y * 18, invPlayer ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, drive, x + y * 2, 71 + x * 18, 14 + y * 18, this.invPlayer ) );
|
||||
}
|
||||
|
||||
bindPlayerInventory( ip, 0, 199 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 199 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public class ContainerFormationPlane extends ContainerUpgradeable
|
||||
|
||||
public ContainerFormationPlane(InventoryPlayer ip, PartFormationPlane te) {
|
||||
super( ip, te );
|
||||
storageBus = te;
|
||||
this.storageBus = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -63,7 +63,7 @@ public class ContainerFormationPlane extends ContainerUpgradeable
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx)
|
||||
{
|
||||
int upgrades = upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
|
||||
return upgrades > idx;
|
||||
}
|
||||
@@ -74,37 +74,37 @@ public class ContainerFormationPlane extends ContainerUpgradeable
|
||||
int xo = 8;
|
||||
int yo = 23 + 6;
|
||||
|
||||
IInventory config = upgradeable.getInventoryByName( "config" );
|
||||
IInventory config = this.upgradeable.getInventoryByName( "config" );
|
||||
for (int y = 0; y < 7; y++)
|
||||
{
|
||||
for (int x = 0; x < 9; x++)
|
||||
{
|
||||
if ( y < 2 )
|
||||
addSlotToContainer( new SlotFakeTypeOnly( config, y * 9 + x, xo + x * 18, yo + y * 18 ) );
|
||||
this.addSlotToContainer( new SlotFakeTypeOnly( config, y * 9 + x, xo + x * 18, yo + y * 18 ) );
|
||||
else
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( config, this, y * 9 + x, xo, yo, x, y, y - 2 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( config, this, y * 9 + x, xo, yo, x, y, y - 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, invPlayer )).setNotDraggable() );
|
||||
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer )).setNotDraggable() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
}
|
||||
|
||||
standardDetectAndSendChanges();
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,17 +34,17 @@ public class ContainerGrinder extends AEBaseContainer
|
||||
super( ip, grinder, null );
|
||||
this.grinder = grinder;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 0, 12, 17, invPlayer ) );
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 1, 12 + 18, 17, invPlayer ) );
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 2, 12 + 36, 17, invPlayer ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 0, 12, 17, this.invPlayer ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 1, 12 + 18, 17, this.invPlayer ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 2, 12 + 36, 17, this.invPlayer ) );
|
||||
|
||||
addSlotToContainer( new SlotInaccessible( grinder, 6, 80, 40 ) );
|
||||
this.addSlotToContainer( new SlotInaccessible( grinder, 6, 80, 40 ) );
|
||||
|
||||
addSlotToContainer( new SlotOutput( grinder, 3, 112, 63, 2 * 16 + 15 ) );
|
||||
addSlotToContainer( new SlotOutput( grinder, 4, 112 + 18, 63, 2 * 16 + 15 ) );
|
||||
addSlotToContainer( new SlotOutput( grinder, 5, 112 + 36, 63, 2 * 16 + 15 ) );
|
||||
this.addSlotToContainer( new SlotOutput( grinder, 3, 112, 63, 2 * 16 + 15 ) );
|
||||
this.addSlotToContainer( new SlotOutput( grinder, 4, 112 + 18, 63, 2 * 16 + 15 ) );
|
||||
this.addSlotToContainer( new SlotOutput( grinder, 5, 112 + 36, 63, 2 * 16 + 15 ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 176 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 176 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ContainerIOPort extends ContainerUpgradeable
|
||||
|
||||
public ContainerIOPort(InventoryPlayer ip, TileIOPort te) {
|
||||
super( ip, te );
|
||||
ioPort = te;
|
||||
this.ioPort = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,37 +72,37 @@ public class ContainerIOPort extends ContainerUpgradeable
|
||||
int offX = 19;
|
||||
int offY = 17;
|
||||
|
||||
IInventory cells = upgradeable.getInventoryByName( "cells" );
|
||||
IInventory cells = this.upgradeable.getInventoryByName( "cells" );
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 2; x++)
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, invPlayer ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.invPlayer ) );
|
||||
|
||||
offX = 122;
|
||||
offY = 17;
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 2; x++)
|
||||
addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
|
||||
this.addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offX + x * 18, offY + y * 18, SlotRestrictedInput.PlacableItemType.STORAGE_CELLS.IIcon ) );
|
||||
|
||||
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
|
||||
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer )).setNotDraggable() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
this.opMode = (OperationMode) upgradeable.getConfigManager().getSetting( Settings.OPERATION_MODE );
|
||||
this.opMode = (OperationMode) this.upgradeable.getConfigManager().getSetting( Settings.OPERATION_MODE );
|
||||
this.fMode = (FullnessMode) this.upgradeable.getConfigManager().getSetting( Settings.FULLNESS_MODE );
|
||||
this.rsMode = (RedstoneMode) this.upgradeable.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
}
|
||||
|
||||
standardDetectAndSendChanges();
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,15 +49,15 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
public ContainerInscriber(InventoryPlayer ip, TileInscriber te)
|
||||
{
|
||||
super( ip, te );
|
||||
ti = te;
|
||||
this.ti = te;
|
||||
|
||||
addSlotToContainer( top = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, ti, 0, 45, 16, invPlayer ) );
|
||||
addSlotToContainer( bottom = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, ti, 1, 45, 62, invPlayer ) );
|
||||
addSlotToContainer( middle = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_INPUT, ti, 2, 63, 39, invPlayer ) );
|
||||
this.addSlotToContainer( this.top = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, this.ti, 0, 45, 16, this.invPlayer ) );
|
||||
this.addSlotToContainer( this.bottom = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, this.ti, 1, 45, 62, this.invPlayer ) );
|
||||
this.addSlotToContainer( this.middle = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_INPUT, this.ti, 2, 63, 39, this.invPlayer ) );
|
||||
|
||||
addSlotToContainer( new SlotOutput( ti, 3, 113, 40, -1 ) );
|
||||
this.addSlotToContainer( new SlotOutput( this.ti, 3, 113, 40, -1 ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, getHeight() - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, this.getHeight() - /* height of player inventory */82 );
|
||||
|
||||
}
|
||||
|
||||
@@ -85,16 +85,16 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
*/
|
||||
protected void setupConfig()
|
||||
{
|
||||
setupUpgrades();
|
||||
this.setupUpgrades();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidForSlot(Slot s, ItemStack is)
|
||||
{
|
||||
ItemStack PlateA = ti.getStackInSlot( 0 );
|
||||
ItemStack PlateB = ti.getStackInSlot( 1 );
|
||||
ItemStack PlateA = this.ti.getStackInSlot( 0 );
|
||||
ItemStack PlateB = this.ti.getStackInSlot( 1 );
|
||||
|
||||
if ( s == middle )
|
||||
if ( s == this.middle )
|
||||
{
|
||||
for (ItemStack i : Inscribe.plates)
|
||||
{
|
||||
@@ -129,14 +129,14 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( (s == top && PlateB != null) || (s == bottom && PlateA != null) )
|
||||
if ( (s == this.top && PlateB != null) || (s == this.bottom && PlateA != null) )
|
||||
{
|
||||
boolean isValid = false;
|
||||
ItemStack otherSlot = null;
|
||||
if ( s == top )
|
||||
otherSlot = bottom.getStack();
|
||||
if ( s == this.top )
|
||||
otherSlot = this.bottom.getStack();
|
||||
else
|
||||
otherSlot = top.getStack();
|
||||
otherSlot = this.top.getStack();
|
||||
|
||||
// name presses
|
||||
if ( AEApi.instance().materials().materialNamePress.sameAsStack( otherSlot ) )
|
||||
@@ -168,24 +168,24 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
standardDetectAndSendChanges();
|
||||
this.standardDetectAndSendChanges();
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
this.maxProcessingTime = ti.maxProcessingTime;
|
||||
this.processingTime = ti.processingTime;
|
||||
this.maxProcessingTime = this.ti.maxProcessingTime;
|
||||
this.processingTime = this.ti.processingTime;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentProgress()
|
||||
{
|
||||
return processingTime;
|
||||
return this.processingTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxProgress()
|
||||
{
|
||||
return maxProcessingTime;
|
||||
return this.maxProcessingTime;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,16 +44,16 @@ public class ContainerInterface extends ContainerUpgradeable
|
||||
public ContainerInterface(InventoryPlayer ip, IInterfaceHost te) {
|
||||
super( ip, te.getInterfaceDuality().getHost() );
|
||||
|
||||
myDuality = te.getInterfaceDuality();
|
||||
this.myDuality = te.getInterfaceDuality();
|
||||
|
||||
for (int x = 0; x < 9; x++)
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7, invPlayer ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, this.myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7, this.invPlayer ) );
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
addSlotToContainer( new SlotFake( myDuality.getConfig(), x, 17 + 18 * x, 35 ) );
|
||||
this.addSlotToContainer( new SlotFake( this.myDuality.getConfig(), x, 17 + 18 * x, 35 ) );
|
||||
|
||||
for (int x = 0; x < 8; x++)
|
||||
addSlotToContainer( new SlotNormal( myDuality.getStorage(), x, 17 + 18 * x, 35 + 18 ) );
|
||||
this.addSlotToContainer( new SlotNormal( this.myDuality.getStorage(), x, 17 + 18 * x, 35 + 18 ) );
|
||||
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ContainerInterface extends ContainerUpgradeable
|
||||
@Override
|
||||
protected void setupConfig()
|
||||
{
|
||||
setupUpgrades();
|
||||
this.setupUpgrades();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +85,7 @@ public class ContainerInterface extends ContainerUpgradeable
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
final String unlocalizedName;
|
||||
|
||||
public InvTracker(DualityInterface dual, IInventory patterns, String unlocalizedName) {
|
||||
server = patterns;
|
||||
client = new AppEngInternalInventory( null, server.getSizeInventory() );
|
||||
this.server = patterns;
|
||||
this.client = new AppEngInternalInventory( null, this.server.getSizeInventory() );
|
||||
this.unlocalizedName = unlocalizedName;
|
||||
this.sortBy = dual.getSortValue();
|
||||
}
|
||||
@@ -89,9 +89,9 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
super( ip, anchor );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
g = anchor.getActionableNode().getGrid();
|
||||
this.g = anchor.getActionableNode().getGrid();
|
||||
|
||||
bindPlayerInventory( ip, 0, 222 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 222 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
@@ -114,7 +114,7 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
@Override
|
||||
public void doAction(EntityPlayerMP player, InventoryAction action, int slot, long id)
|
||||
{
|
||||
InvTracker inv = byId.get( id );
|
||||
InvTracker inv = this.byId.get( id );
|
||||
if ( inv != null )
|
||||
{
|
||||
ItemStack is = inv.server.getStackInSlot( slot );
|
||||
@@ -210,7 +210,7 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
return;
|
||||
}
|
||||
|
||||
updateHeld( player );
|
||||
this.updateHeld( player );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -222,19 +222,19 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if ( g == null )
|
||||
if ( this.g == null )
|
||||
return;
|
||||
|
||||
int total = 0;
|
||||
boolean missing = false;
|
||||
|
||||
IActionHost host = getActionHost();
|
||||
IActionHost host = this.getActionHost();
|
||||
if ( host != null )
|
||||
{
|
||||
IGridNode agn = host.getActionableNode();
|
||||
if ( agn != null && agn.isActive() )
|
||||
{
|
||||
for (IGridNode gn : g.getMachines( TileInterface.class ))
|
||||
for (IGridNode gn : this.g.getMachines( TileInterface.class ))
|
||||
{
|
||||
if ( gn.isActive() )
|
||||
{
|
||||
@@ -242,7 +242,7 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
if ( ih.getInterfaceDuality().getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.NO )
|
||||
continue;
|
||||
|
||||
InvTracker t = diList.get( ih );
|
||||
InvTracker t = this.diList.get( ih );
|
||||
|
||||
if ( t == null )
|
||||
missing = true;
|
||||
@@ -257,7 +257,7 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
}
|
||||
}
|
||||
|
||||
for (IGridNode gn : g.getMachines( PartInterface.class ))
|
||||
for (IGridNode gn : this.g.getMachines( PartInterface.class ))
|
||||
{
|
||||
if ( gn.isActive() )
|
||||
{
|
||||
@@ -265,7 +265,7 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
if ( ih.getInterfaceDuality().getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.NO )
|
||||
continue;
|
||||
|
||||
InvTracker t = diList.get( ih );
|
||||
InvTracker t = this.diList.get( ih );
|
||||
|
||||
if ( t == null )
|
||||
missing = true;
|
||||
@@ -282,33 +282,33 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
}
|
||||
}
|
||||
|
||||
if ( total != diList.size() || missing )
|
||||
regenList( data );
|
||||
if ( total != this.diList.size() || missing )
|
||||
this.regenList( this.data );
|
||||
else
|
||||
{
|
||||
for (Entry<IInterfaceHost, InvTracker> en : diList.entrySet())
|
||||
for (Entry<IInterfaceHost, InvTracker> en : this.diList.entrySet())
|
||||
{
|
||||
InvTracker inv = en.getValue();
|
||||
for (int x = 0; x < inv.server.getSizeInventory(); x++)
|
||||
{
|
||||
if ( isDifferent( inv.server.getStackInSlot( x ), inv.client.getStackInSlot( x ) ) )
|
||||
addItems( data, inv, x, 1 );
|
||||
if ( this.isDifferent( inv.server.getStackInSlot( x ), inv.client.getStackInSlot( x ) ) )
|
||||
this.addItems( this.data, inv, x, 1 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !data.hasNoTags() )
|
||||
if ( !this.data.hasNoTags() )
|
||||
{
|
||||
try
|
||||
{
|
||||
NetworkHandler.instance.sendTo( new PacketCompressedNBT( data ), (EntityPlayerMP) getPlayerInv().player );
|
||||
NetworkHandler.instance.sendTo( new PacketCompressedNBT( this.data ), (EntityPlayerMP) this.getPlayerInv().player );
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// :P
|
||||
}
|
||||
|
||||
data = new NBTTagCompound();
|
||||
this.data = new NBTTagCompound();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -325,40 +325,40 @@ public class ContainerInterfaceTerminal extends AEBaseContainer
|
||||
|
||||
private void regenList(NBTTagCompound data)
|
||||
{
|
||||
byId.clear();
|
||||
diList.clear();
|
||||
this.byId.clear();
|
||||
this.diList.clear();
|
||||
|
||||
IActionHost host = getActionHost();
|
||||
IActionHost host = this.getActionHost();
|
||||
if ( host != null )
|
||||
{
|
||||
IGridNode agn = host.getActionableNode();
|
||||
if ( agn != null && agn.isActive() )
|
||||
{
|
||||
for (IGridNode gn : g.getMachines( TileInterface.class ))
|
||||
for (IGridNode gn : this.g.getMachines( TileInterface.class ))
|
||||
{
|
||||
IInterfaceHost ih = (IInterfaceHost) gn.getMachine();
|
||||
DualityInterface dual = ih.getInterfaceDuality();
|
||||
if ( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES )
|
||||
diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) );
|
||||
this.diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) );
|
||||
}
|
||||
|
||||
for (IGridNode gn : g.getMachines( PartInterface.class ))
|
||||
for (IGridNode gn : this.g.getMachines( PartInterface.class ))
|
||||
{
|
||||
IInterfaceHost ih = (IInterfaceHost) gn.getMachine();
|
||||
DualityInterface dual = ih.getInterfaceDuality();
|
||||
if ( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES )
|
||||
diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) );
|
||||
this.diList.put( ih, new InvTracker( dual, dual.getPatterns(), dual.getTermName() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.setBoolean( "clear", true );
|
||||
|
||||
for (Entry<IInterfaceHost, InvTracker> en : diList.entrySet())
|
||||
for (Entry<IInterfaceHost, InvTracker> en : this.diList.entrySet())
|
||||
{
|
||||
InvTracker inv = en.getValue();
|
||||
byId.put( inv.which, inv );
|
||||
addItems( data, inv, 0, inv.server.getSizeInventory() );
|
||||
this.byId.put( inv.which, inv );
|
||||
this.addItems( data, inv, 0, inv.server.getSizeInventory() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,13 +50,13 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setTextField(GuiTextField level)
|
||||
{
|
||||
textField = level;
|
||||
textField.setText( String.valueOf( EmitterValue ) );
|
||||
this.textField = level;
|
||||
this.textField.setText( String.valueOf( this.EmitterValue ) );
|
||||
}
|
||||
|
||||
public ContainerLevelEmitter(InventoryPlayer ip, PartLevelEmitter te) {
|
||||
super( ip, te );
|
||||
lvlEmitter = te;
|
||||
this.lvlEmitter = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,8 +74,8 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
|
||||
|
||||
public void setLevel(long l, EntityPlayer player)
|
||||
{
|
||||
lvlEmitter.setReportingValue( l );
|
||||
EmitterValue = l;
|
||||
this.lvlEmitter.setReportingValue( l );
|
||||
this.EmitterValue = l;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,18 +84,18 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
|
||||
int x = 80 + 44;
|
||||
int y = 40;
|
||||
|
||||
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
|
||||
if ( availableUpgrades() > 0 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 1 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 2 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 3 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() );
|
||||
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
||||
if ( this.availableUpgrades() > 0 )
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer )).setNotDraggable() );
|
||||
if ( this.availableUpgrades() > 1 )
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer )).setNotDraggable() );
|
||||
if ( this.availableUpgrades() > 2 )
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer )).setNotDraggable() );
|
||||
if ( this.availableUpgrades() > 3 )
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer )).setNotDraggable() );
|
||||
|
||||
IInventory inv = upgradeable.getInventoryByName( "config" );
|
||||
addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
|
||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||
this.addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
|
||||
}
|
||||
|
||||
@GuiSync(2)
|
||||
@@ -110,18 +110,18 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
this.EmitterValue = lvlEmitter.getReportingValue();
|
||||
this.EmitterValue = this.lvlEmitter.getReportingValue();
|
||||
this.cmType = (YesNo) this.upgradeable.getConfigManager().getSetting( Settings.CRAFT_VIA_REDSTONE );
|
||||
this.lvType = (LevelType) this.upgradeable.getConfigManager().getSetting( Settings.LEVEL_TYPE );
|
||||
this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE );
|
||||
this.rsMode = (RedstoneMode) this.upgradeable.getConfigManager().getSetting( Settings.REDSTONE_EMITTER );
|
||||
}
|
||||
|
||||
standardDetectAndSendChanges();
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -129,8 +129,8 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
|
||||
{
|
||||
if ( field.equals( "EmitterValue" ) )
|
||||
{
|
||||
if ( textField != null )
|
||||
textField.setText( String.valueOf( EmitterValue ) );
|
||||
if ( this.textField != null )
|
||||
this.textField.setText( String.valueOf( this.EmitterValue ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
|
||||
public ContainerMAC(InventoryPlayer ip, TileMolecularAssembler te)
|
||||
{
|
||||
super( ip, te );
|
||||
tma = te;
|
||||
this.tma = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -72,7 +72,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
|
||||
|
||||
public boolean isValidItemForSlot(int slotIndex, ItemStack i)
|
||||
{
|
||||
IInventory mac = upgradeable.getInventoryByName( "mac" );
|
||||
IInventory mac = this.upgradeable.getInventoryByName( "mac" );
|
||||
|
||||
ItemStack is = mac.getStackInSlot( 10 );
|
||||
if ( is == null )
|
||||
@@ -96,56 +96,56 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
|
||||
int offX = 29;
|
||||
int offY = 30;
|
||||
|
||||
IInventory mac = upgradeable.getInventoryByName( "mac" );
|
||||
IInventory mac = this.upgradeable.getInventoryByName( "mac" );
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 3; x++)
|
||||
{
|
||||
SlotMACPattern s = new SlotMACPattern( this, mac, x + y * 3, offX + x * 18, offY + y * 18 );
|
||||
addSlotToContainer( s );
|
||||
this.addSlotToContainer( s );
|
||||
}
|
||||
|
||||
offX = 126;
|
||||
offY = 16;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_CRAFTING_PATTERN, mac, 10, offX, offY, invPlayer ) );
|
||||
addSlotToContainer( new SlotOutput( mac, 9, offX, offY + 32, -1 ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_CRAFTING_PATTERN, mac, 10, offX, offY, this.invPlayer ) );
|
||||
this.addSlotToContainer( new SlotOutput( mac, 9, offX, offY + 32, -1 ) );
|
||||
|
||||
offX = 122;
|
||||
offY = 17;
|
||||
|
||||
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer ))
|
||||
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ))
|
||||
.setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer ))
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ))
|
||||
.setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer ))
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ))
|
||||
.setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer ))
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ))
|
||||
.setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, invPlayer ))
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer ))
|
||||
.setNotDraggable() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
this.rsMode = (RedstoneMode) this.upgradeable.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
}
|
||||
|
||||
craftProgress = this.tma.getCraftingProgress();
|
||||
this.craftProgress = this.tma.getCraftingProgress();
|
||||
|
||||
standardDetectAndSendChanges();
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCurrentProgress()
|
||||
{
|
||||
return craftProgress;
|
||||
return this.craftProgress;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -88,66 +88,66 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
|
||||
public IGridNode getNetworkNode()
|
||||
{
|
||||
return networkNode;
|
||||
return this.networkNode;
|
||||
}
|
||||
|
||||
protected ContainerMEMonitorable(InventoryPlayer ip, ITerminalHost monitorable, boolean bindInventory) {
|
||||
super( ip, monitorable instanceof TileEntity ? (TileEntity) monitorable : null, monitorable instanceof IPart ? (IPart) monitorable : null );
|
||||
|
||||
host = monitorable;
|
||||
clientCM = new ConfigManager( this );
|
||||
this.host = monitorable;
|
||||
this.clientCM = new ConfigManager( this );
|
||||
|
||||
clientCM.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||
clientCM.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||
clientCM.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||
this.clientCM.registerSetting( Settings.SORT_BY, SortOrder.NAME );
|
||||
this.clientCM.registerSetting( Settings.VIEW_MODE, ViewItems.ALL );
|
||||
this.clientCM.registerSetting( Settings.SORT_DIRECTION, SortDir.ASCENDING );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
serverCM = monitorable.getConfigManager();
|
||||
this.serverCM = monitorable.getConfigManager();
|
||||
|
||||
monitor = monitorable.getItemInventory();
|
||||
if ( monitor != null )
|
||||
this.monitor = monitorable.getItemInventory();
|
||||
if ( this.monitor != null )
|
||||
{
|
||||
monitor.addListener( this, null );
|
||||
this.monitor.addListener( this, null );
|
||||
|
||||
cellInv = monitor;
|
||||
this.cellInv = this.monitor;
|
||||
|
||||
if ( monitorable instanceof IPortableCell )
|
||||
powerSrc = (IPortableCell) monitorable;
|
||||
this.powerSrc = (IPortableCell) monitorable;
|
||||
else if ( monitorable instanceof IMEChest )
|
||||
powerSrc = (IMEChest) monitorable;
|
||||
this.powerSrc = (IMEChest) monitorable;
|
||||
else if ( monitorable instanceof IGridHost )
|
||||
{
|
||||
IGridNode node = ((IGridHost) monitorable).getGridNode( ForgeDirection.UNKNOWN );
|
||||
if ( node != null )
|
||||
{
|
||||
networkNode = node;
|
||||
this.networkNode = node;
|
||||
IGrid g = node.getGrid();
|
||||
if ( g != null )
|
||||
powerSrc = new ChannelPowerSrc( networkNode, (IEnergyGrid) g.getCache( IEnergyGrid.class ) );
|
||||
this.powerSrc = new ChannelPowerSrc( this.networkNode, (IEnergyGrid) g.getCache( IEnergyGrid.class ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
else
|
||||
monitor = null;
|
||||
this.monitor = null;
|
||||
|
||||
canAccessViewCells = false;
|
||||
this.canAccessViewCells = false;
|
||||
if ( monitorable instanceof IViewCellStorage )
|
||||
{
|
||||
for (int y = 0; y < 5; y++)
|
||||
{
|
||||
cellView[y] = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.VIEW_CELL, ((IViewCellStorage) monitorable).getViewCellStorage(), y, 206, y * 18 + 8,
|
||||
invPlayer );
|
||||
cellView[y].allowEdit = canAccessViewCells;
|
||||
addSlotToContainer( cellView[y] );
|
||||
this.cellView[y] = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.VIEW_CELL, ((IViewCellStorage) monitorable).getViewCellStorage(), y, 206, y * 18 + 8,
|
||||
this.invPlayer );
|
||||
this.cellView[y].allowEdit = this.canAccessViewCells;
|
||||
this.addSlotToContainer( this.cellView[y] );
|
||||
}
|
||||
}
|
||||
|
||||
if ( bindInventory )
|
||||
bindPlayerInventory( ip, 0, 0 );
|
||||
this.bindPlayerInventory( ip, 0, 0 );
|
||||
}
|
||||
|
||||
public ContainerMEMonitorable(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
@@ -159,17 +159,17 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
if ( monitor != host.getItemInventory() )
|
||||
isContainerValid = false;
|
||||
if ( this.monitor != this.host.getItemInventory() )
|
||||
this.isContainerValid = false;
|
||||
|
||||
for (Enum set : serverCM.getSettings())
|
||||
for (Enum set : this.serverCM.getSettings())
|
||||
{
|
||||
Enum sideLocal = serverCM.getSetting( set );
|
||||
Enum sideRemote = clientCM.getSetting( set );
|
||||
Enum sideLocal = this.serverCM.getSetting( set );
|
||||
Enum sideRemote = this.clientCM.getSetting( set );
|
||||
|
||||
if ( sideLocal != sideRemote )
|
||||
{
|
||||
clientCM.putSetting( set, sideLocal );
|
||||
this.clientCM.putSetting( set, sideLocal );
|
||||
for (Object crafter : this.crafters)
|
||||
{
|
||||
try
|
||||
@@ -184,15 +184,15 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
}
|
||||
}
|
||||
|
||||
if ( !items.isEmpty() )
|
||||
if ( !this.items.isEmpty() )
|
||||
{
|
||||
try
|
||||
{
|
||||
IItemList<IAEItemStack> monitorCache = monitor.getStorageList();
|
||||
IItemList<IAEItemStack> monitorCache = this.monitor.getStorageList();
|
||||
|
||||
PacketMEInventoryUpdate piu = new PacketMEInventoryUpdate();
|
||||
|
||||
for (IAEItemStack is : items)
|
||||
for (IAEItemStack is : this.items)
|
||||
{
|
||||
IAEItemStack send = monitorCache.findPrecise( is );
|
||||
if ( send == null )
|
||||
@@ -206,7 +206,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
|
||||
if ( !piu.isEmpty() )
|
||||
{
|
||||
items.resetStatus();
|
||||
this.items.resetStatus();
|
||||
|
||||
for (Object c : this.crafters)
|
||||
{
|
||||
@@ -221,16 +221,16 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
}
|
||||
}
|
||||
|
||||
updatePowerStatus();
|
||||
this.updatePowerStatus();
|
||||
|
||||
boolean oldCanAccessViewCells = canAccessViewCells;
|
||||
canAccessViewCells = hasAccess( SecurityPermissions.BUILD, false );
|
||||
if ( canAccessViewCells != oldCanAccessViewCells )
|
||||
boolean oldCanAccessViewCells = this.canAccessViewCells;
|
||||
this.canAccessViewCells = this.hasAccess( SecurityPermissions.BUILD, false );
|
||||
if ( this.canAccessViewCells != oldCanAccessViewCells )
|
||||
{
|
||||
for (int y = 0; y < 5; y++)
|
||||
{
|
||||
if ( cellView[y] != null )
|
||||
cellView[y].allowEdit = canAccessViewCells;
|
||||
if ( this.cellView[y] != null )
|
||||
this.cellView[y].allowEdit = this.canAccessViewCells;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,12 +242,12 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
{
|
||||
try
|
||||
{
|
||||
if ( networkNode != null )
|
||||
hasPower = networkNode.isActive();
|
||||
else if ( powerSrc instanceof IEnergyGrid )
|
||||
hasPower = ((IEnergyGrid) powerSrc).isNetworkPowered();
|
||||
if ( this.networkNode != null )
|
||||
this.hasPower = this.networkNode.isActive();
|
||||
else if ( this.powerSrc instanceof IEnergyGrid )
|
||||
this.hasPower = ((IEnergyGrid) this.powerSrc).isNetworkPowered();
|
||||
else
|
||||
hasPower = powerSrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8;
|
||||
this.hasPower = this.powerSrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8;
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
@@ -259,17 +259,17 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
public void addCraftingToCrafters(ICrafting c)
|
||||
{
|
||||
super.addCraftingToCrafters( c );
|
||||
queueInventory( c );
|
||||
this.queueInventory( c );
|
||||
}
|
||||
|
||||
public void queueInventory(ICrafting c)
|
||||
{
|
||||
if ( Platform.isServer() && c instanceof EntityPlayer && monitor != null )
|
||||
if ( Platform.isServer() && c instanceof EntityPlayer && this.monitor != null )
|
||||
{
|
||||
try
|
||||
{
|
||||
PacketMEInventoryUpdate piu = new PacketMEInventoryUpdate();
|
||||
IItemList<IAEItemStack> monitorCache = monitor.getStorageList();
|
||||
IItemList<IAEItemStack> monitorCache = this.monitor.getStorageList();
|
||||
|
||||
for (IAEItemStack send : monitorCache)
|
||||
{
|
||||
@@ -304,7 +304,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
if ( c instanceof ICrafting )
|
||||
{
|
||||
ICrafting cr = (ICrafting) c;
|
||||
queueInventory( cr );
|
||||
this.queueInventory( cr );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,8 +315,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
if ( field.equals( "canAccessViewCells" ) )
|
||||
{
|
||||
for (int y = 0; y < 5; y++)
|
||||
if ( cellView[y] != null )
|
||||
cellView[y].allowEdit = canAccessViewCells;
|
||||
if ( this.cellView[y] != null )
|
||||
this.cellView[y].allowEdit = this.canAccessViewCells;
|
||||
}
|
||||
|
||||
super.onUpdate( field, oldValue, newValue );
|
||||
@@ -326,8 +326,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
public void onContainerClosed(EntityPlayer player)
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
if ( monitor != null )
|
||||
monitor.removeListener( this );
|
||||
if ( this.monitor != null )
|
||||
this.monitor.removeListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -335,15 +335,15 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
{
|
||||
super.removeCraftingFromCrafters( c );
|
||||
|
||||
if ( this.crafters.isEmpty() && monitor != null )
|
||||
monitor.removeListener( this );
|
||||
if ( this.crafters.isEmpty() && this.monitor != null )
|
||||
this.monitor.removeListener( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postChange(IBaseMonitor<IAEItemStack> monitor, Iterable<IAEItemStack> change, BaseActionSource source)
|
||||
{
|
||||
for (IAEItemStack is : change)
|
||||
items.add( is );
|
||||
this.items.add( is );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -355,24 +355,24 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
@Override
|
||||
public void updateSetting(IConfigManager manager, Enum settingName, Enum newValue)
|
||||
{
|
||||
if ( gui != null )
|
||||
gui.updateSetting( manager, settingName, newValue );
|
||||
if ( this.gui != null )
|
||||
this.gui.updateSetting( manager, settingName, newValue );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IConfigManager getConfigManager()
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
return serverCM;
|
||||
return clientCM;
|
||||
return this.serverCM;
|
||||
return this.clientCM;
|
||||
}
|
||||
|
||||
public ItemStack[] getViewCells()
|
||||
{
|
||||
ItemStack[] list = new ItemStack[cellView.length];
|
||||
ItemStack[] list = new ItemStack[this.cellView.length];
|
||||
|
||||
for (int x = 0; x < cellView.length; x++)
|
||||
list[x] = cellView[x].getStack();
|
||||
for (int x = 0; x < this.cellView.length; x++)
|
||||
list[x] = this.cellView[x].getStack();
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -33,9 +33,9 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
|
||||
public ContainerMEPortableCell(InventoryPlayer ip, IPortableCell monitorable) {
|
||||
super( ip, monitorable, false );
|
||||
lockPlayerInventorySlot( ip.currentItem );
|
||||
civ = monitorable;
|
||||
bindPlayerInventory( ip, 0, 0 );
|
||||
this.lockPlayerInventorySlot( ip.currentItem );
|
||||
this.civ = monitorable;
|
||||
this.bindPlayerInventory( ip, 0, 0 );
|
||||
}
|
||||
|
||||
int ticks = 0;
|
||||
@@ -43,32 +43,32 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack currentItem = getPlayerInv().getCurrentItem();
|
||||
ItemStack currentItem = this.getPlayerInv().getCurrentItem();
|
||||
|
||||
if ( civ != null )
|
||||
if ( this.civ != null )
|
||||
{
|
||||
if ( currentItem != civ.getItemStack() )
|
||||
if ( currentItem != this.civ.getItemStack() )
|
||||
{
|
||||
if ( currentItem != null )
|
||||
{
|
||||
if ( Platform.isSameItem( civ.getItemStack(), currentItem ) )
|
||||
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, civ.getItemStack() );
|
||||
if ( Platform.isSameItem( this.civ.getItemStack(), currentItem ) )
|
||||
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.civ.getItemStack() );
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
|
||||
// drain 1 ae t
|
||||
ticks++;
|
||||
if ( ticks > 10 )
|
||||
this.ticks++;
|
||||
if ( this.ticks > 10 )
|
||||
{
|
||||
civ.extractAEPower( powerMultiplier * ticks, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
ticks = 0;
|
||||
this.civ.extractAEPower( this.powerMultiplier * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
this.ticks = 0;
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@@ -52,22 +52,22 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
|
||||
if ( host != null )
|
||||
{
|
||||
findNode( host, ForgeDirection.UNKNOWN );
|
||||
this.findNode( host, ForgeDirection.UNKNOWN );
|
||||
for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS)
|
||||
findNode( host, d );
|
||||
this.findNode( host, d );
|
||||
}
|
||||
|
||||
if ( network == null && Platform.isServer() )
|
||||
isContainerValid = false;
|
||||
if ( this.network == null && Platform.isServer() )
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
|
||||
private void findNode(IGridHost host, ForgeDirection d)
|
||||
{
|
||||
if ( network == null )
|
||||
if ( this.network == null )
|
||||
{
|
||||
IGridNode node = host.getGridNode( d );
|
||||
if ( node != null )
|
||||
network = node.getGrid();
|
||||
this.network = node.getGrid();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,18 +85,18 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
delay++;
|
||||
if ( Platform.isServer() && delay > 15 && network != null )
|
||||
this.delay++;
|
||||
if ( Platform.isServer() && this.delay > 15 && this.network != null )
|
||||
{
|
||||
delay = 0;
|
||||
this.delay = 0;
|
||||
|
||||
IEnergyGrid eg = network.getCache( IEnergyGrid.class );
|
||||
IEnergyGrid eg = this.network.getCache( IEnergyGrid.class );
|
||||
if ( eg != null )
|
||||
{
|
||||
avgAddition = (long) (100.0 * eg.getAvgPowerInjection());
|
||||
powerUsage = (long) (100.0 * eg.getAvgPowerUsage());
|
||||
currentPower = (long) (100.0 * eg.getStoredPower());
|
||||
maxPower = (long) (100.0 * eg.getMaxStoredPower());
|
||||
this.avgAddition = (long) (100.0 * eg.getAvgPowerInjection());
|
||||
this.powerUsage = (long) (100.0 * eg.getAvgPowerUsage());
|
||||
this.currentPower = (long) (100.0 * eg.getStoredPower());
|
||||
this.maxPower = (long) (100.0 * eg.getMaxStoredPower());
|
||||
}
|
||||
|
||||
PacketMEInventoryUpdate piu;
|
||||
@@ -104,10 +104,10 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
{
|
||||
piu = new PacketMEInventoryUpdate();
|
||||
|
||||
for (Class<? extends IGridHost> machineClass : network.getMachinesClasses())
|
||||
for (Class<? extends IGridHost> machineClass : this.network.getMachinesClasses())
|
||||
{
|
||||
IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
|
||||
for (IGridNode machine : network.getMachines( machineClass ))
|
||||
for (IGridNode machine : this.network.getMachines( machineClass ))
|
||||
{
|
||||
IGridBlock blk = machine.getGridBlock();
|
||||
ItemStack is = blk.getMachineRepresentation();
|
||||
|
||||
@@ -37,20 +37,20 @@ public class ContainerNetworkTool extends AEBaseContainer
|
||||
|
||||
public ContainerNetworkTool(InventoryPlayer ip, INetworkTool te) {
|
||||
super( ip, null, null );
|
||||
toolInv = te;
|
||||
this.toolInv = te;
|
||||
|
||||
lockPlayerInventorySlot( ip.currentItem );
|
||||
this.lockPlayerInventorySlot( ip.currentItem );
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 3; x++)
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, te, y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, invPlayer )) );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, te, y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, this.invPlayer )) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
public void toggleFacadeMode()
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( toolInv.getItemStack() );
|
||||
NBTTagCompound data = Platform.openNbtData( this.toolInv.getItemStack() );
|
||||
data.setBoolean( "hideFacades", !data.getBoolean( "hideFacades" ) );
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
@@ -58,27 +58,27 @@ public class ContainerNetworkTool extends AEBaseContainer
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack currentItem = getPlayerInv().getCurrentItem();
|
||||
ItemStack currentItem = this.getPlayerInv().getCurrentItem();
|
||||
|
||||
if ( currentItem != toolInv.getItemStack() )
|
||||
if ( currentItem != this.toolInv.getItemStack() )
|
||||
{
|
||||
if ( currentItem != null )
|
||||
{
|
||||
if ( Platform.isSameItem( toolInv.getItemStack(), currentItem ) )
|
||||
if ( Platform.isSameItem( this.toolInv.getItemStack(), currentItem ) )
|
||||
{
|
||||
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, toolInv.getItemStack() );
|
||||
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
|
||||
}
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
|
||||
if ( isContainerValid )
|
||||
if ( this.isContainerValid )
|
||||
{
|
||||
NBTTagCompound data = Platform.openNbtData( currentItem );
|
||||
facadeMode = data.getBoolean( "hideFacades" );
|
||||
this.facadeMode = data.getBoolean( "hideFacades" );
|
||||
}
|
||||
|
||||
super.detectAndSendChanges();
|
||||
|
||||
@@ -82,50 +82,50 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
public ContainerPatternTerm(InventoryPlayer ip, ITerminalHost monitorable)
|
||||
{
|
||||
super( ip, monitorable, false );
|
||||
ct = (PartPatternTerminal) monitorable;
|
||||
this.ct = (PartPatternTerminal) monitorable;
|
||||
|
||||
IInventory patternInv = ct.getInventoryByName( "pattern" );
|
||||
IInventory output = ct.getInventoryByName( "output" );
|
||||
crafting = ct.getInventoryByName( "crafting" );
|
||||
IInventory patternInv = this.ct.getInventoryByName( "pattern" );
|
||||
IInventory output = this.ct.getInventoryByName( "output" );
|
||||
this.crafting = this.ct.getInventoryByName( "crafting" );
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 3; x++)
|
||||
addSlotToContainer( craftingSlots[x + y * 3] = new SlotFakeCraftingMatrix( crafting, x + y * 3, 18 + x * 18, -76 + y * 18 ) );
|
||||
this.addSlotToContainer( this.craftingSlots[x + y * 3] = new SlotFakeCraftingMatrix( this.crafting, x + y * 3, 18 + x * 18, -76 + y * 18 ) );
|
||||
|
||||
addSlotToContainer( craftSlot = new SlotPatternTerm( ip.player, mySrc, powerSrc, monitorable, crafting, patternInv, cOut, 110, -76 + 18, this, 2, this ) );
|
||||
craftSlot.IIcon = -1;
|
||||
this.addSlotToContainer( this.craftSlot = new SlotPatternTerm( ip.player, this.mySrc, this.powerSrc, monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this ) );
|
||||
this.craftSlot.IIcon = -1;
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
{
|
||||
addSlotToContainer( outputSlots[y] = new SlotPatternOutputs( output, this, y, 110, -76 + y * 18, 0, 0, 1 ) );
|
||||
outputSlots[y].renderDisabled = false;
|
||||
outputSlots[y].IIcon = -1;
|
||||
this.addSlotToContainer( this.outputSlots[y] = new SlotPatternOutputs( output, this, y, 110, -76 + y * 18, 0, 0, 1 ) );
|
||||
this.outputSlots[y].renderDisabled = false;
|
||||
this.outputSlots[y].IIcon = -1;
|
||||
}
|
||||
|
||||
addSlotToContainer( patternSlotIN = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, invPlayer ) );
|
||||
addSlotToContainer( patternSlotOUT = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34, invPlayer ) );
|
||||
this.addSlotToContainer( this.patternSlotIN = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, this.invPlayer ) );
|
||||
this.addSlotToContainer( this.patternSlotOUT = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34, this.invPlayer ) );
|
||||
|
||||
patternSlotOUT.setStackLimit( 1 );
|
||||
this.patternSlotOUT.setStackLimit( 1 );
|
||||
|
||||
bindPlayerInventory( ip, 0, 0 );
|
||||
updateOrderOfOutputSlots();
|
||||
this.bindPlayerInventory( ip, 0, 0 );
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
|
||||
private void updateOrderOfOutputSlots()
|
||||
{
|
||||
if ( !craftingMode )
|
||||
if ( !this.craftingMode )
|
||||
{
|
||||
craftSlot.xDisplayPosition = -9000;
|
||||
this.craftSlot.xDisplayPosition = -9000;
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
outputSlots[y].xDisplayPosition = outputSlots[y].defX;
|
||||
this.outputSlots[y].xDisplayPosition = this.outputSlots[y].defX;
|
||||
}
|
||||
else
|
||||
{
|
||||
craftSlot.xDisplayPosition = craftSlot.defX;
|
||||
this.craftSlot.xDisplayPosition = this.craftSlot.defX;
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
outputSlots[y].xDisplayPosition = -9000;
|
||||
this.outputSlots[y].xDisplayPosition = -9000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,24 +133,24 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
public void putStackInSlot(int par1, ItemStack par2ItemStack)
|
||||
{
|
||||
super.putStackInSlot( par1, par2ItemStack );
|
||||
getAndUpdateOutput();
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putStacksInSlots(ItemStack[] par1ArrayOfItemStack)
|
||||
{
|
||||
super.putStacksInSlots( par1ArrayOfItemStack );
|
||||
getAndUpdateOutput();
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
public ItemStack getAndUpdateOutput()
|
||||
{
|
||||
InventoryCrafting ic = new InventoryCrafting( this, 3, 3 );
|
||||
for (int x = 0; x < ic.getSizeInventory(); x++)
|
||||
ic.setInventorySlotContents( x, crafting.getStackInSlot( x ) );
|
||||
ic.setInventorySlotContents( x, this.crafting.getStackInSlot( x ) );
|
||||
|
||||
ItemStack is = CraftingManager.getInstance().findMatchingRecipe( ic, this.getPlayerInv().player.worldObj );
|
||||
cOut.setInventorySlotContents( 0, is );
|
||||
this.cOut.setInventorySlotContents( 0, is );
|
||||
return is;
|
||||
}
|
||||
|
||||
@@ -163,10 +163,10 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
super.detectAndSendChanges();
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
if ( craftingMode != ct.isCraftingRecipe() )
|
||||
if ( this.craftingMode != this.ct.isCraftingRecipe() )
|
||||
{
|
||||
craftingMode = ct.isCraftingRecipe();
|
||||
updateOrderOfOutputSlots();
|
||||
this.craftingMode = this.ct.isCraftingRecipe();
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -178,8 +178,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
if ( field.equals( "craftingMode" ) )
|
||||
{
|
||||
getAndUpdateOutput();
|
||||
updateOrderOfOutputSlots();
|
||||
this.getAndUpdateOutput();
|
||||
this.updateOrderOfOutputSlots();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,33 +191,33 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
public void encode()
|
||||
{
|
||||
ItemStack output = patternSlotOUT.getStack();
|
||||
ItemStack output = this.patternSlotOUT.getStack();
|
||||
|
||||
ItemStack[] in = getInputs();
|
||||
ItemStack[] out = getOutputs();
|
||||
ItemStack[] in = this.getInputs();
|
||||
ItemStack[] out = this.getOutputs();
|
||||
|
||||
// if there is no input, this would be silly.
|
||||
if ( in == null || out == null )
|
||||
return;
|
||||
|
||||
// first check the output slots, should either be null, or a pattern
|
||||
if ( output != null && !isPattern( output ) )
|
||||
if ( output != null && !this.isPattern( output ) )
|
||||
return;
|
||||
|
||||
// if nothing is there we should snag a new pattern.
|
||||
else if ( output == null )
|
||||
{
|
||||
output = patternSlotIN.getStack();
|
||||
if ( output == null || !isPattern( output ) )
|
||||
output = this.patternSlotIN.getStack();
|
||||
if ( output == null || !this.isPattern( output ) )
|
||||
return; // no blanks.
|
||||
|
||||
// remove one, and clear the input slot.
|
||||
output.stackSize--;
|
||||
if ( output.stackSize == 0 )
|
||||
patternSlotIN.putStack( null );
|
||||
this.patternSlotIN.putStack( null );
|
||||
|
||||
// add a new encoded pattern.
|
||||
patternSlotOUT.putStack( output = AEApi.instance().items().itemEncodedPattern.stack( 1 ) );
|
||||
this.patternSlotOUT.putStack( output = AEApi.instance().items().itemEncodedPattern.stack( 1 ) );
|
||||
}
|
||||
|
||||
// encode the slot.
|
||||
@@ -227,14 +227,14 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
NBTTagList tagOut = new NBTTagList();
|
||||
|
||||
for (ItemStack i : in)
|
||||
tagIn.appendTag( createItemTag( i ) );
|
||||
tagIn.appendTag( this.createItemTag( i ) );
|
||||
|
||||
for (ItemStack i : out)
|
||||
tagOut.appendTag( createItemTag( i ) );
|
||||
tagOut.appendTag( this.createItemTag( i ) );
|
||||
|
||||
encodedValue.setTag( "in", tagIn );
|
||||
encodedValue.setTag( "out", tagOut );
|
||||
encodedValue.setBoolean( "crafting", craftingMode );
|
||||
encodedValue.setBoolean( "crafting", this.craftingMode );
|
||||
|
||||
output.setTagCompound( encodedValue );
|
||||
}
|
||||
@@ -254,9 +254,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
ItemStack[] input = new ItemStack[9];
|
||||
boolean hasValue = false;
|
||||
|
||||
for (int x = 0; x < craftingSlots.length; x++)
|
||||
for (int x = 0; x < this.craftingSlots.length; x++)
|
||||
{
|
||||
input[x] = craftingSlots[x].getStack();
|
||||
input[x] = this.craftingSlots[x].getStack();
|
||||
if ( input[x] != null )
|
||||
hasValue = true;
|
||||
}
|
||||
@@ -269,9 +269,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
private ItemStack[] getOutputs()
|
||||
{
|
||||
if ( craftingMode )
|
||||
if ( this.craftingMode )
|
||||
{
|
||||
ItemStack out = getAndUpdateOutput();
|
||||
ItemStack out = this.getAndUpdateOutput();
|
||||
if ( out != null && out.stackSize > 0 )
|
||||
return new ItemStack[] { out };
|
||||
}
|
||||
@@ -280,7 +280,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
List<ItemStack> list = new ArrayList<ItemStack>( 3 );
|
||||
boolean hasValue = false;
|
||||
|
||||
for (OptionalSlotFake outputSlot : outputSlots)
|
||||
for (OptionalSlotFake outputSlot : this.outputSlots)
|
||||
{
|
||||
ItemStack out = outputSlot.getStack();
|
||||
if ( out != null && out.stackSize > 0 )
|
||||
@@ -309,9 +309,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
public boolean isSlotEnabled(int idx)
|
||||
{
|
||||
if ( idx == 1 )
|
||||
return Platform.isServer() ? !ct.isCraftingRecipe() : !craftingMode;
|
||||
return Platform.isServer() ? !this.ct.isCraftingRecipe() : !this.craftingMode;
|
||||
else if ( idx == 2 )
|
||||
return Platform.isServer() ? ct.isCraftingRecipe() : craftingMode;
|
||||
return Platform.isServer() ? this.ct.isCraftingRecipe() : this.craftingMode;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
@@ -324,27 +324,27 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
public void craftOrGetItem(PacketPatternSlot packetPatternSlot)
|
||||
{
|
||||
if ( packetPatternSlot.slotItem != null && cellInv != null )
|
||||
if ( packetPatternSlot.slotItem != null && this.cellInv != null )
|
||||
{
|
||||
IAEItemStack out = packetPatternSlot.slotItem.copy();
|
||||
|
||||
InventoryAdaptor inv = new AdaptorPlayerHand( getPlayerInv().player );
|
||||
InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor( getPlayerInv().player, ForgeDirection.UNKNOWN );
|
||||
InventoryAdaptor inv = new AdaptorPlayerHand( this.getPlayerInv().player );
|
||||
InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor( this.getPlayerInv().player, ForgeDirection.UNKNOWN );
|
||||
if ( packetPatternSlot.shift )
|
||||
inv = playerInv;
|
||||
|
||||
if ( inv.simulateAdd( out.getItemStack() ) != null )
|
||||
return;
|
||||
|
||||
IAEItemStack extracted = Platform.poweredExtraction( powerSrc, cellInv, out, mySrc );
|
||||
EntityPlayer p = getPlayerInv().player;
|
||||
IAEItemStack extracted = Platform.poweredExtraction( this.powerSrc, this.cellInv, out, this.mySrc );
|
||||
EntityPlayer p = this.getPlayerInv().player;
|
||||
|
||||
if ( extracted != null )
|
||||
{
|
||||
inv.addItems( extracted.getItemStack() );
|
||||
if ( p instanceof EntityPlayerMP )
|
||||
updateHeld( (EntityPlayerMP) p );
|
||||
detectAndSendChanges();
|
||||
this.updateHeld( (EntityPlayerMP) p );
|
||||
this.detectAndSendChanges();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -360,7 +360,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
if ( r == null )
|
||||
return;
|
||||
|
||||
IMEMonitor<IAEItemStack> storage = ct.getItemInventory();
|
||||
IMEMonitor<IAEItemStack> storage = this.ct.getItemInventory();
|
||||
IItemList<IAEItemStack> all = storage.getStorageList();
|
||||
|
||||
ItemStack is = r.getCraftingResult( ic );
|
||||
@@ -369,8 +369,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
{
|
||||
if ( ic.getStackInSlot( x ) != null )
|
||||
{
|
||||
ItemStack pulled = Platform.extractItemsByRecipe( powerSrc, mySrc, storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all,
|
||||
Actionable.MODULATE, ItemViewCell.createFilter( getViewCells() ) );
|
||||
ItemStack pulled = Platform.extractItemsByRecipe( this.powerSrc, this.mySrc, storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all,
|
||||
Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) );
|
||||
real.setInventorySlotContents( x, pulled );
|
||||
}
|
||||
}
|
||||
@@ -379,7 +379,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
if ( rr == r && Platform.isSameItemPrecise( rr.getCraftingResult( real ), is ) )
|
||||
{
|
||||
SlotCrafting sc = new SlotCrafting( p, real, cOut, 0, 0, 0 );
|
||||
SlotCrafting sc = new SlotCrafting( p, real, this.cOut, 0, 0, 0 );
|
||||
sc.onPickupFromSlot( p, is );
|
||||
|
||||
for (int x = 0; x < real.getSizeInventory(); x++)
|
||||
@@ -391,8 +391,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
inv.addItems( is );
|
||||
if ( p instanceof EntityPlayerMP )
|
||||
updateHeld( (EntityPlayerMP) p );
|
||||
detectAndSendChanges();
|
||||
this.updateHeld( (EntityPlayerMP) p );
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -401,7 +401,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
ItemStack failed = real.getStackInSlot( x );
|
||||
if ( failed != null )
|
||||
{
|
||||
cellInv.injectItems( AEItemStack.create( failed ), Actionable.MODULATE, new MachineSource( ct ) );
|
||||
this.cellInv.injectItems( AEItemStack.create( failed ), Actionable.MODULATE, new MachineSource( this.ct ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -412,13 +412,13 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
@Override
|
||||
public void onSlotChange(Slot s)
|
||||
{
|
||||
if ( s == patternSlotOUT && Platform.isServer() )
|
||||
if ( s == this.patternSlotOUT && Platform.isServer() )
|
||||
{
|
||||
for (Object crafter : this.crafters)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) crafter;
|
||||
|
||||
for (Object g : inventorySlots)
|
||||
for (Object g : this.inventorySlots)
|
||||
{
|
||||
if ( g instanceof OptionalSlotFake || g instanceof SlotFakeCraftingMatrix )
|
||||
{
|
||||
@@ -428,20 +428,20 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
}
|
||||
((EntityPlayerMP) icrafting).isChangingQuantityOnly = false;
|
||||
}
|
||||
detectAndSendChanges();
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
for (Slot s : craftingSlots)
|
||||
for (Slot s : this.craftingSlots)
|
||||
s.putStack( null );
|
||||
|
||||
for (Slot s : outputSlots)
|
||||
for (Slot s : this.outputSlots)
|
||||
s.putStack( null );
|
||||
|
||||
detectAndSendChanges();
|
||||
getAndUpdateOutput();
|
||||
this.detectAndSendChanges();
|
||||
this.getAndUpdateOutput();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -449,9 +449,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
{
|
||||
if (name.equals("player"))
|
||||
{
|
||||
return invPlayer;
|
||||
return this.invPlayer;
|
||||
}
|
||||
return ct.getInventoryByName( name );
|
||||
return this.ct.getInventoryByName( name );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,13 +45,13 @@ public class ContainerPriority extends AEBaseContainer
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void setTextField(GuiTextField level)
|
||||
{
|
||||
textField = level;
|
||||
textField.setText( String.valueOf( PriorityValue ) );
|
||||
this.textField = level;
|
||||
this.textField.setText( String.valueOf( this.PriorityValue ) );
|
||||
}
|
||||
|
||||
public ContainerPriority(InventoryPlayer ip, IPriorityHost te) {
|
||||
super( ip, (TileEntity) (te instanceof TileEntity ? te : null), (IPart) (te instanceof IPart ? te : null) );
|
||||
priHost = te;
|
||||
this.priHost = te;
|
||||
}
|
||||
|
||||
@GuiSync(2)
|
||||
@@ -59,19 +59,19 @@ public class ContainerPriority extends AEBaseContainer
|
||||
|
||||
public void setPriority(int newValue, EntityPlayer player)
|
||||
{
|
||||
priHost.setPriority( newValue );
|
||||
PriorityValue = newValue;
|
||||
this.priHost.setPriority( newValue );
|
||||
this.PriorityValue = newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
this.PriorityValue = priHost.getPriority();
|
||||
this.PriorityValue = this.priHost.getPriority();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,8 +80,8 @@ public class ContainerPriority extends AEBaseContainer
|
||||
{
|
||||
if ( field.equals( "PriorityValue" ) )
|
||||
{
|
||||
if ( textField != null )
|
||||
textField.setText( String.valueOf( PriorityValue ) );
|
||||
if ( this.textField != null )
|
||||
this.textField.setText( String.valueOf( this.PriorityValue ) );
|
||||
}
|
||||
|
||||
super.onUpdate( field, oldValue, newValue );
|
||||
|
||||
@@ -32,9 +32,9 @@ public class ContainerQNB extends AEBaseContainer
|
||||
super( ip, quantumBridge, null );
|
||||
this.quantumBridge = quantumBridge;
|
||||
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge, 0, 80, 37, invPlayer )).setStackLimit( 1 ) );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge, 0, 80, 37, this.invPlayer )).setStackLimit( 1 ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,37 +47,37 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
|
||||
public void setName(String value)
|
||||
{
|
||||
myName = value;
|
||||
this.myName = value;
|
||||
}
|
||||
|
||||
public ContainerQuartzKnife(InventoryPlayer ip, QuartzKnifeObj te) {
|
||||
super( ip, null, null );
|
||||
toolInv = te;
|
||||
this.toolInv = te;
|
||||
|
||||
addSlotToContainer( metals = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.METAL_INGOTS, inSlot, 0, 94, 44, ip ) );
|
||||
addSlotToContainer( output = new QuartzKnifeOutput( this, 0, 134, 44, -1 ) );
|
||||
this.addSlotToContainer( this.metals = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.METAL_INGOTS, this.inSlot, 0, 94, 44, ip ) );
|
||||
this.addSlotToContainer( this.output = new QuartzKnifeOutput( this, 0, 134, 44, -1 ) );
|
||||
|
||||
lockPlayerInventorySlot( ip.currentItem );
|
||||
this.lockPlayerInventorySlot( ip.currentItem );
|
||||
|
||||
bindPlayerInventory( ip, 0, 184 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 184 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack currentItem = getPlayerInv().getCurrentItem();
|
||||
ItemStack currentItem = this.getPlayerInv().getCurrentItem();
|
||||
|
||||
if ( currentItem != toolInv.getItemStack() )
|
||||
if ( currentItem != this.toolInv.getItemStack() )
|
||||
{
|
||||
if ( currentItem != null )
|
||||
{
|
||||
if ( Platform.isSameItem( toolInv.getItemStack(), currentItem ) )
|
||||
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, toolInv.getItemStack() );
|
||||
if ( Platform.isSameItem( this.toolInv.getItemStack(), currentItem ) )
|
||||
this.getPlayerInv().setInventorySlotContents( this.getPlayerInv().currentItem, this.toolInv.getItemStack() );
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
|
||||
super.detectAndSendChanges();
|
||||
@@ -86,8 +86,8 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
if ( inSlot.getStackInSlot( 0 ) != null )
|
||||
par1EntityPlayer.dropPlayerItemWithRandomChoice( inSlot.getStackInSlot( 0 ), false );
|
||||
if ( this.inSlot.getStackInSlot( 0 ) != null )
|
||||
par1EntityPlayer.dropPlayerItemWithRandomChoice( this.inSlot.getStackInSlot( 0 ), false );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,17 +111,17 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int var1)
|
||||
{
|
||||
ItemStack input = inSlot.getStackInSlot( 0 );
|
||||
ItemStack input = this.inSlot.getStackInSlot( 0 );
|
||||
if ( input == null )
|
||||
return null;
|
||||
|
||||
if ( SlotRestrictedInput.isMetalIngot( input ) )
|
||||
{
|
||||
if ( myName.length() > 0 )
|
||||
if ( this.myName.length() > 0 )
|
||||
{
|
||||
ItemStack name = AEApi.instance().materials().materialNamePress.stack( 1 );
|
||||
NBTTagCompound c = Platform.openNbtData( name );
|
||||
c.setString( "InscribeName", myName );
|
||||
c.setString( "InscribeName", this.myName );
|
||||
return name;
|
||||
}
|
||||
}
|
||||
@@ -132,10 +132,10 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
@Override
|
||||
public ItemStack decrStackSize(int var1, int var2)
|
||||
{
|
||||
ItemStack is = getStackInSlot( 0 );
|
||||
ItemStack is = this.getStackInSlot( 0 );
|
||||
if ( is != null )
|
||||
{
|
||||
if ( makePlate() )
|
||||
if ( this.makePlate() )
|
||||
return is;
|
||||
}
|
||||
return null;
|
||||
@@ -143,15 +143,15 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
|
||||
private boolean makePlate()
|
||||
{
|
||||
if ( inSlot.decrStackSize( 0, 1 ) != null )
|
||||
if ( this.inSlot.decrStackSize( 0, 1 ) != null )
|
||||
{
|
||||
ItemStack item = toolInv.getItemStack();
|
||||
item.damageItem( 1, getPlayerInv().player );
|
||||
ItemStack item = this.toolInv.getItemStack();
|
||||
item.damageItem( 1, this.getPlayerInv().player );
|
||||
|
||||
if ( item.stackSize == 0 )
|
||||
{
|
||||
getPlayerInv().mainInventory[getPlayerInv().currentItem] = null;
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( getPlayerInv().player, item ) );
|
||||
this.getPlayerInv().mainInventory[this.getPlayerInv().currentItem] = null;
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( this.getPlayerInv().player, item ) );
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -169,7 +169,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
|
||||
public void setInventorySlotContents(int var1, ItemStack var2)
|
||||
{
|
||||
if ( var2 == null && Platform.isServer() )
|
||||
makePlate();
|
||||
this.makePlate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -54,14 +54,14 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||
public ContainerSecurity(InventoryPlayer ip, ITerminalHost monitorable) {
|
||||
super( ip, monitorable, false );
|
||||
|
||||
securityBox = (TileSecurity) monitorable;
|
||||
this.securityBox = (TileSecurity) monitorable;
|
||||
|
||||
addSlotToContainer( configSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, securityBox.configSlot, 0, 37, -33, ip ) );
|
||||
this.addSlotToContainer( this.configSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, this.securityBox.configSlot, 0, 37, -33, ip ) );
|
||||
|
||||
addSlotToContainer( wirelessIn = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODABLE_ITEM, wirelessEncoder, 0, 212, 10, ip ) );
|
||||
addSlotToContainer( wirelessOut = new SlotOutput( wirelessEncoder, 1, 212, 68, -1 ) );
|
||||
this.addSlotToContainer( this.wirelessIn = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODABLE_ITEM, this.wirelessEncoder, 0, 212, 10, ip ) );
|
||||
this.addSlotToContainer( this.wirelessOut = new SlotOutput( this.wirelessEncoder, 1, 212, 68, -1 ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 0 );
|
||||
this.bindPlayerInventory( ip, 0, 0 );
|
||||
}
|
||||
|
||||
@GuiSync(0)
|
||||
@@ -72,11 +72,11 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||
{
|
||||
super.onContainerClosed( player );
|
||||
|
||||
if ( wirelessIn.getHasStack() )
|
||||
player.dropPlayerItemWithRandomChoice( wirelessIn.getStack(), false );
|
||||
if ( this.wirelessIn.getHasStack() )
|
||||
player.dropPlayerItemWithRandomChoice( this.wirelessIn.getStack(), false );
|
||||
|
||||
if ( wirelessOut.getHasStack() )
|
||||
player.dropPlayerItemWithRandomChoice( wirelessOut.getStack(), false );
|
||||
if ( this.wirelessOut.getHasStack() )
|
||||
player.dropPlayerItemWithRandomChoice( this.wirelessOut.getStack(), false );
|
||||
}
|
||||
|
||||
public void toggleSetting(String value, EntityPlayer player)
|
||||
@@ -85,7 +85,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||
{
|
||||
SecurityPermissions permission = SecurityPermissions.valueOf( value );
|
||||
|
||||
ItemStack a = configSlot.getStack();
|
||||
ItemStack a = this.configSlot.getStack();
|
||||
if ( a != null && a.getItem() instanceof IBiometricCard )
|
||||
{
|
||||
IBiometricCard bc = (IBiometricCard) a.getItem();
|
||||
@@ -104,20 +104,20 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.SECURITY, false );
|
||||
this.verifyPermissions( SecurityPermissions.SECURITY, false );
|
||||
|
||||
security = 0;
|
||||
this.security = 0;
|
||||
|
||||
ItemStack a = configSlot.getStack();
|
||||
ItemStack a = this.configSlot.getStack();
|
||||
if ( a != null && a.getItem() instanceof IBiometricCard )
|
||||
{
|
||||
IBiometricCard bc = (IBiometricCard) a.getItem();
|
||||
|
||||
for (SecurityPermissions sp : bc.getPermissions( a ))
|
||||
security = security | (1 << sp.ordinal());
|
||||
this.security = this.security | (1 << sp.ordinal());
|
||||
}
|
||||
|
||||
updatePowerStatus();
|
||||
this.updatePowerStatus();
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
@@ -131,11 +131,11 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||
@Override
|
||||
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack)
|
||||
{
|
||||
if ( !wirelessOut.getHasStack() )
|
||||
if ( !this.wirelessOut.getHasStack() )
|
||||
{
|
||||
if ( wirelessIn.getHasStack() )
|
||||
if ( this.wirelessIn.getHasStack() )
|
||||
{
|
||||
ItemStack term = wirelessIn.getStack().copy();
|
||||
ItemStack term = this.wirelessIn.getStack().copy();
|
||||
INetworkEncodable networkEncodable = null;
|
||||
|
||||
if ( term.getItem() instanceof INetworkEncodable )
|
||||
@@ -147,17 +147,17 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
|
||||
|
||||
if ( networkEncodable != null )
|
||||
{
|
||||
networkEncodable.setEncryptionKey( term, String.valueOf( securityBox.securityKey ), "" );
|
||||
networkEncodable.setEncryptionKey( term, String.valueOf( this.securityBox.securityKey ), "" );
|
||||
|
||||
wirelessIn.putStack( null );
|
||||
wirelessOut.putStack( term );
|
||||
this.wirelessIn.putStack( null );
|
||||
this.wirelessOut.putStack( term );
|
||||
|
||||
// update the two slots in question...
|
||||
for (Object crafter : this.crafters)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) crafter;
|
||||
icrafting.sendSlotContents( this, wirelessIn.slotNumber, wirelessIn.getStack() );
|
||||
icrafting.sendSlotContents( this, wirelessOut.slotNumber, wirelessOut.getStack() );
|
||||
icrafting.sendSlotContents( this, this.wirelessIn.slotNumber, this.wirelessIn.getStack() );
|
||||
icrafting.sendSlotContents( this, this.wirelessOut.slotNumber, this.wirelessOut.getStack() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,19 +39,19 @@ public class ContainerSkyChest extends AEBaseContainer
|
||||
{
|
||||
for (int x = 0; x < 9; x++)
|
||||
{
|
||||
addSlotToContainer( new SlotNormal( this.chest, y * 9 + x, 8 + 18 * x, 24 + 18 * y ) );
|
||||
this.addSlotToContainer( new SlotNormal( this.chest, y * 9 + x, 8 + 18 * x, 24 + 18 * y ) );
|
||||
}
|
||||
}
|
||||
|
||||
this.chest.openInventory();
|
||||
|
||||
bindPlayerInventory( ip, 0, 195 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 195 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onContainerClosed(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
super.onContainerClosed( par1EntityPlayer );
|
||||
chest.closeInventory();
|
||||
this.chest.closeInventory();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,34 +54,34 @@ public class ContainerSpatialIOPort extends AEBaseContainer
|
||||
this.spatialIOPort = spatialIOPort;
|
||||
|
||||
if ( Platform.isServer() )
|
||||
network = spatialIOPort.getGridNode( ForgeDirection.UNKNOWN ).getGrid();
|
||||
this.network = spatialIOPort.getGridNode( ForgeDirection.UNKNOWN ).getGrid();
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS, spatialIOPort, 0, 52, 48, invPlayer ) );
|
||||
addSlotToContainer( new SlotOutput( spatialIOPort, 1, 113, 48, SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS.IIcon ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS, spatialIOPort, 0, 52, 48, this.invPlayer ) );
|
||||
this.addSlotToContainer( new SlotOutput( spatialIOPort, 1, 113, 48, SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS.IIcon ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 197 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 197 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
delay++;
|
||||
if ( delay > 15 && network != null )
|
||||
this.delay++;
|
||||
if ( this.delay > 15 && this.network != null )
|
||||
{
|
||||
delay = 0;
|
||||
this.delay = 0;
|
||||
|
||||
IEnergyGrid eg = network.getCache( IEnergyGrid.class );
|
||||
ISpatialCache sc = network.getCache( ISpatialCache.class );
|
||||
IEnergyGrid eg = this.network.getCache( IEnergyGrid.class );
|
||||
ISpatialCache sc = this.network.getCache( ISpatialCache.class );
|
||||
if ( eg != null )
|
||||
{
|
||||
currentPower = (long) (100.0 * eg.getStoredPower());
|
||||
maxPower = (long) (100.0 * eg.getMaxStoredPower());
|
||||
reqPower = (long) (100.0 * sc.requiredPower());
|
||||
eff = (long) (100.0f * sc.currentEfficiency());
|
||||
this.currentPower = (long) (100.0 * eg.getStoredPower());
|
||||
this.maxPower = (long) (100.0 * eg.getMaxStoredPower());
|
||||
this.reqPower = (long) (100.0 * sc.requiredPower());
|
||||
this.eff = (long) (100.0f * sc.currentEfficiency());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
|
||||
public ContainerStorageBus(InventoryPlayer ip, PartStorageBus te) {
|
||||
super( ip, te );
|
||||
storageBus = te;
|
||||
this.storageBus = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -80,7 +80,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx)
|
||||
{
|
||||
int upgrades = upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
|
||||
return upgrades > idx;
|
||||
}
|
||||
@@ -91,30 +91,30 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
int xo = 8;
|
||||
int yo = 23 + 6;
|
||||
|
||||
IInventory config = upgradeable.getInventoryByName( "config" );
|
||||
IInventory config = this.upgradeable.getInventoryByName( "config" );
|
||||
for (int y = 0; y < 7; y++)
|
||||
{
|
||||
for (int x = 0; x < 9; x++)
|
||||
{
|
||||
if ( y < 2 )
|
||||
addSlotToContainer( new SlotFakeTypeOnly( config, y * 9 + x, xo + x * 18, yo + y * 18 ) );
|
||||
this.addSlotToContainer( new SlotFakeTypeOnly( config, y * 9 + x, xo + x * 18, yo + y * 18 ) );
|
||||
else
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( config, this, y * 9 + x, xo, yo, x, y, y - 2 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( config, this, y * 9 + x, xo, yo, x, y, y - 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, invPlayer )).setNotDraggable() );
|
||||
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer )).setNotDraggable() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.invPlayer )).setNotDraggable() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
@@ -123,22 +123,22 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
this.storageFilter = (StorageFilter) this.upgradeable.getConfigManager().getSetting( Settings.STORAGE_FILTER );
|
||||
}
|
||||
|
||||
standardDetectAndSendChanges();
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
IInventory inv = upgradeable.getInventoryByName( "config" );
|
||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
inv.setInventorySlotContents( x, null );
|
||||
detectAndSendChanges();
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
public void partition()
|
||||
{
|
||||
IInventory inv = upgradeable.getInventoryByName( "config" );
|
||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||
|
||||
IMEInventory<IAEItemStack> cellInv = storageBus.getInternalHandler();
|
||||
IMEInventory<IAEItemStack> cellInv = this.storageBus.getInternalHandler();
|
||||
|
||||
Iterator<IAEItemStack> i = new NullIterator<IAEItemStack>();
|
||||
if ( cellInv != null )
|
||||
@@ -149,7 +149,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
{
|
||||
if ( i.hasNext() && isSlotEnabled( (x / 9) - 2 ) )
|
||||
if ( i.hasNext() && this.isSlotEnabled( (x / 9) - 2 ) )
|
||||
{
|
||||
ItemStack g = i.next().getItemStack();
|
||||
g.stackSize = 1;
|
||||
@@ -159,7 +159,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
|
||||
inv.setInventorySlotContents( x, null );
|
||||
}
|
||||
|
||||
detectAndSendChanges();
|
||||
this.detectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
|
||||
public ContainerUpgradeable(InventoryPlayer ip, IUpgradeableHost te) {
|
||||
super( ip, (TileEntity) (te instanceof TileEntity ? te : null), (IPart) (te instanceof IPart ? te : null) );
|
||||
upgradeable = te;
|
||||
this.upgradeable = te;
|
||||
|
||||
World w = null;
|
||||
int xCoord = 0, yCoord = 0, zCoord = 0;
|
||||
@@ -79,65 +79,65 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
zCoord = mk.zCoord;
|
||||
}
|
||||
|
||||
IInventory pi = getPlayerInv();
|
||||
IInventory pi = this.getPlayerInv();
|
||||
for (int x = 0; x < pi.getSizeInventory(); x++)
|
||||
{
|
||||
ItemStack pii = pi.getStackInSlot( x );
|
||||
if ( pii != null && pii.getItem() instanceof ToolNetworkTool )
|
||||
{
|
||||
lockPlayerInventorySlot( x );
|
||||
tbSlot = x;
|
||||
tbInventory = (NetworkToolViewer) ((ToolNetworkTool) pii.getItem()).getGuiObject( pii, w, xCoord, yCoord, zCoord );
|
||||
this.lockPlayerInventorySlot( x );
|
||||
this.tbSlot = x;
|
||||
this.tbInventory = (NetworkToolViewer) ((ToolNetworkTool) pii.getItem()).getGuiObject( pii, w, xCoord, yCoord, zCoord );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( hasToolbox() )
|
||||
if ( this.hasToolbox() )
|
||||
{
|
||||
for (int v = 0; v < 3; v++)
|
||||
for (int u = 0; u < 3; u++)
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, tbInventory, u + v * 3, 186 + u * 18, getHeight() - 82 + v * 18,
|
||||
invPlayer )).setPlayerSide() );
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.tbInventory, u + v * 3, 186 + u * 18, this.getHeight() - 82 + v * 18,
|
||||
this.invPlayer )).setPlayerSide() );
|
||||
}
|
||||
|
||||
setupConfig();
|
||||
this.setupConfig();
|
||||
|
||||
bindPlayerInventory( ip, 0, getHeight() - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, this.getHeight() - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
protected void setupUpgrades()
|
||||
{
|
||||
IInventory upgrades = upgradeable.getInventoryByName( "upgrades" );
|
||||
if ( availableUpgrades() > 0 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, invPlayer )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 1 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, invPlayer )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 2 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 3 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() );
|
||||
IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
|
||||
if ( this.availableUpgrades() > 0 )
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer )).setNotDraggable() );
|
||||
if ( this.availableUpgrades() > 1 )
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer )).setNotDraggable() );
|
||||
if ( this.availableUpgrades() > 2 )
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer )).setNotDraggable() );
|
||||
if ( this.availableUpgrades() > 3 )
|
||||
this.addSlotToContainer( (new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer )).setNotDraggable() );
|
||||
}
|
||||
|
||||
protected void setupConfig()
|
||||
{
|
||||
int x = 80;
|
||||
int y = 40;
|
||||
setupUpgrades();
|
||||
this.setupUpgrades();
|
||||
|
||||
IInventory inv = upgradeable.getInventoryByName( "config" );
|
||||
addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
|
||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||
this.addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
|
||||
|
||||
if ( supportCapacity() )
|
||||
if ( this.supportCapacity() )
|
||||
{
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 1, x, y, -1, 0, 1 ) );
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 2, x, y, 1, 0, 1 ) );
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 3, x, y, 0, -1, 1 ) );
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 4, x, y, 0, 1, 1 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 1, x, y, -1, 0, 1 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 2, x, y, 1, 0, 1 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 3, x, y, 0, -1, 1 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 4, x, y, 0, 1, 1 ) );
|
||||
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 5, x, y, -1, -1, 2 ) );
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 6, x, y, 1, -1, 2 ) );
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 7, x, y, -1, 1, 2 ) );
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 8, x, y, 1, 1, 2 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 5, x, y, -1, -1, 2 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 6, x, y, 1, -1, 2 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 7, x, y, -1, 1, 2 ) );
|
||||
this.addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 8, x, y, 1, 1, 2 ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,21 +167,21 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
|
||||
public void checkToolbox()
|
||||
{
|
||||
if ( hasToolbox() )
|
||||
if ( this.hasToolbox() )
|
||||
{
|
||||
ItemStack currentItem = getPlayerInv().getStackInSlot( tbSlot );
|
||||
ItemStack currentItem = this.getPlayerInv().getStackInSlot( this.tbSlot );
|
||||
|
||||
if ( currentItem != tbInventory.getItemStack() )
|
||||
if ( currentItem != this.tbInventory.getItemStack() )
|
||||
{
|
||||
if ( currentItem != null )
|
||||
{
|
||||
if ( Platform.isSameItem( tbInventory.getItemStack(), currentItem ) )
|
||||
getPlayerInv().setInventorySlotContents( tbSlot, tbInventory.getItemStack() );
|
||||
if ( Platform.isSameItem( this.tbInventory.getItemStack(), currentItem ) )
|
||||
this.getPlayerInv().setInventorySlotContents( this.tbSlot, this.tbInventory.getItemStack() );
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
else
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,17 +189,17 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
this.verifyPermissions( SecurityPermissions.BUILD, false );
|
||||
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
IConfigManager cm = this.upgradeable.getConfigManager();
|
||||
loadSettingsFromHost( cm );
|
||||
this.loadSettingsFromHost( cm );
|
||||
}
|
||||
|
||||
checkToolbox();
|
||||
this.checkToolbox();
|
||||
|
||||
for (Object o : inventorySlots)
|
||||
for (Object o : this.inventorySlots)
|
||||
{
|
||||
if ( o instanceof OptionalSlotFake )
|
||||
{
|
||||
@@ -209,14 +209,14 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
}
|
||||
}
|
||||
|
||||
standardDetectAndSendChanges();
|
||||
this.standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
protected void loadSettingsFromHost(IConfigManager cm)
|
||||
{
|
||||
this.fzMode = (FuzzyMode) cm.getSetting( Settings.FUZZY_MODE );
|
||||
this.rsMode = (RedstoneMode) cm.getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
if ( upgradeable instanceof PartExportBus )
|
||||
if ( this.upgradeable instanceof PartExportBus )
|
||||
this.cMode = (YesNo) cm.getSetting( Settings.CRAFT_ONLY );
|
||||
}
|
||||
|
||||
@@ -227,13 +227,13 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
|
||||
public boolean hasToolbox()
|
||||
{
|
||||
return tbInventory != null;
|
||||
return this.tbInventory != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx)
|
||||
{
|
||||
int upgrades = upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
|
||||
if ( idx == 1 && upgrades > 0 )
|
||||
return true;
|
||||
|
||||
@@ -36,9 +36,9 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr
|
||||
super( ip, vibrationChamber, null );
|
||||
this.vibrationChamber = vibrationChamber;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber, 0, 80, 37, invPlayer ) );
|
||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber, 0, 80, 37, this.invPlayer ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
public final int aePerTick = 5;
|
||||
@@ -64,7 +64,7 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr
|
||||
@Override
|
||||
public int getCurrentProgress()
|
||||
{
|
||||
return burnProgress > 0 ? burnSpeed : 0;
|
||||
return this.burnProgress > 0 ? this.burnSpeed : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -40,20 +40,20 @@ public class ContainerWireless extends AEBaseContainer
|
||||
|
||||
public ContainerWireless(InventoryPlayer ip, TileWireless te) {
|
||||
super( ip, te, null );
|
||||
wirelessTerminal = te;
|
||||
this.wirelessTerminal = te;
|
||||
|
||||
addSlotToContainer( boosterSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.RANGE_BOOSTER, wirelessTerminal, 0, 80, 47, invPlayer ) );
|
||||
this.addSlotToContainer( this.boosterSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.RANGE_BOOSTER, this.wirelessTerminal, 0, 80, 47, this.invPlayer ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
int boosters = boosterSlot.getStack() == null ? 0 : boosterSlot.getStack().stackSize;
|
||||
int boosters = this.boosterSlot.getStack() == null ? 0 : this.boosterSlot.getStack().stackSize;
|
||||
|
||||
range = (long) (10 * AEConfig.instance.wireless_getMaxRange( boosters ));
|
||||
drain = (long) (100 * AEConfig.instance.wireless_getPowerDrain( boosters ));
|
||||
this.range = (long) (10 * AEConfig.instance.wireless_getMaxRange( boosters ));
|
||||
this.drain = (long) (100 * AEConfig.instance.wireless_getPowerDrain( boosters ));
|
||||
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
|
||||
@@ -39,16 +39,16 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell
|
||||
{
|
||||
super.detectAndSendChanges();
|
||||
|
||||
if ( !wirelessTerminalGUIObject.rangeCheck() )
|
||||
if ( !this.wirelessTerminalGUIObject.rangeCheck() )
|
||||
{
|
||||
if ( Platform.isServer() && isContainerValid )
|
||||
getPlayerInv().player.addChatMessage( PlayerMessages.OutOfRange.get() );
|
||||
if ( Platform.isServer() && this.isContainerValid )
|
||||
this.getPlayerInv().player.addChatMessage( PlayerMessages.OutOfRange.get() );
|
||||
|
||||
isContainerValid = false;
|
||||
this.isContainerValid = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
powerMultiplier = AEConfig.instance.wireless_getDrainRate( wirelessTerminalGUIObject.getRange() );
|
||||
this.powerMultiplier = AEConfig.instance.wireless_getDrainRate( this.wirelessTerminalGUIObject.getRange() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,16 +35,16 @@ public class CraftingCPURecord implements Comparable<CraftingCPURecord>
|
||||
this.size = size;
|
||||
this.processors = coProcessors;
|
||||
this.cpu = server;
|
||||
myName = server.getName();
|
||||
this.myName = server.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(CraftingCPURecord o)
|
||||
{
|
||||
int a = ItemSorters.compareLong( o.processors, processors );
|
||||
int a = ItemSorters.compareLong( o.processors, this.processors );
|
||||
if ( a != 0 )
|
||||
return a;
|
||||
return ItemSorters.compareLong( o.size, size );
|
||||
return ItemSorters.compareLong( o.size, this.size );
|
||||
}
|
||||
|
||||
}
|
||||
@@ -150,7 +150,7 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
@Override
|
||||
public void onPickupFromSlot(EntityPlayer par1EntityPlayer, ItemStack par2ItemStack)
|
||||
{
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent( par1EntityPlayer, par2ItemStack, craftMatrix );
|
||||
FMLCommonHandler.instance().firePlayerCraftingEvent( par1EntityPlayer, par2ItemStack, this.craftMatrix );
|
||||
this.onCrafting( par2ItemStack );
|
||||
|
||||
for (int i = 0; i < this.craftMatrix.getSizeInventory(); ++i)
|
||||
@@ -167,7 +167,7 @@ public class AppEngCraftingSlot extends AppEngSlot
|
||||
|
||||
if ( itemstack2 != null && itemstack2.isItemStackDamageable() && itemstack2.getItemDamage() > itemstack2.getMaxDamage() )
|
||||
{
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( thePlayer, itemstack2 ) );
|
||||
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( this.thePlayer, itemstack2 ) );
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,13 +39,13 @@ public class AppEngSlot extends Slot
|
||||
|
||||
public Slot setNotDraggable()
|
||||
{
|
||||
isDraggable = false;
|
||||
this.isDraggable = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Slot setPlayerSide()
|
||||
{
|
||||
isPlayerSide = true;
|
||||
this.isPlayerSide = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class AppEngSlot extends Slot
|
||||
@Override
|
||||
public boolean func_111238_b()
|
||||
{
|
||||
return isEnabled();
|
||||
return this.isEnabled();
|
||||
}
|
||||
|
||||
public boolean isEnabled()
|
||||
@@ -73,19 +73,19 @@ public class AppEngSlot extends Slot
|
||||
@Override
|
||||
public void onSlotChanged()
|
||||
{
|
||||
if ( inventory instanceof AppEngInternalInventory )
|
||||
((AppEngInternalInventory) inventory).markDirty( getSlotIndex() );
|
||||
if ( this.inventory instanceof AppEngInternalInventory )
|
||||
((AppEngInternalInventory) this.inventory).markDirty( this.getSlotIndex() );
|
||||
else
|
||||
super.onSlotChanged();
|
||||
|
||||
isValid = hasCalculatedValidness.NotAvailable;
|
||||
this.isValid = hasCalculatedValidness.NotAvailable;
|
||||
}
|
||||
|
||||
public AppEngSlot(IInventory inv, int idx, int x, int y) {
|
||||
super( inv, idx, x, y );
|
||||
defX = x;
|
||||
defY = y;
|
||||
isValid = hasCalculatedValidness.NotAvailable;
|
||||
this.defX = x;
|
||||
this.defY = y;
|
||||
this.isValid = hasCalculatedValidness.NotAvailable;
|
||||
}
|
||||
|
||||
public boolean isDisplay = false;
|
||||
@@ -93,16 +93,16 @@ public class AppEngSlot extends Slot
|
||||
@Override
|
||||
public ItemStack getStack()
|
||||
{
|
||||
if ( !isEnabled() )
|
||||
if ( !this.isEnabled() )
|
||||
return null;
|
||||
|
||||
if ( inventory.getSizeInventory() <= getSlotIndex() )
|
||||
if ( this.inventory.getSizeInventory() <= this.getSlotIndex() )
|
||||
return null;
|
||||
|
||||
if ( isDisplay )
|
||||
if ( this.isDisplay )
|
||||
{
|
||||
isDisplay = false;
|
||||
return getDisplayStack();
|
||||
this.isDisplay = false;
|
||||
return this.getDisplayStack();
|
||||
}
|
||||
return super.getStack();
|
||||
}
|
||||
@@ -110,12 +110,12 @@ public class AppEngSlot extends Slot
|
||||
@Override
|
||||
public void putStack(ItemStack par1ItemStack)
|
||||
{
|
||||
if ( isEnabled() )
|
||||
if ( this.isEnabled() )
|
||||
{
|
||||
super.putStack( par1ItemStack );
|
||||
|
||||
if ( myContainer != null )
|
||||
myContainer.onSlotChange( this );
|
||||
if ( this.myContainer != null )
|
||||
this.myContainer.onSlotChange( this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ public class AppEngSlot extends Slot
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
if ( isEnabled() )
|
||||
if ( this.isEnabled() )
|
||||
return super.canTakeStack( par1EntityPlayer );
|
||||
return false;
|
||||
}
|
||||
@@ -135,7 +135,7 @@ public class AppEngSlot extends Slot
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack par1ItemStack)
|
||||
{
|
||||
if ( isEnabled() )
|
||||
if ( this.isEnabled() )
|
||||
return super.isItemValid( par1ItemStack );
|
||||
return false;
|
||||
}
|
||||
@@ -157,17 +157,17 @@ public class AppEngSlot extends Slot
|
||||
|
||||
public int getIcon()
|
||||
{
|
||||
return IIcon;
|
||||
return this.IIcon;
|
||||
}
|
||||
|
||||
public boolean isPlayerSide()
|
||||
{
|
||||
return isPlayerSide;
|
||||
return this.isPlayerSide;
|
||||
}
|
||||
|
||||
public boolean shouldDisplay()
|
||||
{
|
||||
return isEnabled();
|
||||
return this.isEnabled();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,20 +35,20 @@ public class OptionalSlotFake extends SlotFake
|
||||
|
||||
public OptionalSlotFake(IInventory inv, IOptionalSlotHost containerBus, int idx, int x, int y, int offX, int offY, int groupNum) {
|
||||
super( inv, idx, x + offX * 18, y + offY * 18 );
|
||||
srcX = x;
|
||||
srcY = y;
|
||||
invSlot = idx;
|
||||
this.srcX = x;
|
||||
this.srcY = y;
|
||||
this.invSlot = idx;
|
||||
this.groupNum = groupNum;
|
||||
host = containerBus;
|
||||
this.host = containerBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack()
|
||||
{
|
||||
if ( !isEnabled() )
|
||||
if ( !this.isEnabled() )
|
||||
{
|
||||
if ( getDisplayStack() != null )
|
||||
clearStack();
|
||||
if ( this.getDisplayStack() != null )
|
||||
this.clearStack();
|
||||
}
|
||||
|
||||
return super.getStack();
|
||||
@@ -57,15 +57,15 @@ public class OptionalSlotFake extends SlotFake
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
if ( host == null )
|
||||
if ( this.host == null )
|
||||
return false;
|
||||
|
||||
return host.isSlotEnabled( groupNum );
|
||||
return this.host.isSlotEnabled( this.groupNum );
|
||||
}
|
||||
|
||||
public boolean renderDisabled()
|
||||
{
|
||||
return renderDisabled;
|
||||
return this.renderDisabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,16 +29,16 @@ public class OptionalSlotNormal extends AppEngSlot
|
||||
public OptionalSlotNormal(IInventory inv, IOptionalSlotHost containerBus, int slot, int xPos, int yPos, int groupNum) {
|
||||
super( inv, slot, xPos, yPos );
|
||||
this.groupNum = groupNum;
|
||||
host = containerBus;
|
||||
this.host = containerBus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
if ( host == null )
|
||||
if ( this.host == null )
|
||||
return false;
|
||||
|
||||
return host.isSlotEnabled( groupNum );
|
||||
return this.host.isSlotEnabled( this.groupNum );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,10 +37,10 @@ public class OptionalSlotRestrictedInput extends SlotRestrictedInput
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
if ( host == null )
|
||||
if ( this.host == null )
|
||||
return false;
|
||||
|
||||
return host.isSlotEnabled( groupNum );
|
||||
return this.host.isSlotEnabled( this.groupNum );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,14 +42,14 @@ public class SlotCraftingMatrix extends AppEngSlot
|
||||
public void clearStack()
|
||||
{
|
||||
super.clearStack();
|
||||
c.onCraftMatrixChanged( inventory );
|
||||
this.c.onCraftMatrixChanged( this.inventory );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int par1)
|
||||
{
|
||||
ItemStack is = super.decrStackSize( par1 );
|
||||
c.onCraftMatrixChanged( inventory );
|
||||
this.c.onCraftMatrixChanged( this.inventory );
|
||||
return is;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SlotCraftingMatrix extends AppEngSlot
|
||||
public void putStack(ItemStack par1ItemStack)
|
||||
{
|
||||
super.putStack( par1ItemStack );
|
||||
c.onCraftMatrixChanged( inventory );
|
||||
this.c.onCraftMatrixChanged( this.inventory );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
this.energySrc = energySrc;
|
||||
this.storage = storage;
|
||||
this.mySrc = mySrc;
|
||||
pattern = cMatrix;
|
||||
craftInv = secondMatrix;
|
||||
container = ccp;
|
||||
this.pattern = cMatrix;
|
||||
this.craftInv = secondMatrix;
|
||||
this.container = ccp;
|
||||
}
|
||||
|
||||
public IInventory getCraftingMatrix()
|
||||
{
|
||||
return craftInv;
|
||||
return this.craftInv;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -92,18 +92,18 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
public ItemStack craftItem( EntityPlayer p, ItemStack request, IMEMonitor<IAEItemStack> inv, IItemList all )
|
||||
{
|
||||
// update crafting matrix...
|
||||
ItemStack is = getStack();
|
||||
ItemStack is = this.getStack();
|
||||
|
||||
if ( is != null && Platform.isSameItem( request, is ) )
|
||||
{
|
||||
ItemStack[] set = new ItemStack[pattern.getSizeInventory()];
|
||||
ItemStack[] set = new ItemStack[this.pattern.getSizeInventory()];
|
||||
|
||||
// add one of each item to the items on the board...
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 );
|
||||
for ( int x = 0; x < 9; x++ )
|
||||
ic.setInventorySlotContents( x, pattern.getStackInSlot( x ) );
|
||||
ic.setInventorySlotContents( x, this.pattern.getStackInSlot( x ) );
|
||||
|
||||
IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj );
|
||||
|
||||
@@ -125,7 +125,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
{
|
||||
super.onPickupFromSlot( p, is );
|
||||
// actually necessary to cleanup this case...
|
||||
p.openContainer.onCraftMatrixChanged( getCraftingMatrix() );
|
||||
p.openContainer.onCraftMatrixChanged( this.getCraftingMatrix() );
|
||||
return request;
|
||||
}
|
||||
}
|
||||
@@ -136,27 +136,27 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
|
||||
if ( inv != null )
|
||||
{
|
||||
for ( int x = 0; x < pattern.getSizeInventory(); x++ )
|
||||
for ( int x = 0; x < this.pattern.getSizeInventory(); x++ )
|
||||
{
|
||||
if ( pattern.getStackInSlot( x ) != null )
|
||||
if ( this.pattern.getStackInSlot( x ) != null )
|
||||
{
|
||||
set[x] = Platform.extractItemsByRecipe( energySrc, mySrc, inv, p.worldObj, r, is, ic, pattern.getStackInSlot( x ), x, all,
|
||||
Actionable.MODULATE, ItemViewCell.createFilter( container.getViewCells() ) );
|
||||
set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.worldObj, r, is, ic, this.pattern.getStackInSlot( x ), x, all,
|
||||
Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) );
|
||||
ic.setInventorySlotContents( x, set[x] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( preCraft( p, inv, set, is ) )
|
||||
if ( this.preCraft( p, inv, set, is ) )
|
||||
{
|
||||
makeItem( p, is );
|
||||
this.makeItem( p, is );
|
||||
|
||||
postCraft( p, inv, set, is );
|
||||
this.postCraft( p, inv, set, is );
|
||||
}
|
||||
|
||||
// shouldn't be necessary...
|
||||
p.openContainer.onCraftMatrixChanged( getCraftingMatrix() );
|
||||
p.openContainer.onCraftMatrixChanged( this.getCraftingMatrix() );
|
||||
|
||||
return is;
|
||||
}
|
||||
@@ -177,14 +177,14 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
// set new items onto the crafting table...
|
||||
for ( int x = 0; x < getCraftingMatrix().getSizeInventory(); x++ )
|
||||
for ( int x = 0; x < this.getCraftingMatrix().getSizeInventory(); x++ )
|
||||
{
|
||||
if ( getCraftingMatrix().getStackInSlot( x ) == null )
|
||||
getCraftingMatrix().setInventorySlotContents( x, set[x] );
|
||||
if ( this.getCraftingMatrix().getStackInSlot( x ) == null )
|
||||
this.getCraftingMatrix().setInventorySlotContents( x, set[x] );
|
||||
else if ( set[x] != null )
|
||||
{
|
||||
// eek! put it back!
|
||||
IAEItemStack fail = inv.injectItems( AEItemStack.create( set[x] ), Actionable.MODULATE, mySrc );
|
||||
IAEItemStack fail = inv.injectItems( AEItemStack.create( set[x] ), Actionable.MODULATE, this.mySrc );
|
||||
if ( fail != null )
|
||||
drops.add( fail.getItemStack() );
|
||||
}
|
||||
@@ -197,25 +197,25 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
|
||||
public void doClick( InventoryAction action, EntityPlayer who )
|
||||
{
|
||||
if ( getStack() == null )
|
||||
if ( this.getStack() == null )
|
||||
return;
|
||||
if ( Platform.isClient() )
|
||||
return;
|
||||
|
||||
IMEMonitor<IAEItemStack> inv = storage.getItemInventory();
|
||||
int howManyPerCraft = getStack().stackSize;
|
||||
IMEMonitor<IAEItemStack> inv = this.storage.getItemInventory();
|
||||
int howManyPerCraft = this.getStack().stackSize;
|
||||
int maxTimesToCraft = 0;
|
||||
|
||||
InventoryAdaptor ia = null;
|
||||
if ( action == InventoryAction.CRAFT_SHIFT ) // craft into player inventory...
|
||||
{
|
||||
ia = InventoryAdaptor.getAdaptor( who, null );
|
||||
maxTimesToCraft = ( int ) Math.floor( ( double ) getStack().getMaxStackSize() / ( double ) howManyPerCraft );
|
||||
maxTimesToCraft = ( int ) Math.floor( ( double ) this.getStack().getMaxStackSize() / ( double ) howManyPerCraft );
|
||||
}
|
||||
else if ( action == InventoryAction.CRAFT_STACK ) // craft into hand, full stack
|
||||
{
|
||||
ia = new AdaptorPlayerHand( who );
|
||||
maxTimesToCraft = ( int ) Math.floor( ( double ) getStack().getMaxStackSize() / ( double ) howManyPerCraft );
|
||||
maxTimesToCraft = ( int ) Math.floor( ( double ) this.getStack().getMaxStackSize() / ( double ) howManyPerCraft );
|
||||
}
|
||||
else
|
||||
// pick up what was crafted...
|
||||
@@ -224,12 +224,12 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
maxTimesToCraft = 1;
|
||||
}
|
||||
|
||||
maxTimesToCraft = CapCraftingAttempts( maxTimesToCraft );
|
||||
maxTimesToCraft = this.CapCraftingAttempts( maxTimesToCraft );
|
||||
|
||||
if ( ia == null )
|
||||
return;
|
||||
|
||||
ItemStack rs = Platform.cloneItemStack( getStack() );
|
||||
ItemStack rs = Platform.cloneItemStack( this.getStack() );
|
||||
if ( rs == null )
|
||||
return;
|
||||
|
||||
@@ -238,7 +238,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
|
||||
if ( ia.simulateAdd( rs ) == null )
|
||||
{
|
||||
IItemList<IAEItemStack> all = inv.getStorageList();
|
||||
ItemStack extra = ia.addItems( craftItem( who, rs, inv, all ) );
|
||||
ItemStack extra = ia.addItems( this.craftItem( who, rs, inv, all ) );
|
||||
if ( extra != null )
|
||||
{
|
||||
List<ItemStack> drops = new ArrayList<ItemStack>();
|
||||
|
||||
@@ -29,7 +29,7 @@ public class SlotFake extends AppEngSlot
|
||||
|
||||
public SlotFake(IInventory inv, int idx, int x, int y) {
|
||||
super( inv, idx, x, y );
|
||||
invSlot = idx;
|
||||
this.invSlot = idx;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,9 +42,9 @@ public class SlotFakeBlacklist extends SlotFakeTypeOnly
|
||||
@Override
|
||||
public int getIcon()
|
||||
{
|
||||
if ( getHasStack() )
|
||||
if ( this.getHasStack() )
|
||||
{
|
||||
return getStack().stackSize > 0 ? 16 + 14 : 14;
|
||||
return this.getStack().stackSize > 0 ? 16 + 14 : 14;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -34,20 +34,20 @@ public class SlotInaccessible extends AppEngSlot
|
||||
@Override
|
||||
public ItemStack getDisplayStack()
|
||||
{
|
||||
if ( dspStack == null )
|
||||
if ( this.dspStack == null )
|
||||
{
|
||||
ItemStack dsp = super.getDisplayStack();
|
||||
if ( dsp != null )
|
||||
dspStack = dsp.copy();
|
||||
this.dspStack = dsp.copy();
|
||||
}
|
||||
return dspStack;
|
||||
return this.dspStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSlotChanged()
|
||||
{
|
||||
super.onSlotChanged();
|
||||
dspStack = null;
|
||||
this.dspStack = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,7 @@ public class SlotMACPattern extends AppEngSlot
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack i)
|
||||
{
|
||||
return mac.isValidItemForSlot( this.getSlotIndex(), i );
|
||||
return this.mac.isValidItemForSlot( this.getSlotIndex(), i );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ public class SlotOutput extends AppEngSlot
|
||||
|
||||
public SlotOutput(IInventory a, int b, int c, int d, int i) {
|
||||
super( a, b, c, d );
|
||||
IIcon = i;
|
||||
this.IIcon = i;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -42,18 +42,18 @@ public class SlotPatternTerm extends SlotCraftingTerm
|
||||
{
|
||||
super( player, mySrc, energySrc, storage, cMatrix, secondMatrix, output, x, y, c );
|
||||
|
||||
host = h;
|
||||
groupNum = groupNumber;
|
||||
this.host = h;
|
||||
this.groupNum = groupNumber;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStack()
|
||||
{
|
||||
if ( !isEnabled() )
|
||||
if ( !this.isEnabled() )
|
||||
{
|
||||
if ( getDisplayStack() != null )
|
||||
clearStack();
|
||||
if ( this.getDisplayStack() != null )
|
||||
this.clearStack();
|
||||
}
|
||||
|
||||
return super.getStack();
|
||||
@@ -62,15 +62,15 @@ public class SlotPatternTerm extends SlotCraftingTerm
|
||||
@Override
|
||||
public boolean isEnabled()
|
||||
{
|
||||
if ( host == null )
|
||||
if ( this.host == null )
|
||||
return false;
|
||||
|
||||
return host.isSlotEnabled( groupNum );
|
||||
return this.host.isSlotEnabled( this.groupNum );
|
||||
}
|
||||
|
||||
public AppEngPacket getRequest(boolean shift) throws IOException
|
||||
{
|
||||
return new PacketPatternSlot( this.pattern, AEApi.instance().storage().createItemStack( getStack() ), shift );
|
||||
return new PacketPatternSlot( this.pattern, AEApi.instance().storage().createItemStack( this.getStack() ), shift );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,6 @@ public class SlotPlayerHotBar extends AppEngSlot
|
||||
|
||||
public SlotPlayerHotBar(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super( par1iInventory, par2, par3, par4 );
|
||||
isPlayerSide = true;
|
||||
this.isPlayerSide = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,6 @@ public class SlotPlayerInv extends AppEngSlot
|
||||
public SlotPlayerInv(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super( par1iInventory, par2, par3, par4 );
|
||||
|
||||
isPlayerSide = true;
|
||||
this.isPlayerSide = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,21 +61,21 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
public final int IIcon;
|
||||
|
||||
private PlacableItemType(int o) {
|
||||
IIcon = o;
|
||||
this.IIcon = o;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit()
|
||||
{
|
||||
if ( stackLimit != -1 )
|
||||
return stackLimit;
|
||||
if ( this.stackLimit != -1 )
|
||||
return this.stackLimit;
|
||||
return super.getSlotStackLimit();
|
||||
}
|
||||
|
||||
public boolean isValid(ItemStack is, World theWorld)
|
||||
{
|
||||
if ( which == PlacableItemType.VALID_ENCODED_PATTERN_W_OUTPUT )
|
||||
if ( this.which == PlacableItemType.VALID_ENCODED_PATTERN_W_OUTPUT )
|
||||
{
|
||||
ICraftingPatternDetails ap = is.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) is.getItem()).getPatternForItem( is, theWorld )
|
||||
: null;
|
||||
@@ -94,26 +94,26 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
@Override
|
||||
public boolean canTakeStack(EntityPlayer par1EntityPlayer)
|
||||
{
|
||||
return allowEdit;
|
||||
return this.allowEdit;
|
||||
}
|
||||
|
||||
public Slot setStackLimit(int i)
|
||||
{
|
||||
stackLimit = i;
|
||||
this.stackLimit = i;
|
||||
return this;
|
||||
}
|
||||
|
||||
public SlotRestrictedInput(PlacableItemType valid, IInventory i, int slotIndex, int x, int y, InventoryPlayer p) {
|
||||
super( i, slotIndex, x, y );
|
||||
which = valid;
|
||||
IIcon = valid.IIcon;
|
||||
this.which = valid;
|
||||
this.IIcon = valid.IIcon;
|
||||
this.p = p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getDisplayStack()
|
||||
{
|
||||
if ( Platform.isClient() && (which == PlacableItemType.ENCODED_PATTERN) )
|
||||
if ( Platform.isClient() && (this.which == PlacableItemType.ENCODED_PATTERN) )
|
||||
{
|
||||
ItemStack is = super.getStack();
|
||||
if ( is != null && is.getItem() instanceof ItemEncodedPattern )
|
||||
@@ -130,7 +130,7 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
@Override
|
||||
public boolean isItemValid(ItemStack i)
|
||||
{
|
||||
if ( !myContainer.isValidForSlot( this, i ) )
|
||||
if ( !this.myContainer.isValidForSlot( this, i ) )
|
||||
return false;
|
||||
|
||||
if ( i == null )
|
||||
@@ -138,21 +138,21 @@ public class SlotRestrictedInput extends AppEngSlot
|
||||
if ( i.getItem() == null )
|
||||
return false;
|
||||
|
||||
if ( !inventory.isItemValidForSlot( this.getSlotIndex(), i ) )
|
||||
if ( !this.inventory.isItemValidForSlot( this.getSlotIndex(), i ) )
|
||||
return false;
|
||||
|
||||
IAppEngApi api = AEApi.instance();
|
||||
|
||||
if ( !allowEdit )
|
||||
if ( !this.allowEdit )
|
||||
return false;
|
||||
|
||||
switch (which)
|
||||
switch (this.which)
|
||||
{
|
||||
case ENCODED_CRAFTING_PATTERN:
|
||||
if ( i.getItem() instanceof ICraftingPatternItem )
|
||||
{
|
||||
ICraftingPatternItem b = (ICraftingPatternItem) i.getItem();
|
||||
ICraftingPatternDetails de = b.getPatternForItem( i, p.player.worldObj );
|
||||
ICraftingPatternDetails de = b.getPatternForItem( i, this.p.player.worldObj );
|
||||
if ( de != null )
|
||||
return de.isCraftable();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user