Added legacy Crafting Terminal

This commit is contained in:
Timo Ley 2021-03-28 18:20:02 +02:00
parent 97e2388d02
commit 425d3868dd
16 changed files with 112 additions and 12 deletions

View File

@ -0,0 +1,36 @@
package appeng.block.legacy;
import appeng.block.AEBaseTileBlock;
import appeng.core.features.AEFeature;
import appeng.core.sync.GuiBridge;
import appeng.tile.legacy.TileCraftTerminal;
import appeng.util.Platform;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.EnumSet;
public class BlockCraftTerminal extends AEBaseTileBlock {
public BlockCraftTerminal() {
super(Material.iron);
this.setTileEntity(TileCraftTerminal.class);
this.setFeature( EnumSet.of(AEFeature.Legacy) );
}
@Override
public boolean onActivated(World w, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
final TileCraftTerminal tile = this.getTileEntity(w, x, y, z);
if( tile != null && !player.isSneaking() ) {
if( Platform.isClient() )
{
return true;
}
Platform.openGUI(player, tile, ForgeDirection.getOrientation(side), GuiBridge.GUI_CRAFTING_TERMINAL);
return true;
}
return false;
}
}

View File

@ -23,8 +23,8 @@ import appeng.api.storage.ITerminalHost;
import appeng.container.ContainerNull;
import appeng.container.slot.SlotCraftingMatrix;
import appeng.container.slot.SlotCraftingTerm;
import appeng.core.api.ICraftingTerminal;
import appeng.helpers.IContainerCraftingPacket;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
@ -38,7 +38,7 @@ import net.minecraft.item.crafting.CraftingManager;
public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAEAppEngInventory, IContainerCraftingPacket
{
private final PartCraftingTerminal ct;
private final ICraftingTerminal ct;
private final AppEngInternalInventory output = new AppEngInternalInventory( this, 1 );
private final SlotCraftingMatrix[] craftingSlots = new SlotCraftingMatrix[9];
private final SlotCraftingTerm outputSlot;
@ -46,7 +46,7 @@ public class ContainerCraftingTerm extends ContainerMEMonitorable implements IAE
public ContainerCraftingTerm( final InventoryPlayer ip, final ITerminalHost monitorable )
{
super( ip, monitorable, false );
this.ct = (PartCraftingTerminal) monitorable;
this.ct = (ICraftingTerminal) monitorable;
final IInventory crafting = this.ct.getInventoryByName( "crafting" );

View File

@ -47,6 +47,7 @@ import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketMEInventoryUpdate;
import appeng.core.sync.packets.PacketValueConfig;
import appeng.me.helpers.ChannelPowerSrc;
import appeng.tile.legacy.TileTerminal;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import appeng.util.Platform;
@ -402,6 +403,9 @@ public class ContainerMEMonitorable extends AEBaseContainer implements IConfigMa
public ItemStack[] getViewCells()
{
if (host instanceof TileTerminal) {
return new ItemStack[0];
}
final ItemStack[] list = new ItemStack[this.cellView.length];
for( int x = 0; x < this.cellView.length; x++ )

View File

@ -0,0 +1,10 @@
package appeng.core.api;
import appeng.api.storage.ITerminalHost;
import net.minecraft.inventory.IInventory;
public interface ICraftingTerminal extends ITerminalHost {
IInventory getInventoryByName(final String name);
}

View File

@ -27,6 +27,7 @@ import appeng.block.AEBaseSlabBlock;
import appeng.block.crafting.*;
import appeng.block.grindstone.BlockCrank;
import appeng.block.grindstone.BlockGrinder;
import appeng.block.legacy.BlockCraftTerminal;
import appeng.block.legacy.BlockTerminal;
import appeng.block.misc.*;
import appeng.block.networking.*;
@ -132,6 +133,7 @@ public final class ApiBlocks implements IBlocks
//Legacy
private final ITileDefinition terminal;
private final ITileDefinition craftTerminal;
public ApiBlocks( final DefinitionConstructor constructor )
{
@ -224,6 +226,7 @@ public final class ApiBlocks implements IBlocks
//Legacy
this.terminal = constructor.registerTileDefinition( new BlockTerminal() );
this.craftTerminal = constructor.registerTileDefinition( new BlockCraftTerminal() );
}

View File

@ -43,6 +43,7 @@ import appeng.container.AEBaseContainer;
import appeng.container.ContainerNull;
import appeng.container.ContainerOpenContext;
import appeng.container.implementations.*;
import appeng.core.api.ICraftingTerminal;
import appeng.core.stats.Achievements;
import appeng.helpers.IInterfaceHost;
import appeng.helpers.IPriorityHost;
@ -51,7 +52,6 @@ import appeng.items.contents.QuartzKnifeObj;
import appeng.parts.automation.PartFormationPlane;
import appeng.parts.automation.PartLevelEmitter;
import appeng.parts.misc.PartStorageBus;
import appeng.parts.reporting.PartCraftingTerminal;
import appeng.parts.reporting.PartInterfaceTerminal;
import appeng.parts.reporting.PartPatternTerminal;
import appeng.tile.crafting.TileCraftingTile;
@ -129,7 +129,7 @@ public enum GuiBridge implements IGuiHandler
GUI_SECURITY( ContainerSecurity.class, TileSecurity.class, GuiHostType.WORLD, SecurityPermissions.SECURITY ),
GUI_CRAFTING_TERMINAL( ContainerCraftingTerm.class, PartCraftingTerminal.class, GuiHostType.WORLD, SecurityPermissions.CRAFT ),
GUI_CRAFTING_TERMINAL( ContainerCraftingTerm.class, ICraftingTerminal.class, GuiHostType.WORLD, SecurityPermissions.CRAFT ),
GUI_PATTERN_TERMINAL( ContainerPatternTerm.class, PartPatternTerminal.class, GuiHostType.WORLD, SecurityPermissions.CRAFT ),

View File

@ -20,6 +20,7 @@ package appeng.parts.reporting;
import appeng.client.texture.CableBusTextures;
import appeng.core.api.ICraftingTerminal;
import appeng.core.sync.GuiBridge;
import appeng.helpers.Reflected;
import appeng.tile.inventory.AppEngInternalInventory;
@ -31,7 +32,7 @@ import net.minecraft.nbt.NBTTagCompound;
import java.util.List;
public class PartCraftingTerminal extends AbstractPartTerminal
public class PartCraftingTerminal extends AbstractPartTerminal implements ICraftingTerminal
{
private static final CableBusTextures FRONT_BRIGHT_ICON = CableBusTextures.PartCraftingTerm_Bright;
private static final CableBusTextures FRONT_DARK_ICON = CableBusTextures.PartCraftingTerm_Dark;

View File

@ -111,7 +111,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
// NOTE: WAS FINAL, changed for Immibis
public final void readFromNBT( final NBTTagCompound data )
public void readFromNBT(final NBTTagCompound data)
{
super.readFromNBT( data );
@ -144,7 +144,7 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
@Override
// NOTE: WAS FINAL, changed for Immibis
public final void writeToNBT( final NBTTagCompound data )
public void writeToNBT(final NBTTagCompound data)
{
super.writeToNBT( data );

View File

@ -0,0 +1,43 @@
package appeng.tile.legacy;
import appeng.core.api.ICraftingTerminal;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.inventory.IAEAppEngInventory;
import appeng.tile.inventory.InvOperation;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
public class TileCraftTerminal extends TileTerminal implements ICraftingTerminal, IAEAppEngInventory {
private final AppEngInternalInventory craftingGrid = new AppEngInternalInventory( this, 9 );
@Override
public IInventory getInventoryByName(String name) {
if( name.equals( "crafting" ) )
{
return this.craftingGrid;
}
return null;
}
@Override
public void onChangeInventory(IInventory inv, int slot, InvOperation mc, ItemStack removedStack, ItemStack newStack) {
this.markDirty();
}
@Override
public void readFromNBT( final NBTTagCompound data )
{
super.readFromNBT( data );
this.craftingGrid.readFromNBT( data, "craftingGrid" );
}
@Override
public void writeToNBT( final NBTTagCompound data )
{
super.writeToNBT( data );
this.craftingGrid.writeToNBT( data, "craftingGrid" );
}
}

View File

@ -9,14 +9,10 @@ import appeng.api.storage.*;
import appeng.api.storage.data.IAEFluidStack;
import appeng.api.storage.data.IAEItemStack;
import appeng.api.util.IConfigManager;
import appeng.core.sync.GuiBridge;
import appeng.me.GridAccessException;
import appeng.tile.grid.AENetworkTile;
import appeng.tile.storage.TileChest;
import appeng.util.ConfigManager;
import appeng.util.IConfigManagerHost;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.util.ForgeDirection;
import java.util.EnumSet;

View File

@ -53,6 +53,7 @@ tile.appliedenergistics2.BlockMolecularAssembler.name=Molecular Assembler
#Legacy
tile.appliedenergistics2.BlockTerminal.name=ME Access Terminal
tile.appliedenergistics2.BlockCraftTerminal.name=ME Crafting Terminal
item.appliedenergistics2.ItemMaterial.ConversionMatrix.name=Conversion Matrix

View File

@ -15,3 +15,9 @@ shaped=
ae2:CableGlass.Fluix ae2:ItemMaterial.ConversionMatrix glass,
oredictionary:ingotIron oredictionary:ingotIron glass
-> ae2:BlockTerminal
shaped=
oredictionary:ingotIron oredictionary:ingotIron glass,
oredictionary:craftingTableWood ae2:ItemMaterial.Cell1kPart ae2:BlockTerminal,
oredictionary:ingotIron oredictionary:ingotIron glass
-> ae2:BlockCraftTerminal

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 364 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 438 B