mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-22 05:02:25 +00:00
allow to store crafting recipes in the inventory panel
This commit is contained in:
1 parent
674dc78b6d
commit
dccdd478b6
13 files changed
+487
-86
No files matched your search
@@ -32,13 +32,13 @@ import crazypants.util.ItemUtil;
|
||||
|
||||
public class InventoryPanelContainer extends AbstractMachineContainer implements ChangeLog {
|
||||
|
||||
public static final int CRAFTING_GRID_X = 7;
|
||||
public static final int CRAFTING_GRID_X = 24+7;
|
||||
public static final int CRAFTING_GRID_Y = 16;
|
||||
|
||||
public static final int RETURN_INV_X = 7;
|
||||
public static final int RETURN_INV_X = 24+7;
|
||||
public static final int RETURN_INV_Y = 82;
|
||||
|
||||
public static final int FILTER_SLOT_X = 233;
|
||||
public static final int FILTER_SLOT_X = 24+233;
|
||||
public static final int FILTER_SLOT_Y = 7;
|
||||
|
||||
private final HashSet<ItemEntry> changedItems;
|
||||
@@ -53,6 +53,7 @@ public class InventoryPanelContainer extends AbstractMachineContainer implements
|
||||
private int endSlotCraftingGrid;
|
||||
|
||||
private boolean updateReturnAreaSlots;
|
||||
private boolean storedRecipeExists;
|
||||
|
||||
public InventoryPanelContainer(InventoryPlayer playerInv, TileInventoryPanel te) {
|
||||
super(playerInv, te);
|
||||
@@ -128,7 +129,7 @@ public class InventoryPanelContainer extends AbstractMachineContainer implements
|
||||
|
||||
@Override
|
||||
public Point getPlayerInventoryOffset() {
|
||||
return new Point(39, 130);
|
||||
return new Point(24+39, 130);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,7 +141,7 @@ public class InventoryPanelContainer extends AbstractMachineContainer implements
|
||||
removeChangeLog();
|
||||
}
|
||||
|
||||
private TileInventoryPanel getInventoryPanel() {
|
||||
public TileInventoryPanel getInventoryPanel() {
|
||||
return (TileInventoryPanel) tileEntity;
|
||||
}
|
||||
|
||||
@@ -220,6 +221,22 @@ public class InventoryPanelContainer extends AbstractMachineContainer implements
|
||||
}
|
||||
|
||||
tileEntity.setInventorySlotContents(9, CraftingManager.getInstance().findMatchingRecipe(tmp, tileEntity.getWorldObj()));
|
||||
|
||||
checkCraftingRecipes();
|
||||
}
|
||||
|
||||
public void checkCraftingRecipes() {
|
||||
storedRecipeExists = false;
|
||||
int storedCraftingRecipes = getInventoryPanel().getStoredCraftingRecipes();
|
||||
if(hasCraftingRecipe() && storedCraftingRecipes > 0) {
|
||||
List<Slot> craftingGrid = getCraftingGridSlots();
|
||||
for(int idx = 0; idx < storedCraftingRecipes; idx++) {
|
||||
if(getInventoryPanel().getStoredCraftingRecipe(idx).isEqual(craftingGrid)) {
|
||||
storedRecipeExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -244,6 +261,10 @@ public class InventoryPanelContainer extends AbstractMachineContainer implements
|
||||
return getSlot(slotCraftResult).getHasStack();
|
||||
}
|
||||
|
||||
public boolean hasNewCraftingRecipe() {
|
||||
return hasCraftingRecipe() && !storedRecipeExists;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<SlotRange> getTargetSlotsForTransfer(int slotIndex, Slot slot) {
|
||||
if((slotIndex == slotCraftResult) || (slotIndex >= firstSlotReturn && slotIndex < endSlotReturn)) {
|
||||
|
||||
Reference in new issue
Block a user