diff options
author | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-07 16:24:37 +0000 |
---|---|---|
committer | Alkalus <3060479+draknyte1@users.noreply.github.com> | 2022-01-07 16:24:37 +0000 |
commit | 53da73a35860acd285baa0ccab5aef4ff4f6bd98 (patch) | |
tree | 8a8ed6df5de3a8a94884e182a59122e87bc9f222 /src/main/java/gtPlusPlus | |
parent | d579f2d2b41922dbee4c2146833b257bfeab4ecd (diff) | |
download | GT5-Unofficial-53da73a35860acd285baa0ccab5aef4ff4f6bd98.tar.gz GT5-Unofficial-53da73a35860acd285baa0ccab5aef4ff4f6bd98.tar.bz2 GT5-Unofficial-53da73a35860acd285baa0ccab5aef4ff4f6bd98.zip |
Rewrote and readded Bronze/Advanced Workbenches using GT Meta Tile system.
Diffstat (limited to 'src/main/java/gtPlusPlus')
21 files changed, 1227 insertions, 1625 deletions
diff --git a/src/main/java/gtPlusPlus/core/block/ModBlocks.java b/src/main/java/gtPlusPlus/core/block/ModBlocks.java index fdbb2bdf5b..a716366601 100644 --- a/src/main/java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/main/java/gtPlusPlus/core/block/ModBlocks.java @@ -13,11 +13,22 @@ import gtPlusPlus.core.block.general.PlayerDoors; import gtPlusPlus.core.block.general.antigrief.BlockWitherProof; import gtPlusPlus.core.block.general.redstone.BlockGenericRedstoneDetector; import gtPlusPlus.core.block.general.redstone.BlockGenericRedstoneTest; -import gtPlusPlus.core.block.machine.*; +import gtPlusPlus.core.block.machine.CircuitProgrammer; +import gtPlusPlus.core.block.machine.DecayablesChest; +import gtPlusPlus.core.block.machine.EggBox; +import gtPlusPlus.core.block.machine.FishTrap; +import gtPlusPlus.core.block.machine.HeliumGenerator; +import gtPlusPlus.core.block.machine.Machine_ModularityTable; +import gtPlusPlus.core.block.machine.Machine_PestKiller; +import gtPlusPlus.core.block.machine.Machine_PooCollector; +import gtPlusPlus.core.block.machine.Machine_ProjectTable; +import gtPlusPlus.core.block.machine.Machine_RoundRobinator; +import gtPlusPlus.core.block.machine.Machine_SuperJukebox; +import gtPlusPlus.core.block.machine.Machine_TradeTable; +import gtPlusPlus.core.block.machine.VolumetricFlaskSetter; import gtPlusPlus.core.block.machine.bedrock.Mining_Head_Fake; import gtPlusPlus.core.block.machine.bedrock.Mining_Pipe_Fake; import gtPlusPlus.core.fluids.FluidRegistryHandler; -import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import net.minecraft.block.Block; import net.minecraft.block.material.Material; @@ -110,8 +121,6 @@ public final class ModBlocks { FluidRegistryHandler.registerFluids(); //Workbench - blockWorkbench = new Machine_Workbench().setHardness(1.5F); - blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F); blockHeliumGenerator = new HeliumGenerator(); blockFirePit = new FirePit(); blockFishTrap = new FishTrap(); diff --git a/src/main/java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/main/java/gtPlusPlus/core/block/machine/Machine_Workbench.java deleted file mode 100644 index 5c08612042..0000000000 --- a/src/main/java/gtPlusPlus/core/block/machine/Machine_Workbench.java +++ /dev/null @@ -1,152 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.Optional; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.EnumCreatureType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; -import net.minecraft.world.World; - -import gtPlusPlus.GTplusplus; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.util.minecraft.PlayerUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; -import ic2.core.item.tool.ItemToolWrench; - -@Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO") -public class Machine_Workbench extends BlockContainer -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - @SuppressWarnings("deprecation") - public Machine_Workbench() - { - super(Material.iron); - this.setBlockName("blockWorkbenchGT"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockWorkbenchGT"); - LanguageRegistry.addName(this, "Bronze Workbench"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_top_crafting"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "bronze_side_cabinet"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - - ItemStack heldItem = null; - if (world.isRemote){ - heldItem = PlayerUtils.getItemStackInPlayersHand(); - } - - boolean holdingWrench = false; - - if (heldItem != null){ - holdingWrench = isWrench(heldItem); - } - - if (world.isRemote) { - return true; - } - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityWorkbench)) - { - if (!holdingWrench){ - player.openGui(GTplusplus.instance, 3, world, x, y, z); - return true; - } - Logger.INFO("Holding a Wrench, doing wrench things instead."); - } - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityWorkbench(); - } - - public static boolean isWrench(final ItemStack item){ - if (item.getItem() instanceof ItemToolWrench){ - return true; - } - if (LoadedMods.BuildCraft){ - return checkBuildcraftWrench(item); - } - if (LoadedMods.EnderIO){ - return checkEnderIOWrench(item); - } - return false; - } - - @Optional.Method(modid = "EnderIO") - private static boolean checkEnderIOWrench(final ItemStack item) { - if (ReflectionUtils.doesClassExist("crazypants.enderio.api.tool.ITool")) { - Class<?> wrenchClass; - wrenchClass = ReflectionUtils.getClass("crazypants.enderio.api.tool.ITool"); - if (wrenchClass.isInstance(item.getItem())) { - return true; - } - } - return false; - } - - @Optional.Method(modid = "Buildcraft") - private static boolean checkBuildcraftWrench(final ItemStack item) { - if (ReflectionUtils.doesClassExist("buildcraft.api.tools.IToolWrench")) { - Class<?> wrenchClass; - wrenchClass = ReflectionUtils.getClass("buildcraft.api.tools.IToolWrench"); - if (wrenchClass.isInstance(item.getItem())) { - return true; - } - } - return false; - } - - @Override - public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, final int z) { - return false; - } - -}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java b/src/main/java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java deleted file mode 100644 index af2f9f82e0..0000000000 --- a/src/main/java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java +++ /dev/null @@ -1,111 +0,0 @@ -package gtPlusPlus.core.block.machine; - -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.LanguageRegistry; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.block.BlockContainer; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.World; - -import gtPlusPlus.core.creative.AddToCreativeTab; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; - -public class Machine_WorkbenchAdvanced extends BlockContainer -{ - @SideOnly(Side.CLIENT) - private IIcon textureTop; - @SideOnly(Side.CLIENT) - private IIcon textureBottom; - @SideOnly(Side.CLIENT) - private IIcon textureFront; - - @SuppressWarnings("deprecation") - public Machine_WorkbenchAdvanced() - { - super(Material.iron); - this.setBlockName("blockWorkbenchGTAdvanced"); - this.setCreativeTab(AddToCreativeTab.tabMachines); - GameRegistry.registerBlock(this, "blockWorkbenchGTAdvanced"); - LanguageRegistry.addName(this, "Advanced Workbench"); - - } - - /** - * Gets the block's texture. Args: side, meta - */ - @Override - @SideOnly(Side.CLIENT) - public IIcon getIcon(final int p_149691_1_, final int p_149691_2_) - { - return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront)); - } - - @Override - @SideOnly(Side.CLIENT) - public void registerBlockIcons(final IIconRegister p_149651_1_) - { - this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting"); - this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top"); - } - - /** - * Called upon block activation (right click on the block.) - */ - @Override - public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz) - { - - /*final ItemStack heldItem = PlayerUtils.getItemStackInPlayersHand(player); - if (world.isRemote) { - return true; - } - boolean holdingWrench = false; - - if (heldItem != null){ - if (heldItem.getItem() instanceof ItemToolWrench){ - holdingWrench = true; - } - else if (heldItem.getItem() instanceof IToolWrench){ - holdingWrench = true; - } - else if (heldItem.getItem() instanceof ITool){ - holdingWrench = true; - } - else if (heldItem.getItem() instanceof GT_MetaGenerated_Tool){ - GT_MetaGenerated_Tool testTool = (GT_MetaGenerated_Tool) heldItem.getItem(); - if (testTool.canWrench(player, x, y, z)){ - holdingWrench = true; - } - } - else { - holdingWrench = false; - } - } - - - final TileEntity te = world.getTileEntity(x, y, z); - if ((te != null) && (te instanceof TileEntityWorkbenchAdvanced)) - { - if (!holdingWrench){ - player.openGui(GTplusplus.instance, 4, world, x, y, z); - return true; - } - Utils.LOG_INFO("Holding a Wrench, doing wrench things instead."); - }*/ - return false; - } - - @Override - public TileEntity createNewTileEntity(final World world, final int p_149915_2_) { - return new TileEntityWorkbenchAdvanced(128000, 2); - } -}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/container/Container_Workbench.java b/src/main/java/gtPlusPlus/core/container/Container_Workbench.java deleted file mode 100644 index 55ef1a3d0c..0000000000 --- a/src/main/java/gtPlusPlus/core/container/Container_Workbench.java +++ /dev/null @@ -1,413 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.world.World; - -import gregtech.api.gui.GT_Slot_Holo; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.interfaces.IItemBlueprint; -import gtPlusPlus.core.inventories.InventoryWorkbenchChest; -import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; -import gtPlusPlus.core.inventories.InventoryWorkbenchTools; -import gtPlusPlus.core.item.general.ItemBlueprint; -import gtPlusPlus.core.slots.*; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class Container_Workbench extends Container { - - protected TileEntityWorkbench tile_entity; - public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); - public final InventoryWorkbenchChest inventoryChest; - public final InventoryWorkbenchTools inventoryTool; - public final InventoryWorkbenchHoloSlots inventoryHolo; - //public final InventoryWorkbenchHoloCrafting inventoryCrafting; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static int HoloSlotNumber = 6; - public static int InputSlotNumber = 0; //Number of Slots in the Crafting Grid - public static int StorageSlotNumber = 16; //Number of slots in storage area - public static int ToolSlotNumber = 5; // Number of slots in the tool area up top - public static int InOutputSlotNumber = InputSlotNumber + StorageSlotNumber + ToolSlotNumber + HoloSlotNumber; //Same plus Output Slot - public static int InventorySlotNumber = 36; //Inventory Slots (Inventory and Hotbar) - public static int InventoryOutSlotNumber = InventorySlotNumber + 1; //Inventory Slot Number + Output - public static int FullSlotNumber = InventorySlotNumber + InOutputSlotNumber; //All slots - - private final int slotOutput = 0; - private final int[] slotHolo = new int[5]; - private final int[] slotCrafting = new int[9]; - private final int[] slotStorage = new int[16]; - private final int[] slotTools = new int[5]; - - public void moveCraftingToChest(){ - //Check Chest Space - for (int i=0;i<9;i++){ - if (this.craftMatrix.getStackInSlot(i) != null){ - for (int r=0;r<16;r++){ - if ((this.inventoryChest.getStackInSlot(r) == null) || ((this.inventoryChest.getStackInSlot(r).getItem() == this.craftMatrix.getStackInSlot(i).getItem()) && ((64-this.craftMatrix.getStackInSlot(i).stackSize) <= (64-this.craftMatrix.getStackInSlot(i).stackSize)))){ - this.inventoryChest.setInventorySlotContents(r, this.craftMatrix.getStackInSlot(i)); - this.craftMatrix.setInventorySlotContents(i, null); - break; - } - } - } - } - //For Each Space or already existing itemstack, move one itemstack or fill current partial stack - //Remove old itemstack or partial stack from crafting grid - } - - public void moveChestToCrafting(){ - //Check Crafting items and slots - for (int i=0;i<9;i++){ - if ((this.craftMatrix.getStackInSlot(i) == null) || (this.craftMatrix.getStackInSlot(i).stackSize > 0)){ - for (int r=0;r<16;r++){ - if (this.inventoryChest.getStackInSlot(r) != null){ - this.craftMatrix.setInventorySlotContents(i, this.craftMatrix.getStackInSlot(r)); - this.inventoryChest.setInventorySlotContents(r, null); - } - } - } - } - //For Each already existing itemstack, fill current partial stack - //Remove partial stack from chest area - } - - - public Container_Workbench(final InventoryPlayer inventory, final TileEntityWorkbench tile){ - this.tile_entity = tile; - this.inventoryChest = tile.inventoryChest; - this.inventoryTool = tile.inventoryTool; - this.inventoryHolo = tile.inventoryHolo; - //this.inventoryCrafting = tile.inventoryCrafting; - - int var6; - int var7; - this.worldObj = tile.getWorldObj(); - this.posX = tile.xCoord; - this.posY = tile.yCoord; - this.posZ = tile.zCoord; - - int o=0; - - //Output slot - this.addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); - //Util Slots - this.addSlotToContainer(new SlotBlueprint(this.inventoryHolo, 1, 136, 28)); //Blueprint - this.addSlotToContainer(new SlotNoInput(this.inventoryHolo, 2, 154, 28)); //Hopper - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 3, 154, 64, false, false, 64)); //Parking - //Holo Slots - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 4, 154, 46, false, false, 1)); - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 5, 136, 46, false, false, 1)); - - for (int i=1; i<6; i++){ - this.slotHolo[o] = o+1; - o++; - } - - o=0; - - this.updateCraftingMatrix(); - - //Crafting Grid - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 3; ++var7) - { - //this.addSlotToContainer(new Slot(this.craftMatrix, var7 + (var6 * 3), 82 + (var7 * 18), 28 + (var6 * 18))); - - /*if (this.inventoryCrafting.getStackInSlot(o) != null){ - this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); - this.inventoryCrafting.setInventorySlotContents(o, null); - } */ - this.slotCrafting[o] = o+6; - o++; - } - } - - o=0; - - //Storage Side - for (var6 = 0; var6 < 4; ++var6) - { - for (var7 = 0; var7 < 4; ++var7) - { - //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new Slot(this.inventoryChest, var7 + (var6 * 4), 8 + (var7 * 18), 7 + (var6 * 18))); - this.slotStorage[o] = o+15; - o++; - } - } - - o=0; - - //Tool Slots - for (var6 = 0; var6 < 1; ++var6) - { - for (var7 = 0; var7 < 5; ++var7) - { - this.addSlotToContainer(new SlotGtTool(this.inventoryTool, var7 + (var6 * 3), 82 + (var7 * 18), 8 + (var6 * 18))); - this.slotTools[o] = o+31; - o++; - } - } - - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - //Player Hotbar - for (var6 = 0; var6 < 9; ++var6) - { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - this.onCraftMatrixChanged(this.craftMatrix); - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ - - if (!aPlayer.worldObj.isRemote){ - if ((aSlotIndex == 999) || (aSlotIndex == -999)){ - //Utils.LOG_WARNING("??? - "+aSlotIndex); - } - - if (aSlotIndex == this.slotOutput){ - Logger.WARNING("Player Clicked on the output slot"); - //TODO - } - - for (final int x : this.slotHolo){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); - if (x == 1){ - Logger.WARNING("Player Clicked Blueprint slot in the Holo Grid"); - } - else if (x == 2){ - Logger.WARNING("Player Clicked Right Arrow slot in the Holo Grid"); - if (this.inventoryHolo.getStackInSlot(1) != null){ - Logger.WARNING("Found an ItemStack."); - if (this.inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ - Logger.WARNING("Found a blueprint."); - final ItemStack tempBlueprint = this.inventoryHolo.getStackInSlot(1); - final ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); - if ((this.inventoryHolo.getStackInSlot(0) != null) && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Logger.WARNING("Output slot was not empty."); - Logger.WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); - tempItemBlueprint.setBlueprint(this.inventoryHolo.getStackInSlot(1), this.craftMatrix, this.inventoryHolo.getStackInSlot(0)); - final ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); - this.inventoryHolo.setInventorySlotContents(1, newTempBlueprint); - Logger.WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); - } - else { - if (tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Logger.WARNING("Blueprint already holds a recipe."); - } - else { - Logger.WARNING("Output slot was empty."); - } - } - } - else { - Logger.WARNING("ItemStack found was not a blueprint."); - } - } - else { - Logger.WARNING("No ItemStack found in Blueprint slot."); - } - } - else if (x == 3){ - Logger.WARNING("Player Clicked Big [P] slot in the Holo Grid"); - } - else if (x == 4){ - Logger.WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); - } - else if (x == 5){ - Logger.WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); - } - } - } - - for (final int x : this.slotCrafting){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); - } - } - for (final int x : this.slotStorage){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); - } - } - for (final int x : this.slotTools){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); - } - } - } - //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - private void updateCraftingMatrix() { - for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { - //this.craftMatrix.setInventorySlotContents(i, this.tile_entity.inventoryCrafting.getStackInSlot(i)); - } - } - - @Override - public void onCraftMatrixChanged(final IInventory iiventory) { - this.tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) - { - super.onContainerClosed(par1EntityPlayer); - this.saveCraftingMatrix(); - } - - private void saveCraftingMatrix() { - for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { - //this.tile_entity.inventoryCrafting.setInventorySlotContents(i, this.craftMatrix.getStackInSlot(i)); - } - } - - - - - /*@Override - public void onCraftMatrixChanged(IInventory par1IInventory){ - //Custom Recipe Handler - //craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj)); - - //Vanilla CraftingManager - Utils.LOG_WARNING("checking crafting grid for a valid output."); - ItemStack temp = CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj); - if (temp != null){ - Utils.LOG_WARNING("Output found. "+temp.getDisplayName()+" x"+temp.stackSize); - craftResult.setInventorySlotContents(slotOutput, temp); - } - else { - Utils.LOG_WARNING("No Valid output found."); - craftResult.setInventorySlotContents(slotOutput, null); - } - }*/ - - /*@Override - public void onContainerClosed(EntityPlayer par1EntityPlayer) - { - for (int o=0; o<craftMatrix.getSizeInventory(); o++){ - this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); - this.craftMatrix.setInventorySlotContents(o, null); - }*/ - - //super.onContainerClosed(par1EntityPlayer); - - /*if (worldObj.isRemote) - { - return; - } - - for (int i = 0; i < InputSlotNumber; i++) - { - ItemStack itemstack = craftMatrix.getStackInSlotOnClosing(i); - - if (itemstack != null) - { - par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); - } - }*/ - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockWorkbench){ - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) - { - ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) - { - return null; - } - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack)null); - } - else - { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) - { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - //Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return (p_94530_2_.inventory != this.tile_entity.inventoryCraftResult) && super.func_94530_a(p_94530_1_, p_94530_2_); - } - - -}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java b/src/main/java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java deleted file mode 100644 index dc499c570f..0000000000 --- a/src/main/java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java +++ /dev/null @@ -1,377 +0,0 @@ -package gtPlusPlus.core.container; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.*; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.world.World; - -import gregtech.api.gui.GT_Slot_Holo; - -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.interfaces.IItemBlueprint; -import gtPlusPlus.core.inventories.*; -import gtPlusPlus.core.item.general.ItemBlueprint; -import gtPlusPlus.core.slots.*; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class Container_WorkbenchAdvanced extends Container { - - protected TileEntityWorkbenchAdvanced tile_entity; - public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); - public final InventoryWorkbenchChest inventoryChest; - public final InventoryWorkbenchToolsElectric inventoryTool; - public final InventoryWorkbenchHoloSlots inventoryHolo; - public final InventoryWorkbenchHoloCrafting inventoryCrafting; - - private final World worldObj; - private final int posX; - private final int posY; - private final int posZ; - - public static int HoloSlotNumber = 6; - public static int InputSlotNumber = 9; //Number of Slots in the Crafting Grid - public static int StorageSlotNumber = 16; //Number of slots in storage area - public static int ToolSlotNumber = 5; // Number of slots in the tool area up top - public static int InOutputSlotNumber = InputSlotNumber + StorageSlotNumber + ToolSlotNumber + HoloSlotNumber; //Same plus Output Slot - public static int InventorySlotNumber = 36; //Inventory Slots (Inventory and Hotbar) - public static int InventoryOutSlotNumber = InventorySlotNumber + 1; //Inventory Slot Number + Output - public static int FullSlotNumber = InventorySlotNumber + InOutputSlotNumber; //All slots - - private final int slotOutput = 0; - private final int[] slotHolo = new int[5]; - private final int[] slotCrafting = new int[9]; - private final int[] slotStorage = new int[16]; - private final int[] slotTools = new int[5]; - - public Container_WorkbenchAdvanced(final InventoryPlayer inventory, final TileEntityWorkbenchAdvanced tile){ - this.tile_entity = tile; - this.inventoryChest = tile.inventoryChest; - this.inventoryTool = tile.inventoryTool; - this.inventoryHolo = tile.inventoryHolo; - this.inventoryCrafting = tile.inventoryCrafting; - - int var6; - int var7; - this.worldObj = tile.getWorldObj(); - this.posX = tile.xCoord; - this.posY = tile.yCoord; - this.posZ = tile.zCoord; - - int o=0; - - //Output slot - this.addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64)); - //Util Slots - this.addSlotToContainer(new SlotBlueprint(this.inventoryHolo, 1, 136, 28)); //Blueprint - this.addSlotToContainer(new SlotNoInput(this.inventoryHolo, 2, 154, 28)); //Hopper - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 3, 154, 64, false, false, 64)); //Parking - //Holo Slots - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 4, 154, 46, false, false, 1)); - this.addSlotToContainer(new GT_Slot_Holo(this.inventoryHolo, 5, 136, 46, false, false, 1)); - - for (int i=1; i<6; i++){ - this.slotHolo[o] = o+1; - o++; - } - - o=0; - - this.updateCraftingMatrix(); - - //Crafting Grid - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 3; ++var7) - { - this.addSlotToContainer(new Slot(this.craftMatrix, var7 + (var6 * 3), 82 + (var7 * 18), 28 + (var6 * 18))); - - /*if (this.inventoryCrafting.getStackInSlot(o) != null){ - this.craftMatrix.setInventorySlotContents(o, inventoryCrafting.getStackInSlot(o)); - this.inventoryCrafting.setInventorySlotContents(o, null); - } */ - this.slotCrafting[o] = o+6; - o++; - } - } - - o=0; - - //Storage Side - for (var6 = 0; var6 < 4; ++var6) - { - for (var7 = 0; var7 < 4; ++var7) - { - //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18)); - this.addSlotToContainer(new Slot(this.inventoryChest, var7 + (var6 * 4), 8 + (var7 * 18), 7 + (var6 * 18))); - this.slotStorage[o] = o+15; - o++; - } - } - - o=0; - - //Tool Slots - for (var6 = 0; var6 < 1; ++var6) - { - for (var7 = 0; var7 < 5; ++var7) - { - this.addSlotToContainer(new SlotGtToolElectric(this.inventoryTool, var7 + (var6 * 3), 82 + (var7 * 18), 8 + (var6 * 18), 3, false)); - this.slotTools[o] = o+31; - o++; - } - } - - //Player Inventory - for (var6 = 0; var6 < 3; ++var6) - { - for (var7 = 0; var7 < 9; ++var7) - { - this.addSlotToContainer(new Slot(inventory, var7 + (var6 * 9) + 9, 8 + (var7 * 18), 84 + (var6 * 18))); - } - } - - //Player Hotbar - for (var6 = 0; var6 < 9; ++var6) - { - this.addSlotToContainer(new Slot(inventory, var6, 8 + (var6 * 18), 142)); - } - - this.onCraftMatrixChanged(this.craftMatrix); - - } - - @Override - public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){ - - if (!aPlayer.worldObj.isRemote){ - if ((aSlotIndex == 999) || (aSlotIndex == -999)){ - //Utils.LOG_WARNING("??? - "+aSlotIndex); - } - - if (aSlotIndex == this.slotOutput){ - Logger.WARNING("Player Clicked on the output slot"); - //TODO - } - - for (final int x : this.slotHolo){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); - if (x == 1){ - Logger.WARNING("Player Clicked Blueprint slot in the Holo Grid"); - } - else if (x == 2){ - Logger.WARNING("Player Clicked Right Arrow slot in the Holo Grid"); - if (this.inventoryHolo.getStackInSlot(1) != null){ - Logger.WARNING("Found an ItemStack."); - if (this.inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){ - Logger.WARNING("Found a blueprint."); - final ItemStack tempBlueprint = this.inventoryHolo.getStackInSlot(1); - final ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem(); - if ((this.inventoryHolo.getStackInSlot(0) != null) && !tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Logger.WARNING("Output slot was not empty."); - Logger.WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one."); - tempItemBlueprint.setBlueprint(this.inventoryHolo.getStackInSlot(1), this.craftMatrix, this.inventoryHolo.getStackInSlot(0)); - final ItemStack newTempBlueprint = ItemUtils.getSimpleStack(tempItemBlueprint); - this.inventoryHolo.setInventorySlotContents(1, newTempBlueprint); - Logger.WARNING(ItemUtils.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint))); - } - else { - if (tempItemBlueprint.hasBlueprint(tempBlueprint)){ - Logger.WARNING("Blueprint already holds a recipe."); - } - else { - Logger.WARNING("Output slot was empty."); - } - } - } - else { - Logger.WARNING("ItemStack found was not a blueprint."); - } - } - else { - Logger.WARNING("No ItemStack found in Blueprint slot."); - } - } - else if (x == 3){ - Logger.WARNING("Player Clicked Big [P] slot in the Holo Grid"); - } - else if (x == 4){ - Logger.WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid"); - } - else if (x == 5){ - Logger.WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid"); - } - } - } - - for (final int x : this.slotCrafting){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid"); - } - } - for (final int x : this.slotStorage){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid"); - } - } - for (final int x : this.slotTools){ - if (aSlotIndex == x){ - Logger.WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid"); - } - } - } - //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid"); - return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); - } - - private void updateCraftingMatrix() { - for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { - this.craftMatrix.setInventorySlotContents(i, this.tile_entity.inventoryCrafting.getStackInSlot(i)); - } - } - - @Override - public void onCraftMatrixChanged(final IInventory iiventory) { - this.tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); - } - - @Override - public void onContainerClosed(final EntityPlayer par1EntityPlayer) - { - super.onContainerClosed(par1EntityPlayer); - this.saveCraftingMatrix(); - } - - private void saveCraftingMatrix() { - for (int i = 0; i < this.craftMatrix.getSizeInventory(); i++) { - this.tile_entity.inventoryCrafting.setInventorySlotContents(i, this.craftMatrix.getStackInSlot(i)); - } - } - - - - - /*@Override - public void onCraftMatrixChanged(IInventory par1IInventory){ - //Custom Recipe Handler - //craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj)); - - //Vanilla CraftingManager - Utils.LOG_WARNING("checking crafting grid for a valid output."); - ItemStack temp = CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj); - if (temp != null){ - Utils.LOG_WARNING("Output found. "+temp.getDisplayName()+" x"+temp.stackSize); - craftResult.setInventorySlotContents(slotOutput, temp); - } - else { - Utils.LOG_WARNING("No Valid output found."); - craftResult.setInventorySlotContents(slotOutput, null); - } - }*/ - - /*@Override - public void onContainerClosed(EntityPlayer par1EntityPlayer) - { - for (int o=0; o<craftMatrix.getSizeInventory(); o++){ - this.inventoryCrafting.setInventorySlotContents(o, craftMatrix.getStackInSlot(o)); - this.craftMatrix.setInventorySlotContents(o, null); - }*/ - - //super.onContainerClosed(par1EntityPlayer); - - /*if (worldObj.isRemote) - { - return; - } - - for (int i = 0; i < InputSlotNumber; i++) - { - ItemStack itemstack = craftMatrix.getStackInSlotOnClosing(i); - - if (itemstack != null) - { - par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); - } - }*/ - - @Override - public boolean canInteractWith(final EntityPlayer par1EntityPlayer){ - if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockWorkbench){ - return false; - } - - return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D; - } - - - @Override - public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2) - { - ItemStack var3 = null; - final Slot var4 = (Slot)this.inventorySlots.get(par2); - - if ((var4 != null) && var4.getHasStack()) - { - final ItemStack var5 = var4.getStack(); - var3 = var5.copy(); - - if (par2 == 0) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true)) - { - return null; - } - - var4.onSlotChange(var5, var3); - } - else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber)) - { - if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false)) - { - return null; - } - } - else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber)) - { - if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false)) - { - return null; - } - } - else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false)) - { - return null; - } - - if (var5.stackSize == 0) - { - var4.putStack((ItemStack)null); - } - else - { - var4.onSlotChanged(); - } - - if (var5.stackSize == var3.stackSize) - { - return null; - } - - var4.onPickupFromSlot(par1EntityPlayer, var5); - } - - return var3; - } - - //Can merge Slot - @Override - public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) { - return (p_94530_2_.inventory != this.tile_entity.inventoryCraftResult) && super.func_94530_a(p_94530_1_, p_94530_2_); - } - - -}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/gui/machine/GUI_Workbench.java b/src/main/java/gtPlusPlus/core/gui/machine/GUI_Workbench.java deleted file mode 100644 index 861c2ba6b6..0000000000 --- a/src/main/java/gtPlusPlus/core/gui/machine/GUI_Workbench.java +++ /dev/null @@ -1,81 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_Workbench; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; - -@SideOnly(Side.CLIENT) -public class GUI_Workbench extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/BronzeCraftingTable.png"); - - public boolean moveItemsToChest = false; - public boolean moveItemsToCrafting = false; - - public GUI_Workbench(final InventoryPlayer player_inventory, final TileEntityWorkbench tile){ - super(new Container_Workbench(player_inventory, tile)); - } - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); - //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - - } - - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - - - //This method is called when the Gui is first called! - @Override - public void initGui() - { - //You have to add this line for the Gui to function properly! - super.initGui(); - - //The parameters of GuiButton are(id, x, y, width, height, text); - //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X")); - //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y")); - //NOTE: the id always has to be different or else it might get called twice or never! - - //Add any other buttons here too! - } - - @Override - protected void actionPerformed(final GuiButton B) - { - //If the button id is different, or you have mrs buttons, create another if block for that too! - if(B.id == 1){ - System.out.println("Trying to empty crafting grid to the storage compartment."); - //moveItemsToChest = true; - ((Container_Workbench) this.inventorySlots).moveCraftingToChest(); - } - else if(B.id == 2){ - System.out.println("Trying to move items into the crafting grid."); - //moveItemsToCrafting = true; - ((Container_Workbench) this.inventorySlots).moveChestToCrafting(); - } - - - } - -}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java b/src/main/java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java deleted file mode 100644 index 20183eb0b0..0000000000 --- a/src/main/java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java +++ /dev/null @@ -1,42 +0,0 @@ -package gtPlusPlus.core.gui.machine; - -import org.lwjgl.opengl.GL11; - -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; - -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; - -import gtPlusPlus.core.container.Container_WorkbenchAdvanced; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; - -@SideOnly(Side.CLIENT) -public class GUI_WorkbenchAdvanced extends GuiContainer { - - private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/AdvancedCraftingTable.png"); - - public GUI_WorkbenchAdvanced(final InventoryPlayer player_inventory, final TileEntityWorkbenchAdvanced tile){ - super(new Container_WorkbenchAdvanced(player_inventory, tile)); - } - - - @Override - protected void drawGuiContainerForegroundLayer(final int i, final int j){ - //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752); - //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752); - } - - - @Override - protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){ - GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f); - this.mc.renderEngine.bindTexture(craftingTableGuiTextures); - final int x = (this.width - this.xSize) / 2; - final int y = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); - } - -}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/handler/GuiHandler.java b/src/main/java/gtPlusPlus/core/handler/GuiHandler.java index 0567d6c5dd..1be3578ed0 100644 --- a/src/main/java/gtPlusPlus/core/handler/GuiHandler.java +++ b/src/main/java/gtPlusPlus/core/handler/GuiHandler.java @@ -5,7 +5,19 @@ import cpw.mods.fml.common.network.NetworkRegistry; import gtPlusPlus.GTplusplus; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; -import gtPlusPlus.core.container.*; +import gtPlusPlus.core.container.Container_BackpackBase; +import gtPlusPlus.core.container.Container_CircuitProgrammer; +import gtPlusPlus.core.container.Container_DecayablesChest; +import gtPlusPlus.core.container.Container_EggBox; +import gtPlusPlus.core.container.Container_FishTrap; +import gtPlusPlus.core.container.Container_Grindle; +import gtPlusPlus.core.container.Container_ModularityTable; +import gtPlusPlus.core.container.Container_PestKiller; +import gtPlusPlus.core.container.Container_ProjectTable; +import gtPlusPlus.core.container.Container_RoundRobinator; +import gtPlusPlus.core.container.Container_SuperJukebox; +import gtPlusPlus.core.container.Container_TradeTable; +import gtPlusPlus.core.container.Container_VolumetricFlaskSetter; import gtPlusPlus.core.container.box.LunchBoxContainer; import gtPlusPlus.core.container.box.MagicBagContainer; import gtPlusPlus.core.container.box.ToolBoxContainer; @@ -16,7 +28,17 @@ import gtPlusPlus.core.gui.item.GuiBaseGrindle; import gtPlusPlus.core.gui.item.box.LunchBoxGui; import gtPlusPlus.core.gui.item.box.MagicBagGui; import gtPlusPlus.core.gui.item.box.ToolBoxGui; -import gtPlusPlus.core.gui.machine.*; +import gtPlusPlus.core.gui.machine.GUI_CircuitProgrammer; +import gtPlusPlus.core.gui.machine.GUI_DecayablesChest; +import gtPlusPlus.core.gui.machine.GUI_EggBox; +import gtPlusPlus.core.gui.machine.GUI_FishTrap; +import gtPlusPlus.core.gui.machine.GUI_ModularityTable; +import gtPlusPlus.core.gui.machine.GUI_PestKiller; +import gtPlusPlus.core.gui.machine.GUI_ProjectTable; +import gtPlusPlus.core.gui.machine.GUI_RoundRobinator; +import gtPlusPlus.core.gui.machine.GUI_SuperJukebox; +import gtPlusPlus.core.gui.machine.GUI_TradeTable; +import gtPlusPlus.core.gui.machine.GUI_VolumetricFlaskSetter; import gtPlusPlus.core.interfaces.IGuiManager; import gtPlusPlus.core.inventories.BaseInventoryBackpack; import gtPlusPlus.core.inventories.BaseInventoryGrindle; @@ -24,14 +46,16 @@ import gtPlusPlus.core.inventories.box.LunchBoxInventory; import gtPlusPlus.core.inventories.box.MagicBagInventory; import gtPlusPlus.core.inventories.box.ToolBoxInventory; import gtPlusPlus.core.tileentities.base.TileEntityBase; -import gtPlusPlus.core.tileentities.general.*; +import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; +import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; +import gtPlusPlus.core.tileentities.general.TileEntityEggBox; +import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; +import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ChunkCoordinates; @@ -88,11 +112,10 @@ public class GuiHandler implements IGuiHandler { if (te != null) { if (ID == GUI4) { - return new Container_Workbench(player.inventory, (TileEntityWorkbench) te); + //return new Container_Workbench(player.inventory, (TileEntityWorkbench) te); } else if (ID == GUI5) { Logger.INFO("sad"); - return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); - + //return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); } else if (ID == GUI6) { return new Container_FishTrap(player.inventory, (TileEntityFishTrap) te); } else if (ID == GUI7) { @@ -154,10 +177,10 @@ public class GuiHandler implements IGuiHandler { if (te != null) { if (ID == GUI4) { - return new GUI_Workbench(player.inventory, (TileEntityWorkbench) te); + //return new GUI_Workbench(player.inventory, (TileEntityWorkbench) te); } else if (ID == GUI5) { Logger.INFO("sad"); - return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); + //return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced) te); } else if (ID == GUI6) { return new GUI_FishTrap(player.inventory, (TileEntityFishTrap) te); } else if (ID == GUI7) { diff --git a/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java b/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java index eded4e2585..5df17979a9 100644 --- a/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java +++ b/src/main/java/gtPlusPlus/core/item/general/ItemBlueprint.java @@ -71,7 +71,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ @Override public String getItemStackDisplayName(final ItemStack p_77653_1_) { - return "Blueprint [I am useless]"; + return "Blueprint"; } @Override @@ -103,7 +103,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ ItemStack[] blueprint = new ItemStack[9]; if (itemStack.hasTagCompound()){ final NBTTagCompound nbt = itemStack.getTagCompound(); - final NBTTagList list = nbt.getTagList("Items", 10); + final NBTTagList list = nbt.getTagList("Inventory", 10); blueprint = new ItemStack[INV_SIZE]; for(int i = 0;i<list.tagCount();i++) { @@ -135,7 +135,7 @@ public class ItemBlueprint extends Item implements IItemBlueprint{ list.appendTag(data); } } - nbt.setTag("Items", list); + nbt.setTag("Inventory", list); itemStack.setTagCompound(nbt); return itemStack; } diff --git a/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java index 62b545c5c8..0fcbb6a576 100644 --- a/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/main/java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -5,7 +5,15 @@ import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.general.BlockSuperLight.TileEntitySuperLight; import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; import gtPlusPlus.core.lib.LoadedMods; -import gtPlusPlus.core.tileentities.general.*; +import gtPlusPlus.core.tileentities.general.TileEntityCircuitProgrammer; +import gtPlusPlus.core.tileentities.general.TileEntityDecayablesChest; +import gtPlusPlus.core.tileentities.general.TileEntityEggBox; +import gtPlusPlus.core.tileentities.general.TileEntityFirepit; +import gtPlusPlus.core.tileentities.general.TileEntityFishTrap; +import gtPlusPlus.core.tileentities.general.TileEntityInfiniteFluid; +import gtPlusPlus.core.tileentities.general.TileEntityPlayerDoorBase; +import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter; +import gtPlusPlus.core.tileentities.general.TileEntityXpConverter; import gtPlusPlus.core.tileentities.machines.TileEntityAdvPooCollector; import gtPlusPlus.core.tileentities.machines.TileEntityModularityTable; import gtPlusPlus.core.tileentities.machines.TileEntityPestKiller; @@ -13,8 +21,6 @@ import gtPlusPlus.core.tileentities.machines.TileEntityPooCollector; import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable; import gtPlusPlus.core.tileentities.machines.TileEntityRoundRobinator; import gtPlusPlus.core.tileentities.machines.TileEntityTradeTable; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; -import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced; import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; @@ -24,8 +30,6 @@ public class ModTileEntities { Logger.INFO("Registering Tile Entities."); GameRegistry.registerTileEntity(TileEntityPooCollector.class, "TileEntityPooCollector"); GameRegistry.registerTileEntity(TileEntityAdvPooCollector.class, "TileEntityAdvPooCollector"); - GameRegistry.registerTileEntity(TileEntityWorkbench.class, "TileWorkbench"); - GameRegistry.registerTileEntity(TileEntityWorkbenchAdvanced.class, "TileWorkbenchAdvanced"); GameRegistry.registerTileEntity(TileEntityFishTrap.class, "TileFishTrap"); GameRegistry.registerTileEntity(TileEntityFirepit.class, "TileFirePit"); GameRegistry.registerTileEntity(TileEntityInfiniteFluid.class, "TileInfiniteFluid"); diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java deleted file mode 100644 index a2db2326a9..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java +++ /dev/null @@ -1,172 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.List; -import java.util.Vector; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; - -import gtPlusPlus.core.inventories.InventoryWorkbenchChest; -import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; -import gtPlusPlus.core.inventories.InventoryWorkbenchTools; -import ic2.api.network.INetworkDataProvider; -import ic2.api.network.INetworkUpdateListener; -import ic2.api.tile.IWrenchable; -import ic2.core.IC2; - -public class TileEntityWorkbench extends TileEntity implements INetworkDataProvider, INetworkUpdateListener, IWrenchable{ - - //Credit to NovaViper in http://www.minecraftforge.net/forum/index.php?topic=26439.0 - Helped me restructure my Inventory system and now the crafting matrix works better. - - public InventoryWorkbenchChest inventoryChest; - public InventoryWorkbenchTools inventoryTool; - public InventoryWorkbenchHoloSlots inventoryHolo; - //public InventoryWorkbenchHoloCrafting inventoryCrafting; - - public IInventory inventoryCraftResult = new InventoryCraftResult(); - - public TileEntityWorkbench(){ - this.inventoryTool = new InventoryWorkbenchTools();//number of slots - without product slot - this.inventoryChest = new InventoryWorkbenchChest();//number of slots - without product slot - this.inventoryHolo = new InventoryWorkbenchHoloSlots(); - //this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); - this.canUpdate(); - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) - { - if(!nbt.hasKey(tag)) - { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) - { - super.writeToNBT(nbt); - - nbt.setShort("facing", this.facing); - - this.inventoryChest.writeToNBT(this.getTag(nbt, "ContentsChest")); - this.inventoryTool.writeToNBT(this.getTag(nbt, "ContentsTools")); - //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); - this.inventoryHolo.writeToNBT(this.getTag(nbt, "ContentsHolo")); - - // Write Crafting Matrix to NBT - final NBTTagList craftingTag = new NBTTagList(); - /*for (int currentIndex = 0; currentIndex < this.inventoryCrafting.getSizeInventory(); ++currentIndex) { - if (this.inventoryCrafting.getStackInSlot(currentIndex) != null) { - final NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte) currentIndex); - this.inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); - craftingTag.appendTag(tagCompound); - } - }*/ - - nbt.setTag("CraftingMatrix", craftingTag); - // Write craftingResult to NBT - if (this.inventoryCraftResult.getStackInSlot(0) != null) { - nbt.setTag("CraftingResult", this.inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); - } - - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) - { - super.readFromNBT(nbt); - - this.prevFacing = (this.facing = nbt.getShort("facing")); - - this.inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); - this.inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); - //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); - this.inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); - - // Read in the Crafting Matrix from NBT - final NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); - /*this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number - for (int i = 0; i < craftingTag.tagCount(); ++i) { - final NBTTagCompound tagCompound = craftingTag.getCompoundTagAt(i); - final byte slot = tagCompound.getByte("Slot"); - if ((slot >= 0) && (slot < this.inventoryCrafting.getSizeInventory())) { - this.inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); - } - }*/ - - - // Read craftingResult from NBT - final NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); - this.inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); - - } - - @Override - public List<String> getNetworkedFields(){ - final List<String> ret = new Vector(2); - ret.add("facing"); - return ret; - } - - - @Override - public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) - { - return false; - } - - private short facing = 0; - public short prevFacing = 0; - - @Override - public void setFacing(final short facing1) - { - this.facing = facing1; - if (this.prevFacing != facing1) { - IC2.network.get().updateTileEntityField(this, "facing"); - } - this.prevFacing = facing1; - } - - @Override - public short getFacing() - { - return this.facing; - } - - - @Override - public boolean wrenchCanRemove(final EntityPlayer entityPlayer) - { - return true; - } - - @Override - public float getWrenchDropRate() - { - return 1.0F; - } - - @Override - public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) - { - return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); - } - - @Override - public void onNetworkUpdate(final String field) { - - this.prevFacing = this.facing; - - } - - - -}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java b/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java deleted file mode 100644 index 264323388f..0000000000 --- a/src/main/java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java +++ /dev/null @@ -1,245 +0,0 @@ -package gtPlusPlus.core.tileentities.machines; - -import java.util.List; -import java.util.Vector; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; - -import gtPlusPlus.core.inventories.*; -import ic2.api.energy.event.EnergyTileLoadEvent; -import ic2.api.energy.event.EnergyTileUnloadEvent; -import ic2.api.energy.tile.IEnergySink; -import ic2.api.network.INetworkDataProvider; -import ic2.api.network.INetworkUpdateListener; -import ic2.api.tile.IWrenchable; -import ic2.core.IC2; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.common.util.ForgeDirection; - -public class TileEntityWorkbenchAdvanced extends TileEntity implements IEnergySink, INetworkDataProvider, INetworkUpdateListener, IWrenchable{ - - //Credit to NovaViper in http://www.minecraftforge.net/forum/index.php?topic=26439.0 - Helped me restructure my Inventory system and now the crafting matrix works better. - - public InventoryWorkbenchChest inventoryChest; - public InventoryWorkbenchToolsElectric inventoryTool; - public InventoryWorkbenchHoloSlots inventoryHolo; - public InventoryWorkbenchHoloCrafting inventoryCrafting; - - public IInventory inventoryCraftResult = new InventoryCraftResult(); - - //Wrench Code - private short facing = 0; - public short prevFacing = 0; - - //E-Net Code - public double energy = 0.0D; - public int maxEnergy; - private boolean addedToEnergyNet = false; - private int tier; - private float guiChargeLevel; - - - public TileEntityWorkbenchAdvanced(final int maxenergy, final int tier1){ - this.inventoryTool = new InventoryWorkbenchToolsElectric();//number of slots - without product slot - this.inventoryChest = new InventoryWorkbenchChest();//number of slots - without product slot - this.inventoryHolo = new InventoryWorkbenchHoloSlots(); - this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); - this.canUpdate(); - - //Electric Stats - this.maxEnergy = maxenergy; - this.tier = tier1; - - } - - public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag) - { - if(!nbt.hasKey(tag)) - { - nbt.setTag(tag, new NBTTagCompound()); - } - return nbt.getCompoundTag(tag); - } - - @Override - public void writeToNBT(final NBTTagCompound nbt) - { - super.writeToNBT(nbt); - nbt.setDouble("energy", this.energy); - nbt.setShort("facing", this.facing); - - this.inventoryChest.writeToNBT(this.getTag(nbt, "ContentsChest")); - this.inventoryTool.writeToNBT(this.getTag(nbt, "ContentsTools")); - //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); - this.inventoryHolo.writeToNBT(this.getTag(nbt, "ContentsHolo")); - - // Write Crafting Matrix to NBT - final NBTTagList craftingTag = new NBTTagList(); - for (int currentIndex = 0; currentIndex < this.inventoryCrafting.getSizeInventory(); ++currentIndex) { - if (this.inventoryCrafting.getStackInSlot(currentIndex) != null) { - final NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setByte("Slot", (byte) currentIndex); - this.inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound); - craftingTag.appendTag(tagCompound); - } - } - - nbt.setTag("CraftingMatrix", craftingTag); - // Write craftingResult to NBT - if (this.inventoryCraftResult.getStackInSlot(0) != null) { - nbt.setTag("CraftingResult", this.inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound())); - } - - } - - @Override - public void readFromNBT(final NBTTagCompound nbt) - { - super.readFromNBT(nbt); - this.energy = nbt.getDouble("energy"); - - this.prevFacing = (this.facing = nbt.getShort("facing")); - - this.inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); - this.inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); - //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); - this.inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); - - // Read in the Crafting Matrix from NBT - final NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10); - this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number - for (int i = 0; i < craftingTag.tagCount(); ++i) { - final NBTTagCompound tagCompound = craftingTag.getCompoundTagAt(i); - final byte slot = tagCompound.getByte("Slot"); - if ((slot >= 0) && (slot < this.inventoryCrafting.getSizeInventory())) { - this.inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound)); - } - } - - - // Read craftingResult from NBT - final NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult"); - this.inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult)); - - } - - @Override - public boolean acceptsEnergyFrom(final TileEntity emitter, final ForgeDirection direction) - { - return true; - } - - @Override - public double getDemandedEnergy() - { - return this.maxEnergy - this.energy; - } - - @Override - public int getSinkTier() - { - return this.tier; - } - - @Override - public double injectEnergy(final ForgeDirection directionFrom, final double amount, final double voltage) - { - if (this.energy >= this.maxEnergy) { - return amount; - } - this.energy += amount; - return 0.0D; - } - - public final float getChargeLevel() - { - return this.guiChargeLevel; - } - - public void setTier(final int tier1) - { - if (this.tier == tier1) { - return; - } - final boolean addedToENet = this.addedToEnergyNet; - if (addedToENet) - { - MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this)); - this.addedToEnergyNet = false; - } - this.tier = tier1; - - for (int i=0; i<this.inventoryTool.getSizeInventory(); i++){ - //this.inventoryTool..setTier(tier1); TODO - } - - if (addedToENet) - { - MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this)); - this.addedToEnergyNet = true; - } - } - - @Override - public List<String> getNetworkedFields(){ - final List<String> ret = new Vector(2); - ret.add("facing"); - return ret; - } - - - @Override - public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side) - { - return false; - } - - @Override - public void setFacing(final short facing1) - { - this.facing = facing1; - if (this.prevFacing != facing1) { - IC2.network.get().updateTileEntityField(this, "facing"); - } - this.prevFacing = facing1; - } - - @Override - public short getFacing() - { - return this.facing; - } - - - @Override - public boolean wrenchCanRemove(final EntityPlayer entityPlayer) - { - return true; - } - - @Override - public float getWrenchDropRate() - { - return 1.0F; - } - - @Override - public ItemStack getWrenchDrop(final EntityPlayer entityPlayer) - { - return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord)); - } - - @Override - public void onNetworkUpdate(final String field) { - - this.prevFacing = this.facing; - - } - -}
\ No newline at end of file diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java new file mode 100644 index 0000000000..d7ec19a9ac --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_AdvancedWorkbench.java @@ -0,0 +1,124 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.slots.SlotBlueprint; +import gtPlusPlus.core.slots.SlotElectric; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_AdvancedWorkbench extends GT_ContainerMetaTile_Machine { + + public GT_Container_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 8, 8)); + addSlotToContainer(new Slot(mTileEntity, 1, 26, 8)); + addSlotToContainer(new Slot(mTileEntity, 2, 44, 8)); + addSlotToContainer(new Slot(mTileEntity, 3, 62, 8)); + addSlotToContainer(new Slot(mTileEntity, 4, 8, 26)); + addSlotToContainer(new Slot(mTileEntity, 5, 26, 26)); + addSlotToContainer(new Slot(mTileEntity, 6, 44, 26)); + addSlotToContainer(new Slot(mTileEntity, 7, 62, 26)); + addSlotToContainer(new Slot(mTileEntity, 8, 8, 44)); + addSlotToContainer(new Slot(mTileEntity, 9, 26, 44)); + addSlotToContainer(new Slot(mTileEntity, 10, 44, 44)); + addSlotToContainer(new Slot(mTileEntity, 11, 62, 44)); + addSlotToContainer(new Slot(mTileEntity, 12, 8, 62)); + addSlotToContainer(new Slot(mTileEntity, 13, 26, 62)); + addSlotToContainer(new Slot(mTileEntity, 14, 44, 62)); + addSlotToContainer(new Slot(mTileEntity, 15, 62, 62)); + + addSlotToContainer(new SlotElectric(mTileEntity, 16, 82, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 17, 100, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 18, 118, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 19, 136, 8)); + addSlotToContainer(new SlotElectric(mTileEntity, 20, 154, 8)); + + addSlotToContainer(new Slot(mTileEntity, 21, 82, 28)); + addSlotToContainer(new Slot(mTileEntity, 22, 100, 28)); + addSlotToContainer(new Slot(mTileEntity, 23, 118, 28)); + addSlotToContainer(new Slot(mTileEntity, 24, 82, 46)); + addSlotToContainer(new Slot(mTileEntity, 25, 100, 46)); + addSlotToContainer(new Slot(mTileEntity, 26, 118, 46)); + addSlotToContainer(new Slot(mTileEntity, 27, 82, 64)); + addSlotToContainer(new Slot(mTileEntity, 28, 100, 64)); + addSlotToContainer(new Slot(mTileEntity, 29, 118, 64)); + + addSlotToContainer(new Slot(mTileEntity, 33, 154, 28)); + addSlotToContainer(new Slot(mTileEntity, 34, 154, 64)); + + addSlotToContainer(new SlotBlueprint(mTileEntity, 30, 136, 28)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 31, 136, 64, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 136, 46, false, false, 1)); + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + Logger.INFO("Clicked on slot "+aSlotIndex); + if (aSlotIndex < 21 || aSlotIndex > 35) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + if (mTileEntity == null || mTileEntity.getMetaTileEntity() == null) return null; + try { + ItemStack tStack = ((Slot)inventorySlots.get(aSlotIndex)).getStack(); + if (tStack != null && tStack.stackSize <= 0 && !GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack())) { + return null; + } + if (aSlotIndex == 32) { + if (aMouseclick == 0 && aShifthold == 1) { + ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).setBluePrint(null); + return null; + } + } else if (aSlotIndex == 33) { + ItemStack tStack2, tCraftedStack = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(); + if (tCraftedStack != null) { + if (aShifthold == 1) { + for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i++) { + for (byte j = 0; j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); j++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.mainInventory[i] = (((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i])); + } + } + } else { + if (aMouseclick == 0) { + if (((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + return aPlayer.inventory.getItemStack(); + } else { + for (int i = 0; i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); i++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + } + } + return null; + } else if (aSlotIndex == 34) { + ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).mFlushMode = true; + return null; + } else if (aSlotIndex == 35) { + ((GT_MetaTileEntity_AdvancedCraftingTable)mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); + return null; + } + } catch(Throwable e) { + //GT_Log.log.catching(e); + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int getSlotCount() { + return 33; + } + + public int getShiftClickSlotCount() { + return 21; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java new file mode 100644 index 0000000000..f7cfd31e5d --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_Container_BronzeWorkbench.java @@ -0,0 +1,120 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_BronzeCraftingTable; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class GT_Container_BronzeWorkbench extends GT_ContainerMetaTile_Machine { + + public GT_Container_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + addSlotToContainer(new Slot(mTileEntity, 0, 8, 8)); + addSlotToContainer(new Slot(mTileEntity, 1, 26, 8)); + addSlotToContainer(new Slot(mTileEntity, 2, 44, 8)); + addSlotToContainer(new Slot(mTileEntity, 3, 62, 8)); + addSlotToContainer(new Slot(mTileEntity, 4, 8, 26)); + addSlotToContainer(new Slot(mTileEntity, 5, 26, 26)); + addSlotToContainer(new Slot(mTileEntity, 6, 44, 26)); + addSlotToContainer(new Slot(mTileEntity, 7, 62, 26)); + addSlotToContainer(new Slot(mTileEntity, 8, 8, 44)); + addSlotToContainer(new Slot(mTileEntity, 9, 26, 44)); + addSlotToContainer(new Slot(mTileEntity, 10, 44, 44)); + addSlotToContainer(new Slot(mTileEntity, 11, 62, 44)); + addSlotToContainer(new Slot(mTileEntity, 12, 8, 62)); + addSlotToContainer(new Slot(mTileEntity, 13, 26, 62)); + addSlotToContainer(new Slot(mTileEntity, 14, 44, 62)); + addSlotToContainer(new Slot(mTileEntity, 15, 62, 62)); + + addSlotToContainer(new Slot(mTileEntity, 16, 82, 8)); + addSlotToContainer(new Slot(mTileEntity, 17, 100, 8)); + addSlotToContainer(new Slot(mTileEntity, 18, 118, 8)); + addSlotToContainer(new Slot(mTileEntity, 19, 136, 8)); + addSlotToContainer(new Slot(mTileEntity, 20, 154, 8)); + + addSlotToContainer(new Slot(mTileEntity, 21, 82, 28)); + addSlotToContainer(new Slot(mTileEntity, 22, 100, 28)); + addSlotToContainer(new Slot(mTileEntity, 23, 118, 28)); + addSlotToContainer(new Slot(mTileEntity, 24, 82, 46)); + addSlotToContainer(new Slot(mTileEntity, 25, 100, 46)); + addSlotToContainer(new Slot(mTileEntity, 26, 118, 46)); + addSlotToContainer(new Slot(mTileEntity, 27, 82, 64)); + addSlotToContainer(new Slot(mTileEntity, 28, 100, 64)); + addSlotToContainer(new Slot(mTileEntity, 29, 118, 64)); + + addSlotToContainer(new Slot(mTileEntity, 33, 154, 28)); + addSlotToContainer(new Slot(mTileEntity, 34, 154, 64)); + + addSlotToContainer(new Slot(mTileEntity, 30, 136, 28)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 31, 136, 64, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 154, 46, false, false, 1)); + addSlotToContainer(new GT_Slot_Holo(mTileEntity, 32, 136, 46, false, false, 1)); + + } + + public ItemStack slotClick(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer) { + if (aSlotIndex < 21 || aSlotIndex > 35) return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + if (mTileEntity == null || mTileEntity.getMetaTileEntity() == null) return null; + try { + ItemStack tStack = ((Slot)inventorySlots.get(aSlotIndex)).getStack(); + if (tStack != null && tStack.stackSize <= 0 && !GT_Utility.areStacksEqual(tStack, aPlayer.inventory.getItemStack())) { + return null; + } + if (aSlotIndex == 32) { + if (aMouseclick == 0 && aShifthold == 1) { + ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).setBluePrint(null); + return null; + } + } else if (aSlotIndex == 33) { + ItemStack tStack2, tCraftedStack = ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(); + if (tCraftedStack != null) { + if (aShifthold == 1) { + for (byte i = 0; i < aPlayer.inventory.mainInventory.length; i++) { + for (byte j = 0; j < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); j++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.mainInventory[i] = (((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.mainInventory[i])); + } + } + } else { + if (aMouseclick == 0) { + if (((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput()) aPlayer.inventory.setItemStack(((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + return aPlayer.inventory.getItemStack(); + } else { + for (int i = 0; i < tCraftedStack.getMaxStackSize() / tCraftedStack.stackSize && ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).canDoCraftingOutput(); i++) { + if (!GT_Utility.areStacksEqual(tStack2 = ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).getCraftingOutput(), tCraftedStack) || tStack.stackSize != tStack2.stackSize) return aPlayer.inventory.getItemStack(); + aPlayer.inventory.setItemStack(((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).consumeMaterials(aPlayer, aPlayer.inventory.getItemStack())); + } + return aPlayer.inventory.getItemStack(); + } + } + } + return null; + } else if (aSlotIndex == 34) { + ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).mFlushMode = true; + return null; + } else if (aSlotIndex == 35) { + ((GT_MetaTileEntity_BronzeCraftingTable)mTileEntity.getMetaTileEntity()).sortIntoTheInputSlots(); + return null; + } + } catch(Throwable e) { + //GT_Log.log.catching(e); + } + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } + + public int getSlotCount() { + return 33; + } + + public int getShiftClickSlotCount() { + return 21; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java new file mode 100644 index 0000000000..fc3041f553 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_AdvancedWorkbench.java @@ -0,0 +1,84 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +import java.util.ArrayList; +import java.util.List; + +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.sys.KeyboardUtils; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_AdvancedWorkbench extends GT_GUIContainerMetaTile_Machine { + + private final String mLocalName; + + public GT_GUIContainer_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { + super(new GT_Container_AdvancedWorkbench(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + "AdvancedCraftingTable.png"); + mLocalName = aLocalName; + } + + public GT_GUIContainer_AdvancedWorkbench(GT_ContainerMetaTile_Machine aContainer, String aLocalName, String aResource) { + super(aContainer, aResource); + mLocalName = aLocalName; + } + + @Override + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + //fontRendererObj.drawString(mLocalName, 8, 4, 4210752); + this.drawTooltip(par1, par2); + } + + private void drawTooltip(final int x2, final int y2) { + final int xStart = (this.width - this.xSize) / 2; + final int yStart = (this.height - this.ySize) / 2; + final int x3 = x2 - xStart; + final int y3 = y2 - yStart + 5; + final List<String> list = new ArrayList<String>(); + //154 - 172 + + if (KeyboardUtils.isShiftKeyDown()) { + if (y3 >= 30 && y3 <= 49) { + if (x3 >= 135 && x3 <= 154) { + list.add("Blueprint Slot"); + list.add("Shift+Lmb Sets to crafting output"); + } + if (x3 >= 153 && x3 <= 170) { + list.add("Extraction Slot"); + list.add("Things can always be pulled from here"); + } + } + if (y3 >= 50 && y3 <= 67) { + if (x3 >= 135 && x3 <= 152) { + list.add("Flush"); + list.add("Empty crafting grid back to storage"); + } + if (x3 >= 153 && x3 <= 170) { + list.add("Automation"); + list.add("Allows output while"); + list.add("crafting grid is full"); + } + } + if (y3 >= 68 && y3 <= 85){ + if (x3 >= 135 && x3 <= 152) { + list.add("Output Slot"); + } + if (x3 >= 153 && x3 <= 170) { + list.add("Free Parking"); + } + } + } + if (!list.isEmpty()) { + this.drawHoveringText(list, x3, y3, this.fontRendererObj); + } + } + + @Override + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (width - xSize) / 2; + int y = (height - ySize) / 2; + drawTexturedModalRect(x, y, 0, 0, xSize, ySize); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java new file mode 100644 index 0000000000..178c9241f1 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/workbench/GT_GUIContainer_BronzeWorkbench.java @@ -0,0 +1,13 @@ +package gtPlusPlus.xmod.gregtech.api.gui.workbench; + +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_GUIContainer_BronzeWorkbench extends GT_GUIContainer_AdvancedWorkbench { + + public GT_GUIContainer_BronzeWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aLocalName) { + super(new GT_Container_BronzeWorkbench(aInventoryPlayer, aTileEntity), aLocalName, CORE.RES_PATH_GUI + "BronzeCraftingTable.png"); + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java index 2fa63e4568..7653224fd2 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlock.java @@ -402,10 +402,17 @@ public class TexturesGtBlock { public static final CustomIcon Overlay_FluidReactor_Top_Active = new CustomIcon("TileEntities/FluidReactor/OVERLAY_TOP_ACTIVE"); //Crafting Overlays - private static final CustomIcon Internal_Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting"); - public static final CustomIcon Overlay_Crafting_Bronze = Internal_Overlay_Crafting_Bronze; - private static final CustomIcon Internal_Overlay_Crafting_Steel = new CustomIcon("TileEntities/cover_crafting"); - public static final CustomIcon Overlay_Crafting_Steel = Internal_Overlay_Crafting_Steel; + public static final CustomIcon Overlay_Crafting_Bronze = new CustomIcon("TileEntities/bronze_top_crafting"); + public static final CustomIcon Overlay_Crafting_Steel = new CustomIcon("TileEntities/cover_crafting"); + + public static final CustomIcon Casing_Workbench_Crafting_Overlay = new CustomIcon("TileEntities/gt4/bronze_top_crafting"); + public static final CustomIcon Casing_Workbench_Top = new CustomIcon("TileEntities/gt4/bronze_top"); + public static final CustomIcon Casing_Workbench_Side = new CustomIcon("TileEntities/gt4/bronze_side"); + public static final CustomIcon Casing_Workbench_Bottom = new CustomIcon("TileEntities/gt4/bronze_bottom"); + public static final CustomIcon Casing_Adv_Workbench_Crafting_Overlay = new CustomIcon("TileEntities/gt4/machine_top_crafting"); + public static final CustomIcon Casing_Adv_Workbench_Top = new CustomIcon("TileEntities/gt4/machine_top"); + public static final CustomIcon Casing_Adv_Workbench_Side = new CustomIcon("TileEntities/gt4/machine_side"); + public static final CustomIcon Casing_Adv_Workbench_Bottom = new CustomIcon("TileEntities/gt4/machine_bottom"); //Covers private static final CustomIcon Internal_Overlay_Overflow_Valve = new CustomIcon("iconsets/OVERLAY_OVERFLOW_VALVE"); @@ -443,7 +450,7 @@ public class TexturesGtBlock { // Lapo Orb Hatch public static final CustomIcon Overlay_Hatch_Lapo_Orb = new CustomIcon("iconsets/OVERLAY_LAPO"); // Data Orb Hatch - public static final CustomIcon Overlay_Hatch_Data_Orb = new CustomIcon("iconsets/OVERYLAY_DATA_ORB"); + public static final CustomIcon Overlay_Hatch_Data_Orb = new CustomIcon("iconsets/OVERLAY_DATA_ORB"); // RTG Hatch private static final CustomIcon Internal_Overlay_Hatch_RTG_Off = new CustomIcon("iconsets/OVERLAY_ENERGY_RTG_OFF"); diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java new file mode 100644 index 0000000000..92190521cd --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/steam/GregtechMetaTileEntity_SteamCompressor.java @@ -0,0 +1,163 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.steam; + +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass; +import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose; +import static gregtech.api.GregTech_API.sBlockCasings1; +import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; + +import com.gtnewhorizon.structurelib.structure.IStructureDefinition; +import com.gtnewhorizon.structurelib.structure.StructureDefinition; + +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.api.util.GT_Recipe; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusInput; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Steam_BusOutput; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GT_MetaTileEntity_Hatch_CustomFluidBase; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_SteamMultiBase; +import net.minecraft.item.ItemStack; + +public class GregtechMetaTileEntity_SteamCompressor extends GregtechMeta_SteamMultiBase { + + private String mCasingName = "Bronze Plated Bricks"; + private IStructureDefinition<GregtechMetaTileEntity_SteamCompressor> STRUCTURE_DEFINITION = null; + private int mCasing; + + public GregtechMetaTileEntity_SteamCompressor(String aName) { + super(aName); + } + + public GregtechMetaTileEntity_SteamCompressor(int aID, String aName, String aNameRegional) { + super(aID, aName, aNameRegional); + } + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity arg0) { + return new GregtechMetaTileEntity_SteamCompressor(this.mName); + } + + @Override + protected GT_RenderedTexture getFrontOverlay() { + return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR); + } + + @Override + protected GT_RenderedTexture getFrontOverlayActive() { + return new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_TOP_STEAM_MACERATOR_ACTIVE); + } + + @Override + public String getMachineType() { + return "Compressor"; + } + + @Override + protected GT_Multiblock_Tooltip_Builder createTooltip() { + GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); + tt.addMachineType(getMachineType()) + .addInfo("Controller Block for the Steam Macerator") + .addInfo("Macerates " + getMaxParallelRecipes() + " ores at a time") + .addSeparator() + .beginStructureBlock(3, 3, 3, true) + .addController("Front center") + .addCasingInfo(mCasingName, 14) + .addStructureHint("Input Bus (Steam)", 1) + .addStructureHint("Output Bus (Steam)", 1) + .addStructureHint("Steam Hatch", 1) + .toolTipFinisher(CORE.GT_Tooltip_Builder); + return tt; + } + + @Override + public IStructureDefinition<GregtechMetaTileEntity_SteamCompressor> getStructureDefinition() { + if (STRUCTURE_DEFINITION == null) { + STRUCTURE_DEFINITION = StructureDefinition.<GregtechMetaTileEntity_SteamCompressor>builder() + .addShape(mName, transpose(new String[][]{ + {"CCC", "CCC", "CCC", "CCC"}, + {"C~C", "C-C", "C-C", "CCC"}, + {"CCC", "CCC", "CCC", "CCC"}, + })) + .addElement( + 'C', + ofChain( + ofHatchAdder( + GregtechMetaTileEntity_SteamCompressor::addSteamMultiList, 10, 1 + ), + onElementPass( + x -> ++x.mCasing, + ofBlock( + sBlockCasings1, 10 + ) + ) + ) + ) + .build(); + } + return STRUCTURE_DEFINITION; + } + + public final boolean addSteamMultiList(IGregTechTileEntity aTileEntity, int aBaseCasingIndex) { + if (aTileEntity == null) { + return false; + } else { + IMetaTileEntity aMetaTileEntity = aTileEntity.getMetaTileEntity(); + if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_CustomFluidBase && aMetaTileEntity.getBaseMetaTileEntity().getMetaTileID() == 31040){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusInput){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Steam_BusOutput){ + return addToMachineList(aTileEntity, aBaseCasingIndex); + } + } + return false; + } + + @Override + public void construct(ItemStack stackSize, boolean hintsOnly) { + buildPiece(mName, stackSize, hintsOnly, 1, 1, 0); + } + + @Override + public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) { + mCasing = 0; + fixAllMaintenanceIssue(); + return checkPiece(mName, 1, 1, 0) && mCasing >= 14; + } + + @Override + public int getMaxParallelRecipes() { + return 8; + } + + + public GT_Recipe.GT_Recipe_Map getRecipeMap() { + return GT_Recipe.GT_Recipe_Map.sCompressorRecipes; + } + + @Override + public ItemStack[] getOutputItems(GT_Recipe aRecipe) { + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[1]; + for (int h = 0; h < 1; h++) { + if (aRecipe.getOutput(h) != null) { + tOutputItems[h] = aRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + return tOutputItems; + } + + @Override + public int getOutputCount(ItemStack[] aOutputs) { + return 1; + } + + + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java new file mode 100644 index 0000000000..b5aa916e54 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_AdvancedCraftingTable.java @@ -0,0 +1,550 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.storage; + +import java.util.ArrayList; + +import gregtech.api.enums.GT_Values; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicTank; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.item.general.ItemBlueprint; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_Container_AdvancedWorkbench; +import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_GUIContainer_AdvancedWorkbench; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class GT_MetaTileEntity_AdvancedCraftingTable extends GT_MetaTileEntity_BasicTank { + + public boolean mFlushMode = false; + + protected String mLocalName; + + public GT_MetaTileEntity_AdvancedCraftingTable(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription) { + super(aID, aName, aNameRegional, aTier, 35, aDescription); + mLocalName = aNameRegional; + } + + public GT_MetaTileEntity_AdvancedCraftingTable(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, 35, aDescription, aTextures); + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_AdvancedWorkbench(aPlayerInventory, aBaseMetaTileEntity, mLocalName); + } + + @Override + public boolean isTransformerUpgradable() { + return true; + } + @Override + public boolean isSimpleMachine() { + return true; + } + @Override + public boolean isValidSlot(int aIndex) { + return aIndex < 31 || aIndex > 32; + } + @Override + public boolean isFacingValid(byte aFacing) { + return true; + } + @Override + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + @Override + public boolean isEnetInput() { + return isElectric(); + } + @Override + public boolean isInputFacing(byte aSide) { + return true; + } + @Override + public long maxEUInput() { + return isElectric() ? GT_Values.V[3] : 0; + } + @Override + public long maxEUStore() { + return isElectric() ? GT_Values.V[3] * 1024 : 0; + } + + @Override + public boolean isElectric() { + return isAdvanced(); + } + + @Override + public boolean isPneumatic() { + return false; + } + + @Override + public boolean isSteampowered() { + return false; + } + + @Override + public long maxAmperesIn() { + return isElectric() ? 2 : 0; + } + + @Override + public long getMinimumStoredEU() { + return isElectric() ? GT_Values.V[3] * 2 : 0; + } + + @Override + public int getSizeInventory() { + return 35; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_AdvancedCraftingTable(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public boolean doesFillContainers() { + return false; + } + @Override + public boolean doesEmptyContainers() { + return false; + } + @Override + public boolean canTankBeFilled() { + return true; + } + @Override + public boolean canTankBeEmptied() { + return true; + } + @Override + public boolean displaysItemStack() { + return false; + } + @Override + public boolean displaysStackSize() { + return false; + } + + public void sortIntoTheInputSlots() { + for (byte i = 21; i < 30; i++) + if (mInventory[i] != null) { + if (mInventory[i].stackSize == 0) { + mInventory[i] = null; + } + if (mInventory[i] != null) + for (byte j = 0; j < 16; j++) { + if (GT_Utility.areStacksEqual( + mInventory[i], mInventory[j] + )) { + GT_Utility.moveStackFromSlotAToSlotB( + getBaseMetaTileEntity(), getBaseMetaTileEntity(), i, j, (byte) 64, (byte) 1, (byte) 64, (byte) 1 + ); + } + } + if (mInventory[i] != null) + for (byte j = 0; j < 16; j++) { + if (mInventory[j] == null) { + GT_Utility.moveStackFromSlotAToSlotB( + getBaseMetaTileEntity(), getBaseMetaTileEntity(), i, j, (byte) 64, (byte) 1, (byte) 64, (byte) 1 + ); + } + } + } + } + + private void fillLiquidContainers() { + for (byte i = 16; i < 21 && mFluid != null; i++) { + ItemStack tOutput = GT_Utility.fillFluidContainer(mFluid, mInventory[i], false, true); + if (tOutput != null) { + if (mInventory[i].stackSize == 1) { + mFluid.amount -= GT_Utility.getFluidForFilledItem( + tOutput, true + ).amount * tOutput.stackSize; + mInventory[i] = tOutput; + } + else + for (byte j = 16; j < 21; j++) { + if (mInventory[j] == null || (GT_Utility.areStacksEqual( + tOutput, mInventory[j] + ) && mInventory[j].stackSize + + tOutput.stackSize <= tOutput.getMaxStackSize())) { + mFluid.amount -= GT_Utility.getFluidForFilledItem( + tOutput, true + ).amount * tOutput.stackSize; + getBaseMetaTileEntity().decrStackSize(i, 1); + if (mInventory[j] == null) { + mInventory[j] = tOutput; + } + else { + mInventory[j].stackSize++; + } + break; + } + } + if (mFluid != null && mFluid.amount <= 0) + mFluid = null; + } + } + if (mFluid != null && mFluid.amount <= 0) + mFluid = null; + } + + public void setBluePrint(ItemStack aStack) { + if (aStack == null) { + aStack = mInventory[30]; + Logger.INFO("Using Slot 30 supply."); + } + if (mInventory[31] == null || aStack == null || aStack.getItem() == null + || aStack.getItemDamage() != 0 || aStack.stackSize != 1 + || !(aStack.getItem() instanceof ItemBlueprint)) { + try { + Logger.INFO( + "Could not set Blueprint. Slot 31: " + + (mInventory[31] != null ? mInventory[31].getDisplayName() : "Null") + + ", aStack: "+(aStack != null ? aStack.getDisplayName() : "Null") + + ", Damage: "+(aStack != null ? aStack.getItemDamage() : "Null")); + } + catch (Throwable t) { + t.printStackTrace(); + } + return; + } + if (!aStack.getTagCompound().hasKey("Inventory")) { + NBTTagCompound tNBT = new NBTTagCompound(); + NBTTagList tNBT_ItemList = new NBTTagList(); + for (int i = 0; i < 9; i++) { + ItemStack tStack = mInventory[i + 21]; + if (tStack != null) { + NBTTagCompound tag = new NBTTagCompound(); + tag.setByte("Slot", (byte) i); + tStack.writeToNBT(tag); + tNBT_ItemList.appendTag(tag); + } + } + tNBT.setTag("Inventory", tNBT_ItemList); + tNBT.setBoolean("mBlueprint", true); + tNBT.setInteger("mID", MathUtils.randInt(1, Short.MAX_VALUE)); + tNBT.setString("mName", mInventory[31].getDisplayName()); + aStack.setTagCompound(tNBT); + Logger.INFO("Set NBT of crafting table to Stack in slot 30."); + } + else { + Logger.INFO("Blueprint already has recipe tags."); + } + + } + + public ItemStack getCraftingOutput() { + if (mInventory[30] != null && mInventory[30].getItem() != null + && mInventory[30].getItemDamage() == 0 + && mInventory[30].hasTagCompound() && mInventory[30].getItem() instanceof ItemBlueprint) { + //Logger.INFO("Getting Blueprint Data in slot 30. "+mInventory[30].getDisplayName()); + NBTTagCompound tNBT = mInventory[30].getTagCompound(); + NBTTagList tNBT_ItemList = tNBT.getTagList("Blueprint", 10); + for (int i = 0; i < tNBT_ItemList.tagCount() && i < 9; i++) { + NBTTagCompound tag = (NBTTagCompound) tNBT_ItemList.getCompoundTagAt( + i + ); + byte slot = tag.getByte("Slot"); + if (slot >= 0 && slot < 9 && mInventory[slot + 21] == null) { + mInventory[slot + 21] = GT_Utility.loadItem(tag); + if (mInventory[slot + 21] != null) + mInventory[slot + 21].stackSize = 0; + } + } + } + mInventory[31] = GT_ModHandler.getAllRecipeOutput( + getBaseMetaTileEntity().getWorld(), new ItemStack[]{ + mInventory[21], mInventory[22], mInventory[23], + mInventory[24], mInventory[25], mInventory[26], + mInventory[27], mInventory[28], mInventory[29] + } + ); + return mInventory[31]; + } + + public boolean canDoCraftingOutput() { + if (mInventory[31] == null) + return false; + for (ItemStack tStack : recipeContent()) { + if (tStack.stackSize > getAmountOf(tStack)) { + return false; + } + } + return true; + } + + private int getAmountOf(ItemStack aStack) { + int tAmount = 0; + for (byte i = 0; i < 30 && tAmount < 9; i++) { + if (GT_Utility.areStacksOrToolsEqual(aStack, mInventory[i])) { + tAmount += mInventory[i].stackSize; + } + } + return tAmount; + } + + private ArrayList<ItemStack> recipeContent() { + ArrayList<ItemStack> tList = new ArrayList<ItemStack>(); + for (byte i = 21; i < 30; i++) { + if (mInventory[i] != null) { + boolean temp = false; + for (byte j = 0; j < tList.size(); j++) { + if (GT_Utility.areStacksOrToolsEqual( + mInventory[i], tList.get(j) + )) { + tList.get(j).stackSize++; + temp = true; + break; + } + } + if (!temp) + tList.add(GT_Utility.copy(1, mInventory[i])); + } + } + return tList; + } + + public ItemStack consumeMaterials(EntityPlayer aPlayer, ItemStack aHoldStack) { + if (mInventory[31] == null) + return aHoldStack; + if (aHoldStack != null) { + if (!GT_Utility.areStacksEqual(aHoldStack, mInventory[31])) + return aHoldStack; + if (aHoldStack.stackSize + + mInventory[31].stackSize > aHoldStack.getMaxStackSize()) + return aHoldStack; + } + for (byte i = 21; i < 30; i++) + if (mInventory[i] != null) { + for (byte j = 0; j <= i; j++) { + if (j < 21 || j == i) { + if (GT_Utility.areStacksOrToolsEqual( + mInventory[i], mInventory[j] + ) && mInventory[j].stackSize > 0) { + ItemStack tStack = GT_Utility.getContainerItem( + mInventory[j], true + ); + if (tStack == null + || (tStack.isItemStackDamageable() + && tStack.getItemDamage() >= tStack.getMaxDamage())) { + getBaseMetaTileEntity().decrStackSize(j, 1); + } + else if (mInventory[j].stackSize == 1) { + mInventory[j] = tStack; + } + else { + getBaseMetaTileEntity().decrStackSize(j, 1); + for (byte k = 0; k < 21; k++) { + if (mInventory[k] == null) { + mInventory[k] = tStack; + break; + } + else { + if (GT_Utility.areStacksEqual( + tStack, mInventory[k] + )) { + if (tStack.stackSize + + mInventory[k].stackSize <= mInventory[k].getMaxStackSize()) { + mInventory[k].stackSize += tStack.stackSize; + break; + } + } + } + } + } + break; + } + } + } + } + if (aHoldStack == null) { + aHoldStack = GT_Utility.copy(mInventory[31]); + aHoldStack.onCrafting( + getBaseMetaTileEntity().getWorld(), aPlayer, mInventory[31].stackSize + ); + } + else { + aHoldStack.stackSize += mInventory[31].stackSize; + aHoldStack.onCrafting( + getBaseMetaTileEntity().getWorld(), aPlayer, mInventory[31].stackSize + ); + } + + fillLiquidContainers(); + + return aHoldStack; + } + + @Override + public int rechargerSlotStartIndex() { + return 16; + } + + @Override + public int rechargerSlotCount() { + return 5; + } + + @Override + public long getOutputTier() { + return GT_Utility.getTier(getBaseMetaTileEntity().getInputVoltage()); + } + + @Override + public int getCapacity() { + return 64000; + } + + @Override + public int getTankPressure() { + return -100; + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return aIndex == 33 || (mFlushMode && aIndex >= 21 && aIndex < 30); + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + if (aIndex < 16) { + for (byte i = 0; i < 16; i++) + if (GT_Utility.areStacksOrToolsEqual(aStack, mInventory[i])) + return aIndex == i; + return true; + } + return false; + } + + @Override + public void onPreTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPreTick(aBaseMetaTileEntity, aTick); + getCraftingOutput(); + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + super.onPostTick(aBaseMetaTileEntity, aTick); + if (getBaseMetaTileEntity().isServerSide()) { + if (getBaseMetaTileEntity().hasInventoryBeenModified()) + getCraftingOutput(); + fillLiquidContainers(); + if (mFlushMode) { + mFlushMode = false; + for (byte i = 21; i < 30; i++) { + if (mInventory[i] != null) { + if (mInventory[i].stackSize == 0) { + mInventory[i] = null; + } + else { + mFlushMode = true; + break; + } + } + } + } + } + /*if (aTick % 100 == 0) { + for (int i = 0; i < this.mInventory.length; i++) { + ItemStack aSlot = mInventory[i]; + Logger.INFO("Slot "+i+" "+(aSlot != null ? "contains "+aSlot.getDisplayName() : "is empty")); + } + }*/ + } + + @Override + public String[] getDescription() { + return new String[] { + "For the very large Projects", + this.mDescription, + CORE.GT_Tooltip }; + } + + @Override + public ITexture[][][] getTextureSet(final ITexture[] aTextures) { + final ITexture[][][] rTextures = new ITexture[10][17][]; + for (byte i = -1; i < 16; i++) { + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFront(i); + rTextures[6][i + 1] = this.getBack(i); + rTextures[7][i + 1] = this.getBottom(i); + rTextures[8][i + 1] = this.getTop(i); + rTextures[9][i + 1] = this.getSides(i); + } + return rTextures; + } + + protected boolean isAdvanced() { + return true; + } + + @Override + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing ? 0 + : aSide == GT_Utility.getOppositeSide(aFacing) ? 1 : aSide == 0 ? 2 : aSide == 1 ? 3 : 4)][aColorIndex + + 1]; + } + + public ITexture[] getFront(final byte aColor) { + return new ITexture[] { isAdvanced() ? new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Side) : new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Side)}; + } + + public ITexture[] getBack(final byte aColor) { + return new ITexture[] { isAdvanced() ? new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Side) : new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Side)}; + } + + public ITexture[] getBottom(final byte aColor) { + return new ITexture[] { isAdvanced() ? new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Bottom) : new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Bottom)}; + } + + public ITexture[] getTop(final byte aColor) { + if (isAdvanced()) { + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Top), + new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Crafting_Overlay) }; + } + else { + return new ITexture[] { new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Top), + new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Crafting_Overlay) }; + } + } + + public ITexture[] getSides(final byte aColor) { + return new ITexture[] { isAdvanced() ? new GT_RenderedTexture(TexturesGtBlock.Casing_Adv_Workbench_Side) : new GT_RenderedTexture(TexturesGtBlock.Casing_Workbench_Side)}; + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java new file mode 100644 index 0000000000..75d46cbb53 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_BronzeCraftingTable.java @@ -0,0 +1,91 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.storage; + +import gregtech.api.GregTech_API; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.objects.GT_ItemStack; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_Container_BronzeWorkbench; +import gtPlusPlus.xmod.gregtech.api.gui.workbench.GT_GUIContainer_BronzeWorkbench; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; + +public class GT_MetaTileEntity_BronzeCraftingTable extends GT_MetaTileEntity_AdvancedCraftingTable { + + public GT_MetaTileEntity_BronzeCraftingTable(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription) { + super(aID, aName, aNameRegional, aTier, aDescription); + } + + public GT_MetaTileEntity_BronzeCraftingTable(final String aName, final int aTier, final String aDescription, final ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + } + + @Override + public Object getServerGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_Container_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity); + } + + @Override + public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) { + return new GT_GUIContainer_BronzeWorkbench(aPlayerInventory, aBaseMetaTileEntity, mLocalName); + } + + @Override + public boolean isTransformerUpgradable() { + return false; + } + + @Override + public boolean isInputFacing(byte aSide) { + return false; + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaTileEntity_BronzeCraftingTable(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + @Override + public boolean onRightclick(final IGregTechTileEntity aBaseMetaTileEntity, final EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @SuppressWarnings("deprecation") + @Override + public boolean allowCoverOnSide(byte aSide, GT_ItemStack aStack) { + return GregTech_API.getCoverBehavior(aStack.toStack()).isSimpleCover(); + } + + @Override + public int rechargerSlotStartIndex() { + return 0; + } + + @Override + public int rechargerSlotCount() { + return 0; + } + + @Override + public String[] getDescription() { + return new String[] { + "For the smaller Projects", + this.mDescription, + CORE.GT_Tooltip }; + } + + @Override + public int getCapacity() { + return 16000; + } + + @Override + protected boolean isAdvanced() { + return false; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java index 0817202e85..721dbd69c3 100644 --- a/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java +++ b/src/main/java/gtPlusPlus/xmod/gregtech/registration/gregtech/Gregtech4Content.java @@ -8,7 +8,14 @@ import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity import gtPlusPlus.xmod.gregtech.common.tileentities.automation.GT_MetaTileEntity_TesseractTerminal; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_AutoCrafter; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GT4Entity_ThermalBoiler; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.*; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_BronzeCraftingTable; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.GT4Entity_Shelf; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.GT4Entity_Shelf_Compartment; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.GT4Entity_Shelf_Desk; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.GT4Entity_Shelf_FileCabinet; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.GT4Entity_Shelf_Iron; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.shelving.GT4Entity_Shelf_Large; public class Gregtech4Content { @@ -26,10 +33,10 @@ public class Gregtech4Content { private static void workbenches() { // Gregtech 4 Workbenches - //Utils.LOG_INFO("Gregtech 4 Content | Registering Workbenches."); - // Free //GregtechItemList.GT4_Workbench_Bronze.set(new - // GT_MetaTileEntity_BronzeCraftingTable(828, "workbench.bronze", - // "Bronze Workbench", 0).getStackForm(1L)); + Logger.INFO("Gregtech 4 Content | Registering Workbenches."); + GregtechItemList.GT4_Workbench_Bronze.set(new GT_MetaTileEntity_BronzeCraftingTable(29001, "workbench.basic", "Bronze Workbench", 0, "Stores 16000L of fluid").getStackForm(1L)); + GregtechItemList.GT4_Workbench_Advanced.set(new GT_MetaTileEntity_AdvancedCraftingTable(29002, "workbench.advanced", "Advanced Workbench", 3, "Stores 64000L of fluid").getStackForm(1L)); + } private static void tesseracts() { |