From 7dc251611c06692aad83b4be10cea2aeebef74ad Mon Sep 17 00:00:00 2001 From: AlgorithmX2 Date: Tue, 8 Apr 2014 21:56:59 -0500 Subject: [PATCH] tiny progress... --- .../gui/implementations/GuiPatternTerm.java | 14 +++---- .../implementations/ContainerPatternTerm.java | 9 +++-- container/slot/SlotRestrictedInput.java | 37 ++++++++----------- core/localization/ButtonToolTips.java | 2 +- items/storage/ItemEncodedPattern.java | 11 +++++- parts/misc/PartToggleBus.java | 1 - 6 files changed, 39 insertions(+), 35 deletions(-) diff --git a/client/gui/implementations/GuiPatternTerm.java b/client/gui/implementations/GuiPatternTerm.java index 0eaa14fe1..3b79e38f3 100644 --- a/client/gui/implementations/GuiPatternTerm.java +++ b/client/gui/implementations/GuiPatternTerm.java @@ -12,16 +12,16 @@ import appeng.core.localization.GuiText; public class GuiPatternTerm extends GuiMEMonitorable { - GuiImgButton clearBtn; + GuiImgButton exttractPatternBtn; GuiImgButton substitutionsBtn; @Override public void initGui() { super.initGui(); - buttonList.add( clearBtn = new GuiImgButton( this.guiLeft + 32, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.PULL ) ); - buttonList.add( substitutionsBtn = new GuiImgButton( this.guiLeft + 92, this.guiTop + this.ySize - 156, Settings.ACTIONS, ActionItems.CLOSE ) ); - clearBtn.halfSize = true; + buttonList.add( exttractPatternBtn = new GuiImgButton( this.guiLeft + 6, this.guiTop + this.ySize - 161, Settings.ACTIONS, ActionItems.PULL ) ); + buttonList.add( substitutionsBtn = new GuiImgButton( this.guiLeft + 118, this.guiTop + this.ySize - 161, Settings.ACTIONS, ActionItems.CLOSE ) ); + exttractPatternBtn.halfSize = true; } @Override @@ -29,7 +29,7 @@ public class GuiPatternTerm extends GuiMEMonitorable { super.actionPerformed( btn ); - if ( clearBtn == btn ) + if ( exttractPatternBtn == btn ) { } @@ -42,7 +42,7 @@ public class GuiPatternTerm extends GuiMEMonitorable public GuiPatternTerm(InventoryPlayer inventoryPlayer, ITerminalHost te) { super( inventoryPlayer, te, new ContainerPatternTerm( inventoryPlayer, te ) ); - reservedSpace = 73; + reservedSpace = 85; } protected String getBackground() @@ -54,7 +54,7 @@ public class GuiPatternTerm extends GuiMEMonitorable public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) { super.drawFG( offsetX, offsetY, mouseX, mouseY ); - fontRendererObj.drawString( GuiText.PatternTerminal.getLocal(), 8, ySize - 96 + 1 - reservedSpace, 4210752 ); + fontRendererObj.drawString( GuiText.PatternTerminal.getLocal(), 8, ySize - 96 + 2 - reservedSpace, 4210752 ); } } diff --git a/container/implementations/ContainerPatternTerm.java b/container/implementations/ContainerPatternTerm.java index b6a5a6fdd..f89a95a0b 100644 --- a/container/implementations/ContainerPatternTerm.java +++ b/container/implementations/ContainerPatternTerm.java @@ -34,14 +34,15 @@ public class ContainerPatternTerm extends ContainerMEMonitorable implements IAEA for (int y = 0; y < 3; y++) for (int x = 0; x < 3; x++) - addSlotToContainer( craftingSlots[x + y * 3] = new SlotFake( crafting, x + y * 3, 54 + x * 18, -72 + y * 18 ) ); + addSlotToContainer( craftingSlots[x + y * 3] = new SlotFake( crafting, x + y * 3, 54 + x * 18, -76 + y * 18 ) ); for (int y = 0; y < 3; y++) - addSlotToContainer( outputSlots[y] = new SlotFake( crafting, y * 3, 146, -72 + y * 18 ) ); + addSlotToContainer( outputSlots[y] = new SlotFake( crafting, 9 + y, 146, -76 + y * 18 ) ); - addSlotToContainer( patternSlot = new SlotRestrictedInput( PlaceableItemType.PATTERN, patternInv, 0, 17, -72 - 5 ) ); - addSlotToContainer( craftSlot = new SlotPatternTerm( craftSlotInv, 0, 17, -72 + 38 ) ); + addSlotToContainer( patternSlot = new SlotRestrictedInput( PlaceableItemType.PATTERN, patternInv, 0, 17, -72 - 9 ) ); + addSlotToContainer( craftSlot = new SlotPatternTerm( craftSlotInv, 0, 17, -72 + 34 ) ); + patternSlot.setStackLimit( 1 ); bindPlayerInventory( ip, 0, 0 ); } diff --git a/container/slot/SlotRestrictedInput.java b/container/slot/SlotRestrictedInput.java index 69fe96a3e..c48fa2b16 100644 --- a/container/slot/SlotRestrictedInput.java +++ b/container/slot/SlotRestrictedInput.java @@ -10,7 +10,7 @@ import net.minecraft.world.World; import net.minecraftforge.oredict.OreDictionary; import appeng.api.AEApi; import appeng.api.IAppEngApi; -import appeng.api.crafting.ICraftingPatternMAC; +import appeng.api.crafting.ICraftingPatternDetails; import appeng.api.features.INetworkEncodable; import appeng.api.implementations.ICraftingPatternItem; import appeng.api.implementations.items.IBiometricCard; @@ -18,6 +18,7 @@ import appeng.api.implementations.items.ISpatialStorageCell; import appeng.api.implementations.items.IStorageComponent; import appeng.api.implementations.items.IUpgradeModule; import appeng.api.storage.ICellWorkbenchItem; +import appeng.api.storage.data.IAEItemStack; import appeng.recipes.handlers.Inscribe; import appeng.util.Platform; @@ -57,8 +58,8 @@ public class SlotRestrictedInput extends AppEngSlot { if ( which == PlaceableItemType.VALID_ENCODED_PATTERN_W_OUPUT ) { - ICraftingPatternMAC ap = is.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) is.getItem()).getPatternForItem( is ) : null; - if ( ap != null && ap.isEncoded() && ap.isCraftable( theWorld ) ) + ICraftingPatternDetails ap = is.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) is.getItem()).getPatternForItem( is ) : null; + if ( ap != null ) return true; return false; } @@ -93,12 +94,15 @@ public class SlotRestrictedInput extends AppEngSlot if ( Platform.isClient() && (which == PlaceableItemType.VALID_ENCODED_PATTERN_W_OUPUT || which == PlaceableItemType.ENCODED_PATTERN_W_OUTPUT) ) { ItemStack is = super.getStack(); - if ( is != null ) + if ( is != null && is.getItem() instanceof ICraftingPatternItem ) { - ICraftingPatternMAC ap = is.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) is.getItem()).getPatternForItem( is ) : null; - if ( ap != null ) + ICraftingPatternItem it = (ICraftingPatternItem) is.getItem(); + ICraftingPatternDetails details = it.getPatternForItem( is ); + if ( details != null ) { - return ap.getOutput().getItemStack(); + IAEItemStack list[] = details.getOutputs(); + if ( list.length > 0 ) + return list[0].getItemStack(); } } } @@ -126,24 +130,15 @@ public class SlotRestrictedInput extends AppEngSlot case VALID_ENCODED_PATTERN_W_OUPUT: case ENCODED_PATTERN_W_OUTPUT: case ENCODED_PATTERN: { - ICraftingPatternMAC pattern = i.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) i.getItem()).getPatternForItem( i ) : null; - if ( pattern != null ) - return pattern.isEncoded(); - return false; + ICraftingPatternDetails pattern = i.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) i.getItem()).getPatternForItem( i ) : null; + return pattern != null; } case PATTERN: - ICraftingPatternMAC p = i.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) i.getItem()).getPatternForItem( i ) : null; - if ( p != null ) + + if ( i.getItem() instanceof ICraftingPatternItem ) return true; - return false; - case BLANK_PATTERN: { - ICraftingPatternMAC pattern = i.getItem() instanceof ICraftingPatternItem ? ((ICraftingPatternItem) i.getItem()).getPatternForItem( i ) : null; - if ( pattern != null ) - return !pattern.isEncoded(); - - return false; - } + return AEApi.instance().materials().materialBlankPattern.sameAs( i ); case INSCRIBER_PLATE: diff --git a/core/localization/ButtonToolTips.java b/core/localization/ButtonToolTips.java index 6d978df7f..b86f9a02d 100644 --- a/core/localization/ButtonToolTips.java +++ b/core/localization/ButtonToolTips.java @@ -34,7 +34,7 @@ public enum ButtonToolTips LevelType, LevelType_Energy, LevelType_Item, InventoryTweaks, TerminalStyle, TerminalStyle_Full, TerminalStyle_Tall, TerminalStyle_Small, - Pull, PullDescription; + Pull, PullDescription, Substitutions, SubstitutionsOn, SubstitutionsOff; String root; diff --git a/items/storage/ItemEncodedPattern.java b/items/storage/ItemEncodedPattern.java index 3f1cf83a8..d5a375ea9 100644 --- a/items/storage/ItemEncodedPattern.java +++ b/items/storage/ItemEncodedPattern.java @@ -2,10 +2,13 @@ package appeng.items.storage; import java.util.EnumSet; +import net.minecraft.item.ItemStack; +import appeng.api.crafting.ICraftingPatternDetails; +import appeng.api.implementations.ICraftingPatternItem; import appeng.core.features.AEFeature; import appeng.items.AEBaseItem; -public class ItemEncodedPattern extends AEBaseItem +public class ItemEncodedPattern extends AEBaseItem implements ICraftingPatternItem { public ItemEncodedPattern() { @@ -14,4 +17,10 @@ public class ItemEncodedPattern extends AEBaseItem setMaxStackSize( 1 ); } + @Override + public ICraftingPatternDetails getPatternForItem(ItemStack is) + { + return null; + } + } diff --git a/parts/misc/PartToggleBus.java b/parts/misc/PartToggleBus.java index cb9790623..fc71b3430 100644 --- a/parts/misc/PartToggleBus.java +++ b/parts/misc/PartToggleBus.java @@ -15,7 +15,6 @@ import org.lwjgl.opengl.GL11; import appeng.api.AEApi; import appeng.api.exceptions.FailedConnection; -import appeng.api.networking.GridFlags; import appeng.api.networking.IGridConnection; import appeng.api.networking.IGridNode; import appeng.api.parts.IPartCollsionHelper;