Reduces visibility of internal fields/methods

Reduces the visibility of all fields to private and create setters/getters
when necessary. Exceptions are fields with GuiSync as these need to be
public.

Reduces the visibility of internal methods to private/protected/default when possible.
This commit is contained in:
yueh
2015-10-08 15:42:42 +02:00
parent f054bd699b
commit e94a0cfccf
497 changed files with 7865 additions and 6908 deletions
@@ -84,22 +84,22 @@ import appeng.util.item.AEItemStack;
public abstract class AEBaseContainer extends Container
{
protected final InventoryPlayer invPlayer;
protected final BaseActionSource mySrc;
protected final HashSet<Integer> locked = new HashSet<Integer>();
final TileEntity tileEntity;
final IPart part;
final IGuiItemObject obj;
final List<PacketPartialItem> dataChunks = new LinkedList<PacketPartialItem>();
final HashMap<Integer, SyncData> syncData = new HashMap<Integer, SyncData>();
public boolean isContainerValid = true;
public String customName;
public ContainerOpenContext openContext;
protected IMEInventoryHandler<IAEItemStack> cellInv;
protected IEnergySource powerSrc;
boolean sentCustomName;
int ticksSinceCheck = 900;
IAEItemStack clientRequestedTargetItem = null;
private final InventoryPlayer invPlayer;
private final BaseActionSource mySrc;
private final HashSet<Integer> locked = new HashSet<Integer>();
private final TileEntity tileEntity;
private final IPart part;
private final IGuiItemObject obj;
private final List<PacketPartialItem> dataChunks = new LinkedList<PacketPartialItem>();
private final HashMap<Integer, SyncData> syncData = new HashMap<Integer, SyncData>();
private boolean isContainerValid = true;
private String customName;
private ContainerOpenContext openContext;
private IMEInventoryHandler<IAEItemStack> cellInv;
private IEnergySource powerSrc;
private boolean sentCustomName;
private int ticksSinceCheck = 900;
private IAEItemStack clientRequestedTargetItem = null;
public AEBaseContainer( final InventoryPlayer ip, final TileEntity myTile, final IPart myPart )
{
@@ -277,7 +277,7 @@ public abstract class AEBaseContainer extends Container
this.clientRequestedTargetItem = stack == null ? null : stack.copy();
}
public BaseActionSource getSource()
public BaseActionSource getActionSource()
{
return this.mySrc;
}
@@ -296,7 +296,7 @@ public abstract class AEBaseContainer extends Container
}
this.ticksSinceCheck = 0;
this.isContainerValid = this.isContainerValid && this.hasAccess( security, requirePower );
this.setValidContainer( this.isValidContainer() && this.hasAccess( security, requirePower ) );
}
protected boolean hasAccess( final SecurityPermissions perm, final boolean requirePower )
@@ -321,7 +321,7 @@ public abstract class AEBaseContainer extends Container
}
final ISecurityGrid sg = g.getCache( ISecurityGrid.class );
if( sg.hasPermission( this.invPlayer.player, perm ) )
if( sg.hasPermission( this.getInventoryPlayer().player, perm ) )
{
return true;
}
@@ -356,7 +356,7 @@ public abstract class AEBaseContainer extends Container
public InventoryPlayer getPlayerInv()
{
return this.invPlayer;
return this.getInventoryPlayer();
}
public TileEntity getTileEntity()
@@ -421,7 +421,7 @@ public abstract class AEBaseContainer extends Container
if( newSlot instanceof AppEngSlot )
{
final AppEngSlot s = (AppEngSlot) newSlot;
s.myContainer = this;
s.setContainer( this );
return super.addSlotToContainer( newSlot );
}
else
@@ -723,7 +723,7 @@ public abstract class AEBaseContainer extends Container
@Override
public boolean canInteractWith( final EntityPlayer entityplayer )
{
if( this.isContainerValid )
if( this.isValidContainer() )
{
if( this.tileEntity instanceof IInventory )
{
@@ -737,7 +737,7 @@ public abstract class AEBaseContainer extends Container
@Override
public boolean canDragIntoSlot( final Slot s )
{
return ( (AppEngSlot) s ).isDraggable;
return ( (AppEngSlot) s ).isDraggable();
}
public void doAction( final EntityPlayerMP player, final InventoryAction action, final int slot, final long id )
@@ -851,7 +851,7 @@ public abstract class AEBaseContainer extends Container
switch( action )
{
case SHIFT_CLICK:
if( this.powerSrc == null || this.cellInv == null )
if( this.getPowerSource() == null || this.getCellInventory() == null )
{
return;
}
@@ -872,7 +872,7 @@ public abstract class AEBaseContainer extends Container
ais.setStackSize( ais.getStackSize() - myItem.stackSize );
}
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
if( ais != null )
{
adp.addItems( ais.getItemStack() );
@@ -880,7 +880,7 @@ public abstract class AEBaseContainer extends Container
}
break;
case ROLL_DOWN:
if( this.powerSrc == null || this.cellInv == null )
if( this.getPowerSource() == null || this.getCellInventory() == null )
{
return;
}
@@ -894,7 +894,7 @@ public abstract class AEBaseContainer extends Container
ais.setStackSize( 1 );
final IAEItemStack extracted = ais.copy();
ais = Platform.poweredInsert( this.powerSrc, this.cellInv, ais, this.mySrc );
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
if( ais == null )
{
final InventoryAdaptor ia = new AdaptorPlayerHand( player );
@@ -902,7 +902,7 @@ public abstract class AEBaseContainer extends Container
final ItemStack fail = ia.removeItems( 1, extracted.getItemStack(), null );
if( fail == null )
{
this.cellInv.extractItems( extracted, Actionable.MODULATE, this.mySrc );
this.getCellInventory().extractItems( extracted, Actionable.MODULATE, this.getActionSource() );
}
this.updateHeld( player );
@@ -912,7 +912,7 @@ public abstract class AEBaseContainer extends Container
break;
case ROLL_UP:
case PICKUP_SINGLE:
if( this.powerSrc == null || this.cellInv == null )
if( this.getPowerSource() == null || this.getCellInventory() == null )
{
return;
}
@@ -938,7 +938,7 @@ public abstract class AEBaseContainer extends Container
{
IAEItemStack ais = slotItem.copy();
ais.setStackSize( 1 );
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
if( ais != null )
{
final InventoryAdaptor ia = new AdaptorPlayerHand( player );
@@ -946,7 +946,7 @@ public abstract class AEBaseContainer extends Container
final ItemStack fail = ia.addItems( ais.getItemStack() );
if( fail != null )
{
this.cellInv.injectItems( ais, Actionable.MODULATE, this.mySrc );
this.getCellInventory().injectItems( ais, Actionable.MODULATE, this.getActionSource() );
}
this.updateHeld( player );
@@ -955,7 +955,7 @@ public abstract class AEBaseContainer extends Container
}
break;
case PICKUP_OR_SET_DOWN:
if( this.powerSrc == null || this.cellInv == null )
if( this.getPowerSource() == null || this.getCellInventory() == null )
{
return;
}
@@ -966,7 +966,7 @@ public abstract class AEBaseContainer extends Container
{
IAEItemStack ais = slotItem.copy();
ais.setStackSize( ais.getItemStack().getMaxStackSize() );
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
if( ais != null )
{
player.inventory.setItemStack( ais.getItemStack() );
@@ -981,7 +981,7 @@ public abstract class AEBaseContainer extends Container
else
{
IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() );
ais = Platform.poweredInsert( this.powerSrc, this.cellInv, ais, this.mySrc );
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
if( ais != null )
{
player.inventory.setItemStack( ais.getItemStack() );
@@ -995,7 +995,7 @@ public abstract class AEBaseContainer extends Container
break;
case SPLIT_OR_PLACE_SINGLE:
if( this.powerSrc == null || this.cellInv == null )
if( this.getPowerSource() == null || this.getCellInventory() == null )
{
return;
}
@@ -1007,13 +1007,13 @@ public abstract class AEBaseContainer extends Container
IAEItemStack ais = slotItem.copy();
final long maxSize = ais.getItemStack().getMaxStackSize();
ais.setStackSize( maxSize );
ais = this.cellInv.extractItems( ais, Actionable.SIMULATE, this.mySrc );
ais = this.getCellInventory().extractItems( ais, Actionable.SIMULATE, this.getActionSource() );
if( ais != null )
{
final long stackSize = Math.min( maxSize, ais.getStackSize() );
ais.setStackSize( ( stackSize + 1 ) >> 1 );
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
}
if( ais != null )
@@ -1031,7 +1031,7 @@ public abstract class AEBaseContainer extends Container
{
IAEItemStack ais = AEApi.instance().storage().createItemStack( player.inventory.getItemStack() );
ais.setStackSize( 1 );
ais = Platform.poweredInsert( this.powerSrc, this.cellInv, ais, this.mySrc );
ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
if( ais == null )
{
final ItemStack is = player.inventory.getItemStack();
@@ -1056,7 +1056,7 @@ public abstract class AEBaseContainer extends Container
break;
case MOVE_REGION:
if( this.powerSrc == null || this.cellInv == null )
if( this.getPowerSource() == null || this.getCellInventory() == null )
{
return;
}
@@ -1080,7 +1080,7 @@ public abstract class AEBaseContainer extends Container
ais.setStackSize( ais.getStackSize() - myItem.stackSize );
}
ais = Platform.poweredExtraction( this.powerSrc, this.cellInv, ais, this.mySrc );
ais = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), ais, this.getActionSource() );
if( ais != null )
{
adp.addItems( ais.getItemStack() );
@@ -1113,13 +1113,13 @@ public abstract class AEBaseContainer extends Container
}
}
public ItemStack shiftStoreItem( final ItemStack input )
private ItemStack shiftStoreItem( final ItemStack input )
{
if( this.powerSrc == null || this.cellInv == null )
if( this.getPowerSource() == null || this.getCellInventory() == null )
{
return input;
}
final IAEItemStack ais = Platform.poweredInsert( this.powerSrc, this.cellInv, AEApi.instance().storage().createItemStack( input ), this.mySrc );
final IAEItemStack ais = Platform.poweredInsert( this.getPowerSource(), this.getCellInventory(), AEApi.instance().storage().createItemStack( input ), this.getActionSource() );
if( ais == null )
{
return null;
@@ -1133,7 +1133,7 @@ public abstract class AEBaseContainer extends Container
this.detectAndSendChanges();
}
protected void sendCustomName()
private void sendCustomName()
{
if( !this.sentCustomName )
{
@@ -1166,14 +1166,14 @@ public abstract class AEBaseContainer extends Container
{
if( name.hasCustomName() )
{
this.customName = name.getCustomName();
this.setCustomName( name.getCustomName() );
}
if( this.customName != null )
if( this.getCustomName() != null )
{
try
{
NetworkHandler.instance.sendTo( new PacketValueConfig( "CustomName", this.customName ), (EntityPlayerMP) this.invPlayer.player );
NetworkHandler.instance.sendTo( new PacketValueConfig( "CustomName", this.getCustomName() ), (EntityPlayerMP) this.getInventoryPlayer().player );
}
catch( final IOException e )
{
@@ -1207,12 +1207,12 @@ public abstract class AEBaseContainer extends Container
// can take?
if( isA != null && !a.canTakeStack( this.invPlayer.player ) )
if( isA != null && !a.canTakeStack( this.getInventoryPlayer().player ) )
{
return;
}
if( isB != null && !b.canTakeStack( this.invPlayer.player ) )
if( isB != null && !b.canTakeStack( this.getInventoryPlayer().player ) )
{
return;
}
@@ -1279,4 +1279,59 @@ public abstract class AEBaseContainer extends Container
{
return true;
}
public IMEInventoryHandler<IAEItemStack> getCellInventory()
{
return this.cellInv;
}
public void setCellInventory( final IMEInventoryHandler<IAEItemStack> cellInv )
{
this.cellInv = cellInv;
}
public String getCustomName()
{
return this.customName;
}
public void setCustomName( final String customName )
{
this.customName = customName;
}
public InventoryPlayer getInventoryPlayer()
{
return this.invPlayer;
}
public boolean isValidContainer()
{
return this.isContainerValid;
}
public void setValidContainer( final boolean isContainerValid )
{
this.isContainerValid = isContainerValid;
}
public ContainerOpenContext getOpenContext()
{
return this.openContext;
}
public void setOpenContext( final ContainerOpenContext openContext )
{
this.openContext = openContext;
}
public IEnergySource getPowerSource()
{
return this.powerSrc;
}
public void setPowerSource( final IEnergySource powerSrc )
{
this.powerSrc = powerSrc;
}
}
@@ -29,12 +29,12 @@ import appeng.api.util.AEPartLocation;
public class ContainerOpenContext
{
public final boolean isItem;
public World w;
public int x;
public int y;
public int z;
public AEPartLocation side;
private final boolean isItem;
private World w;
private int x;
private int y;
private int z;
private AEPartLocation side;
public ContainerOpenContext( final Object myItem )
{
@@ -50,4 +50,54 @@ public class ContainerOpenContext
}
return this.w.getTileEntity( new BlockPos( this.x, this.y, this.z ) );
}
public AEPartLocation getSide()
{
return this.side;
}
public void setSide( final AEPartLocation side )
{
this.side = side;
}
private int getZ()
{
return this.z;
}
public void setZ( final int z )
{
this.z = z;
}
private int getY()
{
return this.y;
}
public void setY( final int y )
{
this.y = y;
}
private int getX()
{
return this.x;
}
public void setX( final int x )
{
this.x = x;
}
private World getWorld()
{
return this.w;
}
public void setWorld( final World w )
{
this.w = w;
}
}
@@ -19,11 +19,18 @@
package appeng.container.guisync;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Annotates that this field should be synchronized between the server and client.
* Requires the field to be public.
*/
@Retention( RetentionPolicy.RUNTIME )
@Target( ElementType.FIELD )
public @interface GuiSync
{
@@ -55,7 +55,6 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
public CopyMode copyMode = CopyMode.CLEAR_ON_REMOVE;
private ItemStack prevStack = null;
private int lastUpgrades = 0;
private ItemStack LastCell;
public ContainerCellWorkbench( final InventoryPlayer ip, final TileCellWorkbench te )
{
@@ -72,12 +71,12 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
}
}
public void nextCopyMode()
public void nextWorkBenchCopyMode()
{
this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, Platform.nextEnum( this.getCopyMode() ) );
this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, Platform.nextEnum( this.getWorkBenchCopyMode() ) );
}
public CopyMode getCopyMode()
private CopyMode getWorkBenchCopyMode()
{
return (CopyMode) this.workBench.getConfigManager().getSetting( Settings.COPY_MODE );
}
@@ -91,11 +90,10 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
@Override
protected void setupConfig()
{
final IInventory cell = this.getUpgradeable().getInventoryByName( "cell" );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.getPlayerInv() ) );
final IInventory cell = this.upgradeable.getInventoryByName( "cell" );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.invPlayer ) );
final IInventory inv = this.upgradeable.getInventoryByName( "config" );
final IInventory inv = this.getUpgradeable().getInventoryByName( "config" );
final IInventory upgradeInventory = new Upgrades();
// null, 3 * 8 );
@@ -116,7 +114,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
for( int z = 0; z < 8; z++ )
{
final int iSLot = zz * 8 + z;
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgradeInventory, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.invPlayer ) );
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgradeInventory, this, iSLot, 187 + zz * 18, 8 + 18 * z, iSLot, this.getInventoryPlayer() ) );
}
}
/*
@@ -149,7 +147,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
{
if( this.workBench.getWorld().getTileEntity( this.workBench.getPos() ) != this.workBench )
{
this.isContainerValid = false;
this.setValidContainer( false );
}
for( final Object crafter : this.crafters )
@@ -171,8 +169,8 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
}
}
this.copyMode = this.getCopyMode();
this.fzMode = this.getFuzzyMode();
this.setCopyMode( this.getWorkBenchCopyMode() );
this.setFuzzyMode( this.getWorkBenchFuzzyMode() );
}
this.prevStack = is;
@@ -197,7 +195,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
{
if( field.equals( "copyMode" ) )
{
this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, this.copyMode );
this.workBench.getConfigManager().putSetting( Settings.COPY_MODE, this.getCopyMode() );
}
super.onUpdate( field, oldValue, newValue );
@@ -205,7 +203,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
public void clear()
{
final IInventory inv = this.upgradeable.getInventoryByName( "config" );
final IInventory inv = this.getUpgradeable().getInventoryByName( "config" );
for( int x = 0; x < inv.getSizeInventory(); x++ )
{
inv.setInventorySlotContents( x, null );
@@ -213,7 +211,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
this.detectAndSendChanges();
}
private FuzzyMode getFuzzyMode()
private FuzzyMode getWorkBenchFuzzyMode()
{
final ICellWorkbenchItem cwi = this.workBench.getCell();
if( cwi != null )
@@ -225,9 +223,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
public void partition()
{
final IInventory inv = this.upgradeable.getInventoryByName( "config" );
final IInventory inv = this.getUpgradeable().getInventoryByName( "config" );
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( this.upgradeable.getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS );
final IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell().getCellInventory( this.getUpgradeable().getInventoryByName( "cell" ).getStackInSlot( 0 ), null, StorageChannel.ITEMS );
Iterator<IAEItemStack> i = new NullIterator<IAEItemStack>();
if( cellInv != null )
@@ -253,6 +251,16 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
this.detectAndSendChanges();
}
public CopyMode getCopyMode()
{
return this.copyMode;
}
private void setCopyMode( final CopyMode copyMode )
{
this.copyMode = copyMode;
}
private class Upgrades implements IInventory
{
@@ -328,14 +336,14 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
public void openInventory(
final EntityPlayer player )
{
}
@Override
public void closeInventory(
final EntityPlayer player )
{
}
@Override
@@ -362,7 +370,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
final int id,
final int value )
{
}
@Override
@@ -374,7 +382,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
@Override
public void clear()
{
ContainerCellWorkbench.this.getCellUpgradeInventory().clear();
ContainerCellWorkbench.this.getCellUpgradeInventory().clear();
}
}
}
@@ -28,14 +28,14 @@ import appeng.tile.storage.TileChest;
public class ContainerChest extends AEBaseContainer
{
final TileChest chest;
private final TileChest chest;
public ContainerChest( final InventoryPlayer ip, final TileChest chest )
{
super( ip, chest, null );
this.chest = chest;
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, this.chest, 1, 80, 37, this.invPlayer ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, this.chest, 1, 80, 37, this.getInventoryPlayer() ) );
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
}
@@ -34,7 +34,7 @@ import appeng.util.Platform;
public class ContainerCondenser extends AEBaseContainer implements IProgressProvider
{
final TileCondenser condenser;
private final TileCondenser condenser;
@GuiSync( 0 )
public long requiredEnergy = 0;
@GuiSync( 1 )
@@ -63,8 +63,8 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv
final double requiredEnergy = this.condenser.getRequiredPower();
this.requiredEnergy = requiredEnergy == 0 ? (int) maxStorage : (int) Math.min( requiredEnergy, maxStorage );
this.storedPower = (int) this.condenser.storedPower;
this.output = (CondenserOutput) this.condenser.getConfigManager().getSetting( Settings.CONDENSER_OUTPUT );
this.storedPower = (int) this.condenser.getStoredPower();
this.setOutput( (CondenserOutput) this.condenser.getConfigManager().getSetting( Settings.CONDENSER_OUTPUT ) );
}
super.detectAndSendChanges();
@@ -81,4 +81,14 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv
{
return (int) this.requiredEnergy;
}
public CondenserOutput getOutput()
{
return this.output;
}
private void setOutput( final CondenserOutput output )
{
this.output = output;
}
}
@@ -19,6 +19,8 @@
package appeng.container.implementations;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.world.World;
@@ -37,17 +39,15 @@ import appeng.tile.inventory.AppEngInternalInventory;
public class ContainerCraftAmount extends AEBaseContainer
{
public final Slot craftingItem;
final ITerminalHost priHost;
public IAEItemStack whatToMake;
private final Slot craftingItem;
private IAEItemStack itemToCreate;
public ContainerCraftAmount( final InventoryPlayer ip, final ITerminalHost te )
{
super( ip, te );
this.priHost = te;
this.craftingItem = new SlotInaccessible( new AppEngInternalInventory( null, 1 ), 0, 34, 53 );
this.addSlotToContainer( this.craftingItem );
this.addSlotToContainer( this.getCraftingItem() );
}
@Override
@@ -72,4 +72,19 @@ public class ContainerCraftAmount extends AEBaseContainer
{
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
}
public Slot getCraftingItem()
{
return this.craftingItem;
}
public IAEItemStack getItemToCraft()
{
return this.itemToCreate;
}
public void setItemToCraft( @Nonnull final IAEItemStack itemToCreate )
{
this.itemToCreate = itemToCreate;
}
}
@@ -24,6 +24,10 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
@@ -31,6 +35,7 @@ import net.minecraft.inventory.ICrafting;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.SecurityPermissions;
@@ -60,16 +65,13 @@ import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import appeng.util.Platform;
import com.google.common.collect.ImmutableSet;
public class ContainerCraftConfirm extends AEBaseContainer
{
public final ArrayList<CraftingCPURecord> cpus = new ArrayList<CraftingCPURecord>();
final ITerminalHost priHost;
public Future<ICraftingJob> job;
public ICraftingJob result;
private final ArrayList<CraftingCPURecord> cpus = new ArrayList<CraftingCPURecord>();
private Future<ICraftingJob> job;
private ICraftingJob result;
@GuiSync( 0 )
public long bytesUsed;
@GuiSync( 1 )
@@ -86,45 +88,43 @@ public class ContainerCraftConfirm extends AEBaseContainer
public boolean noCPU = true;
@GuiSync( 7 )
public String myName = "";
protected long cpuIdx = Long.MIN_VALUE;
public ContainerCraftConfirm( final InventoryPlayer ip, final ITerminalHost te )
{
super( ip, te );
this.priHost = te;
}
public void cycleCpu( final boolean next )
{
if( next )
{
this.selectedCpu++;
this.setSelectedCpu( this.getSelectedCpu() + 1 );
}
else
{
this.selectedCpu--;
this.setSelectedCpu( this.getSelectedCpu() - 1 );
}
if( this.selectedCpu < -1 )
if( this.getSelectedCpu() < -1 )
{
this.selectedCpu = this.cpus.size() - 1;
this.setSelectedCpu( this.cpus.size() - 1 );
}
else if( this.selectedCpu >= this.cpus.size() )
else if( this.getSelectedCpu() >= this.cpus.size() )
{
this.selectedCpu = -1;
this.setSelectedCpu( -1 );
}
if( this.selectedCpu == -1 )
if( this.getSelectedCpu() == -1 )
{
this.cpuBytesAvail = 0;
this.cpuCoProcessors = 0;
this.myName = "";
this.setCpuAvailableBytes( 0 );
this.setCpuCoProcessors( 0 );
this.setName( "" );
}
else
{
this.myName = this.cpus.get( this.selectedCpu ).myName;
this.cpuBytesAvail = this.cpus.get( this.selectedCpu ).size;
this.cpuCoProcessors = this.cpus.get( this.selectedCpu ).processors;
this.setName( this.cpus.get( this.getSelectedCpu() ).getName() );
this.setCpuAvailableBytes( this.cpus.get( this.getSelectedCpu() ).getSize() );
this.setCpuCoProcessors( this.cpus.get( this.getSelectedCpu() ).getProcessors() );
}
}
@@ -146,7 +146,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
boolean found = false;
for( final CraftingCPURecord ccr : this.cpus )
{
if( ccr.cpu == c )
if( ccr.getCpu() == c )
{
found = true;
}
@@ -179,20 +179,20 @@ public class ContainerCraftConfirm extends AEBaseContainer
this.sendCPUs();
}
this.noCPU = this.cpus.isEmpty();
this.setNoCPU( this.cpus.isEmpty() );
super.detectAndSendChanges();
if( this.job != null && this.job.isDone() )
if( this.getJob() != null && this.getJob().isDone() )
{
try
{
this.result = this.job.get();
this.result = this.getJob().get();
if( !this.result.isSimulation() )
{
this.simulation = false;
if( this.autoStart )
this.setSimulation( false );
if( this.isAutoStart() )
{
this.startJob();
return;
@@ -200,7 +200,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
}
else
{
this.simulation = true;
this.setSimulation( true );
}
try
@@ -212,7 +212,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
final IItemList<IAEItemStack> plan = AEApi.instance().storage().createItemList();
this.result.populatePlan( plan );
this.bytesUsed = this.result.getByteTotal();
this.setUsedBytes( this.result.getByteTotal() );
for( final IAEItemStack out : plan )
{
@@ -232,7 +232,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
if( c != null && this.result.isSimulation() )
{
m = o.copy();
o = items.extractItems( o, Actionable.SIMULATE, this.mySrc );
o = items.extractItems( o, Actionable.SIMULATE, this.getActionSource() );
if( o == null )
{
@@ -281,16 +281,16 @@ public class ContainerCraftConfirm extends AEBaseContainer
{
this.getPlayerInv().player.addChatMessage( new ChatComponentText( "Error: " + e.toString() ) );
AELog.error( e );
this.isContainerValid = false;
this.setValidContainer( false );
this.result = null;
}
this.job = null;
this.setJob( null );
}
this.verifyPermissions( SecurityPermissions.CRAFT, false );
}
public IGrid getGrid()
private IGrid getGrid()
{
final IActionHost h = ( (IActionHost) this.getTarget() );
return h.getActionableNode().getGrid();
@@ -298,25 +298,25 @@ public class ContainerCraftConfirm extends AEBaseContainer
private boolean cpuMatches( final ICraftingCPU c )
{
return c.getAvailableStorage() >= this.bytesUsed && !c.isBusy();
return c.getAvailableStorage() >= this.getUsedBytes() && !c.isBusy();
}
private void sendCPUs()
{
Collections.sort( this.cpus );
if( this.selectedCpu >= this.cpus.size() )
if( this.getSelectedCpu() >= this.cpus.size() )
{
this.selectedCpu = -1;
this.cpuBytesAvail = 0;
this.cpuCoProcessors = 0;
this.myName = "";
this.setSelectedCpu( -1 );
this.setCpuAvailableBytes( 0 );
this.setCpuCoProcessors( 0 );
this.setName( "" );
}
else if( this.selectedCpu != -1 )
else if( this.getSelectedCpu() != -1 )
{
this.myName = this.cpus.get( this.selectedCpu ).myName;
this.cpuBytesAvail = this.cpus.get( this.selectedCpu ).size;
this.cpuCoProcessors = this.cpus.get( this.selectedCpu ).processors;
this.setName( this.cpus.get( this.getSelectedCpu() ).getName() );
this.setCpuAvailableBytes( this.cpus.get( this.getSelectedCpu() ).getSize() );
this.setCpuCoProcessors( this.cpus.get( this.getSelectedCpu() ).getProcessors() );
}
}
@@ -345,22 +345,22 @@ public class ContainerCraftConfirm extends AEBaseContainer
originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
if( this.result != null && !this.simulation )
if( this.result != null && !this.isSimulation() )
{
final ICraftingGrid cc = this.getGrid().getCache( ICraftingGrid.class );
final 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 )
final ICraftingLink g = cc.submitJob( this.result, null, this.getSelectedCpu() == -1 ? null : this.cpus.get( this.getSelectedCpu() ).getCpu(), true, this.getActionSrc() );
this.setAutoStart( false );
if( g != null && originalGui != null && this.getOpenContext() != null )
{
NetworkHandler.instance.sendTo( new PacketSwitchGuis( originalGui ), (EntityPlayerMP) this.invPlayer.player );
NetworkHandler.instance.sendTo( new PacketSwitchGuis( originalGui ), (EntityPlayerMP) this.getInventoryPlayer().player );
final TileEntity te = this.openContext.getTile();
Platform.openGUI( this.invPlayer.player, te, this.openContext.side, originalGui );
final TileEntity te = this.getOpenContext().getTile();
Platform.openGUI( this.getInventoryPlayer().player, te, this.getOpenContext().getSide(), originalGui );
}
}
}
public BaseActionSource getActionSrc()
private BaseActionSource getActionSrc()
{
return new PlayerSource( this.getPlayerInv().player, (IActionHost) this.getTarget() );
}
@@ -369,10 +369,10 @@ public class ContainerCraftConfirm extends AEBaseContainer
public void removeCraftingFromCrafters( final ICrafting c )
{
super.removeCraftingFromCrafters( c );
if( this.job != null )
if( this.getJob() != null )
{
this.job.cancel( true );
this.job = null;
this.getJob().cancel( true );
this.setJob( null );
}
}
@@ -380,10 +380,10 @@ public class ContainerCraftConfirm extends AEBaseContainer
public void onContainerClosed( final EntityPlayer par1EntityPlayer )
{
super.onContainerClosed( par1EntityPlayer );
if( this.job != null )
if( this.getJob() != null )
{
this.job.cancel( true );
this.job = null;
this.getJob().cancel( true );
this.setJob( null );
}
}
@@ -391,4 +391,94 @@ public class ContainerCraftConfirm extends AEBaseContainer
{
return this.getPlayerInv().player.worldObj;
}
public boolean isAutoStart()
{
return this.autoStart;
}
public void setAutoStart( final boolean autoStart )
{
this.autoStart = autoStart;
}
public long getUsedBytes()
{
return this.bytesUsed;
}
private void setUsedBytes( final long bytesUsed )
{
this.bytesUsed = bytesUsed;
}
public long getCpuAvailableBytes()
{
return this.cpuBytesAvail;
}
private void setCpuAvailableBytes( final long cpuBytesAvail )
{
this.cpuBytesAvail = cpuBytesAvail;
}
public int getCpuCoProcessors()
{
return this.cpuCoProcessors;
}
private void setCpuCoProcessors( final int cpuCoProcessors )
{
this.cpuCoProcessors = cpuCoProcessors;
}
public int getSelectedCpu()
{
return this.selectedCpu;
}
private void setSelectedCpu( final int selectedCpu )
{
this.selectedCpu = selectedCpu;
}
public String getName()
{
return this.myName;
}
private void setName( @Nonnull final String myName )
{
this.myName = myName;
}
public boolean hasNoCPU()
{
return this.noCPU;
}
private void setNoCPU( final boolean noCPU )
{
this.noCPU = noCPU;
}
public boolean isSimulation()
{
return this.simulation;
}
private void setSimulation( final boolean simulation )
{
this.simulation = simulation;
}
private Future<ICraftingJob> getJob()
{
return this.job;
}
public void setJob( final Future<ICraftingJob> job )
{
this.job = job;
}
}
@@ -53,11 +53,10 @@ import appeng.util.Platform;
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject
{
final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
protected IGrid network;
CraftingCPUCluster monitor = null;
String cpuName = null;
int delay = 40;
private final IItemList<IAEItemStack> list = AEApi.instance().storage().createItemList();
private IGrid network;
private CraftingCPUCluster monitor = null;
private String cpuName = null;
@GuiSync( 0 )
public long eta = -1;
@@ -81,34 +80,34 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
this.setCPU( (ICraftingCPU) ( (IAEMultiBlock) te ).getCluster() );
}
if( this.network == null && Platform.isServer() )
if( this.getNetwork() == null && Platform.isServer() )
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
private void findNode( final IGridHost host, final AEPartLocation d )
{
if( this.network == null )
if( this.getNetwork() == null )
{
final IGridNode node = host.getGridNode( d );
if( node != null )
{
this.network = node.getGrid();
this.setNetwork( node.getGrid() );
}
}
}
protected void setCPU( final ICraftingCPU c )
{
if( c == this.monitor )
if( c == this.getMonitor() )
{
return;
}
if( this.monitor != null )
if( this.getMonitor() != null )
{
this.monitor.removeListener( this );
this.getMonitor().removeListener( this );
}
for( final Object g : this.crafters )
@@ -129,27 +128,27 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
if( c instanceof CraftingCPUCluster )
{
this.cpuName = c.getName();
this.monitor = (CraftingCPUCluster) c;
this.setMonitor( (CraftingCPUCluster) c );
this.list.resetStatus();
this.monitor.getListOfItem( this.list, CraftingItemList.ALL );
this.monitor.addListener( this, null );
this.eta = 0;
this.getMonitor().getListOfItem( this.list, CraftingItemList.ALL );
this.getMonitor().addListener( this, null );
this.setEstimatedTime( 0 );
}
else
{
this.monitor = null;
this.setMonitor( null );
this.cpuName = "";
this.eta = -1;
this.setEstimatedTime( -1 );
}
}
public void cancelCrafting()
{
if( this.monitor != null )
if( this.getMonitor() != null )
{
this.monitor.cancel();
this.getMonitor().cancel();
}
this.eta = -1;
this.setEstimatedTime( -1 );
}
@Override
@@ -157,9 +156,9 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
{
super.removeCraftingFromCrafters( c );
if( this.crafters.isEmpty() && this.monitor != null )
if( this.crafters.isEmpty() && this.getMonitor() != null )
{
this.monitor.removeListener( this );
this.getMonitor().removeListener( this );
}
}
@@ -167,26 +166,26 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
public void onContainerClosed( final EntityPlayer player )
{
super.onContainerClosed( player );
if( this.monitor != null )
if( this.getMonitor() != null )
{
this.monitor.removeListener( this );
this.getMonitor().removeListener( this );
}
}
@Override
public void detectAndSendChanges()
{
if( Platform.isServer() && this.monitor != null && !this.list.isEmpty() )
if( Platform.isServer() && this.getMonitor() != null && !this.list.isEmpty() )
{
try
{
if( this.eta >= 0 )
if( this.getEstimatedTime() >= 0 )
{
final long elapsedTime = this.monitor.getElapsedTime();
final double remainingItems = this.monitor.getRemainingItemCount();
final double startItems = this.monitor.getStartItemCount();
final long elapsedTime = this.getMonitor().getElapsedTime();
final double remainingItems = this.getMonitor().getRemainingItemCount();
final double startItems = this.getMonitor().getStartItemCount();
final long eta = (long) ( elapsedTime / Math.max( 1d, ( startItems - remainingItems ) ) * remainingItems );
this.eta = eta;
this.setEstimatedTime( eta );
}
final PacketMEInventoryUpdate a = new PacketMEInventoryUpdate( (byte) 0 );
@@ -195,9 +194,9 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
for( final IAEItemStack out : this.list )
{
a.appendItem( this.monitor.getItemStack( out, CraftingItemList.STORAGE ) );
b.appendItem( this.monitor.getItemStack( out, CraftingItemList.ACTIVE ) );
c.appendItem( this.monitor.getItemStack( out, CraftingItemList.PENDING ) );
a.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.STORAGE ) );
b.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.ACTIVE ) );
c.appendItem( this.getMonitor().getItemStack( out, CraftingItemList.PENDING ) );
}
this.list.resetStatus();
@@ -265,4 +264,34 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
{
return this.cpuName != null && this.cpuName.length() > 0;
}
public long getEstimatedTime()
{
return this.eta;
}
private void setEstimatedTime( final long eta )
{
this.eta = eta;
}
CraftingCPUCluster getMonitor()
{
return this.monitor;
}
private void setMonitor( final CraftingCPUCluster monitor )
{
this.monitor = monitor;
}
IGrid getNetwork()
{
return this.network;
}
private void setNetwork( final IGrid network )
{
this.network = network;
}
}
@@ -21,6 +21,7 @@ package appeng.container.implementations;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import net.minecraft.entity.player.InventoryPlayer;
import appeng.api.networking.crafting.ICraftingCPU;
@@ -34,7 +35,7 @@ import com.google.common.collect.ImmutableSet;
public class ContainerCraftingStatus extends ContainerCraftingCPU
{
public final ArrayList<CraftingCPURecord> cpus = new ArrayList<CraftingCPURecord>();
private final List<CraftingCPURecord> cpus = new ArrayList<CraftingCPURecord>();
@GuiSync( 5 )
public int selectedCpu = -1;
@GuiSync( 6 )
@@ -50,7 +51,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
@Override
public void detectAndSendChanges()
{
final ICraftingGrid cc = this.network.getCache( ICraftingGrid.class );
final ICraftingGrid cc = this.getNetwork().getCache( ICraftingGrid.class );
final ImmutableSet<ICraftingCPU> cpuSet = cc.getCpus();
int matches = 0;
@@ -60,7 +61,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
boolean found = false;
for( final CraftingCPURecord ccr : this.cpus )
{
if( ccr.cpu == c )
if( ccr.getCpu() == c )
{
found = true;
}
@@ -114,7 +115,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
}
else if( this.selectedCpu != -1 )
{
this.myName = this.cpus.get( this.selectedCpu ).myName;
this.myName = this.cpus.get( this.selectedCpu ).getName();
}
if( this.selectedCpu == -1 && this.cpus.size() > 0 )
@@ -124,9 +125,9 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
if( this.selectedCpu != -1 )
{
if( this.cpus.get( this.selectedCpu ).cpu != this.monitor )
if( this.cpus.get( this.selectedCpu ).getCpu() != this.getMonitor() )
{
this.setCPU( this.cpus.get( this.selectedCpu ).cpu );
this.setCPU( this.cpus.get( this.selectedCpu ).getCpu() );
}
}
else
@@ -167,8 +168,8 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
}
else
{
this.myName = this.cpus.get( this.selectedCpu ).myName;
this.setCPU( this.cpus.get( this.selectedCpu ).cpu );
this.myName = this.cpus.get( this.selectedCpu ).getName();
this.setCPU( this.cpus.get( this.selectedCpu ).getCpu() );
}
}
}
@@ -38,10 +38,10 @@ import appeng.tile.inventory.InvOperation;
public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IContainerCraftingPacket
{
public final PartCraftingTerminal ct;
final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 );
final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
final SlotCraftingTerm outputSlot;
private final PartCraftingTerminal ct;
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 );
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
private final SlotCraftingTerm outputSlot;
public ContainerCraftingTerm( final InventoryPlayer ip, final ITerminalHost monitorable )
{
@@ -58,7 +58,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
}
}
this.addSlotToContainer( this.outputSlot = new SlotCraftingTerm( this.getPlayerInv().player, this.mySrc, this.powerSrc, monitorable, crafting, crafting, this.output, 131, -72 + 18, this ) );
this.addSlotToContainer( this.outputSlot = new SlotCraftingTerm( this.getPlayerInv().player, this.getActionSource(), this.getPowerSource(), monitorable, crafting, crafting, this.output, 131, -72 + 18, this ) );
this.bindPlayerInventory( ip, 0, 0 );
@@ -99,7 +99,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
{
if( name.equals( "player" ) )
{
return this.invPlayer;
return this.getInventoryPlayer();
}
return this.ct.getInventoryByName( name );
}
@@ -28,18 +28,15 @@ import appeng.tile.storage.TileDrive;
public class ContainerDrive extends AEBaseContainer
{
final TileDrive drive;
public ContainerDrive( final InventoryPlayer ip, final TileDrive drive )
{
super( ip, drive, null );
this.drive = drive;
for( int y = 0; y < 5; y++ )
{
for( int x = 0; x < 2; x++ )
{
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, drive, x + y * 2, 71 + x * 18, 14 + y * 18, this.invPlayer ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, drive, x + y * 2, 71 + x * 18, 14 + y * 18, this.getInventoryPlayer() ) );
}
}
@@ -37,15 +37,12 @@ import appeng.util.Platform;
public class ContainerFormationPlane extends ContainerUpgradeable
{
final PartFormationPlane storageBus;
@GuiSync( 6 )
public YesNo placeMode;
public ContainerFormationPlane( final InventoryPlayer ip, final PartFormationPlane te )
{
super( ip, te );
this.storageBus = te;
}
@Override
@@ -60,7 +57,7 @@ public class ContainerFormationPlane extends ContainerUpgradeable
final int xo = 8;
final int yo = 23 + 6;
final IInventory config = this.upgradeable.getInventoryByName( "config" );
final IInventory config = this.getUpgradeable().getInventoryByName( "config" );
for( int y = 0; y < 7; y++ )
{
for( int x = 0; x < 9; x++ )
@@ -76,12 +73,12 @@ public class ContainerFormationPlane extends ContainerUpgradeable
}
}
final 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() );
final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ).setNotDraggable() );
}
@Override
@@ -103,8 +100,8 @@ public class ContainerFormationPlane extends ContainerUpgradeable
if( Platform.isServer() )
{
this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE );
this.placeMode = (YesNo) this.upgradeable.getConfigManager().getSetting( Settings.PLACE_BLOCK );
this.setFuzzyMode( (FuzzyMode) this.getUpgradeable().getConfigManager().getSetting( Settings.FUZZY_MODE ) );
this.setPlaceMode( (YesNo) this.getUpgradeable().getConfigManager().getSetting( Settings.PLACE_BLOCK ) );
}
this.standardDetectAndSendChanges();
@@ -113,8 +110,18 @@ public class ContainerFormationPlane extends ContainerUpgradeable
@Override
public boolean isSlotEnabled( final int idx )
{
final int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
final int upgrades = this.getUpgradeable().getInstalledUpgrades( Upgrades.CAPACITY );
return upgrades > idx;
}
public YesNo getPlaceMode()
{
return this.placeMode;
}
private void setPlaceMode( final YesNo placeMode )
{
this.placeMode = placeMode;
}
}
@@ -30,16 +30,13 @@ import appeng.tile.grindstone.TileGrinder;
public class ContainerGrinder extends AEBaseContainer
{
final TileGrinder grinder;
public ContainerGrinder( final InventoryPlayer ip, final TileGrinder grinder )
{
super( ip, grinder, null );
this.grinder = grinder;
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 ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 0, 12, 17, this.getInventoryPlayer() ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 1, 12 + 18, 17, this.getInventoryPlayer() ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ORE, grinder, 2, 12 + 36, 17, this.getInventoryPlayer() ) );
this.addSlotToContainer( new SlotInaccessible( grinder, 6, 80, 40 ) );
@@ -36,8 +36,6 @@ import appeng.util.Platform;
public class ContainerIOPort extends ContainerUpgradeable
{
final TileIOPort ioPort;
@GuiSync( 2 )
public FullnessMode fMode = FullnessMode.EMPTY;
@GuiSync( 3 )
@@ -46,7 +44,6 @@ public class ContainerIOPort extends ContainerUpgradeable
public ContainerIOPort( final InventoryPlayer ip, final TileIOPort te )
{
super( ip, te );
this.ioPort = te;
}
@Override
@@ -61,13 +58,13 @@ public class ContainerIOPort extends ContainerUpgradeable
int offX = 19;
int offY = 17;
final IInventory cells = this.upgradeable.getInventoryByName( "cells" );
final IInventory cells = this.getUpgradeable().getInventoryByName( "cells" );
for( int y = 0; y < 3; y++ )
{
for( int x = 0; x < 2; x++ )
{
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.invPlayer ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, cells, x + y * 2, offX + x * 18, offY + y * 18, this.getInventoryPlayer() ) );
}
}
@@ -81,10 +78,10 @@ public class ContainerIOPort extends ContainerUpgradeable
}
}
final 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() );
final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() );
}
@Override
@@ -106,11 +103,31 @@ public class ContainerIOPort extends ContainerUpgradeable
if( Platform.isServer() )
{
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 );
this.setOperationMode( (OperationMode) this.getUpgradeable().getConfigManager().getSetting( Settings.OPERATION_MODE ) );
this.setFullMode( (FullnessMode) this.getUpgradeable().getConfigManager().getSetting( Settings.FULLNESS_MODE ) );
this.setRedStoneMode( (RedstoneMode) this.getUpgradeable().getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ) );
}
this.standardDetectAndSendChanges();
}
public FullnessMode getFullMode()
{
return this.fMode;
}
private void setFullMode( final FullnessMode fMode )
{
this.fMode = fMode;
}
public OperationMode getOperationMode()
{
return this.opMode;
}
private void setOperationMode( final OperationMode opMode )
{
this.opMode = opMode;
}
}
@@ -42,11 +42,11 @@ import appeng.util.Platform;
public class ContainerInscriber extends ContainerUpgradeable implements IProgressProvider
{
final TileInscriber ti;
private final TileInscriber ti;
final Slot top;
final Slot middle;
final Slot bottom;
private final Slot top;
private final Slot middle;
private final Slot bottom;
@GuiSync( 2 )
public int maxProcessingTime = -1;
@@ -59,9 +59,9 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
super( ip, te );
this.ti = te;
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 ) );
this.addSlotToContainer( this.top = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, this.ti, 0, 45, 16, this.getInventoryPlayer() ) );
this.addSlotToContainer( this.bottom = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_PLATE, this.ti, 1, 45, 62, this.getInventoryPlayer() ) );
this.addSlotToContainer( this.middle = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.INSCRIBER_INPUT, this.ti, 2, 63, 39, this.getInventoryPlayer() ) );
this.addSlotToContainer( new SlotOutput( this.ti, 3, 113, 40, -1 ) );
}
@@ -99,8 +99,8 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
if( Platform.isServer() )
{
this.maxProcessingTime = this.ti.maxProcessingTime;
this.processingTime = this.ti.processingTime;
this.maxProcessingTime = this.ti.getMaxProcessingTime();
this.processingTime = this.ti.getProcessingTime();
}
}
@@ -35,7 +35,7 @@ import appeng.helpers.IInterfaceHost;
public class ContainerInterface extends ContainerUpgradeable
{
final DualityInterface myDuality;
private final DualityInterface myDuality;
@GuiSync( 3 )
public YesNo bMode = YesNo.NO;
@@ -51,7 +51,7 @@ public class ContainerInterface extends ContainerUpgradeable
for( int x = 0; x < DualityInterface.NUMBER_OF_PATTERN_SLOTS; x++ )
{
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, this.myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7, this.invPlayer ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, this.myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7, this.getInventoryPlayer() ) );
}
for( int x = 0; x < DualityInterface.NUMBER_OF_CONFIG_SLOTS; x++ )
@@ -93,7 +93,27 @@ public class ContainerInterface extends ContainerUpgradeable
@Override
protected void loadSettingsFromHost( final IConfigManager cm )
{
this.bMode = (YesNo) cm.getSetting( Settings.BLOCK );
this.iTermMode = (YesNo) cm.getSetting( Settings.INTERFACE_TERMINAL );
this.setBlockingMode( (YesNo) cm.getSetting( Settings.BLOCK ) );
this.setInterfaceTerminalMode( (YesNo) cm.getSetting( Settings.INTERFACE_TERMINAL ) );
}
public YesNo getBlockingMode()
{
return this.bMode;
}
private void setBlockingMode( final YesNo bMode )
{
this.bMode = bMode;
}
public YesNo getInterfaceTerminalMode()
{
return this.iTermMode;
}
private void setInterfaceTerminalMode( final YesNo iTermMode )
{
this.iTermMode = iTermMode;
}
}
@@ -61,10 +61,10 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
*/
private static long autoBase = Long.MIN_VALUE;
final Map<IInterfaceHost, InvTracker> diList = new HashMap<IInterfaceHost, InvTracker>();
final Map<Long, InvTracker> byId = new HashMap<Long, InvTracker>();
IGrid grid;
NBTTagCompound data = new NBTTagCompound();
private final Map<IInterfaceHost, InvTracker> diList = new HashMap<IInterfaceHost, InvTracker>();
private final Map<Long, InvTracker> byId = new HashMap<Long, InvTracker>();
private IGrid grid;
private NBTTagCompound data = new NBTTagCompound();
public ContainerInterfaceTerminal( final InventoryPlayer ip, final PartInterfaceTerminal anchor )
{
@@ -400,14 +400,14 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
data.setTag( name, tag );
}
static class InvTracker
private static class InvTracker
{
public final long sortBy;
final long which = autoBase++;
final String unlocalizedName;
final IInventory client;
final IInventory server;
private final long sortBy;
private final long which = autoBase++;
private final String unlocalizedName;
private final IInventory client;
private final IInventory server;
public InvTracker( final DualityInterface dual, final IInventory patterns, final String unlocalizedName )
{
@@ -418,7 +418,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
}
}
static class PatternInvSlot extends WrapperInvSlot
private static class PatternInvSlot extends WrapperInvSlot
{
public PatternInvSlot( final IInventory inv )
@@ -41,10 +41,10 @@ import appeng.util.Platform;
public class ContainerLevelEmitter extends ContainerUpgradeable
{
final PartLevelEmitter lvlEmitter;
private final PartLevelEmitter lvlEmitter;
@SideOnly( Side.CLIENT )
public GuiTextField textField;
private GuiTextField textField;
@GuiSync( 2 )
public LevelType lvType;
@GuiSync( 3 )
@@ -74,26 +74,25 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
@Override
protected void setupConfig()
{
final IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" );
if( this.availableUpgrades() > 0 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 1 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 2 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 3 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() );
}
final IInventory inv = this.upgradeable.getInventoryByName( "config" );
final IInventory inv = this.getUpgradeable().getInventoryByName( "config" );
final int y = 40;
final int x = 80 + 44;
this.addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
@@ -120,10 +119,10 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
if( Platform.isServer() )
{
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 );
this.setCraftingMode( (YesNo) this.getUpgradeable().getConfigManager().getSetting( Settings.CRAFT_VIA_REDSTONE ) );
this.setLevelMode( (LevelType) this.getUpgradeable().getConfigManager().getSetting( Settings.LEVEL_TYPE ) );
this.setFuzzyMode( (FuzzyMode) this.getUpgradeable().getConfigManager().getSetting( Settings.FUZZY_MODE ) );
this.setRedStoneMode( (RedstoneMode) this.getUpgradeable().getConfigManager().getSetting( Settings.REDSTONE_EMITTER ) );
}
this.standardDetectAndSendChanges();
@@ -140,4 +139,26 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
}
}
}
@Override
public YesNo getCraftingMode()
{
return this.cmType;
}
@Override
public void setCraftingMode( final YesNo cmType )
{
this.cmType = cmType;
}
public LevelType getLevelMode()
{
return this.lvType;
}
private void setLevelMode( final LevelType lvType )
{
this.lvType = lvType;
}
}
@@ -41,7 +41,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
{
private static final int MAX_CRAFT_PROGRESS = 100;
final TileMolecularAssembler tma;
private final TileMolecularAssembler tma;
@GuiSync( 4 )
public int craftProgress = 0;
@@ -53,7 +53,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
public boolean isValidItemForSlot( final int slotIndex, final ItemStack i )
{
final IInventory mac = this.upgradeable.getInventoryByName( "mac" );
final IInventory mac = this.getUpgradeable().getInventoryByName( "mac" );
final ItemStack is = mac.getStackInSlot( 10 );
if( is == null )
@@ -87,7 +87,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
int offX = 29;
int offY = 30;
final IInventory mac = this.upgradeable.getInventoryByName( "mac" );
final IInventory mac = this.getUpgradeable().getInventoryByName( "mac" );
for( int y = 0; y < 3; y++ )
{
@@ -101,18 +101,18 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
offX = 126;
offY = 16;
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_CRAFTING_PATTERN, mac, 10, offX, offY, this.invPlayer ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_CRAFTING_PATTERN, mac, 10, offX, offY, this.getInventoryPlayer() ) );
this.addSlotToContainer( new SlotOutput( mac, 9, offX, offY + 32, -1 ) );
offX = 122;
offY = 17;
final 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() );
final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ).setNotDraggable() );
}
@Override
@@ -134,7 +134,7 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
if( Platform.isServer() )
{
this.rsMode = (RedstoneMode) this.upgradeable.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
this.setRedStoneMode( (RedstoneMode) this.getUpgradeable().getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ) );
}
this.craftProgress = this.tma.getCraftingProgress();
@@ -22,6 +22,8 @@ package appeng.container.implementations;
import java.io.IOException;
import java.nio.BufferOverflowException;
import javax.annotation.Nonnull;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
@@ -71,17 +73,17 @@ import appeng.util.Platform;
public class ContainerMEMonitorable extends AEBaseContainer implements IConfigManagerHost, IConfigurableObject, IMEMonitorHandlerReceiver<IAEItemStack>
{
public final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
final IMEMonitor<IAEItemStack> monitor;
final IItemList<IAEItemStack> items = AEApi.instance().storage().createItemList();
final IConfigManager clientCM;
private final SlotRestrictedInput[] cellView = new SlotRestrictedInput[5];
private final IMEMonitor<IAEItemStack> monitor;
private final IItemList<IAEItemStack> items = AEApi.instance().storage().createItemList();
private final IConfigManager clientCM;
private final ITerminalHost host;
@GuiSync( 99 )
public boolean canAccessViewCells = false;
@GuiSync( 98 )
public boolean hasPower = false;
public IConfigManagerHost gui;
IConfigManager serverCM;
private IConfigManagerHost gui;
private IConfigManager serverCM;
private IGridNode networkNode;
public ContainerMEMonitorable( final InventoryPlayer ip, final ITerminalHost monitorable )
@@ -109,15 +111,15 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
{
this.monitor.addListener( this, null );
this.cellInv = this.monitor;
this.setCellInventory( this.monitor );
if( monitorable instanceof IPortableCell )
{
this.powerSrc = (IEnergySource) monitorable;
this.setPowerSource( (IEnergySource) monitorable );
}
else if( monitorable instanceof IMEChest )
{
this.powerSrc = (IEnergySource) monitorable;
this.setPowerSource( (IEnergySource) monitorable );
}
else if( monitorable instanceof IGridHost )
{
@@ -128,14 +130,14 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
final IGrid g = node.getGrid();
if( g != null )
{
this.powerSrc = new ChannelPowerSrc( this.networkNode, (IEnergySource) g.getCache( IEnergyGrid.class ) );
this.setPowerSource( new ChannelPowerSrc( this.networkNode, (IEnergySource) g.getCache( IEnergyGrid.class ) ) );
}
}
}
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
else
@@ -148,8 +150,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
{
for( int y = 0; y < 5; 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.cellView[y] = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.VIEW_CELL, ( (IViewCellStorage) monitorable ).getViewCellStorage(), y, 206, y * 18 + 8, this.getInventoryPlayer() );
this.cellView[y].setAllowEdit( this.canAccessViewCells );
this.addSlotToContainer( this.cellView[y] );
}
}
@@ -172,7 +174,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
{
if( this.monitor != this.host.getItemInventory() )
{
this.isContainerValid = false;
this.setValidContainer( false );
}
for( final Settings set : this.serverCM.getSettings() )
@@ -248,7 +250,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
{
if( this.cellView[y] != null )
{
this.cellView[y].allowEdit = this.canAccessViewCells;
this.cellView[y].setAllowEdit( this.canAccessViewCells );
}
}
}
@@ -263,15 +265,15 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
{
if( this.networkNode != null )
{
this.hasPower = this.networkNode.isActive();
this.setPowered( this.networkNode.isActive() );
}
else if( this.powerSrc instanceof IEnergyGrid )
else if( this.getPowerSource() instanceof IEnergyGrid )
{
this.hasPower = ( (IEnergyGrid) this.powerSrc ).isNetworkPowered();
this.setPowered( ( (IEnergyGrid) this.getPowerSource() ).isNetworkPowered() );
}
else
{
this.hasPower = this.powerSrc.extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8;
this.setPowered( this.getPowerSource().extractAEPower( 1, Actionable.SIMULATE, PowerMultiplier.CONFIG ) > 0.8 );
}
}
catch( final Throwable t )
@@ -289,7 +291,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
{
if( this.cellView[y] != null )
{
this.cellView[y].allowEdit = this.canAccessViewCells;
this.cellView[y].setAllowEdit( this.canAccessViewCells );
}
}
}
@@ -305,7 +307,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
this.queueInventory( c );
}
public void queueInventory( final ICrafting c )
private void queueInventory( final ICrafting c )
{
if( Platform.isServer() && c instanceof EntityPlayer && this.monitor != null )
{
@@ -390,9 +392,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
@Override
public void updateSetting( final IConfigManager manager, final Enum settingName, final Enum newValue )
{
if( this.gui != null )
if( this.getGui() != null )
{
this.gui.updateSetting( manager, settingName, newValue );
this.getGui().updateSetting( manager, settingName, newValue );
}
}
@@ -417,4 +419,29 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
return list;
}
public SlotRestrictedInput getCellViewSlot( final int index )
{
return this.cellView[index];
}
public boolean isPowered()
{
return this.hasPower;
}
private void setPowered( final boolean isPowered )
{
this.hasPower = isPowered;
}
private IConfigManagerHost getGui()
{
return this.gui;
}
public void setGui( @Nonnull final IConfigManagerHost gui )
{
this.gui = gui;
}
}
@@ -31,7 +31,7 @@ import appeng.util.Platform;
public class ContainerMEPortableCell extends ContainerMEMonitorable
{
public double powerMultiplier = 0.5;
private double powerMultiplier = 0.5;
private final IPortableCell civ;
private int ticks = 0;
@@ -72,27 +72,37 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
// drain 1 ae t
this.ticks++;
if( this.ticks > 10 )
{
this.civ.extractAEPower( this.powerMultiplier * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG );
this.civ.extractAEPower( this.getPowerMultiplier() * this.ticks, Actionable.MODULATE, PowerMultiplier.CONFIG );
this.ticks = 0;
}
super.detectAndSendChanges();
}
private double getPowerMultiplier()
{
return this.powerMultiplier;
}
void setPowerMultiplier( final double powerMultiplier )
{
this.powerMultiplier = powerMultiplier;
}
}
@@ -54,8 +54,8 @@ public class ContainerNetworkStatus extends AEBaseContainer
public long currentPower;
@GuiSync( 3 )
public long maxPower;
IGrid network;
int delay = 40;
private IGrid network;
private int delay = 40;
public ContainerNetworkStatus( final InventoryPlayer ip, final INetworkTool te )
{
@@ -73,7 +73,7 @@ public class ContainerNetworkStatus extends AEBaseContainer
if( this.network == null && Platform.isServer() )
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
@@ -100,10 +100,10 @@ public class ContainerNetworkStatus extends AEBaseContainer
final IEnergyGrid eg = this.network.getCache( IEnergyGrid.class );
if( eg != null )
{
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() );
this.setAverageAddition( (long) ( 100.0 * eg.getAvgPowerInjection() ) );
this.setPowerUsage( (long) ( 100.0 * eg.getAvgPowerUsage() ) );
this.setCurrentPower( (long) ( 100.0 * eg.getStoredPower() ) );
this.setMaxPower( (long) ( 100.0 * eg.getMaxStoredPower() ) );
}
try
@@ -147,4 +147,44 @@ public class ContainerNetworkStatus extends AEBaseContainer
}
super.detectAndSendChanges();
}
public long getCurrentPower()
{
return this.currentPower;
}
private void setCurrentPower( final long currentPower )
{
this.currentPower = currentPower;
}
public long getMaxPower()
{
return this.maxPower;
}
private void setMaxPower( final long maxPower )
{
this.maxPower = maxPower;
}
public long getAverageAddition()
{
return this.avgAddition;
}
private void setAverageAddition( final long avgAddition )
{
this.avgAddition = avgAddition;
}
public long getPowerUsage()
{
return this.powerUsage;
}
private void setPowerUsage( final long powerUsage )
{
this.powerUsage = powerUsage;
}
}
@@ -32,7 +32,7 @@ import appeng.util.Platform;
public class ContainerNetworkTool extends AEBaseContainer
{
final INetworkTool toolInv;
private final INetworkTool toolInv;
@GuiSync( 1 )
public boolean facadeMode;
@@ -48,7 +48,7 @@ public class ContainerNetworkTool extends AEBaseContainer
{
for( int x = 0; x < 3; x++ )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, te, y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, this.invPlayer ) ) );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, te, y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, this.getInventoryPlayer() ) ) );
}
}
@@ -77,21 +77,31 @@ public class ContainerNetworkTool extends AEBaseContainer
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
if( this.isContainerValid )
if( this.isValidContainer() )
{
final NBTTagCompound data = Platform.openNbtData( currentItem );
this.facadeMode = data.getBoolean( "hideFacades" );
this.setFacadeMode( data.getBoolean( "hideFacades" ) );
}
super.detectAndSendChanges();
}
public boolean isFacadeMode()
{
return this.facadeMode;
}
private void setFacadeMode( final boolean facadeMode )
{
this.facadeMode = facadeMode;
}
}
@@ -69,7 +69,7 @@ import appeng.util.item.AEItemStack;
public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket
{
public final PartPatternTerminal ct;
private final PartPatternTerminal patternTerminal;
private final AppEngInternalInventory cOut = new AppEngInternalInventory( null, 1 );
private final IInventory crafting;
private final SlotFakeCraftingMatrix[] craftingSlots = new SlotFakeCraftingMatrix[9];
@@ -85,12 +85,12 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
public ContainerPatternTerm( final InventoryPlayer ip, final ITerminalHost monitorable )
{
super( ip, monitorable, false );
this.ct = (PartPatternTerminal) monitorable;
this.patternTerminal = (PartPatternTerminal) monitorable;
final IInventory patternInv = this.ct.getInventoryByName( "pattern" );
final IInventory output = this.ct.getInventoryByName( "output" );
final IInventory patternInv = this.getPatternTerminal().getInventoryByName( "pattern" );
final IInventory output = this.getPatternTerminal().getInventoryByName( "output" );
this.crafting = this.ct.getInventoryByName( "crafting" );
this.crafting = this.getPatternTerminal().getInventoryByName( "crafting" );
for( int y = 0; y < 3; y++ )
{
@@ -100,18 +100,18 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
}
}
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;
this.addSlotToContainer( this.craftSlot = new SlotPatternTerm( ip.player, this.getActionSource(), this.getPowerSource(), monitorable, this.crafting, patternInv, this.cOut, 110, -76 + 18, this, 2, this ) );
this.craftSlot.setIIcon( -1 );
for( int y = 0; y < 3; y++ )
{
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;
this.outputSlots[y].setRenderDisabled( false );
this.outputSlots[y].setIIcon( -1 );
}
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 ) );
this.addSlotToContainer( this.patternSlotIN = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, this.getInventoryPlayer() ) );
this.addSlotToContainer( this.patternSlotOUT = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34, this.getInventoryPlayer() ) );
this.patternSlotOUT.setStackLimit( 1 );
@@ -121,18 +121,18 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
private void updateOrderOfOutputSlots()
{
if( !this.craftingMode )
if( !this.isCraftingMode() )
{
this.craftSlot.xDisplayPosition = -9000;
for( int y = 0; y < 3; y++ )
{
this.outputSlots[y].xDisplayPosition = this.outputSlots[y].defX;
this.outputSlots[y].xDisplayPosition = this.outputSlots[y].getX();
}
}
else
{
this.craftSlot.xDisplayPosition = this.craftSlot.defX;
this.craftSlot.xDisplayPosition = this.craftSlot.getX();
for( int y = 0; y < 3; y++ )
{
@@ -155,7 +155,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
this.getAndUpdateOutput();
}
public ItemStack getAndUpdateOutput()
private ItemStack getAndUpdateOutput()
{
final InventoryCrafting ic = new InventoryCrafting( this, 3, 3 );
@@ -240,8 +240,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
encodedValue.setTag( "in", tagIn );
encodedValue.setTag( "out", tagOut );
encodedValue.setBoolean( "crafting", this.craftingMode );
encodedValue.setBoolean( "substitute", this.substitute );
encodedValue.setBoolean( "crafting", this.isCraftingMode() );
encodedValue.setBoolean( "substitute", this.isSubstitute() );
output.setTagCompound( encodedValue );
}
@@ -270,7 +270,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
private ItemStack[] getOutputs()
{
if( this.craftingMode )
if( this.isCraftingMode() )
{
final ItemStack out = this.getAndUpdateOutput();
@@ -336,11 +336,11 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
if( idx == 1 )
{
return Platform.isServer() ? !this.ct.isCraftingRecipe() : !this.craftingMode;
return Platform.isServer() ? !this.getPatternTerminal().isCraftingRecipe() : !this.isCraftingMode();
}
else if( idx == 2 )
{
return Platform.isServer() ? this.ct.isCraftingRecipe() : this.craftingMode;
return Platform.isServer() ? this.getPatternTerminal().isCraftingRecipe() : this.isCraftingMode();
}
else
{
@@ -350,7 +350,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
public void craftOrGetItem( final PacketPatternSlot packetPatternSlot )
{
if( packetPatternSlot.slotItem != null && this.cellInv != null )
if( packetPatternSlot.slotItem != null && this.getCellInventory() != null )
{
final IAEItemStack out = packetPatternSlot.slotItem.copy();
InventoryAdaptor inv = new AdaptorPlayerHand( this.getPlayerInv().player );
@@ -366,7 +366,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
return;
}
final IAEItemStack extracted = Platform.poweredExtraction( this.powerSrc, this.cellInv, out, this.mySrc );
final IAEItemStack extracted = Platform.poweredExtraction( this.getPowerSource(), this.getCellInventory(), out, this.getActionSource() );
final EntityPlayer p = this.getPlayerInv().player;
if( extracted != null )
@@ -395,7 +395,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
return;
}
final IMEMonitor<IAEItemStack> storage = this.ct.getItemInventory();
final IMEMonitor<IAEItemStack> storage = this.getPatternTerminal().getItemInventory();
final IItemList<IAEItemStack> all = storage.getStorageList();
final ItemStack is = r.getCraftingResult( ic );
@@ -404,7 +404,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
if( ic.getStackInSlot( x ) != null )
{
final 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() ) );
final ItemStack pulled = Platform.extractItemsByRecipe( this.getPowerSource(), this.getActionSource(), storage, p.worldObj, r, is, ic, ic.getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.getViewCells() ) );
real.setInventorySlotContents( x, pulled );
}
}
@@ -440,7 +440,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
final ItemStack failed = real.getStackInSlot( x );
if( failed != null )
{
this.cellInv.injectItems( AEItemStack.create( failed ), Actionable.MODULATE, new MachineSource( this.ct ) );
this.getCellInventory().injectItems( AEItemStack.create( failed ), Actionable.MODULATE, new MachineSource( this.getPatternTerminal() ) );
}
}
}
@@ -453,13 +453,13 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
super.detectAndSendChanges();
if( Platform.isServer() )
{
if( this.craftingMode != this.ct.isCraftingRecipe() )
if( this.isCraftingMode() != this.getPatternTerminal().isCraftingRecipe() )
{
this.craftingMode = this.ct.isCraftingRecipe();
this.setCraftingMode( this.getPatternTerminal().isCraftingRecipe() );
this.updateOrderOfOutputSlots();
}
this.substitute = this.ct.isSubstitution();
this.substitute = this.patternTerminal.isSubstitution();
}
}
@@ -519,9 +519,9 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
if( name.equals( "player" ) )
{
return this.invPlayer;
return this.getInventoryPlayer();
}
return this.ct.getInventoryByName( name );
return this.getPatternTerminal().getInventoryByName( name );
}
@Override
@@ -537,4 +537,29 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
this.detectAndSendChanges();
this.getAndUpdateOutput();
}
public boolean isCraftingMode()
{
return this.craftingMode;
}
private void setCraftingMode( final boolean craftingMode )
{
this.craftingMode = craftingMode;
}
public PartPatternTerminal getPatternTerminal()
{
return this.patternTerminal;
}
private boolean isSubstitute()
{
return this.substitute;
}
public void setSubstitute( final boolean substitute )
{
this.substitute = substitute;
}
}
@@ -36,10 +36,10 @@ import appeng.util.Platform;
public class ContainerPriority extends AEBaseContainer
{
final IPriorityHost priHost;
private final IPriorityHost priHost;
@SideOnly( Side.CLIENT )
public GuiTextField textField;
private GuiTextField textField;
@GuiSync( 2 )
public long PriorityValue = -1;
@@ -28,14 +28,11 @@ import appeng.tile.qnb.TileQuantumBridge;
public class ContainerQNB extends AEBaseContainer
{
final TileQuantumBridge quantumBridge;
public ContainerQNB( final InventoryPlayer ip, final TileQuantumBridge quantumBridge )
{
super( ip, quantumBridge, null );
this.quantumBridge = quantumBridge;
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge, 0, 80, 37, this.invPlayer ) ).setStackLimit( 1 ) );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge, 0, 80, 37, this.getInventoryPlayer() ) ).setStackLimit( 1 ) );
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
}
@@ -41,20 +41,23 @@ import appeng.util.Platform;
public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngInventory, IInventory
{
final QuartzKnifeObj toolInv;
private final QuartzKnifeObj toolInv;
final AppEngInternalInventory inSlot = new AppEngInternalInventory( this, 1 );
final SlotRestrictedInput metals;
final QuartzKnifeOutput output;
String myName = "";
private final AppEngInternalInventory inSlot = new AppEngInternalInventory( this, 1 );
private final SlotRestrictedInput metals;
private final QuartzKnifeOutput output;
private String myName = "";
public ContainerQuartzKnife( final InventoryPlayer ip, final QuartzKnifeObj te )
{
super( ip, null, null );
this.toolInv = te;
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 ) );
this.metals = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.METAL_INGOTS, this.inSlot, 0, 94, 44, ip );
this.addSlotToContainer( this.metals );
this.output = new QuartzKnifeOutput( this, 0, 134, 44, -1 );
this.addSlotToContainer( this.output );
this.lockPlayerInventorySlot( ip.currentItem );
@@ -81,12 +84,12 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
@@ -42,16 +42,16 @@ import appeng.tile.misc.TileSecurity;
public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppEngInventory
{
final SlotRestrictedInput configSlot;
private final SlotRestrictedInput configSlot;
final AppEngInternalInventory wirelessEncoder = new AppEngInternalInventory( this, 2 );
private final AppEngInternalInventory wirelessEncoder = new AppEngInternalInventory( this, 2 );
final SlotRestrictedInput wirelessIn;
final SlotOutput wirelessOut;
private final SlotRestrictedInput wirelessIn;
private final SlotOutput wirelessOut;
final TileSecurity securityBox;
private final TileSecurity securityBox;
@GuiSync( 0 )
public int security = 0;
public int permissionMode = 0;
public ContainerSecurity( final InventoryPlayer ip, final ITerminalHost monitorable )
{
@@ -59,7 +59,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
this.securityBox = (TileSecurity) monitorable;
this.addSlotToContainer( this.configSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, this.securityBox.configSlot, 0, 37, -33, ip ) );
this.addSlotToContainer( this.configSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.BIOMETRIC_CARD, this.securityBox.getConfigSlot(), 0, 37, -33, ip ) );
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 ) );
@@ -98,7 +98,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
{
this.verifyPermissions( SecurityPermissions.SECURITY, false );
this.security = 0;
this.setPermissionMode( 0 );
final ItemStack a = this.configSlot.getStack();
if( a != null && a.getItem() instanceof IBiometricCard )
@@ -107,7 +107,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
for( final SecurityPermissions sp : bc.getPermissions( a ) )
{
this.security |= ( 1 << sp.ordinal() );
this.setPermissionMode( this.getPermissionMode() | ( 1 << sp.ordinal() ) );
}
}
@@ -161,7 +161,7 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
if( networkEncodable != null )
{
networkEncodable.setEncryptionKey( term, String.valueOf( this.securityBox.securityKey ), "" );
networkEncodable.setEncryptionKey( term, String.valueOf( this.securityBox.getSecurityKey() ), "" );
this.wirelessIn.putStack( null );
this.wirelessOut.putStack( term );
@@ -177,4 +177,14 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE
}
}
}
public int getPermissionMode()
{
return this.permissionMode;
}
private void setPermissionMode( final int permissionMode )
{
this.permissionMode = permissionMode;
}
}
@@ -31,7 +31,7 @@ import appeng.tile.storage.TileSkyChest;
public class ContainerSkyChest extends AEBaseContainer
{
final TileSkyChest chest;
private final TileSkyChest chest;
public ContainerSkyChest( final InventoryPlayer ip, final TileSkyChest chest )
{
@@ -36,7 +36,6 @@ import appeng.util.Platform;
public class ContainerSpatialIOPort extends AEBaseContainer
{
final TileSpatialIOPort spatialIOPort;
@GuiSync( 0 )
public long currentPower;
@GuiSync( 1 )
@@ -45,20 +44,19 @@ public class ContainerSpatialIOPort extends AEBaseContainer
public long reqPower;
@GuiSync( 3 )
public long eff;
IGrid network;
int delay = 40;
private IGrid network;
private int delay = 40;
public ContainerSpatialIOPort( final InventoryPlayer ip, final TileSpatialIOPort spatialIOPort )
{
super( ip, spatialIOPort, null );
this.spatialIOPort = spatialIOPort;
if( Platform.isServer() )
{
this.network = spatialIOPort.getGridNode( AEPartLocation.INTERNAL ).getGrid();
}
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS, spatialIOPort, 0, 52, 48, this.invPlayer ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS, spatialIOPort, 0, 52, 48, this.getInventoryPlayer() ) );
this.addSlotToContainer( new SlotOutput( spatialIOPort, 1, 113, 48, SlotRestrictedInput.PlacableItemType.SPATIAL_STORAGE_CELLS.IIcon ) );
this.bindPlayerInventory( ip, 0, 197 - /* height of player inventory */82 );
@@ -80,14 +78,54 @@ public class ContainerSpatialIOPort extends AEBaseContainer
final ISpatialCache sc = this.network.getCache( ISpatialCache.class );
if( eg != null )
{
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() );
this.setCurrentPower( (long) ( 100.0 * eg.getStoredPower() ) );
this.setMaxPower( (long) ( 100.0 * eg.getMaxStoredPower() ) );
this.setRequiredPower( (long) ( 100.0 * sc.requiredPower() ) );
this.setEfficency( (long) ( 100.0f * sc.currentEfficiency() ) );
}
}
}
super.detectAndSendChanges();
}
public long getCurrentPower()
{
return this.currentPower;
}
private void setCurrentPower( final long currentPower )
{
this.currentPower = currentPower;
}
public long getMaxPower()
{
return this.maxPower;
}
private void setMaxPower( final long maxPower )
{
this.maxPower = maxPower;
}
public long getRequiredPower()
{
return this.reqPower;
}
private void setRequiredPower( final long reqPower )
{
this.reqPower = reqPower;
}
public long getEfficency()
{
return this.eff;
}
private void setEfficency( final long eff )
{
this.eff = eff;
}
}
@@ -46,7 +46,7 @@ import appeng.util.iterators.NullIterator;
public class ContainerStorageBus extends ContainerUpgradeable
{
final PartStorageBus storageBus;
private final PartStorageBus storageBus;
@GuiSync( 3 )
public AccessRestriction rwMode = AccessRestriction.READ_WRITE;
@@ -72,7 +72,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
final int xo = 8;
final int yo = 23 + 6;
final IInventory config = this.upgradeable.getInventoryByName( "config" );
final IInventory config = this.getUpgradeable().getInventoryByName( "config" );
for( int y = 0; y < 7; y++ )
{
for( int x = 0; x < 9; x++ )
@@ -88,12 +88,12 @@ public class ContainerStorageBus extends ContainerUpgradeable
}
}
final 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() );
final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, this.getInventoryPlayer() ) ).setNotDraggable() );
}
@Override
@@ -115,9 +115,9 @@ public class ContainerStorageBus extends ContainerUpgradeable
if( Platform.isServer() )
{
this.fzMode = (FuzzyMode) this.upgradeable.getConfigManager().getSetting( Settings.FUZZY_MODE );
this.rwMode = (AccessRestriction) this.upgradeable.getConfigManager().getSetting( Settings.ACCESS );
this.storageFilter = (StorageFilter) this.upgradeable.getConfigManager().getSetting( Settings.STORAGE_FILTER );
this.setFuzzyMode( (FuzzyMode) this.getUpgradeable().getConfigManager().getSetting( Settings.FUZZY_MODE ) );
this.setReadWriteMode( (AccessRestriction) this.getUpgradeable().getConfigManager().getSetting( Settings.ACCESS ) );
this.setStorageFilter( (StorageFilter) this.getUpgradeable().getConfigManager().getSetting( Settings.STORAGE_FILTER ) );
}
this.standardDetectAndSendChanges();
@@ -126,14 +126,14 @@ public class ContainerStorageBus extends ContainerUpgradeable
@Override
public boolean isSlotEnabled( final int idx )
{
final int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
final int upgrades = this.getUpgradeable().getInstalledUpgrades( Upgrades.CAPACITY );
return upgrades > idx;
}
public void clear()
{
final IInventory inv = this.upgradeable.getInventoryByName( "config" );
final IInventory inv = this.getUpgradeable().getInventoryByName( "config" );
for( int x = 0; x < inv.getSizeInventory(); x++ )
{
inv.setInventorySlotContents( x, null );
@@ -143,7 +143,7 @@ public class ContainerStorageBus extends ContainerUpgradeable
public void partition()
{
final IInventory inv = this.upgradeable.getInventoryByName( "config" );
final IInventory inv = this.getUpgradeable().getInventoryByName( "config" );
final IMEInventory<IAEItemStack> cellInv = this.storageBus.getInternalHandler();
@@ -170,4 +170,24 @@ public class ContainerStorageBus extends ContainerUpgradeable
this.detectAndSendChanges();
}
public AccessRestriction getReadWriteMode()
{
return this.rwMode;
}
private void setReadWriteMode( final AccessRestriction rwMode )
{
this.rwMode = rwMode;
}
public StorageFilter getStorageFilter()
{
return this.storageFilter;
}
private void setStorageFilter( final StorageFilter storageFilter )
{
this.storageFilter = storageFilter;
}
}
@@ -52,7 +52,7 @@ import appeng.util.Platform;
public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSlotHost
{
final IUpgradeableHost upgradeable;
private final IUpgradeableHost upgradeable;
@GuiSync( 0 )
public RedstoneMode rsMode = RedstoneMode.IGNORE;
@GuiSync( 1 )
@@ -61,8 +61,8 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
public YesNo cMode = YesNo.NO;
@GuiSync( 6 )
public SchedulingMode schedulingMode = SchedulingMode.DEFAULT;
int tbSlot;
NetworkToolViewer tbInventory;
private int tbSlot;
private NetworkToolViewer tbInventory;
public ContainerUpgradeable( final InventoryPlayer ip, final IUpgradeableHost te )
{
@@ -111,7 +111,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
{
for( int u = 0; u < 3; u++ )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.tbInventory, u + v * 3, 186 + u * 18, this.getHeight() - 82 + v * 18, this.invPlayer ) ).setPlayerSide() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.tbInventory, u + v * 3, 186 + u * 18, this.getHeight() - 82 + v * 18, this.getInventoryPlayer() ) ).setPlayerSide() );
}
}
}
@@ -135,7 +135,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
{
this.setupUpgrades();
final IInventory inv = this.upgradeable.getInventoryByName( "config" );
final IInventory inv = this.getUpgradeable().getInventoryByName( "config" );
final int y = 40;
final int x = 80;
this.addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
@@ -156,22 +156,22 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
protected void setupUpgrades()
{
final IInventory upgrades = this.upgradeable.getInventoryByName( "upgrades" );
final IInventory upgrades = this.getUpgradeable().getInventoryByName( "upgrades" );
if( this.availableUpgrades() > 0 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 0, 187, 8, this.getInventoryPlayer() ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 1 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 1, 187, 8 + 18, this.getInventoryPlayer() ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 2 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, this.getInventoryPlayer() ) ).setNotDraggable() );
}
if( this.availableUpgrades() > 3 )
{
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.invPlayer ) ).setNotDraggable() );
this.addSlotToContainer( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, this.getInventoryPlayer() ) ).setNotDraggable() );
}
}
@@ -192,7 +192,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
if( Platform.isServer() )
{
final IConfigManager cm = this.upgradeable.getConfigManager();
final IConfigManager cm = this.getUpgradeable().getConfigManager();
this.loadSettingsFromHost( cm );
}
@@ -215,16 +215,16 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
protected void loadSettingsFromHost( final IConfigManager cm )
{
this.fzMode = (FuzzyMode) cm.getSetting( Settings.FUZZY_MODE );
this.rsMode = (RedstoneMode) cm.getSetting( Settings.REDSTONE_CONTROLLED );
if( this.upgradeable instanceof PartExportBus )
this.setFuzzyMode( (FuzzyMode) cm.getSetting( Settings.FUZZY_MODE ) );
this.setRedStoneMode( (RedstoneMode) cm.getSetting( Settings.REDSTONE_CONTROLLED ) );
if( this.getUpgradeable() instanceof PartExportBus )
{
this.cMode = (YesNo) cm.getSetting( Settings.CRAFT_ONLY );
this.schedulingMode = (SchedulingMode) cm.getSetting( Settings.SCHEDULING_MODE );
this.setCraftingMode( (YesNo) cm.getSetting( Settings.CRAFT_ONLY ) );
this.setSchedulingMode( (SchedulingMode) cm.getSetting( Settings.SCHEDULING_MODE ) );
}
}
public void checkToolbox()
private void checkToolbox()
{
if( this.hasToolbox() )
{
@@ -240,12 +240,12 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
else
{
this.isContainerValid = false;
this.setValidContainer( false );
}
}
}
@@ -259,7 +259,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
@Override
public boolean isSlotEnabled( final int idx )
{
final int upgrades = this.upgradeable.getInstalledUpgrades( Upgrades.CAPACITY );
final int upgrades = this.getUpgradeable().getInstalledUpgrades( Upgrades.CAPACITY );
if( idx == 1 && upgrades > 0 )
{
@@ -272,4 +272,49 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
return false;
}
public FuzzyMode getFuzzyMode()
{
return this.fzMode;
}
void setFuzzyMode( final FuzzyMode fzMode )
{
this.fzMode = fzMode;
}
public YesNo getCraftingMode()
{
return this.cMode;
}
public void setCraftingMode( final YesNo cMode )
{
this.cMode = cMode;
}
public RedstoneMode getRedStoneMode()
{
return this.rsMode;
}
void setRedStoneMode( final RedstoneMode rsMode )
{
this.rsMode = rsMode;
}
public SchedulingMode getSchedulingMode()
{
return this.schedulingMode;
}
private void setSchedulingMode( final SchedulingMode schedulingMode )
{
this.schedulingMode = schedulingMode;
}
IUpgradeableHost getUpgradeable()
{
return this.upgradeable;
}
}
@@ -32,8 +32,8 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr
{
private static final int MAX_BURN_TIME = 200;
public final int aePerTick = 5;
final TileVibrationChamber vibrationChamber;
private final int aePerTick = 5;
private final TileVibrationChamber vibrationChamber;
@GuiSync( 0 )
public int burnProgress = 0;
@GuiSync( 1 )
@@ -44,7 +44,7 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr
super( ip, vibrationChamber, null );
this.vibrationChamber = vibrationChamber;
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber, 0, 80, 37, this.invPlayer ) );
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber, 0, 80, 37, this.getInventoryPlayer() ) );
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
}
@@ -54,8 +54,8 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr
{
if( Platform.isServer() )
{
this.burnProgress = (int) ( this.vibrationChamber.maxBurnTime <= 0 ? 0 : 12 * this.vibrationChamber.burnTime / this.vibrationChamber.maxBurnTime );
this.burnSpeed = this.vibrationChamber.burnSpeed;
this.burnProgress = (int) ( this.vibrationChamber.getMaxBurnTime() <= 0 ? 0 : 12 * this.vibrationChamber.getBurnTime() / this.vibrationChamber.getMaxBurnTime() );
this.burnSpeed = this.vibrationChamber.getBurnSpeed();
}
super.detectAndSendChanges();
@@ -72,4 +72,9 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr
{
return MAX_BURN_TIME;
}
public int getAePerTick()
{
return this.aePerTick;
}
}
@@ -30,8 +30,8 @@ import appeng.tile.networking.TileWireless;
public class ContainerWireless extends AEBaseContainer
{
final TileWireless wirelessTerminal;
final SlotRestrictedInput boosterSlot;
private final TileWireless wirelessTerminal;
private final SlotRestrictedInput boosterSlot;
@GuiSync( 1 )
public long range = 0;
@GuiSync( 2 )
@@ -42,7 +42,7 @@ public class ContainerWireless extends AEBaseContainer
super( ip, te, null );
this.wirelessTerminal = te;
this.addSlotToContainer( this.boosterSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.RANGE_BOOSTER, this.wirelessTerminal, 0, 80, 47, this.invPlayer ) );
this.addSlotToContainer( this.boosterSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.RANGE_BOOSTER, this.wirelessTerminal, 0, 80, 47, this.getInventoryPlayer() ) );
this.bindPlayerInventory( ip, 0, 166 - /* height of player inventory */82 );
}
@@ -52,9 +52,29 @@ public class ContainerWireless extends AEBaseContainer
{
final int boosters = this.boosterSlot.getStack() == null ? 0 : this.boosterSlot.getStack().stackSize;
this.range = (long) ( 10 * AEConfig.instance.wireless_getMaxRange( boosters ) );
this.drain = (long) ( 100 * AEConfig.instance.wireless_getPowerDrain( boosters ) );
this.setRange( (long) ( 10 * AEConfig.instance.wireless_getMaxRange( boosters ) ) );
this.setDrain( (long) ( 100 * AEConfig.instance.wireless_getPowerDrain( boosters ) ) );
super.detectAndSendChanges();
}
public long getRange()
{
return this.range;
}
private void setRange( final long range )
{
this.range = range;
}
public long getDrain()
{
return this.drain;
}
private void setDrain( final long drain )
{
this.drain = drain;
}
}
@@ -29,7 +29,7 @@ import appeng.util.Platform;
public class ContainerWirelessTerm extends ContainerMEPortableCell
{
final WirelessTerminalGuiObject wirelessTerminalGUIObject;
private final WirelessTerminalGuiObject wirelessTerminalGUIObject;
public ContainerWirelessTerm( final InventoryPlayer ip, final WirelessTerminalGuiObject gui )
{
@@ -44,16 +44,16 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell
if( !this.wirelessTerminalGUIObject.rangeCheck() )
{
if( Platform.isServer() && this.isContainerValid )
if( Platform.isServer() && this.isValidContainer() )
{
this.getPlayerInv().player.addChatMessage( PlayerMessages.OutOfRange.get() );
}
this.isContainerValid = false;
this.setValidContainer( false );
}
else
{
this.powerMultiplier = AEConfig.instance.wireless_getDrainRate( this.wirelessTerminalGUIObject.getRange() );
this.setPowerMultiplier( AEConfig.instance.wireless_getDrainRate( this.wirelessTerminalGUIObject.getRange() ) );
}
}
}
@@ -28,10 +28,10 @@ import appeng.util.ItemSorters;
public class CraftingCPURecord implements Comparable<CraftingCPURecord>
{
public final String myName;
final ICraftingCPU cpu;
final long size;
final int processors;
private final String myName;
private final ICraftingCPU cpu;
private final long size;
private final int processors;
public CraftingCPURecord( final long size, final int coProcessors, final ICraftingCPU server )
{
@@ -44,11 +44,31 @@ public class CraftingCPURecord implements Comparable<CraftingCPURecord>
@Override
public int compareTo( @Nonnull final CraftingCPURecord o )
{
final int a = ItemSorters.compareLong( o.processors, this.processors );
final int a = ItemSorters.compareLong( o.getProcessors(), this.getProcessors() );
if( a != 0 )
{
return a;
}
return ItemSorters.compareLong( o.size, this.size );
return ItemSorters.compareLong( o.getSize(), this.getSize() );
}
ICraftingCPU getCpu()
{
return this.cpu;
}
String getName()
{
return this.myName;
}
int getProcessors()
{
return this.processors;
}
long getSize()
{
return this.size;
}
}
@@ -145,16 +145,16 @@ public class AppEngCraftingSlot extends AppEngSlot
net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerCraftingEvent(playerIn, stack, this.craftMatrix );
this.onCrafting(stack);
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(playerIn);
final InventoryCrafting ic = new InventoryCrafting( this.myContainer, 3, 3 );
final InventoryCrafting ic = new InventoryCrafting( this.getContainer(), 3, 3 );
for ( int x=0; x < this.craftMatrix.getSizeInventory(); x++ )
ic.setInventorySlotContents( x, this.craftMatrix.getStackInSlot( x ) );
final ItemStack[] aitemstack = CraftingManager.getInstance().func_180303_b(ic, playerIn.worldObj);
for ( int x=0; x < this.craftMatrix.getSizeInventory(); x++ )
this.craftMatrix.setInventorySlotContents( x, ic.getStackInSlot( x ) );
net.minecraftforge.common.ForgeHooks.setCraftingPlayer(null);
for (int i = 0; i < aitemstack.length; ++i)
@@ -30,26 +30,26 @@ import appeng.tile.inventory.AppEngInternalInventory;
public class AppEngSlot extends Slot
{
public final int defX;
public final int defY;
public boolean isDraggable = true;
public boolean isPlayerSide = false;
public AEBaseContainer myContainer = null;
public int IIcon = -1;
public hasCalculatedValidness isValid;
public boolean isDisplay = false;
private final int defX;
private final int defY;
private boolean isDraggable = true;
private boolean isPlayerSide = false;
private AEBaseContainer myContainer = null;
private int IIcon = -1;
private hasCalculatedValidness isValid;
private boolean isDisplay = false;
public AppEngSlot( final IInventory inv, final int idx, final int x, final int y )
{
super( inv, idx, x, y );
this.defX = x;
this.defY = y;
this.isValid = hasCalculatedValidness.NotAvailable;
this.setIsValid( hasCalculatedValidness.NotAvailable );
}
public Slot setNotDraggable()
{
this.isDraggable = false;
this.setDraggable( false );
return this;
}
@@ -92,9 +92,9 @@ public class AppEngSlot extends Slot
return null;
}
if( this.isDisplay )
if( this.isDisplay() )
{
this.isDisplay = false;
this.setDisplay( false );
return this.getDisplayStack();
}
return super.getStack();
@@ -107,9 +107,9 @@ public class AppEngSlot extends Slot
{
super.putStack( par1ItemStack );
if( this.myContainer != null )
if( this.getContainer() != null )
{
this.myContainer.onSlotChange( this );
this.getContainer().onSlotChange( this );
}
}
}
@@ -126,7 +126,7 @@ public class AppEngSlot extends Slot
super.onSlotChanged();
}
this.isValid = hasCalculatedValidness.NotAvailable;
this.setIsValid( hasCalculatedValidness.NotAvailable );
}
@Override
@@ -167,7 +167,7 @@ public class AppEngSlot extends Slot
public int getIcon()
{
return this.IIcon;
return this.getIIcon();
}
public boolean isPlayerSide()
@@ -180,6 +180,71 @@ public class AppEngSlot extends Slot
return this.isEnabled();
}
public int getX()
{
return this.defX;
}
public int getY()
{
return this.defY;
}
private int getIIcon()
{
return this.IIcon;
}
public void setIIcon( final int iIcon )
{
this.IIcon = iIcon;
}
private boolean isDisplay()
{
return this.isDisplay;
}
public void setDisplay( final boolean isDisplay )
{
this.isDisplay = isDisplay;
}
public boolean isDraggable()
{
return this.isDraggable;
}
private void setDraggable( final boolean isDraggable )
{
this.isDraggable = isDraggable;
}
void setPlayerSide( final boolean isPlayerSide )
{
this.isPlayerSide = isPlayerSide;
}
public hasCalculatedValidness getIsValid()
{
return this.isValid;
}
public void setIsValid( final hasCalculatedValidness isValid )
{
this.isValid = isValid;
}
AEBaseContainer getContainer()
{
return this.myContainer;
}
public void setContainer( final AEBaseContainer myContainer )
{
this.myContainer = myContainer;
}
public enum hasCalculatedValidness
{
NotAvailable, Valid, Invalid
@@ -26,19 +26,17 @@ import net.minecraft.item.ItemStack;
public class OptionalSlotFake extends SlotFake
{
public final int srcX;
public final int srcY;
final int invSlot;
final int groupNum;
final IOptionalSlotHost host;
public boolean renderDisabled = true;
private final int srcX;
private final int srcY;
private final int groupNum;
private final IOptionalSlotHost host;
private boolean renderDisabled = true;
public OptionalSlotFake( final IInventory inv, final IOptionalSlotHost containerBus, final int idx, final int x, final int y, final int offX, final int offY, final int groupNum )
{
super( inv, idx, x + offX * 18, y + offY * 18 );
this.srcX = x;
this.srcY = y;
this.invSlot = idx;
this.groupNum = groupNum;
this.host = containerBus;
}
@@ -69,7 +67,27 @@ public class OptionalSlotFake extends SlotFake
}
public boolean renderDisabled()
{
return this.isRenderDisabled();
}
private boolean isRenderDisabled()
{
return this.renderDisabled;
}
public void setRenderDisabled( final boolean renderDisabled )
{
this.renderDisabled = renderDisabled;
}
public int getSourceX()
{
return this.srcX;
}
public int getSourceY()
{
return this.srcY;
}
}
@@ -25,8 +25,8 @@ import net.minecraft.inventory.IInventory;
public class OptionalSlotNormal extends AppEngSlot
{
final int groupNum;
final IOptionalSlotHost host;
private final int groupNum;
private final IOptionalSlotHost host;
public OptionalSlotNormal( final IInventory inv, final IOptionalSlotHost containerBus, final int slot, final int xPos, final int yPos, final int groupNum )
{
@@ -26,8 +26,8 @@ import net.minecraft.inventory.IInventory;
public class OptionalSlotRestrictedInput extends SlotRestrictedInput
{
final int groupNum;
final IOptionalSlotHost host;
private final int groupNum;
private final IOptionalSlotHost host;
public OptionalSlotRestrictedInput( final PlacableItemType valid, final IInventory i, final IOptionalSlotHost host, final int slotIndex, final int x, final int y, final int grpNum, final InventoryPlayer invPlayer )
{
@@ -27,7 +27,7 @@ import net.minecraft.item.ItemStack;
public class SlotCraftingMatrix extends AppEngSlot
{
final Container c;
private final Container c;
public SlotCraftingMatrix( final Container c, final IInventory par1iInventory, final int par2, final int par3, final int par4 )
{
@@ -49,8 +49,8 @@ import appeng.util.item.AEItemStack;
public class SlotCraftingTerm extends AppEngCraftingSlot
{
protected final IInventory craftInv;
protected final IInventory pattern;
private final IInventory craftInv;
private final IInventory pattern;
private final BaseActionSource mySrc;
private final IEnergySource energySrc;
@@ -147,19 +147,19 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
}
}
protected int capCraftingAttempts( final int maxTimesToCraft )
private int capCraftingAttempts( final int maxTimesToCraft )
{
return maxTimesToCraft;
}
public ItemStack craftItem( final EntityPlayer p, final ItemStack request, final IMEMonitor<IAEItemStack> inv, final IItemList all )
private ItemStack craftItem( final EntityPlayer p, final ItemStack request, final IMEMonitor<IAEItemStack> inv, final IItemList all )
{
// update crafting matrix...
ItemStack is = this.getStack();
if( is != null && Platform.isSameItem( request, is ) )
{
final ItemStack[] set = new ItemStack[this.pattern.getSizeInventory()];
final ItemStack[] set = new ItemStack[this.getPattern().getSizeInventory()];
// add one of each item to the items on the board...
if( Platform.isServer() )
@@ -167,7 +167,7 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
final InventoryCrafting ic = new InventoryCrafting( new ContainerNull(), 3, 3 );
for( int x = 0; x < 9; x++ )
{
ic.setInventorySlotContents( x, this.pattern.getStackInSlot( x ) );
ic.setInventorySlotContents( x, this.getPattern().getStackInSlot( x ) );
}
final IRecipe r = Platform.findMatchingRecipe( ic, p.worldObj );
@@ -205,11 +205,11 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
if( inv != null )
{
for( int x = 0; x < this.pattern.getSizeInventory(); x++ )
for( int x = 0; x < this.getPattern().getSizeInventory(); x++ )
{
if( this.pattern.getStackInSlot( x ) != null )
if( this.getPattern().getStackInSlot( x ) != null )
{
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() ) );
set[x] = Platform.extractItemsByRecipe( this.energySrc, this.mySrc, inv, p.worldObj, r, is, ic, this.getPattern().getStackInSlot( x ), x, all, Actionable.MODULATE, ItemViewCell.createFilter( this.container.getViewCells() ) );
ic.setInventorySlotContents( x, set[x] );
}
}
@@ -232,17 +232,17 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
return null;
}
public boolean preCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
private boolean preCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
{
return true;
}
public void makeItem( final EntityPlayer p, final ItemStack is )
private void makeItem( final EntityPlayer p, final ItemStack is )
{
super.onPickupFromSlot( p, is );
}
public void postCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
private void postCraft( final EntityPlayer p, final IMEMonitor<IAEItemStack> inv, final ItemStack[] set, final ItemStack result )
{
final List<ItemStack> drops = new ArrayList<ItemStack>();
@@ -273,4 +273,9 @@ public class SlotCraftingTerm extends AppEngCraftingSlot
Platform.spawnDrops( p.worldObj, new BlockPos( (int) p.posX, (int) p.posY, (int) p.posZ ), drops );
}
}
IInventory getPattern()
{
return this.pattern;
}
}
@@ -27,12 +27,9 @@ import net.minecraft.item.ItemStack;
public class SlotFake extends AppEngSlot
{
final int invSlot;
public SlotFake( final IInventory inv, final int idx, final int x, final int y )
{
super( inv, idx, x, y );
this.invSlot = idx;
}
@Override
@@ -27,7 +27,7 @@ import net.minecraft.item.ItemStack;
public class SlotInaccessible extends AppEngSlot
{
ItemStack dspStack = null;
private ItemStack dspStack = null;
public SlotInaccessible( final IInventory i, final int slotIdx, final int x, final int y )
{
@@ -27,7 +27,7 @@ import appeng.container.implementations.ContainerMAC;
public class SlotMACPattern extends AppEngSlot
{
final ContainerMAC mac;
private final ContainerMAC mac;
public SlotMACPattern( final ContainerMAC mac, final IInventory i, final int slotIdx, final int x, final int y )
{
@@ -29,7 +29,7 @@ public class SlotOutput extends AppEngSlot
public SlotOutput( final IInventory a, final int b, final int c, final int d, final int i )
{
super( a, b, c, d );
this.IIcon = i;
this.setIIcon( i );
}
@Override
@@ -36,8 +36,8 @@ import appeng.helpers.IContainerCraftingPacket;
public class SlotPatternTerm extends SlotCraftingTerm
{
final int groupNum;
final IOptionalSlotHost host;
private final int groupNum;
private final IOptionalSlotHost host;
public SlotPatternTerm( final EntityPlayer player, final BaseActionSource mySrc, final IEnergySource energySrc, final IStorageMonitorable storage, final IInventory cMatrix, final IInventory secondMatrix, final IInventory output, final int x, final int y, final IOptionalSlotHost h, final int groupNumber, final IContainerCraftingPacket c )
{
@@ -49,7 +49,7 @@ public class SlotPatternTerm extends SlotCraftingTerm
public AppEngPacket getRequest( final boolean shift ) throws IOException
{
return new PacketPatternSlot( this.pattern, AEApi.instance().storage().createItemStack( this.getStack() ), shift );
return new PacketPatternSlot( this.getPattern(), AEApi.instance().storage().createItemStack( this.getStack() ), shift );
}
@Override
@@ -28,6 +28,6 @@ public class SlotPlayerHotBar extends AppEngSlot
public SlotPlayerHotBar( final IInventory par1iInventory, final int par2, final int par3, final int par4 )
{
super( par1iInventory, par2, par3, par4 );
this.isPlayerSide = true;
this.setPlayerSide( true );
}
}
@@ -31,6 +31,6 @@ public class SlotPlayerInv extends AppEngSlot
{
super( par1iInventory, par2, par3, par4 );
this.isPlayerSide = true;
this.setPlayerSide( true );
}
}
@@ -53,16 +53,16 @@ import appeng.util.Platform;
public class SlotRestrictedInput extends AppEngSlot
{
public final PlacableItemType which;
private final PlacableItemType which;
private final InventoryPlayer p;
public boolean allowEdit = true;
public int stackLimit = -1;
private boolean allowEdit = true;
private int stackLimit = -1;
public SlotRestrictedInput( final PlacableItemType valid, final IInventory i, final int slotIndex, final int x, final int y, final InventoryPlayer p )
{
super( i, slotIndex, x, y );
this.which = valid;
this.IIcon = valid.IIcon;
this.setIIcon( valid.IIcon );
this.p = p;
}
@@ -95,7 +95,7 @@ public class SlotRestrictedInput extends AppEngSlot
@Override
public boolean isItemValid( final ItemStack i )
{
if( !this.myContainer.isValidForSlot( this, i ) )
if( !this.getContainer().isValidForSlot( this, i ) )
{
return false;
}
@@ -114,7 +114,7 @@ public class SlotRestrictedInput extends AppEngSlot
return false;
}
if( !this.allowEdit )
if( !this.isAllowEdit() )
{
return false;
}
@@ -232,7 +232,7 @@ public class SlotRestrictedInput extends AppEngSlot
@Override
public boolean canTakeStack( final EntityPlayer par1EntityPlayer )
{
return this.allowEdit;
return this.isAllowEdit();
}
@Override
@@ -275,6 +275,16 @@ public class SlotRestrictedInput extends AppEngSlot
return false;
}
private boolean isAllowEdit()
{
return this.allowEdit;
}
public void setAllowEdit( final boolean allowEdit )
{
this.allowEdit = allowEdit;
}
public enum PlacableItemType
{
STORAGE_CELLS( 15 ), ORE( 16 + 15 ), STORAGE_COMPONENT( 3 * 16 + 15 ),