Fixes #1186: Storage Cells drop upgrades upon disassembling
This commit is contained in:
@@ -59,9 +59,21 @@ public interface IStorageCell extends ICellWorkbenchItem
|
|||||||
* @param cellItem item
|
* @param cellItem item
|
||||||
*
|
*
|
||||||
* @return number of bytes
|
* @return number of bytes
|
||||||
|
*
|
||||||
|
* @deprecated use {@link IStorageCell#getBytesPerType(ItemStack)}
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
int BytePerType( ItemStack cellItem );
|
int BytePerType( ItemStack cellItem );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines the number of bytes used for any type included on the cell.
|
||||||
|
*
|
||||||
|
* @param cellItem item
|
||||||
|
*
|
||||||
|
* @return number of bytes
|
||||||
|
*/
|
||||||
|
int getBytesPerType( ItemStack cellItem );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Must be between 1 and 63, indicates how many types you want to store on
|
* Must be between 1 and 63, indicates how many types you want to store on
|
||||||
* the item.
|
* the item.
|
||||||
|
|||||||
@@ -49,15 +49,13 @@ import appeng.util.iterators.NullIterator;
|
|||||||
|
|
||||||
public class ContainerCellWorkbench extends ContainerUpgradeable
|
public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||||
{
|
{
|
||||||
|
private final TileCellWorkbench workBench;
|
||||||
final TileCellWorkbench workBench;
|
private final AppEngNullInventory nullInventory = new AppEngNullInventory();
|
||||||
final AppEngNullInventory ni = new AppEngNullInventory();
|
|
||||||
@GuiSync( 2 )
|
@GuiSync( 2 )
|
||||||
public CopyMode copyMode = CopyMode.CLEAR_ON_REMOVE;
|
public CopyMode copyMode = CopyMode.CLEAR_ON_REMOVE;
|
||||||
IInventory UpgradeInventoryWrapper;
|
private ItemStack prevStack = null;
|
||||||
ItemStack prevStack = null;
|
private int lastUpgrades = 0;
|
||||||
int lastUpgrades = 0;
|
private ItemStack LastCell;
|
||||||
ItemStack LastCell;
|
|
||||||
|
|
||||||
public ContainerCellWorkbench( InventoryPlayer ip, TileCellWorkbench te )
|
public ContainerCellWorkbench( InventoryPlayer ip, TileCellWorkbench te )
|
||||||
{
|
{
|
||||||
@@ -99,7 +97,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
|||||||
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.invPlayer ) );
|
this.addSlotToContainer( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.WORKBENCH_CELL, cell, 0, 152, 8, this.invPlayer ) );
|
||||||
|
|
||||||
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
IInventory inv = this.upgradeable.getInventoryByName( "config" );
|
||||||
this.UpgradeInventoryWrapper = new Upgrades();// Platform.isServer() ? new Upgrades() : new AppEngInternalInventory(
|
IInventory upgradeInventory = new Upgrades();
|
||||||
// null, 3 * 8 );
|
// null, 3 * 8 );
|
||||||
|
|
||||||
for( int w = 0; w < 7; w++ )
|
for( int w = 0; w < 7; w++ )
|
||||||
@@ -113,7 +111,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
|||||||
for( int z = 0; z < 8; z++ )
|
for( int z = 0; z < 8; z++ )
|
||||||
{
|
{
|
||||||
int iSLot = zz * 8 + z;
|
int iSLot = zz * 8 + z;
|
||||||
this.addSlotToContainer( new OptionalSlotRestrictedInput( SlotRestrictedInput.PlacableItemType.UPGRADES, this.UpgradeInventoryWrapper, 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.invPlayer ) );
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new
|
* if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new
|
||||||
@@ -134,7 +132,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
|||||||
if( this.prevStack != is )
|
if( this.prevStack != is )
|
||||||
{
|
{
|
||||||
this.prevStack = is;
|
this.prevStack = is;
|
||||||
return this.lastUpgrades = this.getCellUpgradeInventory().getSizeInventory();
|
this.lastUpgrades = this.getCellUpgradeInventory().getSizeInventory();
|
||||||
}
|
}
|
||||||
return this.lastUpgrades;
|
return this.lastUpgrades;
|
||||||
}
|
}
|
||||||
@@ -180,8 +178,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
|||||||
|
|
||||||
public IInventory getCellUpgradeInventory()
|
public IInventory getCellUpgradeInventory()
|
||||||
{
|
{
|
||||||
IInventory ri = this.workBench.getCellUpgradeInventory();
|
final IInventory upgradeInventory = this.workBench.getCellUpgradeInventory();
|
||||||
return ri == null ? this.ni : ri;
|
|
||||||
|
return upgradeInventory == null ? this.nullInventory : upgradeInventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -237,7 +236,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
|
|||||||
this.detectAndSendChanges();
|
this.detectAndSendChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
class Upgrades implements IInventory
|
private class Upgrades implements IInventory
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -78,9 +78,9 @@ public abstract class AEBaseItem extends Item implements IAEFeature
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings( "unchecked" )
|
@SuppressWarnings( "unchecked" )
|
||||||
public final void addInformation( ItemStack stack, EntityPlayer player, List lines, boolean displayAdditionalInformation )
|
public final void addInformation( ItemStack stack, EntityPlayer player, List lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
this.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
this.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -89,8 +89,8 @@ public abstract class AEBaseItem extends Item implements IAEFeature
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
super.addInformation( stack, player, lines, displayAdditionalInformation );
|
super.addInformation( stack, player, lines, displayMoreInfo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,9 +85,9 @@ public class ItemMultiMaterial extends AEBaseItem implements IStorageComponent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||||
|
|
||||||
MaterialType mt = this.getTypeByStack( stack );
|
MaterialType mt = this.getTypeByStack( stack );
|
||||||
if( mt == null )
|
if( mt == null )
|
||||||
|
|||||||
@@ -162,13 +162,13 @@ public class ItemCrystalSeed extends AEBaseItem implements IGrowableCrystal
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
lines.add( ButtonToolTips.DoesntDespawn.getLocal() );
|
lines.add( ButtonToolTips.DoesntDespawn.getLocal() );
|
||||||
int progress = this.getProgress( stack ) % SINGLE_OFFSET;
|
int progress = this.getProgress( stack ) % SINGLE_OFFSET;
|
||||||
lines.add( Math.floor( (float) progress / (float) ( SINGLE_OFFSET / 100 ) ) + "%" );
|
lines.add( Math.floor( (float) progress / (float) ( SINGLE_OFFSET / 100 ) ) + "%" );
|
||||||
|
|
||||||
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternIt
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
ICraftingPatternDetails details = this.getPatternForItem( stack, player.worldObj );
|
ICraftingPatternDetails details = this.getPatternForItem( stack, player.worldObj );
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ import appeng.api.config.IncludeExclude;
|
|||||||
import appeng.api.exceptions.MissingDefinition;
|
import appeng.api.exceptions.MissingDefinition;
|
||||||
import appeng.api.implementations.items.IItemGroup;
|
import appeng.api.implementations.items.IItemGroup;
|
||||||
import appeng.api.implementations.items.IStorageCell;
|
import appeng.api.implementations.items.IStorageCell;
|
||||||
|
import appeng.api.implementations.items.IUpgradeModule;
|
||||||
import appeng.api.storage.ICellInventory;
|
import appeng.api.storage.ICellInventory;
|
||||||
import appeng.api.storage.ICellInventoryHandler;
|
import appeng.api.storage.ICellInventoryHandler;
|
||||||
import appeng.api.storage.IMEInventoryHandler;
|
import appeng.api.storage.IMEInventoryHandler;
|
||||||
@@ -55,12 +56,12 @@ import appeng.util.InventoryAdaptor;
|
|||||||
import appeng.util.Platform;
|
import appeng.util.Platform;
|
||||||
|
|
||||||
|
|
||||||
public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, IItemGroup
|
public final class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, IItemGroup
|
||||||
{
|
{
|
||||||
final MaterialType component;
|
private final MaterialType component;
|
||||||
final int totalBytes;
|
private final int totalBytes;
|
||||||
final int perType;
|
private final int perType;
|
||||||
final double idleDrain;
|
private final double idleDrain;
|
||||||
|
|
||||||
public ItemBasicStorageCell( MaterialType whichCell, int kilobytes )
|
public ItemBasicStorageCell( MaterialType whichCell, int kilobytes )
|
||||||
{
|
{
|
||||||
@@ -96,9 +97,9 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
IMEInventoryHandler inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
IMEInventoryHandler<?> inventory = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||||
|
|
||||||
if( inventory instanceof ICellInventoryHandler )
|
if( inventory instanceof ICellInventoryHandler )
|
||||||
{
|
{
|
||||||
@@ -113,12 +114,12 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
|||||||
|
|
||||||
if( handler.isPreformatted() )
|
if( handler.isPreformatted() )
|
||||||
{
|
{
|
||||||
String List = ( handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded ).getLocal();
|
String list = ( handler.getIncludeExcludeMode() == IncludeExclude.WHITELIST ? GuiText.Included : GuiText.Excluded ).getLocal();
|
||||||
|
|
||||||
if( handler.isFuzzy() )
|
if( handler.isFuzzy() )
|
||||||
lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Fuzzy.getLocal() );
|
lines.add( GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Fuzzy.getLocal() );
|
||||||
else
|
else
|
||||||
lines.add( GuiText.Partitioned.getLocal() + " - " + List + ' ' + GuiText.Precise.getLocal() );
|
lines.add( GuiText.Partitioned.getLocal() + " - " + list + ' ' + GuiText.Precise.getLocal() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -136,6 +137,12 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
|||||||
return this.perType;
|
return this.perType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBytesPerType( ItemStack cellItem )
|
||||||
|
{
|
||||||
|
return this.perType;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalTypes( ItemStack cellItem )
|
public int getTotalTypes( ItemStack cellItem )
|
||||||
{
|
{
|
||||||
@@ -234,10 +241,24 @@ public class ItemBasicStorageCell extends AEBaseItem implements IStorageCell, II
|
|||||||
{
|
{
|
||||||
playerInventory.setInventorySlotContents( playerInventory.currentItem, null );
|
playerInventory.setInventorySlotContents( playerInventory.currentItem, null );
|
||||||
|
|
||||||
|
// drop core
|
||||||
ItemStack extraB = ia.addItems( this.component.stack( 1 ) );
|
ItemStack extraB = ia.addItems( this.component.stack( 1 ) );
|
||||||
if( extraB != null )
|
if( extraB != null )
|
||||||
player.dropPlayerItemWithRandomChoice( extraB, false );
|
player.dropPlayerItemWithRandomChoice( extraB, false );
|
||||||
|
|
||||||
|
// drop upgrades
|
||||||
|
final IInventory upgradesInventory = this.getUpgradesInventory( stack );
|
||||||
|
for( int upgradeIndex = 0; upgradeIndex < upgradesInventory.getSizeInventory(); upgradeIndex++ )
|
||||||
|
{
|
||||||
|
final ItemStack upgradeStack = upgradesInventory.getStackInSlot( upgradeIndex );
|
||||||
|
final ItemStack leftStack = ia.addItems( upgradeStack );
|
||||||
|
if( leftStack != null && upgradeStack.getItem() instanceof IUpgradeModule )
|
||||||
|
{
|
||||||
|
player.dropPlayerItemWithRandomChoice( upgradeStack, false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// drop empty storage cell case
|
||||||
for( ItemStack storageCellStack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
for( ItemStack storageCellStack : AEApi.instance().definitions().materials().emptyStorageCell().maybeStack( 1 ).asSet() )
|
||||||
{
|
{
|
||||||
final ItemStack extraA = ia.addItems( storageCellStack );
|
final ItemStack extraA = ia.addItems( storageCellStack );
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public class ItemSpatialStorageCell extends AEBaseItem implements ISpatialStorag
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
WorldCoord wc = this.getStoredSize( stack );
|
WorldCoord wc = this.getStoredSize( stack );
|
||||||
if( wc.x > 0 )
|
if( wc.x > 0 )
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ public class ToolBiometricCard extends AEBaseItem implements IBiometricCard
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
|
EnumSet<SecurityPermissions> perms = this.getPermissions( stack );
|
||||||
if( perms.isEmpty() )
|
if( perms.isEmpty() )
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class ToolMemoryCard extends AEBaseItem implements IMemoryCard
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
|
lines.add( this.getLocalizedName( this.getSettingsName( stack ) + ".name", this.getSettingsName( stack ) ) );
|
||||||
|
|
||||||
|
|||||||
@@ -388,9 +388,9 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||||
|
|
||||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||||
|
|
||||||
@@ -417,6 +417,12 @@ public class ToolColorApplicator extends AEBasePoweredItem implements IStorageCe
|
|||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBytesPerType( ItemStack cellItem )
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalTypes( ItemStack cellItem )
|
public int getTotalTypes( ItemStack cellItem )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -95,9 +95,9 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||||
|
|
||||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||||
|
|
||||||
@@ -481,6 +481,12 @@ public class ToolMassCannon extends AEBasePoweredItem implements IStorageCell
|
|||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBytesPerType( ItemStack cellItem )
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalTypes( ItemStack cellItem )
|
public int getTotalTypes( ItemStack cellItem )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -80,9 +80,9 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||||
|
|
||||||
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
IMEInventory<IAEItemStack> cdi = AEApi.instance().registries().cell().getCellInventory( stack, null, StorageChannel.ITEMS );
|
||||||
|
|
||||||
@@ -109,6 +109,12 @@ public class ToolPortableCell extends AEBasePoweredItem implements IStorageCell,
|
|||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getBytesPerType( ItemStack cellItem )
|
||||||
|
{
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTotalTypes( ItemStack cellItem )
|
public int getTotalTypes( ItemStack cellItem )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ public class ToolWirelessTerminal extends AEBasePoweredItem implements IWireless
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
super.addCheckedInformation( stack, player, lines, displayAdditionalInformation );
|
super.addCheckedInformation( stack, player, lines, displayMoreInfo );
|
||||||
|
|
||||||
if( stack.hasTagCompound() )
|
if( stack.hasTagCompound() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public abstract class AERootPoweredItem extends AEBaseItem implements IAEItemPow
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayAdditionalInformation )
|
public void addCheckedInformation( ItemStack stack, EntityPlayer player, List<String> lines, boolean displayMoreInfo )
|
||||||
{
|
{
|
||||||
NBTTagCompound tag = stack.getTagCompound();
|
NBTTagCompound tag = stack.getTagCompound();
|
||||||
double internalCurrentPower = 0;
|
double internalCurrentPower = 0;
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
|||||||
|
|
||||||
final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 );
|
final AppEngInternalInventory cell = new AppEngInternalInventory( this, 1 );
|
||||||
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 );
|
final AppEngInternalAEInventory config = new AppEngInternalAEInventory( this, 63 );
|
||||||
final ConfigManager cm = new ConfigManager( this );
|
final ConfigManager manager = new ConfigManager( this );
|
||||||
|
|
||||||
IInventory cacheUpgrades = null;
|
IInventory cacheUpgrades = null;
|
||||||
IInventory cacheConfig = null;
|
IInventory cacheConfig = null;
|
||||||
@@ -56,7 +56,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
|||||||
|
|
||||||
public TileCellWorkbench()
|
public TileCellWorkbench()
|
||||||
{
|
{
|
||||||
this.cm.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE );
|
this.manager.registerSetting( Settings.COPY_MODE, CopyMode.CLEAR_ON_REMOVE );
|
||||||
this.cell.enableClientEvents = true;
|
this.cell.enableClientEvents = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
|||||||
{
|
{
|
||||||
this.cell.writeToNBT( data, "cell" );
|
this.cell.writeToNBT( data, "cell" );
|
||||||
this.config.writeToNBT( data, "config" );
|
this.config.writeToNBT( data, "config" );
|
||||||
this.cm.writeToNBT( data );
|
this.manager.writeToNBT( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
@TileEvent( TileEventType.WORLD_NBT_READ )
|
@TileEvent( TileEventType.WORLD_NBT_READ )
|
||||||
@@ -105,7 +105,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
|||||||
{
|
{
|
||||||
this.cell.readFromNBT( data, "cell" );
|
this.cell.readFromNBT( data, "cell" );
|
||||||
this.config.readFromNBT( data, "config" );
|
this.config.readFromNBT( data, "config" );
|
||||||
this.cm.readFromNBT( data );
|
this.manager.readFromNBT( data );
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -136,13 +136,13 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
|||||||
this.cacheUpgrades = null;
|
this.cacheUpgrades = null;
|
||||||
this.cacheConfig = null;
|
this.cacheConfig = null;
|
||||||
|
|
||||||
IInventory c = this.getCellConfigInventory();
|
IInventory configInventory = this.getCellConfigInventory();
|
||||||
if( c != null )
|
if( configInventory != null )
|
||||||
{
|
{
|
||||||
boolean cellHasConfig = false;
|
boolean cellHasConfig = false;
|
||||||
for( int x = 0; x < c.getSizeInventory(); x++ )
|
for( int x = 0; x < configInventory.getSizeInventory(); x++ )
|
||||||
{
|
{
|
||||||
if( c.getStackInSlot( x ) != null )
|
if( configInventory.getStackInSlot( x ) != null )
|
||||||
{
|
{
|
||||||
cellHasConfig = true;
|
cellHasConfig = true;
|
||||||
break;
|
break;
|
||||||
@@ -152,17 +152,17 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
|||||||
if( cellHasConfig )
|
if( cellHasConfig )
|
||||||
{
|
{
|
||||||
for( int x = 0; x < this.config.getSizeInventory(); x++ )
|
for( int x = 0; x < this.config.getSizeInventory(); x++ )
|
||||||
this.config.setInventorySlotContents( x, c.getStackInSlot( x ) );
|
this.config.setInventorySlotContents( x, configInventory.getStackInSlot( x ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( int x = 0; x < this.config.getSizeInventory(); x++ )
|
for( int x = 0; x < this.config.getSizeInventory(); x++ )
|
||||||
c.setInventorySlotContents( x, this.config.getStackInSlot( x ) );
|
configInventory.setInventorySlotContents( x, this.config.getStackInSlot( x ) );
|
||||||
|
|
||||||
c.markDirty();
|
configInventory.markDirty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( this.cm.getSetting( Settings.COPY_MODE ) == CopyMode.CLEAR_ON_REMOVE )
|
else if( this.manager.getSetting( Settings.COPY_MODE ) == CopyMode.CLEAR_ON_REMOVE )
|
||||||
{
|
{
|
||||||
for( int x = 0; x < this.config.getSizeInventory(); x++ )
|
for( int x = 0; x < this.config.getSizeInventory(); x++ )
|
||||||
this.config.setInventorySlotContents( x, null );
|
this.config.setInventorySlotContents( x, null );
|
||||||
@@ -185,7 +185,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IInventory getCellConfigInventory()
|
private IInventory getCellConfigInventory()
|
||||||
{
|
{
|
||||||
if( this.cacheConfig == null )
|
if( this.cacheConfig == null )
|
||||||
{
|
{
|
||||||
@@ -201,7 +201,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
|||||||
if( inv == null )
|
if( inv == null )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return this.cacheConfig = inv;
|
this.cacheConfig = inv;
|
||||||
}
|
}
|
||||||
return this.cacheConfig;
|
return this.cacheConfig;
|
||||||
}
|
}
|
||||||
@@ -218,7 +218,7 @@ public class TileCellWorkbench extends AEBaseTile implements IUpgradeableHost, I
|
|||||||
@Override
|
@Override
|
||||||
public IConfigManager getConfigManager()
|
public IConfigManager getConfigManager()
|
||||||
{
|
{
|
||||||
return this.cm;
|
return this.manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user