missing JEI ghost support

This commit is contained in:
PrototypeTrousers
2022-08-11 03:19:13 -03:00
parent a44c74b0d7
commit 119cdbc2c0
7 changed files with 100 additions and 195 deletions
+12 -5
View File
@@ -474,7 +474,15 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
{ {
if( slot.getStack().isEmpty() ) if( slot.getStack().isEmpty() )
{ {
InventoryAction action = InventoryAction.SPLIT_OR_PLACE_SINGLE; InventoryAction action;
if( slot.getSlotStackLimit() == 1 )
{
action = InventoryAction.SPLIT_OR_PLACE_SINGLE;
}
else
{
action = InventoryAction.PICKUP_OR_SET_DOWN;
}
final PacketInventoryAction p = new PacketInventoryAction( action, slot.getSlotIndex(), ( (SlotDisconnected) slot ).getSlot().getId() ); final PacketInventoryAction p = new PacketInventoryAction( action, slot.getSlotIndex(), ( (SlotDisconnected) slot ).getSlot().getId() );
NetworkHandler.instance().sendToServer( p ); NetworkHandler.instance().sendToServer( p );
} }
@@ -640,14 +648,13 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
switch ( clickType ) switch ( clickType )
{ {
case PICKUP: // pickup / set-down. case PICKUP: // pickup / set-down.
if( slot.getStack().isEmpty() && !player.inventory.getItemStack().isEmpty() ) if( mouseButton == 1 )
{ {
action = InventoryAction.SPLIT_OR_PLACE_SINGLE; action = InventoryAction.SPLIT_OR_PLACE_SINGLE;
} }
if( !slot.getStack().isEmpty() && player.inventory.getItemStack().getCount() <= 1 ) else
{ {
action = InventoryAction.PICKUP_OR_SET_DOWN; action = InventoryAction.PICKUP_OR_SET_DOWN;
this.haltDragging = true;
} }
break; break;
case QUICK_MOVE: case QUICK_MOVE:
@@ -861,7 +868,7 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
} }
} }
private void mouseWheelEvent( final int x, final int y, final int wheel ) protected void mouseWheelEvent( final int x, final int y, final int wheel )
{ {
final Slot slot = this.getSlot( x, y ); final Slot slot = this.getSlot( x, y );
if( slot instanceof SlotME ) if( slot instanceof SlotME )
@@ -25,10 +25,17 @@ import java.util.*;
import appeng.api.config.ActionItems; import appeng.api.config.ActionItems;
import appeng.api.config.Settings; import appeng.api.config.Settings;
import appeng.api.config.Upgrades; import appeng.api.config.Upgrades;
import appeng.api.storage.data.IAEItemStack;
import appeng.client.gui.widgets.GuiImgButton; import appeng.client.gui.widgets.GuiImgButton;
import appeng.client.me.SlotME;
import appeng.container.AEBaseContainer;
import appeng.container.implementations.ContainerConfiguringTerminal; import appeng.container.implementations.ContainerConfiguringTerminal;
import appeng.container.slot.SlotFake;
import appeng.core.sync.network.NetworkHandler;
import appeng.core.sync.packets.PacketInventoryAction;
import appeng.core.worlddata.IWorldPlayerMapping; import appeng.core.worlddata.IWorldPlayerMapping;
import appeng.helpers.DualityInterface; import appeng.helpers.DualityInterface;
import appeng.helpers.InventoryAction;
import appeng.parts.misc.PartInterface; import appeng.parts.misc.PartInterface;
import appeng.parts.reporting.PartConfiguringTerminal; import appeng.parts.reporting.PartConfiguringTerminal;
import appeng.tile.inventory.AppEngInternalInventory; import appeng.tile.inventory.AppEngInternalInventory;
@@ -39,6 +46,7 @@ import com.google.common.collect.HashMultimap;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
@@ -84,11 +92,8 @@ public class GuiConfiguringTerminal extends AEBaseGui
private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>(); private final Map<String, Set<Object>> cachedSearches = new WeakHashMap<>();
private boolean refreshList = false; private boolean refreshList = false;
private MEGuiTextField searchFieldOutputs;
private MEGuiTextField searchFieldInputs; private MEGuiTextField searchFieldInputs;
private PartConfiguringTerminal partInterfaceTerminal; private PartConfiguringTerminal partInterfaceTerminal;
private GuiButton guiButtonHide;
private GuiButton guiButtonNextAssembler;
private HashMap<ClientDCInternalInv, Integer> dimHashMap = new HashMap<>(); private HashMap<ClientDCInternalInv, Integer> dimHashMap = new HashMap<>();
public GuiConfiguringTerminal( final InventoryPlayer inventoryPlayer, final PartConfiguringTerminal te ) public GuiConfiguringTerminal( final InventoryPlayer inventoryPlayer, final PartConfiguringTerminal te )
@@ -118,13 +123,6 @@ public class GuiConfiguringTerminal extends AEBaseGui
this.searchFieldInputs.setVisible( true ); this.searchFieldInputs.setVisible( true );
this.searchFieldInputs.setFocused( false ); this.searchFieldInputs.setFocused( false );
this.searchFieldOutputs = new MEGuiTextField( this.fontRenderer, this.guiLeft + Math.max( 32, this.offsetX ), this.guiTop + 38, 65, 12 );
this.searchFieldOutputs.setEnableBackgroundDrawing( false );
this.searchFieldOutputs.setMaxStringLength( 25 );
this.searchFieldOutputs.setTextColor( 0xFFFFFF );
this.searchFieldOutputs.setVisible( true );
this.searchFieldOutputs.setFocused( true );
this.searchFieldInputs.setText( partInterfaceTerminal.in ); this.searchFieldInputs.setText( partInterfaceTerminal.in );
} }
@@ -140,7 +138,7 @@ public class GuiConfiguringTerminal extends AEBaseGui
{ {
this.buttonList.clear(); this.buttonList.clear();
this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.InterfaceTerminal.getLocal() ), 8, 6, 4210752 ); this.fontRenderer.drawString( this.getGuiDisplayName( GuiText.InterfaceConfigurationTerminal.getLocal() ), 8, 6, 4210752 );
this.fontRenderer.drawString( GuiText.inventory.getLocal(), this.offsetX + 2, this.ySize - 96 + 3, 4210752 ); this.fontRenderer.drawString( GuiText.inventory.getLocal(), this.offsetX + 2, this.ySize - 96 + 3, 4210752 );
final int currentScroll = this.getScrollBar().getCurrentScroll(); final int currentScroll = this.getScrollBar().getCurrentScroll();
@@ -198,11 +196,6 @@ public class GuiConfiguringTerminal extends AEBaseGui
{ {
drawTooltip( Mouse.getEventX() * this.width / this.mc.displayWidth - offsetX, mouseY - guiTop, "Inputs OR names" ); drawTooltip( Mouse.getEventX() * this.width / this.mc.displayWidth - offsetX, mouseY - guiTop, "Inputs OR names" );
} }
else if( searchFieldOutputs.isMouseIn( mouseX, mouseY ) )
{
drawTooltip( Mouse.getEventX() * this.width / this.mc.displayWidth - offsetX, mouseY - guiTop, "Outputs OR names" );
}
} }
@Override @Override
@@ -216,14 +209,6 @@ public class GuiConfiguringTerminal extends AEBaseGui
this.refreshList(); this.refreshList();
} }
this.searchFieldOutputs.mouseClicked( xCoord, yCoord, btn );
if( btn == 1 && this.searchFieldOutputs.isMouseIn( xCoord, yCoord ) )
{
this.searchFieldOutputs.setText( "" );
this.refreshList();
}
super.mouseClicked( xCoord, yCoord, btn ); super.mouseClicked( xCoord, yCoord, btn );
} }
@@ -256,6 +241,26 @@ public class GuiConfiguringTerminal extends AEBaseGui
} }
} }
@Override
protected void mouseWheelEvent( final int x, final int y, final int wheel )
{
final Slot slot = this.getSlot( x, y );
if( slot instanceof SlotDisconnected )
{
final ItemStack stack = slot.getStack();
if( stack != ItemStack.EMPTY )
{
InventoryAction direction = wheel > 0 ? InventoryAction.PLACE_SINGLE : InventoryAction.PICKUP_SINGLE;
final PacketInventoryAction p = new PacketInventoryAction( direction, slot.getSlotIndex(), ( (SlotDisconnected) slot ).getSlot().getId() );
NetworkHandler.instance().sendToServer( p );
}
}
else
{
super.mouseWheelEvent( x, y, wheel );
}
}
@Override @Override
public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY ) public void drawBG( final int offsetX, final int offsetY, final int mouseX, final int mouseY )
{ {
@@ -293,11 +298,6 @@ public class GuiConfiguringTerminal extends AEBaseGui
{ {
this.searchFieldInputs.drawTextBox(); this.searchFieldInputs.drawTextBox();
} }
if( this.searchFieldOutputs != null )
{
this.searchFieldOutputs.drawTextBox();
}
} }
@Override @Override
@@ -310,12 +310,7 @@ public class GuiConfiguringTerminal extends AEBaseGui
return; return;
} }
if( character == ' ' && this.searchFieldOutputs.getText().isEmpty() && this.searchFieldOutputs.isFocused() ) if( this.searchFieldInputs.textboxKeyTyped( character, key ) )
{
return;
}
if( this.searchFieldInputs.textboxKeyTyped( character, key ) || this.searchFieldOutputs.textboxKeyTyped( character, key ) )
{ {
this.refreshList(); this.refreshList();
} }
@@ -385,7 +380,6 @@ public class GuiConfiguringTerminal extends AEBaseGui
this.matchedStacks.clear(); this.matchedStacks.clear();
final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase(); final String searchFieldInputs = this.searchFieldInputs.getText().toLowerCase();
final String searchFieldOutputs = this.searchFieldOutputs.getText().toLowerCase();
final Set<Object> cachedSearch = this.getCacheForSearchTerm( searchFieldInputs ); final Set<Object> cachedSearch = this.getCacheForSearchTerm( searchFieldInputs );
final boolean rebuild = cachedSearch.isEmpty(); final boolean rebuild = cachedSearch.isEmpty();
@@ -400,8 +394,7 @@ public class GuiConfiguringTerminal extends AEBaseGui
// Shortcut to skip any filter if search term is ""/empty // Shortcut to skip any filter if search term is ""/empty
boolean found = ( searchFieldInputs.isEmpty() && searchFieldOutputs.isEmpty() ); boolean found = searchFieldInputs.isEmpty();
boolean interfaceHasFreeSlots = false;
// Search if the current inventory holds a pattern containing the search term. // Search if the current inventory holds a pattern containing the search term.
if( !found ) if( !found )
@@ -413,46 +406,19 @@ public class GuiConfiguringTerminal extends AEBaseGui
{ {
break; break;
} }
if( !searchFieldInputs.isEmpty() && !searchFieldOutputs.isEmpty() ) if( this.itemStackMatchesSearchTerm( itemStack, searchFieldInputs ) )
{ {
if( this.itemStackMatchesSearchTerm( itemStack, searchFieldInputs, 0 ) || this.itemStackMatchesSearchTerm( itemStack, searchFieldOutputs, 1 ) ) found = true;
{ matchedStacks.add( itemStack );
found = true;
matchedStacks.add( itemStack );
}
}
else if( !searchFieldInputs.isEmpty() )
{
if( this.itemStackMatchesSearchTerm( itemStack, searchFieldInputs, 0 ) )
{
found = true;
matchedStacks.add( itemStack );
}
}
else if( !searchFieldOutputs.isEmpty() )
{
if( this.itemStackMatchesSearchTerm( itemStack, searchFieldOutputs, 1 ) )
{
found = true;
matchedStacks.add( itemStack );
}
}
// If only Interfaces with empty slots should be shown, check that here
if( itemStack.isEmpty() )
{
interfaceHasFreeSlots = true;
} }
slot++; slot++;
} }
} }
// if found, filter skipped or machine name matching the search term, add it // if found, filter skipped or machine name matching the search term, add it
if( found || ( entry.getName().toLowerCase().contains( searchFieldInputs ) && entry.getName().toLowerCase().contains( searchFieldOutputs ) ) ) if( found || entry.getName().toLowerCase().contains( searchFieldInputs ) )
{ {
if( interfaceHasFreeSlots ) this.byName.put( entry.getName(), entry );
{ cachedSearch.add( entry );
this.byName.put( entry.getName(), entry );
cachedSearch.add( entry );
}
} }
else else
{ {
@@ -482,7 +448,7 @@ public class GuiConfiguringTerminal extends AEBaseGui
this.getScrollBar().setRange( 0, this.lines.size() - 1, 1 ); this.getScrollBar().setRange( 0, this.lines.size() - 1, 1 );
} }
private boolean itemStackMatchesSearchTerm( final ItemStack itemStack, final String searchTerm, int pass ) private boolean itemStackMatchesSearchTerm( final ItemStack itemStack, final String searchTerm )
{ {
if( itemStack.isEmpty() ) if( itemStack.isEmpty() )
{ {
@@ -496,16 +462,7 @@ public class GuiConfiguringTerminal extends AEBaseGui
return false; return false;
} }
NBTTagList tag = new NBTTagList(); NBTTagList tag = encodedValue.getTagList( "in", 10 );
if( pass == 0 )
{
tag = encodedValue.getTagList( "in", 10 );
}
else
{
tag = encodedValue.getTagList( "out", 10 );
}
boolean foundMatchingItemStack = false; boolean foundMatchingItemStack = false;
@@ -581,7 +538,7 @@ public class GuiConfiguringTerminal extends AEBaseGui
if( o == null ) if( o == null )
{ {
this.byId.put( id, o = new ClientDCInternalInv( DualityInterface.NUMBER_OF_PATTERN_SLOTS, id, sortBy, string ) ); this.byId.put( id, o = new ClientDCInternalInv( DualityInterface.NUMBER_OF_CONFIG_SLOTS, id, sortBy, string, 64 ) );
this.refreshList = true; this.refreshList = true;
} }
@@ -43,6 +43,14 @@ public class ClientDCInternalInv implements Comparable<ClientDCInternalInv>
this.sortBy = sortBy; this.sortBy = sortBy;
} }
public ClientDCInternalInv( final int size, final long id, final long sortBy, final String unlocalizedName, int stackSize )
{
this.inventory = new AppEngInternalInventory( null, size, stackSize );
this.unlocalizedName = unlocalizedName;
this.id = id;
this.sortBy = sortBy;
}
public String getName() public String getName()
{ {
final String s = I18n.translateToLocal( this.unlocalizedName + ".name" ); final String s = I18n.translateToLocal( this.unlocalizedName + ".name" );
@@ -24,7 +24,6 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import appeng.api.config.Upgrades;
import appeng.parts.reporting.PartConfiguringTerminal; import appeng.parts.reporting.PartConfiguringTerminal;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.entity.player.InventoryPlayer;
@@ -45,9 +44,7 @@ import appeng.core.sync.packets.PacketCompressedNBT;
import appeng.helpers.DualityInterface; import appeng.helpers.DualityInterface;
import appeng.helpers.IInterfaceHost; import appeng.helpers.IInterfaceHost;
import appeng.helpers.InventoryAction; import appeng.helpers.InventoryAction;
import appeng.items.misc.ItemEncodedPattern;
import appeng.parts.misc.PartInterface; import appeng.parts.misc.PartInterface;
import appeng.parts.reporting.PartInterfaceTerminal;
import appeng.tile.inventory.AppEngInternalInventory; import appeng.tile.inventory.AppEngInternalInventory;
import appeng.tile.misc.TileInterface; import appeng.tile.misc.TileInterface;
import appeng.util.InventoryAdaptor; import appeng.util.InventoryAdaptor;
@@ -55,7 +52,6 @@ import appeng.util.Platform;
import appeng.util.helpers.ItemHandlerUtil; import appeng.util.helpers.ItemHandlerUtil;
import appeng.util.inv.AdaptorItemHandler; import appeng.util.inv.AdaptorItemHandler;
import appeng.util.inv.WrapperCursorItemHandler; import appeng.util.inv.WrapperCursorItemHandler;
import appeng.util.inv.WrapperFilteredItemHandler;
import appeng.util.inv.WrapperRangeItemHandler; import appeng.util.inv.WrapperRangeItemHandler;
import appeng.util.inv.filter.IAEItemFilter; import appeng.util.inv.filter.IAEItemFilter;
@@ -214,119 +210,67 @@ public final class ContainerConfiguringTerminal extends AEBaseContainer
final InventoryAdaptor playerHand = new AdaptorItemHandler( new WrapperCursorItemHandler( player.inventory ) ); final InventoryAdaptor playerHand = new AdaptorItemHandler( new WrapperCursorItemHandler( player.inventory ) );
final IItemHandler theSlot = new WrapperFilteredItemHandler( new WrapperRangeItemHandler( inv.server, slot, slot + 1 ), new PatternSlotFilter() ); final IItemHandler theSlot = new WrapperRangeItemHandler( inv.server, slot, slot + 1 );
final InventoryAdaptor interfaceSlot = new AdaptorItemHandler( theSlot ); final InventoryAdaptor interfaceSlot = new AdaptorItemHandler( theSlot );
IItemHandler interfaceHandler = inv.server; ItemStack inSlot = theSlot.getStackInSlot( 0 );
boolean canInsert = true;
switch ( action ) switch ( action )
{ {
case PICKUP_OR_SET_DOWN: case PICKUP_OR_SET_DOWN:
if( hasItemInHand ) if( hasItemInHand )
{ {
for( int s = 0; s < interfaceHandler.getSlots(); s++ ) ItemHandlerUtil.setStackInSlot( theSlot, 0, player.inventory.getItemStack().copy() );
{
if( Platform.itemComparisons().isSameItem( interfaceHandler.getStackInSlot( s ), player.inventory.getItemStack() ) )
{
canInsert = false;
break;
}
}
if( canInsert )
{
ItemStack inSlot = theSlot.getStackInSlot( 0 );
if( inSlot.isEmpty() )
{
player.inventory.setItemStack( interfaceSlot.addItems( player.inventory.getItemStack() ) );
}
else
{
inSlot = inSlot.copy();
final ItemStack inHand = player.inventory.getItemStack().copy();
ItemHandlerUtil.setStackInSlot( theSlot, 0, ItemStack.EMPTY );
player.inventory.setItemStack( ItemStack.EMPTY );
player.inventory.setItemStack( interfaceSlot.addItems( inHand.copy() ) );
if( player.inventory.getItemStack().isEmpty() )
{
player.inventory.setItemStack( inSlot );
}
else
{
player.inventory.setItemStack( inHand );
ItemHandlerUtil.setStackInSlot( theSlot, 0, inSlot );
}
}
}
} }
else else
{ {
ItemHandlerUtil.setStackInSlot( theSlot, 0, playerHand.addItems( theSlot.getStackInSlot( 0 ) ) ); ItemHandlerUtil.setStackInSlot( theSlot, 0, ItemStack.EMPTY );
}
break;
case PLACE_SINGLE:
if( inSlot.getMaxStackSize() > inSlot.getCount() )
{
inSlot.grow( 1 );
ItemHandlerUtil.setStackInSlot( theSlot, 0, inSlot );
}
break;
case PICKUP_SINGLE:
if( theSlot.getStackInSlot( 0 ).getCount() > 1 )
{
inSlot.shrink( 1 );
ItemHandlerUtil.setStackInSlot( theSlot, 0, inSlot );
} }
break; break;
case SPLIT_OR_PLACE_SINGLE: case SPLIT_OR_PLACE_SINGLE:
if( hasItemInHand ) if( hasItemInHand )
{ {
for( int s = 0; s < interfaceHandler.getSlots(); s++ ) if( ItemStack.areItemsEqual( inSlot, player.inventory.getItemStack() ) && ItemStack.areItemStackTagsEqual( inSlot, player.inventory.getItemStack() ) )
{ {
if( Platform.itemComparisons().isSameItem( interfaceHandler.getStackInSlot( s ), player.inventory.getItemStack() ) ) inSlot.grow( 1 );
{ ItemHandlerUtil.setStackInSlot( theSlot, 0, inSlot.copy() );
canInsert = false;
break;
}
} }
if( canInsert ) else
{ {
ItemStack extra = playerHand.removeItems( 1, ItemStack.EMPTY, null ); ItemHandlerUtil.setStackInSlot( theSlot, 0, player.inventory.getItemStack().copy() );
if( !extra.isEmpty() && !interfaceSlot.containsItems() )
{
extra = interfaceSlot.addItems( extra );
}
if( !extra.isEmpty() )
{
playerHand.addItems( extra );
}
} }
} }
else if( !is.isEmpty() ) else if( !is.isEmpty() )
{ {
ItemStack extra = interfaceSlot.removeItems( ( is.getCount() + 1 ) / 2, ItemStack.EMPTY, null ); inSlot.shrink( 1 );
if( !extra.isEmpty() ) ItemHandlerUtil.setStackInSlot( theSlot, 0, inSlot.copy() );
{
extra = playerHand.addItems( extra );
}
if( !extra.isEmpty() )
{
interfaceSlot.addItems( extra );
}
} }
break; break;
case SHIFT_CLICK: case SHIFT_CLICK:
ItemHandlerUtil.setStackInSlot( theSlot, 0, ItemStack.EMPTY );
final InventoryAdaptor playerInv = InventoryAdaptor.getAdaptor( player );
ItemHandlerUtil.setStackInSlot( theSlot, 0, playerInv.addItems( theSlot.getStackInSlot( 0 ) ) );
break; break;
case MOVE_REGION:
final InventoryAdaptor playerInvAd = InventoryAdaptor.getAdaptor( player );
for( int x = 0; x < inv.server.getSlots(); x++ )
{
ItemHandlerUtil.setStackInSlot( inv.server, x, playerInvAd.addItems( inv.server.getStackInSlot( x ) ) );
}
break;
case CREATIVE_DUPLICATE: case CREATIVE_DUPLICATE:
if( player.capabilities.isCreativeMode && !hasItemInHand ) if( player.capabilities.isCreativeMode && hasItemInHand )
{ {
player.inventory.setItemStack( is.isEmpty() ? ItemStack.EMPTY : is.copy() ); ItemHandlerUtil.setStackInSlot( theSlot, 0, player.inventory.getItemStack().copy() );
} }
break; break;
@@ -355,7 +299,7 @@ public final class ContainerConfiguringTerminal extends AEBaseContainer
final DualityInterface dual = ih.getInterfaceDuality(); final DualityInterface dual = ih.getInterfaceDuality();
if( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES ) if( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES )
{ {
this.diList.put( ih, new ConfigTracker( dual, dual.getPatterns(), dual.getTermName() ) ); this.diList.put( ih, new ConfigTracker( dual, dual.getConfig(), dual.getTermName() ) );
} }
} }
@@ -365,7 +309,7 @@ public final class ContainerConfiguringTerminal extends AEBaseContainer
final DualityInterface dual = ih.getInterfaceDuality(); final DualityInterface dual = ih.getInterfaceDuality();
if( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES ) if( gn.isActive() && dual.getConfigManager().getSetting( Settings.INTERFACE_TERMINAL ) == YesNo.YES )
{ {
this.diList.put( ih, new ConfigTracker( dual, dual.getPatterns(), dual.getTermName() ) ); this.diList.put( ih, new ConfigTracker( dual, dual.getConfig(), dual.getTermName() ) );
} }
} }
} }
@@ -407,7 +351,6 @@ public final class ContainerConfiguringTerminal extends AEBaseContainer
tag.setString( "un", inv.unlocalizedName ); tag.setString( "un", inv.unlocalizedName );
tag.setTag( "pos", NBTUtil.createPosTag( inv.pos ) ); tag.setTag( "pos", NBTUtil.createPosTag( inv.pos ) );
tag.setInteger( "dim", inv.dim ); tag.setInteger( "dim", inv.dim );
tag.setInteger( "numUpgrades", inv.numUpgrades );
} }
for( int x = 0; x < length; x++ ) for( int x = 0; x < length; x++ )
@@ -440,32 +383,15 @@ public final class ContainerConfiguringTerminal extends AEBaseContainer
private final IItemHandler server; private final IItemHandler server;
private final BlockPos pos; private final BlockPos pos;
private final int dim; private final int dim;
private final int numUpgrades;
public ConfigTracker( final DualityInterface dual, final IItemHandler patterns, final String unlocalizedName ) public ConfigTracker( final DualityInterface dual, final IItemHandler configSlots, final String unlocalizedName )
{ {
this.server = patterns; this.server = configSlots;
this.client = new AppEngInternalInventory( null, this.server.getSlots() ); this.client = new AppEngInternalInventory( null, this.server.getSlots() );
this.unlocalizedName = unlocalizedName; this.unlocalizedName = unlocalizedName;
this.sortBy = dual.getSortValue(); this.sortBy = dual.getSortValue();
this.pos = dual.getLocation().getPos(); this.pos = dual.getLocation().getPos();
this.dim = dual.getLocation().getWorld().provider.getDimension(); this.dim = dual.getLocation().getWorld().provider.getDimension();
this.numUpgrades = dual.getInstalledUpgrades( Upgrades.PATTERN_EXPANSION );
}
}
private static class PatternSlotFilter implements IAEItemFilter
{
@Override
public boolean allowExtract( IItemHandler inv, int slot, int amount )
{
return true;
}
@Override
public boolean allowInsert( IItemHandler inv, int slot, ItemStack stack )
{
return !stack.isEmpty() && stack.getItem() instanceof ItemEncodedPattern;
} }
} }
} }
@@ -172,6 +172,7 @@ public enum GuiText
Missing, Missing,
InterfaceTerminal, InterfaceTerminal,
InterfaceConfigurationTerminal,
NoCraftingCPUs, NoCraftingCPUs,
Clean, Clean,
InvalidPattern, InvalidPattern,
@@ -27,6 +27,7 @@ import java.io.OutputStream;
import java.util.zip.GZIPInputStream; import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
import appeng.client.gui.implementations.GuiConfiguringTerminal;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled; import io.netty.buffer.Unpooled;
@@ -113,5 +114,9 @@ public class PacketCompressedNBT extends AppEngPacket
{ {
( (GuiInterfaceTerminal) gs ).postUpdate( this.in ); ( (GuiInterfaceTerminal) gs ).postUpdate( this.in );
} }
else if( gs instanceof GuiConfiguringTerminal )
{
( (GuiConfiguringTerminal) gs ).postUpdate( this.in );
}
} }
} }
@@ -168,6 +168,7 @@ gui.appliedenergistics2.StoredFluids=Stored Fluids
gui.appliedenergistics2.Terminal=Terminal gui.appliedenergistics2.Terminal=Terminal
gui.appliedenergistics2.InterfaceTerminal=Interface Terminal gui.appliedenergistics2.InterfaceTerminal=Interface Terminal
gui.appliedenergistics2.InterfaceTerminalHint=Show Or Hide on Interface Terminal. gui.appliedenergistics2.InterfaceTerminalHint=Show Or Hide on Interface Terminal.
gui.appliedenergistics2.InterfaceConfigurationTerminal=Interface Configuration Terminal
gui.appliedenergistics2.FormationPlane=Formation Plane gui.appliedenergistics2.FormationPlane=Formation Plane
gui.appliedenergistics2.FluidFormationPlane=Fluid Formation Plane gui.appliedenergistics2.FluidFormationPlane=Fluid Formation Plane
gui.appliedenergistics2.VibrationChamber=Vibration Chamber gui.appliedenergistics2.VibrationChamber=Vibration Chamber