diff --git a/src/main/java/fox/spiteful/avaritia/blocks/LudicrousBlocks.java b/src/main/java/fox/spiteful/avaritia/blocks/LudicrousBlocks.java index bd935e1..0113922 100644 --- a/src/main/java/fox/spiteful/avaritia/blocks/LudicrousBlocks.java +++ b/src/main/java/fox/spiteful/avaritia/blocks/LudicrousBlocks.java @@ -2,7 +2,6 @@ package fox.spiteful.avaritia.blocks; import cpw.mods.fml.common.registry.GameRegistry; import fox.spiteful.avaritia.Config; -import fox.spiteful.avaritia.tile.TileEntityAutoDireCrafting; import fox.spiteful.avaritia.tile.TileEntityCompressor; import fox.spiteful.avaritia.tile.TileEntityDireCrafting; import fox.spiteful.avaritia.tile.TileEntityNeutron; @@ -30,9 +29,7 @@ public class LudicrousBlocks { double_craft = GameRegistry.registerBlock(new BlockDoubleCraft(), "Double_Craft"); triple_craft = GameRegistry.registerBlock(new BlockTripleCraft(), "Triple_Craft"); dire_crafting = GameRegistry.registerBlock(new BlockDireCrafting(), "Dire_Crafting"); - //auto_dire_crafting =GameRegistry.registerBlock(new BlockAutoDireCrafting(), "Auto_Dire_Crafting"); GameRegistry.registerTileEntity(TileEntityDireCrafting.class, "Avaritia_Dire_Craft"); - //GameRegistry.registerTileEntity(TileEntityAutoDireCrafting.class, "Avaritia_Dire_AutoCraft"); if(Config.craftingOnly) return; diff --git a/src/main/java/fox/spiteful/avaritia/gui/ContainerAutoExtremeCrafting.java b/src/main/java/fox/spiteful/avaritia/gui/ContainerAutoExtremeCrafting.java deleted file mode 100644 index be7da58..0000000 --- a/src/main/java/fox/spiteful/avaritia/gui/ContainerAutoExtremeCrafting.java +++ /dev/null @@ -1,144 +0,0 @@ -package fox.spiteful.avaritia.gui; - -import fox.spiteful.avaritia.blocks.LudicrousBlocks; -import fox.spiteful.avaritia.crafting.ExtremeCraftingManager; -import fox.spiteful.avaritia.tile.TileEntityAutoDireCrafting; -import fox.spiteful.avaritia.tile.TileEntityDireCrafting; -import fox.spiteful.avaritia.tile.inventory.InventoryDireCraftResult; -import fox.spiteful.avaritia.tile.inventory.InventoryDireCrafting; -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 ContainerAutoExtremeCrafting extends Container { - - /** The crafting matrix inventory (9x9). */ - public InventoryCrafting craftMatrix; - public IInventory craftResult; - private World worldObj; - private int posX; - private int posY; - private int posZ; - - public ContainerAutoExtremeCrafting(InventoryPlayer player, World world, int x, int y, int z, TileEntityAutoDireCrafting table) - { - this.worldObj = world; - this.posX = x; - this.posY = y; - this.posZ = z; - //craftMatrix = new InventoryDireCrafting(this, table); - //craftResult = new InventoryDireCraftResult(table); - this.addSlotToContainer(new SlotCrafting(player.player, this.craftMatrix, this.craftResult, 0, 210, 80)); - int wy; - int ex; - - for (wy = 0; wy < 9; ++wy) - { - for (ex = 0; ex < 9; ++ex) - { - this.addSlotToContainer(new Slot(this.craftMatrix, ex + wy * 9, 12 + ex * 18, 8 + wy * 18)); - } - } - - for (wy = 0; wy < 3; ++wy) - { - for (ex = 0; ex < 9; ++ex) - { - this.addSlotToContainer(new Slot(player, ex + wy * 9 + 9, 39 + ex * 18, 174 + wy * 18)); - } - } - - for (ex = 0; ex < 9; ++ex) - { - this.addSlotToContainer(new Slot(player, ex, 39 + ex * 18, 232)); - } - - this.onCraftMatrixChanged(this.craftMatrix); - } - - /** - * Callback for when the crafting matrix is changed. - */ - public void onCraftMatrixChanged(IInventory matrix) - { - this.craftResult.setInventorySlotContents(0, ExtremeCraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj)); - } - - /** - * Called when the container is closed. - */ - public void onContainerClosed(EntityPlayer player) - { - super.onContainerClosed(player); - - } - - public boolean canInteractWith(EntityPlayer player) - { - return this.worldObj.getBlock(this.posX, this.posY, this.posZ) == LudicrousBlocks.dire_crafting && player.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D; - } - - /** - * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that. - */ - public ItemStack transferStackInSlot(EntityPlayer player, int slotNumber) - { - ItemStack itemstack = null; - Slot slot = (Slot)this.inventorySlots.get(slotNumber); - - if (slot != null && slot.getHasStack()) - { - ItemStack itemstack1 = slot.getStack(); - itemstack = itemstack1.copy(); - - if (slotNumber == 0) - { - if (!this.mergeItemStack(itemstack1, 82, 118, true)) - { - return null; - } - - slot.onSlotChange(itemstack1, itemstack); - } - else if (slotNumber >= 82 && slotNumber < 109) - { - if (!this.mergeItemStack(itemstack1, 109, 118, false)) - { - return null; - } - } - else if (slotNumber >= 109 && slotNumber < 118) - { - if (!this.mergeItemStack(itemstack1, 82, 109, false)) - { - return null; - } - } - else if (!this.mergeItemStack(itemstack1, 82, 118, false)) - { - return null; - } - - if (itemstack1.stackSize == 0) - { - slot.putStack((ItemStack)null); - } - else - { - slot.onSlotChanged(); - } - - if (itemstack1.stackSize == itemstack.stackSize) - { - return null; - } - - slot.onPickupFromSlot(player, itemstack1); - } - - return itemstack; - } - -} diff --git a/src/main/java/fox/spiteful/avaritia/gui/GUIAutoExtremeCrafting.java b/src/main/java/fox/spiteful/avaritia/gui/GUIAutoExtremeCrafting.java deleted file mode 100644 index 78c3e21..0000000 --- a/src/main/java/fox/spiteful/avaritia/gui/GUIAutoExtremeCrafting.java +++ /dev/null @@ -1,47 +0,0 @@ -package fox.spiteful.avaritia.gui; - -import org.lwjgl.opengl.GL11; - -import fox.spiteful.avaritia.tile.TileEntityAutoDireCrafting; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.ResourceLocation; -import net.minecraft.world.World; - -public class GUIAutoExtremeCrafting extends GuiContainer { - - private static final ResourceLocation tex = new ResourceLocation("avaritia:textures/gui/dire_autocrafting_gui.png"); - - public GUIAutoExtremeCrafting(InventoryPlayer par1InventoryPlayer, World par2World, int x, int y, int z, TileEntityAutoDireCrafting table) - { - super(new ContainerAutoExtremeCrafting(par1InventoryPlayer, par2World, x, y, z, table)); - this.ySize = 256; - this.xSize = 238; - } - - @Override - protected void drawGuiContainerForegroundLayer(int i, int j) - { - //this.fontRendererObj.drawString(StatCollector.translateToLocal("container.extreme_crafting"), 28, 6, 4210752); - //this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752); - } - - @Override - protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) - { - GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); - /*this.mc.renderEngine.bindTexture(tex); - int foo = (this.width - this.xSize) / 2; - int bar = (this.height - this.ySize) / 2; - this.drawTexturedModalRect(foo, bar, 0, 0, this.ySize, this.ySize);*/ - mc.getTextureManager().bindTexture(tex); - final Tessellator tessellator = Tessellator.instance; - tessellator.startDrawingQuads(); - tessellator.addVertexWithUV(guiLeft, guiTop, 0, 0.0, 0.0); - tessellator.addVertexWithUV(guiLeft, guiTop + xSize, 0, 0.0, 1.0); - tessellator.addVertexWithUV(guiLeft + xSize, guiTop + xSize, 0, 1.0, 1.0); - tessellator.addVertexWithUV(guiLeft + xSize, guiTop, 0, 1.0, 0.0); - tessellator.draw(); - } -} diff --git a/src/main/java/fox/spiteful/avaritia/gui/GooeyHandler.java b/src/main/java/fox/spiteful/avaritia/gui/GooeyHandler.java index fbdb95f..918900e 100644 --- a/src/main/java/fox/spiteful/avaritia/gui/GooeyHandler.java +++ b/src/main/java/fox/spiteful/avaritia/gui/GooeyHandler.java @@ -1,7 +1,6 @@ package fox.spiteful.avaritia.gui; import cpw.mods.fml.common.network.IGuiHandler; -import fox.spiteful.avaritia.tile.TileEntityAutoDireCrafting; import fox.spiteful.avaritia.tile.TileEntityCompressor; import fox.spiteful.avaritia.tile.TileEntityDireCrafting; import fox.spiteful.avaritia.tile.TileEntityNeutron; @@ -21,8 +20,6 @@ public class GooeyHandler implements IGuiHandler { return new GUINeutron(player.inventory, (TileEntityNeutron)world.getTileEntity(x, y, z)); else if(ID == 3) return new GUICompressor(player.inventory, (TileEntityCompressor)world.getTileEntity(x, y, z)); - else if(ID == 4) - return new GUIAutoExtremeCrafting(player.inventory, world, x, y, z, (TileEntityAutoDireCrafting)world.getTileEntity(x, y, z)); return null; } @@ -36,8 +33,6 @@ public class GooeyHandler implements IGuiHandler { return new ContainerNeutron(player.inventory, (TileEntityNeutron)world.getTileEntity(x, y, z)); else if(ID == 3) return new ContainerCompressor(player.inventory, (TileEntityCompressor)world.getTileEntity(x, y, z)); - else if(ID == 4) - return new ContainerAutoExtremeCrafting(player.inventory, world, x, y, z, (TileEntityAutoDireCrafting)world.getTileEntity(x, y, z)); return null; } } diff --git a/src/main/java/fox/spiteful/avaritia/tile/TileEntityAutoDireCrafting.java b/src/main/java/fox/spiteful/avaritia/tile/TileEntityAutoDireCrafting.java deleted file mode 100644 index 45bf5dd..0000000 --- a/src/main/java/fox/spiteful/avaritia/tile/TileEntityAutoDireCrafting.java +++ /dev/null @@ -1,218 +0,0 @@ -package fox.spiteful.avaritia.tile; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.ISidedInventory; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; - -public class TileEntityAutoDireCrafting extends TileLudicrous implements IInventory, ISidedInventory{ - - private ItemStack result; - private ItemStack[] matrix = new ItemStack[81]; - private ItemStack[] storage = new ItemStack[81]; - - private boolean recipeChanged = true; - - @Override - public boolean canUpdate() - { - return false; - } - - @Override - public void readCustomNBT(NBTTagCompound tag) - { - this.result = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Result")); - for(int x = 0;x < matrix.length;x++){ - matrix[x] = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("Craft" + x)); - } - } - - @Override - public void writeCustomNBT(NBTTagCompound tag) - { - if(result != null) { - NBTTagCompound produce = new NBTTagCompound(); - result.writeToNBT(produce); - tag.setTag("Result", produce); - } - else - tag.removeTag("Result"); - - for(int x = 0;x < matrix.length;x++){ - if(matrix[x] != null){ - NBTTagCompound craft = new NBTTagCompound(); - matrix[x].writeToNBT(craft); - tag.setTag("Craft" + x, craft); - } - else - tag.removeTag("Craft" + x); - } - } - - @Override - public int getSizeInventory() - { - return 82; - } - - @Override - public ItemStack getStackInSlot(int slot){ - if(slot == 0) - return result; - else if(slot <= storage.length) - return storage[slot - 1]; - else - return null; - } - - @Override - public ItemStack decrStackSize(int slot, int decrement){ - - if(slot == 0){ - if(result != null){ - for(int x = 1;x <= matrix.length;x++){ - decrStackSize(x, 1); - } - if(result.stackSize <= decrement) { - ItemStack craft = result; - result = null; - return craft; - } - ItemStack split = result.splitStack(decrement); - if(result.stackSize <= 0) - result = null; - return split; - } - else - return null; - } - else if(slot <= matrix.length){ - if(matrix[slot - 1] != null){ - if(matrix[slot - 1].stackSize <= decrement){ - ItemStack ingredient = matrix[slot - 1]; - matrix[slot - 1] = null; - return ingredient; - } - ItemStack split = matrix[slot - 1].splitStack(decrement); - if(matrix[slot - 1].stackSize <= 0) - matrix[slot - 1] = null; - return split; - } - } - return null; - } - - @Override - public void openInventory() {} - @Override - public void closeInventory() {} - - @Override - public boolean isUseableByPlayer(EntityPlayer player) - { - return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) == this && player.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D; - } - - @Override - public boolean isItemValidForSlot(int slot, ItemStack stack){ - - return false; - } - - @Override - public int getInventoryStackLimit(){ - return 64; - } - - @Override - public void setInventorySlotContents(int slot, ItemStack stack){ - if(slot == 0){ - result = stack; - } - else if(slot <= matrix.length){ - matrix[slot - 1] = stack; - } - } - - @Override - public ItemStack getStackInSlotOnClosing(int slot){ - return null; - } - - /** - * Returns the name of the inventory - */ - @Override - public String getInventoryName() - { - return "container.dire"; - } - - /** - * Returns if the inventory is named - */ - @Override - public boolean hasCustomInventoryName() - { - return false; - } - - public int[] getAccessibleSlotsFromSide(int side){ - return new int[]{}; - } - - public boolean canInsertItem(int slot, ItemStack item, int side){ - return false; - } - - public boolean canExtractItem(int slot, ItemStack item, int side){ - return false; - } - public class ExtremeCraftingMatrix extends InventoryCrafting - { - public ExtremeCraftingMatrix() - { - super(new Container() - { - @Override - public boolean canInteractWith(final EntityPlayer entityPlayer) - { - return false; - } - }, 9, 9); - } - - @Override - public ItemStack getStackInSlot(final int slot) - { - return matrix[slot]; - } - - @Override - public void setInventorySlotContents(final int slot, final ItemStack itemStack) - { - recipeChanged = true; - matrix[slot] = itemStack; - markDirty(); - } - - @Override - public ItemStack decrStackSize(int slot, final int howMuch) - { - if (matrix[slot] == null) - return null; - final ItemStack itemStack = matrix[slot].copy(); - if ((matrix[slot].stackSize -= howMuch) == 0) - matrix[slot] = null; - itemStack.stackSize = howMuch; - markDirty(); - return itemStack; - } - } - - -}