aboutsummaryrefslogtreecommitdiff
path: root/src/Java
diff options
context:
space:
mode:
authorDraknyte1 <Draknyte1@hotmail.com>2016-10-03 18:08:43 +1000
committerDraknyte1 <Draknyte1@hotmail.com>2016-10-03 18:08:43 +1000
commitbdb6fc4a5410d68cf517dbe90fa49cec45bbda5a (patch)
treed345344fe061e07bca20357b18457c0b9fdf475b /src/Java
parente56e3fa33d84ca19a3fb0c5e72a60212f30660a7 (diff)
downloadGT5-Unofficial-bdb6fc4a5410d68cf517dbe90fa49cec45bbda5a.tar.gz
GT5-Unofficial-bdb6fc4a5410d68cf517dbe90fa49cec45bbda5a.tar.bz2
GT5-Unofficial-bdb6fc4a5410d68cf517dbe90fa49cec45bbda5a.zip
% Gotta Re-merge these Changes with those made on my laptop.
Diffstat (limited to 'src/Java')
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java6
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java3
-rw-r--r--src/Java/gtPlusPlus/core/common/CommonProxy.java1
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_Workbench.java83
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java61
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java28
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java7
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java37
-rw-r--r--src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java7
-rw-r--r--src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java33
-rw-r--r--src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java10
-rw-r--r--src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java39
-rw-r--r--src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlate.java2
-rw-r--r--src/Java/gtPlusPlus/core/item/base/plates/BaseItemPlateDouble.java4
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rings/BaseItemRing.java46
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRod.java109
-rw-r--r--src/Java/gtPlusPlus/core/item/base/rods/BaseItemRodLong.java71
-rw-r--r--src/Java/gtPlusPlus/core/item/base/screws/BaseItemScrew.java42
-rw-r--r--src/Java/gtPlusPlus/core/material/Material.java78
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotGtTool.java10
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java11
-rw-r--r--src/Java/gtPlusPlus/core/util/item/UtilsItems.java43
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java29
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaBasicTank.java3
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java4
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/GregtechMetaTileEntityMultiTank.java20
-rw-r--r--src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GT_MetaTileEntity_TieredTank.java16
27 files changed, 525 insertions, 278 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index e8334af98b..b7a2526e30 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -5,7 +5,6 @@ import gtPlusPlus.core.block.machine.Machine_Workbench;
import gtPlusPlus.core.fluids.FluidRegistryHandler;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.Utils;
-import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraftforge.fluids.Fluid;
@@ -20,6 +19,7 @@ public final class ModBlocks {
// WIP TODO public static Block blockToolBuilder;
public static Block blockGriefSaver;
public static Block blockCasingsMisc;
+ public static Block blockMetaTileEntity;
public static Block blockHeliumGenerator;
public static Block blockNHG;
public static Block blockCharger;
@@ -43,10 +43,6 @@ public final class ModBlocks {
Utils.LOG_INFO("Registering Blocks.");
GameRegistry.registerBlock(MatterFabricatorEffectBlock = new LightGlass(Material.glass, false).setHardness(0.1F).setBlockTextureName(CORE.MODID + ":" + "blockMFEffect").setStepSound(Block.soundTypeGlass), "blockMFEffect");
-
- //Casing Blocks
- blockCasingsMisc = new GregtechMetaCasingBlocks();
-
//Fluids
FluidRegistryHandler.registerFluids();
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
index 92ba4a11cc..308413d81f 100644
--- a/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_Workbench.java
@@ -24,7 +24,8 @@ public class Machine_Workbench extends BlockContainer
@SideOnly(Side.CLIENT)
private IIcon textureFront;
- public Machine_Workbench()
+ @SuppressWarnings("deprecation")
+ public Machine_Workbench()
{
super(Material.iron);
this.setBlockName("blockWorkbenchGT");
diff --git a/src/Java/gtPlusPlus/core/common/CommonProxy.java b/src/Java/gtPlusPlus/core/common/CommonProxy.java
index c6dc1b0b73..53c4256ed6 100644
--- a/src/Java/gtPlusPlus/core/common/CommonProxy.java
+++ b/src/Java/gtPlusPlus/core/common/CommonProxy.java
@@ -91,7 +91,6 @@ public class CommonProxy {
//Compat Handling
COMPAT_HANDLER.registerMyModsOreDictEntries();
- COMPAT_HANDLER.registerGregtechMachines();
COMPAT_HANDLER.intermodOreDictionarySupport();
COMPAT_IntermodStaging.init();
}
diff --git a/src/Java/gtPlusPlus/core/container/Container_Workbench.java b/src/Java/gtPlusPlus/core/container/Container_Workbench.java
index 09abd8e23a..3c12e860bc 100644
--- a/src/Java/gtPlusPlus/core/container/Container_Workbench.java
+++ b/src/Java/gtPlusPlus/core/container/Container_Workbench.java
@@ -1,7 +1,6 @@
package gtPlusPlus.core.container;
import gtPlusPlus.core.block.ModBlocks;
-import gtPlusPlus.core.handler.workbench.Workbench_CraftingHandler;
import gtPlusPlus.core.inventories.InventoryWorkbenchChest;
import gtPlusPlus.core.inventories.InventoryWorkbenchTools;
import gtPlusPlus.core.slots.SlotGtTool;
@@ -15,6 +14,7 @@ import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.inventory.Slot;
import net.minecraft.inventory.SlotCrafting;
import net.minecraft.item.ItemStack;
+import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;
public class Container_Workbench extends Container {
@@ -28,6 +28,9 @@ public class Container_Workbench extends Container {
private int posX;
private int posY;
private int posZ;
+
+ public boolean movingChest;
+ public boolean movingCrafting;
public static int StorageSlotNumber = 12; //Number of slots in storage area
public static int ToolSlotNumber = 5; // Number of slots in the tool area up top
@@ -36,11 +39,42 @@ public class Container_Workbench extends Container {
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
+
+ public void moveCraftingToChest(){
+ //Check Chest Space
+ for (int i=0;i<9;i++){
+ if (craftMatrix.getStackInSlot(i) != null){
+ for (int r=0;r<16;r++){
+ if (inventoryChest.getStackInSlot(r) == null || (inventoryChest.getStackInSlot(r).getItem() == craftMatrix.getStackInSlot(i).getItem() && (64-craftMatrix.getStackInSlot(i).stackSize) <= (64-craftMatrix.getStackInSlot(i).stackSize))){
+ inventoryChest.setInventorySlotContents(r, craftMatrix.getStackInSlot(i));
+ 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 (craftMatrix.getStackInSlot(i) == null || craftMatrix.getStackInSlot(i).stackSize > 0){
+ for (int r=0;r<16;r++){
+ if (inventoryChest.getStackInSlot(r) != null){
+ craftMatrix.setInventorySlotContents(i, craftMatrix.getStackInSlot(r));
+ inventoryChest.setInventorySlotContents(r, null);
+ }
+ }
+ }
+ }
+ //For Each already existing itemstack, fill current partial stack
+ //Remove partial stack from chest area
+ }
public Container_Workbench(InventoryPlayer inventory, TileEntityWorkbench tile){
-
this.tile_entity = tile;
this.inventoryChest = tile.inventoryChest;
this.inventoryTool = tile.inventoryTool;
@@ -64,25 +98,7 @@ public class Container_Workbench extends Container {
{
this.addSlotToContainer(new Slot(this.craftMatrix, var7 + var6 * 3, 82 + var7 * 18, 28 + var6 * 18));
}
- }
-
- //Storage Side
- for (var6 = 0; var6 < 4; ++var6)
- {
- for (var7 = 0; var7 < 4; ++var7)
- {
- this.addSlotToContainer(new Slot(inventoryChest, var7 + var6 * 3, 8 + var7 * 18, 7 + var6 * 18));
- }
}
-
- //Tool Slots
- for (var6 = 0; var6 < 1; ++var6)
- {
- for (var7 = 0; var7 < 5; ++var7)
- {
- this.addSlotToContainer(new SlotGtTool(inventoryTool, var7 + var6 * 3, 82 + var7 * 18, 8 + var6 * 18));
- }
- }
//Player Inventory
for (var6 = 0; var6 < 3; ++var6)
@@ -99,6 +115,27 @@ public class Container_Workbench extends Container {
this.addSlotToContainer(new Slot(inventory, var6, 8 + var6 * 18, 142));
}
+
+
+ //Storage Side
+ for (var6 = 0; var6 < 4; ++var6)
+ {
+ for (var7 = 0; var7 < 4; ++var7)
+ {
+ //Utils.LOG_INFO("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));
+ }
+ }
+
+ //Tool Slots
+ for (var6 = 0; var6 < 1; ++var6)
+ {
+ for (var7 = 0; var7 < 5; ++var7)
+ {
+ this.addSlotToContainer(new SlotGtTool(inventoryTool, var7 + var6 * 3, 82 + var7 * 18, 8 + var6 * 18));
+ }
+ }
+
this.onCraftMatrixChanged(this.craftMatrix);
}
@@ -106,7 +143,11 @@ public class Container_Workbench extends Container {
@Override
public void onCraftMatrixChanged(IInventory par1IInventory){
- craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj));
+ //Custom Recipe Handler
+ //craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj));
+
+ //Vanilla CraftingManager
+ craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
}
diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java
index c1b6904cb4..2da4c7bc7c 100644
--- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java
@@ -3,6 +3,7 @@ package gtPlusPlus.core.gui.machine;
import gtPlusPlus.core.container.Container_Workbench;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
+import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
@@ -14,28 +15,66 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GUI_Workbench extends GuiContainer {
-
+
private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/Workbench.png");
-
+
+ public boolean moveItemsToChest = false;
+ public boolean moveItemsToCrafting = false;
+
public GUI_Workbench(InventoryPlayer player_inventory, TileEntityWorkbench tile){
- super(new Container_Workbench(player_inventory, tile));
-}
+ super(new Container_Workbench(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);
-
+ //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);
+ 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);
+ }
+
+
+ //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(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/Java/gtPlusPlus/core/handler/GuiHandler.java b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
index b9b3229f13..dc1903e83d 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -32,7 +32,7 @@ public class GuiHandler implements IGuiHandler {
public static final int GUI6 = 5; //
public static final int GUI7 = 6; //
public static final int GUI8 = 7; //
-
+
public static void init(){
@@ -60,25 +60,27 @@ public class GuiHandler implements IGuiHandler {
}
-
+
if (ID == GUI3)
{
// Use the player's held item to create the inventory
return new Container_BackpackBase(player, player.inventory, new BaseInventoryBackpack(player.getHeldItem()));
}
-
+
if (te != null){
if (ID == GUI4){
+
return new Container_Workbench(player.inventory, (TileEntityWorkbench)te);
+
}
}
-
-
-
-
-
-
-
+
+
+
+
+
+
+
return null;
}
@@ -98,20 +100,20 @@ public class GuiHandler implements IGuiHandler {
//return new GUI_RTG((TileEntityRTG) te.);
}
}
-
+
if (ID == GUI3)
{
// We have to cast the new container as our custom class
// and pass in currently held item for the inventory
return new GuiBaseBackpack((Container_BackpackBase) new Container_BackpackBase(player, player.inventory, new BaseInventoryBackpack(player.getHeldItem())));
}
-
+
if (te != null){
if (ID == GUI4){
return new GUI_Workbench(player.inventory, (TileEntityWorkbench)te);
}
}
-
+
return null;
}
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java
index 569f99b078..8d147ad21c 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchChest.java
@@ -146,7 +146,12 @@ public class InventoryWorkbenchChest implements IInventory{
{
for (int i = 0; i < getSizeInventory(); ++i)
{
- if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
+ ItemStack temp = getStackInSlot(i);
+ if (temp != null){
+ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
+ }
+
+ if (temp != null && temp.stackSize == 0) {
inventory[i] = null;
}
}
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java
index 72454d75ed..333bb5c847 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchCrafting.java
@@ -1,7 +1,9 @@
package gtPlusPlus.core.inventories;
import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.inventory.Container;
import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.InventoryCrafting;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
@@ -15,13 +17,30 @@ public class InventoryWorkbenchCrafting implements IInventory{
/** Inventory's size must be same as number of slots you add to the Container class */
private ItemStack[] inventory = new ItemStack[INV_SIZE];
+ public final InventoryCrafting craftMatrix;
+ public final Container parentContainer;
+
+ public InventoryCrafting getCrafting(){
+ return craftMatrix;
+ }
/**
* @param itemstack - the ItemStack to which this inventory belongs
*/
- public InventoryWorkbenchCrafting()
+ public InventoryWorkbenchCrafting(Container containerR)
{
-
+ this.parentContainer = containerR;
+ this.craftMatrix = new InventoryCrafting(parentContainer, 3, 3);
+ }
+
+ private ItemStack[] getArrayOfCraftingItems(){
+ ItemStack[] array = new ItemStack[9];
+ for (int i=0; i<craftMatrix.getSizeInventory();i++){
+ if(craftMatrix.getStackInSlot(i) != null){
+ array[i] = craftMatrix.getStackInSlot(i);
+ }
+ }
+ return array;
}
public void readFromNBT(NBTTagCompound nbt)
@@ -34,7 +53,7 @@ public class InventoryWorkbenchCrafting implements IInventory{
int slot = data.getInteger("Slot");
if(slot >= 0 && slot < INV_SIZE)
{
- inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ getInventory()[slot] = ItemStack.loadItemStackFromNBT(data);
}
}
}
@@ -44,7 +63,7 @@ public class InventoryWorkbenchCrafting implements IInventory{
NBTTagList list = new NBTTagList();
for(int i = 0;i<INV_SIZE;i++)
{
- ItemStack stack = inventory[i];
+ ItemStack stack = getInventory()[i];
if(stack != null)
{
NBTTagCompound data = new NBTTagCompound();
@@ -59,17 +78,17 @@ public class InventoryWorkbenchCrafting implements IInventory{
@Override
public int getSizeInventory()
{
- return inventory.length;
+ return getInventory().length;
}
public ItemStack[] getInventory(){
- return inventory;
+ return getArrayOfCraftingItems();
}
@Override
public ItemStack getStackInSlot(int slot)
{
- return inventory[slot];
+ return getInventory()[slot];
}
@Override
@@ -104,7 +123,7 @@ public class InventoryWorkbenchCrafting implements IInventory{
@Override
public void setInventorySlotContents(int slot, ItemStack stack)
{
- inventory[slot] = stack;
+ getInventory()[slot] = stack;
if (stack != null && stack.stackSize > getInventoryStackLimit())
{
@@ -147,7 +166,7 @@ public class InventoryWorkbenchCrafting implements IInventory{
for (int i = 0; i < getSizeInventory(); ++i)
{
if (getStackInSlot(i) != null && getStackInSlot(i).stackSize == 0) {
- inventory[i] = null;
+ getInventory()[i] = null;
}
}
}
diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java
index 00ecd94574..7e3e7c3aef 100644
--- a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java
+++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchTools.java
@@ -1,6 +1,6 @@
package gtPlusPlus.core.inventories;
-import gregtech.api.interfaces.IToolStats;
+import gregtech.api.items.GT_MetaGenerated_Tool;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
@@ -178,7 +178,10 @@ public class InventoryWorkbenchTools implements IInventory{
// 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
- return (itemstack.getItem() instanceof IToolStats);
+ if (itemstack.getItem() instanceof GT_MetaGenerated_Tool){
+ return true;
+ }
+ return false;
}
} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
index 0f56730177..3d56307f39 100644
--- a/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
+++ b/src/Java/gtPlusPlus/core/item/base/bolts/BaseItemBolt.java
@@ -5,6 +5,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.UtilsItems;
import gtPlusPlus.core.util.math.MathUtils;
@@ -19,22 +20,19 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class BaseItemBolt extends Item{
- protected int colour;
- protected String materialName;
- protected String unlocalName;
- private int mTier;
+ final Material boltMaterial;
+ final String materialName;
+ final String unlocalName;
- public BaseItemBolt(String unlocalizedName, String materialName, int colour, int tier) {
- setUnlocalizedName(unlocalizedName);
+ public BaseItemBolt(Material material) {
+ this.boltMaterial = material;
+ this.unlocalName = "itemBolt"+material.getUnlocalizedName();
+ this.materialName = material.getLocalizedName();
this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalizedName);
- this.unlocalName = unlocalizedName;
+ this.setUnlocalizedName(unlocalName);
this.setMaxStackSize(64);
this.setTextureName(CORE.MODID + ":" + "itemBolt");
- this.colour = colour;
- this.mTier = tier;
- this.materialName = materialName;
- GameRegistry.registerItem(this, unlocalizedName);
+ GameRegistry.registerItem(this, unlocalName);
GT_OreDictUnificator.registerOre(unlocalName.replace("itemB", "b"), UtilsItems.getSimpleStack(this));
addExtruderRecipe();
}
@@ -59,10 +57,10 @@ public class BaseItemBolt extends Item{
@Override
public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (colour == 0){
+ if (boltMaterial.getRgbAsHex() == 0){
return MathUtils.generateSingularRandomHexValue();
}
- return colour;
+ return boltMaterial.getRgbAsHex();
}
@@ -74,9 +72,10 @@ public class BaseItemBolt extends Item{
GT_Values.RA.addExtruderRecipe(tempOutputStack,
ItemList.Shape_Extruder_Bolt.get(1),
UtilsItems.getSimpleStack(this, 8),
- 30*mTier*20,
- 24*mTier);
- }
+ (int) Math.max(boltMaterial.getMass() * 2L * 1, 1),
+ 8 * boltMaterial.vVoltageMultiplier);
+ }
+
}
}
diff --git a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
index 0342f7f104..236edca24d 100644
--- a/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
+++ b/src/Java/gtPlusPlus/core/item/base/dusts/BaseItemDust.java
@@ -26,13 +26,12 @@ public class BaseItemDust extends Item{
protected int colour;
protected String materialName;
protected String pileType;
- protected boolean useBlastFurnace;
String name = "";
private int mTier;
private Material dustInfo;
private String oredictName;
- public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, boolean blastFurnaceRequired, int tier, int sRadioactivity) {
+ public BaseItemDust(String unlocalizedName, String materialName, Material matInfo, int colour, String pileSize, int tier, int sRadioactivity) {
setUnlocalizedName(unlocalizedName);
this.setUnlocalizedName(unlocalizedName);
this.setMaxStackSize(64);
@@ -44,7 +43,6 @@ public class BaseItemDust extends Item{
this.colour = colour;
this.mTier = tier;
this.materialName = materialName;
- this.useBlastFurnace = blastFurnaceRequired;
this.dustInfo = matInfo;
this.sRadiation = sRadioactivity;
GameRegistry.registerItem(this, unlocalizedName);
@@ -272,7 +270,7 @@ public class BaseItemDust extends Item{
temp = temp.replace("itemDust", "ingot");
if (temp != null && temp != ""){
- if (this.useBlastFurnace){
+ if (dustInfo.requiresBlastFurnace()){
Utils.LOG_WARNING("Adding recipe for Hot "+materialName+" Ingots in a Blast furnace.");
String tempIngot = temp.replace("ingot", "ingotHot");
ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 1);
@@ -286,10 +284,10 @@ public class BaseItemDust extends Item{
ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(temp, 1);
Utils.LOG_WARNING("This will produce an ingot of "+tempOutputStack.getDisplayName() + " Debug: "+temp);
if (null != tempOutputStack){
- if (mTier < 5){
+ if (mTier < 5 || !dustInfo.requiresBlastFurnace()){
CORE.GT_Recipe.addSmeltingAndAlloySmeltingRecipe(UtilsItems.getSimpleStack(this), tempOutputStack);
}
- else if (mTier >= 5){
+ else if (mTier >= 5 || dustInfo.requiresBlastFurnace()){
Utils.LOG_WARNING("Adding recipe for "+materialName+" Ingots in a Blast furnace.");
Utils.LOG_WARNING("This will produce "+tempOutputStack.getDisplayName());
if (null != tempOutputStack){
diff --git a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
index ba41625b25..47ce5b7815 100644
--- a/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
+++ b/src/Java/gtPlusPlus/core/item/base/gears/BaseItemGear.java
@@ -5,6 +5,7 @@ import gregtech.api.enums.ItemList;
import gregtech.api.util.GT_OreDictUnificator;
import gtPlusPlus.core.creative.AddToCreativeTab;
import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
import gtPlusPlus.core.util.Utils;
import gtPlusPlus.core.util.item.UtilsItems;
import gtPlusPlus.core.util.math.MathUtils;
@@ -19,22 +20,19 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class BaseItemGear extends Item{
- protected int colour;
- protected String materialName;
- protected String unlocalName;
- private int mTier;
+ final Material gearMaterial;
+ final String materialName;
+ final String unlocalName;
- public BaseItemGear(String unlocalizedName, String materialName, int colour, int tier) {
- setUnlocalizedName(unlocalizedName);
+ public BaseItemGear(Material material) {
+ this.gearMaterial = material;
+ this.unlocalName = "itemGear"+material.getUnlocalizedName();
+ this.materialName = material.getLocalizedName();
this.setCreativeTab(AddToCreativeTab.tabMisc);
- this.setUnlocalizedName(unlocalizedName);
- this.unlocalName = unlocalizedName;
+ this.setUnlocalizedName(unlocalName);
this.setMaxStackSize(64);
this.setTextureName(CORE.MODID + ":" + "itemGear");
- this.colour = colour;
- this.mTier = tier;
- this.materialName = materialName;
- GameRegistry.registerItem(this, unlocalizedName);
+ GameRegistry.registerItem(this, unlocalName);
GT_OreDictUnificator.registerOre(unlocalName.replace("itemG", "g"), UtilsItems.getSimpleStack(this));
addExtruderRecipe();
}
@@ -42,7 +40,7 @@ public class BaseItemGear extends Item{
@Override
public String getItemStackDisplayName(ItemStack p_77653_1_) {
- return (materialName+ " Gear");
+ return (gearMaterial.getLocalizedName()+ " Gear");
}
@Override
@@ -59,23 +57,24 @@ public class BaseItemGear extends Item{
@Override
public int getColorFromItemStack(ItemStack stack, int HEX_OxFFFFFF) {
- if (colour == 0){
+ if (gearMaterial.getRgbAsHex() == 0){
return MathUtils.generateSingularRandomHexValue();
}
- return colour;
+ return gearMaterial.getRgbAsHex();
}
private void addExtruderRecipe(){
Utils.LOG_WARNING("Adding recipe for "+materialName+" Gears");
- String tempIngot = unlocalName.replace("itemGear", "ingot");
- ItemStack tempOutputStack = UtilsItems.getItemStackOfAmountFromOreDict(tempIngot, 8);
+ ItemStack tempOutputStack = gearMaterial.getIngot(8);
if (null != tempOutputStack){
- GT_Values.RA.addExtruderRecipe(tempOutputStack,
+
+ GT_Values.RA.addExtruderRecipe(
+ tempOutputStack,
ItemList.Shape_Extruder_Gear.get(1),
UtilsItems.getSimpleStack(this),
- 40*mTier*20,
- 24*mTier);
+ (int) Math.max(gearMaterial.getMass() * 5L, 1),
+ 8 * gearMaterial.vVoltageMultiplier);
}
}
diff --git a/src/Java/g