add upgrade slots

This commit is contained in:
PrototypeTrousers
2023-01-30 14:58:55 -03:00
parent 7c4e5679a3
commit 13c3067068
13 changed files with 198 additions and 97 deletions
@@ -25,6 +25,7 @@ import appeng.api.config.Actionable;
import appeng.api.config.PowerMultiplier;
import appeng.api.features.ILocatable;
import appeng.api.features.IWirelessTermHandler;
import appeng.api.implementations.IUpgradeableCellHost;
import appeng.api.implementations.guiobjects.IPortableCell;
import appeng.api.implementations.tiles.IViewCellStorage;
import appeng.api.implementations.tiles.IWirelessAccessPoint;
@@ -44,6 +45,8 @@ import appeng.api.storage.data.IItemList;
import appeng.api.util.DimensionalCoord;
import appeng.api.util.IConfigManager;
import appeng.container.interfaces.IInventorySlotAware;
import appeng.parts.automation.StackUpgradeInventory;
import appeng.parts.automation.UpgradeInventory;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.networking.TileWireless;
import appeng.util.inv.IAEAppEngInventory;
@@ -55,7 +58,7 @@ import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, IInventorySlotAware, IViewCellStorage, IAEAppEngInventory {
public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, IInventorySlotAware, IViewCellStorage, IAEAppEngInventory, IUpgradeableCellHost {
private final ItemStack effectiveItem;
private final IWirelessTermHandler wth;
@@ -70,6 +73,8 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
private final int inventorySlot;
private final AppEngInternalInventory viewCell = new AppEngInternalInventory(this, 5);
private final UpgradeInventory upgrades;
public WirelessTerminalGuiObject(final IWirelessTermHandler wh, final ItemStack is, final EntityPlayer ep, final World w, final int x, final int y, final int z) {
this.encryptionKey = wh.getEncryptionKey(is);
@@ -100,6 +105,8 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
}
}
upgrades = new StackUpgradeInventory(effectiveItem, this, 4);
this.loadFromNBT();
}
@@ -327,6 +334,7 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
NBTTagCompound data = effectiveItem.getTagCompound();
if (data != null) {
viewCell.readFromNBT(data);
upgrades.readFromNBT(data);
}
}
@@ -334,4 +342,12 @@ public class WirelessTerminalGuiObject implements IPortableCell, IActionHost, II
public void onChangeInventory(IItemHandler inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
}
@Override
public IItemHandler getInventoryByName(String name) {
if (name.equals("upgrades")) {
return upgrades;
}
return null;
}
}