Implements opening containers from items with and without a block context.
This commit is contained in:
@@ -22,7 +22,7 @@ package appeng.container.implementations;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -47,8 +47,8 @@ public class ContainerCraftAmount extends AEBaseContainer
|
||||
|
||||
public static ContainerType<ContainerCraftAmount> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerCraftAmount, ITerminalHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerCraftAmount::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
private static final ContainerHelper<ContainerCraftAmount, ITerminalHost> helper
|
||||
= new ContainerHelper<>(ContainerCraftAmount::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
|
||||
private final Slot craftingItem;
|
||||
private IAEItemStack itemToCreate;
|
||||
|
||||
@@ -39,8 +39,7 @@ import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerOpener;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.TileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import appeng.core.AELog;
|
||||
import appeng.core.sync.network.NetworkHandler;
|
||||
import appeng.core.sync.packets.PacketMEInventoryUpdate;
|
||||
@@ -57,7 +56,6 @@ import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.inventory.container.IContainerListener;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.text.StringTextComponent;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -73,8 +71,8 @@ public class ContainerCraftConfirm extends AEBaseContainer
|
||||
|
||||
public static ContainerType<ContainerCraftConfirm> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerCraftConfirm, ITerminalHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerCraftConfirm::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
private static final ContainerHelper<ContainerCraftConfirm, ITerminalHost> helper
|
||||
= new ContainerHelper<>(ContainerCraftConfirm::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
|
||||
public static ContainerCraftConfirm fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -25,8 +25,7 @@ import java.util.List;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.TileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
@@ -46,8 +45,8 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
|
||||
|
||||
public static ContainerType<ContainerCraftingStatus> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerCraftingStatus, ITerminalHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerCraftingStatus::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
private static final ContainerHelper<ContainerCraftingStatus, ITerminalHost> helper
|
||||
= new ContainerHelper<>(ContainerCraftingStatus::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
|
||||
public static ContainerCraftingStatus fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -21,8 +21,7 @@ package appeng.container.implementations;
|
||||
|
||||
import appeng.api.config.SecurityPermissions;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.TileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -53,8 +52,8 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
|
||||
|
||||
public static ContainerType<ContainerCraftingTerm> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerCraftingTerm, ITerminalHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerCraftingTerm::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
private static final ContainerHelper<ContainerCraftingTerm, ITerminalHost> helper
|
||||
= new ContainerHelper<>(ContainerCraftingTerm::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
|
||||
public static ContainerCraftingTerm fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.container.implementations;
|
||||
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
|
||||
@@ -43,8 +43,8 @@ public class ContainerInterface extends ContainerUpgradeable
|
||||
|
||||
public static ContainerType<ContainerInterface> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerInterface, IInterfaceHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerInterface::new, IInterfaceHost.class, SecurityPermissions.BUILD);
|
||||
private static final ContainerHelper<ContainerInterface, IInterfaceHost> helper
|
||||
= new ContainerHelper<>(ContainerInterface::new, IInterfaceHost.class, SecurityPermissions.BUILD);
|
||||
|
||||
public static ContainerInterface fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -24,8 +24,9 @@ import java.nio.BufferOverflowException;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
@@ -82,8 +83,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
|
||||
public static ContainerType<ContainerMEMonitorable> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerMEMonitorable, ITerminalHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerMEMonitorable::new, ITerminalHost.class);
|
||||
private static final ContainerHelper<ContainerMEMonitorable, ITerminalHost> helper
|
||||
= new ContainerHelper<>(ContainerMEMonitorable::new, ITerminalHost.class);
|
||||
|
||||
public static ContainerMEMonitorable fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
@@ -116,7 +117,8 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
id,
|
||||
ip,
|
||||
monitorable instanceof TileEntity ? (TileEntity) monitorable : null,
|
||||
monitorable instanceof IPart ? (IPart) monitorable : null );
|
||||
monitorable instanceof IPart ? (IPart) monitorable : null,
|
||||
monitorable instanceof IGuiItemObject ? (IGuiItemObject) monitorable : null);
|
||||
|
||||
this.host = monitorable;
|
||||
this.clientCM = new ConfigManager( this );
|
||||
@@ -166,7 +168,7 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
|
||||
final IGrid g = node.getGrid();
|
||||
if( g != null )
|
||||
{
|
||||
this.setPowerSource( new ChannelPowerSrc( this.networkNode, (IEnergySource) g.getCache( IEnergyGrid.class ) ) );
|
||||
this.setPowerSource( new ChannelPowerSrc( this.networkNode, g.getCache( IEnergyGrid.class )) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.container.implementations;
|
||||
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -38,8 +38,8 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
|
||||
|
||||
public static ContainerType<ContainerMEPortableCell> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerMEPortableCell, IPortableCell> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerMEPortableCell::new, IPortableCell.class);
|
||||
private static final ContainerHelper<ContainerMEPortableCell, IPortableCell> helper
|
||||
= new ContainerHelper<>(ContainerMEPortableCell::new, IPortableCell.class);
|
||||
|
||||
public static ContainerMEPortableCell fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -22,8 +22,7 @@ package appeng.container.implementations;
|
||||
import java.io.IOException;
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.TileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
@@ -55,8 +54,8 @@ public class ContainerNetworkStatus extends AEBaseContainer
|
||||
|
||||
public static ContainerType<ContainerNetworkStatus> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerNetworkStatus, INetworkTool> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerNetworkStatus::new, INetworkTool.class);
|
||||
private static final ContainerHelper<ContainerNetworkStatus, INetworkTool> helper
|
||||
= new ContainerHelper<>(ContainerNetworkStatus::new, INetworkTool.class);
|
||||
|
||||
public static ContainerNetworkStatus fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -23,8 +23,7 @@ import appeng.api.implementations.guiobjects.INetworkTool;
|
||||
import appeng.container.AEBaseContainer;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.TileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import appeng.container.slot.SlotRestrictedInput;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
@@ -39,8 +38,8 @@ public class ContainerNetworkTool extends AEBaseContainer
|
||||
|
||||
public static ContainerType<ContainerNetworkTool> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerNetworkTool, INetworkTool> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerNetworkTool::new, INetworkTool.class);
|
||||
private static final ContainerHelper<ContainerNetworkTool, INetworkTool> helper
|
||||
= new ContainerHelper<>(ContainerNetworkTool::new, INetworkTool.class);
|
||||
|
||||
public static ContainerNetworkTool fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -31,8 +31,7 @@ import appeng.api.storage.data.IItemList;
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.ContainerNull;
|
||||
import appeng.container.guisync.GuiSync;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.TileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import appeng.container.slot.*;
|
||||
import appeng.core.sync.packets.PacketPatternSlot;
|
||||
import appeng.helpers.IContainerCraftingPacket;
|
||||
@@ -77,8 +76,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
|
||||
|
||||
public static ContainerType<ContainerPatternTerm> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerPatternTerm, ITerminalHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerPatternTerm::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
private static final ContainerHelper<ContainerPatternTerm, ITerminalHost> helper
|
||||
= new ContainerHelper<>(ContainerPatternTerm::new, ITerminalHost.class, SecurityPermissions.CRAFT);
|
||||
|
||||
public static ContainerPatternTerm fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -20,7 +20,7 @@ package appeng.container.implementations;
|
||||
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
@@ -43,8 +43,8 @@ public class ContainerPriority extends AEBaseContainer
|
||||
|
||||
public static ContainerType<ContainerPriority> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerPriority, IPriorityHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerPriority::new, IPriorityHost.class, SecurityPermissions.BUILD);
|
||||
private static final ContainerHelper<ContainerPriority, IPriorityHost> helper
|
||||
= new ContainerHelper<>(ContainerPriority::new, IPriorityHost.class, SecurityPermissions.BUILD);
|
||||
|
||||
public static ContainerPriority fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -22,7 +22,7 @@ package appeng.container.implementations;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -47,8 +47,8 @@ public class ContainerQuartzKnife extends AEBaseContainer
|
||||
|
||||
public static ContainerType<ContainerQuartzKnife> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerQuartzKnife, QuartzKnifeObj> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerQuartzKnife::new, QuartzKnifeObj.class);
|
||||
private static final ContainerHelper<ContainerQuartzKnife, QuartzKnifeObj> helper
|
||||
= new ContainerHelper<>(ContainerQuartzKnife::new, QuartzKnifeObj.class);
|
||||
|
||||
public static ContainerQuartzKnife fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
@@ -20,8 +20,7 @@ package appeng.container.implementations;
|
||||
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.TileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
@@ -50,8 +49,8 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
|
||||
|
||||
public static ContainerType<ContainerSecurityStation> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerSecurityStation, ITerminalHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerSecurityStation::new, ITerminalHost.class, SecurityPermissions.SECURITY);
|
||||
private static final ContainerHelper<ContainerSecurityStation, ITerminalHost> helper
|
||||
= new ContainerHelper<>(ContainerSecurityStation::new, ITerminalHost.class, SecurityPermissions.SECURITY);
|
||||
|
||||
private final SlotRestrictedInput configSlot;
|
||||
|
||||
|
||||
@@ -20,20 +20,15 @@ package appeng.container.implementations;
|
||||
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartContainerHelper;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.parts.misc.PartStorageBus;
|
||||
import appeng.tile.misc.TileCellWorkbench;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.container.ContainerType;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
@@ -66,8 +61,8 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
|
||||
public static ContainerType<ContainerUpgradeable> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerUpgradeable, IUpgradeableHost> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerUpgradeable::new, IUpgradeableHost.class, SecurityPermissions.BUILD);
|
||||
private static final ContainerHelper<ContainerUpgradeable, IUpgradeableHost> helper
|
||||
= new ContainerHelper<>(ContainerUpgradeable::new, IUpgradeableHost.class, SecurityPermissions.BUILD);
|
||||
|
||||
public static ContainerUpgradeable fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
@@ -130,7 +125,7 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
|
||||
{
|
||||
this.lockPlayerInventorySlot( x );
|
||||
this.tbSlot = x;
|
||||
this.tbInventory = (NetworkToolViewer) ( (IGuiItem) pii.getItem() ).getGuiObject( pii, w, new BlockPos( xCoord, yCoord, zCoord ) );
|
||||
this.tbInventory = (NetworkToolViewer) ( (IGuiItem) pii.getItem() ).getGuiObject( pii, x, w, new BlockPos( xCoord, yCoord, zCoord ) );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,8 +20,7 @@ package appeng.container.implementations;
|
||||
|
||||
|
||||
import appeng.container.ContainerLocator;
|
||||
import appeng.container.helper.PartContainerHelper;
|
||||
import appeng.container.helper.PartOrTileContainerHelper;
|
||||
import appeng.container.helper.ContainerHelper;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.entity.player.PlayerInventory;
|
||||
|
||||
@@ -38,8 +37,8 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell
|
||||
|
||||
public static ContainerType<ContainerWirelessTerm> TYPE;
|
||||
|
||||
private static final PartOrTileContainerHelper<ContainerWirelessTerm, WirelessTerminalGuiObject> helper
|
||||
= new PartOrTileContainerHelper<>(ContainerWirelessTerm::new, WirelessTerminalGuiObject.class);
|
||||
private static final ContainerHelper<ContainerWirelessTerm, WirelessTerminalGuiObject> helper
|
||||
= new ContainerHelper<>(ContainerWirelessTerm::new, WirelessTerminalGuiObject.class);
|
||||
|
||||
public static ContainerWirelessTerm fromNetwork(int windowId, PlayerInventory inv, PacketBuffer buf) {
|
||||
return helper.fromNetwork(windowId, inv, buf);
|
||||
|
||||
Reference in New Issue
Block a user