Lots of compile fixes

This commit is contained in:
Sebastian Hartte
2020-06-04 03:02:48 +02:00
parent 6eb2a9504a
commit 237463dd94
241 changed files with 3438 additions and 3474 deletions
@@ -21,10 +21,12 @@ package appeng.container.implementations;
import java.util.Iterator;
import appeng.core.Api;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.EmptyHandler;
@@ -58,9 +60,9 @@ public class ContainerCellWorkbench extends ContainerUpgradeable
private ItemStack prevStack = ItemStack.EMPTY;
private int lastUpgrades = 0;
public ContainerCellWorkbench( final PlayerInventory ip, final TileCellWorkbench te )
public ContainerCellWorkbench(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileCellWorkbench te )
{
super( ip, te );
super( containerType, id, ip, te );
this.workBench = te;
}
@@ -24,6 +24,7 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.storage.TileChest;
import net.minecraft.inventory.container.ContainerType;
public class ContainerChest extends AEBaseContainer
@@ -31,9 +32,9 @@ public class ContainerChest extends AEBaseContainer
private final TileChest chest;
public ContainerChest( final PlayerInventory ip, final TileChest chest )
public ContainerChest( ContainerType<?> containerType, int id, final PlayerInventory ip, final TileChest chest )
{
super( ip, chest, null );
super( containerType, id, ip, chest, null );
this.chest = chest;
this.addSlot( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.STORAGE_CELLS, this.chest.getInternalInventory(), 1, 80, 37, this
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.CondenserOutput;
@@ -44,9 +45,9 @@ public class ContainerCondenser extends AEBaseContainer implements IProgressProv
@GuiSync( 2 )
public CondenserOutput output = CondenserOutput.TRASH;
public ContainerCondenser( final PlayerInventory ip, final TileCondenser condenser )
public ContainerCondenser(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileCondenser condenser )
{
super( ip, condenser, null );
super( containerType, id, ip, condenser, null );
this.condenser = condenser;
IItemHandler inv = condenser.getInternalInventory();
@@ -19,24 +19,6 @@
package appeng.container.implementations;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.Future;
import javax.annotation.Nonnull;
import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.World;
import appeng.api.AEApi;
import appeng.api.config.Actionable;
import appeng.api.config.SecurityPermissions;
import appeng.api.networking.IGrid;
@@ -55,15 +37,26 @@ import appeng.api.storage.data.IItemList;
import appeng.container.AEBaseContainer;
import appeng.container.guisync.GuiSync;
import appeng.core.AELog;
import appeng.core.sync.GuiBridge;
import appeng.core.Api;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.me.helpers.PlayerSource;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.parts.reporting.PartTerminal;
import appeng.util.Platform;
import com.google.common.collect.ImmutableSet;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.world.World;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.concurrent.Future;
public class ContainerCraftConfirm extends AEBaseContainer
@@ -89,9 +82,8 @@ public class ContainerCraftConfirm extends AEBaseContainer
@GuiSync( 7 )
public String myName = "";
public ContainerCraftConfirm( final PlayerInventory ip, final ITerminalHost te )
{
super( ip, te );
public ContainerCraftConfirm(ContainerType<?> containerType, int id, PlayerInventory ip, ITerminalHost te) {
super(containerType, id, ip, te);
}
public void cycleCpu( final boolean next )
@@ -279,7 +271,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
}
catch( final Throwable e )
{
this.getPlayerInv().player.sendMessage( new TextComponentString( "Error: " + e.toString() ) );
this.getPlayerInv().player.sendMessage( new StringTextComponent( "Error: " + e.toString() ) );
AELog.debug( e );
this.setValidContainer( false );
this.result = null;
@@ -322,28 +314,28 @@ public class ContainerCraftConfirm extends AEBaseContainer
public void startJob()
{
GuiBridge originalGui = null;
/* FIXME GuiBridge */ Object originalGui = null;
final IActionHost ah = this.getActionHost();
if( ah instanceof WirelessTerminalGuiObject )
{
originalGui = GuiBridge.GUI_WIRELESS_TERM;
}
if( ah instanceof PartTerminal )
{
originalGui = GuiBridge.GUI_ME;
}
if( ah instanceof PartCraftingTerminal )
{
originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
}
if( ah instanceof PartPatternTerminal )
{
originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
}
// FIXME if( ah instanceof WirelessTerminalGuiObject )
// FIXME {
// FIXME originalGui = GuiBridge.GUI_WIRELESS_TERM;
// FIXME }
// FIXME
// FIXME if( ah instanceof PartTerminal )
// FIXME {
// FIXME originalGui = GuiBridge.GUI_ME;
// FIXME }
// FIXME
// FIXME if( ah instanceof PartCraftingTerminal )
// FIXME {
// FIXME originalGui = GuiBridge.GUI_CRAFTING_TERMINAL;
// FIXME }
// FIXME
// FIXME if( ah instanceof PartPatternTerminal )
// FIXME {
// FIXME originalGui = GuiBridge.GUI_PATTERN_TERMINAL;
// FIXME }
if( this.result != null && !this.isSimulation() )
{
@@ -354,7 +346,7 @@ public class ContainerCraftConfirm extends AEBaseContainer
if( g != null && originalGui != null && this.getOpenContext() != null )
{
final TileEntity te = this.getOpenContext().getTile();
Platform.openGUI( this.getPlayerInventory().player, te, this.getOpenContext().getSide(), originalGui );
// FIXME Platform.openGUI( this.getPlayerInventory().player, te, this.getOpenContext().getSide(), originalGui );
}
}
}
@@ -21,12 +21,11 @@ package appeng.container.implementations;
import java.io.IOException;
import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IContainerListener;
import appeng.api.AEApi;
import appeng.api.networking.IGrid;
import appeng.api.networking.crafting.CraftingItemList;
import appeng.api.networking.crafting.ICraftingCPU;
@@ -48,6 +47,9 @@ import appeng.me.cluster.IAEMultiBlock;
import appeng.me.cluster.implementations.CraftingCPUCluster;
import appeng.tile.crafting.TileCraftingTile;
import appeng.util.Platform;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.util.text.ITextComponent;
public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorHandlerReceiver<IAEItemStack>, ICustomNameObject
@@ -56,14 +58,14 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
private final IItemList<IAEItemStack> list = Api.INSTANCE.storage().getStorageChannel( IItemStorageChannel.class ).createList();
private IGrid network;
private CraftingCPUCluster monitor = null;
private String cpuName = null;
private ITextComponent cpuName = null;
@GuiSync( 0 )
public long eta = -1;
public ContainerCraftingCPU( final PlayerInventory ip, final Object te )
public ContainerCraftingCPU(ContainerType<?> containerType, int id, final PlayerInventory ip, final Object te )
{
super( ip, te );
super( containerType, id, ip, te );
final IActionHost host = (IActionHost) ( te instanceof IActionHost ? te : null );
if( host != null && host.getActionableNode() != null )
@@ -121,7 +123,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
else
{
this.setMonitor( null );
this.cpuName = "";
this.cpuName = null;
this.setEstimatedTime( -1 );
}
}
@@ -238,7 +240,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
}
@Override
public String getCustomInventoryName()
public ITextComponent getCustomInventoryName()
{
return this.cpuName;
}
@@ -246,7 +248,7 @@ public class ContainerCraftingCPU extends AEBaseContainer implements IMEMonitorH
@Override
public boolean hasCustomInventoryName()
{
return this.cpuName != null && this.cpuName.length() > 0;
return this.cpuName != null;
}
public long getEstimatedTime()
@@ -32,6 +32,7 @@ import appeng.api.networking.crafting.ICraftingGrid;
import appeng.api.storage.ITerminalHost;
import appeng.container.guisync.GuiSync;
import appeng.util.Platform;
import net.minecraft.inventory.container.ContainerType;
public class ContainerCraftingStatus extends ContainerCraftingCPU
@@ -45,9 +46,9 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU
@GuiSync( 7 )
public String myName = "";
public ContainerCraftingStatus( final PlayerInventory ip, final ITerminalHost te )
public ContainerCraftingStatus(ContainerType<?> containerType, int id, final PlayerInventory ip, final ITerminalHost te )
{
super( ip, te );
super( containerType, id, ip, te );
}
@Override
@@ -22,9 +22,11 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
@@ -47,11 +49,11 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 );
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
private final SlotCraftingTerm outputSlot;
private IRecipe currentRecipe;
private IRecipe<CraftingInventory> currentRecipe;
public ContainerCraftingTerm( final PlayerInventory ip, final ITerminalHost monitorable )
public ContainerCraftingTerm(ContainerType<?> containerType, int id, final PlayerInventory ip, final ITerminalHost monitorable )
{
super( ip, monitorable, false );
super( containerType, id, ip, monitorable, false );
this.ct = (PartCraftingTerminal) monitorable;
final IItemHandler crafting = this.ct.getInventoryByName( "crafting" );
@@ -89,7 +91,8 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
if( this.currentRecipe == null || !this.currentRecipe.matches( ic, this.getPlayerInv().player.world ) )
{
this.currentRecipe = CraftingManager.findMatchingRecipe( ic, this.getPlayerInv().player.world );
World world = this.getPlayerInv().player.world;
this.currentRecipe = world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
}
if( this.currentRecipe == null )
@@ -132,7 +135,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
return true;
}
public IRecipe getCurrentRecipe()
public IRecipe<CraftingInventory> getCurrentRecipe()
{
return this.currentRecipe;
}
@@ -24,14 +24,15 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.storage.TileDrive;
import net.minecraft.inventory.container.ContainerType;
public class ContainerDrive extends AEBaseContainer
{
public ContainerDrive( final PlayerInventory ip, final TileDrive drive )
public ContainerDrive(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileDrive drive )
{
super( ip, drive, null );
super( containerType, id, ip, drive, null );
for( int y = 0; y < 5; y++ )
{
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FuzzyMode;
@@ -41,9 +42,9 @@ public class ContainerFormationPlane extends ContainerUpgradeable
@GuiSync( 6 )
public YesNo placeMode;
public ContainerFormationPlane( final PlayerInventory ip, final PartFormationPlane te )
public ContainerFormationPlane(ContainerType<?> containerType, int id, final PlayerInventory ip, final PartFormationPlane te )
{
super( ip, te );
super( containerType, id, ip, te );
}
@Override
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.items.IItemHandler;
import appeng.api.config.FullnessMode;
@@ -42,9 +43,9 @@ public class ContainerIOPort extends ContainerUpgradeable
@GuiSync( 3 )
public OperationMode opMode = OperationMode.EMPTY;
public ContainerIOPort( final PlayerInventory ip, final TileIOPort te )
public ContainerIOPort(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileIOPort te )
{
super( ip, te );
super( containerType, id, ip, te );
}
@Override
@@ -19,8 +19,10 @@
package appeng.container.implementations;
import appeng.core.Api;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
@@ -55,9 +57,9 @@ public class ContainerInscriber extends ContainerUpgradeable implements IProgres
@GuiSync( 3 )
public int processingTime = -1;
public ContainerInscriber( final PlayerInventory ip, final TileInscriber te )
public ContainerInscriber(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileInscriber te )
{
super( ip, te );
super( containerType, id, ip, te );
this.ti = te;
IItemHandler inv = te.getInternalInventory();
@@ -31,6 +31,7 @@ import appeng.container.slot.SlotNormal;
import appeng.container.slot.SlotRestrictedInput;
import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost;
import net.minecraft.inventory.container.ContainerType;
public class ContainerInterface extends ContainerUpgradeable
@@ -44,9 +45,9 @@ public class ContainerInterface extends ContainerUpgradeable
@GuiSync( 4 )
public YesNo iTermMode = YesNo.YES;
public ContainerInterface( final PlayerInventory ip, final IInterfaceHost te )
public ContainerInterface(ContainerType<?> containerType, int id, final PlayerInventory ip, final IInterfaceHost te )
{
super( ip, te.getInterfaceDuality().getHost() );
super( containerType, id, ip, te.getInterfaceDuality().getHost() );
this.myDuality = te.getInterfaceDuality();
@@ -26,6 +26,7 @@ import java.util.Map.Entry;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.items.IItemHandler;
@@ -69,9 +70,9 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
private IGrid grid;
private CompoundNBT data = new CompoundNBT();
public ContainerInterfaceTerminal( final PlayerInventory ip, final PartInterfaceTerminal anchor )
public ContainerInterfaceTerminal(ContainerType<?> containerType, int id, final PlayerInventory ip, final PartInterfaceTerminal anchor )
{
super( ip, anchor );
super( containerType, id, ip, anchor );
if( Platform.isServer() )
{
@@ -372,7 +373,7 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
private void addItems( final CompoundNBT data, final InvTracker inv, final int offset, final int length )
{
final String name = '=' + Long.toString( inv.which, Character.MAX_RADIX );
final CompoundNBT tag = data.getCompoundTag( name );
final CompoundNBT tag = data.getCompound( name );
if( tag.isEmpty() )
{
@@ -394,10 +395,10 @@ public final class ContainerInterfaceTerminal extends AEBaseContainer
is.write(itemNBT);
}
tag.setTag( Integer.toString( x + offset ), itemNBT );
tag.put( Integer.toString( x + offset ), itemNBT );
}
data.setTag( name, tag );
data.put( name, tag );
}
private static class InvTracker
@@ -19,9 +19,10 @@
package appeng.container.implementations;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.items.IItemHandler;
@@ -45,7 +46,7 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
private final PartLevelEmitter lvlEmitter;
@OnlyIn( Dist.CLIENT )
private GuiTextField textField;
private TextFieldWidget textField;
@GuiSync( 2 )
public LevelType lvType;
@GuiSync( 3 )
@@ -53,14 +54,14 @@ public class ContainerLevelEmitter extends ContainerUpgradeable
@GuiSync( 4 )
public YesNo cmType;
public ContainerLevelEmitter( final PlayerInventory ip, final PartLevelEmitter te )
public ContainerLevelEmitter( ContainerType<?> containerType, int id, final PlayerInventory ip, final PartLevelEmitter te )
{
super( ip, te );
super( containerType, id, ip, te );
this.lvlEmitter = te;
}
@OnlyIn( Dist.CLIENT )
public void setTextField( final GuiTextField level )
public void setTextField( final TextFieldWidget level )
{
this.textField = level;
this.textField.setText( String.valueOf( this.EmitterValue ) );
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
@@ -46,9 +47,9 @@ public class ContainerMAC extends ContainerUpgradeable implements IProgressProvi
@GuiSync( 4 )
public int craftProgress = 0;
public ContainerMAC( final PlayerInventory ip, final TileMolecularAssembler te )
public ContainerMAC(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileMolecularAssembler te )
{
super( ip, te );
super( containerType, id, ip, te );
this.tma = te;
}
@@ -24,10 +24,12 @@ import java.nio.BufferOverflowException;
import javax.annotation.Nonnull;
import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -88,14 +90,18 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
private IConfigManager serverCM;
private IGridNode networkNode;
public ContainerMEMonitorable( final PlayerInventory ip, final ITerminalHost monitorable )
public ContainerMEMonitorable( ContainerType<?> containerType, int id, final PlayerInventory ip, final ITerminalHost monitorable )
{
this( ip, monitorable, true );
this( containerType, id, ip, monitorable, true );
}
protected ContainerMEMonitorable( final PlayerInventory ip, final ITerminalHost monitorable, final boolean bindInventory )
{
super( ip, monitorable instanceof TileEntity ? (TileEntity) monitorable : null, monitorable instanceof IPart ? (IPart) monitorable : null );
public ContainerMEMonitorable(ContainerType<?> containerType, int id, PlayerInventory ip, final ITerminalHost monitorable, final boolean bindInventory ) {
super( containerType,
id,
ip,
monitorable instanceof TileEntity ? (TileEntity) monitorable : null,
monitorable instanceof IPart ? (IPart) monitorable : null );
this.host = monitorable;
this.clientCM = new ConfigManager( this );
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import appeng.api.config.Actionable;
@@ -37,9 +38,9 @@ public class ContainerMEPortableCell extends ContainerMEMonitorable
private int ticks = 0;
private final int slot;
public ContainerMEPortableCell( final PlayerInventory ip, final IPortableCell monitorable )
public ContainerMEPortableCell(ContainerType<?> containerType, int id, final PlayerInventory ip, final IPortableCell monitorable )
{
super( ip, monitorable, false );
super( containerType, id, ip, monitorable, false );
if( monitorable instanceof IInventorySlotAware )
{
final int slotIndex = ( (IInventorySlotAware) monitorable ).getInventorySlot();
@@ -21,9 +21,12 @@ package appeng.container.implementations;
import java.io.IOException;
import appeng.api.parts.IPart;
import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import appeng.api.AEApi;
@@ -43,6 +46,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import net.minecraft.tileentity.TileEntity;
public class ContainerNetworkStatus extends AEBaseContainer
@@ -59,9 +63,8 @@ public class ContainerNetworkStatus extends AEBaseContainer
private IGrid network;
private int delay = 40;
public ContainerNetworkStatus( final PlayerInventory ip, final INetworkTool te )
{
super( ip, null, null );
public ContainerNetworkStatus(ContainerType<?> containerType, int id, PlayerInventory ip, final INetworkTool te) {
super(containerType, id, ip, null, null);
final IGridHost host = te.getGridHost();
if( host != null )
@@ -20,6 +20,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
@@ -37,9 +38,9 @@ public class ContainerNetworkTool extends AEBaseContainer
@GuiSync( 1 )
public boolean facadeMode;
public ContainerNetworkTool( final PlayerInventory ip, final INetworkTool te )
public ContainerNetworkTool(ContainerType<?> containerType, int id, final PlayerInventory ip, final INetworkTool te )
{
super( ip, null, null );
super( containerType, id, ip, null, null );
this.toolInv = te;
this.lockPlayerInventorySlot( ip.currentItem );
@@ -19,28 +19,6 @@
package appeng.container.implementations;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
import appeng.api.config.Actionable;
import appeng.api.definitions.IDefinitions;
import appeng.api.storage.IMEMonitor;
@@ -50,12 +28,8 @@ import appeng.api.storage.data.IAEItemStack;
import appeng.api.storage.data.IItemList;
import appeng.container.ContainerNull;
import appeng.container.guisync.GuiSync;
import appeng.container.slot.IOptionalSlotHost;
import appeng.container.slot.OptionalSlotFake;
import appeng.container.slot.SlotFakeCraftingMatrix;
import appeng.container.slot.SlotPatternOutputs;
import appeng.container.slot.SlotPatternTerm;
import appeng.container.slot.SlotRestrictedInput;
import appeng.container.slot.*;
import appeng.core.Api;
import appeng.core.sync.packets.PacketPatternSlot;
import appeng.helpers.IContainerCraftingPacket;
import appeng.items.storage.ItemViewCell;
@@ -69,6 +43,28 @@ import appeng.util.inv.IAEAppEngInventory;
import appeng.util.inv.InvOperation;
import appeng.util.inv.WrapperCursorItemHandler;
import appeng.util.item.AEItemStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.inventory.CraftResultInventory;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.CraftingResultSlot;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.inventory.container.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT;
import net.minecraft.world.World;
import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.wrapper.PlayerInvWrapper;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IOptionalSlotHost, IContainerCraftingPacket
@@ -83,15 +79,15 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
private final SlotRestrictedInput patternSlotIN;
private final SlotRestrictedInput patternSlotOUT;
private IRecipe currentRecipe;
private IRecipe<CraftingInventory> currentRecipe;
@GuiSync( 97 )
public boolean craftingMode = true;
@GuiSync( 96 )
public boolean substitute = false;
public ContainerPatternTerm( final PlayerInventory ip, final ITerminalHost monitorable )
public ContainerPatternTerm(ContainerType<?> type, int id, final PlayerInventory ip, final ITerminalHost monitorable )
{
super( ip, monitorable, false );
super( type, id, ip, monitorable, false );
this.patternTerminal = (PartPatternTerminal) monitorable;
final IItemHandler patternInv = this.getPatternTerminal().getInventoryByName( "pattern" );
@@ -135,20 +131,20 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
{
if( !this.isCraftingMode() )
{
this.craftSlot.xPos = -9000;
// FIXME this.craftSlot.xPos = -9000;
for( int y = 0; y < 3; y++ )
{
this.outputSlots[y].xPos = this.outputSlots[y].getX();
// FIXME this.outputSlots[y].xPos = this.outputSlots[y].getX();
}
}
else
{
this.craftSlot.xPos = this.craftSlot.getX();
// FIXME this.craftSlot.xPos = this.craftSlot.getX();
for( int y = 0; y < 3; y++ )
{
this.outputSlots[y].xPos = -9000;
// FIXME this.outputSlots[y].xPos = -9000;
}
}
}
@@ -172,7 +168,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
if( this.currentRecipe == null || !this.currentRecipe.matches( ic, world ) )
{
this.currentRecipe = CraftingManager.findMatchingRecipe( ic, world );
this.currentRecipe = world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, world).orElse(null);
}
final ItemStack is;
@@ -252,20 +248,20 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
for( final ItemStack i : in )
{
tagIn.appendTag( this.createItemTag( i ) );
tagIn.add( this.createItemTag( i ) );
}
for( final ItemStack i : out )
{
tagOut.appendTag( this.createItemTag( i ) );
tagOut.add( this.createItemTag( i ) );
}
encodedValue.setTag( "in", tagIn );
encodedValue.setTag( "out", tagOut );
encodedValue.put( "in", tagIn );
encodedValue.put( "out", tagOut );
encodedValue.putBoolean("crafting", this.isCraftingMode());
encodedValue.putBoolean("substitute", this.isSubstitute());
output.setTagCompound( encodedValue );
output.setTag( encodedValue );
}
private ItemStack[] getInputs()
@@ -341,7 +337,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
return isPattern;
}
private NBTBase createItemTag( final ItemStack i )
private INBT createItemTag( final ItemStack i )
{
final CompoundNBT c = new CompoundNBT();
@@ -410,7 +406,7 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
ic.setInventorySlotContents( x, packetPatternSlot.pattern[x] == null ? ItemStack.EMPTY : packetPatternSlot.pattern[x].createItemStack() );
}
final IRecipe r = CraftingManager.findMatchingRecipe( ic, p.world );
final IRecipe<CraftingInventory> r = p.world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, ic, p.world).orElse(null);
if( r == null )
{
@@ -433,14 +429,14 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
}
}
final IRecipe rr = CraftingManager.findMatchingRecipe( real, p.world );
final IRecipe<CraftingInventory> rr = p.world.getRecipeManager().getRecipe(IRecipeType.CRAFTING, real, p.world).orElse(null);
if( rr == r && Platform.itemComparisons().isSameItem( rr.getCraftingResult( real ), is ) )
{
final InventoryCraftResult craftingResult = new InventoryCraftResult();
final CraftResultInventory craftingResult = new CraftResultInventory();
craftingResult.setRecipeUsed( rr );
final SlotCrafting sc = new SlotCrafting( p, real, craftingResult, 0, 0, 0 );
final CraftingResultSlot sc = new CraftingResultSlot( p, real, craftingResult, 0, 0, 0 );
sc.onTake( p, is );
for( int x = 0; x < real.getSizeInventory(); x++ )
@@ -504,6 +500,8 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA
}
}
@Override
public void onSlotChange( final Slot s )
{
@@ -19,9 +19,10 @@
package appeng.container.implementations;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.widget.TextFieldWidget;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
@@ -40,18 +41,18 @@ public class ContainerPriority extends AEBaseContainer
private final IPriorityHost priHost;
@OnlyIn( Dist.CLIENT )
private GuiTextField textField;
private TextFieldWidget textField;
@GuiSync( 2 )
public long PriorityValue = -1;
public ContainerPriority( final PlayerInventory ip, final IPriorityHost te )
public ContainerPriority(ContainerType<?> containerType, int id, final PlayerInventory ip, final IPriorityHost te )
{
super( ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) );
super( containerType, id, ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) );
this.priHost = te;
}
@OnlyIn( Dist.CLIENT )
public void setTextField( final GuiTextField level )
public void setTextField( final TextFieldWidget level )
{
this.textField = level;
this.textField.setText( String.valueOf( this.PriorityValue ) );
@@ -24,14 +24,15 @@ import net.minecraft.entity.player.PlayerInventory;
import appeng.container.AEBaseContainer;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.qnb.TileQuantumBridge;
import net.minecraft.inventory.container.ContainerType;
public class ContainerQNB extends AEBaseContainer
{
public ContainerQNB( final PlayerInventory ip, final TileQuantumBridge quantumBridge )
public ContainerQNB(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileQuantumBridge quantumBridge )
{
super( ip, quantumBridge, null );
super( containerType, id, ip, quantumBridge, null );
this.addSlot( ( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.QE_SINGULARITY, quantumBridge
.getInternalInventory(), 0, 80, 37, this.getPlayerInventory() ) ).setStackLimit( 1 ) );
@@ -21,8 +21,10 @@ package appeng.container.implementations;
import javax.annotation.Nonnull;
import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT;
import net.minecraftforge.common.MinecraftForge;
@@ -45,9 +47,9 @@ public class ContainerQuartzKnife extends AEBaseContainer
private final IItemHandler inSlot = new AppEngInternalInventory( null, 1, 1 );
private String myName = "";
public ContainerQuartzKnife( final PlayerInventory ip, final QuartzKnifeObj te )
public ContainerQuartzKnife(ContainerType<?> containerType, int id, final PlayerInventory ip, final QuartzKnifeObj te )
{
super( ip, null, null );
super( containerType, id, ip, null, null );
this.toolInv = te;
this.addSlot( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.METAL_INGOTS, this.inSlot, 0, 94, 44, ip ) );
@@ -120,7 +122,7 @@ public class ContainerQuartzKnife extends AEBaseContainer
{
if( ContainerQuartzKnife.this.myName.length() > 0 )
{
return Api.INSTANCE.definitions().materials().namePress().maybeStack( 1 ).map( namePressStack ->
return Api.INSTANCE.definitions().materials().namePress().maybeStack( 1 ).map(namePressStack ->
{
final CompoundNBT compound = namePressStack.getOrCreateTag();
compound.putString("InscribeName", ContainerQuartzKnife.this.myName);
@@ -161,14 +163,11 @@ public class ContainerQuartzKnife extends AEBaseContainer
{
final ItemStack item = ContainerQuartzKnife.this.toolInv.getItemStack();
final ItemStack before = item.copy();
item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player );
if( item.getCount() == 0 )
{
item.damageItem( 1, ContainerQuartzKnife.this.getPlayerInv().player, p -> {
ContainerQuartzKnife.this.getPlayerInv()
.setInventorySlotContents( ContainerQuartzKnife.this.getPlayerInv().currentItem, ItemStack.EMPTY );
MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( ContainerQuartzKnife.this.getPlayerInv().player, before, null ) );
}
} );
ContainerQuartzKnife.this.detectAndSendChanges();
}
@@ -19,9 +19,11 @@
package appeng.container.implementations;
import appeng.core.Api;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IContainerListener;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.inventory.container.IContainerListener;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
@@ -53,9 +55,9 @@ public class ContainerSecurityStation extends ContainerMEMonitorable implements
@GuiSync( 0 )
public int permissionMode = 0;
public ContainerSecurityStation( final PlayerInventory ip, final ITerminalHost monitorable )
public ContainerSecurityStation(ContainerType<?> containerType, int id, final PlayerInventory ip, final ITerminalHost monitorable )
{
super( ip, monitorable, false );
super( containerType, id, ip, monitorable, false );
this.securityBox = (TileSecurityStation) monitorable;
@@ -33,6 +33,7 @@ import appeng.container.slot.SlotOutput;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.spatial.TileSpatialIOPort;
import appeng.util.Platform;
import net.minecraft.inventory.container.ContainerType;
public class ContainerSpatialIOPort extends AEBaseContainer
@@ -56,9 +57,9 @@ public class ContainerSpatialIOPort extends AEBaseContainer
@GuiSync( 33 )
public int zSize;
public ContainerSpatialIOPort( final PlayerInventory ip, final TileSpatialIOPort spatialIOPort )
public ContainerSpatialIOPort(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileSpatialIOPort spatialIOPort )
{
super( ip, spatialIOPort, null );
super( containerType, id, ip, spatialIOPort, null );
if( Platform.isServer() )
{
@@ -21,7 +21,9 @@ package appeng.container.implementations;
import java.util.Iterator;
import appeng.core.Api;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.IItemHandler;
@@ -56,9 +58,9 @@ public class ContainerStorageBus extends ContainerUpgradeable
@GuiSync( 4 )
public StorageFilter storageFilter = StorageFilter.EXTRACTABLE_ONLY;
public ContainerStorageBus( final PlayerInventory ip, final PartStorageBus te )
public ContainerStorageBus(ContainerType<?> containerType, int id, final PlayerInventory ip, final PartStorageBus te )
{
super( ip, te );
super( containerType, id, ip, te );
this.storageBus = te;
}
@@ -21,6 +21,7 @@ package appeng.container.implementations;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.container.ContainerType;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos;
@@ -66,9 +67,9 @@ public class ContainerUpgradeable extends AEBaseContainer implements IOptionalSl
private int tbSlot;
private NetworkToolViewer tbInventory;
public ContainerUpgradeable( final PlayerInventory ip, final IUpgradeableHost te )
public ContainerUpgradeable(ContainerType<?> containerType, int id, final PlayerInventory ip, final IUpgradeableHost te )
{
super( ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) );
super( containerType, id, ip, (TileEntity) ( te instanceof TileEntity ? te : null ), (IPart) ( te instanceof IPart ? te : null ) );
this.upgradeable = te;
World w = null;
@@ -27,6 +27,7 @@ import appeng.container.interfaces.IProgressProvider;
import appeng.container.slot.SlotRestrictedInput;
import appeng.tile.misc.TileVibrationChamber;
import appeng.util.Platform;
import net.minecraft.inventory.container.ContainerType;
public class ContainerVibrationChamber extends AEBaseContainer implements IProgressProvider
@@ -37,9 +38,9 @@ public class ContainerVibrationChamber extends AEBaseContainer implements IProgr
@GuiSync( 1 )
public int remainingBurnTime = 0;
public ContainerVibrationChamber( final PlayerInventory ip, final TileVibrationChamber vibrationChamber )
public ContainerVibrationChamber(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileVibrationChamber vibrationChamber )
{
super( ip, vibrationChamber, null );
super( containerType, id, ip, vibrationChamber, null );
this.vibrationChamber = vibrationChamber;
this.addSlot( new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.FUEL, vibrationChamber.getInternalInventory(), 0, 80, 37, this
@@ -26,6 +26,7 @@ import appeng.container.guisync.GuiSync;
import appeng.container.slot.SlotRestrictedInput;
import appeng.core.AEConfig;
import appeng.tile.networking.TileWireless;
import net.minecraft.inventory.container.ContainerType;
public class ContainerWireless extends AEBaseContainer
@@ -38,9 +39,9 @@ public class ContainerWireless extends AEBaseContainer
@GuiSync( 2 )
public long drain = 0;
public ContainerWireless( final PlayerInventory ip, final TileWireless te )
public ContainerWireless(ContainerType<?> containerType, int id, final PlayerInventory ip, final TileWireless te )
{
super( ip, te, null );
super( containerType, id, ip, te, null );
this.wirelessTerminal = te;
this.addSlot( this.boosterSlot = new SlotRestrictedInput( SlotRestrictedInput.PlacableItemType.RANGE_BOOSTER, this.wirelessTerminal
@@ -25,6 +25,7 @@ import appeng.core.AEConfig;
import appeng.core.localization.PlayerMessages;
import appeng.helpers.WirelessTerminalGuiObject;
import appeng.util.Platform;
import net.minecraft.inventory.container.ContainerType;
public class ContainerWirelessTerm extends ContainerMEPortableCell
@@ -32,9 +33,9 @@ public class ContainerWirelessTerm extends ContainerMEPortableCell
private final WirelessTerminalGuiObject wirelessTerminalGUIObject;
public ContainerWirelessTerm( final PlayerInventory ip, final WirelessTerminalGuiObject gui )
public ContainerWirelessTerm(ContainerType<?> containerType, int id, final PlayerInventory ip, final WirelessTerminalGuiObject gui )
{
super( ip, gui );
super( containerType, id, ip, gui );
this.wirelessTerminalGUIObject = gui;
}
@@ -22,12 +22,13 @@ package appeng.container.implementations;
import javax.annotation.Nonnull;
import appeng.api.networking.crafting.ICraftingCPU;
import net.minecraft.util.text.ITextComponent;
public class CraftingCPURecord implements Comparable<CraftingCPURecord>
{
private final String myName;
private final ITextComponent myName;
private final ICraftingCPU cpu;
private final long size;
private final int processors;
@@ -56,7 +57,7 @@ public class CraftingCPURecord implements Comparable<CraftingCPURecord>
return this.cpu;
}
String getName()
ITextComponent getName()
{
return this.myName;
}