Compare commits

..
5 Commits
Author SHA1 Message Date
Martin Robertz 07fd1eef26 Merge pull request #23 from GTNewHorizons/hotfix-infinity-booster
Prevent the infinity booster from getting pulled out by accident
2022-09-19 13:26:38 +02:00
Raven Szewczyk 5c4d3d11c9 Prevent the infinity booster from getting pulled out by accident 2022-09-17 11:03:46 +01:00
Martin Robertz fc8f956316 Update BS+SA 2022-09-16 19:26:59 +02:00
Martin Robertz f920eed9dd Merge pull request #22 from asdflj/master
fix crafting terminal crash
2022-09-16 16:58:57 +02:00
zy f9e3f80f6b fix crafting terminal crash
fix in crafting terminal use hot key to transfer current crafting terminal item to craft slot crash
2022-09-16 22:34:00 +08:00
2 changed files with 18 additions and 17 deletions

No files matched your search

@@ -29,7 +29,6 @@ import appeng.container.AEBaseContainer;
import appeng.container.ContainerNull;
import appeng.container.slot.AppEngCraftingSlot;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.NullSlot;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotCraftingTerm;
import appeng.container.slot.SlotDisabled;
@@ -113,7 +112,7 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
public ItemStack[] craftMatrixInventory;
private final World worldObj;
private final EntityPlayer player;
public static final int HOTBAR_START = 1,
public static final int HOTBAR_START = 2,
HOTBAR_END = HOTBAR_START + 8,
INV_START = HOTBAR_END + 1,
INV_END = INV_START + 26,
@@ -124,12 +123,11 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
CRAFT_RESULT = CRAFT_GRID_END + 1,
VIEW_CELL_START = CRAFT_RESULT + 1,
VIEW_CELL_END = VIEW_CELL_START + 4,
BOOSTER_INDEX = 0,
BOOSTER_INDEX = 1,
MAGNET_INDEX = VIEW_CELL_END + 1;
public static int CRAFTING_SLOT_X_POS = 80, CRAFTING_SLOT_Y_POS = 83;
private SlotBooster boosterSlot;
private final SlotMagnet magnetSlot;
private NullSlot nullSlot;
private final Slot[] hotbarSlot;
private final Slot[] inventorySlot;
private final SlotArmor[] armorSlot;
@@ -214,17 +212,24 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
this.monitor = null;
}
// Dummy slot at index 0 to work around ME slots all having their slot number set to 0.
this.addSlotToContainer(new SlotInaccessible(new AppEngInternalInventory(null, 1), 0, -1000, -1000));
if (Reference.WCT_BOOSTER_ENABLED) {
boosterSlot = new SlotBooster(this.boosterInventory, 0, 134, -20);
this.addSlotToContainer(boosterSlot);
} else {
nullSlot = new NullSlot();
this.addSlotToContainer(nullSlot);
this.addSlotToContainer(new SlotInaccessible(new AppEngInternalInventory(null, 1), 0, -1000, -1000));
}
// Add hotbar slots
for (int i = 0; i < 9; ++i) {
hotbarSlot[i] = new SlotPlayerHotBar(this.inventoryPlayer, i, i * 18 + 8, 58);
if (player.inventory.getStackInSlot(i) != null
&& player.inventory.getStackInSlot(i).getItem() == this.thisItem) {
hotbarSlot[i] = new SlotDisabled(this.inventoryPlayer, i, i * 18 + 8, 58);
} else {
hotbarSlot[i] = new SlotPlayerHotBar(this.inventoryPlayer, i, i * 18 + 8, 58);
}
this.addSlotToContainer(hotbarSlot[i]);
}
@@ -233,7 +238,12 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
// Add player inventory slots
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 9; ++j) {
inventorySlot[k] = new SlotPlayerInv(this.inventoryPlayer, j + i * 9 + 9, j * 18 + 8, i * 18);
if (player.inventory.getStackInSlot(j + i * 9 + 9) != null
&& player.inventory.getStackInSlot(j + i * 9 + 9).getItem() == this.thisItem) {
inventorySlot[k] = new SlotDisabled(this.inventoryPlayer, j + i * 9 + 9, j * 18 + 8, i * 18);
} else {
inventorySlot[k] = new SlotPlayerInv(this.inventoryPlayer, j + i * 9 + 9, j * 18 + 8, i * 18);
}
this.addSlotToContainer(inventorySlot[k]);
k++;
}
@@ -1317,8 +1327,6 @@ public class ContainerWirelessCraftingTerminal extends AEBaseContainer
&& getSlot(slot) != null
&& getSlot(slot).getStack() == RandomUtils.getWirelessTerm(player.inventory)) {
return null;
} else if (player.inventory.currentItem == button && flag == 2) {
return null;
}
return super.slotClick(slot, button, flag, player);
} catch (IndexOutOfBoundsException e) {
@@ -51,13 +51,6 @@ public class KeybindHandler {
IWirelessCraftingTerminalItem wirelessTerm = (IWirelessCraftingTerminalItem) is.getItem();
if (wirelessTerm != null && wirelessTerm.isWirelessCraftingEnabled(is)) {
if (!FMLClientHandler.instance().isGUIOpen(GuiWirelessCraftingTerminal.class)) {
for (int i = 0; i < p.inventory.mainInventory.length; ++i) {
if (p.inventory.mainInventory[i] != null
&& p.inventory.mainInventory[i].getItem() == wirelessTerm) {
p.inventory.currentItem = i + 1;
break;
}
}
NetworkHandler.instance.sendToServer(new PacketOpenGui(Reference.GUI_WCT));
}
}