aboutsummaryrefslogtreecommitdiff
path: root/src/Java/gtPlusPlus
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-10-20 20:04:45 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-10-20 20:04:45 +1000
commitd6c2e9fd582594f9e19f732398d1c16d20d3b38e (patch)
treec17148e3f11fccd715b6196b0af8d8774ea77097 /src/Java/gtPlusPlus
parent5496d90210fdb56f1b7c4b07295a90b130aed7a3 (diff)
downloadGT5-Unofficial-d6c2e9fd582594f9e19f732398d1c16d20d3b38e.tar.gz
GT5-Unofficial-d6c2e9fd582594f9e19f732398d1c16d20d3b38e.tar.bz2
GT5-Unofficial-d6c2e9fd582594f9e19f732398d1c16d20d3b38e.zip
+ Added the Advanced workbench.
+ Added custom slots for the Adv. Workbench, that take either tools or IElectricItems. % Swapped the textures on most multiblocks/casings.
Diffstat (limited to 'src/Java/gtPlusPlus')
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java3
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java67
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java115
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_Workbench.java56
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java384
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java41
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java14
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java191
-rw-r--r--src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java43
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_General.java2
-rw-r--r--src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java18
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java98
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java2
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java121
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java249
-rw-r--r--src/Java/gtPlusPlus/core/util/item/UtilsItems.java37
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java12
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlocks.java18
18 files changed, 1386 insertions, 85 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index b7a2526e30..af7e5d833e 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -2,6 +2,7 @@ package gtPlusPlus.core.block;
import gtPlusPlus.core.block.general.LightGlass;
import gtPlusPlus.core.block.machine.Machine_Workbench;
+import gtPlusPlus.core.block.machine.Machine_WorkbenchAdvanced;
import gtPlusPlus.core.fluids.FluidRegistryHandler;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
@@ -13,6 +14,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
public final class ModBlocks {
public static Block blockWorkbench;
+ public static Block blockWorkbenchAdvanced;
//Blocks
//public static Block blockBloodSteel;
//public static Block blockStaballoy;
@@ -48,6 +50,7 @@ public final class ModBlocks {
//Workbench
blockWorkbench = new Machine_Workbench().setHardness(1.5F);
+ blockWorkbenchAdvanced = new Machine_WorkbenchAdvanced().setHardness(2.5F);
}
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
index 270d0d1820..212e9154be 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
@@ -1,20 +1,27 @@
package gtPlusPlus.core.block.machine;
+import gregtech.api.items.GT_MetaGenerated_Tool;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.item.UtilsItems;
+import ic2.core.item.tool.ItemToolWrench;
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.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.World;
+import buildcraft.api.tools.IToolWrench;
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 crazypants.enderio.api.tool.ITool;
public class Machine_Workbench extends BlockContainer
{
@@ -32,7 +39,7 @@ public class Machine_Workbench extends BlockContainer
this.setBlockName("blockWorkbenchGT");
this.setCreativeTab(AddToCreativeTab.tabMachines);
GameRegistry.registerBlock(this, "blockWorkbenchGT");
- LanguageRegistry.addName(this, "Gregtech Workbench");
+ LanguageRegistry.addName(this, "Bronze Workbench");
}
@@ -50,10 +57,10 @@ public class Machine_Workbench extends BlockContainer
@SideOnly(Side.CLIENT)
public void registerBlockIcons(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");
+ 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");
}
/**
@@ -61,17 +68,45 @@ public class Machine_Workbench extends BlockContainer
*/
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz)
- {
- if (world.isRemote) return true;
-
- TileEntity te = world.getTileEntity(x, y, z);
- if (te != null && te instanceof TileEntityWorkbench)
- {
- player.openGui(GTplusplus.instance, 3, world, x, y, z);
- return true;
- }
- return false;
- }
+ {
+ if (world.isRemote) return true;
+
+ ItemStack heldItem = UtilsItems.getItemStackInPlayersHand();
+ 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;
+ }
+ }
+
+
+ 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;
+ }
+ Utils.LOG_INFO("Holding a Wrench, doing wrench things instead.");
+ }
+ return false;
+ }
@Override
public TileEntity createNewTileEntity(World world, int p_149915_2_) {
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java
new file mode 100644
index 0000000000..46c08c0d4d
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_WorkbenchAdvanced.java
@@ -0,0 +1,115 @@
+package gtPlusPlus.core.block.machine;
+
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.item.UtilsItems;
+import ic2.core.item.tool.ItemToolWrench;
+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.item.ItemStack;
+import net.minecraft.tileentity.TileEntity;
+import net.minecraft.util.IIcon;
+import net.minecraft.world.World;
+import buildcraft.api.tools.IToolWrench;
+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 crazypants.enderio.api.tool.ITool;
+
+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(int p_149691_1_, 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(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(World world, int x, int y, int z, EntityPlayer player, int side, float lx, float ly, float lz)
+ {
+ if (world.isRemote) return true;
+
+ ItemStack heldItem = UtilsItems.getItemStackInPlayersHand();
+ 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;
+ }
+ }
+
+
+ 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(World world, int p_149915_2_) {
+ return new TileEntityWorkbenchAdvanced(128000, 2);
+ }
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/container/Container_Workbench.java b/src/Java/gtPlusPlus/core/container/Container_Workbench.java
index aa1fd1b509..6e68eb7338 100644
--- a/src/Java/gtPlusPlus/core/container/Container_Workbench.java
+++ b/src/Java/gtPlusPlus/core/container/Container_Workbench.java
@@ -9,8 +9,8 @@ import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots;
import gtPlusPlus.core.inventories.InventoryWorkbenchTools;
import gtPlusPlus.core.item.general.ItemBlueprint;
import gtPlusPlus.core.slots.SlotBlueprint;
-import gtPlusPlus.core.slots.SlotGeneric;
import gtPlusPlus.core.slots.SlotGtTool;
+import gtPlusPlus.core.slots.SlotNoInput;
import gtPlusPlus.core.slots.SlotOutput;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
import gtPlusPlus.core.util.Utils;
@@ -108,8 +108,8 @@ public class Container_Workbench extends Container {
addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64));
//Util Slots
addSlotToContainer(new SlotBlueprint(inventoryHolo, 1, 136, 28)); //Blueprint
- addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 2, 154, 28, false, false, 1)); //Hopper
- addSlotToContainer(new SlotGeneric(inventoryHolo, 3, 154, 64)); //Parking
+ addSlotToContainer(new SlotNoInput(inventoryHolo, 2, 154, 28)); //Hopper
+ addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 3, 154, 64, false, false, 64)); //Parking
//Holo Slots
addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 4, 154, 46, false, false, 1));
addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 5, 136, 46, false, false, 1));
@@ -146,7 +146,7 @@ public class Container_Workbench extends Container {
{
for (var7 = 0; var7 < 4; ++var7)
{
- //Utils.LOG_INFO("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18));
+ //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18));
this.addSlotToContainer(new Slot(inventoryChest, var7 + var6 * 4, 8 + var7 * 18, 7 + var6 * 18));
slotStorage[o] = o+15;
o++;
@@ -190,82 +190,82 @@ public class Container_Workbench extends Container {
if (!aPlayer.worldObj.isRemote){
if (aSlotIndex == 999 || aSlotIndex == -999){
- //Utils.LOG_INFO("??? - "+aSlotIndex);
+ //Utils.LOG_WARNING("??? - "+aSlotIndex);
}
if (aSlotIndex == slotOutput){
- Utils.LOG_INFO("Player Clicked on the output slot");
+ Utils.LOG_WARNING("Player Clicked on the output slot");
//TODO
}
for (int x : slotHolo){
if (aSlotIndex == x){
- Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the Holo Grid");
+ Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid");
if (x == 1){
- Utils.LOG_INFO("Player Clicked Blueprint slot in the Holo Grid");
+ Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid");
}
else if (x == 2){
- Utils.LOG_INFO("Player Clicked Right Arrow slot in the Holo Grid");
+ Utils.LOG_WARNING("Player Clicked Right Arrow slot in the Holo Grid");
if (inventoryHolo.getStackInSlot(1) != null){
- Utils.LOG_INFO("Found an ItemStack.");
+ Utils.LOG_WARNING("Found an ItemStack.");
if (inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){
- Utils.LOG_INFO("Found a blueprint.");
+ Utils.LOG_WARNING("Found a blueprint.");
ItemStack tempBlueprint = inventoryHolo.getStackInSlot(1);
ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem();
if (inventoryHolo.getStackInSlot(0) != null && !tempItemBlueprint.hasBlueprint(tempBlueprint)){
- Utils.LOG_INFO("Output slot was not empty.");
- Utils.LOG_INFO("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one.");
+ Utils.LOG_WARNING("Output slot was not empty.");
+ Utils.LOG_WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one.");
tempItemBlueprint.setBlueprint(inventoryHolo.getStackInSlot(1), craftMatrix, inventoryHolo.getStackInSlot(0));
ItemStack newTempBlueprint = UtilsItems.getSimpleStack(tempItemBlueprint);
inventoryHolo.setInventorySlotContents(1, newTempBlueprint);
- Utils.LOG_INFO(UtilsItems.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint)));
+ Utils.LOG_WARNING(UtilsItems.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint)));
}
else {
if (tempItemBlueprint.hasBlueprint(tempBlueprint)){
- Utils.LOG_INFO("Blueprint already holds a recipe.");
+ Utils.LOG_WARNING("Blueprint already holds a recipe.");
}
else {
- Utils.LOG_INFO("Output slot was empty.");
+ Utils.LOG_WARNING("Output slot was empty.");
}
}
}
else {
- Utils.LOG_INFO("ItemStack found was not a blueprint.");
+ Utils.LOG_WARNING("ItemStack found was not a blueprint.");
}
}
else {
- Utils.LOG_INFO("No ItemStack found in Blueprint slot.");
+ Utils.LOG_WARNING("No ItemStack found in Blueprint slot.");
}
}
else if (x == 3){
- Utils.LOG_INFO("Player Clicked Big [P] slot in the Holo Grid");
+ Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid");
}
else if (x == 4){
- Utils.LOG_INFO("Player Clicked Transfer to Crafting Grid slot in the Holo Grid");
+ Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid");
}
else if (x == 5){
- Utils.LOG_INFO("Player Clicked Transfer to Storage Grid slot in the Holo Grid");
+ Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid");
}
}
}
for (int x : slotCrafting){
if (aSlotIndex == x){
- Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the crafting Grid");
+ Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid");
}
}
for (int x : slotStorage){
if (aSlotIndex == x){
- Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the storage Grid");
+ Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid");
}
}
for (int x : slotTools){
if (aSlotIndex == x){
- Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the tool Grid");
+ Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the tool Grid");
}
}
}
- //Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the Grid");
+ //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid");
return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
}
@@ -302,14 +302,14 @@ public class Container_Workbench extends Container {
//craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj));
//Vanilla CraftingManager
- Utils.LOG_INFO("checking crafting grid for a valid output.");
+ Utils.LOG_WARNING("checking crafting grid for a valid output.");
ItemStack temp = CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj);
if (temp != null){
- Utils.LOG_INFO("Output found. "+temp.getDisplayName()+" x"+temp.stackSize);
+ Utils.LOG_WARNING("Output found. "+temp.getDisplayName()+" x"+temp.stackSize);
craftResult.setInventorySlotContents(slotOutput, temp);
}
else {
- Utils.LOG_INFO("No Valid output found.");
+ Utils.LOG_WARNING("No Valid output found.");
craftResult.setInventorySlotContents(slotOutput, null);
}
}*/
diff --git a/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java
new file mode 100644
index 0000000000..17ec451056
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/container/Container_WorkbenchAdvanced.java
@@ -0,0 +1,384 @@
+package gtPlusPlus.core.container;
+
+import gregtech.api.gui.GT_Slot_Holo;
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.interfaces.IItemBlueprint;
+import gtPlusPlus.core.inventories.InventoryWorkbenchChest;
+import gtPlusPlus.core.inventories.InventoryWorkbenchHoloCrafting;
+import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots;
+import gtPlusPlus.core.inventories.InventoryWorkbenchToolsElectric;
+import gtPlusPlus.core.item.general.ItemBlueprint;
+import gtPlusPlus.core.slots.SlotBlueprint;
+import gtPlusPlus.core.slots.SlotGtToolElectric;
+import gtPlusPlus.core.slots.SlotNoInput;
+import gtPlusPlus.core.slots.SlotOutput;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.item.UtilsItems;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.Container;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.InventoryCrafting;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.CraftingManager;
+import net.minecraft.world.World;
+
+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 World worldObj;
+ private int posX;
+ private int posY;
+ private 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 int slotOutput = 0;
+ private int[] slotHolo = new int[5];
+ private int[] slotCrafting = new int[9];
+ private int[] slotStorage = new int[16];
+ private int[] slotTools = new int[5];
+
+ public Container_WorkbenchAdvanced(InventoryPlayer inventory, 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;
+ worldObj = tile.getWorldObj();
+ posX = tile.xCoord;
+ posY = tile.yCoord;
+ posZ = tile.zCoord;
+
+ int o=0;
+
+ //Output slot
+ addSlotToContainer(new SlotOutput(inventory.player, this.craftMatrix, tile.inventoryCraftResult, 0, 136, 64));
+ //Util Slots
+ addSlotToContainer(new SlotBlueprint(inventoryHolo, 1, 136, 28)); //Blueprint
+ addSlotToContainer(new SlotNoInput(inventoryHolo, 2, 154, 28)); //Hopper
+ addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 3, 154, 64, false, false, 64)); //Parking
+ //Holo Slots
+ addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 4, 154, 46, false, false, 1));
+ addSlotToContainer(new GT_Slot_Holo(inventoryHolo, 5, 136, 46, false, false, 1));
+
+ for (int i=1; i<6; i++){
+ slotHolo[o] = o+1;
+ o++;
+ }
+
+ o=0;
+
+ 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);
+ } */
+ 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(inventoryChest, var7 + var6 * 4, 8 + var7 * 18, 7 + var6 * 18));
+ 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(inventoryTool, var7 + var6 * 3, 82 + var7 * 18, 8 + var6 * 18, 3, false));
+ 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(int aSlotIndex, int aMouseclick, int aShifthold, EntityPlayer aPlayer){
+
+ if (!aPlayer.worldObj.isRemote){
+ if (aSlotIndex == 999 || aSlotIndex == -999){
+ //Utils.LOG_WARNING("??? - "+aSlotIndex);
+ }
+
+ if (aSlotIndex == slotOutput){
+ Utils.LOG_WARNING("Player Clicked on the output slot");
+ //TODO
+ }
+
+ for (int x : slotHolo){
+ if (aSlotIndex == x){
+ Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Holo Grid");
+ if (x == 1){
+ Utils.LOG_WARNING("Player Clicked Blueprint slot in the Holo Grid");
+ }
+ else if (x == 2){
+ Utils.LOG_WARNING("Player Clicked Right Arrow slot in the Holo Grid");
+ if (inventoryHolo.getStackInSlot(1) != null){
+ Utils.LOG_WARNING("Found an ItemStack.");
+ if (inventoryHolo.getStackInSlot(1).getItem() instanceof IItemBlueprint){
+ Utils.LOG_WARNING("Found a blueprint.");
+ ItemStack tempBlueprint = inventoryHolo.getStackInSlot(1);
+ ItemBlueprint tempItemBlueprint = (ItemBlueprint) tempBlueprint.getItem();
+ if (inventoryHolo.getStackInSlot(0) != null && !tempItemBlueprint.hasBlueprint(tempBlueprint)){
+ Utils.LOG_WARNING("Output slot was not empty.");
+ Utils.LOG_WARNING("Trying to manipulate NBT data on the blueprint stack, then replace it with the new one.");
+ tempItemBlueprint.setBlueprint(inventoryHolo.getStackInSlot(1), craftMatrix, inventoryHolo.getStackInSlot(0));
+ ItemStack newTempBlueprint = UtilsItems.getSimpleStack(tempItemBlueprint);
+ inventoryHolo.setInventorySlotContents(1, newTempBlueprint);
+ Utils.LOG_WARNING(UtilsItems.getArrayStackNames(tempItemBlueprint.getBlueprint(newTempBlueprint)));
+ }
+ else {
+ if (tempItemBlueprint.hasBlueprint(tempBlueprint)){
+ Utils.LOG_WARNING("Blueprint already holds a recipe.");
+ }
+ else {
+ Utils.LOG_WARNING("Output slot was empty.");
+ }
+ }
+ }
+ else {
+ Utils.LOG_WARNING("ItemStack found was not a blueprint.");
+ }
+ }
+ else {
+ Utils.LOG_WARNING("No ItemStack found in Blueprint slot.");
+ }
+ }
+ else if (x == 3){
+ Utils.LOG_WARNING("Player Clicked Big [P] slot in the Holo Grid");
+ }
+ else if (x == 4){
+ Utils.LOG_WARNING("Player Clicked Transfer to Crafting Grid slot in the Holo Grid");
+ }
+ else if (x == 5){
+ Utils.LOG_WARNING("Player Clicked Transfer to Storage Grid slot in the Holo Grid");
+ }
+ }
+ }
+
+ for (int x : slotCrafting){
+ if (aSlotIndex == x){
+ Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid");
+ }
+ }
+ for (int x : slotStorage){
+ if (aSlotIndex == x){
+ Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the storage Grid");
+ }
+ }
+ for (int x : slotTools){
+ if (aSlotIndex == x){
+ Utils.LOG_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 < craftMatrix.getSizeInventory(); i++) {
+ craftMatrix.setInventorySlotContents(i, tile_entity.inventoryCrafting.getStackInSlot(i));
+ }
+ }
+
+ @Override
+ public void onCraftMatrixChanged(IInventory iiventory) {
+ tile_entity.inventoryCraftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
+ }
+
+ @Override
+ public void onContainerClosed(EntityPlayer par1EntityPlayer)
+ {
+ super.onContainerClosed(par1EntityPlayer);
+ saveCraftingMatrix();
+ }
+
+ private void saveCraftingMatrix() {
+ for (int i = 0; i < craftMatrix.getSizeInventory(); i++) {
+ tile_entity.inventoryCrafting.setInventorySlotContents(i, 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(EntityPlayer par1EntityPlayer){
+ if (worldObj.getBlock(posX, posY, posZ) != ModBlocks.blockWorkbench){
+ return false;
+ }
+
+ return par1EntityPlayer.getDistanceSq((double)posX + 0.5D, (double)posY + 0.5D, (double)posZ + 0.5D) <= 64D;
+ }
+
+
+ @Override
+ public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)
+ {
+ ItemStack var3 = null;
+ Slot var4 = (Slot)this.inventorySlots.get(par2);
+
+ if (var4 != null && var4.getHasStack())
+ {
+ 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(ItemStack p_94530_1_, Slot p_94530_2_) {
+ return p_94530_2_.inventory != tile_entity.inventoryCraftResult && super.func_94530_a(p_94530_1_, p_94530_2_);
+ }
+
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java
new file mode 100644
index 0000000000..5c04acf13b
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_WorkbenchAdvanced.java
@@ -0,0 +1,41 @@
+package gtPlusPlus.core.gui.machine;
+
+import gtPlusPlus.core.container.Container_WorkbenchAdvanced;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
+import net.minecraft.client.gui.inventory.GuiContainer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.util.ResourceLocation;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+
+@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(InventoryPlayer player_inventory, TileEntityWorkbenchAdvanced tile){
+ super(new Container_WorkbenchAdvanced(player_inventory, tile));
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(int i, 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(float f, int i, int j){
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ this.mc.renderEngine.bindTexture(craftingTableGuiTextures);
+ int x = (width - xSize) / 2;
+ int y = (height - ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, xSize, ySize);
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index dc1903e83d..c2b120d428 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -3,14 +3,17 @@ package gtPlusPlus.core.handler;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.core.container.Container_BackpackBase;
import gtPlusPlus.core.container.Container_Workbench;
+import gtPlusPlus.core.container.Container_WorkbenchAdvanced;
import gtPlusPlus.core.gui.beta.Gui_ID_Registry;
import gtPlusPlus.core.gui.beta.MU_GuiId;
import gtPlusPlus.core.gui.item.GuiBaseBackpack;
import gtPlusPlus.core.gui.machine.GUI_Workbench;
+import gtPlusPlus.core.gui.machine.GUI_WorkbenchAdvanced;
import gtPlusPlus.core.interfaces.IGuiManager;
import gtPlusPlus.core.inventories.BaseInventoryBackpack;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.xmod.forestry.bees.alveary.TileAlvearyFrameHousing;
import gtPlusPlus.xmod.forestry.bees.alveary.gui.CONTAINER_FrameHousing;
@@ -28,7 +31,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI2 = 1; //RTG
public static final int GUI3 = 2; //BackpackHandler
public static final int GUI4 = 3; //Workbench
- public static final int GUI5 = 4; //
+ public static final int GUI5 = 4; //Workbench Adv
public static final int GUI6 = 5; //
public static final int GUI7 = 6; //
public static final int GUI8 = 7; //
@@ -73,6 +76,11 @@ public class GuiHandler implements IGuiHandler {
return new Container_Workbench(player.inventory, (TileEntityWorkbench)te);
}
+ if (ID == GUI5){
+ Utils.LOG_INFO("sad");
+ return new Container_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te);
+
+ }
}
@@ -112,6 +120,10 @@ public class GuiHandler implements IGuiHandler {
if (ID == GUI4){
return new GUI_Workbench(player.inventory, (TileEntityWorkbench)te);
}
+ if (ID == GUI5){
+ Utils.LOG_INFO("sad");
+ return new GUI_WorkbenchAdvanced(player.inventory, (TileEntityWorkbenchAdvanced)te);
+ }
}
return null;
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java
new file mode 100644
index 0000000000..77f3351e59
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchToolsElectric.java
@@ -0,0 +1,191 @@
+package gtPlusPlus.core.inventories;
+
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gtPlusPlus.core.slots.SlotGtToolElectric;
+import ic2.api.item.IElectricItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
+
+public class InventoryWorkbenchToolsElectric implements IInventory{
+
+ private String name = "Inventory Tools";
+
+ /** Defining your inventory size this way is handy */
+ public static final int INV_SIZE = 5;
+
+ /** Inventory's size must be same as number of slots you add to the Container class */
+ private ItemStack[] inventory = new ItemStack[INV_SIZE];
+ private Slot[] toolSlots = new SlotGtToolElectric[INV_SIZE]; //TODO
+
+ /**
+ * @param itemstack - the ItemStack to which this inventory belongs
+ */
+ public InventoryWorkbenchToolsElectric()
+ {
+
+ }
+
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ NBTTagList list = nbt.getTagList("Items", 10);
+ inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
+ {
+ NBTTagCompound data = list.getCompoundTagAt(i);
+ int slot = data.getInteger("Slot");
+ if(slot >= 0 && slot < INV_SIZE)
+ {
+ inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ }
+
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
+ {
+ ItemStack stack = inventory[i];
+ if(stack != null)
+ {
+ NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
+ @Override
+ public int getSizeInventory()
+ {
+ return inventory.length;
+ }
+
+ public ItemStack[] getInventory(){
+ return inventory;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(int slot)
+ {
+ return inventory[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(int slot, int amount)
+ {
+ ItemStack stack = getStackInSlot(slot);
+ if(stack != null)
+ {
+ if(stack.stackSize > amount)
+ {
+ stack = stack.splitStack(amount);
+ // Don't forget this line or your inventory will not be saved!
+ markDirty();
+ }
+ else
+ {
+ // this method also calls markDirty, so we don't need to call it again
+ setInventorySlotContents(slot, null);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(int slot)
+ {
+ ItemStack stack = getStackInSlot(slot);
+ setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ @Override
+ public void setInventorySlotContents(int slot, ItemStack stack)
+ {
+ inventory[slot] = stack;
+
+ if (stack != null && stack.stackSize > getInventoryStackLimit())
+ {
+ stack.stackSize = getInventoryStackLimit();
+ }
+
+ // Don't forget this line or your inventory will not be saved!
+ markDirty();
+ }
+
+ // 1.7.2+ renamed to getInventoryName
+ @Override
+ public String getInventoryName()
+ {
+ return name;
+ }
+
+ // 1.7.2+ renamed to hasCustomInventoryName
+ @Override
+ public boolean hasCustomInventoryName()
+ {
+ return name.length() > 0;
+ }
+
+ @Override
+ public int getInventoryStackLimit()
+ {
+ return 1;
+ }
+
+ /**
+ * This is the method that will handle saving the inventory contents, as it is called (or should be called!)
+ * anytime the inventory changes. Perfect. Much better than using onUpdate in an Item, as this will also
+ * let you change things in your inventory without ever opening a Gui, if you want.
+ */
+ // 1.7.2+ renamed to markDirty
+ @Override
+ public void markDirty()
+ {
+ for (int i = 0; i < getSizeInventory(); ++i)
+ {
+ if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
+ inventory[i] = null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isUseableByPlayer(EntityPlayer entityplayer)
+ {
+ return true;
+ }
+
+ // 1.7.2+ renamed to openInventory(EntityPlayer player)
+ @Override
+ public void openInventory() {}
+
+ // 1.7.2+ renamed to closeInventory(EntityPlayer player)
+ @Override
+ public void closeInventory() {}
+
+ /**
+ * This method doesn't seem to do what it claims to do, as
+ * items can still be left-clicked and placed in the inventory
+ * even when this returns false
+ */
+ @Override
+ public boolean isItemValidForSlot(int slot, ItemStack itemstack)
+ {
+ // Don't want to be able to store the inventory item within itself
+ // Bad things will happen, like losing your inventory
+ // Actually, this needs a custom Slot to work
+ if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem){
+ return true;
+ }
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java
new file mode 100644
index 0000000000..73fcbc2ab6
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/item/base/itemblock/ItemBlockTileEntity.java
@@ -0,0 +1,43 @@
+package gtPlusPlus.core.item.base.itemblock;
+
+import java.util.List;
+
+import net.minecraft.block.Block;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemBlock;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class ItemBlockTileEntity extends ItemBlock{
+
+ String[] description;
+
+ public ItemBlockTileEntity(Block block) {
+ super(block);
+ }
+
+ @Override
+ public void addInformation(ItemStack stack, EntityPlayer aPlayer, List list, boolean bool) {
+ for (int i =0; i< this.description.length; i++){
+ if (!this.description[i].equals("")){
+ list.add(this.description[i]);
+ }
+ }
+
+
+ super.addInformation(stack, aPlayer, list, bool);
+ }
+
+ @Override
+ public void onUpdate(ItemStack iStack, World world, Entity entityHolding, int p_77663_4_, boolean p_77663_5_) {
+
+ }
+
+ public void setDecription(String[] description){
+ for (int i =0; i< description.length; i++){
+ this.description[i] = description[i];
+ }
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java
index 1d17bee204..2f57dc4c81 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_General.java
@@ -16,7 +16,7 @@ public class RECIPES_General {
static ItemStack RECIPE_LapisDust = UtilsItems.getItemStackOfAmountFromOreDictNoBroken("dustLazurite", 2);
static ItemStack OUTPUT_Blueprint = UtilsItems.getSimpleStack(ModItems.itemBlueprintBase);
static ItemStack RECIPE_CraftingTable = UtilsItems.getSimpleStack(Item.getItemFromBlock(Blocks.crafting_table));
- static ItemStack RECIPE_BronzePlate = UtilsItems.getItemStackOfAmountFromOreDictNoBroken("plateBronze", 1);
+ static ItemStack RECIPE_BronzePlate = UtilsItems.getItemStackOfAmountFromOreDictNoBrokenExcluding("ic2", "plateAnyBronze", 1);
static ItemStack RECIPE_BasicCasingIC2;
static ItemStack OUTPUT_Workbench_Bronze = UtilsItems.getSimpleStack(Item.getItemFromBlock(ModBlocks.blockWorkbench));
static ItemStack NULL = null;
diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
index 09a7acbfd6..eac35d586f 100644
--- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
+++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java
@@ -95,8 +95,8 @@ public class RECIPES_Machines {
static String plateTier4 = "plateGold";
static String plateTier5 = "plateAluminium";
static String plateTier6 = "plateMaragingSteel250";
- static String plateTier7 = "plateTungsten";
- static String plateTier8 = "plateTungstenSteel";
+ static String plateTier7 = "plateTantalloy61";
+ static String plateTier8 = "plateInconel792";
static String plateTier9 = "plateZeron100";
static String plateTier10 = "plateNaquadahEnriched";
static String plateTier11 = "plateNeutronium";
@@ -108,8 +108,8 @@ public class RECIPES_Machines {
static String rodTier4 = "stickGold";
static String rodTier5 = "stickAluminium";
static String rodTier6 = "stickMaragingSteel250";
- static String rodTier7 = "stickTungsten";
- static String rodTier8 = "stickTungstenSteel";
+ static String rodTier7 = "stickTantalloy61";
+ static String rodTier8 = "stickInconel792";
static String rodTier9 = "stickZeron100";
static String rodTier10 = "stickNaquadahEnriched";
static String rodTier11 = "stickNeutronium";
@@ -528,16 +528,16 @@ public class RECIPES_Machines {
if (LoadedMods.ImmersiveEngineering){
//Industrial Coke Oven
UtilsRecipe.addShapedGregtechRecipe(
- plateCobalt, circuitTier4, plateCobalt,
+ plateTier8, circuitTier4, plateTier8,
machineCasing_HV, INPUT_IECokeOvenBlock, machineCasing_HV,
- plateCobalt, circuitTier5, plateCobalt,
+ plateTier8, circuitTier3, plateTier8,
RECIPE_IndustrialCokeOvenController);
}
//Coke Oven Frame Casing
UtilsRecipe.addShapedGregtechRecipe(
- plateTier8, rodTier8, plateTier8,
- rodTier8, "frameGtTantalloy61", rodTier8,
- plateTier8, rodTier8, plateTier8,
+ plateTier7, rodTier7, plateTier7,
+ rodTier7, "frameGtTantalloy61", rodTier7,
+ plateTier7, rodTier7, plateTier7,
RECIPE_IndustrialCokeOvenFrame);
//Coke Oven Coil 1
UtilsRecipe.addShapedGregtechRecipe(
diff --git a/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java
new file mode 100644
index 0000000000..461fa6ff04
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/slots/SlotGtToolElectric.java
@@ -0,0 +1,98 @@
+package gtPlusPlus.core.slots;
+
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gtPlusPlus.core.util.Utils;
+import ic2.api.info.Info;
+import ic2.api.item.ElectricItem;
+import ic2.api.item.IElectricItem;
+import net.minecraft.init.Items;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.item.ItemStack;
+
+public class SlotGtToolElectric extends SlotGtTool {
+ public int tier;
+ private ItemStack content;
+
+ public SlotGtToolElectric(IInventory base, int x, int y, int z, int tier, boolean allowRedstoneDust)
+ {
+ super(base, x, y, z);
+ this.tier = tier;
+ this.allowRedstoneDust = allowRedstoneDust;
+ }
+
+ public boolean accepts(ItemStack stack)
+ {
+ if (stack == null) {
+ return false;
+ }
+ if ((stack.getItem() == Items.redstone) && (!this.allowRedstoneDust)) {
+ return false;
+ }
+ return (Info.itemEnergy.getEnergyValue(stack) > 0.0D) || (ElectricItem.manager.discharge(stack, (1.0D / 0.0D), this.tier, true, true, true) > 0.0D);
+ }
+
+ public double discharge(double amount, boolean ignoreLimit)
+ {
+ if (amount <= 0.0D) {
+ throw new IllegalArgumentException("Amount must be > 0.");
+ }
+ ItemStack stack = get(0);
+ if (stack == null) {
+ return 0.0D;
+ }
+ double realAmount = ElectricItem.manager.discharge(stack, amount, this.tier, ignoreLimit, true, false);
+ if (realAmount <= 0.0D)
+ {
+ realAmount = Info.itemEnergy.getEnergyValue(stack);
+ if (realAmount <= 0.0D) {
+ return 0.0D;
+ }
+ stack.stackSize -= 1;
+ if (stack.stackSize <= 0) {
+ put(0, null);
+ }
+ }
+ return realAmount;
+ }
+
+ public void setTier(int tier1)
+ {
+ this.tier = tier1;
+ }
+
+ public boolean allowRedstoneDust = true;
+
+ public ItemStack get()
+ {
+ return get(0);
+ }
+
+ public ItemStack get(int index)
+ {
+ return this.content;
+ }
+
+ public void put(ItemStack content)
+ {
+ put(0, content);
+ }
+
+ public void put(int index, ItemStack content)
+ {
+ this.content = content;
+ onChanged();
+ }
+
+ public void onChanged() {}
+
+ @Override
+ public boolean isItemValid(ItemStack itemstack) {
+ if (itemstack.getItem() instanceof GT_MetaGenerated_Tool || itemstack.getItem() instanceof IElectricItem){
+ Utils.LOG_WARNING(itemstack.getDisplayName()+" is a valid Tool.");
+ return true;
+ }
+ Utils.LOG_WARNING(itemstack.getDisplayName()+" is not a valid Tool.");
+ return false;
+ }
+
+}
diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
index 2028e19787..a228021c82 100644
--- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
+++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
@@ -1,6 +1,7 @@
package gtPlusPlus.core.tileentities;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
import gtPlusPlus.core.util.Utils;
import cpw.mods.fml.common.registry.GameRegistry;
@@ -15,6 +16,7 @@ public class ModTileEntities {
//GameRegistry.registerTileEntity(TileEntityCharger.class, "TE_Charger");
// GameRegistry.registerTileEntity(TileEntityHeliumGenerator.class, "Helium");
GameRegistry.registerTileEntity(TileEntityWorkbench.class, "TileWorkbench");
+ GameRegistry.registerTileEntity(TileEntityWorkbenchAdvanced.class, "TileWorkbenchAdvanced");
}
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java
index 725967c31e..9cbd963572 100644
--- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java
@@ -4,6 +4,16 @@ import gtPlusPlus.core.inventories.InventoryWorkbenchChest;
import gtPlusPlus.core.inventories.InventoryWorkbenchHoloCrafting;
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;
+import ic2.core.network.NetworkManager;
+
+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;
@@ -11,8 +21,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
-public class TileEntityWorkbench extends TileEntity {
-
+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;
@@ -44,22 +54,25 @@ public class TileEntityWorkbench extends TileEntity {
public void writeToNBT(NBTTagCompound nbt)
{
super.writeToNBT(nbt);
+
+ nbt.setShort("facing", this.facing);
+
inventoryChest.writeToNBT(getTag(nbt, "ContentsChest"));
inventoryTool.writeToNBT(getTag(nbt, "ContentsTools"));
//inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting"));
inventoryHolo.writeToNBT(getTag(nbt, "ContentsHolo"));
- // Write Crafting Matrix to NBT
- NBTTagList craftingTag = new NBTTagList();
- for (int currentIndex = 0; currentIndex < inventoryCrafting.getSizeInventory(); ++currentIndex) {
- if (inventoryCrafting.getStackInSlot(currentIndex) != null) {
- NBTTagCompound tagCompound = new NBTTagCompound();
- tagCompound.setByte("Slot", (byte) currentIndex);
- inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound);
- craftingTag.appendTag(tagCompound);
- }
- }
-
+ // Write Crafting Matrix to NBT
+ NBTTagList craftingTag = new NBTTagList();
+ for (int currentIndex = 0; currentIndex < inventoryCrafting.getSizeInventory(); ++currentIndex) {
+ if (inventoryCrafting.getStackInSlot(currentIndex) != null) {
+ NBTTagCompound tagCompound = new NBTTagCompound();
+ tagCompound.setByte("Slot", (byte) currentIndex);
+ inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound);
+ craftingTag.appendTag(tagCompound);
+ }
+ }
+
nbt.setTag("CraftingMatrix", craftingTag);
// Write craftingResult to NBT
if (inventoryCraftResult.getStackInSlot(0) != null)
@@ -71,29 +84,91 @@ public class TileEntityWorkbench extends TileEntity {
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
+
+ this.prevFacing = (this.facing = nbt.getShort("facing"));
+
inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest"));
inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools"));
//inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting"));
inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo"));
// Read in the Crafting Matrix from NBT
- NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10);
- inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number
- for (int i = 0; i < craftingTag.tagCount(); ++i) {
- NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i);
- byte slot = tagCompound.getByte("Slot");
- if (slot >= 0 && slot < inventoryCrafting.getSizeInventory()) {
- inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound));
- }
- }
+ NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10);
+ inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number
+ for (int i = 0; i < craftingTag.tagCount(); ++i) {
+ NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i);
+ byte slot = tagCompound.getByte("Slot");
+ if (slot >= 0 && slot < inventoryCrafting.getSizeInventory()) {
+ inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound));
+ }
+ }
+
-
// Read craftingResult from NBT
NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult");
inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult));
}
+ @Override
+ public List<String> getNetworkedFields(){
+ List<String> ret = new Vector(2);
+ ret.add("facing");
+ return ret;
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
+ {
+ return false;
+ }
+
+ private short facing = 0;
+ public short prevFacing = 0;
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ this.facing = facing1;
+ if (this.prevFacing != facing1) {
+ ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "facing");
+ }
+ this.prevFacing = facing1;
+ }
+
+ @Override
+ public short getFacing()
+ {
+ return this.facing;
+ }
+
+
+ @Override
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer)
+ {
+ return true;
+ }
+
+ @Override
+ public float getWrenchDropRate()
+ {
+ return 1.0F;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(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(String field) {
+
+ this.prevFacing = this.facing;
+
+ }
+
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java
new file mode 100644
index 0000000000..63770a6efd
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbenchAdvanced.java
@@ -0,0 +1,249 @@
+package gtPlusPlus.core.tileentities.machines;
+
+import gtPlusPlus.core.inventories.InventoryWorkbenchChest;
+import gtPlusPlus.core.inventories.InventoryWorkbenchHoloCrafting;
+import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots;
+import gtPlusPlus.core.inventories.InventoryWorkbenchToolsElectric;
+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 ic2.core.network.NetworkManager;
+
+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 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(int maxenergy, 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;
+
+ }
+
+ @SuppressWarnings("static-method")
+ public NBTTagCompound getTag(NBTTagCompound nbt, String tag)
+ {
+ if(!nbt.hasKey(tag))
+ {
+ nbt.setTag(tag, new NBTTagCompound());
+ }
+ return nbt.getCompoundTag(tag);
+ }
+
+ @Override
+ public void writeToNBT(NBTTagCompound nbt)
+ {
+ super.writeToNBT(nbt);
+ nbt.setDouble("energy", this.energy);
+ nbt.setShort("facing", this.facing);
+
+ inventoryChest.writeToNBT(getTag(nbt, "ContentsChest"));
+ inventoryTool.writeToNBT(getTag(nbt, "ContentsTools"));
+ //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting"));
+ inventoryHolo.writeToNBT(getTag(nbt, "ContentsHolo"));
+
+ // Write Crafting Matrix to NBT
+ NBTTagList craftingTag = new NBTTagList();
+ for (int currentIndex = 0; currentIndex < inventoryCrafting.getSizeInventory(); ++currentIndex) {
+ if (inventoryCrafting.getStackInSlot(currentIndex) != null) {
+ NBTTagCompound tagCompound = new NBTTagCompound();
+ tagCompound.setByte("Slot", (byte) currentIndex);
+ inventoryCrafting.getStackInSlot(currentIndex).writeToNBT(tagCompound);
+ craftingTag.appendTag(tagCompound);
+ }
+ }
+
+ nbt.setTag("CraftingMatrix", craftingTag);
+ // Write craftingResult to NBT
+ if (inventoryCraftResult.getStackInSlot(0) != null)
+ nbt.setTag("CraftingResult", inventoryCraftResult.getStackInSlot(0).writeToNBT(new NBTTagCompound()));
+
+ }
+
+ @Override
+ public void readFromNBT(NBTTagCompound nbt)
+ {
+ super.readFromNBT(nbt);
+ this.energy = nbt.getDouble("energy");
+
+ this.prevFacing = (this.facing = nbt.getShort("facing"));
+
+ inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest"));
+ inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools"));
+ //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting"));
+ inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo"));
+
+ // Read in the Crafting Matrix from NBT
+ NBTTagList craftingTag = nbt.getTagList("CraftingMatrix", 10);
+ inventoryCrafting = new InventoryWorkbenchHoloCrafting(); //TODO: magic number
+ for (int i = 0; i < craftingTag.tagCount(); ++i) {
+ NBTTagCompound tagCompound = (NBTTagCompound) craftingTag.getCompoundTagAt(i);
+ byte slot = tagCompound.getByte("Slot");
+ if (slot >= 0 && slot < inventoryCrafting.getSizeInventory()) {
+ inventoryCrafting.setInventorySlotContents(slot, ItemStack.loadItemStackFromNBT(tagCompound));
+ }
+ }
+
+
+ // Read craftingResult from NBT
+ NBTTagCompound tagCraftResult = nbt.getCompoundTag("CraftingResult");
+ inventoryCraftResult.setInventorySlotContents(0, ItemStack.loadItemStackFromNBT(tagCraftResult));
+
+ }
+
+ @Override
+ public boolean acceptsEnergyFrom(TileEntity emitter, ForgeDirection direction)
+ {
+ return true;
+ }
+
+ @Override
+ public double getDemandedEnergy()
+ {
+ return this.maxEnergy - this.energy;
+ }
+
+ @Override
+ public int getSinkTier()
+ {
+ return this.tier;
+ }
+
+ @Override
+ public double injectEnergy(ForgeDirection directionFrom, double amount, 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(int tier1)
+ {
+ if (this.tier == tier1) {
+ return;
+ }
+ boolean addedToENet = this.addedToEnergyNet;
+ if (addedToENet)
+ {
+ MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
+ this.addedToEnergyNet = false;
+ }
+ this.tier = tier1;
+
+ for (int i=0; i<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(){
+ List<String> ret = new Vector(2);
+ ret.add("facing");
+ return ret;
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(EntityPlayer entityPlayer, int side)
+ {
+ return false;
+ }
+
+ @Override
+ public void setFacing(short facing1)
+ {
+ this.facing = facing1;
+ if (this.prevFacing != facing1) {
+ ((NetworkManager)IC2.network.get()).updateTileEntityField(this, "facing");
+ }
+ this.prevFacing = facing1;
+ }
+
+ @Override
+ public short getFacing()
+ {
+ return this.facing;
+ }
+
+
+ @Override
+ public boolean wrenchCanRemove(EntityPlayer entityPlayer)
+ {
+ return true;
+ }
+
+ @Override
+ public float getWrenchDropRate()
+ {
+ return 1.0F;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(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(String field) {
+
+ this.prevFacing = this.facing;
+
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java
index 64f06a078c..62162e596d 100644
--- a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java
+++ b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java
@@ -244,6 +244,17 @@ public class UtilsItems {
return null;
}
+
+ public static ItemStack getItemStackInPlayersHand(){
+ Minecraft mc = Minecraft.getMinecraft();
+ ItemStack heldItem = null;
+ try{heldItem = mc.thePlayer.getHeldItem();
+ }catch(NullPointerException e){return null;}
+ if (heldItem != null){
+ return heldItem;
+ }
+ return null;
+ }
public static void generateSpawnEgg(String entityModID, String parSpawnName, int colourEgg, int colourOverlay){
Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg");
@@ -279,6 +290,32 @@ public class UtilsItems {
Utils.LOG_INFO(oredictName+" was not valid.");
return null;
}
+
+ public static ItemStack getItemStackOfAmountFromOreDictNoBrokenExcluding(String excludeModName, String oredictName, int amount){
+ ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount);
+
+ if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){
+ if (returnValue.getClass().toString().toLowerCase().contains(excludeModName.toLowerCase())){
+ ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
+ if (!oreDictList.isEmpty()){
+ returnValue = oreDictList.get(1).copy();
+ returnValue.stackSize = amount;
+ return returnValue;
+ }
+ }
+ else {
+ ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName);
+ if (!oreDictList.isEmpty()){
+ returnValue = oreDictList.get(1).copy();
+ returnValue.stackSize = amount;
+ return returnValue;
+ }
+ }
+ return returnValue;
+ }
+ Utils.LOG_INFO(oredictName+" was not valid.");
+ return null;
+ }
public static void generateItemsFromMaterial(Material matInfo){
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java
index 8327d30155..0f4a9f522c 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/CasingTextureHandler.java
@@ -16,10 +16,10 @@ public class CasingTextureHandler {
switch (aMeta) {
//Centrifuge
case 0:
- return Textures.BlockIcons.MACHINE_CASING_SOLID_STEEL.getIcon();
+ return TexturesGtBlocks.Casing_Material_MaragingSteel.getIcon();
//Coke Oven Frame
case 1:
- return Textures.BlockIcons.MACHINE_CASING_RADIATIONPROOF.getIcon();
+ return TexturesGtBlocks.Casing_Material_Staballoy61.getIcon();
//Coke Oven Casing Tier 1
case 2:
return Textures.BlockIcons.MACHINE_CASING_FIREBOX_BRONZE.getIcon();
@@ -31,13 +31,13 @@ public class CasingTextureHandler {
return Textures.BlockIcons.MACHINE_CASING_STABLE_TITANIUM.getIcon();
//Electrolyzer Casings
case 5:
- return Textures.BlockIcons.MACHINE_CASING_FUSION_2.getIcon();
+ return TexturesGtBlocks.Casing_Material_Potin.getIcon();
//Broken Blue Fusion Casings
case 6:
return Textures.BlockIcons.MACHINE_CASING_FUSION.getIcon();
//Maceration Stack Casings
case 7:
- return Textures.BlockIcons.MACHINE_LuV_BOTTOM.getIcon();
+ return TexturesGtBlocks.Casing_Material_Tumbaga.getIcon();
//Broken Pink Fusion Casings
case 8:
return Textures.BlockIcons.MACHINE_CASING_FUSION_2.getIcon();
@@ -52,10 +52,10 @@ public class CasingTextureHandler {
return Textures.BlockIcons.MACHINE_CASING_GRATE.getIcon();
//Reactor Casing I
case 12:
- return Textures.BlockIcons.MACHINE_CASING_CLEAN_STAINLESSSTEEL.getIcon();
+ return TexturesGtBlocks.Casing_Material_Stellite.getIcon();
//Reactor Casing II
case 13:
- return Textures.BlockIcons.MACHINE_CASING_ROBUST_TUNGSTENSTEEL.getIcon();
+ return TexturesGtBlocks.Casing_Material_Zeron100.getIcon();
default:
return Textures.BlockIcons.MACHINE_CASING_RADIOACTIVEHAZARD.getIcon();
diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlocks.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlocks.java
index 3f90e2a467..672fc58ff7 100644
--- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlocks.java
+++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtBlocks.java
@@ -58,12 +58,28 @@ public class TexturesGtBlocks {
//Machine Casings
private static final CustomIcon Internal_Casing_Machine_Simple = new CustomIcon("TileEntities/machine_top");
public static final CustomIcon Casing_Machine_Simple = Internal_Casing_Machine_Simple;
-
private static final CustomIcon Internal_Casing_Machine_Dimensional = new CustomIcon("TileEntities/adv_machine_dimensional");
public static final CustomIcon Casing_Machine_Dimensional = Internal_Casing_Machine_Dimensional;
private static final CustomIcon Internal_Casing_Machine_Dimensional_Adv = new CustomIcon("TileEntities/high_adv_machine_dimensional");
public static final CustomIcon Casing_Machine_Dimensional_Adv = Internal_Casing_Machine_Dimensional_Adv;
+ //Material Casings
+ private static final CustomIcon Internal_Casing_Staballoy61 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TANTALLOY61");
+ public static final CustomIcon Casing_Material_Staballoy61 = Internal_Casing_Staballoy61;
+ private static final CustomIcon Internal_Casing_MaragingSteel = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_MARAGINGSTEEL");
+ public static final CustomIcon Casing_Material_MaragingSteel = Internal_Casing_MaragingSteel;
+ private static final CustomIcon Internal_Casing_Stellite = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_STELLITE");
+ public static final CustomIcon Casing_Material_Stellite = Internal_Casing_Stellite;
+ private static final CustomIcon Internal_Casing_Talonite = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TALONITE");
+ public static final CustomIcon Casing_Material_Talonite = Internal_Casing_Talonite;
+ private static final CustomIcon Internal_Casing_Tumbaga = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_TUMBAGA");
+ public static final CustomIcon Casing_Material_Tumbaga = Internal_Casing_Tumbaga;
+ private static final CustomIcon Internal_Casing_Zeron100 = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_ZERON100");
+ public static final CustomIcon Casing_Material_Zeron100 = Internal_Casing_Zeron100;
+ private static final CustomIcon Internal_Casing_Potin = new CustomIcon("TileEntities/MACHINE_CASING_STABLE_POTIN");
+ public static final CustomIcon Casing_Material_Potin = Internal_Casing_Potin;
+
+ //Misc Casings
private static final CustomIcon Internal_Casing_Machine_Sound = new CustomIcon("TileEntities/audio_out");
public static final CustomIcon Casing_Machine_Sound = Internal_Casing_Machine_Sound;
private static final CustomIcon Internal_Casing_Machine_Sound_Active = new CustomIcon("TileEntities/audio_out_active");