Implement Interface Configuration Terminal

This commit is contained in:
PrototypeTrousers
2022-08-12 23:01:35 -03:00
parent 40caeec92f
commit 104d6fc34d
18 changed files with 182 additions and 79 deletions
@@ -26,23 +26,14 @@ import java.util.List;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.api.config.Upgrades;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.me.SlotME;
import appeng.container.AEBaseContainer;
import appeng.container.implementations.ContainerConfiguringTerminal;
import appeng.container.implementations.ContainerInterfaceConfigurationTerminal;
import appeng.container.interfaces.IJEIGhostIngredients;
import appeng.container.slot.SlotFake;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.worlddata.IWorldPlayerMapping;
import appeng.helpers.DualityInterface;
import appeng.helpers.InventoryAction;
import appeng.parts.misc.PartInterface;
import appeng.parts.reporting.PartConfiguringTerminal;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.misc.TileInterface;
import appeng.parts.reporting.PartInterfaceConfigurationTerminal;
import appeng.util.BlockPosUtils;
import appeng.util.item.AEItemStack;
import com.google.common.collect.HashMultimap;
@@ -54,7 +45,6 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import appeng.api.AEApi;
import appeng.api.storage.channels.IItemStorageChannel;
@@ -63,9 +53,7 @@ import appeng.client.gui.widgets.GuiScrollbar;
import appeng.client.gui.widgets.MEGuiTextField;
import appeng.client.me.ClientDCInternalInv;
import appeng.client.me.SlotDisconnected;
import appeng.container.implementations.ContainerInterfaceTerminal;
import appeng.core.localization.GuiText;
import appeng.parts.reporting.PartInterfaceTerminal;
import appeng.util.Platform;
import net.minecraft.nbt.NBTUtil;
import net.minecraft.util.math.BlockPos;
@@ -77,7 +65,7 @@ import org.lwjgl.input.Mouse;
import static appeng.client.render.BlockPosHighlighter.hilightBlock;
public class GuiConfiguringTerminal extends AEBaseGui implements IJEIGhostIngredients
public class GuiInterfaceConfigurationTerminal extends AEBaseGui implements IJEIGhostIngredients
{
private static final int LINES_ON_PAGE = 6;
@@ -98,19 +86,19 @@ public class GuiConfiguringTerminal extends AEBaseGui implements IJEIGhostIngred
private boolean refreshList = false;
private MEGuiTextField searchFieldInputs;
private PartConfiguringTerminal partInterfaceTerminal;
private PartInterfaceConfigurationTerminal partInterfaceTerminal;
private HashMap<ClientDCInternalInv, Integer> dimHashMap = new HashMap<>();
public Map<IGhostIngredientHandler.Target<?>, Object> mapTargetSlot = new HashMap<>();
public GuiConfiguringTerminal( final InventoryPlayer inventoryPlayer, final PartConfiguringTerminal te )
public GuiInterfaceConfigurationTerminal( final InventoryPlayer inventoryPlayer, final PartInterfaceConfigurationTerminal te )
{
super( new ContainerConfiguringTerminal( inventoryPlayer, te ) );
super( new ContainerInterfaceConfigurationTerminal( inventoryPlayer, te ) );
this.partInterfaceTerminal = te;
final GuiScrollbar scrollbar = new GuiScrollbar();
this.setScrollBar( scrollbar );
this.xSize = 208;
this.ySize = 255;
this.ySize = 235;
}
@Override
@@ -120,9 +108,9 @@ public class GuiConfiguringTerminal extends AEBaseGui implements IJEIGhostIngred
this.getScrollBar().setLeft( 189 );
this.getScrollBar().setHeight( 106 );
this.getScrollBar().setTop( 51 );
this.getScrollBar().setTop( 31 );
this.searchFieldInputs = new MEGuiTextField( this.fontRenderer, this.guiLeft + Math.max( 32, this.offsetX ), this.guiTop + 25, 65, 12 );
this.searchFieldInputs = new MEGuiTextField( this.fontRenderer, this.guiLeft + Math.max( 32, this.offsetX ), this.guiTop + 17, 65, 12 );
this.searchFieldInputs.setEnableBackgroundDrawing( false );
this.searchFieldInputs.setMaxStringLength( 25 );
this.searchFieldInputs.setTextColor( 0xFFFFFF );
@@ -151,7 +139,7 @@ public class GuiConfiguringTerminal extends AEBaseGui implements IJEIGhostIngred
this.inventorySlots.inventorySlots.removeIf( slot -> slot instanceof SlotDisconnected );
int offset = 52;
int offset = 30;
int linesDraw = 0;
for( int x = 0; x < LINES_ON_PAGE && linesDraw < LINES_ON_PAGE && currentScroll + x < this.lines.size(); x++ )
{
@@ -270,10 +258,10 @@ public class GuiConfiguringTerminal extends AEBaseGui implements IJEIGhostIngred
@Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{
this.bindTexture( "guis/newinterfaceterminal.png" );
this.bindTexture( "guis/interfaceconfigurationterminal.png" );
this.drawTexturedModalRect( offsetX, offsetY, 0, 0, this.xSize, this.ySize );
int offset = 51;
int offset = 29;
final int ex = this.getScrollBar().getCurrentScroll();
int linesDraw = 0;
for( int x = 0; x < LINES_ON_PAGE && linesDraw < LINES_ON_PAGE && ex + x < this.lines.size(); x++ )
@@ -288,7 +276,7 @@ public class GuiConfiguringTerminal extends AEBaseGui implements IJEIGhostIngred
for( int row = 0; row < 1 + extraLines && linesDraw < LINES_ON_PAGE; ++row )
{
this.drawTexturedModalRect( offsetX + 20, offsetY + offset, 20, 173, width, 18 );
this.drawTexturedModalRect( offsetX + 20, offsetY + offset, 20, 170, width, 18 );
offset += 18;
linesDraw++;
}
@@ -461,24 +449,10 @@ public class GuiConfiguringTerminal extends AEBaseGui implements IJEIGhostIngred
return false;
}
final NBTTagCompound encodedValue = itemStack.getTagCompound();
if( encodedValue == null )
{
return false;
}
NBTTagList tag = encodedValue.getTagList( "in", 10 );
boolean foundMatchingItemStack = false;
for( int i = 0; i < tag.tagCount(); i++ )
{
final ItemStack parsedItemStack = new ItemStack( tag.getCompoundTagAt( i ) );
if( !parsedItemStack.isEmpty() )
{
final String displayName = Platform
.getItemDisplayName( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( parsedItemStack ) )
.getItemDisplayName( AEApi.instance().storage().getStorageChannel( IItemStorageChannel.class ).createStack( itemStack ) )
.toLowerCase();
for( String term : searchTerm.split( " " ) )
@@ -496,8 +470,6 @@ public class GuiConfiguringTerminal extends AEBaseGui implements IJEIGhostIngred
foundMatchingItemStack = true;
}
}
}
}
return foundMatchingItemStack;
}
@@ -24,7 +24,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import appeng.parts.reporting.PartConfiguringTerminal;
import appeng.parts.reporting.PartInterfaceConfigurationTerminal;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
@@ -47,15 +47,12 @@ import appeng.helpers.InventoryAction;
import appeng.parts.misc.PartInterface;
import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.misc.TileInterface;
import appeng.util.InventoryAdaptor;
import appeng.util.Platform;
import appeng.util.helpers.ItemHandlerUtil;
import appeng.util.inv.AdaptorItemHandler;
import appeng.util.inv.WrapperCursorItemHandler;
import appeng.util.inv.WrapperRangeItemHandler;
public final class ContainerConfiguringTerminal extends AEBaseContainer
public final class ContainerInterfaceConfigurationTerminal extends AEBaseContainer
{
/**
@@ -68,7 +65,7 @@ public final class ContainerConfiguringTerminal extends AEBaseContainer
private IGrid grid;
private NBTTagCompound data = new NBTTagCompound();
public ContainerConfiguringTerminal( final InventoryPlayer ip, final PartConfiguringTerminal anchor )
public ContainerInterfaceConfigurationTerminal( final InventoryPlayer ip, final PartInterfaceConfigurationTerminal anchor )
{
super( ip, anchor );
@@ -77,7 +74,7 @@ public final class ContainerConfiguringTerminal extends AEBaseContainer
this.grid = anchor.getActionableNode().getGrid();
}
this.bindPlayerInventory( ip, 14, 256 - /* height of player inventory */82 );
this.bindPlayerInventory( ip, 14, 235 - /* height of player inventory */82 );
}
@Override
@@ -250,7 +247,9 @@ public final class ContainerConfiguringTerminal extends AEBaseContainer
}
else
{
ItemHandlerUtil.setStackInSlot( theSlot, 0, player.inventory.getItemStack().copy() );
ItemStack configuredStack = player.inventory.getItemStack().copy();
configuredStack.setCount( 1 );
ItemHandlerUtil.setStackInSlot( theSlot, 0, configuredStack );
}
}
@@ -80,7 +80,7 @@ public final class ApiParts implements IParts
private final IItemDefinition interfaceTerminal;
private final IItemDefinition patternTerminal;
private final IItemDefinition expandedProcessingPatternTerminal;
private final IItemDefinition configuringInterfaceTerminal;
private final IItemDefinition interfaceConfigurationTerminal;
private final IItemDefinition craftingTerminal;
private final IItemDefinition terminal;
private final IItemDefinition storageMonitor;
@@ -143,7 +143,7 @@ public final class ApiParts implements IParts
this.interfaceTerminal = new DamagedItemDefinition( "part.terminal.interface", itemPart.createPart( PartType.INTERFACE_TERMINAL ) );
this.patternTerminal = new DamagedItemDefinition( "part.terminal.pattern", itemPart.createPart( PartType.PATTERN_TERMINAL ) );
this.expandedProcessingPatternTerminal = new DamagedItemDefinition( "part.terminal.expanded_processing_pattern", itemPart.createPart( PartType.EXPANDED_PROCESSING_PATTERN_TERMINAL ) );
this.configuringInterfaceTerminal = new DamagedItemDefinition( "part.terminal.configuring_interface_terminal", itemPart.createPart( PartType.CONFIGURING_INTERFACE_TERMINAL ) );
this.interfaceConfigurationTerminal = new DamagedItemDefinition( "part.terminal.interface_configuration_terminal", itemPart.createPart( PartType.INTERFACE_CONFIGURATION_TERMINAL ) );
this.craftingTerminal = new DamagedItemDefinition( "part.terminal.crafting", itemPart.createPart( PartType.CRAFTING_TERMINAL ) );
this.terminal = new DamagedItemDefinition( "part.terminal", itemPart.createPart( PartType.TERMINAL ) );
this.storageMonitor = new DamagedItemDefinition( "part.monitor.storage", itemPart.createPart( PartType.STORAGE_MONITOR ) );
@@ -179,7 +179,7 @@ public enum GuiBridge implements IGuiHandler
GUI_CRAFTING_STATUS( ContainerCraftingStatus.class, ITerminalHost.class, GuiHostType.ITEM_OR_WORLD, SecurityPermissions.CRAFT ),
GUI_CONFIG_INTERFACE_TERMINAL( ContainerConfiguringTerminal.class, PartConfiguringTerminal.class, GuiHostType.WORLD, SecurityPermissions.BUILD );
GUI_INTERFACE_CONFIGURATION_TERMINAL( ContainerInterfaceConfigurationTerminal.class, PartInterfaceConfigurationTerminal.class, GuiHostType.WORLD, SecurityPermissions.BUILD );
private final Class tileClass;
private final Class containerClass;
@@ -27,7 +27,7 @@ import java.io.OutputStream;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
import appeng.client.gui.implementations.GuiConfiguringTerminal;
import appeng.client.gui.implementations.GuiInterfaceConfigurationTerminal;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
@@ -114,9 +114,9 @@ public class PacketCompressedNBT extends AppEngPacket
{
( (GuiInterfaceTerminal) gs ).postUpdate( this.in );
}
else if( gs instanceof GuiConfiguringTerminal )
else if( gs instanceof GuiInterfaceConfigurationTerminal )
{
( (GuiConfiguringTerminal) gs ).postUpdate( this.in );
( (GuiInterfaceConfigurationTerminal) gs ).postUpdate( this.in );
}
}
}
@@ -24,8 +24,8 @@ import java.util.Collections;
import appeng.api.storage.data.IAEFluidStack;
import appeng.client.me.SlotDisconnected;
import appeng.container.implementations.ContainerConfiguringTerminal;
import appeng.container.implementations.ContainerConfiguringTerminal.ConfigTracker;
import appeng.container.implementations.ContainerInterfaceConfigurationTerminal;
import appeng.container.implementations.ContainerInterfaceConfigurationTerminal.ConfigTracker;
import appeng.container.slot.IJEITargetSlot;
import appeng.container.slot.SlotFake;
import appeng.core.AELog;
@@ -223,9 +223,9 @@ public class PacketInventoryAction extends AppEngPacket
}
}
}
else if( sender.openContainer instanceof ContainerConfiguringTerminal )
else if( sender.openContainer instanceof ContainerInterfaceConfigurationTerminal )
{
ConfigTracker inv = ( (ContainerConfiguringTerminal) sender.openContainer ).getSlotByID( this.id );
ConfigTracker inv = ( (ContainerInterfaceConfigurationTerminal) sender.openContainer ).getSlotByID( this.id );
final IItemHandler theSlot = new WrapperRangeItemHandler( inv.getServer(), 0, slot + 1 );
ItemHandlerUtil.setStackInSlot( theSlot, this.slot, this.slotItem.createItemStack() );
@@ -285,7 +285,7 @@ public enum PartType
INTERFACE_TERMINAL( 480, "interface_terminal", EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartInterfaceTerminal.class ),
FLUID_TERMINAL( 520, "fluid_terminal", EnumSet.of( AEFeature.FLUID_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartFluidTerminal.class ),
CONFIGURING_INTERFACE_TERMINAL( 521, "configuring_interface_terminal", EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartConfiguringTerminal.class );
INTERFACE_CONFIGURATION_TERMINAL( 521, "interface_configuration_terminal", EnumSet.of( AEFeature.INTERFACE_TERMINAL ), EnumSet.noneOf( IntegrationType.class ), PartInterfaceConfigurationTerminal.class );
private final int baseDamage;
private final Set<AEFeature> features;
@@ -33,20 +33,20 @@ import appeng.parts.PartModel;
import appeng.util.Platform;
public class PartConfiguringTerminal extends AbstractPartDisplay
public class PartInterfaceConfigurationTerminal extends AbstractPartDisplay
{
@PartModels
public static final ResourceLocation MODEL_OFF = new ResourceLocation( AppEng.MOD_ID, "part/interface_terminal_off" );
public static final ResourceLocation MODEL_OFF = new ResourceLocation( AppEng.MOD_ID, "part/interface_configuration_terminal_off" );
@PartModels
public static final ResourceLocation MODEL_ON = new ResourceLocation( AppEng.MOD_ID, "part/interface_terminal_on" );
public static final ResourceLocation MODEL_ON = new ResourceLocation( AppEng.MOD_ID, "part/interface_configuration_terminal_on" );
public static final IPartModel MODELS_OFF = new PartModel( MODEL_BASE, MODEL_OFF, MODEL_STATUS_OFF );
public static final IPartModel MODELS_ON = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_ON );
public static final IPartModel MODELS_HAS_CHANNEL = new PartModel( MODEL_BASE, MODEL_ON, MODEL_STATUS_HAS_CHANNEL );
public String in = "";
public PartConfiguringTerminal( final ItemStack is )
public PartInterfaceConfigurationTerminal( final ItemStack is )
{
super( is );
}
@@ -58,7 +58,7 @@ public class PartConfiguringTerminal extends AbstractPartDisplay
{
if( Platform.isServer() )
{
Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_CONFIG_INTERFACE_TERMINAL );
Platform.openGUI( player, this.getHost().getTile(), this.getSide(), GuiBridge.GUI_INTERFACE_CONFIGURATION_TERMINAL );
}
}
return true;
@@ -549,6 +549,7 @@ item.appliedenergistics2.multi_part.inverted_toggle_bus.name=ME Inverted Toggle
item.appliedenergistics2.multi_part.toggle_bus.name=ME Toggle Bus
item.appliedenergistics2.multi_part.crafting_monitor.name=ME Crafting Monitor
item.appliedenergistics2.multi_part.interface_terminal.name=ME Interface Terminal
item.appliedenergistics2.multi_part.interface_configuration_terminal.name=ME Configuration Interface Terminal
item.appliedenergistics2.multi_part.fluid_terminal.name=ME Fluid Terminal
item.appliedenergistics2.multi_part.invalid_type.name=Disabled Item
@@ -0,0 +1,9 @@
{
"parent": "appliedenergistics2:item/part/display",
"textures": {
"front": "appliedenergistics2:items/part/interface_terminal",
"front_bright": "appliedenergistics2:parts/interface_configuration_terminal_bright",
"front_medium": "appliedenergistics2:parts/interface_configuration_terminal_medium",
"front_dark": "appliedenergistics2:parts/interface_configuration_terminal_dark"
}
}
@@ -0,0 +1,8 @@
{
"parent": "appliedenergistics2:part/display_off",
"textures": {
"lightsBright": "appliedenergistics2:parts/interface_configuration_terminal_bright",
"lightsMedium": "appliedenergistics2:parts/interface_configuration_terminal_medium",
"lightsDark": "appliedenergistics2:parts/interface_configuration_terminal_dark"
}
}
@@ -0,0 +1,76 @@
{
"ae2_uvl_marker": true,
"textures": {
"lightsBright": "appliedenergistics2:parts/interface_configuration_terminal_bright",
"lightsMedium": "appliedenergistics2:parts/interface_configuration_terminal_medium",
"lightsDark": "appliedenergistics2:parts/interface_configuration_terminal_dark"
},
"elements": [
{
"from": [
2,
2,
0
],
"to": [
14,
14,
2
],
"faces": {
"north": {
"texture": "#lightsBright",
"tintindex": 3,
"uvlightmap": {
"sky": 0.007,
"block": 0.007
}
}
}
},
{
"from": [
2,
2,
0
],
"to": [
14,
14,
2
],
"faces": {
"north": {
"texture": "#lightsMedium",
"tintindex": 2,
"uvlightmap": {
"sky": 0.007,
"block": 0.007
}
}
}
},
{
"from": [
2,
2,
0
],
"to": [
14,
14,
2
],
"faces": {
"north": {
"texture": "#lightsDark",
"tintindex": 1,
"uvlightmap": {
"sky": 0.007,
"block": 0.007
}
}
}
}
]
}
@@ -0,0 +1,19 @@
{
"conditions": [
{
"type": "minecraft:item_exists",
"item": "appliedenergistics2:interface"
}
],
"result": {
"type": "appliedenergistics2:part",
"part": "part.interface_terminal"
},
"type": "appliedenergistics2:part_shapeless",
"ingredients": [
{
"type": "appliedenergistics2:part",
"part": "part.interface_configuration_terminal"
}
]
}
@@ -0,0 +1,19 @@
{
"conditions": [
{
"type": "minecraft:item_exists",
"item": "appliedenergistics2:interface"
}
],
"result": {
"type": "appliedenergistics2:part",
"part": "part.interface_configuration_terminal"
},
"type": "appliedenergistics2:part_shapeless",
"ingredients": [
{
"type": "appliedenergistics2:part",
"part": "part.interface_terminal"
}
]
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB