From 738340dad10d9fa45696643e6cea3cc2696ad3cb Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 27 Jul 2014 08:23:32 -0400 Subject: [PATCH] Arcane Crafting Terminal Created the Arcane Crafting Terminal. A.C.T. completion ~80% Lots of code cleanups and refactoring. Version change to 0.3.0a --- ChangeLog.txt | 19 +- Features.md | 2 +- .../ThaumicEnergistics.java | 12 +- .../container/ContainerCellTerminalBase.java | 40 +- .../container/ContainerInternalCrafting.java | 20 + .../ContainerPartArcaneCraftingTerminal.java | 706 ++++++++++++++++++ .../container/ContainerPartEssentiaIOBus.java | 16 +- .../ContainerPartEssentiaLevelEmitter.java | 10 +- .../ContainerPartEssentiaStorageBus.java | 16 +- .../IAspectSelectorContainer.java | 2 +- .../slot/SlotArcaneCraftingResult.java | 132 ++++ .../container/slot/SlotRestrictive.java | 9 +- .../grid/AEPartGridBlock.java | 38 + .../gui/GuiArcaneCraftingTerminal.java | 375 ++++++++++ .../gui/GuiCellTerminalBase.java | 57 +- .../gui/GuiEssentiaLevelEmitter.java | 23 +- .../gui/GuiEssentiaStorageBus.java | 25 +- .../gui/GuiEssentiatIO.java | 62 +- .../thaumicenergistics/gui/GuiWidgetHost.java | 35 + .../gui/widget/AbstractAspectWidget.java | 108 +-- .../gui/widget/AbstractWidget.java | 150 ++++ .../gui/widget/IAspectSelectorGui.java | 4 +- .../gui/widget/IAspectWidgetGui.java | 8 - .../gui/widget/IWidgetHost.java | 8 + .../gui/widget/WidgetAEItem.java | 119 +++ .../gui/widget/WidgetAspectSelector.java | 51 +- .../gui/widget/WidgetAspectSlot.java | 147 +--- .../network/AbstractPacket.java | 346 ++++++++- .../network/ChannelHandler.java | 14 +- .../network/IAspectSlotGui.java | 3 +- .../HandlerClientArcaneCraftingTerminal.java | 18 + .../HandlerServerArcaneCraftingTerminal.java | 18 + .../network/packet/PacketAspectSlot.java | 1 + .../PacketClientArcaneCraftingTerminal.java | 244 ++++++ .../packet/PacketClientEssentiaCell.java | 2 + .../packet/PacketClientEssentiaTerminal.java | 2 + .../PacketServerArcaneCraftingTerminal.java | 170 +++++ .../parts/AEPartArcaneCraftingTerminal.java | 426 +++++++++++ .../thaumicenergistics/parts/AEPartBase.java | 12 + .../parts/AEPartEssentiaIO.java | 17 +- .../parts/AEPartEssentiaStorageBus.java | 8 +- .../parts/AEPartEssentiaTerminal.java | 25 + .../registries/AEPartsEnum.java | 5 +- .../render/RenderBlockEssentiaProvider.java | 20 +- .../render/RenderBlockInfusionProvider.java | 18 +- .../texture/BlockTextureManager.java | 10 +- .../texture/GuiTextureManager.java | 3 +- .../tileentities/TileProviderBase.java | 14 + .../util/EssentiaItemContainerHelper.java | 4 +- .../thaumicenergistics/util/GuiHelper.java | 64 +- .../util/IInventoryUpdateReceiver.java | 4 +- .../util/PrivateInventory.java | 12 +- .../assets/thaumicenergistics/lang/en_US.lang | 4 +- .../essentia.provider.overlay.inactive.png | Bin 0 -> 2805 bytes .../textures/blocks/essentia.provider.png | Bin 4782 -> 4412 bytes .../infusion.provider.overlay.inactive.png | Bin 0 -> 2805 bytes .../blocks/parts/arcane.crafting.overlay1.png | Bin 0 -> 3146 bytes .../blocks/parts/arcane.crafting.overlay2.png | Bin 0 -> 2849 bytes .../blocks/parts/arcane.crafting.overlay3.png | Bin 0 -> 2822 bytes .../blocks/parts/arcane.crafting.side.png | Bin 0 -> 3402 bytes .../textures/gui/arcane.crafting.png | Bin 0 -> 4227 bytes src/main/resources/mcmod.info | 2 +- 62 files changed, 3149 insertions(+), 511 deletions(-) create mode 100644 src/main/java/thaumicenergistics/container/ContainerInternalCrafting.java create mode 100644 src/main/java/thaumicenergistics/container/ContainerPartArcaneCraftingTerminal.java rename src/main/java/thaumicenergistics/{gui => container}/IAspectSelectorContainer.java (79%) create mode 100644 src/main/java/thaumicenergistics/container/slot/SlotArcaneCraftingResult.java create mode 100644 src/main/java/thaumicenergistics/gui/GuiArcaneCraftingTerminal.java create mode 100644 src/main/java/thaumicenergistics/gui/GuiWidgetHost.java create mode 100644 src/main/java/thaumicenergistics/gui/widget/AbstractWidget.java delete mode 100644 src/main/java/thaumicenergistics/gui/widget/IAspectWidgetGui.java create mode 100644 src/main/java/thaumicenergistics/gui/widget/IWidgetHost.java create mode 100644 src/main/java/thaumicenergistics/gui/widget/WidgetAEItem.java create mode 100644 src/main/java/thaumicenergistics/network/handlers/part/HandlerClientArcaneCraftingTerminal.java create mode 100644 src/main/java/thaumicenergistics/network/handlers/part/HandlerServerArcaneCraftingTerminal.java create mode 100644 src/main/java/thaumicenergistics/network/packet/PacketClientArcaneCraftingTerminal.java create mode 100644 src/main/java/thaumicenergistics/network/packet/PacketServerArcaneCraftingTerminal.java create mode 100644 src/main/java/thaumicenergistics/parts/AEPartArcaneCraftingTerminal.java create mode 100644 src/main/resources/assets/thaumicenergistics/textures/blocks/essentia.provider.overlay.inactive.png create mode 100644 src/main/resources/assets/thaumicenergistics/textures/blocks/infusion.provider.overlay.inactive.png create mode 100644 src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.overlay1.png create mode 100644 src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.overlay2.png create mode 100644 src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.overlay3.png create mode 100644 src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.side.png create mode 100644 src/main/resources/assets/thaumicenergistics/textures/gui/arcane.crafting.png diff --git a/ChangeLog.txt b/ChangeLog.txt index 3d7f2cd4..bc289e65 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,4 +1,21 @@ -7/23/2014 0.2.1a +7/27/2014 0.3.0a + Cleaned up widget and gui code. + Added ME deposit support. + +7/26/2014 0.3.0a + Linked ACT to ME item network. + +7/25/2014 0.3.0a + Added vanilla crafting functionality to ACT. + Added Thaumcraft crafting functionality to ACT. + Comments and code cleanup on abstract packet. + Implemented packet compression for lists. + +7/24/2014 0.3.0a + Bugfix: Terminals now drop contents when destroyed. + Added Arcane Crafting Terminal AppEng part. + +7/23/2014 0.2.1a Fixes #2: Added IO whitelist. Tiles must be on the whitelist for extraction/injection. Added "Cell" to the storage cell names. Refactored EssentiaTileContainerHelper method names for clarity. diff --git a/Features.md b/Features.md index a86825d6..7f640b14 100644 --- a/Features.md +++ b/Features.md @@ -15,4 +15,4 @@ --WIP-- Redstone indication of how much essentia is stored in the network. ###Crafting - --Planned-- Thaumcraft crafting table with access to items on the network. \ No newline at end of file + --WIP-- Thaumcraft crafting table with access to items on the network. \ No newline at end of file diff --git a/src/main/java/thaumicenergistics/ThaumicEnergistics.java b/src/main/java/thaumicenergistics/ThaumicEnergistics.java index 52048368..59fee83c 100644 --- a/src/main/java/thaumicenergistics/ThaumicEnergistics.java +++ b/src/main/java/thaumicenergistics/ThaumicEnergistics.java @@ -29,7 +29,7 @@ public class ThaumicEnergistics /** * Current version of the mod. */ - public static final String VERSION = "0.2.1a"; // Note: don't forget to change the mcmod.info file as well + public static final String VERSION = "0.3.0a"; // Note: don't forget to change the mcmod.info file as well /** * Singleton instance @@ -94,10 +94,11 @@ public class ThaumicEnergistics } /* TODO: -- Code + * Bugfix: Determine if terminal was destroyed or wrenched. Dont always drop items * Bugfix: Machines run without power * Find magic numbers such as the openGL and keyboard and replace with meaningful constants - * Cache major enum.values[] - * Packet.Write/Read aspect needs compression or a lookup table of some kind. Strings are bad. + * Adjust rarity values for items + * Rework packet structure for client vs server with superclasses and stop depending on constructors, use methods. * * ... I think I hate the word 'essentia' now * @@ -107,13 +108,16 @@ public class ThaumicEnergistics /* * TODO -- Planned Features - * Thaumcraft crafting table with ME network connection + * --WIP--Thaumcraft crafting table with ME network connection * Occlude aspect names if not researched * Terminal sort modes, by amount, by name. Include ascending and desending order * Add aspect tags (thaumometer) to all items * Additional UI's redstone mode, priority window * Level emitter multi-mode * Terminal should be able to do work even when noone is looking at it. (internal timeout perhaps?) + * Give rarity tooltip color value to providers + * Give Spatial IO the ability to move my Tile Entitites. + * Add a scrollbar to guis * * --Possible Features * Wireless terminal diff --git a/src/main/java/thaumicenergistics/container/ContainerCellTerminalBase.java b/src/main/java/thaumicenergistics/container/ContainerCellTerminalBase.java index 134f8e66..6a9cf9d7 100644 --- a/src/main/java/thaumicenergistics/container/ContainerCellTerminalBase.java +++ b/src/main/java/thaumicenergistics/container/ContainerCellTerminalBase.java @@ -5,6 +5,7 @@ import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotFurnace; import net.minecraft.item.ItemStack; @@ -13,7 +14,6 @@ import thaumcraft.api.aspects.Aspect; import thaumicenergistics.aspect.AspectStack; import thaumicenergistics.container.slot.SlotRestrictive; import thaumicenergistics.gui.GuiCellTerminalBase; -import thaumicenergistics.gui.IAspectSelectorContainer; import thaumicenergistics.util.EssentiaConversionHelper; import thaumicenergistics.util.IInventoryUpdateReceiver; import thaumicenergistics.util.PrivateInventory; @@ -52,15 +52,15 @@ public abstract class ContainerCellTerminalBase */ private static int INPUT_POSITION_Y = 74; - /** - * X position for the player inventory - */ - private static int PLAYER_INV_POSITION_X = 104; - /** * Y position for the player inventory */ - private static int PLAYER_INV_POSITION_Y = 162; + private static int PLAYER_INV_POSITION_Y = 104; + + /** + * Y position for the hotbar inventory + */ + private static int HOTBAR_INV_POSITION_Y = 162; /** * The minimum amount of time to wait before playing @@ -174,8 +174,8 @@ public abstract class ContainerCellTerminalBase this.outputSlotNumber = workSlot.slotNumber; // Bind to the player's inventory - this.bindPlayerInventory( this.player.inventory, ContainerCellTerminalBase.PLAYER_INV_POSITION_X, - ContainerCellTerminalBase.PLAYER_INV_POSITION_Y ); + this.bindPlayerInventory( this.player.inventory, ContainerCellTerminalBase.PLAYER_INV_POSITION_Y, + ContainerCellTerminalBase.HOTBAR_INV_POSITION_Y ); } @@ -265,7 +265,7 @@ public abstract class ContainerCellTerminalBase * Called when the import or export has changed items. */ @Override - public void onInventoryChanged() + public void onInventoryChanged( IInventory sourceInventory) { // Is this client side? if ( this.player.worldObj.isRemote ) @@ -315,6 +315,8 @@ public abstract class ContainerCellTerminalBase public void postChange( IMEMonitor monitor, IAEFluidStack change, BaseActionSource source ) { this.aspectStackList = EssentiaConversionHelper.convertIIAEFluidStackListToAspectStackList( monitor.getStorageList() ); + + //TODO: Seriously look at how all this is done. Should be using change, not resending the whole bloody list. } /** @@ -373,30 +375,26 @@ public abstract class ContainerCellTerminalBase // Attempt to merge with the input slot didMerge = this.mergeItemStack( slotStack, this.inputSlotNumber, this.inputSlotNumber + 1, false ); } - + // Did we merge? - if( !didMerge ) + if ( !didMerge ) { didMerge = this.swapSlotInventoryHotbar( slotNumber, slotStack ); } } - // Did we merge? - if ( !didMerge ) - { - return null; - } - // Did the merger drain the stack? if ( slotStack.stackSize == 0 ) { // Set the slot to have no item slot.putStack( null ); } - - // Inform the slot its stack changed; - slot.onSlotChanged(); + else + { + // Inform the slot its stack changed; + slot.onSlotChanged(); + } } diff --git a/src/main/java/thaumicenergistics/container/ContainerInternalCrafting.java b/src/main/java/thaumicenergistics/container/ContainerInternalCrafting.java new file mode 100644 index 00000000..00c3fbbc --- /dev/null +++ b/src/main/java/thaumicenergistics/container/ContainerInternalCrafting.java @@ -0,0 +1,20 @@ +package thaumicenergistics.container; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.Container; + +public class ContainerInternalCrafting + extends Container +{ + + public ContainerInternalCrafting() + { + } + + @Override + public boolean canInteractWith( EntityPlayer player ) + { + return false; + } + +} diff --git a/src/main/java/thaumicenergistics/container/ContainerPartArcaneCraftingTerminal.java b/src/main/java/thaumicenergistics/container/ContainerPartArcaneCraftingTerminal.java new file mode 100644 index 00000000..e36b1d6c --- /dev/null +++ b/src/main/java/thaumicenergistics/container/ContainerPartArcaneCraftingTerminal.java @@ -0,0 +1,706 @@ +package thaumicenergistics.container; + +import java.util.ArrayList; +import java.util.List; +import appeng.api.AEApi; +import appeng.api.config.Actionable; +import appeng.api.networking.security.BaseActionSource; +import appeng.api.networking.security.MachineSource; +import appeng.api.storage.IMEMonitor; +import appeng.api.storage.IMEMonitorHandlerReceiver; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IItemList; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; +import net.minecraft.item.crafting.CraftingManager; +import thaumcraft.api.ThaumcraftApi; +import thaumcraft.api.aspects.Aspect; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.api.crafting.IArcaneRecipe; +import thaumcraft.common.items.wands.ItemWandCasting; +import thaumcraft.common.tiles.TileMagicWorkbench; +import thaumicenergistics.container.slot.SlotArcaneCraftingResult; +import thaumicenergistics.container.slot.SlotRestrictive; +import thaumicenergistics.network.packet.PacketClientArcaneCraftingTerminal; +import thaumicenergistics.parts.AEPartArcaneCraftingTerminal; +import thaumicenergistics.util.GuiHelper; + +public class ContainerPartArcaneCraftingTerminal + extends ContainerWithPlayerInventory + implements IMEMonitorHandlerReceiver +{ + /** + * Y position for the player inventory. + */ + private static int PLAYER_INV_POSITION_Y = 162; + + /** + * Y position for the hotbar inventory. + */ + private static int HOTBAR_INV_POSITION_Y = 220; + + /** + * Row and Column counts of the crafting grid. + */ + private static int CRAFTING_GRID_SIZE = 3; + + /** + * Total number of slots in the crafting grid + */ + public static int CRAFTING_GRID_TOTAL_SIZE = CRAFTING_GRID_SIZE * CRAFTING_GRID_SIZE; + + /** + * Starting X position for crafting slots. + */ + private static int CRAFTING_SLOT_X_POS = 44; + + /** + * Starting Y position for crafting slots. + */ + private static int CRAFTING_SLOT_Y_POS = 90; + + /** + * Starting X position for the output slot. + */ + private static int RESULT_SLOT_X_POS = 116; + + /** + * Starting Y position for the output slot. + */ + private static int RESULT_SLOT_Y_POS = 126; + + /** + * Starting X position for the wand slot. + */ + private static int WAND_SLOT_XPOS = 116; + + /** + * Starting Y position for the wand slot. + */ + private static int WAND_SLOT_YPOS = 90; + + /** + * Width and height of a slot. + */ + private static int SLOT_SIZE = 18; + + /** + * The arcane crafting terminal associated with the container. + */ + private AEPartArcaneCraftingTerminal terminal; + + /** + * The player associated with this container. + */ + private EntityPlayer player; + + /** + * Slot number of the first crafting slot. + */ + private int firstCraftingSlotNumber = -1; + + /** + * Slot number of the last crafting slot. + */ + private int lastCraftingSlotNumber = -1; + + /** + * Slot number of the wand. + */ + private int wandSlotNumber = -1; + + /** + * Slot number of the result. + */ + private int resultSlotNumber = -1; + + /** + * The wand currently in the wand slot. + */ + private ItemStack wand; + + /** + * The required aspects for the current recipe. + */ + private AspectList requiredAspects; + + /** + * The aspects the wand does not have enough of for the current recipe. + */ + private List missingAspects = new ArrayList(); + + /** + * The AE network item monitor we are attached to. + */ + private IMEMonitor monitor; + + /** + * AE Machine representation of the terminal. + */ + private MachineSource machineSource; + + /** + * Creates the container + * + * @param terminal + * @param player + */ + public ContainerPartArcaneCraftingTerminal( AEPartArcaneCraftingTerminal terminal, EntityPlayer player ) + { + // Set the part + this.terminal = terminal; + + // Set the machine source + this.machineSource = new MachineSource( terminal ); + + // Set the player + this.player = player; + + // Bind to the players inventory + this.bindPlayerInventory( player.inventory, ContainerPartArcaneCraftingTerminal.PLAYER_INV_POSITION_Y, + ContainerPartArcaneCraftingTerminal.HOTBAR_INV_POSITION_Y ); + + // Add crafting slots + Slot craftingSlot = null; + for( int row = 0; row < ContainerPartArcaneCraftingTerminal.CRAFTING_GRID_SIZE; row++ ) + { + for( int column = 0; column < ContainerPartArcaneCraftingTerminal.CRAFTING_GRID_SIZE; column++ ) + { + // Calculate the index + int slotIndex = ( row * ContainerPartArcaneCraftingTerminal.CRAFTING_GRID_SIZE ) + column; + + // Create the slot + craftingSlot = new Slot( terminal, slotIndex, ContainerPartArcaneCraftingTerminal.CRAFTING_SLOT_X_POS + + ( column * ContainerPartArcaneCraftingTerminal.SLOT_SIZE ), ContainerPartArcaneCraftingTerminal.CRAFTING_SLOT_Y_POS + + ( row * ContainerPartArcaneCraftingTerminal.SLOT_SIZE ) ); + + // Add the slot + this.addSlotToContainer( craftingSlot ); + + // Check first crafting slot number + if( ( row + column ) == 0 ) + { + this.firstCraftingSlotNumber = craftingSlot.slotNumber; + } + } + } + + // Set last crafting slot number + if( craftingSlot != null ) + { + this.lastCraftingSlotNumber = craftingSlot.slotNumber; + } + + // Create the result slot + SlotArcaneCraftingResult resultSlot = new SlotArcaneCraftingResult( player, terminal, terminal, + AEPartArcaneCraftingTerminal.RESULT_SLOT_INDEX, ContainerPartArcaneCraftingTerminal.RESULT_SLOT_X_POS, + ContainerPartArcaneCraftingTerminal.RESULT_SLOT_Y_POS ); + + // Add the result slot + this.addSlotToContainer( resultSlot ); + + // Set the result slot number + this.resultSlotNumber = resultSlot.slotNumber; + + // Create the wand slot + SlotRestrictive wandSlot = new SlotRestrictive( terminal, AEPartArcaneCraftingTerminal.WAND_SLOT_INDEX, + ContainerPartArcaneCraftingTerminal.WAND_SLOT_XPOS, ContainerPartArcaneCraftingTerminal.WAND_SLOT_YPOS ); + + // Add the wand slot + this.addSlotToContainer( wandSlot ); + + // Set wand slot number + this.wandSlotNumber = wandSlot.slotNumber; + + // Register the container with terminal + terminal.registerListener( this ); + + // Is this server side? + if( !player.worldObj.isRemote ) + { + // Get the AE monitor + this.monitor = terminal.getGridBlock().getItemMonitor(); + + // Did we get a monitor? + if( this.monitor != null ) + { + // Register with the monitor. + this.monitor.addListener( this, null ); + } + } + + } + + /** + * Searches for a matching regular(non arcane) crafting recipe result + * + * @return ItemStack of the result if found, null otherwise. + */ + private ItemStack findMatchingRegularResult() + { + // Create a new crafting inventory + InventoryCrafting craftingInventory = new InventoryCrafting( new ContainerInternalCrafting(), + ContainerPartArcaneCraftingTerminal.CRAFTING_GRID_SIZE, ContainerPartArcaneCraftingTerminal.CRAFTING_GRID_SIZE ); + + // Load the inventory based on what is in the part's inventory + for( int slotIndex = 0; slotIndex < ( ContainerPartArcaneCraftingTerminal.CRAFTING_GRID_TOTAL_SIZE ); slotIndex++ ) + { + // Set the slot + craftingInventory.setInventorySlotContents( slotIndex, this.terminal.getStackInSlot( slotIndex ) ); + } + + // Return the result + return CraftingManager.getInstance().findMatchingRecipe( craftingInventory, this.terminal.getWorldObj() ); + } + + /** + * Searches for a matching arcane crafting recipe result + * + * @return ItemStack of the result if found, null otherwise. + */ + private ItemStack findMatchingArcaneResult() + { + // Create a new workbench tile (finally figured this bit out, can't just use any old inventory. Nooope.) + TileMagicWorkbench workbenchTile = new TileMagicWorkbench(); + + // Load the workbench inventory based on what is in the part's inventory + for( int slotIndex = 0; slotIndex < ( ContainerPartArcaneCraftingTerminal.CRAFTING_GRID_TOTAL_SIZE ); slotIndex++ ) + { + // Set the slot + workbenchTile.setInventorySlotContentsSoftly( slotIndex, this.terminal.getStackInSlot( slotIndex ) ); + } + + ItemStack arcaneCraft = null; + + // Loop through all arcane crafting recipes + for( Object currentRecipe : ThaumcraftApi.getCraftingRecipes() ) + { + // Is the current recipe an arcane one? + if( ( currentRecipe != null ) && ( currentRecipe instanceof IArcaneRecipe ) ) + { + // Does the recipe have a match? + if( ( (IArcaneRecipe)currentRecipe ).matches( workbenchTile, this.player.worldObj, this.player ) ) + { + // Found a match, validate it. + arcaneCraft = this.validateWandVisAmount( (IArcaneRecipe)currentRecipe, workbenchTile ); + + // Stop searching + break; + } + } + } + + // Invalidate the tile (not sure if this is needed, but seems a good idea) + workbenchTile.invalidate(); + + // Return the result + return arcaneCraft; + } + + /** + * Checks if the wand has enough vis to complete the craft. + * Takes into consideration the players multiplier. + * + * @param forRecipe + * @param workbenchTile + * @return ItemStack of the result if wand has enough vis, null otherwise. + */ + private ItemStack validateWandVisAmount( IArcaneRecipe forRecipe, TileMagicWorkbench workbenchTile ) + { + // Do we have a want? + if( this.wand != null ) + { + boolean hasAll = true; + + // Get a copy the aspects of the recipe. + this.requiredAspects = forRecipe.getAspects( workbenchTile ).copy(); + + // Cache the recipes aspects + Aspect[] recipeAspects = this.requiredAspects.getAspects(); + + // Get the wand item + ItemWandCasting wandItem = ( (ItemWandCasting)this.wand.getItem() ); + + // Cache the wand's aspect list + AspectList wandAspectList = wandItem.getAllVis( this.wand ); + + // Check the wand amounts vs recipe aspects + for( Aspect currentAspect : recipeAspects ) + { + // Get the base required vis + int baseVis = this.requiredAspects.getAmount( currentAspect ); + + // Get the adjusted amount + int requiredVis = (int)( baseVis * 100 * wandItem.getConsumptionModifier( this.wand, this.player, currentAspect, true ) ); + + // Get the amount of vis in the wand + int hasVis = wandAspectList.getAmount( currentAspect ); + + // Does the wand not have enough of vis of this aspect? + if( hasVis < requiredVis ) + { + // Add to the missing list + this.missingAspects.add( currentAspect ); + + // Mark that we do not have enough vis to complete crafting + hasAll = false; + } + } + + // Did we have all the vis required? + if( hasAll ) + { + // Get the result of the recipe. + return forRecipe.getCraftingResult( workbenchTile ); + } + } + + return null; + + } + + /** + * Sets 'wand' if there is a wand in the wand slot. + */ + private void getWand() + { + // Get the wand slot + Slot wandSlot = this.getSlot( this.wandSlotNumber ); + + // Is the slot not null and does it contain a wand? + if( ( wandSlot != null ) && ( wandSlot.getHasStack() ) && ( wandSlot.getStack().getItem() instanceof ItemWandCasting ) ) + { + // Set the wand + this.wand = wandSlot.getStack(); + } + else + { + // Set the wand to null + this.wand = null; + } + } + + /** + * Called when crafting inputs are changed. + */ + @Override + public void onCraftMatrixChanged( IInventory inventory ) + { + // Reset crafting aspects + this.requiredAspects = null; + this.missingAspects.clear(); + + // Reset wand + this.getWand(); + + // Get the matching regular crafting recipe. + ItemStack craftResult = this.findMatchingRegularResult(); + + // Was there not a regular match and do we have a wand? + if( ( craftResult == null ) && ( this.wand != null ) ) + { + // Get the matching arcane crafting recipe. + craftResult = this.findMatchingArcaneResult(); + } + + // Get the result slot + SlotArcaneCraftingResult resultSlot = (SlotArcaneCraftingResult)this.getSlot( this.resultSlotNumber ); + + // Set the result slot aspects and wand + resultSlot.setResultAspects( this.requiredAspects ); + resultSlot.setWand( this.wand ); + + // Set the result + this.terminal.setInventorySlotContentsWithoutNotify( AEPartArcaneCraftingTerminal.RESULT_SLOT_INDEX, craftResult ); + + } + + /** + * Who can interact with this? + */ + @Override + public boolean canInteractWith( EntityPlayer player ) + { + return true; + } + + /** + * Called when the player shift+clicks on a slot + */ + @Override + public ItemStack transferStackInSlot( EntityPlayer player, int slotNumber ) + { + // Get the slot that was shift-clicked + Slot slot = (Slot)this.inventorySlots.get( slotNumber ); + + // Is there a valid slot with and item? + if( ( slot != null ) && ( slot.getHasStack() ) ) + { + boolean didMerge = false; + + boolean didCrafting = false; + + // Get the itemstack in the slot + ItemStack slotStack = slot.getStack(); + + // Also make a copy of it + ItemStack slotStackOriginal = slotStack.copy(); + + // Was the slot clicked in the crafting grid or wand? + if( ( slotNumber == this.wandSlotNumber ) || this.slotClickedWasInCraftingInventory( slotNumber ) ) + { + // Attempt to merge with the player inventory + didMerge = this.mergeSlotWithPlayerInventory( slotStack ); + + // Did we merge? + if( !didMerge ) + { + // Attempt to merge with the hotbar + didMerge = this.mergeSlotWithHotbarInventory( slotStack ); + } + } + // Was the slot clicked in the player or hotbar inventory? + else if( this.slotClickedWasInPlayerInventory( slotNumber ) || this.slotClickedWasInHotbarInventory( slotNumber ) ) + { + + // Is the item a valid wand? + if( this.getSlot( this.wandSlotNumber ).isItemValid( slotStack ) ) + { + // Attempt to merge with the wand + didMerge = this.mergeItemStack( slotStack, this.wandSlotNumber, this.wandSlotNumber + 1, false ); + } + + // Did we merge? + if( !didMerge ) + { + // Attempt to merge with the crafting grid + didMerge = this.mergeItemStack( slotStack, this.firstCraftingSlotNumber, this.lastCraftingSlotNumber + 1, false ); + + // Did we merge? + if( !didMerge ) + { + // Attempt to swap hotbar<->player inventory + didMerge = this.swapSlotInventoryHotbar( slotNumber, slotStack ); + } + } + } + else if( slotNumber == this.resultSlotNumber ) + { + // Attempt to merge with the player inventory + didMerge = this.mergeSlotWithPlayerInventory( slotStack ); + + // Did we merge? + if( !didMerge ) + { + // Attempt to merge with the hotbar + didMerge = this.mergeSlotWithHotbarInventory( slotStack ); + } + + // Did we merge? + if( didMerge ) + { + /** + * If slotStackOriginal has more items than slotStack, + * onCrafting(item,countIncrease) is called + */ + slot.onSlotChange( slotStack, slotStackOriginal ); + + // Mark that we may have done some crafting. + didCrafting = true; + } + + } + + // Did we merge? + if( !didMerge ) + { + return null; + } + + // Did the merger drain the stack? + if( slotStack.stackSize == 0 ) + { + // Set the slot to have no item + slot.putStack( null ); + } + else + { + // Inform the slot its stack changed; + slot.onSlotChanged(); + } + + // Was there a crafting event? + if( didCrafting ) + { + // Do the stack sizes differ? + if( slotStack.stackSize != slotStackOriginal.stackSize ) + { + // Call on pickup + slot.onPickupFromSlot( player, slotStack ); + + // Return the original so that retry is called + return slotStackOriginal; + } + + } + + } + + // All taken care of! + return null; + } + + /** + * Checks if the slotnumber belongs to the crafting matrix + * + * @param slotNumber + * @return + */ + protected boolean slotClickedWasInCraftingInventory( int slotNumber ) + { + return ( slotNumber >= this.firstCraftingSlotNumber ) && ( slotNumber <= this.lastCraftingSlotNumber ); + } + + /** + * Unregister this container + */ + @Override + public void onContainerClosed( EntityPlayer player ) + { + // Pass to super + super.onContainerClosed( player ); + + if( this.terminal != null ) + { + this.terminal.removeListener( this ); + } + + if( !player.worldObj.isRemote ) + { + if( this.monitor != null ) + { + this.monitor.removeListener( this ); + } + } + } + + @Override + public boolean isValid( Object authToken ) + { + return true; + } + + @Override + public void onListUpdate() + { + // Ignored + } + + @Override + public void postChange( IMEMonitor monitor, IAEItemStack change, BaseActionSource actionSource ) + { + // Send the change to the client + new PacketClientArcaneCraftingTerminal().createChangeUpdate( this.player, change ).sendPacketToPlayer( this.player ); + } + + /** + * A client has requested the full list of all items in the ME network. + * @param player + */ + public void onClientRequestFullUpdate( EntityPlayer player ) + { + // Ensure we have a monitor + if( this.monitor != null ) + { + // Get the full list + IItemList fullList = this.monitor.getStorageList(); + + // Is it valid? + if( ( fullList != null ) && ( !fullList.isEmpty() ) ) + { + // Send to the client + new PacketClientArcaneCraftingTerminal().createFullListUpdate( player, fullList ).sendPacketToPlayer( player ); + } + } + } + + /** + * A client player is requesting to extract an item stack out + * of the ME network. + * @param player + * @param itemStack + * @param mouseButton + */ + public void onClientRequestExtract( EntityPlayer player, IAEItemStack itemStack, int mouseButton ) + { + + } + + /** + * A client player is requesting to deposit their held item + * into the ME network. + */ + public void onClientRequestDeposit( EntityPlayer player, int mouseButton ) + { + // Get what the player is holding + ItemStack playerHolding = player.inventory.getItemStack(); + + System.out.println( mouseButton ); + + // Is the player holding anything? + if( playerHolding != null ) + { + // Create the AE itemstack representation of the itemstack + IAEItemStack toInjectStack = AEApi.instance().storage().createItemStack( playerHolding ); + + // Was it a right click? + if( mouseButton == GuiHelper.MOUSE_BUTTON_RIGHT) + { + // Set stack size to 1 + toInjectStack.setStackSize( 1 ); + } + + // Attempt to inject + IAEItemStack leftOverStack = this.monitor.injectItems( toInjectStack, Actionable.MODULATE, this.machineSource ); + + // Was there anything left over? + if( ( leftOverStack != null ) && ( leftOverStack.getStackSize() > 0 ) ) + { + // Were we only trying to inject one? + if( toInjectStack.getStackSize() == 1 ) + { + // No changes made + return; + } + + // Set what was left over as the itemstack being held + player.inventory.setItemStack( leftOverStack.getItemStack() ); + } + else + { + // Was this a right click, and there was more than 1 item? + if( ( mouseButton == GuiHelper.MOUSE_BUTTON_RIGHT ) && ( playerHolding.stackSize > 1 ) ) + { + // Set the player holding one less + playerHolding.stackSize--; + player.inventory.setItemStack( playerHolding ); + + // Set the leftover stack to match + leftOverStack = AEApi.instance().storage().createItemStack( playerHolding ); + } + else + { + // Set the player as holding nothing + player.inventory.setItemStack( null ); + } + } + + // Send the update to the client + new PacketClientArcaneCraftingTerminal().createPlayerHoldingUpdate( player, leftOverStack ).sendPacketToPlayer( player ); + } + } + +} diff --git a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaIOBus.java b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaIOBus.java index c3d08d23..50c8b61b 100644 --- a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaIOBus.java +++ b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaIOBus.java @@ -29,15 +29,15 @@ public class ContainerPartEssentiaIOBus */ private static int UPGRADE_Y_POS = 8; - /** - * X position for the player inventory - */ - private static int PLAYER_INV_POSITION_X = 102; - /** * Y position for the player inventory */ - private static int PLAYER_INV_POSITION_Y = 160; + private static int PLAYER_INV_POSITION_Y = 102; + + /** + * Y position for the hotbar inventory + */ + private static int HOTBAR_INV_POSITION_Y = 160; /** * The part associated with this container @@ -58,8 +58,8 @@ public class ContainerPartEssentiaIOBus this.part = part; // Bind to the player's inventory - this.bindPlayerInventory( player.inventory, ContainerPartEssentiaIOBus.PLAYER_INV_POSITION_X, - ContainerPartEssentiaIOBus.PLAYER_INV_POSITION_Y ); + this.bindPlayerInventory( player.inventory, ContainerPartEssentiaIOBus.PLAYER_INV_POSITION_Y, + ContainerPartEssentiaIOBus.HOTBAR_INV_POSITION_Y ); // Add the upgrade slots this.addUpgradeSlots( part.getUpgradeInventory(), ContainerPartEssentiaIOBus.NUMBER_OF_UPGRADE_SLOTS, ContainerPartEssentiaIOBus.UPGRADE_X_POS, diff --git a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaLevelEmitter.java b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaLevelEmitter.java index d90dfa52..86ecb68f 100644 --- a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaLevelEmitter.java +++ b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaLevelEmitter.java @@ -17,12 +17,12 @@ public class ContainerPartEssentiaLevelEmitter /** * X position for the player inventory */ - private static int PLAYER_INV_POSITION_X = 93; + private static int PLAYER_INV_POSITION_Y = 93; /** - * Y position for the player inventory + * Y position for the hotbar inventory */ - private static int PLAYER_INV_POSITION_Y = 151; + private static int HOTBAR_INV_POSITION_Y = 151; /** * The AE part associated with this container. @@ -41,8 +41,8 @@ public class ContainerPartEssentiaLevelEmitter this.part = part; // Get the players inventory and bind it to the container. - this.bindPlayerInventory( player.inventory, ContainerPartEssentiaLevelEmitter.PLAYER_INV_POSITION_X, - ContainerPartEssentiaLevelEmitter.PLAYER_INV_POSITION_Y ); + this.bindPlayerInventory( player.inventory, ContainerPartEssentiaLevelEmitter.PLAYER_INV_POSITION_Y, + ContainerPartEssentiaLevelEmitter.HOTBAR_INV_POSITION_Y ); } /** diff --git a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaStorageBus.java b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaStorageBus.java index 3f0b5286..33501919 100644 --- a/src/main/java/thaumicenergistics/container/ContainerPartEssentiaStorageBus.java +++ b/src/main/java/thaumicenergistics/container/ContainerPartEssentiaStorageBus.java @@ -18,15 +18,15 @@ public class ContainerPartEssentiaStorageBus */ private static final int UPGRADE_SLOT_Y = 8; - /** - * X position for the player inventory - */ - private static int PLAYER_INV_POSITION_X = 140; - /** * Y position for the player inventory */ - private static int PLAYER_INV_POSITION_Y = 198; + private static int PLAYER_INV_POSITION_Y = 140; + + /** + * Y position for the hotbar inventory + */ + private static int HOTBAR_INV_POSITION_Y = 198; private AEPartEssentiaStorageBus part; @@ -40,8 +40,8 @@ public class ContainerPartEssentiaStorageBus ContainerPartEssentiaStorageBus.UPGRADE_SLOT_Y ); // Bind to the player's inventory - this.bindPlayerInventory( player.inventory, ContainerPartEssentiaStorageBus.PLAYER_INV_POSITION_X, - ContainerPartEssentiaStorageBus.PLAYER_INV_POSITION_Y ); + this.bindPlayerInventory( player.inventory, ContainerPartEssentiaStorageBus.PLAYER_INV_POSITION_Y, + ContainerPartEssentiaStorageBus.HOTBAR_INV_POSITION_Y ); // Bind to the network tool this.bindToNetworkTool( player.inventory, part.getHost().getLocation() ); diff --git a/src/main/java/thaumicenergistics/gui/IAspectSelectorContainer.java b/src/main/java/thaumicenergistics/container/IAspectSelectorContainer.java similarity index 79% rename from src/main/java/thaumicenergistics/gui/IAspectSelectorContainer.java rename to src/main/java/thaumicenergistics/container/IAspectSelectorContainer.java index 52ce6b6e..770264f2 100644 --- a/src/main/java/thaumicenergistics/gui/IAspectSelectorContainer.java +++ b/src/main/java/thaumicenergistics/container/IAspectSelectorContainer.java @@ -1,4 +1,4 @@ -package thaumicenergistics.gui; +package thaumicenergistics.container; import thaumcraft.api.aspects.Aspect; diff --git a/src/main/java/thaumicenergistics/container/slot/SlotArcaneCraftingResult.java b/src/main/java/thaumicenergistics/container/slot/SlotArcaneCraftingResult.java new file mode 100644 index 00000000..14001366 --- /dev/null +++ b/src/main/java/thaumicenergistics/container/slot/SlotArcaneCraftingResult.java @@ -0,0 +1,132 @@ +package thaumicenergistics.container.slot; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.SlotCrafting; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.entity.player.PlayerDestroyItemEvent; +import thaumcraft.api.aspects.AspectList; +import thaumcraft.common.items.wands.ItemWandCasting; +import thaumicenergistics.container.ContainerPartArcaneCraftingTerminal; +import cpw.mods.fml.common.FMLCommonHandler; + +public class SlotArcaneCraftingResult + extends SlotCrafting +{ + /** + * The inventory of the terminal + */ + private IInventory terminalInventory; + + private AspectList craftingAspects = null; + + private ItemStack wand; + + /** + * Creates the slot + * + * @param player + * @param terminalInventory + * @param slotInventory + * @param slotIndex + * @param xPos + * @param yPos + */ + public SlotArcaneCraftingResult( EntityPlayer player, IInventory terminalInventory, IInventory slotInventory, int slotIndex, int xPos, int yPos ) + { + // Call super + super( player, terminalInventory, slotInventory, slotIndex, xPos, yPos ); + + // Set the matrix + this.terminalInventory = terminalInventory; + } + + public void setResultAspects( AspectList aspectList ) + { + this.craftingAspects = aspectList; + } + + public void setWand( ItemStack wand ) + { + this.wand = wand; + } + + @Override + public void onPickupFromSlot( EntityPlayer player, ItemStack itemStack ) + { + // Not really sure what this does, but "SlotCrafting" does it, so I shall also! + FMLCommonHandler.instance().firePlayerCraftingEvent( player, itemStack, this.terminalInventory ); + + // Seems to fire achievements, and handles the item creation + this.onCrafting( itemStack ); + + // Is this an arcane recipe? + if( this.craftingAspects != null ) + { + // Consume wand vis + ( (ItemWandCasting)this.wand.getItem() ).consumeAllVisCrafting( this.wand, player, this.craftingAspects, true ); + + } + + // Loop over all crafting slots + for( int slotIndex = 0; slotIndex < ContainerPartArcaneCraftingTerminal.CRAFTING_GRID_TOTAL_SIZE; slotIndex++ ) + { + // Get the itemstack in this slot + ItemStack slotStack = this.terminalInventory.getStackInSlot( slotIndex ); + + // Is there a stack? + if( slotStack == null ) + { + // Next + continue; + } + + // Decrease it's size by 1 + this.terminalInventory.decrStackSize( slotIndex, 1 ); + + // Does the item in the slotstack have a container? + if( slotStack.getItem().hasContainerItem( slotStack ) ) + { + // Get the container item + ItemStack slotContainerItem = slotStack.getItem().getContainerItem( slotStack ); + + // Is the container item damage-able? + if( slotContainerItem.isItemStackDamageable() ) + { + // Did we kill it? + if( slotContainerItem.getItemDamage() >= slotContainerItem.getMaxDamage() ) + { + // Still not sure about these forge events, really need to read up on them + // But again "SlotCrafting" does this, so shall I + MinecraftForge.EVENT_BUS.post( new PlayerDestroyItemEvent( player, slotContainerItem ) ); + + // Null out the container item + slotContainerItem = null; + } + } + + // Did we not kill the container item? + if( slotContainerItem != null ) + { + // Should the item go back to the player inventory? + if( slotStack.getItem().doesContainerItemLeaveCraftingGrid( slotStack ) ) + { + // Attempt to place it in the players inventory + if( player.inventory.addItemStackToInventory( slotContainerItem ) ) + { + // Could place it, next + continue; + } + + // Could not place it back in the players inventory + } + + // Place it back in the grid + this.terminalInventory.setInventorySlotContents( slotIndex, slotContainerItem ); + } + } + } + } + +} diff --git a/src/main/java/thaumicenergistics/container/slot/SlotRestrictive.java b/src/main/java/thaumicenergistics/container/slot/SlotRestrictive.java index c2af26a9..e711c634 100644 --- a/src/main/java/thaumicenergistics/container/slot/SlotRestrictive.java +++ b/src/main/java/thaumicenergistics/container/slot/SlotRestrictive.java @@ -14,7 +14,9 @@ public class SlotRestrictive extends Slot /** * The inventory we belong to */ - IInventory inventory; + private IInventory inventory; + + private int myIndex; /** * Create the slot. @@ -30,6 +32,9 @@ public class SlotRestrictive extends Slot // Set the inventory this.inventory = inventory; + + // Set this index + this.myIndex = index; } /** @@ -38,6 +43,6 @@ public class SlotRestrictive extends Slot @Override public boolean isItemValid( ItemStack itemstack ) { - return this.inventory.isItemValidForSlot( this.slotNumber, itemstack ); + return this.inventory.isItemValidForSlot( this.myIndex, itemstack ); } } diff --git a/src/main/java/thaumicenergistics/grid/AEPartGridBlock.java b/src/main/java/thaumicenergistics/grid/AEPartGridBlock.java index 977f311c..44d5e9ee 100644 --- a/src/main/java/thaumicenergistics/grid/AEPartGridBlock.java +++ b/src/main/java/thaumicenergistics/grid/AEPartGridBlock.java @@ -14,6 +14,7 @@ import appeng.api.networking.storage.IStorageGrid; import appeng.api.parts.PartItemStack; import appeng.api.storage.IMEMonitor; import appeng.api.storage.data.IAEFluidStack; +import appeng.api.storage.data.IAEItemStack; import appeng.api.util.AEColor; import appeng.api.util.DimensionalCoord; @@ -106,6 +107,43 @@ public class AEPartGridBlock implements IGridBlock return storageGrid.getFluidInventory(); } + /** + * Gets the AE item monitor for the grid. + * @return Monitor if valid grid, null otherwise. + */ + public IMEMonitor getItemMonitor() + { + // Get the grid node + IGridNode node = this.part.getGridNode(); + + // Do we have a grid node? + if ( node == null ) + { + return null; + } + + // Get the grid. + IGrid grid = node.getGrid(); + + // Do we have a grid? + if ( grid == null ) + { + return null; + } + + // Get the storage grid from the cache. + IStorageGrid storageGrid = (IStorageGrid) grid.getCache( IStorageGrid.class ); + + // Do we have a storage grid? + if ( storageGrid == null ) + { + return null; + } + + // Return the storage grid's item monitor. + return storageGrid.getItemInventory(); + } + /** * Returns the color of the grid. */ diff --git a/src/main/java/thaumicenergistics/gui/GuiArcaneCraftingTerminal.java b/src/main/java/thaumicenergistics/gui/GuiArcaneCraftingTerminal.java new file mode 100644 index 00000000..e090c158 --- /dev/null +++ b/src/main/java/thaumicenergistics/gui/GuiArcaneCraftingTerminal.java @@ -0,0 +1,375 @@ +package thaumicenergistics.gui; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import net.minecraft.client.Minecraft; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.util.StatCollector; +import org.lwjgl.opengl.GL11; +import thaumicenergistics.container.ContainerPartArcaneCraftingTerminal; +import thaumicenergistics.gui.widget.AbstractWidget; +import thaumicenergistics.gui.widget.WidgetAEItem; +import thaumicenergistics.network.packet.PacketServerArcaneCraftingTerminal; +import thaumicenergistics.parts.AEPartArcaneCraftingTerminal; +import thaumicenergistics.texture.GuiTextureManager; +import thaumicenergistics.util.GuiHelper; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IItemList; +import appeng.client.render.AppEngRenderItem; + +public class GuiArcaneCraftingTerminal + extends GuiWidgetHost +{ + /** + * The width of the gui + */ + private final int GUI_WIDTH = 175; + + /** + * The height of the gui + */ + private final int GUI_HEIGHT = 243; + + /** + * X position of the title string + */ + private static final int TITLE_POS_X = 8; + + /** + * Y position of the title string + */ + private static final int TITLE_POS_Y = 6; + + /** + * Number of rows in the ME inventory grid. + */ + private static final int ME_ROWS = 3; + + /** + * Number of columns in the ME inventory grid. + */ + private static final int ME_COLUMNS = 9; + + /** + * Total number of item widgets + */ + private static final int ME_WIDGET_COUNT = ME_ROWS * ME_COLUMNS; + + /** + * Starting X position of the items + */ + private static final int ME_ITEM_POS_X = 7; + + /** + * Starting Y position of the items + */ + private static final int ME_ITEM_POS_Y = 17; + + /** + * Total width of the ME item grid + */ + private static final int ME_GRID_WIDTH = 161; + + /** + * Total height of the ME item grid + */ + private static final int ME_GRID_HEIGHT = 53; + + /** + * Holds the list of all items in the ME network + */ + private IItemList networkItems = null; + + /** + * Holds a list of changes sent to the gui before the + * full list is sent. + */ + private List pendingChanges = new ArrayList(); + + /** + * Renders an AE itemstack into the gui. + */ + private AppEngRenderItem aeItemRenderer = new AppEngRenderItem(); + + /** + * Set to true once a request is sent to the server. + */ + private boolean hasRequested = false; + + private String searchQuery = ""; + + private String guiTitle; + + private WidgetAEItem[] itemWidgets = new WidgetAEItem[GuiArcaneCraftingTerminal.ME_WIDGET_COUNT]; + + private EntityPlayer player; + + public GuiArcaneCraftingTerminal( AEPartArcaneCraftingTerminal part, EntityPlayer player ) + { + // Call super + super( new ContainerPartArcaneCraftingTerminal( part, player ) ); + + // Set the player + this.player = player; + + // Set the width and height + this.xSize = this.GUI_WIDTH; + this.ySize = this.GUI_HEIGHT; + + // Set the title + this.guiTitle = StatCollector.translateToLocal( "thaumicenergistics.gui.arcane.crafting.terminal.title" ); + + // Create the widgets + for( int row = 0; row < GuiArcaneCraftingTerminal.ME_ROWS; row++ ) + { + for( int column = 0; column < GuiArcaneCraftingTerminal.ME_COLUMNS; column++ ) + { + // Calculate the index + int index = ( row * GuiArcaneCraftingTerminal.ME_COLUMNS ) + column; + + this.itemWidgets[index] = new WidgetAEItem( this, GuiArcaneCraftingTerminal.ME_ITEM_POS_X + ( column * AbstractWidget.WIDGET_SIZE ), + GuiArcaneCraftingTerminal.ME_ITEM_POS_Y + ( row * AbstractWidget.WIDGET_SIZE ), this.aeItemRenderer ); + } + } + + // Request a full update from the server + new PacketServerArcaneCraftingTerminal().createFullListRequest( player ).sendPacketToServer(); + this.hasRequested = true; + + } + + /** + * Called when the server sends a full list of all + * items in the AE network in response to our request. + * + * @param itemList + */ + public void onReceiveFullList( IItemList itemList ) + { + // Set the list + this.networkItems = itemList; + + // Check pending changes + if( ( this.networkItems != null ) && ( !this.pendingChanges.isEmpty() ) ) + { + // Update list with pending changes + for( int index = 0; index < this.pendingChanges.size(); index++ ) + { + this.onReceiveChange( this.pendingChanges.get( index ) ); + } + + // Clear pending + this.pendingChanges.clear(); + } + + // Update the widgets + this.updateWidgetItems(); + } + + public void onReceiveChange( IAEItemStack change ) + { + // Is the change not null? + if( change != null ) + { + // Do we yet have a requested list? + if( this.hasRequested && ( this.networkItems == null ) ) + { + // Add to the pending list + this.pendingChanges.add( change ); + return; + } + + // Get the matching item + IAEItemStack networkItem = this.networkItems.findPrecise( change ); + + // Is there a match? + if( networkItem != null ) + { + // Adjust its amount + networkItem.incStackSize( change.getStackSize() ); + } + else if( change.getStackSize() > 0 ) + { + // Add to the list + this.networkItems.add( change ); + } + } + + // Update widgets only if there are not pending changes + if( this.pendingChanges.isEmpty() ) + { + this.updateWidgetItems(); + } + } + + /** + * Assigns the network items to the widgets + */ + private void updateWidgetItems() + { + // Create an iterator + Iterator networkItemIterator = this.networkItems.iterator(); + + // Is there a search term? + if( !this.searchQuery.equals( "" ) ) + { + // Pass to update with search + this.updateWithSearch( networkItemIterator ); + + return; + } + + // List all items + for( int index = 0; index < GuiArcaneCraftingTerminal.ME_WIDGET_COUNT; index++ ) + { + // Does the iterator have a next? + if( networkItemIterator.hasNext() ) + { + // Set the item + this.itemWidgets[index].setItemStack( networkItemIterator.next() ); + } + else + { + // Set to null + this.itemWidgets[index].setItemStack( null ); + } + } + } + + /** + * Assigns the network items to the widgets, skipping any item + * that does not match the search query. + * + * @param networkItemIterator + */ + private void updateWithSearch( Iterator networkItemIterator ) + { + + } + + @Override + protected void drawGuiContainerBackgroundLayer( float alpha, int mouseX, int mouseY ) + { + // Full white + GL11.glColor4f( 1.0F, 1.0F, 1.0F, 1.0F ); + + // Set the texture + Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.ARCANE_CRAFTING_TERMINAL.getTexture() ); + + // Draw the gui image + this.drawTexturedModalRect( this.guiLeft, this.guiTop, 0, 0, this.GUI_WIDTH, this.GUI_HEIGHT ); + + //this.drawTexturedModalRect( this.guiLeft + 179, this.guiTop, 179, 0, 32, 86 ); + + } + + /** + * Draw the foreground layer. + */ + @Override + protected void drawGuiContainerForegroundLayer( int mouseX, int mouseY ) + { + boolean noOverlay = true; + + // Draw the title + this.fontRendererObj.drawString( this.guiTitle, GuiArcaneCraftingTerminal.TITLE_POS_X, GuiArcaneCraftingTerminal.TITLE_POS_Y, 0x000000 ); + + // Draw the item widgets + for( int index = 0; index < GuiArcaneCraftingTerminal.ME_WIDGET_COUNT; index++ ) + { + // Get the widget + WidgetAEItem currentWidget = this.itemWidgets[index]; + + // Draw the widget + currentWidget.drawWidget(); + + // Is the mouse over this widget? + if( noOverlay && currentWidget.isMouseOverWidget( mouseX, mouseY ) ) + { + // Draw the overlay + currentWidget.drawMouseHoverUnderlay(); + + // Set that we have an overlay + noOverlay = false; + } + } + + } + + @Override + protected void mouseClicked( int mouseX, int mouseY, int mouseButton ) + { + // Was the click inside the ME grid? + if( GuiHelper.isPointInGuiRegion( GuiArcaneCraftingTerminal.ME_ITEM_POS_X, GuiArcaneCraftingTerminal.ME_ITEM_POS_Y, + GuiArcaneCraftingTerminal.ME_GRID_HEIGHT, GuiArcaneCraftingTerminal.ME_GRID_WIDTH, mouseX, mouseY, this.guiLeft, this.guiTop ) ) + { + // Is the player holding anything? + if( this.player.inventory.getItemStack() != null ) + { + // Inform the server the user would like to deposit the currently held item into the ME network. + new PacketServerArcaneCraftingTerminal().createDepositRequest( this.player, mouseButton ).sendPacketToServer(); + } + else + { + // Search for the widget the mouse is over, and send extract request. + this.sendItemWidgetClicked( mouseX, mouseY, mouseButton ); + } + } + else + { + // Pass to super + super.mouseClicked( mouseX, mouseY, mouseButton ); + } + } + + /** + * If the user has clicked on an item widget this will inform the server + * so that the item can be extracted from the AE network. + */ + private void sendItemWidgetClicked( int mouseX, int mouseY, int mouseButton ) + { + for( int index = 0; index < GuiArcaneCraftingTerminal.ME_WIDGET_COUNT; index++ ) + { + // Get the widget + WidgetAEItem currentWidget = this.itemWidgets[index]; + // Is the mouse over this widget + + if( currentWidget.isMouseOverWidget( mouseX, mouseY ) ) + { + // Get the AE itemstack this widget represents + IAEItemStack itemStack = currentWidget.getSingleItemStack(); + + // Did we get an item? + if( itemStack != null ) + { + // Let the server know the user is requesting an itemstack. + new PacketServerArcaneCraftingTerminal().createExtractRequest( this.player, itemStack, mouseButton ).sendPacketToServer(); + } + + // Stop searching + return; + } + } + } + + /** + * Called to update what the player is holding. + * @param heldItemstack + */ + public void onPlayerHeldReceived( IAEItemStack heldItemstack ) + { + ItemStack itemStack = null; + + // Get the stack + if( heldItemstack != null ) + { + itemStack = heldItemstack.getItemStack(); + } + + // Set what the player is holding + this.player.inventory.setItemStack( itemStack ); + } + +} diff --git a/src/main/java/thaumicenergistics/gui/GuiCellTerminalBase.java b/src/main/java/thaumicenergistics/gui/GuiCellTerminalBase.java index 438b5592..1fff2fc9 100644 --- a/src/main/java/thaumicenergistics/gui/GuiCellTerminalBase.java +++ b/src/main/java/thaumicenergistics/gui/GuiCellTerminalBase.java @@ -6,24 +6,23 @@ import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.audio.PositionedSoundRecord; import net.minecraft.client.gui.GuiTextField; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.ResourceLocation; import net.minecraft.util.StatCollector; import org.lwjgl.input.Keyboard; import org.lwjgl.input.Mouse; import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import thaumicenergistics.ThaumicEnergistics; import thaumicenergistics.aspect.AspectStack; import thaumicenergistics.container.ContainerCellTerminalBase; -import thaumicenergistics.gui.widget.AbstractAspectWidget; +import thaumicenergistics.container.IAspectSelectorContainer; +import thaumicenergistics.gui.widget.AbstractWidget; import thaumicenergistics.gui.widget.AspectWidgetComparator; import thaumicenergistics.gui.widget.IAspectSelectorGui; import thaumicenergistics.gui.widget.WidgetAspectSelector; import thaumicenergistics.texture.GuiTextureManager; -import thaumicenergistics.util.GuiHelper; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; /** * Base class for cell and terminal guis @@ -33,7 +32,7 @@ import thaumicenergistics.util.GuiHelper; */ @SideOnly(Side.CLIENT) public class GuiCellTerminalBase - extends GuiContainer + extends GuiWidgetHost implements IAspectSelectorGui { @@ -393,19 +392,17 @@ public class GuiCellTerminalBase if ( index < listSize ) { // Get the widget at this index - WidgetAspectSelector widget = this.matchingSearchWidgets.get( index ); + WidgetAspectSelector currentWidget = this.matchingSearchWidgets.get( index ); // Is the mouse over this widget? - if ( GuiHelper.isPointInGuiRegion( ( x * AbstractAspectWidget.WIDGET_SIZE ) + GuiCellTerminalBase.WIDGET_OFFSET_X, - ( y * AbstractAspectWidget.WIDGET_SIZE ) + GuiCellTerminalBase.WIDGET_OFFSET_Y, AbstractAspectWidget.WIDGET_SIZE, - AbstractAspectWidget.WIDGET_SIZE, mouseX, mouseY, this.guiLeft, this.guiTop ) ) + if( currentWidget.isMouseOverWidget( mouseX, mouseY ) ) { // Play clicky sound Minecraft.getMinecraft().getSoundHandler() .playSound( PositionedSoundRecord.func_147674_a( new ResourceLocation( "gui.button.press" ), 1.0F ) ); - // Send the click to the widget ( args ignored for WidgetAspectSelector ) - widget.mouseClicked( 0, 0, 0, 0 ); + // Send the click to the widget + currentWidget.mouseClicked(); // Stop searching return; @@ -453,13 +450,17 @@ public class GuiCellTerminalBase for( int index = startingIndex; index < endingIndex; index++ ) { + // Get the widget + WidgetAspectSelector currentWidget = this.matchingSearchWidgets.get( index ); + + // Set the position + currentWidget.setPosition( widgetPosX, widgetPosY ); + // Draw the widget - this.matchingSearchWidgets.get( index ).drawWidget( widgetPosX, widgetPosY ); + currentWidget.drawWidget(); // Is the mouse over this widget? - if ( ( widgetUnderMouse == null ) && - GuiHelper.isPointInGuiRegion( widgetPosX, widgetPosY, AbstractAspectWidget.WIDGET_SIZE, - AbstractAspectWidget.WIDGET_SIZE, mouseX, mouseY, this.guiLeft, this.guiTop ) ) + if( currentWidget.isMouseOverWidget( mouseX, mouseY ) ) { // Set the widget and its position widgetUnderMouse = this.matchingSearchWidgets.get( index ); @@ -480,12 +481,12 @@ public class GuiCellTerminalBase widgetColumnPosition = 1; // Increment y - widgetPosY += AbstractAspectWidget.WIDGET_SIZE; + widgetPosY += AbstractWidget.WIDGET_SIZE; } else { // Increment the x position - widgetPosX += AbstractAspectWidget.WIDGET_SIZE; + widgetPosX += AbstractWidget.WIDGET_SIZE; } } @@ -520,24 +521,6 @@ public class GuiCellTerminalBase return this.selectedAspectStack; } - /** - * Gets the starting X position for the Gui. - */ - @Override - public int guiLeft() - { - return this.guiLeft; - } - - /** - * Gets the starting Y position for the Gui. - */ - @Override - public int guiTop() - { - return this.guiTop; - } - /** * Sets the gui up. */ @@ -580,7 +563,7 @@ public class GuiCellTerminalBase for( AspectStack aspectStack : this.containerBase.getAspectStackList() ) { // Create the widget - this.aspectWidgets.add( new WidgetAspectSelector( this, aspectStack ) ); + this.aspectWidgets.add( new WidgetAspectSelector( this, aspectStack, 0, 0 ) ); } // Update the search results diff --git a/src/main/java/thaumicenergistics/gui/GuiEssentiaLevelEmitter.java b/src/main/java/thaumicenergistics/gui/GuiEssentiaLevelEmitter.java index 11a061c7..0e1fe506 100644 --- a/src/main/java/thaumicenergistics/gui/GuiEssentiaLevelEmitter.java +++ b/src/main/java/thaumicenergistics/gui/GuiEssentiaLevelEmitter.java @@ -3,16 +3,12 @@ package thaumicenergistics.gui; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import thaumcraft.api.aspects.Aspect; import thaumicenergistics.container.ContainerPartEssentiaLevelEmitter; -import thaumicenergistics.gui.widget.AbstractAspectWidget; import thaumicenergistics.gui.widget.DigitTextField; import thaumicenergistics.gui.widget.WidgetAspectSlot; import thaumicenergistics.gui.widget.WidgetRedstoneModes; @@ -22,8 +18,9 @@ import thaumicenergistics.parts.AEPartEssentiaLevelEmitter; import thaumicenergistics.registries.AEPartsEnum; import thaumicenergistics.texture.GuiTextureManager; import thaumicenergistics.util.EssentiaItemContainerHelper; -import thaumicenergistics.util.GuiHelper; import appeng.api.config.RedstoneMode; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; /** * Gui for the level emitter. @@ -33,7 +30,7 @@ import appeng.api.config.RedstoneMode; */ @SideOnly(Side.CLIENT) public class GuiEssentiaLevelEmitter - extends GuiContainer + extends GuiWidgetHost implements IAspectSlotGui { /** @@ -191,7 +188,7 @@ public class GuiEssentiaLevelEmitter this.part = part; // Create the filter slot - this.aspectFilterSlot = new WidgetAspectSlot( this.player, this.part, 123, 30 ); + this.aspectFilterSlot = new WidgetAspectSlot( this, this.player, this.part, 123, 30 ); new PacketEssentiaEmitter( false, this.part, this.player ).sendPacketToServer(); } @@ -259,8 +256,7 @@ public class GuiEssentiaLevelEmitter super.mouseClicked( mouseX, mouseY, mouseBtn ); // Is the mouse over the widget? - if ( GuiHelper.isPointInGuiRegion( this.aspectFilterSlot.getPosX(), this.aspectFilterSlot.getPosY(), AbstractAspectWidget.WIDGET_SIZE, - AbstractAspectWidget.WIDGET_SIZE, mouseX, mouseY, this.guiLeft, this.guiTop ) ) + if ( this.aspectFilterSlot.isMouseOverWidget( mouseX, mouseY ) ) { // Pass to the widget this.aspectFilterSlot.mouseClicked( EssentiaItemContainerHelper.getAspectInContainer( this.player.inventory.getItemStack() ) ); @@ -297,11 +293,14 @@ public class GuiEssentiaLevelEmitter this.fontRendererObj.drawString( AEPartsEnum.EssentiaLevelEmitter.getStatName(), GuiEssentiaLevelEmitter.TITLE_POS_X, GuiEssentiaLevelEmitter.TITLE_POS_Y, 0 ); + // Draw underlay when mouse is over slot. + if( this.aspectFilterSlot.isMouseOverWidget( mouseX, mouseY ) ) + { + this.aspectFilterSlot.drawMouseHoverUnderlay(); + } + // Draw the filter widget this.aspectFilterSlot.drawWidget(); - - // Draw overlay when mouse is over slot. - GuiHelper.renderOverlay( this.zLevel, this.guiLeft, this.guiTop, this.aspectFilterSlot, mouseX, mouseY ); } /** diff --git a/src/main/java/thaumicenergistics/gui/GuiEssentiaStorageBus.java b/src/main/java/thaumicenergistics/gui/GuiEssentiaStorageBus.java index 01d61ac1..23e00536 100644 --- a/src/main/java/thaumicenergistics/gui/GuiEssentiaStorageBus.java +++ b/src/main/java/thaumicenergistics/gui/GuiEssentiaStorageBus.java @@ -3,13 +3,12 @@ package thaumicenergistics.gui; import java.util.ArrayList; import java.util.List; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import org.lwjgl.opengl.GL11; import thaumcraft.api.aspects.Aspect; import thaumicenergistics.container.ContainerPartEssentiaStorageBus; -import thaumicenergistics.gui.widget.AbstractAspectWidget; +import thaumicenergistics.gui.widget.AbstractWidget; import thaumicenergistics.gui.widget.WidgetAspectSlot; import thaumicenergistics.gui.widget.WidgetRedstoneModes; import thaumicenergistics.network.IAspectSlotGui; @@ -27,7 +26,7 @@ import appeng.api.AEApi; * */ public class GuiEssentiaStorageBus - extends GuiContainer + extends GuiWidgetHost implements IAspectSlotGui { /** @@ -106,9 +105,9 @@ public class GuiEssentiaStorageBus { for( int column = 0; column < GuiEssentiaStorageBus.COLUMNS; column++ ) { - this.aspectWidgetList.add( new WidgetAspectSlot( this.player, part, ( row * GuiEssentiaStorageBus.COLUMNS ) + column, - GuiEssentiaStorageBus.WIDGET_X_POS + ( AbstractAspectWidget.WIDGET_SIZE * column ), - GuiEssentiaStorageBus.WIDGET_Y_POS + ( AbstractAspectWidget.WIDGET_SIZE * row ) ) ); + this.aspectWidgetList.add( new WidgetAspectSlot( this, this.player, part, ( row * GuiEssentiaStorageBus.COLUMNS ) + column, + GuiEssentiaStorageBus.WIDGET_X_POS + ( AbstractWidget.WIDGET_SIZE * column ), + GuiEssentiaStorageBus.WIDGET_Y_POS + ( AbstractWidget.WIDGET_SIZE * row ) ) ); } } @@ -154,16 +153,20 @@ public class GuiEssentiaStorageBus { super.drawGuiContainerForegroundLayer( mouseX, mouseY ); - boolean overlayRendered = false; + boolean hoverUnderlayRendered = false; for( int i = 0; i < 54; i++ ) { - this.aspectWidgetList.get( i ).drawWidget(); + WidgetAspectSlot currentWidget = this.aspectWidgetList.get( i ); - if ( ( !overlayRendered ) && ( this.aspectWidgetList.get( i ).canRender() ) ) + if ( ( !hoverUnderlayRendered ) && ( currentWidget.canRender() ) && ( currentWidget.isMouseOverWidget( mouseX, mouseY ) ) ) { - overlayRendered = GuiHelper.renderOverlay( this.zLevel, this.guiLeft, this.guiTop, this.aspectWidgetList.get( i ), mouseX, mouseY ); + currentWidget.drawMouseHoverUnderlay(); + + hoverUnderlayRendered = true; } + + currentWidget.drawWidget(); } for( Object button : this.buttonList ) @@ -204,7 +207,7 @@ public class GuiEssentiaStorageBus for( WidgetAspectSlot aspectSlot : this.aspectWidgetList ) { - if ( GuiHelper.isPointInGuiRegion( aspectSlot.getPosX(), aspectSlot.getPosY(), 18, 18, mouseX, mouseY, this.guiLeft, this.guiTop ) ) + if ( aspectSlot.isMouseOverWidget( mouseX, mouseY ) ) { // Get the aspect of the currently held item Aspect itemAspect = EssentiaItemContainerHelper.getAspectInContainer( this.player.inventory.getItemStack() ); diff --git a/src/main/java/thaumicenergistics/gui/GuiEssentiatIO.java b/src/main/java/thaumicenergistics/gui/GuiEssentiatIO.java index 4a8e4fb3..a87d1509 100644 --- a/src/main/java/thaumicenergistics/gui/GuiEssentiatIO.java +++ b/src/main/java/thaumicenergistics/gui/GuiEssentiatIO.java @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.List; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Slot; import org.lwjgl.opengl.GL11; @@ -25,7 +24,7 @@ import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class GuiEssentiatIO - extends GuiContainer + extends GuiWidgetHost implements WidgetAspectSlot.IConfigurable, IAspectSlotGui { private AEPartEssentiaIO part; @@ -43,15 +42,15 @@ public class GuiEssentiatIO this.part = terminal; this.player = player; - this.aspectSlotList.add( new WidgetAspectSlot( this.player, this.part, 0, 61, 21, this, (byte)2 ) ); - this.aspectSlotList.add( new WidgetAspectSlot( this.player, this.part, 1, 79, 21, this, (byte)1 ) ); - this.aspectSlotList.add( new WidgetAspectSlot( this.player, this.part, 2, 97, 21, this, (byte)2 ) ); - this.aspectSlotList.add( new WidgetAspectSlot( this.player, this.part, 3, 61, 39, this, (byte)1 ) ); - this.aspectSlotList.add( new WidgetAspectSlot( this.player, this.part, 4, 79, 39, this, (byte)0 ) ); - this.aspectSlotList.add( new WidgetAspectSlot( this.player, this.part, 5, 97, 39, this, (byte)1 ) ); - this.aspectSlotList.add( new WidgetAspectSlot( this.player, this.part, 6, 61, 57, this, (byte)2 ) ); - this.aspectSlotList.add( new WidgetAspectSlot( this.player, this.part, 7, 79, 57, this, (byte)1 ) ); - this.aspectSlotList.add( new WidgetAspectSlot( this.player, this.part, 8, 97, 57, this, (byte)2 ) ); + this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, 0, 61, 21, this, (byte)2 ) ); + this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, 1, 79, 21, this, (byte)1 ) ); + this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, 2, 97, 21, this, (byte)2 ) ); + this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, 3, 61, 39, this, (byte)1 ) ); + this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, 4, 79, 39, this, (byte)0 ) ); + this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, 5, 97, 39, this, (byte)1 ) ); + this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, 6, 61, 57, this, (byte)2 ) ); + this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, 7, 79, 57, this, (byte)1 ) ); + this.aspectSlotList.add( new WidgetAspectSlot( this, this.player, this.part, 8, 97, 57, this, (byte)2 ) ); new PacketEssentiaIOBus( this.player, this.part ).sendPacketToServer(); @@ -117,7 +116,7 @@ public class GuiEssentiatIO for( WidgetAspectSlot aspectSlot : this.aspectSlotList ) { - if ( GuiHelper.isPointInGuiRegion( aspectSlot.getPosX(), aspectSlot.getPosY(), 18, 18, mouseX, mouseY, this.guiLeft, this.guiTop ) ) + if ( aspectSlot.isMouseOverWidget( mouseX, mouseY ) ) { // Get the aspect of the currently held item Aspect itemAspect = EssentiaItemContainerHelper.getAspectInContainer( this.player.inventory.getItemStack() ); @@ -173,7 +172,7 @@ public class GuiEssentiatIO { super.drawGuiContainerForegroundLayer( mouseX, mouseY ); - boolean overlayRendered = false; + boolean hoverUnderlayRendered = false; WidgetAspectSlot slotUnderMouse = null; @@ -181,17 +180,16 @@ public class GuiEssentiatIO { WidgetAspectSlot slotWidget = this.aspectSlotList.get( i ); - slotWidget.drawWidget(); - - if ( ( !overlayRendered ) && ( slotWidget.canRender() ) ) + if ( ( !hoverUnderlayRendered ) && ( slotWidget.canRender() ) && ( slotWidget.isMouseOverWidget( mouseX, mouseY ) ) ) { - overlayRendered = this.renderOverlay( slotWidget, mouseX, mouseY ); - - if ( overlayRendered ) - { - slotUnderMouse = slotWidget; - } + slotWidget.drawMouseHoverUnderlay(); + + slotUnderMouse = slotWidget; + + hoverUnderlayRendered = true; } + + slotWidget.drawWidget(); } if ( slotUnderMouse != null ) @@ -216,26 +214,6 @@ public class GuiEssentiatIO return this.filterSize; } - public boolean renderOverlay( WidgetAspectSlot aspectSlot, int mouseX, int mouseY ) - { - if ( GuiHelper.isPointInGuiRegion( aspectSlot.getPosX(), aspectSlot.getPosY(), 18, 18, mouseX, mouseY, this.guiLeft, this.guiTop ) ) - { - GL11.glDisable( GL11.GL_LIGHTING ); - - GL11.glDisable( GL11.GL_DEPTH_TEST ); - - this.drawGradientRect( aspectSlot.getPosX() + 1, aspectSlot.getPosY() + 1, aspectSlot.getPosX() + 17, aspectSlot.getPosY() + 17, - -2130706433, -2130706433 ); - - GL11.glEnable( GL11.GL_LIGHTING ); - - GL11.glEnable( GL11.GL_DEPTH_TEST ); - - return true; - } - return false; - } - public void setRedstoneControlled( boolean redstoneControled ) { this.redstoneControlled = redstoneControled; diff --git a/src/main/java/thaumicenergistics/gui/GuiWidgetHost.java b/src/main/java/thaumicenergistics/gui/GuiWidgetHost.java new file mode 100644 index 00000000..b4bbaca6 --- /dev/null +++ b/src/main/java/thaumicenergistics/gui/GuiWidgetHost.java @@ -0,0 +1,35 @@ +package thaumicenergistics.gui; + +import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.inventory.Container; +import thaumicenergistics.gui.widget.IWidgetHost; + +public abstract class GuiWidgetHost + extends GuiContainer + implements IWidgetHost +{ + + public GuiWidgetHost( Container container ) + { + super( container ); + } + + /** + * Gets the starting X position for the Gui. + */ + @Override + public final int guiLeft() + { + return this.guiLeft; + } + + /** + * Gets the starting Y position for the Gui. + */ + @Override + public final int guiTop() + { + return this.guiTop; + } + +} diff --git a/src/main/java/thaumicenergistics/gui/widget/AbstractAspectWidget.java b/src/main/java/thaumicenergistics/gui/widget/AbstractAspectWidget.java index 24ca6bbb..3e58e374 100644 --- a/src/main/java/thaumicenergistics/gui/widget/AbstractAspectWidget.java +++ b/src/main/java/thaumicenergistics/gui/widget/AbstractAspectWidget.java @@ -1,114 +1,36 @@ package thaumicenergistics.gui.widget; -import java.util.List; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.RenderHelper; -import org.lwjgl.opengl.GL11; import thaumcraft.api.aspects.Aspect; -import thaumicenergistics.util.GuiHelper; -public abstract class AbstractAspectWidget extends Gui +public abstract class AbstractAspectWidget + extends AbstractWidget { - /** - * The width and height of the aspect - */ - public static int WIDGET_SIZE = 18; - protected IAspectWidgetGui selectorGui; protected Aspect aspect; - protected int width = 0; - protected int height = 0; - public AbstractAspectWidget(IAspectWidgetGui selectorGui, int height, int width, Aspect aspect) + public AbstractAspectWidget( IWidgetHost hostGui, Aspect aspect, int xPos, int yPos ) { - this.selectorGui = selectorGui; + super( hostGui, xPos, yPos ); + this.aspect = aspect; - this.width = width; - this.height = height; } - - protected void drawHoveringText( List list, int x, int y, FontRenderer fontrenderer ) - { - if ( !list.isEmpty() ) - { - GL11.glDisable( 32826 ); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable( 2896 ); - GL11.glDisable( 2929 ); - - int maxStringLength = 0; - - for( Object string : list ) - { - String s = (String) string; - int stringLen = fontrenderer.getStringWidth( s ); - if ( stringLen > maxStringLength ) - { - maxStringLength = stringLen; - } - } - - int i1 = x + 12; - int j1 = y - 12; - int k1 = 8; - - if ( list.size() > 1 ) - { - k1 += 2 + ( ( list.size() - 1 ) * 10 ); - } - - this.zLevel = 300.0F; - - int l1 = -267386864; - this.drawGradientRect( i1 - 3, j1 - 4, i1 + maxStringLength + 3, j1 - 3, l1, l1 ); - this.drawGradientRect( i1 - 3, j1 + k1 + 3, i1 + maxStringLength + 3, j1 + k1 + 4, l1, l1 ); - this.drawGradientRect( i1 - 3, j1 - 3, i1 + maxStringLength + 3, j1 + k1 + 3, l1, l1 ); - this.drawGradientRect( i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1 ); - this.drawGradientRect( i1 + maxStringLength + 3, j1 - 3, i1 + maxStringLength + 4, j1 + k1 + 3, l1, l1 ); - int i2 = 0x505000FF; - int j2 = ( ( i2 & 0xFEFEFE ) >> 1 ) | ( i2 & 0xFF000000 ); - this.drawGradientRect( i1 - 3, ( j1 - 3 ) + 1, ( i1 - 3 ) + 1, ( j1 + k1 + 3 ) - 1, i2, j2 ); - this.drawGradientRect( i1 + maxStringLength + 2, ( j1 - 3 ) + 1, i1 + maxStringLength + 3, ( j1 + k1 + 3 ) - 1, i2, j2 ); - this.drawGradientRect( i1 - 3, j1 - 3, i1 + maxStringLength + 3, ( j1 - 3 ) + 1, i2, i2 ); - this.drawGradientRect( i1 - 3, j1 + k1 + 2, i1 + maxStringLength + 3, j1 + k1 + 3, j2, j2 ); - for( int k2 = 0; k2 < list.size(); k2++ ) - { - String s1 = (String) list.get( k2 ); - fontrenderer.drawStringWithShadow( s1, i1, j1, -1 ); - if ( k2 == 0 ) - { - j1 += 2; - } - j1 += 10; - } - this.zLevel = 0.0F; - GL11.glEnable( 2896 ); - GL11.glEnable( 2929 ); - RenderHelper.enableStandardItemLighting(); - GL11.glEnable( 32826 ); - } - } - - protected boolean isPointInRegion( int top, int left, int height, int width, int pointX, int pointY ) - { - return GuiHelper.isPointInGuiRegion( top, left, height, width, pointX, pointY, this.selectorGui.guiLeft(), - this.selectorGui.guiTop() ); - } - - public abstract boolean drawTooltip( int posX, int posY, int mouseX, int mouseY ); - - public abstract void drawWidget( int posX, int posY ); - + public Aspect getAspect() { return this.aspect; } + - public abstract void mouseClicked( int posX, int posY, int mouseX, int mouseY ); - + /* public void setAspect( String aspectTag ) { this.aspect = Aspect.aspects.get( aspectTag ); } + */ + + + public void setAspect( Aspect aspect ) + { + this.aspect = aspect; + } } diff --git a/src/main/java/thaumicenergistics/gui/widget/AbstractWidget.java b/src/main/java/thaumicenergistics/gui/widget/AbstractWidget.java new file mode 100644 index 00000000..0f9eb04f --- /dev/null +++ b/src/main/java/thaumicenergistics/gui/widget/AbstractWidget.java @@ -0,0 +1,150 @@ +package thaumicenergistics.gui.widget; + +import java.util.List; +import org.lwjgl.opengl.GL11; +import thaumicenergistics.util.GuiHelper; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.gui.Gui; +import net.minecraft.client.renderer.RenderHelper; + +public abstract class AbstractWidget + extends Gui +{ + private static int GL_RESCALE_NORMAL = 0x803A; + + /** + * The width and height of the aspect + */ + public static int WIDGET_SIZE = 18; + + protected int xPosition; + + protected int yPosition; + + protected IWidgetHost hostGUI; + + public AbstractWidget( IWidgetHost hostGUI, int xPos, int yPos ) + { + this.hostGUI = hostGUI; + + this.xPosition = xPos; + + this.yPosition = yPos; + } + + public void setPosition( int xPos, int yPos ) + { + this.xPosition = xPos; + this.yPosition = yPos; + } + + // This is a mess... + protected void drawHoveringText( List descriptionLines, int posX, int posY, FontRenderer fontrenderer ) + { + if( !descriptionLines.isEmpty() ) + { + GL11.glDisable( GL_RESCALE_NORMAL ); + + RenderHelper.disableStandardItemLighting(); + + GL11.glDisable( GL11.GL_LIGHTING ); + + GL11.glDisable( GL11.GL_DEPTH_TEST ); + + int maxStringLength = 0; + + for( String string : descriptionLines ) + { + + int stringLen = fontrenderer.getStringWidth( string ); + + if( stringLen > maxStringLength ) + { + maxStringLength = stringLen; + } + } + + int offsetX = posX + 12; + + int offsetY = posY - 12; + + int tooltipHeight = 8; + + if( descriptionLines.size() > 1 ) + { + tooltipHeight += 2 + ( ( descriptionLines.size() - 1 ) * 10 ); + } + + this.zLevel = 300.0F; + + int drawColor = 0xF0100010; + this.drawGradientRect( offsetX - 3, offsetY - 4, offsetX + maxStringLength + 3, offsetY - 3, drawColor, drawColor ); + this.drawGradientRect( offsetX - 3, offsetY + tooltipHeight + 3, offsetX + maxStringLength + 3, offsetY + tooltipHeight + 4, drawColor, + drawColor ); + this.drawGradientRect( offsetX - 3, offsetY - 3, offsetX + maxStringLength + 3, offsetY + tooltipHeight + 3, drawColor, drawColor ); + this.drawGradientRect( offsetX - 4, offsetY - 3, offsetX - 3, offsetY + tooltipHeight + 3, drawColor, drawColor ); + this.drawGradientRect( offsetX + maxStringLength + 3, offsetY - 3, offsetX + maxStringLength + 4, offsetY + tooltipHeight + 3, drawColor, + drawColor ); + + drawColor = 0x505000FF; + int fadeColor = ( ( drawColor & 0xFEFEFE ) >> 1 ) | ( drawColor & 0xFF000000 ); + this.drawGradientRect( offsetX - 3, ( offsetY - 3 ) + 1, ( offsetX - 3 ) + 1, ( offsetY + tooltipHeight + 3 ) - 1, drawColor, fadeColor ); + this.drawGradientRect( offsetX + maxStringLength + 2, ( offsetY - 3 ) + 1, offsetX + maxStringLength + 3, + ( offsetY + tooltipHeight + 3 ) - 1, drawColor, fadeColor ); + this.drawGradientRect( offsetX - 3, offsetY - 3, offsetX + maxStringLength + 3, ( offsetY - 3 ) + 1, drawColor, drawColor ); + this.drawGradientRect( offsetX - 3, offsetY + tooltipHeight + 2, offsetX + maxStringLength + 3, offsetY + tooltipHeight + 3, fadeColor, + fadeColor ); + + for( int descriptionIndex = 0; descriptionIndex < descriptionLines.size(); descriptionIndex++ ) + { + String s1 = descriptionLines.get( descriptionIndex ); + fontrenderer.drawStringWithShadow( s1, offsetX, offsetY, -1 ); + if( descriptionIndex == 0 ) + { + offsetY += 2; + } + offsetY += 10; + } + this.zLevel = 0.0F; + + GL11.glEnable( GL11.GL_LIGHTING ); + + GL11.glEnable( GL11.GL_DEPTH_TEST ); + + RenderHelper.enableStandardItemLighting(); + + GL11.glEnable( GL_RESCALE_NORMAL ); + } + } + + public void drawMouseHoverUnderlay( int offsetX, int offsetY ) + { + GL11.glDisable( GL11.GL_LIGHTING ); + + GL11.glDisable( GL11.GL_DEPTH_TEST ); + + this.drawGradientRect( this.xPosition + offsetX, this.yPosition + offsetX, this.xPosition + 17, this.yPosition + 17, 0x80FFFFFF, 0x80FFFFFF ); + + GL11.glEnable( GL11.GL_LIGHTING ); + + GL11.glEnable( GL11.GL_DEPTH_TEST ); + } + + public void drawMouseHoverUnderlay() + { + this.drawMouseHoverUnderlay( 1, 1 ); + } + + public boolean isMouseOverWidget( int mouseX, int mouseY ) + { + return GuiHelper.isPointInGuiRegion( this.xPosition, this.yPosition, AbstractWidget.WIDGET_SIZE, AbstractWidget.WIDGET_SIZE, mouseX, mouseY, + this.hostGUI.guiLeft(), this.hostGUI.guiTop() ); + } + + public abstract boolean drawTooltip( int posX, int posY, int mouseX, int mouseY ); + + public abstract void drawWidget(); + + public abstract void mouseClicked(); + +} diff --git a/src/main/java/thaumicenergistics/gui/widget/IAspectSelectorGui.java b/src/main/java/thaumicenergistics/gui/widget/IAspectSelectorGui.java index 98ddb9a3..340dd36b 100644 --- a/src/main/java/thaumicenergistics/gui/widget/IAspectSelectorGui.java +++ b/src/main/java/thaumicenergistics/gui/widget/IAspectSelectorGui.java @@ -1,9 +1,9 @@ package thaumicenergistics.gui.widget; import thaumicenergistics.aspect.AspectStack; -import thaumicenergistics.gui.IAspectSelectorContainer; +import thaumicenergistics.container.IAspectSelectorContainer; -public interface IAspectSelectorGui extends IAspectWidgetGui +public interface IAspectSelectorGui extends IWidgetHost { public IAspectSelectorContainer getContainer(); diff --git a/src/main/java/thaumicenergistics/gui/widget/IAspectWidgetGui.java b/src/main/java/thaumicenergistics/gui/widget/IAspectWidgetGui.java deleted file mode 100644 index 60221e43..00000000 --- a/src/main/java/thaumicenergistics/gui/widget/IAspectWidgetGui.java +++ /dev/null @@ -1,8 +0,0 @@ -package thaumicenergistics.gui.widget; - -public abstract interface IAspectWidgetGui -{ - public abstract int guiLeft(); - - public abstract int guiTop(); -} diff --git a/src/main/java/thaumicenergistics/gui/widget/IWidgetHost.java b/src/main/java/thaumicenergistics/gui/widget/IWidgetHost.java new file mode 100644 index 00000000..9ec338d3 --- /dev/null +++ b/src/main/java/thaumicenergistics/gui/widget/IWidgetHost.java @@ -0,0 +1,8 @@ +package thaumicenergistics.gui.widget; + +public interface IWidgetHost +{ + public int guiLeft(); + + public int guiTop(); +} diff --git a/src/main/java/thaumicenergistics/gui/widget/WidgetAEItem.java b/src/main/java/thaumicenergistics/gui/widget/WidgetAEItem.java new file mode 100644 index 00000000..77fa8965 --- /dev/null +++ b/src/main/java/thaumicenergistics/gui/widget/WidgetAEItem.java @@ -0,0 +1,119 @@ +package thaumicenergistics.gui.widget; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.FontRenderer; +import net.minecraft.client.renderer.texture.TextureManager; +import appeng.api.storage.data.IAEItemStack; +import appeng.client.render.AppEngRenderItem; + +public class WidgetAEItem + extends AbstractWidget +{ + /** + * Cache of the minecraft font renderer + */ + private static final FontRenderer FONT_RENDERER = Minecraft.getMinecraft().fontRenderer; + + /** + * Cache of the minecraft texture manager + */ + private static final TextureManager TEXTURE_MANAGER = Minecraft.getMinecraft().getTextureManager(); + + /** + * Cache of the AE item renderer + */ + private final AppEngRenderItem aeItemRenderer; + + /** + * The itemstack this widget represents + */ + private IAEItemStack aeItemStack; + + /** + * Creates the widget + * + * @param hostGUI + * @param xPos + * @param yPos + * @param aeItemRenderer + */ + public WidgetAEItem( IWidgetHost hostGUI, int xPos, int yPos, AppEngRenderItem aeItemRenderer ) + { + super( hostGUI, xPos, yPos ); + + this.aeItemRenderer = aeItemRenderer; + } + + /** + * Set the itemstack this widget represents + * + * @param itemStack + */ + public void setItemStack( IAEItemStack itemStack ) + { + this.aeItemStack = itemStack; + } + + @Override + public boolean drawTooltip( int posX, int posY, int mouseX, int mouseY ) + { + // TODO No tooltips yet + return false; + } + + /** + * Draws the itemstack if there is one. + */ + @Override + public void drawWidget() + { + if( this.aeItemStack != null ) + { + // Set the z level + this.zLevel = 2.0F; + this.aeItemRenderer.zLevel = 2.0F; + + // Set the item + this.aeItemRenderer.aestack = this.aeItemStack; + + // Draw the item + this.aeItemRenderer.renderItemAndEffectIntoGUI( WidgetAEItem.FONT_RENDERER, WidgetAEItem.TEXTURE_MANAGER, this.aeItemStack.getItemStack(), + this.xPosition + 1, this.yPosition + 1 ); + + // Draw the amount + this.aeItemRenderer.renderItemOverlayIntoGUI( WidgetAEItem.FONT_RENDERER, WidgetAEItem.TEXTURE_MANAGER, this.aeItemStack.getItemStack(), + this.xPosition + 1, this.yPosition + 1 ); + + // Reset the z level + this.zLevel = 0.0F; + this.aeItemRenderer.zLevel = 0.0F; + } + + } + + @Override + public void mouseClicked() + { + // Unused + } + + public IAEItemStack getSingleItemStack() + { + // Do we have an AE itemstack? + if( this.aeItemStack != null ) + { + // Create a new stack + IAEItemStack itemStack = this.aeItemStack.copy(); + + // Set size to one + itemStack.setStackSize( 1 ); + + // Return it + return itemStack; + + } + + return null; + } + +} diff --git a/src/main/java/thaumicenergistics/gui/widget/WidgetAspectSelector.java b/src/main/java/thaumicenergistics/gui/widget/WidgetAspectSelector.java index 5e207be3..03811ca0 100644 --- a/src/main/java/thaumicenergistics/gui/widget/WidgetAspectSelector.java +++ b/src/main/java/thaumicenergistics/gui/widget/WidgetAspectSelector.java @@ -17,9 +17,9 @@ public class WidgetAspectSelector private int color; private int borderThickness; - public WidgetAspectSelector(IAspectSelectorGui selectorGui, AspectStack stack) + public WidgetAspectSelector( IAspectSelectorGui selectorGui, AspectStack stack, int xPos, int yPos ) { - super( selectorGui, AbstractAspectWidget.WIDGET_SIZE, AbstractAspectWidget.WIDGET_SIZE, stack.aspect ); + super( selectorGui, stack.aspect, xPos, yPos ); this.amount = stack.amount; @@ -44,7 +44,7 @@ public class WidgetAspectSelector @Override public boolean drawTooltip( int posX, int posY, int mouseX, int mouseY ) { - if ( ( this.aspect == null ) || ( this.amount <= 0L ) ) + if( ( this.aspect == null ) || ( this.amount <= 0L ) ) { return false; } @@ -57,37 +57,42 @@ public class WidgetAspectSelector description.add( amountToText ); - this.drawHoveringText( description, mouseX - this.selectorGui.guiLeft(), mouseY - this.selectorGui.guiTop(), - Minecraft.getMinecraft().fontRenderer ); + this.drawHoveringText( description, mouseX - this.hostGUI.guiLeft(), mouseY - this.hostGUI.guiTop(), Minecraft.getMinecraft().fontRenderer ); return true; } @Override - public void drawWidget( int posX, int posY ) + public void drawWidget() { Minecraft.getMinecraft().renderEngine.bindTexture( TextureMap.locationBlocksTexture ); - GL11.glDisable( 2896 ); - GL11.glEnable( 3042 ); + GL11.glDisable( GL11.GL_LIGHTING ); + + GL11.glEnable( GL11.GL_BLEND ); + GL11.glBlendFunc( 770, 771 ); + GL11.glColor3f( 1.0F, 1.0F, 1.0F ); - AspectStack terminalFluid = ( (IAspectSelectorGui) this.selectorGui ).getSelectedAspect(); - - Aspect currentAspect = terminalFluid != null ? terminalFluid.aspect : null; - - if ( this.aspect != null ) + if( this.aspect != null ) { - UtilsFX.drawTag( posX + 1, posY + 1, this.aspect, 0, 0, this.zLevel ); - } - if ( this.aspect == currentAspect ) - { - this.drawHollowRectWithCorners( posX, posY, this.height, this.width, this.color, this.borderThickness ); + UtilsFX.drawTag( this.xPosition + 1, this.yPosition + 1, this.aspect, 0, 0, this.zLevel ); + + AspectStack terminalFluid = ( (IAspectSelectorGui)this.hostGUI ).getSelectedAspect(); + + Aspect currentAspect = terminalFluid != null ? terminalFluid.aspect : null; + + if( this.aspect == currentAspect ) + { + this.drawHollowRectWithCorners( this.xPosition, this.yPosition, AbstractWidget.WIDGET_SIZE, AbstractWidget.WIDGET_SIZE, this.color, + this.borderThickness ); + } } - GL11.glEnable( 2896 ); - GL11.glDisable( 3042 ); + GL11.glEnable( GL11.GL_LIGHTING ); + + GL11.glDisable( GL11.GL_BLEND ); } public long getAmount() @@ -96,11 +101,11 @@ public class WidgetAspectSelector } @Override - public void mouseClicked( int posX, int posY, int mouseX, int mouseY ) + public void mouseClicked() { - if ( this.aspect != null ) + if( this.aspect != null ) { - ( (IAspectSelectorGui) this.selectorGui ).getContainer().setSelectedAspect( this.aspect ); + ( (IAspectSelectorGui)this.hostGUI ).getContainer().setSelectedAspect( this.aspect ); } } diff --git a/src/main/java/thaumicenergistics/gui/widget/WidgetAspectSlot.java b/src/main/java/thaumicenergistics/gui/widget/WidgetAspectSlot.java index c7fc11e1..3c3b148e 100644 --- a/src/main/java/thaumicenergistics/gui/widget/WidgetAspectSlot.java +++ b/src/main/java/thaumicenergistics/gui/widget/WidgetAspectSlot.java @@ -3,19 +3,14 @@ package thaumicenergistics.gui.widget; import java.util.ArrayList; import java.util.List; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.player.EntityPlayer; import org.lwjgl.opengl.GL11; import thaumcraft.api.aspects.Aspect; import thaumcraft.client.lib.UtilsFX; import thaumicenergistics.network.IAspectSlotPart; import thaumicenergistics.network.packet.PacketAspectSlot; -import thaumicenergistics.texture.GuiTextureManager; -public class WidgetAspectSlot extends Gui +public class WidgetAspectSlot extends AbstractAspectWidget { public static interface IConfigurable { @@ -23,100 +18,34 @@ public class WidgetAspectSlot extends Gui } private int id; - private int posX; - private int posY; - private Aspect aspect; private IAspectSlotPart part; private EntityPlayer player; private IConfigurable configurable; private byte configOption; - public WidgetAspectSlot(EntityPlayer player, IAspectSlotPart part, int posX, int posY) + + public WidgetAspectSlot(IWidgetHost hostGui, EntityPlayer player, IAspectSlotPart part, int posX, int posY) { - this( player, part, 0, posX, posY, null, (byte) 0 ); + this( hostGui, player, part, 0, posX, posY, null, (byte) 0 ); } - public WidgetAspectSlot(EntityPlayer player, IAspectSlotPart part, int id, int posX, int posY) + public WidgetAspectSlot(IWidgetHost hostGui, EntityPlayer player, IAspectSlotPart part, int id, int posX, int posY) { - this( player, part, id, posX, posY, null, (byte) 0 ); + this( hostGui, player, part, id, posX, posY, null, (byte) 0 ); } + - public WidgetAspectSlot(EntityPlayer player, IAspectSlotPart part, int id, int posX, int posY, IConfigurable configurable, byte configOption) + public WidgetAspectSlot(IWidgetHost hostGui, EntityPlayer player, IAspectSlotPart part, int id, int posX, int posY, IConfigurable configurable, byte configOption) { + super( hostGui, null, posX, posY ); this.player = player; this.part = part; this.id = id; - this.posX = posX; - this.posY = posY; this.configurable = configurable; this.configOption = configOption; } - protected void drawHoveringText( List list, int x, int y, FontRenderer fontrenderer ) - { - boolean lighting_enabled = GL11.glIsEnabled( 2896 ); - - if ( !list.isEmpty() ) - { - GL11.glDisable( 32826 ); - RenderHelper.disableStandardItemLighting(); - GL11.glDisable( 2896 ); - GL11.glDisable( 2929 ); - int k = 0; - for( Object string : list ) - { - String s = (String) string; - int l = fontrenderer.getStringWidth( s ); - if ( l > k ) - { - k = l; - } - } - - int i1 = x + 12; - int j1 = y - 12; - int k1 = 8; - if ( list.size() > 1 ) - { - k1 += 2 + ( ( list.size() - 1 ) * 10 ); - } - this.zLevel = 300.0F; - int l1 = -267386864; - this.drawGradientRect( i1 - 3, j1 - 4, i1 + k + 3, j1 - 3, l1, l1 ); - this.drawGradientRect( i1 - 3, j1 + k1 + 3, i1 + k + 3, j1 + k1 + 4, l1, l1 ); - this.drawGradientRect( i1 - 3, j1 - 3, i1 + k + 3, j1 + k1 + 3, l1, l1 ); - this.drawGradientRect( i1 - 4, j1 - 3, i1 - 3, j1 + k1 + 3, l1, l1 ); - this.drawGradientRect( i1 + k + 3, j1 - 3, i1 + k + 4, j1 + k1 + 3, l1, l1 ); - - int i2 = 1347420415; - int j2 = ( ( i2 & 0xFEFEFE ) >> 1 ) | ( i2 & 0xFF000000 ); - this.drawGradientRect( i1 - 3, ( j1 - 3 ) + 1, ( i1 - 3 ) + 1, ( j1 + k1 + 3 ) - 1, i2, j2 ); - this.drawGradientRect( i1 + k + 2, ( j1 - 3 ) + 1, i1 + k + 3, ( j1 + k1 + 3 ) - 1, i2, j2 ); - this.drawGradientRect( i1 - 3, j1 - 3, i1 + k + 3, ( j1 - 3 ) + 1, i2, i2 ); - this.drawGradientRect( i1 - 3, j1 + k1 + 2, i1 + k + 3, j1 + k1 + 3, j2, j2 ); - for( int k2 = 0; k2 < list.size(); k2++ ) - { - String s1 = list.get( k2 ); - fontrenderer.drawStringWithShadow( s1, i1, j1, -1 ); - if ( k2 == 0 ) - { - j1 += 2; - } - j1 += 10; - } - - this.zLevel = 0.0F; - if ( lighting_enabled ) - { - GL11.glEnable( 2896 ); - } - GL11.glEnable( 2929 ); - RenderHelper.enableStandardItemLighting(); - GL11.glEnable( 32826 ); - } - } - public boolean canRender() { return ( this.configurable == null ) || ( this.configurable.getConfigState() >= this.configOption ); @@ -135,49 +64,27 @@ public class WidgetAspectSlot extends Gui } } + @Override public void drawWidget() { - if ( this.canRender() ) + if ( ( this.aspect != null ) && this.canRender() ) { - GL11.glDisable( 2896 ); - GL11.glEnable( 3042 ); + GL11.glDisable( GL11.GL_LIGHTING ); + + GL11.glEnable( GL11.GL_BLEND ); + GL11.glBlendFunc( 770, 771 ); + GL11.glColor3f( 1.0F, 1.0F, 1.0F ); - GL11.glDisable( 2896 ); - GL11.glColor3f( 1.0F, 1.0F, 1.0F ); - Minecraft.getMinecraft().renderEngine.bindTexture( GuiTextureManager.ESSENTIA_IO_BUS.getTexture() ); - this.drawTexturedModalRect( this.posX, this.posY, 79, 39, 18, 18 ); - GL11.glEnable( 2896 ); - if ( this.aspect != null ) - { - Minecraft.getMinecraft().renderEngine.bindTexture( TextureMap.locationBlocksTexture ); - GL11.glDisable( 2896 ); - GL11.glColor3f( 1.0F, 1.0F, 1.0F ); - - UtilsFX.drawTag( this.posX + 1, this.posY + 1, this.aspect, 0, 0, this.zLevel ); - - GL11.glEnable( 2896 ); - GL11.glDisable( 3042 ); - } + UtilsFX.drawTag( this.xPosition + 1, this.yPosition + 1, this.aspect, 0, 0, this.zLevel ); + + GL11.glEnable( GL11.GL_LIGHTING ); + + GL11.glDisable( GL11.GL_BLEND ); } } - public Aspect getAspect() - { - return this.aspect; - } - - public int getPosX() - { - return this.posX; - } - - public int getPosY() - { - return this.posY; - } - public void mouseClicked( Aspect withAspect ) { this.aspect = withAspect; @@ -185,8 +92,16 @@ public class WidgetAspectSlot extends Gui new PacketAspectSlot( this.part, this.id, this.aspect, this.player ).sendPacketToServer(); } - public void setAspect( Aspect aspect ) + @Override + public boolean drawTooltip( int posX, int posY, int mouseX, int mouseY ) { - this.aspect = aspect; + // Ignored + return false; + } + + @Override + public void mouseClicked() + { + // Ignored } } diff --git a/src/main/java/thaumicenergistics/network/AbstractPacket.java b/src/main/java/thaumicenergistics/network/AbstractPacket.java index 061e692a..088e01c8 100644 --- a/src/main/java/thaumicenergistics/network/AbstractPacket.java +++ b/src/main/java/thaumicenergistics/network/AbstractPacket.java @@ -1,6 +1,12 @@ package thaumicenergistics.network; import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; @@ -10,39 +16,129 @@ import net.minecraftforge.common.util.ForgeDirection; import thaumcraft.api.aspects.Aspect; import thaumicenergistics.parts.AEPartBase; import appeng.api.parts.IPartHost; +import appeng.api.storage.data.IAEItemStack; +import appeng.util.item.AEItemStack; import com.google.common.base.Charsets; import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.network.simpleimpl.IMessage; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -public abstract class AbstractPacket implements IMessage +public abstract class AbstractPacket + implements IMessage { + /** + * Starting size of buffers compressed buffers, 1 Megabyte + */ + private static final int COMPRESSED_BUFFER_SIZE = 1048576; + + /** + * Player entity + */ + public EntityPlayer player; + + /** + * Used by subclasses to distinguish what's in the stream. + */ + public byte mode; + + /** + * If true will compress subclass data streams. + */ + public boolean useCompression; + + /** + * Creates an empty packet (called from the netty core) + */ + public AbstractPacket() + { + this.player = null; + this.mode = -1; + this.useCompression = false; + } + + /** + * Creates the packet with the specified player. + * + * @param player + */ + public AbstractPacket( EntityPlayer player ) + { + this.player = player; + this.mode = -1; + this.useCompression = false; + } + + /** + * Gets the loaded world on the client side. + * + * @return + */ @SideOnly(Side.CLIENT) public static World getClientWorld() { return Minecraft.getMinecraft().theWorld; } + /** + * Reads a Thaumcraft aspect from the stream. + * + * @param stream + * @return + */ public static Aspect readAspect( ByteBuf stream ) { return Aspect.aspects.get( readString( stream ) ); } + /** + * Reads an AE part from the stream. + * + * @param stream + * @return + */ public static AEPartBase readPart( ByteBuf stream ) { ForgeDirection side = ForgeDirection.getOrientation( stream.readInt() ); - IPartHost host = (IPartHost) AbstractPacket.readTileEntity( stream ); + IPartHost host = (IPartHost)AbstractPacket.readTileEntity( stream ); - return (AEPartBase) host.getPart( side ); + return (AEPartBase)host.getPart( side ); } + /** + * Reads an AE itemstack from the stream. + * @param stream + * @return + */ + public static IAEItemStack readAEItemStack( ByteBuf stream ) + { + IAEItemStack itemStack; + try + { + itemStack = AEItemStack.loadItemStackFromPacket( stream ); + + return itemStack; + } + catch( IOException e ) + { + } + + return null; + + } + + /** + * Reads a player entity from the stream. + * + * @param stream + * @return + */ public static EntityPlayer readPlayer( ByteBuf stream ) { EntityPlayer player = null; - if ( stream.readBoolean() ) + if( stream.readBoolean() ) { World playerWorld = readWorld( stream ); player = playerWorld.getPlayerEntityByName( readString( stream ) ); @@ -51,6 +147,12 @@ public abstract class AbstractPacket implements IMessage return player; } + /** + * Reads a string from the stream. + * + * @param stream + * @return + */ public static String readString( ByteBuf stream ) { byte[] stringBytes = new byte[stream.readInt()]; @@ -60,6 +162,12 @@ public abstract class AbstractPacket implements IMessage return new String( stringBytes, Charsets.UTF_8 ); } + /** + * Reads a tile entity from the stream. + * + * @param stream + * @return + */ public static TileEntity readTileEntity( ByteBuf stream ) { World world = AbstractPacket.readWorld( stream ); @@ -67,13 +175,19 @@ public abstract class AbstractPacket implements IMessage return world.getTileEntity( stream.readInt(), stream.readInt(), stream.readInt() ); } + /** + * Reads a world from the stream. + * + * @param stream + * @return + */ public static World readWorld( ByteBuf stream ) { World world = DimensionManager.getWorld( stream.readInt() ); - if ( FMLCommonHandler.instance().getSide() == Side.CLIENT ) + if( FMLCommonHandler.instance().getSide() == Side.CLIENT ) { - if ( world == null ) + if( world == null ) { world = getClientWorld(); } @@ -82,11 +196,17 @@ public abstract class AbstractPacket implements IMessage return world; } + /** + * Writes a Thaumcraft aspect to the stream. + * + * @param aspect + * @param stream + */ public static void writeAspect( Aspect aspect, ByteBuf stream ) { String aspectName = ""; - if ( aspect != null ) + if( aspect != null ) { aspectName = aspect.getTag(); } @@ -94,6 +214,34 @@ public abstract class AbstractPacket implements IMessage writeString( aspectName, stream ); } + /** + * Writes an AE itemstack to the stream. + * @param itemStack + * @param stream + */ + public static void writeAEItemStack( IAEItemStack itemStack, ByteBuf stream ) + { + // Do we have a valid stack? + if( itemStack != null ) + { + // Write into the stream + try + { + itemStack.writeToPacket( stream ); + } + catch( IOException e ) + { + } + } + + } + + /** + * Writes an AE part to the stream. + * + * @param part + * @param stream + */ public static void writePart( AEPartBase part, ByteBuf stream ) { stream.writeInt( part.getSide().ordinal() ); @@ -101,6 +249,12 @@ public abstract class AbstractPacket implements IMessage writeTileEntity( part.getHost().getTile(), stream ); } + /** + * Writes a player to the stream. + * + * @param player + * @param stream + */ @SuppressWarnings("null") public static void writePlayer( EntityPlayer player, ByteBuf stream ) { @@ -108,13 +262,19 @@ public abstract class AbstractPacket implements IMessage stream.writeBoolean( validPlayer ); - if ( validPlayer ) + if( validPlayer ) { writeWorld( player.worldObj, stream ); writeString( player.getCommandSenderName(), stream ); } } + /** + * Writes a string to the stream. + * + * @param string + * @param stream + */ public static void writeString( String string, ByteBuf stream ) { byte[] stringBytes = string.getBytes( Charsets.UTF_8 ); @@ -124,6 +284,12 @@ public abstract class AbstractPacket implements IMessage stream.writeBytes( stringBytes ); } + /** + * Writes a tile entity to the stream. + * + * @param entity + * @param stream + */ public static void writeTileEntity( TileEntity entity, ByteBuf stream ) { writeWorld( entity.getWorldObj(), stream ); @@ -132,60 +298,204 @@ public abstract class AbstractPacket implements IMessage stream.writeInt( entity.zCoord ); } + /** + * Writes a world to the stream. + * + * @param world + * @param stream + */ public static void writeWorld( World world, ByteBuf stream ) { stream.writeInt( world.provider.dimensionId ); } - public EntityPlayer player; - - public byte mode; - - public AbstractPacket() + private void fromCompressedBytes( final ByteBuf packetStream ) { - this.player = null; + // Create a new data stream + ByteBuf decompressedStream = Unpooled.buffer( AbstractPacket.COMPRESSED_BUFFER_SIZE ); + + // Create the decompressor + try( GZIPInputStream decompressor = new GZIPInputStream( new InputStream() + { + + @Override + public int read() throws IOException + { + // Is there anymore data to read from the packet stream? + if( packetStream.readableBytes() <= 0 ) + { + // Return end marker + return -1; + } + + // Return the byte + return packetStream.readByte() & 0xFF; + } + } ) ) + { + // Create a temporary holding array + byte[] holding = new byte[512]; + + // Decompress + while( decompressor.available() != 0 ) + { + // Read into the holding array + int bytesRead = decompressor.read( holding ); + + // Did we read any data? + if( bytesRead > 0 ) + { + // Write the holding array into the decompressed stream + decompressedStream.writeBytes( holding, 0, bytesRead ); + } + } + + // Close the decompressor + decompressor.close(); + + // Reset stream position + decompressedStream.readerIndex( 0 ); + + // Pass to subclass + this.readData( decompressedStream ); + + } + catch( IOException e ) + { + // Failed + } } - public AbstractPacket(EntityPlayer player) + /** + * Creates a new stream, calls to the subclass to write + * into it, then compresses it into the packet stream. + * + * @param packetStream + */ + private void toCompressedBytes( final ByteBuf packetStream ) { - this.player = player; + // Create a new data stream + ByteBuf streamToCompress = Unpooled.buffer( AbstractPacket.COMPRESSED_BUFFER_SIZE ); + + // Pass to subclass + this.writeData( streamToCompress ); + + // Create the compressor + try( GZIPOutputStream compressor = new GZIPOutputStream( new OutputStream() + { + + @Override + public void write( int byteToWrite ) throws IOException + { + // Write the byte to the packet stream + packetStream.writeByte( byteToWrite & 0xFF ); + } + } ); ) + { + // Compress + compressor.write( streamToCompress.array(), 0, streamToCompress.writerIndex() ); + + // Close the compressor + compressor.close(); + } + catch( IOException e ) + { + // Failed + } } + /** + * Packet has been read and action can now take place. + */ public abstract void execute(); + /** + * Reads data from the packet stream. + */ @Override public void fromBytes( ByteBuf stream ) { this.mode = stream.readByte(); this.player = AbstractPacket.readPlayer( stream ); - this.readData( stream ); + this.useCompression = stream.readBoolean(); + + // Is there a compressed substream? + if( this.useCompression ) + { + this.fromCompressedBytes( stream ); + } + else + { + // Pass stream directly to subclass + this.readData( stream ); + } } + /** + * Allows subclasses to read data from the specified stream. + * + * @param stream + */ public abstract void readData( ByteBuf stream ); + /** + * Send this packet to all players. + */ public void sendPacketToAllPlayers() { ChannelHandler.sendPacketToAllPlayers( this ); } + /** + * Send this packet to the specified player. + * + * @param player + */ public void sendPacketToPlayer( EntityPlayer player ) { ChannelHandler.sendPacketToPlayer( this, player ); } + /** + * Send this packet to the server. + */ public void sendPacketToServer() { ChannelHandler.sendPacketToServer( this ); } + /** + * Writes data into the packet stream. + */ @Override public void toBytes( ByteBuf stream ) { + // Write the mode stream.writeByte( this.mode ); + + // Write the player AbstractPacket.writePlayer( this.player, stream ); - this.writeData( stream ); + + // Write if there is a compressed sub-stream. + stream.writeBoolean( this.useCompression ); + + // Is compression enabled? + if( this.useCompression ) + { + this.toCompressedBytes( stream ); + } + else + { + // No compression, subclass writes directly into stream. + this.writeData( stream ); + } } + /** + * Allows subclasses to write data into the specified stream. + * + * @param stream + */ public abstract void writeData( ByteBuf stream ); } diff --git a/src/main/java/thaumicenergistics/network/ChannelHandler.java b/src/main/java/thaumicenergistics/network/ChannelHandler.java index 27320b61..99618b13 100644 --- a/src/main/java/thaumicenergistics/network/ChannelHandler.java +++ b/src/main/java/thaumicenergistics/network/ChannelHandler.java @@ -8,19 +8,23 @@ import thaumicenergistics.ThaumicEnergistics; import thaumicenergistics.network.handlers.HandlerAspectSlot; import thaumicenergistics.network.handlers.HandlerClientEssentiaCell; import thaumicenergistics.network.handlers.HandlerServerEssentiaCell; +import thaumicenergistics.network.handlers.part.HandlerClientArcaneCraftingTerminal; +import thaumicenergistics.network.handlers.part.HandlerClientEssentiaTerminal; import thaumicenergistics.network.handlers.part.HandlerEssentiaIOBus; import thaumicenergistics.network.handlers.part.HandlerEssentiaLevelEmitter; import thaumicenergistics.network.handlers.part.HandlerEssentiaStorageBus; +import thaumicenergistics.network.handlers.part.HandlerServerArcaneCraftingTerminal; import thaumicenergistics.network.handlers.part.HandlerServerEssentiaTerminal; -import thaumicenergistics.network.handlers.part.HandlerClientEssentiaTerminal; import thaumicenergistics.network.packet.PacketAspectSlot; +import thaumicenergistics.network.packet.PacketClientArcaneCraftingTerminal; import thaumicenergistics.network.packet.PacketClientEssentiaCell; +import thaumicenergistics.network.packet.PacketClientEssentiaTerminal; import thaumicenergistics.network.packet.PacketEssentiaEmitter; import thaumicenergistics.network.packet.PacketEssentiaIOBus; import thaumicenergistics.network.packet.PacketEssentiaStorageBus; -import thaumicenergistics.network.packet.PacketServerEssentiaTerminal; -import thaumicenergistics.network.packet.PacketClientEssentiaTerminal; +import thaumicenergistics.network.packet.PacketServerArcaneCraftingTerminal; import thaumicenergistics.network.packet.PacketServerEssentiaCell; +import thaumicenergistics.network.packet.PacketServerEssentiaTerminal; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper; import cpw.mods.fml.relauncher.Side; @@ -46,11 +50,13 @@ public class ChannelHandler wrapper.registerMessage( HandlerClientEssentiaCell.class, PacketClientEssentiaCell.class, 4, Side.CLIENT ); wrapper.registerMessage( HandlerServerEssentiaCell.class, PacketServerEssentiaCell.class, 5, Side.SERVER ); - wrapper.registerMessage( HandlerClientEssentiaTerminal.class, PacketClientEssentiaTerminal.class, 6, Side.CLIENT ); wrapper.registerMessage( HandlerServerEssentiaTerminal.class, PacketServerEssentiaTerminal.class, 7, Side.SERVER ); + wrapper.registerMessage( HandlerClientArcaneCraftingTerminal.class, PacketClientArcaneCraftingTerminal.class, 8, Side.CLIENT ); + wrapper.registerMessage( HandlerServerArcaneCraftingTerminal.class, PacketServerArcaneCraftingTerminal.class, 9, Side.SERVER ); + } public static void sendPacketToAllPlayers( AbstractPacket packet ) diff --git a/src/main/java/thaumicenergistics/network/IAspectSlotGui.java b/src/main/java/thaumicenergistics/network/IAspectSlotGui.java index 9a5ff22d..809d3cef 100644 --- a/src/main/java/thaumicenergistics/network/IAspectSlotGui.java +++ b/src/main/java/thaumicenergistics/network/IAspectSlotGui.java @@ -2,8 +2,9 @@ package thaumicenergistics.network; import java.util.List; import thaumcraft.api.aspects.Aspect; +import thaumicenergistics.gui.widget.IWidgetHost; -public interface IAspectSlotGui +public interface IAspectSlotGui extends IWidgetHost { public void updateAspects( List aspectList ); } diff --git a/src/main/java/thaumicenergistics/network/handlers/part/HandlerClientArcaneCraftingTerminal.java b/src/main/java/thaumicenergistics/network/handlers/part/HandlerClientArcaneCraftingTerminal.java new file mode 100644 index 00000000..45e2bcab --- /dev/null +++ b/src/main/java/thaumicenergistics/network/handlers/part/HandlerClientArcaneCraftingTerminal.java @@ -0,0 +1,18 @@ +package thaumicenergistics.network.handlers.part; + +import thaumicenergistics.network.packet.PacketClientArcaneCraftingTerminal; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; + +public class HandlerClientArcaneCraftingTerminal implements IMessageHandler +{ + + @Override + public IMessage onMessage( PacketClientArcaneCraftingTerminal message, MessageContext ctx ) + { + message.execute(); + return null; + } + +} diff --git a/src/main/java/thaumicenergistics/network/handlers/part/HandlerServerArcaneCraftingTerminal.java b/src/main/java/thaumicenergistics/network/handlers/part/HandlerServerArcaneCraftingTerminal.java new file mode 100644 index 00000000..50e219ad --- /dev/null +++ b/src/main/java/thaumicenergistics/network/handlers/part/HandlerServerArcaneCraftingTerminal.java @@ -0,0 +1,18 @@ +package thaumicenergistics.network.handlers.part; + +import thaumicenergistics.network.packet.PacketServerArcaneCraftingTerminal; +import cpw.mods.fml.common.network.simpleimpl.IMessage; +import cpw.mods.fml.common.network.simpleimpl.IMessageHandler; +import cpw.mods.fml.common.network.simpleimpl.MessageContext; + +public class HandlerServerArcaneCraftingTerminal implements IMessageHandler +{ + + @Override + public IMessage onMessage( PacketServerArcaneCraftingTerminal message, MessageContext ctx ) + { + message.execute(); + return null; + } + +} diff --git a/src/main/java/thaumicenergistics/network/packet/PacketAspectSlot.java b/src/main/java/thaumicenergistics/network/packet/PacketAspectSlot.java index 2736d998..d358306d 100644 --- a/src/main/java/thaumicenergistics/network/packet/PacketAspectSlot.java +++ b/src/main/java/thaumicenergistics/network/packet/PacketAspectSlot.java @@ -36,6 +36,7 @@ public class PacketAspectSlot extends AbstractPacket public PacketAspectSlot(List filterAspects) { this.mode = 1; + this.useCompression = true; this.filterAspects = filterAspects; } diff --git a/src/main/java/thaumicenergistics/network/packet/PacketClientArcaneCraftingTerminal.java b/src/main/java/thaumicenergistics/network/packet/PacketClientArcaneCraftingTerminal.java new file mode 100644 index 00000000..1c8c76dc --- /dev/null +++ b/src/main/java/thaumicenergistics/network/packet/PacketClientArcaneCraftingTerminal.java @@ -0,0 +1,244 @@ +package thaumicenergistics.network.packet; + +import io.netty.buffer.ByteBuf; +import java.util.Iterator; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.Gui; +import net.minecraft.entity.player.EntityPlayer; +import thaumicenergistics.gui.GuiArcaneCraftingTerminal; +import thaumicenergistics.network.AbstractPacket; +import appeng.api.AEApi; +import appeng.api.storage.data.IAEItemStack; +import appeng.api.storage.data.IItemList; + +public class PacketClientArcaneCraftingTerminal + extends AbstractPacket +{ + private static final byte MODE_RECEIVE_CHANGE = 0; + private static final byte MODE_RECEIVE_FULL_LIST = 1; + private static final byte MODE_RECEIVE_PLAYER_HOLDING = 2; + + private IAEItemStack changedStack; + + private IItemList fullList; + + private boolean isHeldEmpty; + + public PacketClientArcaneCraftingTerminal() + { + } + + /** + * Creates a packet with a changed network stack amount + * + * @param player + * @param change + */ + public PacketClientArcaneCraftingTerminal createChangeUpdate( EntityPlayer player, IAEItemStack change ) + { + // Set the player + this.player = player; + + // Set the mode + this.mode = PacketClientArcaneCraftingTerminal.MODE_RECEIVE_CHANGE; + + // Set the change + this.changedStack = change; + + return this; + } + + /** + * Creates a packet with the full list of items in the AE network. + * Only send in response to a request. + * + * @param player + * @param fullList + */ + public PacketClientArcaneCraftingTerminal createFullListUpdate( EntityPlayer player, IItemList fullList ) + { + // Set the player + this.player = player; + + // Set the mode + this.mode = PacketClientArcaneCraftingTerminal.MODE_RECEIVE_FULL_LIST; + + // Enable compression + this.useCompression = true; + + // Set the full list + this.fullList = fullList; + + return this; + } + + /** + * Creates a packet with an update to what itemstack the player is holding. + * @param player + * @param heldItem + * @return + */ + public PacketClientArcaneCraftingTerminal createPlayerHoldingUpdate( EntityPlayer player, IAEItemStack heldItem ) + { + // Set the player + this.player = player; + + // Set the mode + this.mode = PacketClientArcaneCraftingTerminal.MODE_RECEIVE_PLAYER_HOLDING; + + // Set the held item + this.changedStack = heldItem; + + // Is the player holding anything? + this.isHeldEmpty = ( heldItem == null ); + + return this; + } + + @Override + public void execute() + { + // Ensure we have a player + if( ( this.player != null ) ) + { + // Get the current screen being displayed to the user + Gui gui = Minecraft.getMinecraft().currentScreen; + + // Is that screen the gui for the ACT? + if( gui instanceof GuiArcaneCraftingTerminal ) + { + switch ( this.mode ) + { + case PacketClientArcaneCraftingTerminal.MODE_RECEIVE_FULL_LIST: + // Set the item list + ( (GuiArcaneCraftingTerminal)gui ).onReceiveFullList( this.fullList ); + break; + + case PacketClientArcaneCraftingTerminal.MODE_RECEIVE_CHANGE: + // Update the item list + ( (GuiArcaneCraftingTerminal)gui ).onReceiveChange( this.changedStack ); + break; + + case PacketClientArcaneCraftingTerminal.MODE_RECEIVE_PLAYER_HOLDING: + // Set the held item + ( (GuiArcaneCraftingTerminal)gui ).onPlayerHeldReceived( this.changedStack ); + } + } + } + } + + @Override + public void readData( ByteBuf stream ) + { + + switch ( this.mode ) + { + case PacketClientArcaneCraftingTerminal.MODE_RECEIVE_FULL_LIST: + // Create a new list + this.fullList = AEApi.instance().storage().createItemList(); + + // Read how many items there are + int count = stream.readInt(); + + for( int i = 0; i < count; i++ ) + { + // Also ensure there are bytes to read + if( stream.readableBytes() <= 0 ) + { + break; + } + + // Read the itemstack + IAEItemStack itemStack = AbstractPacket.readAEItemStack( stream ); + + // Ensure it is not null + if( itemStack != null ) + { + // Add to the list + this.fullList.add( itemStack ); + } + } + break; + + case PacketClientArcaneCraftingTerminal.MODE_RECEIVE_CHANGE: + // Read the change amount + int changeAmount = stream.readInt(); + + // Read the item + this.changedStack = AbstractPacket.readAEItemStack( stream ); + + // Adjust it's size + this.changedStack.setStackSize( changeAmount ); + + break; + + case PacketClientArcaneCraftingTerminal.MODE_RECEIVE_PLAYER_HOLDING: + // Read if the itemstack is empty + this.isHeldEmpty = stream.readBoolean(); + + // Is it not empty? + if( !this.isHeldEmpty ) + { + this.changedStack = AbstractPacket.readAEItemStack( stream ); + } + else + { + this.changedStack = null; + } + break; + } + } + + @Override + public void writeData( ByteBuf stream ) + { + + switch ( this.mode ) + { + case PacketClientArcaneCraftingTerminal.MODE_RECEIVE_FULL_LIST: + // Write how many items there are + stream.writeInt( this.fullList.size() ); + + // Get the iterator + Iterator listIterator = this.fullList.iterator(); + + // Write each item + while( listIterator.hasNext() ) + { + AbstractPacket.writeAEItemStack( listIterator.next(), stream ); + } + break; + + case PacketClientArcaneCraftingTerminal.MODE_RECEIVE_CHANGE: + // Write the change amount + stream.writeInt( (int)this.changedStack.getStackSize() ); + + // Write the change + AbstractPacket.writeAEItemStack( this.changedStack, stream ); + break; + + case PacketClientArcaneCraftingTerminal.MODE_RECEIVE_PLAYER_HOLDING: + // Write if the held item is empty + stream.writeBoolean( this.isHeldEmpty ); + + // Is it not empty? + if( !this.isHeldEmpty ) + { + // Write the stack + AbstractPacket.writeAEItemStack( this.changedStack, stream ); + } + + break; + } + + } + + /** + * Invalid, can only be sent to clients + */ + @Override + public void sendPacketToServer() + { + } + +} diff --git a/src/main/java/thaumicenergistics/network/packet/PacketClientEssentiaCell.java b/src/main/java/thaumicenergistics/network/packet/PacketClientEssentiaCell.java index 85575795..0e4dc647 100644 --- a/src/main/java/thaumicenergistics/network/packet/PacketClientEssentiaCell.java +++ b/src/main/java/thaumicenergistics/network/packet/PacketClientEssentiaCell.java @@ -30,6 +30,8 @@ public class PacketClientEssentiaCell super( player ); this.mode = PacketClientEssentiaCell.MODE_UPDATE_LIST; + + this.useCompression = true; this.aspectStackList = list; } diff --git a/src/main/java/thaumicenergistics/network/packet/PacketClientEssentiaTerminal.java b/src/main/java/thaumicenergistics/network/packet/PacketClientEssentiaTerminal.java index 0f9baf08..d226792f 100644 --- a/src/main/java/thaumicenergistics/network/packet/PacketClientEssentiaTerminal.java +++ b/src/main/java/thaumicenergistics/network/packet/PacketClientEssentiaTerminal.java @@ -31,6 +31,8 @@ public class PacketClientEssentiaTerminal this.mode = PacketClientEssentiaTerminal.MODE_UPDATE_LIST; + this.useCompression = true; + this.aspectStackList = list; } diff --git a/src/main/java/thaumicenergistics/network/packet/PacketServerArcaneCraftingTerminal.java b/src/main/java/thaumicenergistics/network/packet/PacketServerArcaneCraftingTerminal.java new file mode 100644 index 00000000..4e34e207 --- /dev/null +++ b/src/main/java/thaumicenergistics/network/packet/PacketServerArcaneCraftingTerminal.java @@ -0,0 +1,170 @@ +package thaumicenergistics.network.packet; + +import io.netty.buffer.ByteBuf; +import net.minecraft.entity.player.EntityPlayer; +import thaumicenergistics.container.ContainerPartArcaneCraftingTerminal; +import thaumicenergistics.network.AbstractPacket; +import appeng.api.storage.data.IAEItemStack; + +public class PacketServerArcaneCraftingTerminal + extends AbstractPacket +{ + + private static final byte MODE_REQUEST_FULL_LIST = 1; + private static final byte MODE_REQUEST_EXTRACTION = 2; + private static final byte MODE_REQUEST_DEPOSIT = 3; + + private IAEItemStack itemStack; + + private int mouseButton; + + public PacketServerArcaneCraftingTerminal() + { + } + + /** + * Create a packet in full list mode. + * This will request a full list of all items in + * the ME network. Use only when needed. + * + * @param player + */ + public PacketServerArcaneCraftingTerminal createFullListRequest( EntityPlayer player ) + { + // Set the player + this.player = player; + + // Set the mode + this.mode = PacketServerArcaneCraftingTerminal.MODE_REQUEST_FULL_LIST; + + return this; + } + + /** + * Creates a packet letting the server know the user would like to + * extract the specified itemstack from the ME network. + * + * @param player + * @param itemStack + * @param mouseButton + * @return + */ + public PacketServerArcaneCraftingTerminal createExtractRequest( EntityPlayer player, IAEItemStack itemStack, int mouseButton ) + { + // Set player + this.player = player; + + // Set mode + this.mode = PacketServerArcaneCraftingTerminal.MODE_REQUEST_EXTRACTION; + + // Set stack + this.itemStack = itemStack; + + // Set mouse button + this.mouseButton = mouseButton; + + return this; + } + + /** + * Creates a packet letting the server know the user would like to + * deposition whatever they are holding into the ME network. + * + * @param player + * @return + */ + public PacketServerArcaneCraftingTerminal createDepositRequest( EntityPlayer player, int mouseButton ) + { + // Set the player + this.player = player; + + // Set the mode + this.mode = PacketServerArcaneCraftingTerminal.MODE_REQUEST_DEPOSIT; + + // Set the button + this.mouseButton = mouseButton; + + return this; + } + + @Override + public void execute() + { + // If the player is not null, and they have the ACT container open + if( ( this.player != null ) && ( this.player.openContainer instanceof ContainerPartArcaneCraftingTerminal ) ) + { + switch ( this.mode ) + { + case PacketServerArcaneCraftingTerminal.MODE_REQUEST_FULL_LIST: + // Request the full list + ( (ContainerPartArcaneCraftingTerminal)this.player.openContainer ).onClientRequestFullUpdate( this.player ); + break; + case PacketServerArcaneCraftingTerminal.MODE_REQUEST_EXTRACTION: + //TODO + break; + case PacketServerArcaneCraftingTerminal.MODE_REQUEST_DEPOSIT: + // Request deposit + ( (ContainerPartArcaneCraftingTerminal)this.player.openContainer ).onClientRequestDeposit( this.player, this.mouseButton ); + break; + } + } + } + + @Override + public void readData( ByteBuf stream ) + { + switch ( this.mode ) + { + case PacketServerArcaneCraftingTerminal.MODE_REQUEST_EXTRACTION: + // Read the item + this.itemStack = AbstractPacket.readAEItemStack( stream ); + + // Read the mouse button + this.mouseButton = stream.readInt(); + break; + + case PacketServerArcaneCraftingTerminal.MODE_REQUEST_DEPOSIT: + // Read the mouse button + this.mouseButton = stream.readInt(); + break; + } + + } + + @Override + public void writeData( ByteBuf stream ) + { + switch ( this.mode ) + { + case PacketServerArcaneCraftingTerminal.MODE_REQUEST_EXTRACTION: + // Write the itemstack + AbstractPacket.writeAEItemStack( this.itemStack, stream ); + + // Write the mouse button + stream.writeInt( this.mouseButton ); + break; + + case PacketServerArcaneCraftingTerminal.MODE_REQUEST_DEPOSIT: + // Write the mouse button + stream.writeInt( this.mouseButton ); + break; + } + } + + /** + * Invalid, this packet is to be send to the server. + */ + @Override + public void sendPacketToAllPlayers() + { + } + + /** + * Invalid, this packet is to be send to the server. + */ + @Override + public void sendPacketToPlayer( EntityPlayer player ) + { + } + +} diff --git a/src/main/java/thaumicenergistics/parts/AEPartArcaneCraftingTerminal.java b/src/main/java/thaumicenergistics/parts/AEPartArcaneCraftingTerminal.java new file mode 100644 index 00000000..75ccfab5 --- /dev/null +++ b/src/main/java/thaumicenergistics/parts/AEPartArcaneCraftingTerminal.java @@ -0,0 +1,426 @@ +package thaumicenergistics.parts; + +import java.util.ArrayList; +import java.util.List; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; +import thaumcraft.common.items.wands.ItemWandCasting; +import thaumicenergistics.ThaumicEnergistics; +import thaumicenergistics.container.ContainerPartArcaneCraftingTerminal; +import thaumicenergistics.gui.GuiArcaneCraftingTerminal; +import thaumicenergistics.registries.AEPartsEnum; +import thaumicenergistics.texture.BlockTextureManager; +import appeng.api.parts.IPartCollsionHelper; +import appeng.api.parts.IPartRenderHelper; +import appeng.api.util.AEColor; + +public class AEPartArcaneCraftingTerminal + extends AEPartBase + implements IInventory +{ + private static final int MY_INVENTORY_SIZE = 11; + + public static final int WAND_SLOT_INDEX = 9; + + public static final int RESULT_SLOT_INDEX = 10; + + private static final String INVENTORY_NBT_KEY = "TEACT_Inventory"; + + private static final String SLOT_NBT_KEY = "Slot#"; + + private final ItemStack[] slots = new ItemStack[AEPartArcaneCraftingTerminal.MY_INVENTORY_SIZE]; + + private List listeners = new ArrayList(); + + public AEPartArcaneCraftingTerminal() + { + // Call super + super( AEPartsEnum.ArcaneCraftingTerminal ); + } + + public void registerListener( ContainerPartArcaneCraftingTerminal container ) + { + // Is this already registered? + if( !this.listeners.contains( container ) ) + { + // Add to the list + this.listeners.add( container ); + } + + } + + public void removeListener( ContainerPartArcaneCraftingTerminal container ) + { + // Remove the container from the listeners + this.listeners.remove( container ); + } + + private void notifyListeners( int slotIndex ) + { + // Loop over all listeners + for( ContainerPartArcaneCraftingTerminal listener : this.listeners ) + { + // Ensure the listener is still there + if( listener != null ) + { + // Notify it + listener.onCraftMatrixChanged( this ); + } + } + } + + @Override + public Object getClientGuiElement( EntityPlayer player ) + { + return new GuiArcaneCraftingTerminal( this, player ); + } + + @Override + public Object getServerGuiElement( EntityPlayer player ) + { + return new ContainerPartArcaneCraftingTerminal( this, player ); + } + + @Override + public int cableConnectionRenderTo() + { + return 3; + } + + @Override + public void getBoxes( IPartCollsionHelper helper ) + { + helper.addBox( 2.0D, 2.0D, 14.0D, 14.0D, 14.0D, 16.0D ); + + helper.addBox( 5.0D, 5.0D, 13.0D, 11.0D, 11.0D, 14.0D ); + } + + @Override + public void renderInventory( IPartRenderHelper helper, RenderBlocks renderer ) + { + Tessellator ts = Tessellator.instance; + + IIcon side = BlockTextureManager.ARCANE_CRAFTING_TERMINAL.getTextures()[3]; + + helper.setTexture( side, side, side, BlockTextureManager.ARCANE_CRAFTING_TERMINAL.getTextures()[0], side, side ); + helper.setBounds( 2.0F, 2.0F, 14.0F, 14.0F, 14.0F, 16.0F ); + helper.renderInventoryBox( renderer ); + + helper.setBounds( 2.0F, 2.0F, 15.0F, 14.0F, 14.0F, 16.0F ); + ts.setColorOpaque_I( AEPartBase.inventoryOverlayColor ); + helper.renderInventoryFace( BlockTextureManager.ARCANE_CRAFTING_TERMINAL.getTextures()[2], ForgeDirection.SOUTH, renderer ); + + ts.setColorOpaque_I( AEColor.Black.mediumVariant ); + helper.renderInventoryFace( BlockTextureManager.ARCANE_CRAFTING_TERMINAL.getTextures()[1], ForgeDirection.SOUTH, renderer ); + + helper.setBounds( 5.0F, 5.0F, 13.0F, 11.0F, 11.0F, 14.0F ); + this.renderInventoryBusLights( helper, renderer ); + } + + @Override + public void renderStatic( int x, int y, int z, IPartRenderHelper helper, RenderBlocks renderer ) + { + Tessellator ts = Tessellator.instance; + + IIcon side = BlockTextureManager.ARCANE_CRAFTING_TERMINAL.getTextures()[3]; + + helper.setTexture( side, side, side, BlockTextureManager.ARCANE_CRAFTING_TERMINAL.getTextures()[0], side, side ); + helper.setBounds( 2.0F, 2.0F, 14.0F, 14.0F, 14.0F, 16.0F ); + helper.renderBlock( x, y, z, renderer ); + + if( this.isActive() ) + { + + helper.setBounds( 2.0F, 2.0F, 15.0F, 14.0F, 14.0F, 16.0F ); + ts.setColorOpaque_I( this.host.getColor().blackVariant ); + helper.renderFace( x, y, z, BlockTextureManager.ARCANE_CRAFTING_TERMINAL.getTextures()[2], ForgeDirection.SOUTH, renderer ); + + ts.setColorOpaque_I( this.host.getColor().mediumVariant ); + helper.renderFace( x, y, z, BlockTextureManager.ARCANE_CRAFTING_TERMINAL.getTextures()[1], ForgeDirection.SOUTH, renderer ); + } + + helper.setBounds( 5.0F, 5.0F, 13.0F, 11.0F, 11.0F, 14.0F ); + this.renderStaticBusLights( x, y, z, helper, renderer ); + } + + @Override + public void readFromNBT( NBTTagCompound data ) + { + // Does the data tag have the list? + if( data.hasKey( AEPartArcaneCraftingTerminal.INVENTORY_NBT_KEY ) ) + { + // Get the list + NBTTagList nbtTagList = (NBTTagList)data.getTag( AEPartArcaneCraftingTerminal.INVENTORY_NBT_KEY ); + + for( int listIndex = 0; listIndex < nbtTagList.tagCount(); listIndex++ ) + { + // Get the compound tag + NBTTagCompound nbtCompound = nbtTagList.getCompoundTagAt( listIndex ); + + // Get the slot list + int slotIndex = nbtCompound.getByte( AEPartArcaneCraftingTerminal.SLOT_NBT_KEY ); + + // Is it in range? + if( this.isSlotInRange( slotIndex ) ) + { + // Set the slot + this.slots[slotIndex] = ItemStack.loadItemStackFromNBT( nbtCompound ); + } + } + } + } + + @Override + public void writeToNBT( NBTTagCompound data ) + { + // Create a new tag list + NBTTagList nbtList = new NBTTagList(); + + // Loop over the slots + for( int slotId = 0; slotId < AEPartArcaneCraftingTerminal.MY_INVENTORY_SIZE; slotId++ ) + { + // Is the slot not null? + if( this.slots[slotId] != null ) + { + // Create the compound tag for this stack + NBTTagCompound nbtCompound = new NBTTagCompound(); + + // Set the slot ID + nbtCompound.setByte( AEPartArcaneCraftingTerminal.SLOT_NBT_KEY, (byte)slotId ); + + // Write the stack into the tag + this.slots[slotId].writeToNBT( nbtCompound ); + + // Append to the list + nbtList.appendTag( nbtCompound ); + } + } + + // Append the list to the data tag + data.setTag( AEPartArcaneCraftingTerminal.INVENTORY_NBT_KEY, nbtList ); + } + + @Override + public void removeFromWorld() + { + + // Is this server side? + if( !this.hostTile.getWorldObj().isRemote ) + { + // Loop over inventory + for( int slotIndex = 0; slotIndex < AEPartArcaneCraftingTerminal.MY_INVENTORY_SIZE; slotIndex++ ) + { + // Skip if this is the output slot + if( slotIndex == AEPartArcaneCraftingTerminal.RESULT_SLOT_INDEX ) + { + continue; + } + + // Get the stack at this index + ItemStack slotStack = this.slots[slotIndex]; + + // Did we get anything? + if( slotStack != null ) + { + // Drop it on the ground + this.dropInventoryItemOnGround( slotStack ); + } + } + } + + // Pass to super + super.removeFromWorld(); + } + + private boolean isSlotInRange( int slotIndex ) + { + // Is the slot in range? + return( ( slotIndex >= 0 ) && ( slotIndex < AEPartArcaneCraftingTerminal.MY_INVENTORY_SIZE ) ); + } + + @Override + public int getSizeInventory() + { + return AEPartArcaneCraftingTerminal.MY_INVENTORY_SIZE; + } + + @Override + public ItemStack getStackInSlot( int slotIndex ) + { + // Is the slot in range? + if( this.isSlotInRange( slotIndex ) ) + { + // Return the contents of the slot + return this.slots[slotIndex]; + } + + // Return null + return null; + } + + @Override + public ItemStack decrStackSize( int slotIndex, int amount ) + { + ItemStack returnStack = null; + + // Is the slot in range? + if( this.isSlotInRange( slotIndex ) ) + { + // Get the stack + ItemStack slotStack = this.slots[slotIndex]; + + // Is the slot not null? + if( slotStack != null ) + { + + // Is the amount for more than or all of the slot? + if( amount >= slotStack.stackSize ) + { + // Set the return to a copy of the stack + returnStack = slotStack.copy(); + + // Set stack size to 0 + this.slots[slotIndex].stackSize = 0; + } + else + { + // Split the slot stack + returnStack = slotStack.splitStack( amount ); + } + + // Is the size now 0? + if( this.slots[slotIndex].stackSize == 0 ) + { + // Null it out + this.slots[slotIndex] = null; + } + + // Notify the worker + this.notifyListeners( slotIndex ); + } + } + + return returnStack; + } + + @Override + public ItemStack getStackInSlotOnClosing( int slotIndex ) + { + // Is the slot in range? + if( this.isSlotInRange( slotIndex ) ) + { + return this.slots[slotIndex]; + } + + return null; + } + + public boolean setInventorySlotContentsWithoutNotify( int slotIndex, ItemStack slotStack ) + { + // Is the slot in range? + if( this.isSlotInRange( slotIndex ) ) + { + // Set the slot + this.slots[slotIndex] = slotStack; + + return true; + } + + return false; + } + + @Override + public void setInventorySlotContents( int slotIndex, ItemStack slotStack ) + { + if( this.setInventorySlotContentsWithoutNotify( slotIndex, slotStack ) ) + { + // Inform the listeners + this.notifyListeners( slotIndex ); + } + } + + @Override + public String getInventoryName() + { + return ThaumicEnergistics.MOD_ID + ".arcane.crafting.terminal.inventory"; + } + + @Override + public boolean hasCustomInventoryName() + { + return true; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + @Override + public void markDirty() + { + // Mark the host tile + this.hostTile.markDirty(); + } + + @Override + public boolean isUseableByPlayer( EntityPlayer player ) + { + return true; + } + + @Override + public void openInventory() + { + // Ignored + } + + @Override + public void closeInventory() + { + // Ignored + } + + @Override + public boolean isItemValidForSlot( int slotIndex, ItemStack proposedStack ) + { + // Is the slot in range? + if( this.isSlotInRange( slotIndex ) ) + { + // Is this the wand slot? + if( slotIndex == AEPartArcaneCraftingTerminal.WAND_SLOT_INDEX ) + { + // Is the item a wand? + if( proposedStack.getItem() instanceof ItemWandCasting ) + { + // Valid wand + return true; + } + + // Invalid wand + return false; + } + + // Unrestricted slot + return true; + } + + // Out of range + return false; + } + + public World getWorldObj() + { + return this.hostTile.getWorldObj(); + } + +} diff --git a/src/main/java/thaumicenergistics/parts/AEPartBase.java b/src/main/java/thaumicenergistics/parts/AEPartBase.java index 25e007c6..43d977ed 100644 --- a/src/main/java/thaumicenergistics/parts/AEPartBase.java +++ b/src/main/java/thaumicenergistics/parts/AEPartBase.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.ItemStack; @@ -555,5 +556,16 @@ public abstract class AEPartBase helper.renderFace( x, y, z, lightTexture, ForgeDirection.SOUTH, renderer ); helper.renderFace( x, y, z, lightTexture, ForgeDirection.WEST, renderer ); } + + protected void dropInventoryItemOnGround( ItemStack item ) + { + World hostWorld = this.hostTile.getWorldObj(); + + // Create the entity + EntityItem craftItem = new EntityItem( hostWorld, this.hostTile.xCoord, this.hostTile.yCoord, this.hostTile.zCoord, item ); + + // Drop it on the ground + hostWorld.spawnEntityInWorld( craftItem ); + } } diff --git a/src/main/java/thaumicenergistics/parts/AEPartEssentiaIO.java b/src/main/java/thaumicenergistics/parts/AEPartEssentiaIO.java index aca8b90e..f6966608 100644 --- a/src/main/java/thaumicenergistics/parts/AEPartEssentiaIO.java +++ b/src/main/java/thaumicenergistics/parts/AEPartEssentiaIO.java @@ -158,7 +158,8 @@ public abstract class AEPartEssentiaIO } // Simulate a drain from the container - FluidStack drained = EssentiaTileContainerHelper.extractFromContainer( this.facingContainer, amountToDrain, aspectToDrain, Actionable.SIMULATE ); + FluidStack drained = EssentiaTileContainerHelper.extractFromContainer( this.facingContainer, amountToDrain, aspectToDrain, + Actionable.SIMULATE ); // Was any drained? if ( drained == null ) @@ -260,7 +261,7 @@ public abstract class AEPartEssentiaIO { boolean activated = super.onActivate( player, position ); - this.onInventoryChanged(); + this.onInventoryChanged( null ); return activated; } @@ -270,12 +271,12 @@ public abstract class AEPartEssentiaIO { if ( inv == this.upgradeInventory ) { - this.onInventoryChanged(); + this.onInventoryChanged( inv ); } } @Override - public void onInventoryChanged() + public void onInventoryChanged( IInventory sourceInventory ) { int oldFilterSize = this.filterSize; @@ -405,7 +406,7 @@ public abstract class AEPartEssentiaIO this.upgradeInventory.readFromNBT( data, "upgradeInventory" ); - this.onInventoryChanged(); + this.onInventoryChanged( this.upgradeInventory ); } @Override @@ -506,7 +507,7 @@ public abstract class AEPartEssentiaIO public boolean addFilteredAspectFromItemstack( EntityPlayer player, ItemStack itemStack ) { Aspect itemAspect = EssentiaItemContainerHelper.getAspectInContainer( itemStack ); - + if ( itemAspect != null ) { // Are we already filtering this aspect? @@ -546,9 +547,9 @@ public abstract class AEPartEssentiaIO @SideOnly(Side.CLIENT) public void receiveFilterSize( byte filterSize ) - { + { this.filterSize = filterSize; - + this.resizeAvailableArray(); } diff --git a/src/main/java/thaumicenergistics/parts/AEPartEssentiaStorageBus.java b/src/main/java/thaumicenergistics/parts/AEPartEssentiaStorageBus.java index 2bc1a76f..7cf01344 100644 --- a/src/main/java/thaumicenergistics/parts/AEPartEssentiaStorageBus.java +++ b/src/main/java/thaumicenergistics/parts/AEPartEssentiaStorageBus.java @@ -178,13 +178,13 @@ public class AEPartEssentiaStorageBus } @Override - public void onChangeInventory( IInventory arg0, int arg1, InvOperation arg2, ItemStack arg3, ItemStack arg4 ) + public void onChangeInventory( IInventory inv, int arg1, InvOperation arg2, ItemStack arg3, ItemStack arg4 ) { - this.onInventoryChanged(); + this.onInventoryChanged( inv ); } @Override - public void onInventoryChanged() + public void onInventoryChanged( IInventory sourceInventory ) { this.handler.setInverted( AEApi.instance().materials().materialCardInverter.sameAs( this.upgradeInventory.getStackInSlot( 0 ) ) ); } @@ -225,7 +225,7 @@ public class AEPartEssentiaStorageBus this.upgradeInventory.readFromNBT( data, "UpgradeInventory" ); - this.onInventoryChanged(); + this.onInventoryChanged( this.upgradeInventory ); } @SideOnly(Side.CLIENT) diff --git a/src/main/java/thaumicenergistics/parts/AEPartEssentiaTerminal.java b/src/main/java/thaumicenergistics/parts/AEPartEssentiaTerminal.java index 31ad920d..0e9f02d2 100644 --- a/src/main/java/thaumicenergistics/parts/AEPartEssentiaTerminal.java +++ b/src/main/java/thaumicenergistics/parts/AEPartEssentiaTerminal.java @@ -245,5 +245,30 @@ public class AEPartEssentiaTerminal this.inventoryLocked = false; } } + + @Override + public void removeFromWorld() + { + // Is this server side? + if ( !this.hostTile.getWorldObj().isRemote ) + { + // Loop over inventory + for( int index = 0; index < 2; index++ ) + { + // Get the stack at this index + ItemStack slotStack = this.inventory.getStackInSlot( index ); + + // Did we get anything? + if( slotStack != null ) + { + // Drop it on the ground + this.dropInventoryItemOnGround( slotStack ); + } + } + } + + // Pass to super + super.removeFromWorld(); + } } diff --git a/src/main/java/thaumicenergistics/registries/AEPartsEnum.java b/src/main/java/thaumicenergistics/registries/AEPartsEnum.java index e570fdeb..c3f702ca 100644 --- a/src/main/java/thaumicenergistics/registries/AEPartsEnum.java +++ b/src/main/java/thaumicenergistics/registries/AEPartsEnum.java @@ -8,6 +8,7 @@ import net.minecraft.util.StatCollector; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import thaumicenergistics.ThaumicEnergistics; +import thaumicenergistics.parts.AEPartArcaneCraftingTerminal; import thaumicenergistics.parts.AEPartBase; import thaumicenergistics.parts.AEPartEssentiaExportBus; import thaumicenergistics.parts.AEPartEssentiaImportBus; @@ -28,7 +29,9 @@ public enum AEPartsEnum EssentiaExportBus ("essentia.ExportBus", AEPartEssentiaExportBus.class, ThaumicEnergistics.MOD_ID + ".group.essentia.transport", new Pair[] { generatePair( Upgrades.CAPACITY, 2 ), generatePair( Upgrades.REDSTONE, 1 ), generatePair( Upgrades.SPEED, 2 ) }), - EssentiaTerminal ("essentia.terminal", AEPartEssentiaTerminal.class); + EssentiaTerminal ("essentia.terminal", AEPartEssentiaTerminal.class), + + ArcaneCraftingTerminal( "arcane.crafting.terminal", AEPartArcaneCraftingTerminal.class ); private String unlocalizedName; diff --git a/src/main/java/thaumicenergistics/render/RenderBlockEssentiaProvider.java b/src/main/java/thaumicenergistics/render/RenderBlockEssentiaProvider.java index 7665957d..280f2c3a 100644 --- a/src/main/java/thaumicenergistics/render/RenderBlockEssentiaProvider.java +++ b/src/main/java/thaumicenergistics/render/RenderBlockEssentiaProvider.java @@ -19,16 +19,16 @@ public class RenderBlockEssentiaProvider if ( Renderers.currentRenderPass == Renderers.PASS_OPAQUE ) { // Opaque pass - this.renderBlock( x, y, z, null, blockBrightness ); + this.renderBlock( x, y, z, null, blockBrightness, false ); } else { - // Alpha pass, get the providers color - AEColor overlayColor = ( (TileEssentiaProvider)world.getTileEntity( x, y, z ) ).getGridColor(); + // Alpha pass + TileEssentiaProvider provider = (TileEssentiaProvider)world.getTileEntity( x, y, z ); // Render the overlay - this.renderBlock( x, y, z, overlayColor, blockBrightness ); + this.renderBlock( x, y, z, provider.getGridColor(), blockBrightness, provider.isActive() ); } } @@ -39,7 +39,7 @@ public class RenderBlockEssentiaProvider return Renderers.EssentiaProviderRenderID; } - private void renderBlock( double x, double y, double z, AEColor overlayColor, int blockBrightness ) + private void renderBlock( double x, double y, double z, AEColor overlayColor, int blockBrightness, boolean isActive ) { // Slightly offsets the overlay so no z-fighting double negativeOffset = -.0001D; @@ -62,6 +62,16 @@ public class RenderBlockEssentiaProvider // Reset offset negativeOffset = 0.0D; } + // Are we active? + else if( !isActive ) + { + // Set the texture to the inactive version + texture = BlockTextureManager.ESSENTIA_PROVIDER.getTextures()[3]; + + // Set the drawing color to full white + tessellator.setColorRGBA( 255, 255, 255, 255 ); + + } // Does the tile have a color? else if ( overlayColor != AEColor.Transparent ) { diff --git a/src/main/java/thaumicenergistics/render/RenderBlockInfusionProvider.java b/src/main/java/thaumicenergistics/render/RenderBlockInfusionProvider.java index 49320d30..8ca963bf 100644 --- a/src/main/java/thaumicenergistics/render/RenderBlockInfusionProvider.java +++ b/src/main/java/thaumicenergistics/render/RenderBlockInfusionProvider.java @@ -31,20 +31,20 @@ public class RenderBlockInfusionProvider if ( Renderers.currentRenderPass == Renderers.PASS_OPAQUE ) { // Opaque pass - this.renderBlock( x, y, z, null, blockBrightness ); + this.renderBlock( x, y, z, null, blockBrightness, false ); } else { - // Alpha pass, get the providers color - AEColor overlayColor = ( (TileInfusionProvider)world.getTileEntity( x, y, z ) ).getGridColor(); + // Alpha pass + TileInfusionProvider provider = (TileInfusionProvider)world.getTileEntity( x, y, z ); // Render the overlay - this.renderBlock( x, y, z, overlayColor, blockBrightness ); + this.renderBlock( x, y, z, provider.getGridColor(), blockBrightness, provider.isActive() ); } } - private void renderBlock( double x, double y, double z, AEColor overlayColor, int blockBrightness ) + private void renderBlock( double x, double y, double z, AEColor overlayColor, int blockBrightness, boolean isActive ) { // Slightly offsets the overlay so no z-fighting double negativeOffset = -.0001D; @@ -72,6 +72,14 @@ public class RenderBlockInfusionProvider // Reset offset negativeOffset = 0.0D; } + else if( !isActive ) + { + // Set the texture to the inactive version + sideTexture = BlockTextureManager.INFUSION_PROVIDER.getTextures()[5]; + + // Set the drawing color to full white + tessellator.setColorRGBA( 255, 255, 255, 255 ); + } // Does the tile have a color? else if ( overlayColor != AEColor.Transparent ) { diff --git a/src/main/java/thaumicenergistics/texture/BlockTextureManager.java b/src/main/java/thaumicenergistics/texture/BlockTextureManager.java index 328fce09..96ee8b74 100644 --- a/src/main/java/thaumicenergistics/texture/BlockTextureManager.java +++ b/src/main/java/thaumicenergistics/texture/BlockTextureManager.java @@ -23,12 +23,18 @@ public enum BlockTextureManager "essentia.terminal.overlay.3" }), ESSENTIA_PROVIDER (TextureTypes.Block, new String[] { "essentia.provider", "essentia.provider.overlay", - "essentia.provider.overlay.nogridcolor" }), + "essentia.provider.overlay.nogridcolor", + "essentia.provider.overlay.inactive" }), INFUSION_PROVIDER (TextureTypes.Block, new String[] { "infusion.provider.bottom", "infusion.provider.side", "infusion.provider.side.overlay", "infusion.provider.side.overlay.nogridcolor", - "infusion.provider.top" }); + "infusion.provider.top", + "infusion.provider.overlay.inactive" }), + ARCANE_CRAFTING_TERMINAL (TextureTypes.Part, new String[] { "arcane.crafting.overlay1", + "arcane.crafting.overlay2", + "arcane.crafting.overlay3", + "arcane.crafting.side" }); private enum TextureTypes { diff --git a/src/main/java/thaumicenergistics/texture/GuiTextureManager.java b/src/main/java/thaumicenergistics/texture/GuiTextureManager.java index 5d24466f..2e2ad6e8 100644 --- a/src/main/java/thaumicenergistics/texture/GuiTextureManager.java +++ b/src/main/java/thaumicenergistics/texture/GuiTextureManager.java @@ -8,7 +8,8 @@ public enum GuiTextureManager ESSENTIA_LEVEL_EMITTER( "essentia.level.emitter" ), ESSENTIA_STORAGE_BUS( "essentia.storage.bus" ), ESSENTIA_TERMINAL( "essentia.terminal" ), - ESSENTIA_IO_BUS( "essentia.io.bus" ); + ESSENTIA_IO_BUS( "essentia.io.bus" ), + ARCANE_CRAFTING_TERMINAL( "arcane.crafting" ); private ResourceLocation texture; diff --git a/src/main/java/thaumicenergistics/tileentities/TileProviderBase.java b/src/main/java/thaumicenergistics/tileentities/TileProviderBase.java index 448f3d4b..5385bf22 100644 --- a/src/main/java/thaumicenergistics/tileentities/TileProviderBase.java +++ b/src/main/java/thaumicenergistics/tileentities/TileProviderBase.java @@ -374,5 +374,19 @@ public abstract class TileProviderBase return sideColors; } + + // TODO: Dis is a client side hack + public boolean isActive() + { + for( ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS ) + { + if( this.worldObj.getTileEntity( this.xCoord + dir.offsetX, this.yCoord + dir.offsetY, this.zCoord + dir.offsetZ ) instanceof TileCableBus ) + { + return true; + } + } + + return false; + } } diff --git a/src/main/java/thaumicenergistics/util/EssentiaItemContainerHelper.java b/src/main/java/thaumicenergistics/util/EssentiaItemContainerHelper.java index a6eae97c..b7fed396 100644 --- a/src/main/java/thaumicenergistics/util/EssentiaItemContainerHelper.java +++ b/src/main/java/thaumicenergistics/util/EssentiaItemContainerHelper.java @@ -190,9 +190,7 @@ public final class EssentiaItemContainerHelper * @return Info if was registered, null otherwise. */ private static ContainerInfo getContainerInfo( Class container, int metadata ) - { - System.out.println( metadata ); - + { // Is the item registered? if ( EssentiaItemContainerHelper.itemWhitelist.containsKey( container ) ) { diff --git a/src/main/java/thaumicenergistics/util/GuiHelper.java b/src/main/java/thaumicenergistics/util/GuiHelper.java index f4071bd8..bd8ed1f6 100644 --- a/src/main/java/thaumicenergistics/util/GuiHelper.java +++ b/src/main/java/thaumicenergistics/util/GuiHelper.java @@ -1,46 +1,12 @@ package thaumicenergistics.util; -import net.minecraft.client.renderer.OpenGlHelper; -import net.minecraft.client.renderer.Tessellator; -import org.lwjgl.opengl.GL11; -import thaumicenergistics.gui.widget.WidgetAspectSlot; public class GuiHelper { - private static void drawGradientRect( float zLevel, int par1, int par2, int par3, int par4, int par5, int par6 ) - { - float f = ( ( par5 >> 24 ) & 0xFF ) / 255.0F; - float f1 = ( ( par5 >> 16 ) & 0xFF ) / 255.0F; - float f2 = ( ( par5 >> 8 ) & 0xFF ) / 255.0F; - float f3 = ( par5 & 0xFF ) / 255.0F; - float f4 = ( ( par6 >> 24 ) & 0xFF ) / 255.0F; - float f5 = ( ( par6 >> 16 ) & 0xFF ) / 255.0F; - float f6 = ( ( par6 >> 8 ) & 0xFF ) / 255.0F; - float f7 = ( par6 & 0xFF ) / 255.0F; - - GL11.glDisable( 3553 ); - GL11.glEnable( 3042 ); - GL11.glDisable( 3008 ); - - OpenGlHelper.glBlendFunc( 770, 771, 1, 0 ); - - GL11.glShadeModel( 7425 ); - - Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.setColorRGBA_F( f1, f2, f3, f ); - tessellator.addVertex( par3, par2, zLevel ); - tessellator.addVertex( par1, par2, zLevel ); - tessellator.setColorRGBA_F( f5, f6, f7, f4 ); - tessellator.addVertex( par1, par4, zLevel ); - tessellator.addVertex( par3, par4, zLevel ); - tessellator.draw(); - - GL11.glShadeModel( 7424 ); - GL11.glDisable( 3042 ); - GL11.glEnable( 3008 ); - GL11.glEnable( 3553 ); - } + public static final int MOUSE_BUTTON_LEFT = 0; + public static final int MOUSE_BUTTON_RIGHT = 1; + public static final int MOUSE_BUTTON_WHEEL = 2; + public static boolean isPointInGuiRegion( int top, int left, int height, int width, int pointX, int pointY, int guiLeft, int guiTop ) { @@ -49,27 +15,7 @@ public class GuiHelper public static boolean isPointInRegion( int top, int left, int height, int width, int pointX, int pointY ) { - return ( pointX >= ( top - 1 ) ) && ( pointX < ( top + width + 1 ) ) && ( pointY >= ( left - 1 ) ) && ( pointY < ( left + height + 1 ) ); - } - - public static boolean renderOverlay( float zLevel, int guiLeft, int guiTop, WidgetAspectSlot aspectSlot, int mouseX, int mouseY ) - { - if ( GuiHelper.isPointInGuiRegion( aspectSlot.getPosX(), aspectSlot.getPosY(), 18, 18, mouseX, mouseY, guiLeft, guiTop ) ) - { - GL11.glDisable( 2896 ); - - GL11.glDisable( 2929 ); - - GuiHelper.drawGradientRect( zLevel, aspectSlot.getPosX() + 1, aspectSlot.getPosY() + 1, aspectSlot.getPosX() + 17, - aspectSlot.getPosY() + 17, -2130706433, -2130706433 ); - - GL11.glEnable( 2896 ); - - GL11.glEnable( 2929 ); - - return true; - } - return false; + return ( pointX >= top ) && ( pointX <= ( top + width ) ) && ( pointY >= left ) && ( pointY <= ( left + height ) ); } public static class ChatColors diff --git a/src/main/java/thaumicenergistics/util/IInventoryUpdateReceiver.java b/src/main/java/thaumicenergistics/util/IInventoryUpdateReceiver.java index 50cfd039..22ecffd7 100644 --- a/src/main/java/thaumicenergistics/util/IInventoryUpdateReceiver.java +++ b/src/main/java/thaumicenergistics/util/IInventoryUpdateReceiver.java @@ -1,6 +1,8 @@ package thaumicenergistics.util; +import net.minecraft.inventory.IInventory; + public interface IInventoryUpdateReceiver { - public void onInventoryChanged(); + public void onInventoryChanged( IInventory sourceInventory ); } diff --git a/src/main/java/thaumicenergistics/util/PrivateInventory.java b/src/main/java/thaumicenergistics/util/PrivateInventory.java index a4a4a196..440a6d2a 100644 --- a/src/main/java/thaumicenergistics/util/PrivateInventory.java +++ b/src/main/java/thaumicenergistics/util/PrivateInventory.java @@ -21,8 +21,10 @@ public class PrivateInventory implements IInventory this.stackLimit = stackLimit; } - public void setReceiver( IInventoryUpdateReceiver receiver ) + public PrivateInventory( String customName, int size, int stackLimit , IInventoryUpdateReceiver receiver ) { + this( customName, size, stackLimit ); + this.receiver = receiver; } @@ -147,7 +149,7 @@ public class PrivateInventory implements IInventory { if ( this.receiver != null ) { - this.receiver.onInventoryChanged(); + this.receiver.onInventoryChanged( this ); } } @@ -204,5 +206,11 @@ public class PrivateInventory implements IInventory return nbtList; } + + // TODO: Remove me + public void setReceiver( IInventoryUpdateReceiver receiver ) + { + this.receiver = receiver; + } } diff --git a/src/main/resources/assets/thaumicenergistics/lang/en_US.lang b/src/main/resources/assets/thaumicenergistics/lang/en_US.lang index fc9c6603..978b2cbc 100644 --- a/src/main/resources/assets/thaumicenergistics/lang/en_US.lang +++ b/src/main/resources/assets/thaumicenergistics/lang/en_US.lang @@ -15,6 +15,7 @@ thaumicenergistics.aeparts.essentia.ExportBus.name=Essentia Export Bus thaumicenergistics.aeparts.essentia.levelemitter.name=Essentia Level Emitter thaumicenergistics.aeparts.essentia.StorageBus.name=Essentia Storage Bus thaumicenergistics.aeparts.essentia.terminal.name=Essentia Terminal +thaumicenergistics.aeparts.arcane.crafting.terminal.name=Arcane Crafting Terminal #Items thaumicenergistics.item.essentia.cell.1k.name=ME 1k Essentia Storage Cell @@ -28,10 +29,11 @@ thaumicenergistics.item.storage.component.16k.name=ME 16k Essentia Storage Compo thaumicenergistics.item.storage.component.64k.name=ME 64k Essentia Storage Component thaumicenergistics.item.essentia.cell.inventory=Essentia Cell - #Tooltips thaumicenergistics.tooltip.amount=Amount thaumicenergistics.tooltip.aspect=Aspect thaumicenergistics.tooltip.essentia.cell.bytes=%d of %d bytes used. thaumicenergistics.tooltip.essentia.cell.types=%d of %d essentia types stored. +#GUI +thaumicenergistics.gui.arcane.crafting.terminal.title=Arcane Terminal \ No newline at end of file diff --git a/src/main/resources/assets/thaumicenergistics/textures/blocks/essentia.provider.overlay.inactive.png b/src/main/resources/assets/thaumicenergistics/textures/blocks/essentia.provider.overlay.inactive.png new file mode 100644 index 0000000000000000000000000000000000000000..86299dba18a62f626bb24d33aac2fefac046ce35 GIT binary patch literal 2805 zcmVKLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#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-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0000WNklZU6uP|NjF33?KjjwT-y_00000NkvXX Hu0mjfBK9$& literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/thaumicenergistics/textures/blocks/essentia.provider.png b/src/main/resources/assets/thaumicenergistics/textures/blocks/essentia.provider.png index 964a4f3a4870d23bec28830805a06f47c51945e8..82d9a656a51300c5b998cd7d218d471c6326e326 100644 GIT binary patch delta 1682 zcmV;D25tGSCA=cAzY2c_XGugsRCwB)mtSZc*A>QpJ9B4tXQbVg64zBg{ujdrOQo*e zSlI>>Z>_WjyQUAV)-k5w;2IoK@LQ>yhxEk_M5GU;@`EARF7&~Yt2~&JHZ8FPsiR1W zsi2mdnpBpoXw{9ZKfCLl*_qKyABLG|SCXae2g8M#bMKrvbIyNvz7y%{>hb`N9616& zV`C$hW#Kpu073}Lu3+)`o!Sg&!(?nHOWLZX4RT>%^ z0I+SFQmI5TnWU$u2LK5molfJrE&!%!B1sZL2ml<%L6RhF+s1X>s%s?zha-^)mSv&q zIzk9!S;lo;EX#kQR4S23B#-R6-?Z&gQAC9Ci3mH=P*hIV5TkyqR}X}Z6l)5C;)%iY!-me$0qsP(4WcA`(d3$ z;>|P185kI-I^egzxxmXuPcroWH7d$3Ui(@9hA&O0)2kz(sw$Es(c9Y_Mj$^gk$N`4 z@V$qOJg8928KHv#cI?>6;LYE&drv#X((3262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2QsQ==n>dd7-S2yF9EX8TgA5IgaPX5B5uN<|CpeCS=eYzyu;P2P)}|est{4P? z>CIV|wN%kEb6pqLb?NKtqf{!9Bnex`MtJmB5Al6`}O%E&=B$rcGc?hIZ3fFbbJg_uDmiP0e_VwX?ZF*qoy2%sg zsXh1jcPcAG%egAfW4(V=Mqf%~tfU8)uWeML6_r)4EB5T!(*lr7@_Zo48EUxzS#DeI z*wCg2mao59S=HM-kn0K=1c4d3gb*mDxYi$_v$K;lP0?DL4wq*zaFHI^c;$6y-69wv z#ATJ$?%lgvWhkXI!$O*-D5cCSXWKTO=V9A6VHmcFj7dB7df>o;11A0h0|RZNxl)Sm?rt2%G2>azoJ*N9r*hYITVDAFOfFJg*Cop` k>h(IMQi<{LaRB~5079{_^!3W$jQ{`u07*qoM6N<$g4G8D1^@s6 diff --git a/src/main/resources/assets/thaumicenergistics/textures/blocks/infusion.provider.overlay.inactive.png b/src/main/resources/assets/thaumicenergistics/textures/blocks/infusion.provider.overlay.inactive.png new file mode 100644 index 0000000000000000000000000000000000000000..86299dba18a62f626bb24d33aac2fefac046ce35 GIT binary patch literal 2805 zcmVKLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 z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c25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0000WNklZU6uP|NjF33?KjjwT-y_00000NkvXX Hu0mjfBK9$& literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.overlay1.png b/src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.overlay1.png new file mode 100644 index 0000000000000000000000000000000000000000..8e518dc60d58064fff2af93811d8357d96d299f3 GIT binary patch literal 3146 zcmV-Q47Kx#P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIv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4O$^JcHLmM!BP?## zAfOX=>3;bU6eX7qOixPI*Et<_H09tFL+^jSj4feWwWKmMd zKol*!x$9ZaS6~5AADEC5YYbVG@cZFsHG?7~|6`y2WB|bE({YI~ycjdO7=!-1TU(>& zc^G2=$n(6M9mlDCv5in;`Cq+=kVOgm9}XCtZ(0bhPdWMWzQh@SJ|T;emk~T)p;KL+ z(=@H1t^Taoa#jf99$4embQhG kbRJu1t+yTgx8L|Y0AAIZx1fZv!vFvP07*qoM6N<$f-mIP$N&HU literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.overlay2.png b/src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.overlay2.png new file mode 100644 index 0000000000000000000000000000000000000000..dbc34b3c669938b6ef03d90f30a9998c798ffe39 GIT binary patch literal 2849 zcmV++3*PjJP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE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q2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z0000nNklYIc3}B>*7e);jHDCxQWdHyG0RR63 Y0DTSz9Rvee>Hq)$07*qoM6N<$f`o52F8}}l literal 0 HcmV?d00001 diff --git a/src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.side.png b/src/main/resources/assets/thaumicenergistics/textures/blocks/parts/arcane.crafting.side.png new file mode 100644 index 0000000000000000000000000000000000000000..a4e4401b3f54e5edc425678880178445228c7784 GIT binary patch literal 3402 zcmV-Q4Yl%#P)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B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<9giV}?R!@e%W5?o+${w>$d%*@sc| zQBkK*{P?XSYf=8mv->8qwW^*L0A3sbU;_ZyKRvUn06Y)^;EM$SQt<%LVP2ZIC3=o9Z)LWTD=ATZ)V`*coVhYD`Yxn@EUsV182dg716 zoKvsT7;K&tkj=zOxz+EVuF@29WFFKhVA6`Gchl7Cj?LokE6(PoEzQ)#&L7Wp={O3+ zbrqk)K0ZM2x7z0}qrO}rTwhpd;(GqNXN!@Fs;l%-J)_6j$2EI39s_sI|NYpJd$e!9 zYq^YG*@7R`ozBRuls!@b9@D|eX<9>zT}QLt04oZv6*)7Op-G#ZMwdbW0up5D1fM?- zC;{T^IlF^Hf!z~x{JOFIM`3pp8DY?LC7&7Zk1-UV$ z6}%DXnaaj$WgNRMTC=}|_GD}emWFNbynhod759^ZKbvhzD6pI!obtdf{sjULTZS!2 ztDu7YA>g;8eseegv2e|{?_vagZQ?{VhI%fCyrNm zn|2Jw4p{r0pa*rkYg%!Db=CzyC?Qk`pooCFIGhUQcmvcGzkn&a&s9Ylaa~K4=Gtf= z&4EWaR9jy!w?lC>m&W5xfM5!{4fzL?d{T_CQv^iFXnT)1nhy&(qj4<6DDb{Qe zXA}J|sr{!@<}*Cx5E$rZX7KCg@g)yGTMlpOdrS3M3H`Izrd9@5mz6Qt;{RjszrbNw z%ibV<* G{{IJ?r$@g4 literal 0 HcmV?d00001 diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 77600f60..81150507 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "thaumicenergistics", "name": "Thaumic Energistics", "description": "The digital age could use some magic", - "version": "0.2.1a", + "version": "0.3.0a", "mcversion": "1.7.2", "url": "", "updateUrl": "",