Fix armor slot index and duplicated tooltip (#45)

This commit is contained in:
Kogepan229 authored and GitHub committed 2025-12-14 12:48:29 +01:00
1 parent b86cc2eb68
commit bde9445ea4
3 files changed
+7 -76

No files matched your search

@@ -22,11 +22,9 @@ import appeng.api.parts.ICraftingTerminal;
import appeng.client.gui.implementations.GuiMEMonitorable;
import appeng.client.gui.slots.VirtualMEPinSlot;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.gui.widgets.GuiTabButton;
import appeng.container.slot.AppEngSlot;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.core.localization.GuiText;
import appeng.helpers.InventoryAction;
import cpw.mods.fml.common.Optional;
import yalter.mousetweaks.api.IMTModGuiContainer;
@@ -44,7 +42,6 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable implements IMT
public static int craftingGridOffsetX = 80;
public static int craftingGridOffsetY;
private GuiTabButton craftingStatusBtn;
private GuiImgButton clearBtn;
private GuiTrashButton trashBtn;
@@ -62,9 +59,6 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable implements IMT
@Override
protected void actionPerformed(final GuiButton btn) {
// if (btn == this.craftingStatusBtn) {
// NetworkHandler.instance.sendToServer(new PacketSwitchGuis(Reference.GUI_CRAFTING_STATUS));
// } else
if (this.clearBtn == btn) {
Slot s = null;
final Container c = this.inventorySlots;
@@ -115,15 +109,6 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable implements IMT
this.buttonList.add(this.trashBtn = new GuiTrashButton(this.guiLeft + 98, this.guiTop + this.ySize - 104));
this.clearBtn.setHalfSize(true);
this.buttonList.add(
this.craftingStatusBtn = new GuiTabButton(
this.guiLeft + 169,
this.guiTop - 4,
2 + 11 * 16,
GuiText.CraftingStatus.getLocal(),
itemRender));
this.craftingStatusBtn.setHideEdge(13);
craftingGridOffsetX = Integer.MAX_VALUE;
craftingGridOffsetY = Integer.MAX_VALUE;
@@ -151,7 +151,13 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEMonitorable
// Add armor slots
for (int i = 0; i < 4; ++i) {
armorSlot[i] = new SlotArmor(this.player, this.inventoryPlayer, 39 - i, (int) 8.5, (i * 18) - 76, i);
armorSlot[i] = new SlotArmor(
this.player,
this.inventoryPlayer,
this.inventoryPlayer.getSizeInventory() - 1 - i,
(int) 8.5,
(i * 18) - 76,
i);
this.addSlotToContainer(armorSlot[i]);
}
k = 0;
@@ -22,8 +22,6 @@ import net.p455w0rd.wirelesscraftingterminal.integration.IntegrationHelper;
import net.p455w0rd.wirelesscraftingterminal.integration.abstraction.INEI;
import net.p455w0rd.wirelesscraftingterminal.integration.modules.NEIHelpers.NEIAEShapedRecipeHandler;
import appeng.api.AEApi;
import appeng.api.storage.data.IAEItemStack;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.integration.modules.NEIHelpers.NEIAEShapelessRecipeHandler;
@@ -114,28 +112,6 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
}
}
@Override
public List<String> handleTooltip(final GuiContainer arg0, final int arg1, final int arg2,
final List<String> current) {
return current;
}
@Override
public List<String> handleItemDisplayName(final GuiContainer arg0, final ItemStack arg1,
final List<String> current) {
return current;
}
@Override
public List<String> handleItemTooltip(final GuiContainer guiScreen, final ItemStack stack, final int mouseX,
final int mouseY, final List<String> currentToolTip) {
if (guiScreen instanceof GuiWirelessCraftingTerminal) {
return ((GuiWirelessCraftingTerminal) guiScreen).handleItemTooltip(stack, mouseX, mouseY, currentToolTip);
}
return currentToolTip;
}
static final int NEI_REGULAR_SLOT_OFFSET_X = 25;
static final int NEI_REGULAR_SLOT_OFFSET_Y = 6;
@@ -160,42 +136,6 @@ public class NEI implements INEI, IContainerTooltipHandler, IIntegrationModule {
public class WCTOverlayHandler implements IOverlayHandler {
/**
* Reduces regular slot offsets to 0, 1, or 2
*/
private static final int REGULAR_SLOT_INDEX_DIVISOR = 18;
/**
* Adds NEI ingredients to the WCT crafting grid.
*
* @param ingredient
* @param overlayItems
* @return
*/
private boolean addCraftingItems(final PositionedStack ingredient, final IAEItemStack[] overlayItems) {
// Calculate the slot positions
int slotX = (ingredient.relx - NEI.NEI_REGULAR_SLOT_OFFSET_X)
/ WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
int slotY = (ingredient.rely - NEI.NEI_REGULAR_SLOT_OFFSET_Y)
/ WCTOverlayHandler.REGULAR_SLOT_INDEX_DIVISOR;
// Calculate the slot index
int slotIndex = slotX + (slotY * 3);
// Add the item to the list
overlayItems[slotIndex] = AEApi.instance().storage().createItemStack(ingredient.item);
return true;
}
protected boolean addIngredientToItems(final PositionedStack ingredient, final IAEItemStack[] overlayItems) {
// Pass to regular handler
return this.addCraftingItems(ingredient, overlayItems);
}
protected void addItemsToGUI(final IAEItemStack[] overlayItems) {
// Send the list to the server
// Packet_S_WCT.sendSetCrafting_NEI(Minecraft.getMinecraft().thePlayer,
// overlayItems);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void overlayRecipe(final GuiContainer gui, final IRecipeHandler recipe, final int recipeIndex,