This commit is contained in:
lc-1337 committed 2026-02-11 19:49:41 +02:00
1 parent dfabc1c62b
commit 38f3042711
3 files changed
+7 -15

No files matched your search

@@ -9,10 +9,10 @@ import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import com.glodblock.github.inventory.item.IItemInventory;
import com.glodblock.github.util.Util;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.util.Platform;
public abstract class ItemGuiFactory<T> implements IGuiFactory {
@@ -30,7 +30,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
@Nullable
@Override
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -57,7 +57,7 @@ public abstract class ItemGuiFactory<T> implements IGuiFactory {
@Nullable
@Override
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -14,6 +14,7 @@ import com.glodblock.github.util.Util;
import appeng.container.AEBaseContainer;
import appeng.container.ContainerOpenContext;
import appeng.util.Platform;
public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
@@ -31,7 +32,7 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
public Object createServerGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
if (result.getLeft() == Util.GuiHelper.GuiType.ITEM) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -62,7 +63,7 @@ public abstract class PartOrItemGuiFactory<T> extends PartGuiFactory<T> {
public Object createClientGui(EntityPlayer player, World world, int x, int y, int z, ForgeDirection face) {
ImmutablePair<Util.GuiHelper.GuiType, Integer> result = Util.GuiHelper.decodeType(y);
if (result.left == Util.GuiHelper.GuiType.ITEM) {
ItemStack item = Util.getWirelessTerminal(player, x);
ItemStack item = Platform.getItemFromPlayerInventoryBySlotIndex(player, x);
if (item == null || !(item.getItem() instanceof IItemInventory)) {
return null;
}
@@ -73,7 +73,7 @@ public final class Util {
public static int drainItemPower(AEBaseContainer c, InventoryPlayer ip, int slot, int ticks, double pm,
IFluidPortableCell wt) {
if (slot != -1) {
final ItemStack currentItem = getWirelessTerminal(ip.player, slot);
final ItemStack currentItem = Platform.getItemFromPlayerInventoryBySlotIndex(ip.player, slot);
if (wt != null) {
if (currentItem != wt.getItemStack()) {
if (currentItem != null) {
@@ -193,15 +193,6 @@ public final class Util {
return new NullInventory<>();
}
public static ItemStack getWirelessTerminal(EntityPlayer player, int x) {
ImmutablePair<GuiHelper.InvType, Integer> result = GuiHelper.decodeInvType(x);
if (result.getLeft() == GuiHelper.InvType.PLAYER_INV) {
return player.inventory.getStackInSlot(result.getRight());
} else {
return BaublesApi.getBaubles(player).getStackInSlot(result.getRight());
}
}
public static ImmutablePair<Integer, ItemStack> getUltraWirelessTerm(EntityPlayer player) {
int invSize = player.inventory.getSizeInventory();