Compare commits

..
9 Commits
Author SHA1 Message Date
Martin Robertz 3d15a78bef update+gradle+bs+deps 2026-02-28 21:43:59 +01:00
lc-1337andMartin Robertz 0b55097ea0 Fix container interaction tooltip (#48)
Co-authored-by: Martin Robertz <[email protected]>
2026-02-28 13:12:12 +01:00
lc-1337 a3b9b72065 fix log spam (#49) 2026-02-28 13:11:55 +01:00
Kogepan229andMartin Robertz 81ab446772 Fix primary gui (#47)
Co-authored-by: Martin Robertz <[email protected]>
2025-12-20 10:13:49 +00:00
lc-1337 b6c46b17d9 fix terminal in baubles & update hard deps (#46) 2025-12-16 23:44:11 +09:00
Kogepan229 bde9445ea4 Fix armor slot index and duplicated tooltip (#45) 2025-12-14 12:48:29 +01:00
Martin Robertz b86cc2eb68 Merge remote-tracking branch 'origin/master' 2025-12-11 16:42:09 +01:00
Martin Robertz 5875aeefcc update bs+dep 2025-12-11 16:41:07 +01:00
e3f344e5c2 Universal GUI (#44)
Co-authored-by: lc-1337 <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
2025-12-11 16:39:33 +01:00
21 changed files with 190 additions and 181 deletions

No files matched your search

+5 -5
View File
@@ -1,11 +1,11 @@
// Add your dependencies here
dependencies {
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-731-GTNH-pre:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-847-GTNH:dev")
implementation("com.github.GTNewHorizons:Baubles-Expanded:2.2.2-GTNH:dev")
implementation("com.github.GTNewHorizons:Baubles-Expanded:2.2.6-GTNH:dev")
compileOnly("curse.maven:cofh-core-69162:2388751")
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.26-GTNH:dev")
compileOnly("com.github.GTNewHorizons:MouseTweaks:2.4.20-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:EnderIO:2.10.3:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:NotEnoughItems:2.8.71-GTNH:dev")
compileOnly("com.github.GTNewHorizons:MouseTweaks:2.5.0-GTNH:dev") { transitive = false }
compileOnly("com.github.GTNewHorizons:EnderIO:2.10.20:dev") { transitive = false }
}
+30 -3
View File
@@ -39,9 +39,33 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
developmentEnvironmentUserName = Developer
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
# See https://github.com/bsideup/jabel for details on how this works.
enableModernJavaSyntax = true
# Enables modern Java syntax support. Valid values:
# - false: No modern syntax, Java 8 only
# - jabel: Jabel syntax-only support, compiles to J8 bytecode
# - jvmDowngrader: Full modern Java via JVM Downgrader (syntax + stdlib APIs)
# - modern: Native modern Java bytecode, no downgrading
enableModernJavaSyntax = jabel
# If set, ignores the above setting and compiles with the given toolchain. This may cause unexpected issues,
# and should *not* be used in most situations. -1 disables this.
# forceToolchainVersion = -1
# Target JVM version for JVM Downgrader bytecode downgrading.
# Only used when enableModernJavaSyntax = jvmDowngrader
# downgradeTargetVersion = 8
# Comma-separated list of Java versions for multi-release jar support (JVM Downgrader only).
# Classes will be available in META-INF/versions/N/ for each version N in this list.
# Default: "21,25" (J25+ gets native classes, J21-24 gets partial downgrade, J8-20 gets full downgrade).
# jvmDowngraderMultiReleaseVersions = 21,25
# Specifies how JVM Downgrader API stubs are provided. Options:
# - shade: Shade minimized stubs into the jar
# - gtnhlib: GTNHLib provides stubs at runtime (adds version constraint)
# - external: Another dependency provides stubs (no constraint, no warning)
# - (empty): Warning reminding you to configure stubs
# Note: 'shade' option requires you to verify license compliance, see: https://github.com/unimined/JvmDowngrader/blob/main/LICENSE.md
# jvmDowngraderStubsProvider =
# Enables injecting missing generics into the decompiled source code for a better coding experience.
# Turns most publicly visible List, Map, etc. into proper List<E>, Map<K, V> types.
@@ -209,3 +233,6 @@ customArchiveBaseName = WirelessCraftingTerminal
# This is meant to be set in $HOME/.gradle/gradle.properties.
# ideaCheckSpotlessOnBuild = true
# Non-GTNH properties
org.gradle.configuration-cache = true
org.gradle.parallel = true
+12
View File
@@ -0,0 +1,12 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/4945f00643ec68e7c7a6b66f90124f89/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/4945f00643ec68e7c7a6b66f90124f89/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/46949723aaa20c7b64d7ecfed7207034/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/f636c800fdb3f9ae33f019dfa048ba72/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/4945f00643ec68e7c7a6b66f90124f89/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/b41931cf1e70bc8e08d7dd19c343ef00/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/1e91f45234d88a64dafb961c93ddc75a/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/0ef34dd9312b12d61ba1b8e66126d140/redirect
toolchainVersion=25
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Vendored
+1 -4
View File
@@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@@ -114,7 +114,6 @@ case "$( uname )" in #(
NONSTOP* ) nonstop=true ;;
esac
CLASSPATH="\\\"\\\""
# Determine the Java command to use to start the JVM.
@@ -172,7 +171,6 @@ fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
@@ -212,7 +210,6 @@ DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-classpath "$CLASSPATH" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
Vendored
+1 -2
View File
@@ -70,11 +70,10 @@ goto fail
:execute
@rem Setup the command line
set CLASSPATH=
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
+1 -1
View File
@@ -17,7 +17,7 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.48'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '2.0.20'
}
@@ -22,7 +22,7 @@ public class GuiMagnet extends GuiContainer {
public boolean ignoreNBT = false;
public boolean ignoreMeta = false;
public boolean useOreDict = false;
private ItemStack magnetItem;
private final ItemStack magnetItem;
private WCTGuiCheckBox ignoreNBTBox;
private WCTGuiCheckBox ignoreMetaBox;
private WCTGuiCheckBox useOreDictBox;
@@ -2,7 +2,6 @@ package net.p455w0rd.wirelesscraftingterminal.client.gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
@@ -13,20 +12,16 @@ import net.p455w0rd.wirelesscraftingterminal.common.container.slot.SlotTrash;
import net.p455w0rd.wirelesscraftingterminal.core.sync.network.NetworkHandler;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketEmptyTrash;
import net.p455w0rd.wirelesscraftingterminal.core.sync.packets.PacketInventoryAction;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.reference.Reference;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
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,13 +39,11 @@ 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;
private int currentMouseX = 0;
private int currentMouseY = 0;
private final int lowerTextureOffset = 0;
public GuiWirelessCraftingTerminal(final InventoryPlayer inventoryPlayer, ICraftingTerminal host) {
super(inventoryPlayer, host, new ContainerWirelessCraftingTerminal(inventoryPlayer, host));
@@ -63,9 +56,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;
@@ -116,15 +106,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;
@@ -160,18 +141,12 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable implements IMT
this.ySize_lo = (float) mouseY;
}
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
String s = LocaleHandler.WirelessTermLabel.getLocal();
this.mc.fontRenderer.drawString(s, 7, 5, 4210752);
this.mc.fontRenderer.drawString(I18n.format("container.inventory"), 7, this.ySize - 172 + 3, 4210752);
VirtualMEPinSlot.drawSlotsBackground(this.pinSlots, this.mc, this.zLevel);
this.currentMouseX = mouseX;
this.currentMouseY = mouseY;
@Override
protected String getGuiDisplayName(String in) {
return in;
}
@Override
public void drawBG(final int offsetX, final int offsetY, final int mouseX, final int mouseY) {
// draw "over inventory area"
this.mc.getTextureManager().bindTexture(BackgroundTexture);
@@ -185,11 +160,11 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable implements IMT
// draw player inv
this.drawTexturedModalRect(
offsetX,
offsetY + 16 + this.rows * 18 + this.lowerTextureOffset,
offsetY + 16 + this.rows * 18,
0,
106 - 18 - 18,
x_width,
99 + this.getReservedSpace() - this.lowerTextureOffset);
99 + this.getReservedSpace());
// draw view cells background
this.drawTexturedModalRect(offsetX + x_width, offsetY, x_width, 0, 32, 104);
@@ -263,8 +238,7 @@ public class GuiWirelessCraftingTerminal extends GuiMEMonitorable implements IMT
@Override
@Optional.Method(modid = "MouseTweaks")
public Object getModSelectedSlot(Object modContainer, int slotCount) {
Slot s = getSlot(currentMouseX, currentMouseY);
return s;
return getSlot(currentMouseX, currentMouseY);
}
@Override
@@ -1,6 +1,7 @@
package net.p455w0rd.wirelesscraftingterminal.common;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
@@ -16,6 +17,7 @@ import appeng.api.AEApi;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import cpw.mods.fml.common.network.IGuiHandler;
import it.unimi.dsi.fastutil.ints.IntObjectPair;
public class WCTGuiHandler implements IGuiHandler {
@@ -33,14 +35,8 @@ public class WCTGuiHandler implements IGuiHandler {
return null;
}
final WTCGuiObject term = new WTCGuiObject(
wh,
RandomUtils.getWirelessTerm(player.inventory),
player,
world,
x,
y,
z);
final IntObjectPair<ItemStack> termItem = RandomUtils.getWirelessTermWithSlot(player.inventory);
final WTCGuiObject term = new WTCGuiObject(wh, termItem.second(), player, world, x, y, z, termItem.firstInt());
return switch (guiId) {
case Reference.GUI_WCT -> updateGui(
@@ -60,14 +56,16 @@ public class WCTGuiHandler implements IGuiHandler {
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries().wireless()
.getWirelessTerminalHandler(RandomUtils.getWirelessTerm(player.inventory));
if (wh != null && guiId == Reference.GUI_WCT) {
final IntObjectPair<ItemStack> termItem = RandomUtils.getWirelessTermWithSlot(player.inventory);
final WTCGuiObject obj = new WTCGuiObject(
wh,
RandomUtils.getWirelessTerm(player.inventory),
termItem.second(),
player,
world,
x,
y,
z);
z,
termItem.firstInt());
return new GuiWirelessCraftingTerminal(player.inventory, obj);
}
if (guiId == Reference.GUI_MAGNET) {
@@ -42,7 +42,9 @@ import cpw.mods.fml.common.network.NetworkRegistry;
+ '.' // revisionVersion
+ net.minecraftforge.common.ForgeVersion.buildVersion
+ ",);"
+ "required-after:appliedenergistics2@[rv3-beta-328,);after:NotEnoughItems;")
+ "required-after:"
+ "appliedenergistics2@[rv3-beta-754,);after:"
+ "NotEnoughItems;")
public class WirelessCraftingTerminal {
private static LoaderState WCTState = LoaderState.NOINIT;
@@ -97,13 +97,15 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEMonitorable
this.setCustomName("WCTContainer");
this.boosterInventory = new WCTInventoryBooster(RandomUtils.getWirelessTerm(inventoryPlayer));
this.magnetInventory = new WCTInventoryMagnet(RandomUtils.getWirelessTerm(inventoryPlayer));
this.trashInventory = new WCTInventoryTrash(RandomUtils.getWirelessTerm(inventoryPlayer));
this.containerstack = RandomUtils.getWirelessTerm(inventoryPlayer);
final ItemStack wirelessTerminal = RandomUtils.getWirelessTerm(inventoryPlayer);
this.boosterInventory = new WCTInventoryBooster(wirelessTerminal);
this.magnetInventory = new WCTInventoryMagnet(wirelessTerminal);
this.trashInventory = new WCTInventoryTrash(wirelessTerminal);
this.containerstack = wirelessTerminal;
this.thisItem = (IWirelessCraftingTerminalItem) this.containerstack.getItem();
this.craftingGrid = new WCTInventoryCrafting(this, 3, 3, containerstack);
this.viewCellInventory = new WCTInventoryViewCell(RandomUtils.getWirelessTerm(inventoryPlayer));
this.viewCellInventory = new WCTInventoryViewCell(wirelessTerminal);
this.inventoryPlayer = inventoryPlayer;
this.player = player;
craftMatrixInventory = new ItemStack[9];
@@ -151,7 +153,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;
@@ -292,12 +300,12 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEMonitorable
}
public static WTCGuiObject getGuiObject(final ItemStack it, final EntityPlayer player, final World w, final int x,
final int y, final int z) {
final int y, final int z, final int slotIndex) {
if (it != null) {
final IWirelessCraftingTermHandler wh = (IWirelessCraftingTermHandler) AEApi.instance().registries()
.wireless().getWirelessTerminalHandler(it);
if (wh != null) {
return new WTCGuiObject(wh, it, player, w, x, y, z);
return new WTCGuiObject(wh, it, player, w, x, y, z, slotIndex);
}
}
@@ -527,7 +535,7 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEMonitorable
}
@Override
public PrimaryGui getPrimaryGui() {
public PrimaryGui createPrimaryGui() {
ContainerOpenContext context = getOpenContext();
return new WCTPrimaryGui(
Reference.GUI_WCT,
@@ -25,6 +25,11 @@ public class SlotTrash extends appeng.container.slot.AppEngSlot {
return itemStack;
}
@Override
public ItemStack getDisplayStack() {
return this.getStack();
}
@Override
public boolean getHasStack() {
return itemStack != null;
@@ -1,5 +1,7 @@
package net.p455w0rd.wirelesscraftingterminal.common.utils;
import static appeng.util.Platform.baublesSlotsOffset;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -13,6 +15,8 @@ import baubles.api.BaublesApi;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import it.unimi.dsi.fastutil.ints.IntObjectImmutablePair;
import it.unimi.dsi.fastutil.ints.IntObjectPair;
public class RandomUtils {
@@ -86,6 +90,48 @@ public class RandomUtils {
return wirelessTerm;
}
public static IntObjectPair<ItemStack> getWirelessTermWithSlot(InventoryPlayer playerInv) {
if (playerInv.player.getHeldItem() != null
&& playerInv.player.getHeldItem().getItem() instanceof IWirelessCraftingTerminalItem) {
return new IntObjectImmutablePair<>(playerInv.player.inventory.currentItem, playerInv.player.getHeldItem());
}
IntObjectPair<ItemStack> wirelessTerm = null;
int invSize = playerInv.getSizeInventory();
if (invSize <= 0) {
return null;
}
for (int i = 0; i < invSize; ++i) {
ItemStack item = playerInv.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = new IntObjectImmutablePair<>(i, item);
break;
}
}
if (isBaublesLoaded) {
IInventory handler = BaublesApi.getBaubles(playerInv.player);
if (handler != null) {
invSize = handler.getSizeInventory();
for (int i = 0; i < invSize; ++i) {
ItemStack item = handler.getStackInSlot(i);
if (item == null) {
continue;
}
if (item.getItem() instanceof IWirelessCraftingTerminalItem) {
wirelessTerm = new IntObjectImmutablePair<>(i + baublesSlotsOffset, item);
break;
}
}
}
}
return wirelessTerm;
}
public static ItemStack getMagnet(InventoryPlayer playerInv) {
// Is player holding a Magnet Card?
if (playerInv.player.getHeldItem() != null && playerInv.player.getHeldItem().getItem() instanceof ItemMagnet) {
@@ -43,6 +43,7 @@ import appeng.util.item.AEItemStack;
import appeng.util.prioitylist.IPartitionList;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import it.unimi.dsi.fastutil.ints.IntObjectPair;
public class PacketNEIRecipe extends WCTPacket {
@@ -93,13 +94,15 @@ public class PacketNEIRecipe extends WCTPacket {
IGridNode node = cct.getNetworkNode();
if (node == null) {
IntObjectPair<ItemStack> termItem = RandomUtils.getWirelessTermWithSlot(player.inventory);
WTCGuiObject obj = ContainerWirelessCraftingTerminal.getGuiObject(
RandomUtils.getWirelessTerm(player.inventory),
termItem.second(),
player,
player.worldObj,
(int) player.posX,
(int) player.posY,
(int) player.posZ);
(int) player.posZ,
termItem.firstInt());
node = obj.getActionableNode(true);
}
if (node != null) {
@@ -11,8 +11,12 @@ import appeng.items.contents.WirelessCraftingTerminalGuiObject;
public class WTCGuiObject extends WirelessCraftingTerminalGuiObject implements WCTIActionHost {
public WTCGuiObject(IWirelessTermHandler wh, ItemStack is, EntityPlayer ep, World w, int x, int y, int z) {
private final int slotIndex;
public WTCGuiObject(IWirelessTermHandler wh, ItemStack is, EntityPlayer ep, World w, int x, int y, int z,
final int slotIndex) {
super(wh, is, ep, w, x, y, z);
this.slotIndex = slotIndex;
}
@Override
@@ -24,4 +28,9 @@ public class WTCGuiObject extends WirelessCraftingTerminalGuiObject implements W
}
return null;
}
@Override
public int getInventorySlot() {
return this.slotIndex;
}
}
@@ -3,7 +3,6 @@ package net.p455w0rd.wirelesscraftingterminal.implementation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.FakePlayer;
import net.p455w0rd.wirelesscraftingterminal.api.IWCTInteractionHelper;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTermHandler;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
@@ -19,8 +18,7 @@ public class WCTInteractionHelper implements IWCTInteractionHelper {
@Override
public void openWirelessCraftingTerminalGui(final EntityPlayer player) {
if ((player == null) || (player instanceof FakePlayer)
|| (player instanceof EntityPlayerMP)
if (player == null || player instanceof EntityPlayerMP
|| FMLCommonHandler.instance().getSide() == Side.SERVER) {
return;
}
@@ -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,
@@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.p455w0rd.wirelesscraftingterminal.api.IWirelessCraftingTerminalItem;
import net.p455w0rd.wirelesscraftingterminal.api.WCTApi;
import net.p455w0rd.wirelesscraftingterminal.common.WCTGuiHandler;
import net.p455w0rd.wirelesscraftingterminal.common.utils.RandomUtils;
import net.p455w0rd.wirelesscraftingterminal.handlers.LocaleHandler;
import net.p455w0rd.wirelesscraftingterminal.integration.EnderIO;
@@ -25,7 +25,6 @@ import org.lwjgl.input.Keyboard;
import com.google.common.base.Optional;
import appeng.api.config.AccessRestriction;
import appeng.api.config.PowerMultiplier;
import appeng.api.config.PowerUnits;
import appeng.api.config.Settings;
import appeng.api.config.SortDir;
@@ -40,7 +39,6 @@ import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
import baubles.api.BaubleType;
import baubles.api.expanded.IBaubleExpanded;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@@ -49,14 +47,13 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
implements IWirelessCraftingTerminalItem, IWirelessTermHandler, IBaubleExpanded {
public static final String LINK_KEY_STRING = "key";
public static double GLOBAL_POWER_MULTIPLIER = PowerMultiplier.CONFIG.multiplier;
private static final String POWER_NBT_KEY = "internalCurrentPower";
private static final String BOOSTER_SLOT_NBT = "BoosterSlot";
private static final String MAGNET_SLOT_NBT = "MagnetSlot";
private EntityPlayer entityPlayer;
public ItemWirelessCraftingTerminal() {
super(Reference.WCT_MAX_POWER, Optional.<String>absent());
super(Reference.WCT_MAX_POWER, Optional.absent());
setUnlocalizedName("wirelessCraftingTerminal");
setTextureName(Reference.MODID + ":wirelessCraftingTerminal");
setMaxStackSize(1);
@@ -149,16 +146,16 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
@Override
public void onUpdate(final ItemStack is, final World w, final Entity e, int i, boolean f) {
if (!(e instanceof EntityPlayer)) {
if (!(e instanceof EntityPlayer p)) {
return;
}
EntityPlayer p = (EntityPlayer) e;
if (entityPlayer == null) {
entityPlayer = p;
}
ItemStack wirelessTerminal = null;
InventoryPlayer inv = p.inventory;
wirelessTerminal = RandomUtils.getWirelessTerm(inv);
ItemStack wirelessTerminal = RandomUtils.getWirelessTerm(inv);
if (wirelessTerminal == null || !(wirelessTerminal.getItem() instanceof IWirelessCraftingTerminalItem)) {
return;
}
@@ -167,10 +164,16 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
@Override
public ItemStack onItemRightClick(final ItemStack itemStack, final World world, final EntityPlayer player) {
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
// Open the gui
WCTApi.instance().interact().openWirelessCraftingTerminalGui(player);
if (!world.isRemote) {
WCTGuiHandler.launchGui(
Reference.GUI_WCT,
player,
player.worldObj,
(int) player.posX,
(int) player.posY,
(int) player.posZ);
}
return itemStack;
}
@@ -216,11 +219,6 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
return getAECurrentPower(is) >= amt;
}
@Override
public boolean hasInfinityPower(ItemStack is) {
return false;
}
@Override
public boolean hasInfinityRange(ItemStack is) {
return this.checkForBooster(is);
@@ -231,9 +229,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
final ConfigManager out = new ConfigManager(new IConfigManagerHost() {
@Override
public void updateSetting(final IConfigManager manager,
@SuppressWarnings("rawtypes") final Enum settingName,
@SuppressWarnings("rawtypes") final Enum newValue) {
public void updateSetting(final IConfigManager manager, final Enum settingName, final Enum newValue) {
final NBTTagCompound data = Platform.openNbtData(target);
manager.writeToNBT(data);
}
@@ -247,44 +243,39 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
return out;
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@SuppressWarnings({ "unchecked" })
@Override
public void getCheckedSubItems(Item item, CreativeTabs creativeTab, List itemList) {
List itemList2 = itemList;
itemList2.add(new ItemStack(item));
itemList.add(new ItemStack(item));
ItemStack is = new ItemStack(item);
injectAEPower(is, Reference.WCT_MAX_POWER);
itemList2.add(is);
itemList.add(is);
}
@Override
public boolean showDurabilityBar(ItemStack is) {
double aeCurrPower = getAECurrentPower(is);
double aeMaxPower = getAEMaxPower(is);
if ((int) aeCurrPower >= (int) aeMaxPower) {
return false;
}
return true;
return (int) aeCurrPower < (int) aeMaxPower;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@SuppressWarnings({ "unchecked" })
@SideOnly(Side.CLIENT)
@Override
public void addCheckedInformation(ItemStack is, EntityPlayer player, List list, boolean displayMore) {
String shift = LocaleHandler.PressShift.getLocal().replace(
"Shift",
color("yellow") + "" + color("bold") + "" + color("italics") + "Shift" + color("gray"));
String shift = LocaleHandler.PressShift.getLocal()
.replace("Shift", color("yellow") + color("bold") + color("italics") + "Shift" + color("gray"));
final NBTTagCompound tag = ensureTagCompound(is);
String encKey = tag.getString("key");
String pctTxtColor = color("white") + "";
String pctTxtColor = color("white");
double aeCurrPower = getAECurrentPower(is);
double aeCurrPowerPct = (int) Math.floor(aeCurrPower / Reference.WCT_MAX_POWER * 1e4) / 1e2;
if ((int) aeCurrPowerPct >= 75) {
pctTxtColor = color("green") + "";
pctTxtColor = color("green");
}
if ((int) aeCurrPowerPct <= 5) {
pctTxtColor = color("red") + "";
pctTxtColor = color("red");
}
list.add(color("aqua") + "==============================");
list.add(
@@ -300,10 +291,10 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
linked = color("blue") + StatCollector.translateToLocal("gui.appliedenergistics2.Linked");
}
list.add(LocaleHandler.LinkStatus.getLocal() + ": " + linked);
String boosterStatus = (checkForBooster(is) ? color("green") + "" + LocaleHandler.Installed.getLocal()
: color("red") + "" + LocaleHandler.NotInstalled.getLocal());
String magnetStatus = (isMagnetInstalled(is) ? color("green") + "" + LocaleHandler.Installed.getLocal()
: color("red") + "" + LocaleHandler.NotInstalled.getLocal());
String boosterStatus = (checkForBooster(is) ? color("green") + LocaleHandler.Installed.getLocal()
: color("red") + LocaleHandler.NotInstalled.getLocal());
String magnetStatus = (isMagnetInstalled(is) ? color("green") + LocaleHandler.Installed.getLocal()
: color("red") + LocaleHandler.NotInstalled.getLocal());
if (Reference.WCT_BOOSTER_ENABLED) {
list.add(getItemName("infinityBoosterCard") + ": " + boosterStatus);
}
@@ -365,10 +356,7 @@ public class ItemWirelessCraftingTerminal extends AERootPoweredItem
}
private NBTTagCompound ensureTagCompound(ItemStack is) {
if (!is.hasTagCompound()) {
is.setTagCompound(new NBTTagCompound());
}
return is.getTagCompound();
return RandomUtils.getTag(is);
}
@Override
@@ -45,6 +45,7 @@ import cpw.mods.fml.common.gameevent.PlayerEvent.PlayerLoggedInEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import it.unimi.dsi.fastutil.ints.IntObjectPair;
public class CommonProxy {
@@ -204,7 +205,8 @@ public class CommonProxy {
}
}
if (RandomUtils.getWirelessTerm(playerInv) != null) {
ItemStack WCTStack = RandomUtils.getWirelessTerm(playerInv);
IntObjectPair<ItemStack> termItemPair = RandomUtils.getWirelessTermWithSlot(playerInv);
ItemStack WCTStack = termItemPair.second();
if (RandomUtils.isMagnetInstalled(playerInv)) {
ItemStack magnetStack = RandomUtils.getMagnet(playerInv);
if (magnetStack.getItem() instanceof ItemMagnet) {
@@ -216,7 +218,8 @@ public class CommonProxy {
world,
(int) player.posX,
(int) player.posY,
(int) player.posZ);
(int) player.posZ,
termItemPair.firstInt());
magnet.civ = magnet.obj;
magnet.powerSrc = magnet.civ;
magnet.monitor = magnet.civ.getItemInventory();