From f343ac36e88b72b9a924feaf2a3c56470409501b Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Sat, 12 Jul 2014 20:03:17 -0500 Subject: [PATCH] Fix Assembler Crash, and You can no longer insert processing patterns into Assemblers. --- container/AEBaseContainer.java | 2 +- .../implementations/ContainerCellWorkbench.java | 10 +++++----- container/implementations/ContainerChest.java | 2 +- .../implementations/ContainerCondenser.java | 4 ++-- container/implementations/ContainerDrive.java | 2 +- .../implementations/ContainerFormationPlane.java | 10 +++++----- container/implementations/ContainerGrinder.java | 6 +++--- container/implementations/ContainerIOPort.java | 8 ++++---- .../implementations/ContainerInscriber.java | 6 +++--- .../implementations/ContainerInterface.java | 2 +- .../implementations/ContainerLevelEmitter.java | 8 ++++---- container/implementations/ContainerMAC.java | 15 ++++++++------- .../implementations/ContainerMEMonitorable.java | 3 ++- .../implementations/ContainerNetworkTool.java | 2 +- .../implementations/ContainerPatternTerm.java | 4 ++-- container/implementations/ContainerQNB.java | 2 +- .../implementations/ContainerQuartzKnife.java | 2 +- container/implementations/ContainerSecurity.java | 4 ++-- .../implementations/ContainerSpatialIOPort.java | 2 +- .../implementations/ContainerStorageBus.java | 10 +++++----- .../implementations/ContainerUpgradeable.java | 12 ++++++------ .../ContainerVibrationChamber.java | 2 +- container/implementations/ContainerWireless.java | 2 +- container/slot/OptionalSlotRestrictedInput.java | 6 ++++-- container/slot/SlotRestrictedInput.java | 16 ++++++++++++++-- 25 files changed, 79 insertions(+), 63 deletions(-) diff --git a/container/AEBaseContainer.java b/container/AEBaseContainer.java index 4ddf79393..1183dec19 100644 --- a/container/AEBaseContainer.java +++ b/container/AEBaseContainer.java @@ -64,7 +64,7 @@ import appeng.util.item.AEItemStack; public abstract class AEBaseContainer extends Container { - final InventoryPlayer invPlayer; + protected final InventoryPlayer invPlayer; final TileEntity tileEntity; final IPart part; final IGuiItemObject obj; diff --git a/container/implementations/ContainerCellWorkbench.java b/container/implementations/ContainerCellWorkbench.java index e83d7b922..fc764e3ae 100644 --- a/container/implementations/ContainerCellWorkbench.java +++ b/container/implementations/ContainerCellWorkbench.java @@ -197,7 +197,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable int offset = 0; IInventory cell = myte.getInventoryByName( "cell" ); - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.WORKBENCH_CELL, cell, 0, 152, 8 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.WORKBENCH_CELL, cell, 0, 152, 8, invPlayer ) ); IInventory inv = myte.getInventoryByName( "config" ); UpgradeInventoryWrapper = new Upgrades();// Platform.isServer() ? new Upgrades() : new AppEngInternalInventory( @@ -212,7 +212,7 @@ public class ContainerCellWorkbench extends ContainerUpgradeable { int iSLot = zz * 8 + z; addSlotToContainer( new OptionalSlotRestrictedInput( PlaceableItemType.UPGRADES, UpgradeInventoryWrapper, this, iSLot, 187 + zz * 18, - 8 + 18 * z, iSLot ) ); + 8 + 18 * z, iSLot, invPlayer ) ); } /* * if ( supportCapacity() ) { for (int w = 0; w < 2; w++) for (int z = 0; z < 9; z++) addSlotToContainer( new @@ -261,9 +261,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable ((EntityPlayerMP) icrafting).isChangingQuantityOnly = false; } } - - this.copyMode = getCopyMode(); - this.fzMode = (FuzzyMode) getFuzzyMode(); + + this.copyMode = getCopyMode(); + this.fzMode = (FuzzyMode) getFuzzyMode(); } prevStack = is; diff --git a/container/implementations/ContainerChest.java b/container/implementations/ContainerChest.java index 2469adf54..6f2cb52c7 100644 --- a/container/implementations/ContainerChest.java +++ b/container/implementations/ContainerChest.java @@ -15,7 +15,7 @@ public class ContainerChest extends AEBaseContainer super( ip, te, null ); myte = te; - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.STORAGE_CELLS, myte, 1, 80, 37 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.STORAGE_CELLS, myte, 1, 80, 37, invPlayer ) ); bindPlayerInventory( ip, 0, 166 - /* height of playerinventory */82 ); } diff --git a/container/implementations/ContainerCondenser.java b/container/implementations/ContainerCondenser.java index 62d16e206..87c59a027 100644 --- a/container/implementations/ContainerCondenser.java +++ b/container/implementations/ContainerCondenser.java @@ -20,9 +20,9 @@ public class ContainerCondenser extends AEBaseContainer super( ip, te, null ); myte = te; - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.TRASH, te, 0, 51, 52 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.TRASH, te, 0, 51, 52, ip ) ); addSlotToContainer( new SlotOutput( te, 1, 105, 52, -1 ) ); - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.STORAGE_COMPONENT, te.getInternalInventory(), 2, 101, 26 )).setStackLimit( 1 ) ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.STORAGE_COMPONENT, te.getInternalInventory(), 2, 101, 26, ip )).setStackLimit( 1 ) ); bindPlayerInventory( ip, 0, 197 - /* height of playerinventory */82 ); } diff --git a/container/implementations/ContainerDrive.java b/container/implementations/ContainerDrive.java index 75b954d07..7437d7ca3 100644 --- a/container/implementations/ContainerDrive.java +++ b/container/implementations/ContainerDrive.java @@ -18,7 +18,7 @@ public class ContainerDrive extends AEBaseContainer for (int y = 0; y < 5; y++) for (int x = 0; x < 2; x++) { - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.STORAGE_CELLS, te, x + y * 2, 71 + x * 18, 14 + y * 18 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.STORAGE_CELLS, te, x + y * 2, 71 + x * 18, 14 + y * 18, invPlayer ) ); } bindPlayerInventory( ip, 0, 199 - /* height of playerinventory */82 ); diff --git a/container/implementations/ContainerFormationPlane.java b/container/implementations/ContainerFormationPlane.java index 609306fb2..f454cce1e 100644 --- a/container/implementations/ContainerFormationPlane.java +++ b/container/implementations/ContainerFormationPlane.java @@ -68,11 +68,11 @@ public class ContainerFormationPlane extends ContainerUpgradeable } 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() ); - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() ); - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, invPlayer )).setNotDraggable() ); } @Override diff --git a/container/implementations/ContainerGrinder.java b/container/implementations/ContainerGrinder.java index d367f5859..065e6daa8 100644 --- a/container/implementations/ContainerGrinder.java +++ b/container/implementations/ContainerGrinder.java @@ -17,9 +17,9 @@ public class ContainerGrinder extends AEBaseContainer super( ip, te, null ); myte = te; - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ORE, te, 0, 12, 17 ) ); - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ORE, te, 1, 12 + 18, 17 ) ); - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ORE, te, 2, 12 + 36, 17 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ORE, te, 0, 12, 17, invPlayer ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ORE, te, 1, 12 + 18, 17, invPlayer ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ORE, te, 2, 12 + 36, 17, invPlayer ) ); addSlotToContainer( new SlotInaccessable( te, 6, 80, 40 ) ); diff --git a/container/implementations/ContainerIOPort.java b/container/implementations/ContainerIOPort.java index c990c7895..9774a1004 100644 --- a/container/implementations/ContainerIOPort.java +++ b/container/implementations/ContainerIOPort.java @@ -57,7 +57,7 @@ public class ContainerIOPort extends ContainerUpgradeable 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 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.STORAGE_CELLS, cells, x + y * 2, offx + x * 18, offy + y * 18, invPlayer ) ); offx = 122; offy = 17; @@ -66,9 +66,9 @@ public class ContainerIOPort extends ContainerUpgradeable addSlotToContainer( new SlotOutput( cells, 6 + x + y * 2, offx + x * 18, offy + y * 18, PlaceableItemType.STORAGE_CELLS.IIcon ) ); 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() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() ); } @Override diff --git a/container/implementations/ContainerInscriber.java b/container/implementations/ContainerInscriber.java index be548bc24..b335e5f07 100644 --- a/container/implementations/ContainerInscriber.java +++ b/container/implementations/ContainerInscriber.java @@ -24,9 +24,9 @@ public class ContainerInscriber extends AEBaseContainer super( ip, te, null ); myte = te; - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.INSCRIBER_PLATE, myte, 0, 45, 16 ) ); - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.INSCRIBER_INPUT, myte, 2, 63, 39 ) ); - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.INSCRIBER_PLATE, myte, 1, 45, 62 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.INSCRIBER_PLATE, myte, 0, 45, 16, invPlayer ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.INSCRIBER_INPUT, myte, 2, 63, 39, invPlayer ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.INSCRIBER_PLATE, myte, 1, 45, 62, invPlayer ) ); addSlotToContainer( new SlotOutput( myte, 3, 113, 40, -1 ) ); diff --git a/container/implementations/ContainerInterface.java b/container/implementations/ContainerInterface.java index 65e552886..8ebfd20b9 100644 --- a/container/implementations/ContainerInterface.java +++ b/container/implementations/ContainerInterface.java @@ -27,7 +27,7 @@ public class ContainerInterface extends ContainerUpgradeable myDuality = te.getInterfaceDuality(); for (int x = 0; x < 9; x++) - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ENCODED_PATTERN, myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ENCODED_PATTERN, myDuality.getPatterns(), x, 8 + 18 * x, 90 + 7, invPlayer ) ); for (int x = 0; x < 8; x++) addSlotToContainer( new SlotFake( myDuality.getConfig(), x, 17 + 18 * x, 35 ) ); diff --git a/container/implementations/ContainerLevelEmitter.java b/container/implementations/ContainerLevelEmitter.java index 38e762d68..f562034d4 100644 --- a/container/implementations/ContainerLevelEmitter.java +++ b/container/implementations/ContainerLevelEmitter.java @@ -65,13 +65,13 @@ public class ContainerLevelEmitter extends ContainerUpgradeable IInventory upgrades = myte.getInventoryByName( "upgrades" ); if ( availableUpgrades() > 0 ) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0, invPlayer )).setNotDraggable() ); if ( availableUpgrades() > 1 ) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1, invPlayer )).setNotDraggable() ); if ( availableUpgrades() > 2 ) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() ); if ( availableUpgrades() > 3 ) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() ); IInventory inv = myte.getInventoryByName( "config" ); addSlotToContainer( new SlotFakeTypeOnly( inv, 0, x, y ) ); diff --git a/container/implementations/ContainerMAC.java b/container/implementations/ContainerMAC.java index 6b6c29c0d..f3ac40f5d 100644 --- a/container/implementations/ContainerMAC.java +++ b/container/implementations/ContainerMAC.java @@ -60,7 +60,8 @@ public class ContainerMAC extends ContainerUpgradeable World w = this.getTileEntity().getWorldObj(); ItemEncodedPattern iep = (ItemEncodedPattern) is.getItem(); ICraftingPatternDetails ph = iep.getPatternForItem( is, w ); - return ph.isValidItemForSlot( slotIndex, i, w ); + if ( ph.isCraftable() ) + return ph.isValidItemForSlot( slotIndex, i, w ); } return false; @@ -84,18 +85,18 @@ public class ContainerMAC extends ContainerUpgradeable offx = 126; offy = 16; - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ENCODED_PATTERN, mac, 10, offx, offy ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.ENCODED_CRAFTING_PATTERN, mac, 10, offx, offy, invPlayer ) ); addSlotToContainer( new SlotOutput( mac, 9, offx, offy + 32, -1 ) ); offx = 122; offy = 17; 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() ); - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() ); - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, invPlayer )).setNotDraggable() ); } @Override diff --git a/container/implementations/ContainerMEMonitorable.java b/container/implementations/ContainerMEMonitorable.java index 802a645c0..397f82dd9 100644 --- a/container/implementations/ContainerMEMonitorable.java +++ b/container/implementations/ContainerMEMonitorable.java @@ -119,7 +119,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa { for (int y = 0; y < 5; y++) { - cellView[y] = new SlotRestrictedInput( PlaceableItemType.VIEWCELL, ((IViewCellStorage) montiorable).getViewCellStorage(), y, 206, y * 18 + 8 ); + cellView[y] = new SlotRestrictedInput( PlaceableItemType.VIEWCELL, ((IViewCellStorage) montiorable).getViewCellStorage(), y, 206, y * 18 + 8, + invPlayer ); cellView[y].allowEdit = canAccessViewCells; addSlotToContainer( cellView[y] ); } diff --git a/container/implementations/ContainerNetworkTool.java b/container/implementations/ContainerNetworkTool.java index 385958dff..84a24492c 100644 --- a/container/implementations/ContainerNetworkTool.java +++ b/container/implementations/ContainerNetworkTool.java @@ -21,7 +21,7 @@ public class ContainerNetworkTool extends AEBaseContainer for (int y = 0; y < 3; y++) for (int x = 0; x < 3; x++) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, te, y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18 )) ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, te, y * 3 + x, 80 - 18 + x * 18, 37 - 18 + y * 18, invPlayer )) ); bindPlayerInventory( ip, 0, 166 - /* height of playerinventory */82 ); } diff --git a/container/implementations/ContainerPatternTerm.java b/container/implementations/ContainerPatternTerm.java index 02ca43bba..02cb0c61a 100644 --- a/container/implementations/ContainerPatternTerm.java +++ b/container/implementations/ContainerPatternTerm.java @@ -81,8 +81,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA outputSlots[y].IIcon = -1; } - addSlotToContainer( patternSlotIN = new SlotRestrictedInput( PlaceableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9 ) ); - addSlotToContainer( patternSlotOUT = new SlotRestrictedInput( PlaceableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34 ) ); + addSlotToContainer( patternSlotIN = new SlotRestrictedInput( PlaceableItemType.BLANK_PATTERN, patternInv, 0, 147, -72 - 9, invPlayer ) ); + addSlotToContainer( patternSlotOUT = new SlotRestrictedInput( PlaceableItemType.ENCODED_PATTERN, patternInv, 1, 147, -72 + 34, invPlayer ) ); patternSlotOUT.setStackLimit( 1 ); diff --git a/container/implementations/ContainerQNB.java b/container/implementations/ContainerQNB.java index 590b2f944..e76f56b5e 100644 --- a/container/implementations/ContainerQNB.java +++ b/container/implementations/ContainerQNB.java @@ -15,7 +15,7 @@ public class ContainerQNB extends AEBaseContainer super( ip, te, null ); myte = te; - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.QE_SINGULARTIY, te, 0, 80, 37 )).setStackLimit( 1 ) ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.QE_SINGULARTIY, te, 0, 80, 37, invPlayer )).setStackLimit( 1 ) ); bindPlayerInventory( ip, 0, 166 - /* height of playerinventory */82 ); } diff --git a/container/implementations/ContainerQuartzKnife.java b/container/implementations/ContainerQuartzKnife.java index 5e8cdd9ba..c28549460 100644 --- a/container/implementations/ContainerQuartzKnife.java +++ b/container/implementations/ContainerQuartzKnife.java @@ -37,7 +37,7 @@ public class ContainerQuartzKnife extends AEBaseContainer implements IAEAppEngIn super( ip, null, null ); toolInv = te; - addSlotToContainer( metals = new SlotRestrictedInput( PlaceableItemType.METAL_INGOTS, inSlot, 0, 94, 44 ) ); + addSlotToContainer( metals = new SlotRestrictedInput( PlaceableItemType.METAL_INGOTS, inSlot, 0, 94, 44, ip ) ); addSlotToContainer( output = new QuartzKnifeOutput( this, 0, 134, 44, -1 ) ); lockPlayerInventorySlot( ip.currentItem ); diff --git a/container/implementations/ContainerSecurity.java b/container/implementations/ContainerSecurity.java index 2f58eafac..ae246888a 100644 --- a/container/implementations/ContainerSecurity.java +++ b/container/implementations/ContainerSecurity.java @@ -38,9 +38,9 @@ public class ContainerSecurity extends ContainerMEMonitorable implements IAEAppE securityBox = (TileSecurity) montiorable; - addSlotToContainer( configSlot = new SlotRestrictedInput( PlaceableItemType.BIOMETRIC_CARD, securityBox.configSlot, 0, 37, -33 ) ); + addSlotToContainer( configSlot = new SlotRestrictedInput( PlaceableItemType.BIOMETRIC_CARD, securityBox.configSlot, 0, 37, -33, ip ) ); - addSlotToContainer( wirelessIn = new SlotRestrictedInput( PlaceableItemType.ENCODEABLE_ITEM, wirelessEncoder, 0, 212, 10 ) ); + addSlotToContainer( wirelessIn = new SlotRestrictedInput( PlaceableItemType.ENCODEABLE_ITEM, wirelessEncoder, 0, 212, 10, ip ) ); addSlotToContainer( wirelessOut = new SlotOutput( wirelessEncoder, 1, 212, 68, -1 ) ); bindPlayerInventory( ip, 0, 0 ); diff --git a/container/implementations/ContainerSpatialIOPort.java b/container/implementations/ContainerSpatialIOPort.java index e6dcff149..ffcfb2b64 100644 --- a/container/implementations/ContainerSpatialIOPort.java +++ b/container/implementations/ContainerSpatialIOPort.java @@ -39,7 +39,7 @@ public class ContainerSpatialIOPort extends AEBaseContainer if ( Platform.isServer() ) network = te.getGridNode( ForgeDirection.UNKNOWN ).getGrid(); - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.SPATIAL_STORAGE_CELLS, te, 0, 52, 48 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.SPATIAL_STORAGE_CELLS, te, 0, 52, 48, invPlayer ) ); addSlotToContainer( new SlotOutput( te, 1, 113, 48, PlaceableItemType.SPATIAL_STORAGE_CELLS.IIcon ) ); bindPlayerInventory( ip, 0, 197 - /* height of playerinventory */82 ); diff --git a/container/implementations/ContainerStorageBus.java b/container/implementations/ContainerStorageBus.java index 1308b8f59..a843c3641 100644 --- a/container/implementations/ContainerStorageBus.java +++ b/container/implementations/ContainerStorageBus.java @@ -81,11 +81,11 @@ public class ContainerStorageBus extends ContainerUpgradeable } 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() ); - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() ); - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 4, 187, 8 + 18 * 4, invPlayer )).setNotDraggable() ); } @Override diff --git a/container/implementations/ContainerUpgradeable.java b/container/implementations/ContainerUpgradeable.java index 0a5792744..80ff37275 100644 --- a/container/implementations/ContainerUpgradeable.java +++ b/container/implementations/ContainerUpgradeable.java @@ -78,8 +78,8 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl { for (int v = 0; v < 3; v++) for (int u = 0; u < 3; u++) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, tbinv, u + v * 3, 186 + u * 18, getHeight() - 82 + v * 18 )) - .setPlayerSide() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, tbinv, u + v * 3, 186 + u * 18, getHeight() - 82 + v * 18, + invPlayer )).setPlayerSide() ); } setupConfig(); @@ -91,13 +91,13 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl { IInventory upgrades = myte.getInventoryByName( "upgrades" ); if ( availableUpgrades() > 0 ) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 0, 187, 8 + 18 * 0, invPlayer )).setNotDraggable() ); if ( availableUpgrades() > 1 ) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 1, 187, 8 + 18 * 1, invPlayer )).setNotDraggable() ); if ( availableUpgrades() > 2 ) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 2, 187, 8 + 18 * 2, invPlayer )).setNotDraggable() ); if ( availableUpgrades() > 3 ) - addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3 )).setNotDraggable() ); + addSlotToContainer( (new SlotRestrictedInput( PlaceableItemType.UPGRADES, upgrades, 3, 187, 8 + 18 * 3, invPlayer )).setNotDraggable() ); } protected void setupConfig() diff --git a/container/implementations/ContainerVibrationChamber.java b/container/implementations/ContainerVibrationChamber.java index d904a8855..6d70da9c3 100644 --- a/container/implementations/ContainerVibrationChamber.java +++ b/container/implementations/ContainerVibrationChamber.java @@ -17,7 +17,7 @@ public class ContainerVibrationChamber extends AEBaseContainer super( ip, te, null ); myte = te; - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.FUEL, te, 0, 80, 37 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.FUEL, te, 0, 80, 37, invPlayer ) ); bindPlayerInventory( ip, 0, 166 - /* height of playerinventory */82 ); } diff --git a/container/implementations/ContainerWireless.java b/container/implementations/ContainerWireless.java index 3b8db7007..6f1b90b79 100644 --- a/container/implementations/ContainerWireless.java +++ b/container/implementations/ContainerWireless.java @@ -15,7 +15,7 @@ public class ContainerWireless extends AEBaseContainer super( ip, te, null ); myte = te; - addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.RANGE_BOOSTER, myte, 0, 80, 37 ) ); + addSlotToContainer( new SlotRestrictedInput( PlaceableItemType.RANGE_BOOSTER, myte, 0, 80, 37, invPlayer ) ); bindPlayerInventory( ip, 0, 166 - /* height of playerinventory */82 ); } diff --git a/container/slot/OptionalSlotRestrictedInput.java b/container/slot/OptionalSlotRestrictedInput.java index be730297e..4b47df34d 100644 --- a/container/slot/OptionalSlotRestrictedInput.java +++ b/container/slot/OptionalSlotRestrictedInput.java @@ -1,5 +1,6 @@ package appeng.container.slot; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.IInventory; public class OptionalSlotRestrictedInput extends SlotRestrictedInput @@ -8,8 +9,9 @@ public class OptionalSlotRestrictedInput extends SlotRestrictedInput final int groupNum; IOptionalSlotHost host; - public OptionalSlotRestrictedInput(PlaceableItemType valid, IInventory i, IOptionalSlotHost host, int slotnum, int x, int y, int grpNum) { - super( valid, i, slotnum, x, y ); + public OptionalSlotRestrictedInput(PlaceableItemType valid, IInventory i, IOptionalSlotHost host, int slotnum, int x, int y, int grpNum, + InventoryPlayer invPlayer) { + super( valid, i, slotnum, x, y, invPlayer ); this.groupNum = grpNum; this.host = host; } diff --git a/container/slot/SlotRestrictedInput.java b/container/slot/SlotRestrictedInput.java index a9fd05714..b38aa08f8 100644 --- a/container/slot/SlotRestrictedInput.java +++ b/container/slot/SlotRestrictedInput.java @@ -1,6 +1,7 @@ package appeng.container.slot; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; @@ -31,7 +32,7 @@ public class SlotRestrictedInput extends AppEngSlot ENCODEABLE_ITEM(4 * 16 + 15), TRASH(5 * 16 + 15), VALID_ENCODED_PATTERN_W_OUPUT(7 * 16 + 15), ENCODED_PATTERN_W_OUTPUT(7 * 16 + 15), - ENCODED_PATTERN(7 * 16 + 15), PATTERN(8 * 16 + 15), BLANK_PATTERN(8 * 16 + 15), POWERED_TOOL(9 * 16 + 15), + ENCODED_CRAFTING_PATTERN(7 * 16 + 15), ENCODED_PATTERN(7 * 16 + 15), PATTERN(8 * 16 + 15), BLANK_PATTERN(8 * 16 + 15), POWERED_TOOL(9 * 16 + 15), RANGE_BOOSTER(6 * 16 + 15), QE_SINGULARTIY(10 * 16 + 15), SPATIAL_STORAGE_CELLS(11 * 16 + 15), @@ -70,6 +71,7 @@ public class SlotRestrictedInput extends AppEngSlot public PlaceableItemType which; public boolean allowEdit = true; public int stackLimit = -1; + private InventoryPlayer p; @Override public boolean canTakeStack(EntityPlayer par1EntityPlayer) @@ -83,10 +85,11 @@ public class SlotRestrictedInput extends AppEngSlot return this; } - public SlotRestrictedInput(PlaceableItemType valid, IInventory i, int slotnum, int x, int y) { + public SlotRestrictedInput(PlaceableItemType valid, IInventory i, int slotnum, int x, int y, InventoryPlayer p) { super( i, slotnum, x, y ); which = valid; IIcon = valid.IIcon; + this.p = p; } @Override @@ -123,6 +126,15 @@ public class SlotRestrictedInput extends AppEngSlot switch (which) { + case ENCODED_CRAFTING_PATTERN: + if ( i.getItem() instanceof ICraftingPatternItem ) + { + ICraftingPatternItem b = (ICraftingPatternItem) i.getItem(); + ICraftingPatternDetails de = b.getPatternForItem( i, p.player.worldObj ); + if ( de != null ) + return de.isCraftable(); + } + return false; case VALID_ENCODED_PATTERN_W_OUPUT: case ENCODED_PATTERN_W_OUTPUT: case ENCODED_PATTERN: {