diff options
author | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-10 16:35:28 +1000 |
---|---|---|
committer | Draknyte1 <Draknyte1@hotmail.com> | 2016-10-10 16:35:28 +1000 |
commit | 26e10439a576e08bc3261a6d7c6c00c6cad7b761 (patch) | |
tree | b1b056901ce11d0339caf430ba1cb9ef686a53be /src | |
parent | 6d4f28c0b73afa2cdc59b9da24c290ec29bb9132 (diff) | |
download | GT5-Unofficial-26e10439a576e08bc3261a6d7c6c00c6cad7b761.tar.gz GT5-Unofficial-26e10439a576e08bc3261a6d7c6c00c6cad7b761.tar.bz2 GT5-Unofficial-26e10439a576e08bc3261a6d7c6c00c6cad7b761.zip |
+ Added some Geothermal Generators.
+ Added recipes and fuels for all Geothermals. (Normal Lava and Pahoehoe Lava)
$ Fixed workbench not saving crafting table contents when closed.
% Changed internal loading of Workbenches, Tanks and Geothermals.
% Disabled old workbench buttons, now using Gregtech Holo slots.
Diffstat (limited to 'src')
17 files changed, 941 insertions, 112 deletions
diff --git a/src/Java/gtPlusPlus/core/container/Container_Workbench.java b/src/Java/gtPlusPlus/core/container/Container_Workbench.java index 3c12e860bc..d63133a01e 100644 --- a/src/Java/gtPlusPlus/core/container/Container_Workbench.java +++ b/src/Java/gtPlusPlus/core/container/Container_Workbench.java @@ -1,9 +1,14 @@ package gtPlusPlus.core.container; +import gregtech.api.gui.GT_Slot_Holo; +import gregtech.api.gui.GT_Slot_Output; import gtPlusPlus.core.block.ModBlocks; import gtPlusPlus.core.inventories.InventoryWorkbenchChest; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloCrafting; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; import gtPlusPlus.core.inventories.InventoryWorkbenchTools; import gtPlusPlus.core.slots.SlotGtTool; +import gtPlusPlus.core.slots.SlotNoInput; import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; @@ -12,7 +17,6 @@ import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; 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; @@ -23,23 +27,31 @@ public class Container_Workbench extends Container { public InventoryCrafting craftMatrix = new InventoryCrafting(this, 3, 3); public final InventoryWorkbenchChest inventoryChest; public final InventoryWorkbenchTools inventoryTool; + public final InventoryWorkbenchHoloSlots inventoryHolo; + public final InventoryWorkbenchHoloCrafting inventoryCrafting; + public IInventory craftResult = new InventoryCraftResult(); + private World worldObj; 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 + public static int HoloSlotNumber = 6; public static int InputSlotNumber = 9; //Number of Slots in the Crafting Grid - public static int InOutputSlotNumber = InputSlotNumber + 1; //Same plus Output Slot + 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 void moveCraftingToChest(){ //Check Chest Space for (int i=0;i<9;i++){ @@ -78,9 +90,9 @@ public class Container_Workbench extends Container { this.tile_entity = tile; this.inventoryChest = tile.inventoryChest; this.inventoryTool = tile.inventoryTool; - - int o=0; - + this.inventoryHolo = tile.inventoryHolo; + this.inventoryCrafting = tile.inventoryCrafting; + int var6; int var7; worldObj = tile.getWorldObj(); @@ -88,8 +100,24 @@ public class Container_Workbench extends Container { posY = tile.yCoord; posZ = tile.zCoord; + int o=0; + //Output slot - addSlotToContainer(new SlotCrafting(inventory.player, this.craftMatrix, craftResult, 0, 136, 64)); + addSlotToContainer(new GT_Slot_Output(inventoryHolo, 0, 136, 64)); + //Util Slots + addSlotToContainer(new SlotNoInput(inventoryHolo, 1, 136, 28)); + addSlotToContainer(new SlotNoInput(inventoryHolo, 2, 154, 28)); + addSlotToContainer(new SlotNoInput(inventoryHolo, 3, 154, 64)); + //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; //Crafting Grid for (var6 = 0; var6 < 3; ++var6) @@ -97,25 +125,17 @@ public class Container_Workbench extends Container { 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++; } } - //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)); - } - - + o=0; //Storage Side for (var6 = 0; var6 < 4; ++var6) @@ -124,28 +144,100 @@ public class Container_Workbench extends Container { { //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)); + slotStorage[o] = o+15; + o++; } } + o=0; + //Tool Slots for (var6 = 0; var6 < 1; ++var6) { for (var7 = 0; var7 < 5; ++var7) { this.addSlotToContainer(new SlotGtTool(inventoryTool, var7 + var6 * 3, 82 + var7 * 18, 8 + var6 * 18)); + 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 (aSlotIndex == 999 || aSlotIndex == -999){ + Utils.LOG_INFO("??? - "+aSlotIndex); + } + + if (aSlotIndex == slotOutput){ + Utils.LOG_INFO("Player Clicked on the output slot"); + } + + for (int x : slotHolo){ + if (aSlotIndex == x){ + Utils.LOG_INFO("Player Clicked slot "+aSlotIndex+" in the Holo Grid"); + if (x == 1){ + Utils.LOG_INFO("Player Clicked Blueprint slot in the Holo Grid"); + } + else if (x == 2){ + Utils.LOG_INFO("Player Clicked Right Arrow slot in the Holo Grid"); + } + else if (x == 3){ + Utils.LOG_INFO("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"); + } + else if (x == 5){ + Utils.LOG_INFO("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"); + } + } + for (int x : slotStorage){ + if (aSlotIndex == x){ + Utils.LOG_INFO("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_INFO("Player Clicked slot "+aSlotIndex+" in the Grid"); + return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer); + } +*/ @Override public void onCraftMatrixChanged(IInventory par1IInventory){ //Custom Recipe Handler //craftResult.setInventorySlotContents(0, Workbench_CraftingHandler.getInstance().findMatchingRecipe(craftMatrix, worldObj)); - + //Vanilla CraftingManager craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); } @@ -153,11 +245,15 @@ public class Container_Workbench extends Container { @Override public void onContainerClosed(EntityPlayer par1EntityPlayer) - { - - super.onContainerClosed(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) + /*if (worldObj.isRemote) { return; } @@ -170,7 +266,7 @@ public class Container_Workbench extends Container { { par1EntityPlayer.dropPlayerItemWithRandomChoice(itemstack, false); } - } + }*/ } @@ -243,4 +339,7 @@ public class Container_Workbench extends Container { return var3; } + + + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java index 2da4c7bc7c..0507e9099e 100644 --- a/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java +++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_Workbench.java @@ -52,8 +52,8 @@ public class GUI_Workbench extends GuiContainer { 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")); + //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! @@ -65,12 +65,12 @@ public class GUI_Workbench extends GuiContainer { //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; + //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; + //moveItemsToCrafting = true; ((Container_Workbench) this.inventorySlots).moveChestToCrafting(); } diff --git a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java index 927423d060..fd7fbf9645 100644 --- a/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java +++ b/src/Java/gtPlusPlus/core/handler/COMPAT_HANDLER.java @@ -25,6 +25,7 @@ import gtPlusPlus.core.util.item.UtilsItems; import gtPlusPlus.core.util.recipe.UtilsRecipe; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechDehydrator; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechEnergyBuffer; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechGeothermalThermalGenerator; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCentrifuge; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialCokeOven; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechIndustrialElectrolyzer; @@ -41,6 +42,7 @@ import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSolarGenerators; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSteamCondenser; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechSuperConductionPoint; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechTieredFluidTanks; +import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechWorkbenches; import java.util.LinkedList; import java.util.Queue; @@ -89,6 +91,8 @@ public class COMPAT_HANDLER { GregtechDehydrator.run(); GregtechTieredFluidTanks.run(); GregtechIndustrialMultiTank.run(); + GregtechWorkbenches.run(); + GregtechGeothermalThermalGenerator.run(); } } diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java new file mode 100644 index 0000000000..39d9113a31 --- /dev/null +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloCrafting.java @@ -0,0 +1,166 @@ +package gtPlusPlus.core.inventories; + +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class InventoryWorkbenchHoloCrafting implements IInventory{ + + private String name = "Inventory Crafting"; + + /** Defining your inventory size this way is handy */ + public static final int INV_SIZE = 9; + + /** Inventory's size must be same as number of slots you add to the Container class */ + private ItemStack[] inventory = new ItemStack[INV_SIZE]; + + /** + * @param itemstack - the ItemStack to which this inventory belongs + */ + public InventoryWorkbenchHoloCrafting() + { + + } + + 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); + markDirty(); + } + else + { + 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(); + } + markDirty(); + } + + @Override + public String getInventoryName() + { + return name; + } + + @Override + public boolean hasCustomInventoryName() + { + return name.length() > 0; + } + + @Override + public int getInventoryStackLimit() + { + return 64; + } + + @Override + public void markDirty() + { + for (int i = 0; i < getSizeInventory(); ++i) + { + 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; + } + } + } + + @Override + public boolean isUseableByPlayer(EntityPlayer entityplayer) + { + return true; + } + + @Override + public void openInventory() {} + + @Override + public void closeInventory() {} + + + @Override + public boolean isItemValidForSlot(int slot, ItemStack itemstack) + { + return true; + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java new file mode 100644 index 0000000000..2bc84f492d --- /dev/null +++ b/src/Java/gtPlusPlus/core/inventories/InventoryWorkbenchHoloSlots.java @@ -0,0 +1,264 @@ +package gtPlusPlus.core.inventories; + +import gtPlusPlus.core.util.Utils; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.NBTTagList; + +public class InventoryWorkbenchHoloSlots implements IInventory{ + + private String name = "Inventory Holo"; + + /** Defining your inventory size this way is handy */ + public static final int INV_SIZE = 6; + + /** Inventory's size must be same as number of slots you add to the Container class */ + private ItemStack[] inventory = new ItemStack[INV_SIZE]; + + /** + * @param itemstack - the ItemStack to which this inventory belongs + */ + public InventoryWorkbenchHoloSlots() + { + + } + + 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 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) + { + return false; + } + + /** A list of one item containing the result of the crafting formula */ + private ItemStack[] stackResult = new ItemStack[1]; + + /** + * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a + * new stack. + */ + /*@Override + public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) + { + ItemStack stack = getStackInSlot(0); + if (this.stackResult[0] != null) + { + ItemStack itemstack = this.stackResult[0]; + this.stackResult[0] = null; + return itemstack; + } + if(stack != null) + { + if(stack.stackSize > p_70298_2_) + { + stack = stack.splitStack(p_70298_2_); + // 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(p_70298_1_, null); + } + } + return stack; + }*/ + @Override + public ItemStack decrStackSize(int p_70298_1_, int p_70298_2_) + { + if (getStackInSlot(0) != null){ + Utils.LOG_INFO("getStackInSlot(0) contains "+getStackInSlot(0).getDisplayName()); + if (this.stackResult[0] == null){ + Utils.LOG_INFO("this.stackResult[0] == null"); + this.stackResult[0] = getStackInSlot(0); + } + else if (this.stackResult[0] != null){ + Utils.LOG_INFO("this.stackResult[0] != null"); + if (this.stackResult[0].getDisplayName().toLowerCase().equals(getStackInSlot(0).getDisplayName().toLowerCase())){ + Utils.LOG_INFO("Items are the same?"); + } + else { + Utils.LOG_INFO("Items are not the same."); + } + } + } + + if (this.stackResult[0] != null) + { + Utils.LOG_INFO("this.stackResult[0] == null - Really never should be here though. - Returning "+this.stackResult[0].getDisplayName()); + ItemStack itemstack = this.stackResult[0]; + this.stackResult[0] = null; + return itemstack; + } + return null; + } + + /** + * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - + * like when you close a workbench GUI. + */ + @Override + public ItemStack getStackInSlotOnClosing(int p_70304_1_) + { + if (this.stackResult[0] != null) + { + ItemStack itemstack = this.stackResult[0]; + this.stackResult[0] = null; + return itemstack; + } + return null; + } + +} + + + +//Default Behaviour +/*@Override +public ItemStack decrStackSize(int slot, int amount) +{ + 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; +}*/ + +//Default Behaviour +/*@Override +public ItemStack getStackInSlotOnClosing(int slot) +{ + ItemStack stack = getStackInSlot(slot); + setInventorySlotContents(slot, null); + return stack; +}*/ + diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index bb482d96d5..6a1e496305 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -13,6 +13,7 @@ import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.fluid.FluidUtils; import gtPlusPlus.core.util.item.UtilsItems; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import net.minecraft.init.Items; import net.minecraft.item.ItemStack; public class RECIPES_GREGTECH { @@ -175,6 +176,13 @@ public class RECIPES_GREGTECH { GT_Values.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketFire_water", 0, 1), null, 120, 0); GT_Values.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); GT_Values.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketHootch", 0, 1), null, 36, 0); + + + + //CORE.RA.addFuel(UtilsItems.simpleMetaStack("EnderIO:bucketRocket_fuel", 0, 1), null, 112, 0); + GT_Values.RA.addFuel(UtilsItems.getSimpleStack(Items.lava_bucket), null, 32, 2); + GT_Values.RA.addFuel(UtilsItems.getIC2Cell(2), null, 32, 2); + GT_Values.RA.addFuel(UtilsItems.getIC2Cell(11), null, 24, 2); //System.exit(1); } @@ -196,9 +204,5 @@ public class RECIPES_GREGTECH { 240); } - private static void registerSkookumChoocher(){ - //GT_ModHandler.addCraftingRecipe(GT_OreDictUnificator.get(OrePrefixes.toolHeadUniversalSpade, aMaterial, 1L), tBits, new Object[]{"fX", Character.valueOf('X'), OrePrefixes.toolHeadShovel.get(aMaterial)}); - } - }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/slots/SlotNoInput.java b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java new file mode 100644 index 0000000000..fe51631a5d --- /dev/null +++ b/src/Java/gtPlusPlus/core/slots/SlotNoInput.java @@ -0,0 +1,23 @@ +package gtPlusPlus.core.slots; + +import net.minecraft.inventory.IInventory; +import net.minecraft.inventory.Slot; +import net.minecraft.item.ItemStack; + +public class SlotNoInput extends Slot{ + + public SlotNoInput(IInventory inventory, int x, int y, int z) { + super(inventory, x, y, z); + } + + @Override + public boolean isItemValid(ItemStack itemstack) { + return false; + } + + @Override + public int getSlotStackLimit() { + return 0; + } + +} diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java index 49ade0a10a..b0c4fefbf0 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityWorkbench.java @@ -1,6 +1,8 @@ package gtPlusPlus.core.tileentities.machines; import gtPlusPlus.core.inventories.InventoryWorkbenchChest; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloCrafting; +import gtPlusPlus.core.inventories.InventoryWorkbenchHoloSlots; import gtPlusPlus.core.inventories.InventoryWorkbenchTools; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; @@ -9,11 +11,14 @@ public class TileEntityWorkbench extends TileEntity { public InventoryWorkbenchChest inventoryChest; public InventoryWorkbenchTools inventoryTool; - //public InventoryWorkbenchCrafting inventoryCrafting; + public InventoryWorkbenchHoloSlots inventoryHolo; + public InventoryWorkbenchHoloCrafting inventoryCrafting; public TileEntityWorkbench(){ this.inventoryTool = new InventoryWorkbenchTools();//number of slots - without product slot this.inventoryChest = new InventoryWorkbenchChest();//number of slots - without product slot + this.inventoryHolo = new InventoryWorkbenchHoloSlots(); + this.inventoryCrafting = new InventoryWorkbenchHoloCrafting(); this.canUpdate(); } @@ -33,7 +38,8 @@ public class TileEntityWorkbench extends TileEntity { super.writeToNBT(nbt); inventoryChest.writeToNBT(getTag(nbt, "ContentsChest")); inventoryTool.writeToNBT(getTag(nbt, "ContentsTools")); - //inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); + inventoryCrafting.writeToNBT(getTag(nbt, "ContentsCrafting")); + inventoryHolo.writeToNBT(getTag(nbt, "ContentsHolo")); } @@ -43,7 +49,10 @@ public class TileEntityWorkbench extends TileEntity { super.readFromNBT(nbt); inventoryChest.readFromNBT(nbt.getCompoundTag("ContentsChest")); inventoryTool.readFromNBT(nbt.getCompoundTag("ContentsTools")); - //inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); + inventoryCrafting.readFromNBT(nbt.getCompoundTag("ContentsCrafting")); + inventoryHolo.readFromNBT(nbt.getCompoundTag("ContentsHolo")); } + + }
\ 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 52392aeb00..ec4e457489 100644 --- a/src/Java/gtPlusPlus/core/util/item/UtilsItems.java +++ b/src/Java/gtPlusPlus/core/util/item/UtilsItems.java @@ -1,6 +1,7 @@ package gtPlusPlus.core.util.item; import gregtech.api.enums.Materials; +import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gtPlusPlus.core.block.base.BasicBlock.BlockTypes; import gtPlusPlus.core.block.base.BlockBaseModular; @@ -65,6 +66,23 @@ public class UtilsItems { } } + public static ItemStack getIC2Cell(String S){ + ItemStack moreTemp = UtilsItems.getItemStackOfAmountFromOreDictNoBroken("cell"+S, 1); + + if (moreTemp == null){ + int cellID = 0; + ItemStack temp =GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, cellID); + return temp != null ? temp : null; + } + + return moreTemp; + } + + public static ItemStack getIC2Cell(int meta){ + ItemStack temp = GT_ModHandler.getModItem("IC2", "itemCellEmpty", 1L, meta); + return temp != null ? temp : null; + } + public static void getItemForOreDict(String FQRN, String oreDictName, String itemName, int meta){ try { @@ -86,10 +104,10 @@ public class UtilsItems { Utils.LOG_ERROR(itemName+" not found. [NULL]"); } } - + public static void addItemToOreDictionary(ItemStack stack, String oreDictName){ try { - GT_OreDictUnificator.registerOre(oreDictName, stack); + GT_OreDictUnificator.registerOre(oreDictName, stack); } catch (NullPointerException e) { Utils.LOG_ERROR(stack.getDisplayName()+" not registered. [NULL]"); } @@ -231,7 +249,7 @@ public class UtilsItems { Item itemSpawnEgg = new BasicSpawnEgg(entityModID, parSpawnName, colourEgg, colourOverlay).setUnlocalizedName("spawn_egg_"+parSpawnName.toLowerCase()).setTextureName(CORE.MODID+":spawn_egg"); GameRegistry.registerItem(itemSpawnEgg, "spawnEgg"+parSpawnName); } - + public static ItemStack[] validItemsForOreDict(String oredictName){ List<?> validNames = MaterialUtils.oreDictValuesForEntry(oredictName); @@ -245,58 +263,58 @@ public class UtilsItems { public static ItemStack getItemStackOfAmountFromOreDict(String oredictName, int amount){ ArrayList<ItemStack> oreDictList = OreDictionary.getOres(oredictName); if (!oreDictList.isEmpty()){ - ItemStack returnValue = oreDictList.get(0).copy(); - returnValue.stackSize = amount; - return returnValue; + ItemStack returnValue = oreDictList.get(0).copy(); + returnValue.stackSize = amount; + return returnValue; } - return getSimpleStack(ModItems.AAA_Broken, amount); + return getSimpleStack(ModItems.AAA_Broken, amount); } - + public static ItemStack getItemStackOfAmountFromOreDictNoBroken(String oredictName, int amount){ ItemStack returnValue = getItemStackOfAmountFromOreDict(oredictName, amount); - + if (returnValue.getItem().getClass() != ModItems.AAA_Broken.getClass() || returnValue.getItem() != ModItems.AAA_Broken){ - return returnValue; + return returnValue; } - Utils.LOG_INFO(oredictName+" was not valid."); - return null; + Utils.LOG_INFO(oredictName+" was not valid."); + return null; } - + public static void generateItemsFromMaterial(Material matInfo){ - + String unlocalizedName = matInfo.getUnlocalizedName(); String materialName = matInfo.getLocalizedName(); short[] C = matInfo.getRGBA(); int Colour = Utils.rgbtoHexValue(C[0], C[1], C[2]); boolean hotIngot = matInfo.requiresBlastFurnace(); int materialTier = matInfo.vTier; //TODO - + if (materialTier > 10 || materialTier <= 0){ materialTier = 2; } - - - + + + int sRadiation = 0; if (isRadioactive(materialName)){ sRadiation = getRadioactivityLevel(materialName); } - + if (sRadiation >= 1){ Item temp; Block tempBlock; tempBlock = new BlockBaseModular(unlocalizedName, materialName,BlockTypes.STANDARD, Colour); temp = new BaseItemIngot("itemIngot"+unlocalizedName, materialName, Colour, sRadiation); - + temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); - + temp = new BaseItemPlate("itemPlate"+unlocalizedName, materialName, Colour, materialTier, sRadiation); temp = new BaseItemRod(matInfo, sRadiation); temp = new BaseItemRodLong(matInfo, sRadiation); } - + else { Item temp; Block tempBlock; @@ -306,11 +324,11 @@ public class UtilsItems { if (hotIngot){ Item tempIngot = temp; temp = new BaseItemIngotHot("itemHotIngot"+unlocalizedName, materialName, UtilsItems.getSimpleStack(tempIngot, 1), materialTier); - } + } temp = new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, sRadiation); temp = new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, sRadiation); temp = new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, sRadiation); - + temp = new BaseItemPlate("itemPlate"+unlocalizedName, materialName, Colour, materialTier, sRadiation); temp = new BaseItemPlateDouble("itemPlateDouble"+unlocalizedName, materialName, Colour, materialTier, sRadiation); temp = new BaseItemBolt(matInfo); @@ -321,30 +339,30 @@ public class UtilsItems { temp = new BaseItemRotor("itemRotor"+unlocalizedName, materialName, Colour); temp = new BaseItemGear(matInfo); } - + RecipeGen_Plates.generateRecipes(matInfo); - + FluidUtils.generateFluid(matInfo, 1); - + } - + public static Item[] generateDusts(String unlocalizedName, String materialName, int materialTier, Material matInfo, int Colour){ int radioactive = getRadioactivityLevel(materialName); Item[] output = { - new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, radioactive), - new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, radioactive), - new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, radioactive)}; + new BaseItemDust("itemDust"+unlocalizedName, materialName, matInfo, Colour, "Dust", materialTier, radioactive), + new BaseItemDust("itemDustSmall"+unlocalizedName, materialName, matInfo, Colour, "Small", materialTier, radioactive), + new BaseItemDust("itemDustTiny"+unlocalizedName, materialName, matInfo, Colour, "Tiny", materialTier, radioactive)}; return output; } - + public static Item[] generateSpecialUseDusts(String unlocalizedName, String materialName, int Colour){ Item[] output = { - new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust"), - new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, Colour, "Small"), - new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")}; + new BaseItemDustUnique("itemDust"+unlocalizedName, materialName, Colour, "Dust"), + new BaseItemDustUnique("itemDustSmall"+unlocalizedName, materialName, Colour, "Small"), + new BaseItemDustUnique("itemDustTiny"+unlocalizedName, materialName, Colour, "Tiny")}; return output; } - + public static MultiPickaxeBase generateMultiPick(boolean GT_Durability, Materials material){ ToolMaterial customMaterial = Utils.generateMaterialFromGT(material); Utils.LOG_INFO("Generating a Multi-Pick out of "+material.name()); @@ -360,26 +378,26 @@ public class UtilsItems { dur = material.mDurability; Utils.LOG_INFO("Determined durability too low, "+material.name()+" is now "+dur+" based on the GT material durability."); } - + if (dur <= 0){ Utils.LOG_INFO("Still too low, "+material.name()+" will now go unused."); return null; } - + MultiPickaxeBase MP_Redstone = new MultiPickaxeBase( material.name()+" Multipick", (customMaterial), dur, Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2]) ); - + if (MP_Redstone.isValid){ return MP_Redstone; } return null; - + } - + public static MultiSpadeBase generateMultiShovel(boolean GT_Durability, Materials material){ ToolMaterial customMaterial = Utils.generateMaterialFromGT(material); Utils.LOG_INFO("Generating a Multi-Shovel out of "+material.name()); @@ -395,26 +413,26 @@ public class UtilsItems { dur = material.mDurability; Utils.LOG_INFO("Determined durability too low, "+material.name()+" is now "+dur+" based on the GT material durability."); } - + if (dur <= 0){ Utils.LOG_INFO("Still too low, "+material.name()+" will now go unused."); return null; } - + MultiSpadeBase MP_Redstone = new MultiSpadeBase( material.name()+" Multishovel", (customMaterial), dur, Utils.rgbtoHexValue(rgb[0],rgb[1],rgb[2]) ); - + if (MP_Redstone.isValid){ return MP_Redstone; } return null; - + } - + public static boolean isRadioactive(String materialName){ int sRadiation = 0; if (materialName.toLowerCase().contains("uranium")){ @@ -431,7 +449,7 @@ public class UtilsItems { } return false; } - + public static int getRadioactivityLevel(String materialName){ int sRadiation = 0; if (materialName.toLowerCase().contains("uranium")){ @@ -445,7 +463,7 @@ public class UtilsItems { } return sRadiation; } - + public static String getArrayStackNames(ItemStack[] aStack){ String itemNames = "Item Array: "; for (ItemStack alph : aStack){ @@ -453,9 +471,9 @@ public class UtilsItems { itemNames = temp + ", " + alph.getDisplayName() + " x" + alph.stackSize; } return itemNames; - + } - + public static String[] getArrayStackNamesAsArray(ItemStack[] aStack){ String[] itemNames = {}; int arpos = 0; @@ -464,9 +482,9 @@ public class UtilsItems { arpos++; } return itemNames; - + } - + public static String getFluidArrayStackNames(FluidStack[] aStack){ String itemNames = "Fluid Array: "; for (FluidStack alph : aStack){ @@ -474,7 +492,7 @@ public class UtilsItems { itemNames = temp + ", " + alph.getFluid().getName() + " x" + alph.amount; } return itemNames; - + } } diff --git a/src/Java/gtPlusPlus/core/util/math/MathUtils.java b/src/Java/gtPlusPlus/core/util/math/MathUtils.java index 3df5693bc3..b4aec5a8bf 100644 --- a/src/Java/gtPlusPlus/core/util/math/MathUtils.java +++ b/src/Java/gtPlusPlus/core/util/math/MathUtils.java @@ -103,6 +103,19 @@ public class MathUtils { public static double decimalRoundingToWholes(double d) { return 5*(Math.round(d/5)); } + + public static int roundToClosestMultiple(double number, int multiple) { + int result = multiple; + if (number % multiple == 0) { + return (int) number; + } + // If not already multiple of given number + if (number % multiple != 0) { + int division = (int) ((number / multiple) + 1); + result = division * multiple; + } + return result; + } /** diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index de0a72f484..346b239932 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -125,7 +125,10 @@ public enum GregtechItemList implements GregtechItemContainer { Industrial_MultiTank, Industrial_MultiTankDense, Casing_MultitankExterior, //Gt4 Workbenches - GT4_Workbench_Bronze, GT4_Workbench_Advanced; + GT4_Workbench_Bronze, GT4_Workbench_Advanced, + + //Geothermal Engines + Geothermal_Engine_EV, Geothermal_Engine_IV, Geothermal_Engine_LuV; public static final GregtechItemList[] DYE_ONLY_ITEMS = { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java index 47c8aedb98..c5bfc4ac7b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_AdvancedWorkbench.java @@ -1,19 +1,19 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import gregtech.api.gui.GT_ContainerMetaTile_Machine; import gregtech.api.gui.GT_Slot_Holo; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Log; import gregtech.api.util.GT_Utility; import gtPlusPlus.core.slots.SlotGtTool; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.gui.dev.GT_ContainerMetaTile_MachineEx; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -public class CONTAINER_AdvancedWorkbench extends GT_ContainerMetaTile_Machine { +public class CONTAINER_AdvancedWorkbench extends GT_ContainerMetaTile_MachineEx { public CONTAINER_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { super(aInventoryPlayer, aTileEntity); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java index 7da9238bd5..c52d50d674 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/GUI_AdvancedWorkbench.java @@ -1,12 +1,12 @@ package gtPlusPlus.xmod.gregtech.api.gui; -import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.gui.dev.GT_GUIContainerMetaTile_MachineEx; import net.minecraft.entity.player.InventoryPlayer; public class GUI_AdvancedWorkbench -extends GT_GUIContainerMetaTile_Machine +extends GT_GUIContainerMetaTile_MachineEx { public GUI_AdvancedWorkbench(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java new file mode 100644 index 0000000000..263254c751 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GregtechMetaTileEntityGeothermalGenerator.java @@ -0,0 +1,139 @@ +package gtPlusPlus.xmod.gregtech.common.tileentities.generators; + +import gregtech.api.GregTech_API; +import gregtech.api.enums.ConfigCategories; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.MetaTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicGenerator; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import cpw.mods.fml.common.registry.GameRegistry; + +public class GregtechMetaTileEntityGeothermalGenerator +extends GT_MetaTileEntity_BasicGenerator +{ + + public int mEfficiency; + + public GregtechMetaTileEntityGeothermalGenerator(int aID, String aName, String aNameRegional, int aTier) { + super(aID, aName, aNameRegional, aTier, "Requires Pahoehoe Lava or Normal Lava as Fuel", new ITexture[0]); + onConfigLoad(); + } + + public GregtechMetaTileEntityGeothermalGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, aDescription, aTextures); + onConfigLoad(); + } + + @Override + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + if (aBaseMetaTileEntity.isClientSide()){ + return true; + } + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + + @Override + public int getCapacity() { + //return MathUtils.roundToClosestMultiple(32000*(this.mTier/2), 25000); + return 5000*this.mTier; + } + + public void onConfigLoad() { + this.mEfficiency = GregTech_API.sMachineFile.get(ConfigCategories.machineconfig, "ThermalGenerator.efficiency.tier." + this.mTier, (100 - this.mTier * 7)); + } + + @Override + public int getEfficiency() { + return this.mEfficiency; + } + + @Override + public int getFuelValue(ItemStack aStack) { + int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); + if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { + rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); + } + return rValue; + } + + @Override + public boolean isOutputFacing(byte aSide) { + return aSide == getBaseMetaTileEntity().getFrontFacing(); + } + + @Override + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GregtechMetaTileEntityGeothermalGenerator(this.mName, this.mTier, this.mDescription, this.mTextures); + } + + @Override + public ITexture[] getFront(byte aColor) { + return new ITexture[]{super.getFront(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + } + + @Override + public ITexture[] getBack(byte aColor) { + return new ITexture[]{super.getBack(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK), new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP)}; + } + + @Override + public ITexture[] getBottom(byte aColor) { + return new ITexture[]{super.getBottom(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM)}; + } + + @Override + public ITexture[] getTop(byte aColor) { + return new ITexture[]{super.getTop(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER)}; + } + + @Override + public ITexture[] getSides(byte aColor) { + return new ITexture[]{super.getSides(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT)}; + } + + @Override + public ITexture[] getFrontActive(byte aColor) { + return new ITexture[]{super.getFrontActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE), Textures.BlockIcons.OVERLAYS_ENERGY_OUT[this.mTier]}; + } + + @Override + public ITexture[] getBackActive(byte aColor) { + return new ITexture[]{super.getBackActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE), new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE)}; + } + + @Override + public ITexture[] getBottomActive(byte aColor) { + return new ITexture[]{super.getBottomActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BOTTOM_ACTIVE)}; + } + + @Override + public ITexture[] getTopActive(byte aColor) { + return new ITexture[]{super.getTopActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE), new GT_RenderedTexture(Textures.BlockIcons.OVERLAY_FRONT_ROCK_BREAKER_ACTIVE)}; + } + + @Override + public ITexture[] getSidesActive(byte aColor) { + return new ITexture[]{super.getSidesActive(aColor)[0], new GT_RenderedTexture(Textures.BlockIcons.BOILER_LAVA_FRONT_ACTIVE)}; + } + + + @Override + public String[] getDescription() + { + return new String[] {"Generates power from Lava/Pahoehoe at " + getEfficiency() + "% Efficiency per tick"}; + } + + @Override + public GT_Recipe_Map getRecipes() + { + return GT_Recipe_Map.sHotFuels; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java new file mode 100644 index 0000000000..961abedc8d --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechGeothermalThermalGenerator.java @@ -0,0 +1,66 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.recipe.RECIPE_CONSTANTS; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityGeothermalGenerator; +import net.minecraft.item.ItemStack; + +public class GregtechGeothermalThermalGenerator { + + public static void run() + { + if (LoadedMods.Gregtech){ + Utils.LOG_INFO("Gregtech5u Content | Registering Industrial Geothermal Engines."); + run1(); + } + + } + + private static void run1(){ + GregtechItemList.Geothermal_Engine_EV.set(new GregtechMetaTileEntityGeothermalGenerator(830, "advancedgenerator.geothermalFuel.tier.01", "Basic Geothermal Engine", 4).getStackForm(1L)); + GregtechItemList.Geothermal_Engine_IV.set(new GregtechMetaTileEntityGeothermalGenerator(831, "advancedgenerator.geothermalFuel.tier.02", "Turbo Geothermal Engine", 5).getStackForm(1L)); + GregtechItemList.Geothermal_Engine_LuV.set(new GregtechMetaTileEntityGeothermalGenerator(832, "advancedgenerator.geothermalFuel.tier.03", "Vulcan Geothermal Engine", 6).getStackForm(1L)); + + GT_ModHandler.addCraftingRecipe( + GregtechItemList.Geothermal_Engine_EV.get(1L, new Object[0]), + GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"CEC", "GMG", "PWP", + Character.valueOf('M'), ItemList.Hull_EV, + Character.valueOf('P'), ItemList.Electric_Piston_EV, + Character.valueOf('E'), ItemList.Electric_Motor_EV, + Character.valueOf('C'), GregtechOrePrefixes.circuit.get(Materials.Ultimate), + Character.valueOf('W'), OrePrefixes.cableGt04.get(Materials.Aluminium), + Character.valueOf('G'), OrePrefixes.gearGt.get(Materials.Titanium)}); + + GT_ModHandler.addCraftingRecipe(GregtechItemList.Geothermal_Engine_IV.get(1L, new Object[0]), + GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"CEC", "GMG", "PWP", + Character.valueOf('M'), ItemList.Hull_IV, + Character.valueOf('P'), ItemList.Electric_Piston_IV, + Character.valueOf('E'), ItemList.Electric_Motor_IV, + Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Symbiotic), + Character.valueOf('W'), OrePrefixes.cableGt04.get(Materials.Platinum), + Character.valueOf('G'), OrePrefixes.gearGt.get(Materials.TungstenSteel)}); + + final ItemStack INGREDIENT_1 = RECIPE_CONSTANTS.electricPiston_LuV; + final ItemStack INGREDIENT_2 = RECIPE_CONSTANTS.electricMotor_LuV; + GT_ModHandler.addCraftingRecipe(GregtechItemList.Geothermal_Engine_LuV.get(1L, new Object[0]), + GT_ModHandler.RecipeBits.DISMANTLEABLE | GT_ModHandler.RecipeBits.NOT_REMOVABLE | GT_ModHandler.RecipeBits.REVERSIBLE | GT_ModHandler.RecipeBits.BUFFERED, + new Object[]{"CEC", "GMG", "PWP", + Character.valueOf('M'), ItemList.Hull_LuV, + Character.valueOf('P'), INGREDIENT_1, + Character.valueOf('E'), INGREDIENT_2, + Character.valueOf('C'), GregtechOrePrefixes.circuit.get(GT_Materials.Neutronic), + Character.valueOf('W'), OrePrefixes.cableGt04.get(Materials.Tungsten), + Character.valueOf('G'), OrePrefixes.gearGt.get(Materials.Chrome)}); + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java index 4632b306ed..690ebcc0ec 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechTieredFluidTanks.java @@ -3,8 +3,6 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.Utils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable; -import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_BronzeCraftingTable; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_TieredTank; import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_NBT_Tank; @@ -32,13 +30,7 @@ public class GregtechTieredFluidTanks GregtechItemList.GT_FluidTank_LuV.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.06", "Ludicrous Voltage Fluid Tank", 6).getStackForm(1L)); GregtechItemList.GT_FluidTank_ZPM.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.07", "ZPM Voltage Fluid Tank", 7).getStackForm(1L)); GregtechItemList.GT_FluidTank_UV.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.08", "Ultimate Voltage Fluid Tank", 8).getStackForm(1L)); - GregtechItemList.GT_FluidTank_MAX.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.09", "MAX Voltage Fluid Tank", 9).getStackForm(1L)); - - //Gregtech 4 Workbenches - GregtechItemList.GT4_Workbench_Bronze.set(new GT_MetaTileEntity_BronzeCraftingTable(828, "workbench.bronze", "Bronze Workbench", 0).getStackForm(1L)); - GregtechItemList.GT4_Workbench_Advanced.set(new GT_MetaTileEntity_AdvancedCraftingTable(829, "workbench.advanced", "Advanced Workbench", 1).getStackForm(1L)); - - + GregtechItemList.GT_FluidTank_MAX.set(new GT_MetaTileEntity_TieredTank(ID++, "fluidtank.tier.09", "MAX Voltage Fluid Tank", 9).getStackForm(1L)); } private static void run2() diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWorkbenches.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWorkbenches.java new file mode 100644 index 0000000000..4486bc5cd5 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechWorkbenches.java @@ -0,0 +1,29 @@ +package gtPlusPlus.xmod.gregtech.registration.gregtech; + +import gtPlusPlus.core.lib.LoadedMods; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_AdvancedCraftingTable; +import gtPlusPlus.xmod.gregtech.common.tileentities.storage.GT_MetaTileEntity_BronzeCraftingTable; + +public class GregtechWorkbenches +{ + public static void run() + { + if (LoadedMods.Gregtech){ + Utils.LOG_INFO("Gregtech5u Content | Registering Workbenches."); + run1(); + //run2(); + } + + } + + private static void run1() + { + //Gregtech 4 Workbenches + GregtechItemList.GT4_Workbench_Bronze.set(new GT_MetaTileEntity_BronzeCraftingTable(828, "workbench.bronze", "Bronze Workbench", 0).getStackForm(1L)); + GregtechItemList.GT4_Workbench_Advanced.set(new GT_MetaTileEntity_AdvancedCraftingTable(829, "workbench.advanced", "Advanced Workbench", 1).getStackForm(1L)); + + + } +} |