aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlkalus <draknyte1@hotmail.com>2017-09-12 09:29:45 +1000
committerAlkalus <draknyte1@hotmail.com>2017-09-12 09:29:45 +1000
commit7721a5dd91d121a0921350572a45a1a39ee1ecfe (patch)
tree51c3e6fc045f661d79e1aad700a72b32f219304b /src
parent8abed1cad3f586e3aa5629aa6cf0a7b3cf7c99fe (diff)
downloadGT5-Unofficial-7721a5dd91d121a0921350572a45a1a39ee1ecfe.tar.gz
GT5-Unofficial-7721a5dd91d121a0921350572a45a1a39ee1ecfe.tar.bz2
GT5-Unofficial-7721a5dd91d121a0921350572a45a1a39ee1ecfe.zip
+ Created the Project Table.
Diffstat (limited to 'src')
-rw-r--r--src/Java/gtPlusPlus/core/block/ModBlocks.java2
-rw-r--r--src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java154
-rw-r--r--src/Java/gtPlusPlus/core/container/Container_ProjectTable.java195
-rw-r--r--src/Java/gtPlusPlus/core/gui/machine/GUI_ProjectTable.java65
-rw-r--r--src/Java/gtPlusPlus/core/handler/GuiHandler.java12
-rw-r--r--src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectMain.java188
-rw-r--r--src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectOutput.java188
-rw-r--r--src/Java/gtPlusPlus/core/slots/SlotDataStick.java36
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java3
-rw-r--r--src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java112
-rw-r--r--src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java6
-rw-r--r--src/resources/assets/miscutils/textures/gui/ProjectTable.pngbin0 -> 2453 bytes
12 files changed, 949 insertions, 12 deletions
diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java
index d0b501b58f..d351926350 100644
--- a/src/Java/gtPlusPlus/core/block/ModBlocks.java
+++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java
@@ -42,6 +42,7 @@ public final class ModBlocks {
public static Block blockHellfire;
public static Block blockInfiniteFLuidTank;
+ public static Block blockProjectTable;
public static void init() {
Utils.LOG_INFO("Initializing Blocks.");
@@ -68,6 +69,7 @@ public final class ModBlocks {
blockOreFluorite = new BlockBaseOre("oreFluorite", "Fluorite", Material.rock, BlockTypes.ORE, Utils.rgbtoHexValue(120, 120, 30), 3);
blockMiningExplosive = new MiningExplosives();
blockHellfire = new HellFire();
+ blockProjectTable = new Machine_ProjectTable();
}
diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java b/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java
new file mode 100644
index 0000000000..8315bbb4d9
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/block/machine/Machine_ProjectTable.java
@@ -0,0 +1,154 @@
+package gtPlusPlus.core.block.machine;
+
+import cpw.mods.fml.common.Optional;
+import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.GTplusplus;
+import gtPlusPlus.core.creative.AddToCreativeTab;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.lib.LoadedMods;
+import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
+import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
+import gtPlusPlus.core.util.Utils;
+import gtPlusPlus.core.util.player.PlayerUtils;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+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;
+
+@Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO")
+public class Machine_ProjectTable extends BlockContainer
+{
+ @SideOnly(Side.CLIENT)
+ private IIcon textureTop;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureBottom;
+ @SideOnly(Side.CLIENT)
+ private IIcon textureFront;
+
+ @SuppressWarnings("deprecation")
+ public Machine_ProjectTable()
+ {
+ super(Material.iron);
+ this.setBlockName("blockProjectBench");
+ this.setCreativeTab(AddToCreativeTab.tabMachines);
+ GameRegistry.registerBlock(this, "blockProjectBench");
+ LanguageRegistry.addName(this, "Project Workbench");
+
+ }
+
+ /**
+ * Gets the block's texture. Args: side, meta
+ */
+ @Override
+ @SideOnly(Side.CLIENT)
+ public IIcon getIcon(final int p_149691_1_, final int p_149691_2_)
+ {
+ return p_149691_1_ == 1 ? this.textureTop : (p_149691_1_ == 0 ? this.textureBottom : ((p_149691_1_ != 2) && (p_149691_1_ != 4) ? this.blockIcon : this.textureFront));
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerBlockIcons(final IIconRegister p_149651_1_)
+ {
+ this.blockIcon = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top");
+ this.textureTop = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "cover_crafting");
+ this.textureBottom = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top");
+ this.textureFront = p_149651_1_.registerIcon(CORE.MODID + ":" + "TileEntities/" + "machine_top");
+ }
+
+ /**
+ * Called upon block activation (right click on the block.)
+ */
+ @Override
+ public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, final int side, final float lx, final float ly, final float lz)
+ {
+
+ ItemStack heldItem = null;
+ if (world.isRemote){
+ heldItem = PlayerUtils.getItemStackInPlayersHand();
+ }
+
+ boolean holdingWrench = false;
+
+ if (heldItem != null){
+ holdingWrench = isWrench(heldItem);
+ }
+
+ if (world.isRemote) {
+ return true;
+ }
+
+ final TileEntity te = world.getTileEntity(x, y, z);
+ if ((te != null) && (te instanceof TileEntityWorkbench))
+ {
+ if (!holdingWrench){
+ player.openGui(GTplusplus.instance, 0, world, x, y, z);
+ return true;
+ }
+ Utils.LOG_INFO("Holding a Wrench, doing wrench things instead.");
+ }
+ return false;
+ }
+
+ @Override
+ public TileEntity createNewTileEntity(final World world, final int p_149915_2_) {
+ return new TileEntityProjectTable();
+ }
+
+ public static boolean isWrench(final ItemStack item){
+ if (item.getItem() instanceof ItemToolWrench){
+ return true;
+ }
+ if (LoadedMods.BuildCraft){
+ return checkBuildcraftWrench(item);
+ }
+ if (LoadedMods.EnderIO){
+ return checkEnderIOWrench(item);
+ }
+ return false;
+ }
+
+ @Optional.Method(modid = "EnderIO")
+ private static boolean checkEnderIOWrench(final ItemStack item){
+ if (ReflectionUtils.doesClassExist("crazypants.enderio.api.tool.ITool")){
+ Class<?> wrenchClass;
+ try {
+ wrenchClass = Class.forName("crazypants.enderio.api.tool.ITool");
+ if (wrenchClass.isInstance(item.getItem())){
+ return true;
+ }
+ }
+ catch (final ClassNotFoundException e1) {
+ return false;
+ }
+ }
+ return false;
+ }
+
+ @Optional.Method(modid = "Buildcraft")
+ private static boolean checkBuildcraftWrench(final ItemStack item){
+ if (ReflectionUtils.doesClassExist("buildcraft.api.tools.IToolWrench")){
+ Class<?> wrenchClass;
+ try {
+ wrenchClass = Class.forName("buildcraft.api.tools.IToolWrench");
+ if (wrenchClass.isInstance(item.getItem())){
+ return true;
+ }
+ }
+ catch (final ClassNotFoundException e1) {
+ return false;
+ }
+ }
+ return false;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java b/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java
new file mode 100644
index 0000000000..f667796098
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/container/Container_ProjectTable.java
@@ -0,0 +1,195 @@
+package gtPlusPlus.core.container;
+
+import gtPlusPlus.core.block.ModBlocks;
+import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain;
+import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput;
+import gtPlusPlus.core.slots.*;
+import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
+import gtPlusPlus.core.util.Utils;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.*;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+public class Container_ProjectTable extends Container {
+
+ protected TileEntityProjectTable tile_entity;
+ public final InventoryProjectMain inventoryGrid;
+ public final InventoryProjectOutput inventoryOutputs;
+
+ private final World worldObj;
+ private final int posX;
+ private final int posY;
+ private final int posZ;
+
+ public static int StorageSlotNumber = 9; //Number of slots in storage area
+ public static int InOutputSlotNumber = StorageSlotNumber; //Same plus Output Slot
+ public static int InventorySlotNumber = 36; //Inventory Slots (Inventory and Hotbar)
+ public static int InventoryOutSlotNumber = InventorySlotNumber + 1; //Inventory Slot Number + Output
+ public static int FullSlotNumber = InventorySlotNumber + InOutputSlotNumber; //All slots
+
+ private final int[] slotOutputs = new int[2];
+ private final int[] slotGrid = new int[9];
+
+
+ public Container_ProjectTable(final InventoryPlayer inventory, final TileEntityProjectTable tile){
+ this.tile_entity = tile;
+ this.inventoryGrid = tile.inventoryGrid;
+ this.inventoryOutputs = tile.inventoryOutputs;
+
+ int var6;
+ int var7;
+ this.worldObj = tile.getWorldObj();
+ this.posX = tile.xCoord;
+ this.posY = tile.yCoord;
+ this.posZ = tile.zCoord;
+
+ int o=0;
+
+ //Output slots
+ this.addSlotToContainer(new SlotDataStick(this.inventoryOutputs, 0, 136, 64));
+ this.addSlotToContainer(new SlotNoInput(this.inventoryOutputs, 1, 136, 64));
+
+ for (int i=1; i<2; i++){
+ this.slotOutputs[o] = i;
+ o++;
+ }
+
+
+ o=0;
+
+ //Storage Side
+ for (var6 = 0; var6 < 3; ++var6)
+ {
+ for (var7 = 0; var7 < 3; ++var7)
+ {
+ //Utils.LOG_WARNING("Adding slots at var:"+(var7 + var6 * 4)+" x:"+(8 + var7 * 18)+" y:"+(7 + var6 * 18));
+ this.addSlotToContainer(new Slot(this.inventoryGrid, var7 + (var6 * 4), 8 + (var7 * 18), 7 + (var6 * 18)));
+ this.slotGrid[o] = o+2;
+ o++;
+ }
+ }
+
+ o=0;
+
+ //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));
+ }
+
+ }
+
+ @Override
+ public ItemStack slotClick(final int aSlotIndex, final int aMouseclick, final int aShifthold, final EntityPlayer aPlayer){
+
+ if (!aPlayer.worldObj.isRemote){
+ if ((aSlotIndex == 999) || (aSlotIndex == -999)){
+ //Utils.LOG_WARNING("??? - "+aSlotIndex);
+ }
+
+ if (aSlotIndex == 0){
+ Utils.LOG_WARNING("Player Clicked on the Data Stick slot");
+ //TODO
+ }if (aSlotIndex == 1){
+ Utils.LOG_WARNING("Player Clicked on the output slot");
+ //TODO
+ }
+
+ for (final int x : this.slotGrid){
+ if (aSlotIndex == x){
+ Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the crafting Grid");
+ }
+ }
+ }
+ //Utils.LOG_WARNING("Player Clicked slot "+aSlotIndex+" in the Grid");
+ return super.slotClick(aSlotIndex, aMouseclick, aShifthold, aPlayer);
+ }
+
+ @Override
+ public boolean canInteractWith(final EntityPlayer par1EntityPlayer){
+ if (this.worldObj.getBlock(this.posX, this.posY, this.posZ) != ModBlocks.blockWorkbench){
+ return false;
+ }
+
+ return par1EntityPlayer.getDistanceSq(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D) <= 64D;
+ }
+
+
+ @Override
+ public ItemStack transferStackInSlot(final EntityPlayer par1EntityPlayer, final int par2)
+ {
+ ItemStack var3 = null;
+ final Slot var4 = (Slot)this.inventorySlots.get(par2);
+
+ if ((var4 != null) && var4.getHasStack())
+ {
+ final ItemStack var5 = var4.getStack();
+ var3 = var5.copy();
+
+ if (par2 == 0)
+ {
+ if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, true))
+ {
+ return null;
+ }
+
+ var4.onSlotChange(var5, var3);
+ }
+ else if ((par2 >= InOutputSlotNumber) && (par2 < InventoryOutSlotNumber))
+ {
+ if (!this.mergeItemStack(var5, InventoryOutSlotNumber, FullSlotNumber, false))
+ {
+ return null;
+ }
+ }
+ else if ((par2 >= InventoryOutSlotNumber) && (par2 < FullSlotNumber))
+ {
+ if (!this.mergeItemStack(var5, InOutputSlotNumber, InventoryOutSlotNumber, false))
+ {
+ return null;
+ }
+ }
+ else if (!this.mergeItemStack(var5, InOutputSlotNumber, FullSlotNumber, false))
+ {
+ return null;
+ }
+
+ if (var5.stackSize == 0)
+ {
+ var4.putStack((ItemStack)null);
+ }
+ else
+ {
+ var4.onSlotChanged();
+ }
+
+ if (var5.stackSize == var3.stackSize)
+ {
+ return null;
+ }
+
+ var4.onPickupFromSlot(par1EntityPlayer, var5);
+ }
+
+ return var3;
+ }
+
+ //Can merge Slot
+ @Override
+ public boolean func_94530_a(final ItemStack p_94530_1_, final Slot p_94530_2_) {
+ return 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_ProjectTable.java b/src/Java/gtPlusPlus/core/gui/machine/GUI_ProjectTable.java
new file mode 100644
index 0000000000..98c8a2dad0
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/gui/machine/GUI_ProjectTable.java
@@ -0,0 +1,65 @@
+package gtPlusPlus.core.gui.machine;
+
+import org.lwjgl.opengl.GL11;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gtPlusPlus.core.container.Container_ProjectTable;
+import gtPlusPlus.core.container.Container_Workbench;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
+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;
+
+@SideOnly(Side.CLIENT)
+public class GUI_ProjectTable extends GuiContainer {
+
+ private static final ResourceLocation craftingTableGuiTextures = new ResourceLocation(CORE.MODID, "textures/gui/ProjectTable.png");
+
+ public GUI_ProjectTable(final InventoryPlayer player_inventory, final TileEntityProjectTable tile){
+ super(new Container_ProjectTable(player_inventory, tile));
+ }
+
+
+ @Override
+ protected void drawGuiContainerForegroundLayer(final int i, final int j){
+ //this.fontRendererObj.drawString(I18n.format("Workbench", new Object[0]), 28, 6, 4210752);
+ //this.fontRendererObj.drawString(I18n.format("container.inventory", new Object[0]), 8, this.ySize - 96 + 2, 4210752);
+
+ }
+
+
+ @Override
+ protected void drawGuiContainerBackgroundLayer(final float f, final int i, final int j){
+ GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
+ this.mc.renderEngine.bindTexture(craftingTableGuiTextures);
+ final int x = (this.width - this.xSize) / 2;
+ final int y = (this.height - this.ySize) / 2;
+ this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize);
+ }
+
+
+ //This method is called when the Gui is first called!
+ @Override
+ public void initGui(){
+ //You have to add this line for the Gui to function properly!
+ super.initGui();
+
+ //The parameters of GuiButton are(id, x, y, width, height, text);
+ //this.buttonList.add(new GuiButton( 1, 367, 132, 18, 18, "X"));
+ //this.buttonList.add(new GuiButton( 2, 385, 132, 18, 18, "Y"));
+ //NOTE: the id always has to be different or else it might get called twice or never!
+
+ //Add any other buttons here too!
+ }
+
+ @Override
+ protected void actionPerformed(final GuiButton B){
+
+
+ }
+
+} \ 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 75c85fdaa4..cb120f0254 100644
--- a/src/Java/gtPlusPlus/core/handler/GuiHandler.java
+++ b/src/Java/gtPlusPlus/core/handler/GuiHandler.java
@@ -13,6 +13,7 @@ import gtPlusPlus.core.inventories.BaseInventoryBackpack;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.tileentities.general.TileEntityFishTrap;
import gtPlusPlus.core.tileentities.general.TileEntityHeliumGenerator;
+import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
import gtPlusPlus.core.util.Utils;
@@ -23,7 +24,7 @@ import net.minecraft.world.World;
public class GuiHandler implements IGuiHandler {
- public static final int GUI1 = 0; //Frame Alveary
+ public static final int GUI1 = 0; //Project Table
public static final int GUI2 = 1; //Helium Generator
public static final int GUI3 = 2; //BackpackHandler
public static final int GUI4 = 3; //Workbench
@@ -49,9 +50,7 @@ public class GuiHandler implements IGuiHandler {
if (te != null){
if (ID == GUI1){
- if (CORE.configSwitches.enableCustomAlvearyBlocks){
- //return new CONTAINER_FrameHousing((TileAlvearyFrameHousing)te, player);
- }
+ return new Container_ProjectTable(player.inventory, (TileEntityProjectTable)te);
}
else if (ID == GUI2){
//HeliumGenerator
@@ -98,10 +97,7 @@ public class GuiHandler implements IGuiHandler {
final TileEntity te = world.getTileEntity(x, y, z);
if (te != null){
if (ID == GUI1){
- if (CORE.configSwitches.enableCustomAlvearyBlocks){
- Utils.LOG_WARNING("Opening Gui with Id: "+ID+" Alveary Frame Housing");
- //return new GUI_FrameHousing((TileAlvearyFrameHousing) te, player);
- }
+ return new GUI_ProjectTable(player.inventory, (TileEntityProjectTable)te);
}
else if (ID == GUI2){
Utils.LOG_WARNING("Opening Gui with Id: "+ID+" RTG");
diff --git a/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectMain.java b/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectMain.java
new file mode 100644
index 0000000000..f1b3ae76a2
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectMain.java
@@ -0,0 +1,188 @@
+package gtPlusPlus.core.inventories.projecttable;
+
+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 InventoryProjectMain implements IInventory{
+
+ private final String name = "Inventory Grid";
+
+ /** 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 InventoryProjectMain()
+ {
+
+ }
+
+ public void readFromNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
+ {
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE))
+ {
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ }
+
+ public void writeToNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
+ {
+ final ItemStack stack = this.inventory[i];
+ if(stack != null)
+ {
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
+ @Override
+ public int getSizeInventory()
+ {
+ return this.inventory.length;
+ }
+
+ public ItemStack[] getInventory(){
+ return this.inventory;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int slot)
+ {
+ return this.inventory[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int slot, final int amount)
+ {
+ ItemStack stack = this.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!
+ this.markDirty();
+ }
+ else
+ {
+ // this method also calls markDirty, so we don't need to call it again
+ this.setInventorySlotContents(slot, null);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int slot)
+ {
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
+ {
+ this.inventory[slot] = stack;
+
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
+ {
+ stack.stackSize = this.getInventoryStackLimit();
+ }
+
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+
+ // 1.7.2+ renamed to getInventoryName
+ @Override
+ public String getInventoryName()
+ {
+ return this.name;
+ }
+
+ // 1.7.2+ renamed to hasCustomInventoryName
+ @Override
+ public boolean hasCustomInventoryName()
+ {
+ return this.name.length() > 0;
+ }
+
+ @Override
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ /**
+ * 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 < this.getSizeInventory(); ++i)
+ {
+ final ItemStack temp = this.getStackInSlot(i);
+ if (temp != null){
+ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
+ }
+
+ if ((temp != null) && (temp.stackSize == 0)) {
+ this.inventory[i] = null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final 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(final int slot, final 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
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectOutput.java b/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectOutput.java
new file mode 100644
index 0000000000..41ddd06ef1
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/inventories/projecttable/InventoryProjectOutput.java
@@ -0,0 +1,188 @@
+package gtPlusPlus.core.inventories.projecttable;
+
+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 InventoryProjectOutput implements IInventory{
+
+ private final String name = "Inventory Output";
+
+ /** Defining your inventory size this way is handy */
+ public static final int INV_SIZE = 2;
+
+ /** 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 InventoryProjectOutput()
+ {
+
+ }
+
+ public void readFromNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = nbt.getTagList("Items", 10);
+ this.inventory = new ItemStack[INV_SIZE];
+ for(int i = 0;i<list.tagCount();i++)
+ {
+ final NBTTagCompound data = list.getCompoundTagAt(i);
+ final int slot = data.getInteger("Slot");
+ if((slot >= 0) && (slot < INV_SIZE))
+ {
+ this.inventory[slot] = ItemStack.loadItemStackFromNBT(data);
+ }
+ }
+ }
+
+ public void writeToNBT(final NBTTagCompound nbt)
+ {
+ final NBTTagList list = new NBTTagList();
+ for(int i = 0;i<INV_SIZE;i++)
+ {
+ final ItemStack stack = this.inventory[i];
+ if(stack != null)
+ {
+ final NBTTagCompound data = new NBTTagCompound();
+ stack.writeToNBT(data);
+ data.setInteger("Slot", i);
+ list.appendTag(data);
+ }
+ }
+ nbt.setTag("Items", list);
+ }
+
+ @Override
+ public int getSizeInventory()
+ {
+ return this.inventory.length;
+ }
+
+ public ItemStack[] getInventory(){
+ return this.inventory;
+ }
+
+ @Override
+ public ItemStack getStackInSlot(final int slot)
+ {
+ return this.inventory[slot];
+ }
+
+ @Override
+ public ItemStack decrStackSize(final int slot, final int amount)
+ {
+ ItemStack stack = this.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!
+ this.markDirty();
+ }
+ else
+ {
+ // this method also calls markDirty, so we don't need to call it again
+ this.setInventorySlotContents(slot, null);
+ }
+ }
+ return stack;
+ }
+
+ @Override
+ public ItemStack getStackInSlotOnClosing(final int slot)
+ {
+ final ItemStack stack = this.getStackInSlot(slot);
+ this.setInventorySlotContents(slot, null);
+ return stack;
+ }
+
+ @Override
+ public void setInventorySlotContents(final int slot, final ItemStack stack)
+ {
+ this.inventory[slot] = stack;
+
+ if ((stack != null) && (stack.stackSize > this.getInventoryStackLimit()))
+ {
+ stack.stackSize = this.getInventoryStackLimit();
+ }
+
+ // Don't forget this line or your inventory will not be saved!
+ this.markDirty();
+ }
+
+ // 1.7.2+ renamed to getInventoryName
+ @Override
+ public String getInventoryName()
+ {
+ return this.name;
+ }
+
+ // 1.7.2+ renamed to hasCustomInventoryName
+ @Override
+ public boolean hasCustomInventoryName()
+ {
+ return this.name.length() > 0;
+ }
+
+ @Override
+ public int getInventoryStackLimit()
+ {
+ return 64;
+ }
+
+ /**
+ * 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 < this.getSizeInventory(); ++i)
+ {
+ final ItemStack temp = this.getStackInSlot(i);
+ if (temp != null){
+ //Utils.LOG_INFO("Slot "+i+" contains "+temp.getDisplayName()+" x"+temp.stackSize);
+ }
+
+ if ((temp != null) && (temp.stackSize == 0)) {
+ this.inventory[i] = null;
+ }
+ }
+ }
+
+ @Override
+ public boolean isUseableByPlayer(final 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(final int slot, final 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
+ return true;
+ }
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/core/slots/SlotDataStick.java b/src/Java/gtPlusPlus/core/slots/SlotDataStick.java
new file mode 100644
index 0000000000..2c8e073769
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/slots/SlotDataStick.java
@@ -0,0 +1,36 @@
+package gtPlusPlus.core.slots;
+
+import gregtech.api.enums.ItemList;
+import gregtech.api.enums.OrePrefixes;
+import gregtech.api.items.GT_MetaGenerated_Tool;
+import gregtech.common.items.GT_MetaGenerated_Item_01;
+import gregtech.common.items.GT_MetaGenerated_Item_02;
+import gregtech.common.items.behaviors.Behaviour_DataStick;
+import net.minecraft.inventory.IInventory;
+import net.minecraft.inventory.Slot;
+import net.minecraft.item.ItemStack;
+
+public class SlotDataStick extends Slot{
+
+ public SlotDataStick(final IInventory inventory, final int slot, final int x, final int y) {
+ super(inventory, slot, x, y);
+
+ }
+
+ @Override
+ public boolean isItemValid(final ItemStack itemstack) {
+ boolean isValid = false;
+
+ if (itemstack != null){
+ if ((itemstack.getItem() instanceof GT_MetaGenerated_Item_01 && itemstack.getItemDamage() == 708) || (itemstack == ItemList.Tool_DataStick.get(1))){
+ isValid = true;
+ }
+ }
+ return isValid;
+ }
+
+ @Override
+ public int getSlotStackLimit() {
+ return 1;
+ }
+}
diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
index b7b19aca36..2e644d6f9b 100644
--- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
+++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java
@@ -2,6 +2,7 @@ package gtPlusPlus.core.tileentities;
import cpw.mods.fml.common.registry.GameRegistry;
import gtPlusPlus.core.tileentities.general.*;
+import gtPlusPlus.core.tileentities.machines.TileEntityProjectTable;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbench;
import gtPlusPlus.core.tileentities.machines.TileEntityWorkbenchAdvanced;
import gtPlusPlus.core.util.Utils;
@@ -21,7 +22,7 @@ public class ModTileEntities {
GameRegistry.registerTileEntity(TileEntityFishTrap.class, "TileFishTrap");
GameRegistry.registerTileEntity(TileEntityFirepit.class, "TileFirePit");
GameRegistry.registerTileEntity(TileEntityInfiniteFluid.class, "TileInfiniteFluid");
-
+ GameRegistry.registerTileEntity(TileEntityProjectTable.class, "TileProjectTable");
}
}
diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java
new file mode 100644
index 0000000000..75d0078587
--- /dev/null
+++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityProjectTable.java
@@ -0,0 +1,112 @@
+package gtPlusPlus.core.tileentities.machines;
+
+import java.util.List;
+import java.util.Vector;
+
+import gtPlusPlus.core.inventories.*;
+import gtPlusPlus.core.inventories.projecttable.InventoryProjectMain;
+import gtPlusPlus.core.inventories.projecttable.InventoryProjectOutput;
+import ic2.api.network.INetworkDataProvider;
+import ic2.api.network.INetworkUpdateListener;
+import ic2.api.tile.IWrenchable;
+import ic2.core.IC2;
+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;
+
+public class TileEntityProjectTable extends TileEntity implements INetworkDataProvider, INetworkUpdateListener, IWrenchable{
+
+ public InventoryProjectMain inventoryGrid;
+ public InventoryProjectOutput inventoryOutputs;
+
+ public TileEntityProjectTable(){
+ this.inventoryGrid = new InventoryProjectMain();//number of slots - without product slot
+ this.inventoryOutputs = new InventoryProjectOutput();//number of slots - without product slot
+ this.canUpdate();
+ }
+
+ @SuppressWarnings("static-method")
+ public NBTTagCompound getTag(final NBTTagCompound nbt, final String tag){
+ if(!nbt.hasKey(tag))
+ {
+ nbt.setTag(tag, new NBTTagCompound());
+ }
+ return nbt.getCompoundTag(tag);
+ }
+
+ @Override
+ public void writeToNBT(final NBTTagCompound nbt){
+ super.writeToNBT(nbt);
+ nbt.setShort("facing", this.facing);
+ this.inventoryGrid.writeToNBT(this.getTag(nbt, "ContentsGrid"));
+ this.inventoryOutputs.writeToNBT(this.getTag(nbt, "ContentsOutput"));
+
+ }
+
+ @Override
+ public void readFromNBT(final NBTTagCompound nbt){
+ super.readFromNBT(nbt);
+ this.prevFacing = (this.facing = nbt.getShort("facing"));
+ this.inventoryGrid.readFromNBT(nbt.getCompoundTag("ContentsGrid"));
+ this.inventoryOutputs.readFromNBT(nbt.getCompoundTag("ContentsOutput"));
+ }
+
+ @Override
+ public List<String> getNetworkedFields(){
+ final List<String> ret = new Vector(2);
+ ret.add("facing");
+ return ret;
+ }
+
+
+ @Override
+ public boolean wrenchCanSetFacing(final EntityPlayer entityPlayer, final int side){
+ return false;
+ }
+
+ private short facing = 0;
+ public short prevFacing = 0;
+
+ @Override
+ public void setFacing(final short facing1){
+ this.facing = facing1;
+ if (this.prevFacing != facing1) {
+ IC2.network.get().updateTileEntityField(this, "facing");
+ }
+ this.prevFacing = facing1;
+ }
+
+ @Override
+ public short getFacing(){
+ return this.facing;
+ }
+
+
+ @Override
+ public boolean wrenchCanRemove(final EntityPlayer entityPlayer){
+ return true;
+ }
+
+ @Override
+ public float getWrenchDropRate(){
+ return 1.0F;
+ }
+
+ @Override
+ public ItemStack getWrenchDrop(final EntityPlayer entityPlayer){
+ return new ItemStack(this.worldObj.getBlock(this.xCoord, this.yCoord, this.zCoord), 1, this.worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord));
+ }
+
+ @Override
+ public void onNetworkUpdate(final String field) {
+ this.prevFacing = this.facing;
+
+ }
+
+
+
+} \ No newline at end of file
diff --git a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java
index 74289f2cf3..6aa78ec858 100644
--- a/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java
+++ b/src/Java/gtPlusPlus/preloader/asm/Preloader_DummyContainer.java
@@ -51,19 +51,19 @@ public class Preloader_DummyContainer extends DummyModContainer {
@EventHandler
public void load(final FMLInitializationEvent e) {
- Utils.LOG_INFO("Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION);
+ Utils.LOG_INFO("[GT++ ASM] Begin resource allocation for " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION);
}
@Subscribe
public void preInit(FMLPreInitializationEvent event) {
- Utils.LOG_INFO("Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION);
+ Utils.LOG_INFO("[GT++ ASM] Loading " + CORE_Preloader.MODID + " V" + CORE_Preloader.VERSION);
// Handle GT++ Config
handleConfigFile(event);
}
@Subscribe
public void postInit(FMLPostInitializationEvent evt) {
- Utils.LOG_INFO("Finished loading GT++ Pre-Loader.");
+ Utils.LOG_INFO("[GT++ ASM] Finished loading GT++ Pre-Loader.");
}
public static void handleConfigFile(final FMLPreInitializationEvent event) {
diff --git a/src/resources/assets/miscutils/textures/gui/ProjectTable.png b/src/resources/assets/miscutils/textures/gui/ProjectTable.png
new file mode 100644
index 0000000000..9579187da3
--- /dev/null
+++ b/src/resources/assets/miscutils/textures/gui/ProjectTable.png
Binary files differ