Err too much.
This commit is contained in:
@@ -0,0 +1,290 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.AEApi;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.storage.ICellWorkbenchItem;
|
||||
import appeng.api.storage.IMEInventory;
|
||||
import appeng.api.storage.StorageChannel;
|
||||
import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.slot.OptionalSlotRestrictedInput;
|
||||
import appeng.container.slot.SlotFakeTypeOnly;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.tile.inventory.AppEngNullInventory;
|
||||
import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.ItemList;
|
||||
import appeng.util.iterators.NullIterator;
|
||||
|
||||
public class ContainerCellWorkbench extends ContainerUpgradeable
|
||||
{
|
||||
|
||||
TileCellWorkbench workBench;
|
||||
AppEngNullInventory ni = new AppEngNullInventory();
|
||||
|
||||
public IInventory getCellUpgradeInventory()
|
||||
{
|
||||
IInventory ri = workBench.getCellUpgradeInventory();
|
||||
return ri == null ? ni : ri;
|
||||
}
|
||||
|
||||
public void setFuzzy(FuzzyMode valueOf)
|
||||
{
|
||||
ICellWorkbenchItem cwi = workBench.getCell();
|
||||
if ( cwi != null )
|
||||
cwi.setFuzzyMode( workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ), valueOf );
|
||||
}
|
||||
|
||||
private FuzzyMode getFuzzyMode()
|
||||
{
|
||||
ICellWorkbenchItem cwi = workBench.getCell();
|
||||
if ( cwi != null )
|
||||
return cwi.getFuzzyMode( workBench.getInventoryByName( "cell" ).getStackInSlot( 0 ) );
|
||||
return FuzzyMode.IGNORE_ALL;
|
||||
}
|
||||
|
||||
class Upgrades implements IInventory
|
||||
{
|
||||
|
||||
@Override
|
||||
public int getSizeInventory()
|
||||
{
|
||||
return getCellUpgradeInventory().getSizeInventory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i)
|
||||
{
|
||||
return getCellUpgradeInventory().getStackInSlot( i );
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j)
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
ItemStack is = inv.decrStackSize( i, j );
|
||||
inv.onInventoryChanged();
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i)
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
ItemStack is = inv.getStackInSlotOnClosing( i );
|
||||
inv.onInventoryChanged();
|
||||
return is;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemstack)
|
||||
{
|
||||
IInventory inv = getCellUpgradeInventory();
|
||||
inv.setInventorySlotContents( i, itemstack );
|
||||
inv.onInventoryChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInvName()
|
||||
{
|
||||
return "Upgrades";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInvNameLocalized()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInventoryChanged()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openChest()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeChest()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack)
|
||||
{
|
||||
return getCellUpgradeInventory().isItemValidForSlot( i, itemstack );
|
||||
}
|
||||
};
|
||||
|
||||
IInventory UpgradeInventoryWrapper;
|
||||
|
||||
ItemStack prevStack = null;
|
||||
int lastUpgrades = 0;
|
||||
|
||||
public ContainerCellWorkbench(InventoryPlayer ip, TileCellWorkbench te) {
|
||||
super( ip, te );
|
||||
workBench = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeight()
|
||||
{
|
||||
return 251;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades()
|
||||
{
|
||||
ItemStack is = workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||
if ( prevStack != is )
|
||||
{
|
||||
prevStack = is;
|
||||
return lastUpgrades = getCellUpgradeInventory().getSizeInventory();
|
||||
}
|
||||
return lastUpgrades;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx)
|
||||
{
|
||||
return idx < availableUpgrades();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig()
|
||||
{
|
||||
int x = 8;
|
||||
int y = 29;
|
||||
int offset = 0;
|
||||
|
||||
IInventory cell = myte.getInventoryByName( "cell" );
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.WORKBENCH_CELL, cell, 0, 152, 8 ) );
|
||||
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
UpgradeInventoryWrapper = new Upgrades();// Platform.isServer() ? new Upgrades() : new AppEngInternalInventory(
|
||||
// null, 3 * 8 );
|
||||
|
||||
for (int w = 0; w < 7; w++)
|
||||
for (int z = 0; z < 9; z++)
|
||||
addSlotToContainer( new SlotFakeTypeOnly( inv, offset++, x + z * 18, y + w * 18 ) );
|
||||
|
||||
for (int zz = 0; zz < 3; zz++)
|
||||
for (int z = 0; z < 8; z++)
|
||||
{
|
||||
int iSLot = zz * 8 + z;
|
||||
addSlotToContainer( new OptionalSlotRestrictedInput( PlaceableItemType.UPGRADES, UpgradeInventoryWrapper, this, iSLot, 187 + zz * 18,
|
||||
8 + 18 * z, iSLot ) );
|
||||
}
|
||||
/*
|
||||
* if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new
|
||||
* OptionalSlotFakeTypeOnly( inv, this, offset++, x, y, z, w, 1 ) );
|
||||
*
|
||||
* for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new OptionalSlotFakeTypeOnly(
|
||||
* inv, this, offset++, x, y, z, w + 2, 2 ) );
|
||||
*
|
||||
* for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new OptionalSlotFakeTypeOnly(
|
||||
* inv, this, offset++, x, y, z, w + 4, 3 ) ); }
|
||||
*/
|
||||
}
|
||||
|
||||
ItemStack LastCell;
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack is = workBench.getInventoryByName( "cell" ).getStackInSlot( 0 );
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get( i );
|
||||
|
||||
if ( this.fzMode != getFuzzyMode() )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 1, (int) getFuzzyMode().ordinal() );
|
||||
}
|
||||
|
||||
if ( prevStack != is )
|
||||
{
|
||||
// if the bars changed an item was probably made, so just send shit!
|
||||
for (Object s : inventorySlots)
|
||||
{
|
||||
if ( s instanceof OptionalSlotRestrictedInput )
|
||||
{
|
||||
OptionalSlotRestrictedInput sri = (OptionalSlotRestrictedInput) s;
|
||||
icrafting.sendSlotContents( this, sri.slotNumber, sri.getStack() );
|
||||
}
|
||||
}
|
||||
((EntityPlayerMP) icrafting).playerInventoryBeingManipulated = false;
|
||||
}
|
||||
}
|
||||
|
||||
this.fzMode = (FuzzyMode) getFuzzyMode();
|
||||
}
|
||||
|
||||
prevStack = is;
|
||||
standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
public void clear()
|
||||
{
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
inv.setInventorySlotContents( x, null );
|
||||
detectAndSendChanges();
|
||||
}
|
||||
|
||||
public void partition()
|
||||
{
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
|
||||
IMEInventory<IAEItemStack> cellInv = AEApi.instance().registries().cell()
|
||||
.getCellInventory( myte.getInventoryByName( "cell" ).getStackInSlot( 0 ), StorageChannel.ITEMS );
|
||||
|
||||
Iterator<IAEItemStack> i = new NullIterator<IAEItemStack>();
|
||||
if ( cellInv != null )
|
||||
{
|
||||
IItemList<IAEItemStack> list = cellInv.getAvailableItems( new ItemList() );
|
||||
i = list.iterator();
|
||||
}
|
||||
|
||||
for (int x = 0; x < inv.getSizeInventory(); x++)
|
||||
{
|
||||
if ( i.hasNext() )
|
||||
{
|
||||
ItemStack g = i.next().getItemStack();
|
||||
g.stackSize = 1;
|
||||
inv.setInventorySlotContents( x, g );
|
||||
}
|
||||
else
|
||||
inv.setInventorySlotContents( x, null );
|
||||
}
|
||||
|
||||
detectAndSendChanges();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,11 +6,11 @@ import net.minecraft.inventory.ICrafting;
|
||||
import appeng.api.config.CondenserOuput;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.tile.misc.TileCondenser;
|
||||
import appeng.util.Platform;
|
||||
import buildcraft.core.gui.slots.SlotOutput;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class ContainerCondenser extends AEBaseContainer
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.TRASH, te, 0, 51, 52 ) );
|
||||
addSlotToContainer( new SlotOutput( te, 1, 105, 52 ) );
|
||||
addSlotToContainer( new SlotOutput( te, 1, 105, 52, 15 + 16 * 8 ) );
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.STORAGE_COMPONENT, te.getInternalInventory(), 2, 101, 26 )).setStackLimit( 1 ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 197 - /* height of playerinventory */82 );
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import appeng.api.config.FullnessMode;
|
||||
import appeng.api.config.OperationMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.container.slot.SlotOutput;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.tile.storage.TileIOPort;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerIOPort extends ContainerUpgradeable
|
||||
{
|
||||
|
||||
TileIOPort ioPort;
|
||||
public OperationMode opMode = OperationMode.EMPTY;
|
||||
public FullnessMode fMode = FullnessMode.EMPTY;
|
||||
|
||||
public ContainerIOPort(InventoryPlayer ip, TileIOPort te) {
|
||||
super( ip, te );
|
||||
ioPort = te;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getHeight()
|
||||
{
|
||||
return 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int availableUpgrades()
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean supportCapacity()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig()
|
||||
{
|
||||
int offx = 19;
|
||||
int offy = 17;
|
||||
|
||||
IInventory cells = myte.getInventoryByName( "cells" );
|
||||
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 2; x++)
|
||||
addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.STORAGE_CELLS, cells, x + y * 2, offx + x * 18, offy + y * 18 ) );
|
||||
|
||||
offx = 122;
|
||||
offy = 17;
|
||||
for (int y = 0; y < 3; y++)
|
||||
for (int x = 0; x < 2; x++)
|
||||
addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offx + x * 18, offy + y * 18, PlaceableItemType.STORAGE_CELLS.icon ) );
|
||||
|
||||
IInventory upgrades = myte.getInventoryByName( "upgrades" );
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1 )).setNotDraggable() );
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2 )).setNotDraggable() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
if ( Platform.isServer() )
|
||||
{
|
||||
for (int i = 0; i < this.crafters.size(); ++i)
|
||||
{
|
||||
ICrafting icrafting = (ICrafting) this.crafters.get( i );
|
||||
|
||||
if ( this.rsMode != this.myte.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ) )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 0, (int) this.myte.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED ).ordinal() );
|
||||
}
|
||||
|
||||
if ( this.fMode != this.myte.getConfigManager().getSetting( Settings.FULLNESS_MODE ) )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 2, (int) this.myte.getConfigManager().getSetting( Settings.FULLNESS_MODE ).ordinal() );
|
||||
}
|
||||
|
||||
if ( this.opMode != this.myte.getConfigManager().getSetting( Settings.OPERATION_MODE ) )
|
||||
{
|
||||
icrafting.sendProgressBarUpdate( this, 3, (int) this.myte.getConfigManager().getSetting( Settings.OPERATION_MODE ).ordinal() );
|
||||
}
|
||||
}
|
||||
|
||||
this.opMode = (OperationMode) myte.getConfigManager().getSetting( Settings.OPERATION_MODE );
|
||||
this.fMode = (FullnessMode) this.myte.getConfigManager().getSetting( Settings.FULLNESS_MODE );
|
||||
this.rsMode = (RedstoneMode) this.myte.getConfigManager().getSetting( Settings.REDSTONE_CONTROLLED );
|
||||
}
|
||||
|
||||
standardDetectAndSendChanges();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgressBar(int idx, int value)
|
||||
{
|
||||
super.updateProgressBar( idx, value );
|
||||
|
||||
if ( idx == 2 )
|
||||
this.fMode = FullnessMode.values()[value];
|
||||
|
||||
if ( idx == 3 )
|
||||
this.opMode = OperationMode.values()[value];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,15 +4,19 @@ import net.minecraft.client.gui.GuiTextField;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import appeng.api.config.FuzzyMode;
|
||||
import appeng.api.config.RedstoneMode;
|
||||
import appeng.api.config.Settings;
|
||||
import appeng.container.slot.SlotFakeTypeOnly;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.parts.automation.PartLevelEmitter;
|
||||
import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerLevelEmitter extends ContainerBus
|
||||
public class ContainerLevelEmitter extends ContainerUpgradeable
|
||||
{
|
||||
|
||||
PartLevelEmitter lvlEmitter;
|
||||
@@ -33,7 +37,7 @@ public class ContainerLevelEmitter extends ContainerBus
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int availableUpgrades()
|
||||
public int availableUpgrades()
|
||||
{
|
||||
|
||||
return 1;
|
||||
@@ -53,6 +57,26 @@ public class ContainerLevelEmitter extends ContainerBus
|
||||
EmitterValue = newValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setupConfig()
|
||||
{
|
||||
int x = 80 + 34;
|
||||
int y = 40;
|
||||
|
||||
IInventory upgrades = myte.getInventoryByName( "upgrades" );
|
||||
if ( availableUpgrades() > 0 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 1 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1 )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 2 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2 )).setNotDraggable() );
|
||||
if ( availableUpgrades() > 3 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() );
|
||||
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
|
||||
@@ -22,6 +22,7 @@ import appeng.api.storage.data.IAEItemStack;
|
||||
import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
import appeng.helpers.ICellItemViewer;
|
||||
import appeng.util.Platform;
|
||||
import appeng.util.item.ItemList;
|
||||
import cpw.mods.fml.common.network.PacketDispatcher;
|
||||
@@ -42,7 +43,10 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
monitor.addListener( this, null );
|
||||
|
||||
cellInv = monitor;
|
||||
if ( montiorable instanceof IMEChest )
|
||||
|
||||
if ( montiorable instanceof ICellItemViewer )
|
||||
powerSrc = (ICellItemViewer) montiorable;
|
||||
else if ( montiorable instanceof IMEChest )
|
||||
powerSrc = (IMEChest) montiorable;
|
||||
else if ( montiorable instanceof IGridHost )
|
||||
{
|
||||
@@ -120,8 +124,18 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IMEMonito
|
||||
PacketMEInventoryUpdate piu = new PacketMEInventoryUpdate();
|
||||
IItemList<IAEItemStack> monitorCache = monitor.getStorageList();
|
||||
|
||||
int items = 0;
|
||||
for (IAEItemStack send : monitorCache)
|
||||
{
|
||||
if ( items > 2000 )
|
||||
{
|
||||
items = 0;
|
||||
Packet p = piu.getPacket();
|
||||
PacketDispatcher.sendPacketToPlayer( p, (Player) c );
|
||||
piu = new PacketMEInventoryUpdate();
|
||||
}
|
||||
|
||||
items++;
|
||||
piu.appendItem( send );
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import appeng.api.config.Actionable;
|
||||
import appeng.api.config.PowerMultiplier;
|
||||
import appeng.api.storage.IStorageMonitorable;
|
||||
import appeng.helpers.ICellItemViewer;
|
||||
import appeng.util.Platform;
|
||||
|
||||
public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
{
|
||||
|
||||
ICellItemViewer civ;
|
||||
|
||||
public ContainerMEPortableCell(InventoryPlayer ip, ICellItemViewer montiorable) {
|
||||
super( ip, (IStorageMonitorable) montiorable );
|
||||
civ = montiorable;
|
||||
}
|
||||
|
||||
int ticks = 0;
|
||||
|
||||
@Override
|
||||
public void detectAndSendChanges()
|
||||
{
|
||||
ItemStack currentItem = getPlayerInv().getCurrentItem();
|
||||
|
||||
if ( currentItem != civ.getItemStack() )
|
||||
{
|
||||
if ( currentItem != null )
|
||||
{
|
||||
if ( Platform.isSameItem( civ.getItemStack(), currentItem ) )
|
||||
getPlayerInv().setInventorySlotContents( getPlayerInv().currentItem, civ.getItemStack() );
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
}
|
||||
else
|
||||
getPlayerInv().player.closeScreen();
|
||||
}
|
||||
|
||||
// drain 1 ae t
|
||||
ticks++;
|
||||
if ( ticks > 10 )
|
||||
{
|
||||
civ.extractAEPower( 0.5 * (double) ticks, Actionable.MODULATE, PowerMultiplier.CONFIG );
|
||||
ticks = 0;
|
||||
}
|
||||
super.detectAndSendChanges();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package appeng.container.implementations;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import appeng.container.slot.SlotRestrictedInput.PlaceableItemType;
|
||||
import appeng.tile.qnb.TileQuantumBridge;
|
||||
|
||||
public class ContainerQNB extends AEBaseContainer
|
||||
{
|
||||
|
||||
TileQuantumBridge myte;
|
||||
|
||||
public ContainerQNB(InventoryPlayer ip, TileQuantumBridge te) {
|
||||
super( ip, te, null );
|
||||
myte = te;
|
||||
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.QE_SINGULARTIY, te, 0, 80, 37 )).setStackLimit( 1 ) );
|
||||
|
||||
bindPlayerInventory( ip, 0, 166 - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
}
|
||||
+22
-16
@@ -22,16 +22,34 @@ import appeng.util.Platform;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSlotHost
|
||||
{
|
||||
|
||||
IBusCommon myte;
|
||||
IInventory toolbox = new AppEngInternalInventory( null, 9 );
|
||||
|
||||
public ContainerBus(InventoryPlayer ip, IBusCommon te) {
|
||||
public ContainerUpgradeable(InventoryPlayer ip, IBusCommon te) {
|
||||
super( ip, (TileEntity) (te instanceof TileEntity ? te : null), (IPart) (te instanceof IPart ? te : null) );
|
||||
myte = te;
|
||||
|
||||
if ( hasToolbox() )
|
||||
{
|
||||
for (int v = 0; v < 3; v++)
|
||||
for (int u = 0; u < 3; u++)
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, toolbox, u + v * 3, 186 + u * 18, getHeight() - 82 + v * 18 ))
|
||||
.setPlayerSide() );
|
||||
}
|
||||
|
||||
setupConfig();
|
||||
|
||||
bindPlayerInventory( ip, 0, getHeight() - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
protected void setupConfig()
|
||||
{
|
||||
int x = 80;
|
||||
int y = 40;
|
||||
|
||||
IInventory upgrades = myte.getInventoryByName( "upgrades" );
|
||||
if ( availableUpgrades() > 0 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() );
|
||||
@@ -42,16 +60,6 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
if ( availableUpgrades() > 3 )
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() );
|
||||
|
||||
if ( hasToolbox() )
|
||||
{
|
||||
for (int v = 0; v < 3; v++)
|
||||
for (int u = 0; u < 3; u++)
|
||||
addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, toolbox, u + v * 3, 186 + u * 18, 102 + v * 18 )).setPlayerSide() );
|
||||
}
|
||||
|
||||
int x = 80;
|
||||
int y = 40;
|
||||
|
||||
IInventory inv = myte.getInventoryByName( "config" );
|
||||
addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) );
|
||||
|
||||
@@ -67,8 +75,6 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 7, x, y, -1, 1, 2 ) );
|
||||
addSlotToContainer( new OptionalSlotFakeTypeOnly( inv, this, 8, x, y, 1, 1, 2 ) );
|
||||
}
|
||||
|
||||
bindPlayerInventory( ip, 0, getHeight() - /* height of playerinventory */82 );
|
||||
}
|
||||
|
||||
protected int getHeight()
|
||||
@@ -76,7 +82,7 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
return 184;
|
||||
}
|
||||
|
||||
protected int availableUpgrades()
|
||||
public int availableUpgrades()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
@@ -151,7 +157,7 @@ public class ContainerBus extends AEBaseContainer implements IOptionalSlotHost
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSlotEnabled(int idx, OptionalSlotFake osf)
|
||||
public boolean isSlotEnabled(int idx)
|
||||
{
|
||||
int upgrades = myte.getInstalledUpgrades( Upgrades.CAPACITY );
|
||||
|
||||
Reference in New Issue
Block a user