This commit is contained in:
PrototypeTrousers
2023-02-02 16:19:56 -03:00
parent 58a6dabb20
commit 17c38a6418
6 changed files with 32 additions and 13 deletions
@@ -83,8 +83,8 @@ public class GuiCraftConfirm extends AEBaseGui {
this.ccc = (ContainerCraftConfirm) this.inventorySlots; this.ccc = (ContainerCraftConfirm) this.inventorySlots;
this.ccc.setGui(this); this.ccc.setGui(this);
if (te instanceof WirelessTerminalGuiObject) { if (te instanceof IWirelessTermHandler) {
this.OriginalGui = GuiBridge.GUI_WIRELESS_TERM; this.OriginalGui = (GuiBridge) ((IWirelessTermHandler)te).getGuiHandler(((WirelessTerminalGuiObject)te).getItemStack()));
} }
if (te instanceof PartTerminal) { if (te instanceof PartTerminal) {
@@ -44,7 +44,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
public class ContainerMEPortableCell extends ContainerMEMonitorable implements IUpgradeableCellContainer, IAEAppEngInventory { public class ContainerMEPortableCell extends ContainerMEMonitorable implements IUpgradeableCellContainer, IAEAppEngInventory, IInventorySlotAware {
protected final WirelessTerminalGuiObject wirelessTerminalGUIObject; protected final WirelessTerminalGuiObject wirelessTerminalGUIObject;
private final int slot; private final int slot;
@@ -68,10 +68,6 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
this.wirelessTerminalGUIObject = monitorable; this.wirelessTerminalGUIObject = monitorable;
this.upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2); this.upgrades = new StackUpgradeInventory(wirelessTerminalGUIObject.getItemStack(), this, 2);
this.loadFromNBT(); this.loadFromNBT();
if (bindInventory) {
this.bindPlayerInventory(ip, 0, 0);
}
this.setupUpgrades(); this.setupUpgrades();
} }
@@ -172,4 +168,14 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable implements I
public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) { public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
} }
@Override
public int getInventorySlot() {
return wirelessTerminalGUIObject.getInventorySlot();
}
@Override
public boolean isBaubleSlot() {
return wirelessTerminalGUIObject.isBaubleSlot();
}
} }
@@ -69,8 +69,6 @@ public class ContainerWirelessCraftingTerminal extends ContainerMEPortableCell i
this.addSlotToContainer(this.outputSlot = new SlotCraftingTerm(this.getPlayerInv().player, this.getActionSource(), this this.addSlotToContainer(this.outputSlot = new SlotCraftingTerm(this.getPlayerInv().player, this.getActionSource(), this
.getPowerSource(), this.wirelessTerminalGUIObject, crafting, crafting, this.output, 131, -72 + 18, this)); .getPowerSource(), this.wirelessTerminalGUIObject, crafting, crafting, this.output, 131, -72 + 18, this));
this.bindPlayerInventory(ip, 0, 0);
this.onCraftMatrixChanged(new WrapperInvItemHandler(crafting)); this.onCraftMatrixChanged(new WrapperInvItemHandler(crafting));
} }
@@ -241,7 +241,14 @@ public enum GuiBridge implements IGuiHandler {
it = player.inventory.getStackInSlot(x); it = player.inventory.getStackInSlot(x);
} }
} else { } else {
it = BaublesApi.getBaublesHandler(player).getStackInSlot(x); if (stem) {
if (player.openContainer instanceof IInventorySlotAware) {
int slot = ((IInventorySlotAware)player.openContainer).getInventorySlot();
it = BaublesApi.getBaublesHandler(player).getStackInSlot(slot);
}
}else {
it = BaublesApi.getBaublesHandler(player).getStackInSlot(x);
}
} }
final Object myItem = this.getGuiObject(it, player, w, x, y, z); final Object myItem = this.getGuiObject(it, player, w, x, y, z);
if (myItem != null && ID.CorrectTileOrPart(myItem)) { if (myItem != null && ID.CorrectTileOrPart(myItem)) {
@@ -544,7 +544,7 @@ public class ContainerMEPortableFluidCell extends AEBaseContainer implements IAE
@Override @Override
public int availableUpgrades() { public int availableUpgrades() {
return 2; return 1;
} }
@Override @Override
+10 -2
View File
@@ -45,6 +45,7 @@ import appeng.api.storage.data.IItemList;
import appeng.api.util.AEColor; import appeng.api.util.AEColor;
import appeng.api.util.AEPartLocation; import appeng.api.util.AEPartLocation;
import appeng.api.util.DimensionalCoord; import appeng.api.util.DimensionalCoord;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.core.AEConfig; import appeng.core.AEConfig;
import appeng.core.AELog; import appeng.core.AELog;
import appeng.core.AppEng; import appeng.core.AppEng;
@@ -322,18 +323,25 @@ public class Platform {
return; return;
} }
int x = (int) p.posX; int x;
int y = (int) p.posY; int y = (int) p.posY;
int z = (int) p.posZ; int z = (int) p.posZ;
if (tile != null) { if (tile != null) {
x = tile.getPos().getX(); x = tile.getPos().getX();
y = tile.getPos().getY(); y = tile.getPos().getY();
z = tile.getPos().getZ(); z = tile.getPos().getZ();
} else {
if (p.openContainer instanceof IInventorySlotAware) {
x = ((IInventorySlotAware) p.openContainer).getInventorySlot();
y = ((IInventorySlotAware)p.openContainer).isBaubleSlot() ? 1 : 0;
} else {
x = p.inventory.currentItem;
}
} }
if ((type.getType().isItem() && tile == null) || type.hasPermissions(tile, x, y, z, side, p)) { if ((type.getType().isItem() && tile == null) || type.hasPermissions(tile, x, y, z, side, p)) {
if (tile == null && type.getType() == GuiHostType.ITEM) { if (tile == null && type.getType() == GuiHostType.ITEM) {
p.openGui(AppEng.instance(), type.ordinal() << 4, p.getEntityWorld(), p.inventory.currentItem, 0, 0); p.openGui(AppEng.instance(), type.ordinal() << 4, p.getEntityWorld(), x, 0, 0);
} else if (tile == null || type.getType() == GuiHostType.ITEM) { } else if (tile == null || type.getType() == GuiHostType.ITEM) {
p.openGui(AppEng.instance(), type.ordinal() << 4 | (1 << 3), p.getEntityWorld(), x, y, z); p.openGui(AppEng.instance(), type.ordinal() << 4 | (1 << 3), p.getEntityWorld(), x, y, z);
} else { } else {