public class RevolverEvents
{
	@SubscribeEvent
	public void renderFPHand(RenderHandEvent event)
	{
		if(Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() != null && (Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() instanceof ItemRevolver || Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() instanceof ItemUkulele))
			Minecraft.getMinecraft().getItemRenderer().resetEquippedProgress();
	}
	
	@SubscribeEvent
	public void renderCrossharEvent(RenderGameOverlayEvent event)
	{
		if(event.type == ElementType.CROSSHAIRS && Minecraft.getMinecraft().thePlayer.isSneaking())
		{
			if(Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() != null && Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() instanceof ItemRevolver)
			{
				event.setCanceled(true);
			}
		}
	}
	
	@SubscribeEvent
	public void renderZoomEvent(FOVUpdateEvent event)
	{
		if(Minecraft.getMinecraft().thePlayer.isSneaking())
		{
			if(Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() != null && Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() instanceof ItemRevolver)
			{
				event.newfov = 0.9F / (ItemRevolver.getUpgradeLevel(Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem(), RevolverUpgrade.accuracy)+1);
			}
		}
	}
} public class GuiRevolver extends GuiContainer
{

	public static final ResourceLocation revolverTextures = new ResourceLocation("thaumicbases","textures/gui/revolver.png");
	public int blockedSlot;
	
	public GuiRevolver(InventoryPlayer inv, World w, int x, int y, int z)
	{
		super(new ContainerRevolver(inv,w,x,y,z));
		this.blockedSlot = inv.currentItem;
	}
	
	//Draw a cross above the revolver
	protected void drawGuiContainerForegroundLayer(int mouseX, int mouseZ)
	{
		Minecraft.getMinecraft().renderEngine.bindTexture(revolverTextures);
		float storedZLevel = this.zLevel;
		
		this.zLevel = 200;
		
		GlStateManager.disableAlpha();
		GlStateManager.enableBlend();
		GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
		
		drawTexturedModalRect(8 + blockedSlot * 18, 142, 240, 0, 16, 16);
		
		GlStateManager.disableBlend();
		GlStateManager.enableAlpha();
		
		this.zLevel = storedZLevel;
	}
	
	protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseZ)
	{
		 if (Minecraft.getMinecraft().thePlayer.inventory.mainInventory[this.blockedSlot] == null)
			 Minecraft.getMinecraft().thePlayer.closeScreen();
		 
		 Minecraft.getMinecraft().renderEngine.bindTexture(revolverTextures);
		 GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
		 
		 int k = (this.width - this.xSize) / 2;
		 int l = (this.height - this.ySize) / 2;
		 
		 drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
		 
	}

} public class GuiThaumicAnvil extends GuiContainer implements ICrafting
{
    private static final ResourceLocation anvilResource = new ResourceLocation("textures/gui/container/anvil.png");
    private ContainerThaumicAnvil anvil;
    private GuiTextField nameField;
    private InventoryPlayer playerInventory;

    public GuiThaumicAnvil(InventoryPlayer p_i45508_1_, World worldIn, int x, int y, int z)
    {
        super(new ContainerThaumicAnvil(p_i45508_1_, worldIn, new BlockPos(x,y,z), Minecraft.getMinecraft().thePlayer));
        this.playerInventory = p_i45508_1_;
        this.anvil = (ContainerThaumicAnvil)this.inventorySlots;
    }

    /**
     * Adds the buttons (and other controls) to the screen in question.
     */
    public void initGui()
    {
        super.initGui();
        Keyboard.enableRepeatEvents(true);
        int i = (this.width - this.xSize) / 2;
        int j = (this.height - this.ySize) / 2;
        this.nameField = new GuiTextField(0, this.fontRendererObj, i + 62, j + 24, 103, 12);
        this.nameField.setTextColor(-1);
        this.nameField.setDisabledTextColour(-1);
        this.nameField.setEnableBackgroundDrawing(false);
        this.nameField.setMaxStringLength(40);
        this.inventorySlots.removeCraftingFromCrafters(this);
        this.inventorySlots.onCraftGuiOpened(this);
    }

    /**
     * Called when the screen is unloaded. Used to disable keyboard repeat events
     */
    public void onGuiClosed()
    {
        super.onGuiClosed();
        Keyboard.enableRepeatEvents(false);
        this.inventorySlots.removeCraftingFromCrafters(this);
    }

    /**
     * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
     */
    protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
    {
        GlStateManager.disableLighting();
        GlStateManager.disableBlend();
        this.fontRendererObj.drawString(I18n.format("container.repair", new Object[0]), 60, 6, 4210752);

        if (this.anvil.maximumCost > 0)
        {
            int k = 8453920;
            boolean flag = true;
            String s = I18n.format("container.repair.cost", new Object[] {Integer.valueOf(this.anvil.maximumCost)});

            if (this.anvil.maximumCost >= 60 && !this.mc.thePlayer.capabilities.isCreativeMode)
            {
                s = I18n.format("container.repair.expensive", new Object[0]);
                k = 16736352;
            }
            else if (!this.anvil.getSlot(2).getHasStack())
            {
                flag = false;
            }
            else if (!this.anvil.getSlot(2).canTakeStack(this.playerInventory.player))
            {
                k = 16736352;
            }

            if (flag)
            {
                int l = -16777216 | (k & 16579836) >> 2 | k & -16777216;
                int i1 = this.xSize - 8 - this.fontRendererObj.getStringWidth(s);
                byte b0 = 67;

                if (this.fontRendererObj.getUnicodeFlag())
                {
                    drawRect(i1 - 3, b0 - 2, this.xSize - 7, b0 + 10, -16777216);
                    drawRect(i1 - 2, b0 - 1, this.xSize - 8, b0 + 9, -12895429);
                }
                else
                {
                    this.fontRendererObj.drawString(s, i1, b0 + 1, l);
                    this.fontRendererObj.drawString(s, i1 + 1, b0, l);
                    this.fontRendererObj.drawString(s, i1 + 1, b0 + 1, l);
                }

                this.fontRendererObj.drawString(s, i1, b0, k);
            }
        }

        GlStateManager.enableLighting();
    }

    /**
     * Fired when a key is typed (except F11 who toggle full screen). This is the equivalent of
     * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
     */
    protected void keyTyped(char typedChar, int keyCode) throws IOException
    {
        if (this.nameField.textboxKeyTyped(typedChar, keyCode))
        {
            this.renameItem();
        }
        else
        {
            super.keyTyped(typedChar, keyCode);
        }
    }

    private void renameItem()
    {
        String s = this.nameField.getText();
        Slot slot = this.anvil.getSlot(0);

        if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName()))
        {
            s = "";
        }

        this.anvil.updateItemName(s);
        this.mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(s)));
    }

    /**
     * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
     */
    protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
    {
        super.mouseClicked(mouseX, mouseY, mouseButton);
        this.nameField.mouseClicked(mouseX, mouseY, mouseButton);
    }

    /**
     * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
     */
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
    {
        super.drawScreen(mouseX, mouseY, partialTicks);
        GlStateManager.disableLighting();
        GlStateManager.disableBlend();
        this.nameField.drawTextBox();
    }

    /**
     * Args : renderPartialTicks, mouseX, mouseY
     */
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
    {
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        this.mc.getTextureManager().bindTexture(anvilResource);
        int k = (this.width - this.xSize) / 2;
        int l = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
        this.drawTexturedModalRect(k + 59, l + 20, 0, this.ySize + (this.anvil.getSlot(0).getHasStack() ? 0 : 16), 110, 16);

        if ((this.anvil.getSlot(0).getHasStack() || this.anvil.getSlot(1).getHasStack()) && !this.anvil.getSlot(2).getHasStack())
        {
            this.drawTexturedModalRect(k + 99, l + 45, this.xSize, 0, 28, 21);
        }
    }

    /**
     * update the crafting window inventory with the items in the list
     *  
     * @param containerToSend The container whose contents are to be sent to the player.
     * @param itemsList The items to be sent to the player.
     */
    @SuppressWarnings("rawtypes")
	public void sendContainerAndContentsToPlayer(Container containerToSend, List itemsList)
    {
        this.sendSlotContents(containerToSend, 0, containerToSend.getSlot(0).getStack());
    }

    /**
     * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
     * contents of that slot. Args: Container, slot number, slot contents
     *  
     * @param containerToSend The container that is to be updated on the client.
     * @param slotInd The slot index that is to be updated.
     * @param stack The itemstack to be updated in the selected slot.
     */
    public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
    {
        if (slotInd == 0)
        {
            this.nameField.setText(stack == null ? "" : stack.getDisplayName());
            this.nameField.setEnabled(stack != null);

            if (stack != null)
            {
                this.renameItem();
            }
        }
    }

    /**
     * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress,
     * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new
     * value. Both are truncated to shorts in non-local SMP.
     *  
     * @param containerIn The container sending a progress bar update.
     * @param varToUpdate The integer corresponding the variable to be updated.
     * @param newValue The value the variable is to be updated with.
     */
    public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue) {}

	@Override
	public void updateCraftingInventory(Container containerToSend, List<ItemStack> itemsList) {
		sendContainerAndContentsToPlayer(containerToSend,itemsList);
	}

	@Override
	public void sendAllWindowProperties(Container p_175173_1_, IInventory p_175173_2_) {
		// TODO Auto-generated method stub
		
	}
} public class GuiVoidAnvil extends GuiContainer implements ICrafting
{
    private static final ResourceLocation anvilResource = new ResourceLocation("textures/gui/container/anvil.png");
    private ContainerVoidAnvil anvil;
    private GuiTextField nameField;
    private InventoryPlayer playerInventory;

    public GuiVoidAnvil(InventoryPlayer p_i45508_1_, World worldIn, int x, int y, int z)
    {
        super(new ContainerVoidAnvil(p_i45508_1_, worldIn, new BlockPos(x,y,z), Minecraft.getMinecraft().thePlayer));
        this.playerInventory = p_i45508_1_;
        this.anvil = (ContainerVoidAnvil)this.inventorySlots;
    }

    /**
     * Adds the buttons (and other controls) to the screen in question.
     */
    public void initGui()
    {
        super.initGui();
        Keyboard.enableRepeatEvents(true);
        int i = (this.width - this.xSize) / 2;
        int j = (this.height - this.ySize) / 2;
        this.nameField = new GuiTextField(0, this.fontRendererObj, i + 62, j + 24, 103, 12);
        this.nameField.setTextColor(-1);
        this.nameField.setDisabledTextColour(-1);
        this.nameField.setEnableBackgroundDrawing(false);
        this.nameField.setMaxStringLength(40);
        this.inventorySlots.removeCraftingFromCrafters(this);
        this.inventorySlots.onCraftGuiOpened(this);
    }

    /**
     * Called when the screen is unloaded. Used to disable keyboard repeat events
     */
    public void onGuiClosed()
    {
        super.onGuiClosed();
        Keyboard.enableRepeatEvents(false);
        this.inventorySlots.removeCraftingFromCrafters(this);
    }

    /**
     * Draw the foreground layer for the GuiContainer (everything in front of the items). Args : mouseX, mouseY
     */
    protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
    {
        GlStateManager.disableLighting();
        GlStateManager.disableBlend();
        this.fontRendererObj.drawString(I18n.format("container.repair", new Object[0]), 60, 6, 4210752);

        if (this.anvil.maximumCost > 0)
        {
            int k = 8453920;
            boolean flag = true;
            String s = I18n.format("container.repair.cost", new Object[] {Integer.valueOf(this.anvil.maximumCost)});

            if (this.anvil.maximumCost >= 60 && !this.mc.thePlayer.capabilities.isCreativeMode)
            {
                s = I18n.format("container.repair.expensive", new Object[0]);
                k = 16736352;
            }
            else if (!this.anvil.getSlot(2).getHasStack())
            {
                flag = false;
            }
            else if (!this.anvil.getSlot(2).canTakeStack(this.playerInventory.player))
            {
                k = 16736352;
            }

            if (flag)
            {
                int l = -16777216 | (k & 16579836) >> 2 | k & -16777216;
                int i1 = this.xSize - 8 - this.fontRendererObj.getStringWidth(s);
                byte b0 = 67;

                if (this.fontRendererObj.getUnicodeFlag())
                {
                    drawRect(i1 - 3, b0 - 2, this.xSize - 7, b0 + 10, -16777216);
                    drawRect(i1 - 2, b0 - 1, this.xSize - 8, b0 + 9, -12895429);
                }
                else
                {
                    this.fontRendererObj.drawString(s, i1, b0 + 1, l);
                    this.fontRendererObj.drawString(s, i1 + 1, b0, l);
                    this.fontRendererObj.drawString(s, i1 + 1, b0 + 1, l);
                }

                this.fontRendererObj.drawString(s, i1, b0, k);
            }
        }

        GlStateManager.enableLighting();
    }

    /**
     * Fired when a key is typed (except F11 who toggle full screen). This is the equivalent of
     * KeyListener.keyTyped(KeyEvent e). Args : character (character on the key), keyCode (lwjgl Keyboard key code)
     */
    protected void keyTyped(char typedChar, int keyCode) throws IOException
    {
        if (this.nameField.textboxKeyTyped(typedChar, keyCode))
        {
            this.renameItem();
        }
        else
        {
            super.keyTyped(typedChar, keyCode);
        }
    }

    private void renameItem()
    {
        String s = this.nameField.getText();
        Slot slot = this.anvil.getSlot(0);

        if (slot != null && slot.getHasStack() && !slot.getStack().hasDisplayName() && s.equals(slot.getStack().getDisplayName()))
        {
            s = "";
        }

        this.anvil.updateItemName(s);
        this.mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("MC|ItemName", (new PacketBuffer(Unpooled.buffer())).writeString(s)));
    }

    /**
     * Called when the mouse is clicked. Args : mouseX, mouseY, clickedButton
     */
    protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException
    {
        super.mouseClicked(mouseX, mouseY, mouseButton);
        this.nameField.mouseClicked(mouseX, mouseY, mouseButton);
    }

    /**
     * Draws the screen and all the components in it. Args : mouseX, mouseY, renderPartialTicks
     */
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
    {
        super.drawScreen(mouseX, mouseY, partialTicks);
        GlStateManager.disableLighting();
        GlStateManager.disableBlend();
        this.nameField.drawTextBox();
    }

    /**
     * Args : renderPartialTicks, mouseX, mouseY
     */
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
    {
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        this.mc.getTextureManager().bindTexture(anvilResource);
        int k = (this.width - this.xSize) / 2;
        int l = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(k, l, 0, 0, this.xSize, this.ySize);
        this.drawTexturedModalRect(k + 59, l + 20, 0, this.ySize + (this.anvil.getSlot(0).getHasStack() ? 0 : 16), 110, 16);

        if ((this.anvil.getSlot(0).getHasStack() || this.anvil.getSlot(1).getHasStack()) && !this.anvil.getSlot(2).getHasStack())
        {
            this.drawTexturedModalRect(k + 99, l + 45, this.xSize, 0, 28, 21);
        }
    }

    /**
     * update the crafting window inventory with the items in the list
     *  
     * @param containerToSend The container whose contents are to be sent to the player.
     * @param itemsList The items to be sent to the player.
     */
    @SuppressWarnings("rawtypes")
	public void sendContainerAndContentsToPlayer(Container containerToSend, List itemsList)
    {
        this.sendSlotContents(containerToSend, 0, containerToSend.getSlot(0).getStack());
    }

    /**
     * Sends the contents of an inventory slot to the client-side Container. This doesn't have to match the actual
     * contents of that slot. Args: Container, slot number, slot contents
     *  
     * @param containerToSend The container that is to be updated on the client.
     * @param slotInd The slot index that is to be updated.
     * @param stack The itemstack to be updated in the selected slot.
     */
    public void sendSlotContents(Container containerToSend, int slotInd, ItemStack stack)
    {
        if (slotInd == 0)
        {
            this.nameField.setText(stack == null ? "" : stack.getDisplayName());
            this.nameField.setEnabled(stack != null);

            if (stack != null)
            {
                this.renameItem();
            }
        }
    }

    /**
     * Sends two ints to the client-side Container. Used for furnace burning time, smelting progress, brewing progress,
     * and enchanting level. Normally the first int identifies which variable to update, and the second contains the new
     * value. Both are truncated to shorts in non-local SMP.
     *  
     * @param containerIn The container sending a progress bar update.
     * @param varToUpdate The integer corresponding the variable to be updated.
     * @param newValue The value the variable is to be updated with.
     */
    public void sendProgressBarUpdate(Container containerIn, int varToUpdate, int newValue) {}
    
	@Override
	public void updateCraftingInventory(Container containerToSend, List<ItemStack> itemsList) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void sendAllWindowProperties(Container p_175173_1_, IInventory p_175173_2_) {
		// TODO Auto-generated method stub
		
	}
} public class BraizerRenderer implements ISimpleBlockRenderingHandler {

	@Override
	public void renderWorldBlock(IBlockAccess world, Block b, BlockPos pos, DynamicModelBakery bakery,	SBRHAwareModel model) {
		bakery.forceRenderAllFaces();
		
		bakery.setRenderBounds(0.05D, 0, 0.05D, 0.95D, 0.05D, 0.95D);
		bakery.addCube();
		bakery.setRenderBounds(0.1D, 0.05D, 0.1D, 0.9D, 0.1D, 0.9D);
		bakery.addCube();
		bakery.setRenderBounds(0.15D, 0.1D, 0.15D, 0.85D, 0.15D, 0.85D);
		bakery.addCube();
		bakery.setRenderBounds(0.3D, 0.15D, 0.3D, 0.7D, 0.6D, 0.7D);
		bakery.addCube();
		bakery.setRenderBounds(0.2D, 0.55D, 0.2D, 0.8D, 0.61D, 0.8D);
		bakery.addCube();
		bakery.setRenderBounds(0.2D, 0.61D, 0.2D, 0.3D, 0.85D, 0.8D);
		bakery.addCube();
		bakery.setRenderBounds(0.7D, 0.61D, 0.2D, 0.8D, 0.85D, 0.8D);
		bakery.addCube();
		bakery.setRenderBounds(0.3D, 0.61D, 0.2D, 0.7D, 0.85D, 0.3D);
		bakery.addCube();
		bakery.setRenderBounds(0.3D, 0.61D, 0.7D, 0.7D, 0.85D, 0.8D);
		bakery.addCube();
		
		bakery.setOverrideBlockTexture(Icon.fromBlock(Blocks.coal_block));
		bakery.setRenderBounds(0.3D, 0.61D, 0.3D, 0.7D, 0.75D, 0.7D);
		bakery.addCube();
		
		if(BlockStateMetadata.getBlockMetadata(world, pos) > 0)
		{
			bakery.setRenderBounds(0.3D, 0.8, 0.3D, 0.7D, 1.1D, 0.7D);
			bakery.setOverrideBlockTexture(Icon.fromBlock(Blocks.fire));
			bakery.addCrossedSquares();
		}
		
		
		bakery.clearOverrideBlockTexture();
		bakery.disableRenderAllFaces();
	}

	@Override
	public void renderInventoryBlock(ItemStack stack, DynamicModelBakery bakery, SBRHAwareModel model) {
		
		bakery.forceRenderAllFaces();
		
		bakery.setRenderBounds(0.05D, 0, 0.05D, 0.95D, 0.05D, 0.95D);
		bakery.addCube();
		bakery.setRenderBounds(0.1D, 0.05D, 0.1D, 0.9D, 0.1D, 0.9D);
		bakery.addCube();
		bakery.setRenderBounds(0.15D, 0.1D, 0.15D, 0.85D, 0.15D, 0.85D);
		bakery.addCube();
		bakery.setRenderBounds(0.3D, 0.15D, 0.3D, 0.7D, 0.6D, 0.7D);
		bakery.addCube();
		bakery.setRenderBounds(0.2D, 0.55D, 0.2D, 0.8D, 0.61D, 0.8D);
		bakery.addCube();
		bakery.setRenderBounds(0.2D, 0.61D, 0.2D, 0.3D, 0.85D, 0.8D);
		bakery.addCube();
		bakery.setRenderBounds(0.7D, 0.61D, 0.2D, 0.8D, 0.85D, 0.8D);
		bakery.addCube();
		bakery.setRenderBounds(0.3D, 0.61D, 0.2D, 0.7D, 0.85D, 0.3D);
		bakery.addCube();
		bakery.setRenderBounds(0.3D, 0.61D, 0.7D, 0.7D, 0.85D, 0.8D);
		bakery.addCube();
		
		bakery.setOverrideBlockTexture(Icon.fromBlock(Blocks.coal_block));
		bakery.setRenderBounds(0.3D, 0.61D, 0.3D, 0.7D, 0.75D, 0.7D);
		bakery.addCube();
		
		bakery.clearOverrideBlockTexture();
		bakery.disableRenderAllFaces();
	}

	@Override
	public int getRenderID() {
		return 0x1242fd;
	}

	@Override
	public boolean render3DInInventory() {
		return true;
	}

} public class CampfireRenderer implements ISimpleBlockRenderingHandler {

	@Override
	public void renderWorldBlock(IBlockAccess world, Block b, BlockPos pos, DynamicModelBakery bakery,
			SBRHAwareModel model) {

		bakery.forceRenderAllFaces();
		
		bakery.setOverrideBlockTexture(Icon.fromBlock(Blocks.cobblestone));
		
		Random rand = new Random(pos.getX()+pos.getY()+pos.getZ());
		
		for(int i = 0; i < 6+rand.nextInt(5); ++i)
		{
			double dx = rand.nextDouble();
			double dy = 0;
			double dz = rand.nextDouble();
			
			bakery.setRenderBounds(dx, dy, dz, dx+0.1D, dy+0.1D, dz+0.1D);
			bakery.addCube();
		}
		
		bakery.setOverrideBlockTexture(Icon.fromBlock(Blocks.coal_block));
		
		bakery.setRenderBounds(0.25D, 0, 0.25D, 0.75D, 0.06D, 0.75D);
		bakery.addCube();
		
		TileCampfire tc = (TileCampfire) world.getTileEntity(pos);
		if(tc.tainted)
			bakery.setOverrideBlockTexture(Icon.fromBlock(BlocksTC.taintLog, 0));
		else
			bakery.setOverrideBlockTexture(Icon.fromBlock(BlocksTC.log, 0));
		double yIndex = 0;
		if(BlockStateMetadata.getBlockMetadata(world, pos) > 0)
			for(int i = 0; i < 2; ++i)
			{
				bakery.setRenderBounds(0.2D, 0+yIndex+(0.1D*i), 0.1D, 0.3D, 0.11D+yIndex+(0.1D*i), 0.9D);
				bakery.addCube();
				bakery.setRenderBounds(0.7D, 0+yIndex+(0.1D*i), 0.1D, 0.8D, 0.11D+yIndex+(0.1D*i), 0.9D);
				bakery.addCube();
				
				bakery.setRenderBounds(0.1D, 0.1D+yIndex+(0.1D*i), 0.2D, 0.9D, 0.21D+yIndex+(0.1D*i), 0.3D);
				bakery.addCube();
				bakery.setRenderBounds(0.1D, 0.1D+yIndex+(0.1D*i), 0.7D, 0.9D, 0.21D+yIndex+(0.1D*i), 0.8D);
				bakery.addCube();
				yIndex += 0.1D;
			}
		
		bakery.setOverrideBlockTexture(Icon.fromBlock(Blocks.gravel));
		bakery.setRenderBounds(0.05D, 0, 0.05D, 0.95D, 0.03D, 0.95D);
		bakery.addCube();
		
		if(BlockStateMetadata.getBlockMetadata(world, pos) > 1)
		{
			bakery.setRenderBounds(0.2D, 0, 0.2D, 0.8D, 0.7D, 0.8D);
			if(tc.tainted)
				bakery.setOverrideBlockColor(0xffff0044);
			bakery.setOverrideBlockTexture(Icon.fromBlock(Blocks.fire));
			bakery.addCrossedSquares();
		}
		
		bakery.clearOverrideBlockColor();
		bakery.disableRenderAllFaces();
		bakery.clearOverrideBlockTexture();
		bakery.clearRenderBounds();
	}

	@Override
	public void renderInventoryBlock(ItemStack stack, DynamicModelBakery bakery, SBRHAwareModel model) {
		bakery.addCrossedSquares();
	}

	@Override
	public int getRenderID() {
		return 0x1242fe;
	}

	@Override
	public boolean render3DInInventory() {
		return false;
	}

} @SuppressWarnings("rawtypes")
public class RenderAspectOrb extends Render{

	@SuppressWarnings("unchecked")
	public RenderAspectOrb() {
		super(Minecraft.getMinecraft().getRenderManager());
	    shadowSize = 0.1F;
	    shadowOpaque = 0.5F;
	}

	@Override
	protected ResourceLocation getEntityTexture(Entity entity) {
		return ParticleEngine.particleTexture;
	}
	
	public void renderAO(EntityAspectOrb orb, double x, double y, double z,float partialTicks)
	{
	    GlStateManager.pushMatrix();
	    GlStateManager.translate(x, y, z);
	    
	    GlStateManager.enableBlend();
	    if (orb.getAspect() != null)
	    	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, orb.getAspect().getBlend());
	    else
	    	GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
	    
	    Minecraft.getMinecraft().renderEngine.bindTexture(ParticleEngine.particleTexture);
	    int i = (int)(System.nanoTime() / 25000000L % 16L);
	    
	    float f2 = i / 16.0F;
	    float f3 = (i + 1) / 16.0F;
	    float f4 = 0.5F;
	    float f5 = 0.5625F;
	    
        float f6 = 1.0F;
        float f7 = 0.5F;
        float f8 = 0.25F;
        int j = orb.getBrightnessForRender(partialTicks);
        int k = j % 65536;
        int l = j / 65536;
        
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, k / 1.0F, l / 1.0F);
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        
        GlStateManager.rotate(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GlStateManager.rotate(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        float f9 = 0.1F + 0.3F * (((float)orb.orbMaxAge - (float)orb.orbAge) / orb.orbMaxAge);
        GlStateManager.scale(f9, f9, f9);
        
	    TessellatorWrapper worldrenderer = TessellatorWrapper.getInstance();
	    worldrenderer.startDrawingQuads();
	    if (orb.getAspect() != null)
	    	worldrenderer.setColorRGBA_I(orb.getAspect().getColor(), 128);
	    
	    worldrenderer.addVertexWithUV(0.0F - f7, 0.0F - f8, 0.0D, f2, f5);
	    worldrenderer.addVertexWithUV(f6 - f7, 0.0F - f8, 0.0D, f3, f5);
	    worldrenderer.addVertexWithUV(f6 - f7, 1.0F - f8, 0.0D, f3, f4);
	    worldrenderer.addVertexWithUV(0.0F - f7, 1.0F - f8, 0.0D, f2, f4);
	    worldrenderer.draw();
	    
        GlStateManager.disableBlend();
        GlStateManager.disableRescaleNormal();
        GlStateManager.popMatrix();
	}
	
    @SuppressWarnings("unchecked")
	public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks)
    {
    	this.renderAO(EntityAspectOrb.class.cast(entity), x, y, z, partialTicks);
    	super.doRender(entity, x, y, z, p_76986_8_, partialTicks);
    }
} @SuppressWarnings("rawtypes")
public class RenderBullet extends Render{

	public RenderBullet() {
		super(Minecraft.getMinecraft().getRenderManager());
	}

	@Override
	public void doRender(Entity p_76986_1_, double p_76986_2_,
			double p_76986_4_, double p_76986_6_, float p_76986_8_,
			float p_76986_9_) {
		
	}

	@Override
	protected ResourceLocation getEntityTexture(Entity p_110775_1_) {
		return null;
	}

} @SuppressWarnings("deprecation")
public class AuraLinkerItemRenderer implements IItemRenderer {
	
	public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeLinker/nodeLinker.obj"));
	public static final ResourceLocation genIcon = new ResourceLocation("thaumicbases","textures/blocks/nodeLinker/nodeLinkerUV.png");

	@Override
	public boolean handleRenderType(ItemStack item, TransformType type) {
		return true;
	}

	@Override
	public void renderItem(TransformType type, ItemStack item) {
		GlStateManager.pushMatrix();
		RenderHelper.disableStandardItemLighting();
		
		GlStateManager.scale(0.5, 0.5, 0.5);
		GlStateManager.translate(1, 1.5, 1);
		GlStateManager.rotate(180, 1, 0, 0);
		Minecraft.getMinecraft().renderEngine.bindTexture(genIcon);
		model.renderAll();
		
		RenderHelper.enableGUIStandardItemLighting();
		GlStateManager.popMatrix();
	}

	@Override
	public Matrix4f handleTransformsFor(ItemStack item, TransformType type) {
		if(type == TransformType.THIRD_PERSON)
			return RPAwareModel.THIRD_PERSON_2D;
		
		return null;
	}

} @SuppressWarnings("deprecation")
public class CastingBraceletRenderer implements IItemRenderer{

	public static final IModelCustom bracelet = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/bracelet/bracelet.obj"));
	
	@Override
	public boolean handleRenderType(ItemStack item, TransformType type) {
		return true;
	}

	@Override
	public void renderItem(TransformType type, ItemStack item) {
		
		EntityPlayerSP entityclientplayermp = Minecraft.getMinecraft().thePlayer;
		
		ItemWand wand = (ItemWand)item.getItem();
		ItemStack focusStack = wand.getFocusStack(item);
		
		GlStateManager.pushMatrix();
		RenderHelper.disableStandardItemLighting();
		if(type == TransformType.FIRST_PERSON)
		{
			GlStateManager.pushMatrix();
			
            Minecraft.getMinecraft().getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
        	
            Render<?> render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(Minecraft.getMinecraft().thePlayer);
            RenderPlayer renderplayer = (RenderPlayer)render;
            
            float f10 = 4.0F;
            GlStateManager.scale(f10, f10, f10);
            
            GlStateManager.rotate(90, 1, 0, 0);
            GlStateManager.rotate(40, 0, 0, 1);
            GlStateManager.translate(0.2, 0, 0);
            if(entityclientplayermp.isUsingItem())
            {
            	 GlStateManager.rotate(60, 1, 0, 0);
            	 GlStateManager.translate(0, 0, 0);
            }
            renderplayer.renderRightArm(Minecraft.getMinecraft().thePlayer);
			
			GlStateManager.popMatrix();
			
			
		}
		
		double ds = 0.2D;
		GlStateManager.scale(ds, ds, ds);
		Minecraft.getMinecraft().renderEngine.bindTexture(BraceletState.forMetadata(item.getMetadata()).getBraceletTexture(item));
		GlStateManager.pushMatrix();
		if(wand.getRod(item) != null && wand.getRod(item) == ConfigItems.WAND_ROD_BLAZE)
		{
			 int j = (int)(200.0F + MathHelper.sin(entityclientplayermp.ticksExisted) * 5.0F + 5.0F);
			 int k = j % 65536;
			 int l = j / 65536;
			 OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, k / 1.0F, l / 1.0F);
		}
		
		if(type == TransformType.FIRST_PERSON)
		{
			GlStateManager.translate(-10, 2, 4);
			GlStateManager.rotate(-40, 0, 1, 0);
			GlStateManager.rotate(-15, 1, 0, 0);
			GlStateManager.translate(1.6,2.6,1);
			ds = 0.7;
			GlStateManager.scale(ds, ds, ds);
            if(entityclientplayermp.isUsingItem())
            {
            	 GlStateManager.rotate(-10, 1, 0, 0);
            	 GlStateManager.rotate(20, 0, 1, 0);
            	 GlStateManager.translate(1.7, -1, 0);
            }
		}
		bracelet.renderAll();
		if(focusStack != null)
		{
			GlStateManager.pushMatrix();
			ds = 0.125D;
			GlStateManager.scale(ds, ds, ds);
			GlStateManager.translate(-8, 22, -8);
			DrawUtils.bindTexture("thaumcraft", "textures/models/vcrystal.png");
			TessellatorWrapper tec = TessellatorWrapper.getInstance();
			int color = wand.getFocus(item).getFocusColor(focusStack);
			
			RenderHelper.disableStandardItemLighting();
			OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240, 0);
			tec.startDrawingQuads();
			
			tec.setColorOpaque_I(color);
			tec.addVertexWithUV(16, 0, 0, 0, 0);
			tec.addVertexWithUV(0, 0, 0, 1, 0);
			tec.addVertexWithUV(0, 16, 0, 1, 1);
			tec.addVertexWithUV(16, 16, 0, 0, 1);
			
			tec.addVertexWithUV(16, 16, 0, 0, 0);
			tec.addVertexWithUV(0, 16, 0, 1, 0);
			tec.addVertexWithUV(0, 16, 16, 1, 1);
			tec.addVertexWithUV(16, 16, 16, 0, 1);
			
			tec.addVertexWithUV(0, 0, 0, 0, 0);
			tec.addVertexWithUV(16, 0, 0, 1, 0);
			tec.addVertexWithUV(16, 0, 16, 1, 1);
			tec.addVertexWithUV(0, 0, 16, 0, 1);
			
			tec.addVertexWithUV(0, 0, 16, 0, 0);
			tec.addVertexWithUV(16, 0, 16, 1, 0);
			tec.addVertexWithUV(16, 16, 16, 1, 1);
			tec.addVertexWithUV(0, 16, 16, 0, 1);
			
			tec.addVertexWithUV(16, 0, 16, 0, 0);
			tec.addVertexWithUV(16, 0, 0, 1, 0);
			tec.addVertexWithUV(16, 16, 0, 1, 1);
			tec.addVertexWithUV(16, 16, 16, 0, 1);
			
			tec.addVertexWithUV(0, 0, 0, 0, 0);
			tec.addVertexWithUV(0, 0, 16, 1, 0);
			tec.addVertexWithUV(0, 16, 16, 1, 1);
			tec.addVertexWithUV(0, 16, 0, 0, 1);
			
			Tessellator.getInstance().draw();
			RenderHelper.enableStandardItemLighting();
			GlStateManager.popMatrix();
		}
		GlStateManager.popMatrix();
		RenderHelper.enableStandardItemLighting();
		GlStateManager.popMatrix();
	}

	public static final Matrix4f GUI_FIX = ForgeHooksClient.getMatrix(new ItemTransformVec3f(new Vector3f(0,-0.8F,0),new Vector3f(-0.21F,0,0),new Vector3f(0.55F,0.55F,0.55F)));
	public static final Matrix4f THIRD_PERSON_FIX = ForgeHooksClient.getMatrix(new ItemTransformVec3f(new Vector3f(-1.4F,0,0),new Vector3f(-0.06F,0,-0.14F),new Vector3f(0.15F,0.15F,0.15F)));
	
	@Override
	public Matrix4f handleTransformsFor(ItemStack item, TransformType type) {
		if(type == TransformType.GUI)
			return GUI_FIX;
		
		if(type == TransformType.THIRD_PERSON)
			return THIRD_PERSON_FIX;
		
		return null;
	}

} @SuppressWarnings("deprecation")
public class HerobrinesScytheMH implements IModelMatrixHandler {

	@Override
	public Matrix4f handlePerspective(TransformType cameraTransformType, ItemStack is) {
		if(cameraTransformType == TransformType.GUI)
		{
			return ForgeHooksClient.getMatrix(new ItemTransformVec3f(
				new Vector3f(0,0,0.75F),
				new Vector3f(0,0,0),
				new Vector3f(1,1,1)
			));
		}
		if(cameraTransformType == TransformType.FIRST_PERSON)
		{
			return ForgeHooksClient.getMatrix(new ItemTransformVec3f(
				new Vector3f(0,0.8F,0),
				new Vector3f(0,0.4F,0),
				new Vector3f(3,3,1F)
			));
		}
		if(cameraTransformType == TransformType.THIRD_PERSON)
		{
			return ForgeHooksClient.getMatrix(new ItemTransformVec3f(
				new Vector3f(0,4.8F,2.2F),
				new Vector3f(0,0,-0.1F),
				new Vector3f(2,2,1)
			));
		}
		return null;
	}

} @SuppressWarnings("deprecation")
public class NodeFociRenderer implements IItemRenderer {
	
	public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeManipulator/foci.obj"));
	
	@Override
	public boolean handleRenderType(ItemStack item, TransformType type) {
		return true;
	}

	@Override
	public void renderItem(TransformType type, ItemStack item) {
		
		GlStateManager.pushMatrix();
		RenderHelper.disableStandardItemLighting();
		RenderHelper.enableGUIStandardItemLighting();
		
		GlStateManager.scale(0.25, 0.25, 0.25);
		GlStateManager.translate(2, 1, 2);
		DrawUtils.bindTexture("thaumicbases", "textures/blocks/nodeManipulator/foci_"+ItemNodeFoci.names[item.getItemDamage()]+".png");
		model.renderAll();
		
		GlStateManager.popMatrix();
	}

	@Override
	public Matrix4f handleTransformsFor(ItemStack item, TransformType type) {
		if(type == TransformType.THIRD_PERSON)
			return RPAwareModel.THIRD_PERSON_2D;
		return null;
	}

} @SuppressWarnings("deprecation")
public class NodeManipulatorItemRenderer implements IItemRenderer {
	
	public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeManipulator/nodeManipulator.obj"));
	public static final ResourceLocation genIcon = new ResourceLocation("thaumicbases","textures/blocks/nodeManipulator/baseUVMap.png");

	@Override
	public boolean handleRenderType(ItemStack item, TransformType type) {
		return true;
	}

	@Override
	public void renderItem(TransformType type, ItemStack item) {
		GlStateManager.pushMatrix();
		RenderHelper.disableStandardItemLighting();
		
		GlStateManager.scale(0.5, 0.5, 0.5);
		GlStateManager.translate(1, 0.5, 1);
		Minecraft.getMinecraft().renderEngine.bindTexture(genIcon);
		model.renderAll();
		
		RenderHelper.enableGUIStandardItemLighting();
		GlStateManager.popMatrix();
	}

	@Override
	public Matrix4f handleTransformsFor(ItemStack item, TransformType type) {
		if(type == TransformType.THIRD_PERSON)
			return RPAwareModel.THIRD_PERSON_2D;
		
		return null;
	}

} @SuppressWarnings("deprecation")
public class RenderRevolver implements IItemRenderer{
	
	public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/revolver/revolver.obj"));
	public static final ResourceLocation handle = new ResourceLocation("thaumicbases","textures/items/revolver/revolverHandleUV.png");
	public static final ResourceLocation barrel = new ResourceLocation("thaumicbases","textures/items/revolver/revolverBarrelUV.png");
	public static final ResourceLocation metal = new ResourceLocation("thaumicbases","textures/items/revolver/revolverDarkMetal.png");
	public static final ResourceLocation gun = new ResourceLocation("thaumicbases","textures/items/revolver/revolverGunUV.png");
	public static final ResourceLocation press = new ResourceLocation("thaumicbases","textures/items/revolver/revolverPressUV.png");
	@Override
	public boolean handleRenderType(ItemStack item, TransformType type) {
		return true;
	}
	@Override
	public void renderItem(TransformType type, ItemStack item) {
		
		GlStateManager.pushMatrix();
		RenderHelper.disableStandardItemLighting();
		GlStateManager.disableAlpha();
		GlStateManager.enableBlend();
		GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
		
		double scale = 0.2D;
		GlStateManager.scale(scale, scale, scale);
		GlStateManager.translate(5, -1, 5);
		
		if(type == TransformType.FIRST_PERSON)
		{
			GlStateManager.rotate(135, 0, 1, 0);
			GlStateManager.rotate(2, 1, 0, 0);
			GlStateManager.translate(4, 9, 2);
			GlStateManager.scale(1.2, 1.2, 1.2);
			
			if(Minecraft.getMinecraft().thePlayer.isSneaking())
			{
				GlStateManager.rotate(0, 0, 1, 0);
				GlStateManager.translate(-6.2, 2, 3);
			}
		}
		
		ResourceLocation handle = RenderRevolver.handle;
		ResourceLocation barrel = RenderRevolver.barrel;
		ResourceLocation metal = RenderRevolver.metal;
		ResourceLocation gun = RenderRevolver.gun;
		ResourceLocation press = RenderRevolver.press;
		
		ArrayList<Pair<RevolverUpgrade,Integer>> upgrades = ItemRevolver.getAllUpgradesFor(item);
		for(Pair<RevolverUpgrade,Integer> p : upgrades)
		{
			RevolverUpgrade ru = p.getFirst();
			handle = ru.getOverridePartTexture(item, 0, p.getSecond()) == null ? handle : ru.getOverridePartTexture(item, 0, p.getSecond());
			barrel = ru.getOverridePartTexture(item, 1, p.getSecond()) == null ? barrel : ru.getOverridePartTexture(item, 1, p.getSecond());
			metal = ru.getOverridePartTexture(item, 2, p.getSecond()) == null ? metal : ru.getOverridePartTexture(item, 2, p.getSecond());
			gun = ru.getOverridePartTexture(item, 3, p.getSecond()) == null ? gun : ru.getOverridePartTexture(item, 3, p.getSecond());
			press = ru.getOverridePartTexture(item, 4, p.getSecond()) == null ? press : ru.getOverridePartTexture(item, 4, p.getSecond());
		}
		
		Minecraft.getMinecraft().renderEngine.bindTexture(handle);
		model.renderPart("Cylinder");
		model.renderPart("Plane");
		
		double rotation = item.hasTagCompound() ? item.getTagCompound().getDouble("renderedRotation") : 0;
		
		GlStateManager.pushMatrix();
		GlStateManager.translate(0, 2.9D, 0);
		GlStateManager.translate(0, -Math.cos(Math.toRadians(rotation))*2.8D, 0);
		GlStateManager.translate(Math.sin(Math.toRadians(rotation))*2.8D, 0, 0);
		GlStateManager.rotate((float) rotation, 0, 0, 1);
		
		Minecraft.getMinecraft().renderEngine.bindTexture(barrel);
		model.renderPart("rBarrel_Cube.001");
		GlStateManager.popMatrix();
		
		Minecraft.getMinecraft().renderEngine.bindTexture(metal);
		model.renderPart("Cube.003_Cube.004");
		model.renderPart("Cube.002_Cube.003");
		model.renderPart("Cube_Cube.001");
		Minecraft.getMinecraft().renderEngine.bindTexture(gun);
		model.renderPart("Cylinder.002");
		model.renderPart("Plane.001");
		Minecraft.getMinecraft().renderEngine.bindTexture(press);
		model.renderPart("Cube.001_Cube.005");
		
		GlStateManager.enableAlpha();
		GlStateManager.disableBlend();
		RenderHelper.enableStandardItemLighting();
		GlStateManager.popMatrix();
		
	}
	
	public static final Matrix4f THIRD_PERSON_FIX = ForgeHooksClient.getMatrix(new ItemTransformVec3f(new Vector3f(3.3F,0,0),new Vector3f(0.07F,0,-0.16F),new Vector3f(0.3F,0.3F,0.3F)));
	
	@Override
	public Matrix4f handleTransformsFor(ItemStack item, TransformType type) {
		if(type == TransformType.THIRD_PERSON)
			return THIRD_PERSON_FIX;
		
		return null;
	}
	
} @SuppressWarnings("deprecation")
public class SpawnerCompassRenderer implements IItemRenderer{
	public static final IModelCustom compassModel = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/spawnerCompass/compass.obj"));
	public static final ResourceLocation textures = new ResourceLocation("thaumicbases","textures/blocks/spawnerCompassUV.png");
	
	@Override
	public boolean handleRenderType(ItemStack item, TransformType type) {
		return true;
	}
	
	@Override
	public void renderItem(TransformType type, ItemStack item) {
		EntityPlayerSP entityclientplayermp = Minecraft.getMinecraft().thePlayer;
		GlStateManager.pushMatrix();
		RenderHelper.disableStandardItemLighting();
		
		if(type == TransformType.FIRST_PERSON)
		{
			GlStateManager.pushMatrix();

            Minecraft.getMinecraft().getTextureManager().bindTexture(entityclientplayermp.getLocationSkin());
            	
            GlStateManager.translate(0.6D, 0.1D, -0.3D);
            GlStateManager.rotate(160, 0, 1, 0);
            GlStateManager.rotate(-20, 1, 0, 0);
            Render<?> render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(Minecraft.getMinecraft().thePlayer);
            RenderPlayer renderplayer = (RenderPlayer)render;
            float f10 = 2.0F;
            GlStateManager.scale(f10, f10, f10);
            renderplayer.renderRightArm(Minecraft.getMinecraft().thePlayer);
            GlStateManager.popMatrix();
            
            GlStateManager.pushMatrix();
            
            GlStateManager.rotate(90, 1, 0, 0);
            GlStateManager.rotate(45, 0, 0, 1);
            GlStateManager.translate(2.5, 0, -3.4);
            GlStateManager.scale(0.4d, 0.4d, 0.4d);
            GlStateManager.translate(-1d, -1, 4);
            
            Minecraft.getMinecraft().renderEngine.bindTexture(textures);
            compassModel.renderAll();
            
            GlStateManager.popMatrix();
		}else
		{
			GlStateManager.pushMatrix();
			GlStateManager.rotate(90, 1, 0, 0);
			GlStateManager.rotate(-45, 0, 0, 1);
			GlStateManager.scale(0.25d, 0.25d, 0.25d);
			if(type == TransformType.GROUND)
				GlStateManager.translate(0, 3, 0);
	        Minecraft.getMinecraft().renderEngine.bindTexture(textures);
	        compassModel.renderAll();
	        GlStateManager.popMatrix();
		}
		RenderHelper.enableStandardItemLighting();
		GlStateManager.popMatrix();
	}
	
	public static final Matrix4f THIRD_PERSON_FIX = ForgeHooksClient.getMatrix(new ItemTransformVec3f(new Vector3f(0,1.6F,0),new Vector3f(0F,0.5F,0F),new Vector3f(1,1,1)));
	public static final Matrix4f GENERIC_FIX = ForgeHooksClient.getMatrix(new ItemTransformVec3f(new Vector3f(-0.3F,2.2F,0),new Vector3f(0F,0.1F,0.11F),new Vector3f(0.5F,0.5F,0.5F)));
	
	@Override
	public Matrix4f handleTransformsFor(ItemStack item, TransformType type) {
		if(type != TransformType.FIRST_PERSON)
		{
			if(type != TransformType.THIRD_PERSON)
				return THIRD_PERSON_FIX;
			
			return GENERIC_FIX;
			
		}
		return null;
	}
	
	
} @SuppressWarnings("deprecation")
public class UkuleleRenderer implements IItemRenderer{

	public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/ukulele/ukulele.obj"));
	public static final ResourceLocation base = new ResourceLocation("thaumicbases","textures/items/ukulele/ukulelebase.png");
	public static final ResourceLocation strings = new ResourceLocation("thaumicbases","textures/items/ukulele/ukulelestrings.png");
	public static final ResourceLocation handle = new ResourceLocation("thaumicbases","textures/items/ukulele/ukulelehandle.png");
	
	
	@Override
	public boolean handleRenderType(ItemStack item, TransformType type) {
		return true;
	}

	@Override
	public void renderItem(TransformType type, ItemStack item) {
		GlStateManager.pushMatrix();
		RenderHelper.disableStandardItemLighting();
		GlStateManager.scale(0.4, 0.4, 0.4);
		GlStateManager.translate(1, 0, 1);
		
		if(type == TransformType.GUI)
		{
			GlStateManager.rotate(90, 1, 0, 0);
			GlStateManager.rotate(45, 0, 0, 1);
			GlStateManager.translate(0.5, -2.6, 0);
			GlStateManager.scale(1, 1, 0.7);
		}
		
		if(type == TransformType.FIRST_PERSON)
		{
			GlStateManager.scale(1.8, 1.8, 1.8);	
			GlStateManager.translate(2, 3, 2);
			GlStateManager.rotate(210, 0, 1, 0);
			GlStateManager.rotate(10, 0, 0, 1);
			
			GlStateManager.pushMatrix();
			
            Minecraft.getMinecraft().getTextureManager().bindTexture(Minecraft.getMinecraft().thePlayer.getLocationSkin());
        	
            Render<?> render = Minecraft.getMinecraft().getRenderManager().getEntityRenderObject(Minecraft.getMinecraft().thePlayer);
            RenderPlayer renderplayer = (RenderPlayer)render;
            
            GlStateManager.pushMatrix();
            
            GlStateManager.translate(0, 1, 2);
            GlStateManager.rotate(90, 1, 0, 0);
            GlStateManager.rotate(-90, 0, 0, 1);
            GlStateManager.translate(0, -1.3, 0);
            GlStateManager.rotate(20, 1, 0, 0);
            GlStateManager.rotate(-20, 0, 0, 1);
            GlStateManager.scale(1.5, 1.5, 1.5);
            
            if(Minecraft.getMinecraft().thePlayer.isUsingItem())
            {
            	float mOffset = Minecraft.getMinecraft().thePlayer.ticksExisted % 30 * 12;
            	float nOffset = Minecraft.getMinecraft().thePlayer.ticksExisted % 20 * 18;
            	float oOffset = Minecraft.getMinecraft().thePlayer.ticksExisted % 10 * 36;
            	GlStateManager.translate(0.3+Math.sin(Math.toRadians(mOffset))/6, 0, 0);
            	GlStateManager.translate(0, Math.sin(Math.toRadians(nOffset))/10, 0);
            	GlStateManager.translate(0, 0, Math.sin(Math.toRadians(oOffset))/20);
            }
            
            renderplayer.renderRightArm(Minecraft.getMinecraft().thePlayer);
			
            GlStateManager.popMatrix();
            
            GlStateManager.pushMatrix();
            
            GlStateManager.translate(-0.5, 0.8, -1);
            GlStateManager.rotate(90, 1, 0, 0);
            GlStateManager.rotate(-90, 0, 0, 1);
            GlStateManager.translate(0, -1.3, 0);
            GlStateManager.rotate(20, 1, 0, 0);
            GlStateManager.rotate(-50, 0, 0, 1);
            GlStateManager.scale(1.5, 3, 1.5);
            
            if(Minecraft.getMinecraft().thePlayer.isUsingItem())
            {
            	float mOffset = System.currentTimeMillis()/40 % 20 * 18;
            	float oOffset = Minecraft.getMinecraft().thePlayer.ticksExisted % 10 * 36;
            	GlStateManager.translate(Math.sin(Math.toRadians(-mOffset))/6, 0, 0);
            	GlStateManager.translate(0, 0, -0.03+Math.sin(Math.toRadians(-oOffset))/100);
            }
            
            renderplayer.renderRightArm(Minecraft.getMinecraft().thePlayer);
			
            GlStateManager.popMatrix();
            
			GlStateManager.popMatrix();
		}
		
		Minecraft.getMinecraft().renderEngine.bindTexture(base);
		model.renderPart("base_Cube.001");
		Minecraft.getMinecraft().renderEngine.bindTexture(strings);
		model.renderPart("strings_Cube.003");
		Minecraft.getMinecraft().renderEngine.bindTexture(handle);
		model.renderPart("hand_Cube.002");
		RenderHelper.enableStandardItemLighting();
		GlStateManager.popMatrix();
	}

	@Override
	public Matrix4f handleTransformsFor(ItemStack item, TransformType type) {
		if(type == TransformType.THIRD_PERSON)
			return ForgeHooksClient.getMatrix(new ItemTransformVec3f(
				new Vector3f(3.2F,1.2F,-2),
				new Vector3f(0,0,-0.3F),
				new Vector3f(0.7F,0.7F,0.7F)
			));
		return null;
	}

} @SuppressWarnings("rawtypes")
public class RenderAuraLinker extends TileEntitySpecialRenderer{

	public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeLinker/nodeLinker.obj"));
	public static final ResourceLocation genIcon = new ResourceLocation("thaumicbases","textures/blocks/nodeLinker/nodeLinkerUV.png");
	
	
	@Override
	public void renderTileEntityAt(TileEntity tile, double screenX,	double screenY, double screenZ, float partialTicks, int i)
	{
		GlStateManager.pushMatrix();
		GlStateManager.translate(screenX+0.5, screenY+0.9, screenZ+0.5);
		GlStateManager.scale(0.5, 0.5, 0.5);
		GlStateManager.rotate(180, 1, 0, 0);
		
		Minecraft.getMinecraft().renderEngine.bindTexture(genIcon);
		model.renderAll();
		
		GlStateManager.popMatrix();
	}
	
} @SuppressWarnings("rawtypes")
public class RenderNodeManipulator extends TileEntitySpecialRenderer{
	public static final IModelCustom model = AdvancedModelLoader.loadModel(new ResourceLocation("thaumicbases","models/nodeManipulator/nodeManipulator.obj"));
	public static final ResourceLocation genIcon = new ResourceLocation("thaumicbases","textures/blocks/nodeManipulator/baseUVMap.png");
	
	@Override
	public void renderTileEntityAt(TileEntity tile, double screenX,	double screenY, double screenZ, float partialTicks, int i)
	{
		GlStateManager.pushMatrix();
		GlStateManager.translate(screenX+0.5D, screenY, screenZ+0.5D);
		GlStateManager.scale(0.5D, 0.5D, 0.5D);
		
		Minecraft.getMinecraft().renderEngine.bindTexture(genIcon);
		model.renderPart("base_Cube.001");
		model.renderPart("handle_0_Cube.002");
		model.renderPart("handle_1_Cube.002");
		model.renderPart("handle_2_Cube.002");
		model.renderPart("handle_3_Cube.002");
		
		int meta = BlockStateMetadata.getBlockMetadata(tile.getWorld(), tile.getPos());
		if(meta != 0)
		{
			DrawUtils.bindTexture("thaumicbases", "textures/blocks/nodeManipulator/foci_"+ItemNodeFoci.names[meta-1]+".png");
			model.renderPart("foci_Cube.003");
		}
		
		GlStateManager.popMatrix();
	}
} @SuppressWarnings("rawtypes")
public class RenderOverchanter extends TileEntitySpecialRenderer{

	@Override
	public void renderTileEntityAt(TileEntity tile, double screenX,	double screenY, double screenZ, float partialTicks, int i)
	{
		TileOverchanter overchanter = (TileOverchanter) tile;
		
		if(overchanter.inventory != null)
		{
			GlStateManager.pushMatrix();
			int time = Minecraft.getMinecraft().thePlayer != null ? Minecraft.getMinecraft().thePlayer.ticksExisted : 0;
			DrawUtils.renderItemStack_Full(overchanter.inventory, 0, 0, 0, screenX, screenY, screenZ, time%360+partialTicks, 0, 1, 1, 1, 0.5F, 1.0F, 0.5F,false);
			
			GlStateManager.popMatrix();
		}
		
		if(overchanter.renderedLightning != null)
		{
			GlStateManager.pushMatrix();
			
			overchanter.renderedLightning.render(screenX+0.5D, screenY+1D, screenZ+0.5D, partialTicks);
			
			GlStateManager.popMatrix();
		}
	}
	
} public class EntityAspectOrb extends Entity implements IEntityAdditionalSpawnData{

	public int orbAge = 0;
	public int orbMaxAge = 150;
	private Aspect aspect;
	private int aspectValue;
	private EntityPlayer closestPlayer;
	
	public EntityAspectOrb(World w, double x, double y, double z, Aspect aspect, int value)
	{
	    super(w);
	    setSize(0.125F, 0.125F);
	    setPosition(x, y, z);
        this.motionX = (float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F;
        this.motionY = (float)(Math.random() * 0.2D) * 2.0F;
        this.motionZ = (float)(Math.random() * 0.20000000298023224D - 0.10000000149011612D) * 2.0F;
	    this.aspectValue = value*10;
	    setAspect(aspect);
	}
	
    protected boolean canTriggerWalking()
    {
        return false;
    }
    
    public EntityAspectOrb(World worldIn)
    {
        super(worldIn);
        this.setSize(0.25F, 0.25F);
    }

    protected void entityInit() {}
    
    @SideOnly(Side.CLIENT)
    public int getBrightnessForRender(float p_70070_1_)
    {
        float f1 = 0.5F;
        f1 = MathHelper.clamp_float(f1, 0.0F, 1.0F);
        int i = super.getBrightnessForRender(p_70070_1_);
        int j = i & 255;
        int k = i >> 16 & 255;
        j += (int)(f1 * 15.0F * 16.0F);

        if (j > 240)
        {
            j = 240;
        }

        return j | k << 16;
    }
    
    public void onUpdate()
    {
        super.onUpdate();

        this.prevPosX = this.posX;
        this.prevPosY = this.posY;
        this.prevPosZ = this.posZ;
        this.motionY -= 0.029999999329447746D;

        if (this.worldObj.getBlockState(new BlockPos(this)).getBlock().getMaterial() == Material.lava)
        {
            this.motionY = 0.20000000298023224D;
            this.motionX = (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F;
            this.motionZ = (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F;
            this.playSound("random.fizz", 0.4F, 2.0F + this.rand.nextFloat() * 0.4F);
        }

        this.pushOutOfBlocks(this.posX, (this.getEntityBoundingBox().minY + this.getEntityBoundingBox().maxY) / 2.0D, this.posZ);
        double d0 = 8.0D;

        EntityPlayer player = (EntityPlayer) MiscUtils.getClosestEntity(TBUtils.castLst(this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(this.posX, this.posY, this.posZ, this.posX, this.posY, this.posZ).expand(8, 8, 8))), posX, posY, posZ);
        if(isWandInHotbarWithRoom(getAspect(), this.aspectValue,player) >= 0)
        	closestPlayer = player;
        
        if (this.closestPlayer != null && this.closestPlayer.isSpectator())
            this.closestPlayer = null;

        if (this.closestPlayer != null)
        {
            double d1 = (this.closestPlayer.posX - this.posX) / d0;
            double d2 = (this.closestPlayer.posY + this.closestPlayer.getEyeHeight() - this.posY) / d0;
            double d3 = (this.closestPlayer.posZ - this.posZ) / d0;
            double d4 = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
            double d5 = 1.0D - d4;

            if (d5 > 0.0D)
            {
                d5 *= d5;
                this.motionX += d1 / d4 * d5 * 0.1D;
                this.motionY += d2 / d4 * d5 * 0.1D;
                this.motionZ += d3 / d4 * d5 * 0.1D;
            }
        }

        this.moveEntity(this.motionX, this.motionY, this.motionZ);
        float f = 0.98F;

        if (this.onGround)
            f = this.worldObj.getBlockState(new BlockPos(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.getEntityBoundingBox().minY) - 1, MathHelper.floor_double(this.posZ))).getBlock().slipperiness * 0.98F;

        this.motionX *= f;
        this.motionY *= 0.9800000190734863D;
        this.motionZ *= f;

        if (this.onGround)
            this.motionY *= -0.8999999761581421D;

        ++this.orbAge;

        if (this.orbAge >= this.orbMaxAge)
            this.setDead();
    }
    
    public boolean handleWaterMovement()
    {
        return this.worldObj.handleMaterialAcceleration(this.getEntityBoundingBox(), Material.water, this);
    }
    
    protected void dealFireDamage(int amount)
    {
        this.attackEntityFrom(DamageSource.inFire, amount);
    }
    
    public boolean attackEntityFrom(DamageSource source, float amount)
    {
        if (this.isEntityInvulnerable(source))
        {
            return false;
        }
        
		this.setBeenAttacked();
		this.setDead();
		return false;
    }
    
    public void onCollideWithPlayer(EntityPlayer entityIn)
    {
    	if (!worldObj.isRemote && !isDead)
    	{
    		int slot = isWandInHotbarWithRoom(getAspect(), this.aspectValue, entityIn);
    		if (entityIn.xpCooldown == 0 && getAspect().isPrimal() && slot >= 0)
    		{
    			ItemWand wand = ItemWand.class.cast(entityIn.inventory.getStackInSlot(slot).getItem());
    			wand.addVis(entityIn.inventory.getStackInSlot(slot), getAspect(), this.aspectValue, true);
    			entityIn.xpCooldown = 2;
    	        playSound("random.orb", 0.1F, 0.5F * MathUtils.randomFloat(rand) * 0.7F + 1.8F);
    	        setDead();
    		}
    	}
    }
	
    public int isWandInHotbarWithRoom(Aspect aspect, int amount, EntityPlayer player)
    {
    	if(player == null)
    		return -1;
    	
	    for (int i = 0; i < InventoryPlayer.getHotbarSize(); ++i)
		    if (player.inventory.getStackInSlot(i) != null && player.inventory.getStackInSlot(i).getItem() instanceof ItemWand)
			    if (ItemWand.class.cast(player.inventory.getStackInSlot(i).getItem()).addVis(player.inventory.getStackInSlot(i), aspect, amount, false) < amount)
			    	return i;
	    return -1;
    }
    
    public void writeEntityToNBT(NBTTagCompound tag)
    {
    	tag.setShort("Age", (short)this.orbAge);
    	tag.setShort("Value", (short)this.aspectValue);
    	tag.setString("Aspect", getAspect().getTag());
    }

    public void readEntityFromNBT(NBTTagCompound tag)
    {
    	this.orbAge = tag.getShort("Age");
    	this.aspectValue = tag.getShort("Value");
    	setAspect(Aspect.getAspect(tag.getString("Aspect")));
    }
    
    public void writeSpawnData(ByteBuf data)
    {
	    if (getAspect() != null){
		    data.writeShort(getAspect().getTag().length());
		    for (char c : getAspect().getTag().toCharArray())
		    	data.writeChar(c);
	    }
    }

    public void readSpawnData(ByteBuf data)
    {
	    try{
		    int l = data.readShort();
		    StringBuilder s = new StringBuilder();
		    for (int i = 0; i < l; ++i){
		    	s.append(data.readChar());
		    }
		    setAspect(Aspect.getAspect(s.toString()));
	    }
	    catch (Exception e){e.printStackTrace();}
    }
    
    public int getAspectValue()
    {
    	return this.aspectValue;
    }

    public boolean canAttackWithItem()
    {
    	return false;
    }

    public Aspect getAspect()
    {
    	return this.aspect;
    }

    public void setAspect(Aspect aspect) 
    {
    	this.aspect = aspect;
    }
} public class EntityRevolverBullet extends EntityThrowable
{
	public Entity shooter;
	public ItemStack revolver;
	ArrayList<Pair<RevolverUpgrade,Integer>> upgrades;
	boolean isPrimal;
	
	public EntityRevolverBullet(World w)
	{
		super(w);
	}
	
	public EntityRevolverBullet(World w, EntityLivingBase shooter)
	{
		super(w, shooter);
		revolver = shooter.getHeldItem();
		this.shooter = shooter;
		if(revolver != null && revolver.getItem() instanceof ItemRevolver)
		{
			upgrades = ItemRevolver.getAllUpgradesFor(revolver);
			boolean allowNoclip = false;
			float speedIndex = 1;
			for(Pair<RevolverUpgrade,Integer> p : upgrades)
			{
				if(!allowNoclip)
					allowNoclip = p.getFirst().bulletNoclip((EntityPlayer) shooter, revolver, p.getSecond());
				
				speedIndex = (float) p.getFirst().modifySpeed((EntityPlayer) shooter, revolver, speedIndex, p.getSecond());
				
				if(p.getFirst() == RevolverUpgrade.primal)
					isPrimal = true;
			}
			if(allowNoclip)
				noClip = true;
			
			this.motionX *=3;
			this.motionY *=3;
			this.motionZ *=3;
			
			this.motionX *= speedIndex;
			this.motionY *= speedIndex;
			this.motionZ *= speedIndex;
		}
	}
	
    public void onUpdate()
    {
    	if(this.worldObj.isRemote)
    		Thaumcraft.proxy.getFX().sparkle((float)posX, (float)posY, (float)posZ, 4);
    	
    	if(this.worldObj.isRemote)
    		Thaumcraft.proxy.getFX().sparkle((float)(posX-motionX/20), (float)(posY-motionY/20), (float)(posZ-motionZ/20), 4);
    	
    	if(this.ticksExisted >= 200) //<- loop exit for primal
    		this.setDead();
    	
    	super.onUpdate();
    	
    	if(isPrimal && !isDead)
    	{
    		++ticksExisted; 
    		onUpdate(); //<- loop to turn into a hit-scan
    	}
    }
	
    protected float getGravityVelocity()
    {
        return isPrimal ? 0 : 0.01F;
    }

	@Override
	protected void onImpact(MovingObjectPosition object)
	{
		if(this.isDead)
			return;
		
		if(!this.worldObj.isRemote && object.typeOfHit == MovingObjectType.BLOCK)
		{
			if(noClip)
				return;
			if(this.worldObj.isBlockNormalCube(object.getBlockPos(), true))
				this.setDead();
		}
		if(object.typeOfHit == MovingObjectType.ENTITY)
		{
			Entity e = object.entityHit;
			if(e instanceof EntityLivingBase && e != this.shooter && !(e instanceof EntityRevolverBullet))
			{
				EntityLivingBase elb = (EntityLivingBase) e;
				float initialDamage = 14;
				for(Pair<RevolverUpgrade,Integer> p : upgrades)
					initialDamage = p.getFirst().modifyDamage_start(elb, revolver, initialDamage, p.getSecond());
				
				for(Pair<RevolverUpgrade,Integer> p : upgrades)
					initialDamage = p.getFirst().modifyDamage_end(elb, revolver, initialDamage, p.getSecond());
				
				elb.attackEntityFrom(new RevolverDamage("revolver"), initialDamage);
				
				boolean destroy = true;
				
				for(Pair<RevolverUpgrade,Integer> p : upgrades)
				{
					if(destroy)
						destroy = p.getFirst().afterhit(elb, (EntityPlayer) shooter, revolver, initialDamage, p.getSecond());
					else
						p.getFirst().afterhit(elb, (EntityPlayer) shooter, revolver, initialDamage, p.getSecond());
				}
				
				if(destroy)
					this.setDead();
			}
		}
	}
	
	public static class RevolverDamage extends DamageSource
	{

		public RevolverDamage(String damage) {
			super(damage);
		}
		
	}

    public void writeEntityToNBT(NBTTagCompound tag)
    {
    	super.writeEntityToNBT(tag);
    	if(revolver != null)
    	{
	    	NBTTagCompound revolverTag = new NBTTagCompound();
	    	revolver.writeToNBT(revolverTag);
	    	tag.setTag("revolverTag", revolverTag);
    	}
    	tag.setBoolean("noclip", noClip);
    	tag.setBoolean("primal", isPrimal);
    }
    
    public void readEntityFromNBT(NBTTagCompound tag)
    {
    	super.readEntityFromNBT(tag);
    	
    	if(tag.hasKey("revolverTag"))
    	{
    		revolver = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("revolverTag"));
			upgrades = ItemRevolver.getAllUpgradesFor(revolver);
    	}
    	noClip = tag.getBoolean("noclip");
    	isPrimal = tag.getBoolean("primal");
    }
} public class TBEventHandler {
	
	public static int clientUkuleleSoundPlayDelay = 0;
	
	@SubscribeEvent
	public void bucketFill(FillBucketEvent event)
	{
		if(event.target != null && event.world != null && event.target.typeOfHit == MovingObjectType.BLOCK && event.world.getBlockState(event.target.getBlockPos()).getBlock() instanceof BlockPyrofluid)
			{event.result = new ItemStack(Items.lava_bucket,1,0);event.setCanceled(true);}
	}
	
	@SubscribeEvent
	public void nameFormatEvent(NameFormat event)
	{
		if(TBConfig.allowHSNicknameChange)
			if(event.entityPlayer != null && event.entityPlayer.getCurrentEquippedItem() != null && event.entityPlayer.getCurrentEquippedItem().getItem() instanceof ItemHerobrinesScythe)
				event.displayname = "Herobrine";
	}
	
	@SubscribeEvent
	public void clientWorldTickEvent(ClientTickEvent event)
	{
		World world = TBCore.proxy.clientWorld();
		if(event.side == Side.CLIENT && event.phase == Phase.END && world != null && world.provider != null)
		{
			--clientUkuleleSoundPlayDelay;
			if(Minecraft.getMinecraft().thePlayer != null && Minecraft.getMinecraft().thePlayer.ticksExisted % 20 * 20 == 0)
			{
				TBUtils.loadedClientSpawners.clear();
				if(world.loadedTileEntityList != null)
					for(int i = 0; i < world.loadedTileEntityList.size(); ++i)
					{
						Object obj = world.loadedTileEntityList.get(i);
						if(obj instanceof TileEntity && obj instanceof TileEntityMobSpawner && !TileEntity.class.cast(obj).isInvalid() && TileEntity.class.cast(obj) instanceof ITickable)
						{
							TileEntity tile = TileEntity.class.cast(obj);
							Coord3D coords = new Coord3D(tile.getPos().getX(),tile.getPos().getY(),tile.getPos().getZ());
							Pair<Integer, Coord3D> tileCoords = new Pair<Integer, Coord3D>(world.provider.getDimensionId(),coords);
							TBUtils.loadedClientSpawners.add(tileCoords);
						}
					}
			}
		}
	}

} public class ContainerOverchanter extends ContainerInventory {

	public ContainerOverchanter(InventoryPlayer playerInv, TileEntity tileInv) {
		super(playerInv, tileInv);
	}

	@Override
	public void setupSlots() {
		this.addSlotToContainer(new Slot(this.inv,0,80,20));
		this.setupPlayerInventory();
	}

} public class ItemUkulele extends ItemAmuletVis{

	public static final String[] types = new String[]{
		"simple",
		"knowledge",
		"calming",
		"electric",
		"resistance",
		"buffing",
		"confusion",
		"growth",
		"love"
	};
	
	public static final boolean[] isCostPerTick = new boolean[]{
		false,
		false,
		false,
		false,
		true,
		false,
		false,
		true,
		true
	};
	
	public static final AspectList[] costs = new AspectList[]{
		new AspectList().add(Aspect.AIR, 0).add(Aspect.FIRE, 0).add(Aspect.ENTROPY, 0).add(Aspect.ORDER, 0).add(Aspect.EARTH, 0).add(Aspect.WATER, 0),
		new AspectList().add(Aspect.AIR, 200).add(Aspect.FIRE, 200).add(Aspect.ENTROPY, 50).add(Aspect.ORDER, 100).add(Aspect.EARTH, 50).add(Aspect.WATER, 50),
		new AspectList().add(Aspect.AIR, 100).add(Aspect.FIRE, 50).add(Aspect.ENTROPY, 20).add(Aspect.ORDER, 200).add(Aspect.EARTH, 100).add(Aspect.WATER, 100),
		new AspectList().add(Aspect.AIR, 50).add(Aspect.FIRE, 50).add(Aspect.ENTROPY, 25).add(Aspect.ORDER, 25).add(Aspect.EARTH, 5).add(Aspect.WATER, 10),
		new AspectList().add(Aspect.AIR, 2).add(Aspect.FIRE, 2).add(Aspect.ENTROPY, 2).add(Aspect.ORDER, 8).add(Aspect.EARTH, 10).add(Aspect.WATER, 5),
		new AspectList().add(Aspect.AIR, 2000).add(Aspect.FIRE, 2000).add(Aspect.ENTROPY, 2000).add(Aspect.ORDER, 2000).add(Aspect.EARTH, 2000).add(Aspect.WATER, 2000),
		new AspectList().add(Aspect.AIR, 100).add(Aspect.FIRE, 100).add(Aspect.ENTROPY, 200).add(Aspect.ORDER, 25).add(Aspect.EARTH, 25).add(Aspect.WATER, 50),
		new AspectList().add(Aspect.AIR, 2).add(Aspect.FIRE, 2).add(Aspect.ENTROPY, 2).add(Aspect.ORDER, 10).add(Aspect.EARTH, 10).add(Aspect.WATER, 10),
		new AspectList().add(Aspect.AIR, 10).add(Aspect.FIRE, 5).add(Aspect.ENTROPY, 5).add(Aspect.ORDER, 8).add(Aspect.EARTH, 8).add(Aspect.WATER, 10)
	};
	
	public static final int[] soundDelays = new int[]{
		25*20,
		4*20,
		20*20,
		8*20,
		9*20,
		10*20,
		16*20,
		8*20,
		10*20
	};
	
	public static final DecimalFormat formatForAspects = new DecimalFormat("###.##");
	
	@Override
	public EnumRarity getRarity(ItemStack itemstack)
	{
		return EnumRarity.RARE;
	}
	
	public AspectList getCostWithDiscount(ItemStack is, EntityPlayer p, float originalCost, AspectList al)
	{
		AspectList originalAL = al.copy();
		for(int i1 = 0; i1 < 6; ++i1)
		{
			Aspect a = originalAL.getAspects()[i1];
			int costi = originalAL.getAmount(a);
			originalAL.reduce(a, costi);
			float originalDiscount = originalCost;
			originalDiscount -= WandManager.getTotalVisDiscount(p, a);
			costi *= originalDiscount;
			
			originalAL.add(a, costi);
		}
		return originalAL;
	}

	public void onUsingTick(ItemStack stack, EntityPlayer player, int count)
	{
		{
			Vec3 lookVec = player.getLookVec();
			AspectList cost = getCostWithDiscount(stack, player, 0.75F, costs[Math.min(stack.getItemDamage(), costs.length-1)]);
			player.worldObj.spawnParticle(EnumParticleTypes.NOTE, player.posX+lookVec.xCoord/5+MathUtils.randomDouble(itemRand)/2, player.posY+1+lookVec.yCoord/2+MathUtils.randomDouble(itemRand)/10+0.1D, player.posZ+lookVec.zCoord/2+MathUtils.randomDouble(itemRand)/5, itemRand.nextDouble(), itemRand.nextDouble(), itemRand.nextDouble());
			if(player.worldObj.isRemote && TBEventHandler.clientUkuleleSoundPlayDelay <= 0)
			{
				TBEventHandler.clientUkuleleSoundPlayDelay = soundDelays[Math.min(stack.getItemDamage(), soundDelays.length-1)];
				TBCore.proxy.playGuitarSound("thaumicbases:guitar."+types[Math.min(stack.getItemDamage(), types.length-1)]);
			}
			if(stack.getItemDamage() == 1 && (this.getVis(stack, Aspect.AIR) > 0 && this.getVis(stack, Aspect.FIRE) > 0 && this.getVis(stack, Aspect.WATER) > 0 && this.getVis(stack, Aspect.EARTH) > 0 && this.getVis(stack, Aspect.ORDER) > 0 && this.getVis(stack, Aspect.ENTROPY) > 0))
			{
				if(count % 80 == 0)
				{
					AxisAlignedBB aabb = AxisAlignedBB.fromBounds(player.posX-8, player.posY-8, player.posZ-8, player.posX+8, player.posY+8, player.posZ+8);
					List<EntityPlayer> players = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb);
					for(EntityPlayer p : players)
					{
						boolean addAspect = p == player ? true : p.worldObj.rand.nextBoolean();
						
						if(!addAspect)
							continue;
						
						int amount = p.worldObj.rand.nextInt(3)+1;
						if(!player.worldObj.isRemote && this.consumeAllVis(stack, player, cost, true, false))
						{
							EntityXPOrb xp = new EntityXPOrb(player.worldObj,player.posX,player.posY,player.posZ,amount);
							player.worldObj.spawnEntityInWorld(xp);
						}
					}
				}
			}
			if(stack.getItemDamage() == 2 && (this.getVis(stack, Aspect.AIR) > 0 && this.getVis(stack, Aspect.FIRE) > 0 && this.getVis(stack, Aspect.WATER) > 0 && this.getVis(stack, Aspect.EARTH) > 0 && this.getVis(stack, Aspect.ORDER) > 0 && this.getVis(stack, Aspect.ENTROPY) > 0))
			{
				if(count % 20 == 0)
				{
					AxisAlignedBB aabb = AxisAlignedBB.fromBounds(player.posX-4, player.posY-4, player.posZ-4, player.posX+4, player.posY+4, player.posZ+4);
					List<EntityPlayer> players = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb);
					for(EntityPlayer p : players)
					{
						if(this.consumeAllVis(stack, player, cost, !player.worldObj.isRemote, false))
						{
							boolean hasEffect = p.getActivePotionEffect(PotionWarpWard.instance) != null;
							if(!hasEffect)
							{
								if(!p.worldObj.isRemote)
									p.addPotionEffect(new PotionEffect(PotionWarpWard.instance.getId(),200,0,true,false));
							}else
							{
								PotionEffect effect = p.getActivePotionEffect(PotionWarpWard.instance);
								try
								{
									Field dur = PotionEffect.class.getDeclaredFields()[2];
									dur.setAccessible(true);
									dur.setInt(effect, dur.getInt(effect)+120);
									dur.setAccessible(false);
								}
								catch(Exception e)
								{
									e.printStackTrace();
									continue;
								}
							}
						}
					}
				}
			}
			if(stack.getItemDamage() == 3 && (this.getVis(stack, Aspect.AIR) > 0 && this.getVis(stack, Aspect.FIRE) > 0 && this.getVis(stack, Aspect.WATER) > 0 && this.getVis(stack, Aspect.EARTH) > 0 && this.getVis(stack, Aspect.ORDER) > 0 && this.getVis(stack, Aspect.ENTROPY) > 0))
			{
				double dx = player.posX + MathUtils.randomDouble(itemRand)*16;
				double dy = player.posY + MathUtils.randomDouble(itemRand)*16;
				double dz = player.posZ + MathUtils.randomDouble(itemRand)*16;
				if(player.worldObj.isRemote && player.worldObj.rand.nextDouble() <= 0.1D)
					Thaumcraft.proxy.getFX().arcLightning(player.posX, player.posY-1, player.posZ, dx, dy, dz, 0.2F, 0.5F, 1, 1);
				
				f:for(int i = 1; i <= 16; ++i)
				{
					double px = lookVec.xCoord*i+player.posX;
					double py = lookVec.yCoord*i+player.posY+player.getEyeHeight();
					double pz = lookVec.zCoord*i+player.posZ;
					AxisAlignedBB aabb = AxisAlignedBB.fromBounds(px-0.5D, py-0.5D, pz-0.5D, px+0.5D, py+0.5D, pz+0.5D);
					List<EntityLivingBase> mobs = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, aabb);
					for(EntityLivingBase e : mobs)
					{
						if(e == player)
							continue;
						
						if(e.isDead)
							continue;
						
						if(e.hurtTime > 0)
							continue;

						boolean attack = true;
						
						if(!this.consumeAllVis(stack, player, cost, !player.worldObj.isRemote, false))
						{
							attack = false;
						}
						
						if(attack)
						{
							e.attackEntityFrom(DamageSource.causePlayerDamage(player), 6);
							if(player.worldObj.isRemote)
								Thaumcraft.proxy.getFX().arcLightning(player.posX, player.posY-1, player.posZ, e.posX, e.posY, e.posZ, 0.2F, 0.5F, 1, 1);
							player.worldObj.playSound(player.posX, player.posY, player.posZ, "thaumcraft:jacobs", 1, player.worldObj.rand.nextFloat()*2, false);
							player.worldObj.playSound(e.posX, e.posY, e.posZ, "thaumcraft:jacobs", 1, player.worldObj.rand.nextFloat()*2, false);
						}
						
						break f;
					}
				}
			}
			if(stack.getItemDamage() == 4 && (this.getVis(stack, Aspect.AIR) > 0 && this.getVis(stack, Aspect.FIRE) > 0 && this.getVis(stack, Aspect.WATER) > 0 && this.getVis(stack, Aspect.EARTH) > 0 && this.getVis(stack, Aspect.ORDER) > 0 && this.getVis(stack, Aspect.ENTROPY) > 0))
			{
				if(count % 10 == 0)
				{
					for(int i = 0; i < cost.size(); ++i)
					{
						cost.add(cost.getAspects()[i], cost.getAmount(cost.getAspects()[i])*9);
					}
					if(stack.hasTagCompound() && stack.getTagCompound().hasKey("playerhealth"))
					{
						if(this.consumeAllVis(stack, player, cost, !player.worldObj.isRemote, false))
						{
							if(player.getHealth() < stack.getTagCompound().getDouble("playerhealth"))
							{
								player.setHealth((float) stack.getTagCompound().getDouble("playerhealth"));
							}else
							{
								stack.getTagCompound().setDouble("playerhealth", player.getHealth());
							}
						}
					}else
					{
						if(!stack.hasTagCompound())
							stack.setTagCompound(new NBTTagCompound());
						
						stack.getTagCompound().setDouble("playerhealth", player.getHealth());
					}
					
				}
			}
			if(stack.getItemDamage() == 5 && (this.getVis(stack, Aspect.AIR) > 0 && this.getVis(stack, Aspect.FIRE) > 0 && this.getVis(stack, Aspect.WATER) > 0 && this.getVis(stack, Aspect.EARTH) > 0 && this.getVis(stack, Aspect.ORDER) > 0 && this.getVis(stack, Aspect.ENTROPY) > 0))
			{
				if(count % 100 == 0)
				{
					AxisAlignedBB aabb = AxisAlignedBB.fromBounds(player.posX-4, player.posY-4, player.posZ-4, player.posX+4, player.posY+4, player.posZ+4);
					List<EntityPlayer> players = player.worldObj.getEntitiesWithinAABB(EntityPlayer.class, aabb);
					for(EntityPlayer p : players)
					{
						if(this.consumeAllVis(stack, player, cost, !player.worldObj.isRemote, false))
						{
							Potion[] pots = new Potion[]{Potion.damageBoost,Potion.moveSpeed,Potion.digSpeed,Potion.nightVision,Potion.waterBreathing,Potion.regeneration};
							for(Potion pp : pots)
							{
								boolean hasEffect = p.getActivePotionEffect(pp) != null;
								if(!hasEffect)
								{
									if(!p.worldObj.isRemote)
										p.addPotionEffect(new PotionEffect(pp.id,600,0,true,false));
								}else
								{
									PotionEffect effect = p.getActivePotionEffect(pp);
									try
									{
										Field dur = PotionEffect.class.getDeclaredFields()[2];
										dur.setAccessible(true);
										dur.setInt(effect, dur.getInt(effect)+600);
										dur.setAccessible(false);
									}
									catch(Exception e)
									{
										e.printStackTrace();
										continue;
									}
								}
							}
						}
					}
				}
			}
			if(stack.getItemDamage() == 6 && (this.getVis(stack, Aspect.AIR) > 0 && this.getVis(stack, Aspect.FIRE) > 0 && this.getVis(stack, Aspect.WATER) > 0 && this.getVis(stack, Aspect.EARTH) > 0 && this.getVis(stack, Aspect.ORDER) > 0 && this.getVis(stack, Aspect.ENTROPY) > 0))
			{
				if(count % 20 == 0)
					f:for(int i = 1; i <= 8; ++i)
					{
						double px = lookVec.xCoord*i+player.posX;
						double py = lookVec.yCoord*i+player.posY+player.getEyeHeight();
						double pz = lookVec.zCoord*i+player.posZ;
						AxisAlignedBB aabb = AxisAlignedBB.fromBounds(px-0.5D, py-0.5D, pz-0.5D, px+0.5D, py+0.5D, pz+0.5D);
						List<EntityLivingBase> mobs = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, aabb);
						for(EntityLivingBase e : mobs)
						{
							if(e == player)
								continue;
							
							if(e.isDead)
								continue;
							
							boolean attack = true;
							
							if(!this.consumeAllVis(stack, player, cost, !player.worldObj.isRemote, false))
							{
								attack = false;
							}
							
							if(attack)
							{
								if(e instanceof EntityAnimal)
								{
									EntityAnimal.class.cast(e).attackEntityFrom(DamageSource.causePlayerDamage(player), 0);
								}
								if(e instanceof IMob)
								{
									AxisAlignedBB nearbyMobs = AxisAlignedBB.fromBounds(e.posX-16, e.posY-6, e.posZ-16, e.posX+16, e.posY+6, e.posZ+16);
									List<EntityLivingBase> nMobs = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, nearbyMobs);
									
									if(nMobs.contains(player))
										nMobs.remove(player);
									if(nMobs.contains(e))
										nMobs.remove(e);
									
									if(!nMobs.isEmpty())
									{
										EntityLivingBase base = nMobs.get(player.worldObj.rand.nextInt(nMobs.size()));
										e.setRevengeTarget(base);
										e.setLastAttacker(base);
									}
								}
								
								if(e instanceof EntityPlayer)
								{
									e.addPotionEffect(new PotionEffect(Potion.blindness.id,100,0,true,false));
									e.addPotionEffect(new PotionEffect(Potion.confusion.id,100,0,true,false));
								}
							}
							
							break f;
						}
					}
			}
			if(stack.getItemDamage() == 7 && (this.getVis(stack, Aspect.AIR) > 0 && this.getVis(stack, Aspect.FIRE) > 0 && this.getVis(stack, Aspect.WATER) > 0 && this.getVis(stack, Aspect.EARTH) > 0 && this.getVis(stack, Aspect.ORDER) > 0 && this.getVis(stack, Aspect.ENTROPY) > 0))
			{
				if(count % 10 == 0)
				{
					for(int i = 0; i < cost.size(); ++i)
					{
						cost.add(cost.getAspects()[i], cost.getAmount(cost.getAspects()[i])*9);
					}
					if(this.consumeAllVis(stack, player, cost, !player.worldObj.isRemote, false))
					{
						for(int i = 0; i < 64; ++i)
						{
							int dx = MathHelper.floor_double(player.posX+MathUtils.randomDouble(itemRand)*6);
							int dy = MathHelper.floor_double(player.posY);
							int dz = MathHelper.floor_double(player.posZ+MathUtils.randomDouble(itemRand)*6);
							Block b = player.worldObj.getBlockState(new BlockPos(dx, dy, dz)).getBlock();
							if(!b.isAir(player.worldObj, new BlockPos(dx, dy, dz)) && b instanceof IPlantable)
								b.randomTick(player.worldObj, new BlockPos(dx, dy, dz), player.worldObj.getBlockState(new BlockPos(dx, dy, dz)), player.worldObj.rand);
						}
					}
				}
			}
			if(stack.getItemDamage() == 8 && (this.getVis(stack, Aspect.AIR) > 0 && this.getVis(stack, Aspect.FIRE) > 0 && this.getVis(stack, Aspect.WATER) > 0 && this.getVis(stack, Aspect.EARTH) > 0 && this.getVis(stack, Aspect.ORDER) > 0 && this.getVis(stack, Aspect.ENTROPY) > 0))
			{
				if(count % 10 == 0)
				{
					for(int i = 0; i < cost.size(); ++i)
					{
						cost.add(cost.getAspects()[i], cost.getAmount(cost.getAspects()[i])*9);
					}
					if(this.consumeAllVis(stack, player, cost, !player.worldObj.isRemote, false))
					{
						AxisAlignedBB aabb = AxisAlignedBB.fromBounds(player.posX-16, player.posY-4, player.posZ-16, player.posX+16, player.posY+4, player.posZ+16);
						List<EntityAnimal> animals = player.worldObj.getEntitiesWithinAABB(EntityAnimal.class, aabb);
						List<EntityAnimal> toRemove = new ArrayList<EntityAnimal>();
						for(EntityAnimal a : animals)
						{
							if(a.isInLove())
								toRemove.add(a);
							if(a.isDead)
								toRemove.add(a);
						}
						animals.removeAll(toRemove);
						
						if(!animals.isEmpty())
							animals.get(player.worldObj.rand.nextInt(animals.size())).setInLove(player);
					}
				}
			}
		}
	}
	
	public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer player, int count)
	{
		if(!itemstack.hasTagCompound())
			itemstack.setTagCompound(new NBTTagCompound());
		itemstack.getTagCompound().removeTag("playerhealth");
	}
	
	public Aspect handleRecharge(World world, ItemStack itemstack, BlockPos pos, EntityPlayer player, int amount)
	{
		AspectList al = getAspectsWithRoom(itemstack);
		for (Aspect aspect : al.getAspectsSortedByAmount())
		if (aspect != null)
		{
			int amt = Math.min(amount, al.getAmount(aspect));
			int drained = AuraHandler.drainAuraAvailable(world, pos, aspect, amt);
			if (drained > 0) 
			{
				addVis(itemstack, aspect, drained*100, true);
				amount -= drained;
				if (amount <= 0) return aspect;
			}
		}
		return null;
	}

	public EnumAction getItemUseAction(ItemStack par1ItemStack)
	{
		return EnumAction.NONE;
	}
	
	public int getMaxItemUseDuration(ItemStack itemstack)
	{
		return Integer.MAX_VALUE;
	}
	
	public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
	{
		player.setItemInUse(itemstack, getMaxItemUseDuration(itemstack));
		return itemstack;
	}
	
	@Override
	public boolean canEquip(ItemStack itemstack, EntityLivingBase player)
	{
		return false;
	}
	
	@Override
	public boolean canUnequip(ItemStack itemstack, EntityLivingBase player)
	{
		return false;
	}
	
	@Override
	public int getMaxVis(ItemStack stack)
	{
		return 30000;
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
	{
		AspectList cost = getCostWithDiscount(stack, player, 0.75F, costs[Math.min(stack.getItemDamage(), costs.length-1)]);
		list.add(StatCollector.translateToLocal("tb.ukulele.type."+types[Math.min(stack.getItemDamage(), types.length-1)]));
		list.add("");
		list.add(EnumChatFormatting.GOLD + StatCollector.translateToLocal("item.capacity.text") + " " + getMaxVis(stack) / 100);
		if (stack.hasTagCompound())
			for (Aspect aspect : Aspect.getPrimalAspects())
				 if (stack.getTagCompound().hasKey(aspect.getTag())) 
				 {
					 String amount = formatForAspects.format(stack.getTagCompound().getInteger(aspect.getTag()) / 100.0F);
					 list.add(" §" + aspect.getChatcolor() + aspect.getName() + "§r x " + amount + " ("+formatForAspects.format((float)cost.getAmount(aspect)/100)+"/"+(isCostPerTick[stack.getItemDamage()] ? "tick" : "use")+")");
				 }
	
	}
	
	public void onUpdate(ItemStack is, World w, Entity e, int slot, boolean currentItem)
	{
		if (!w.isRemote && e instanceof EntityPlayer)
		{
			EntityPlayer player = (EntityPlayer)e;
			
			if (player.ticksExisted % 5 == 0) {
				int cr = WandManager.getBaseChargeRate(player, currentItem, slot);
				if (cr > 0) 
					handleRecharge(player.worldObj, is, new BlockPos(player), player, cr);
			}
		}
	}
	
	@SuppressWarnings({ "rawtypes", "unchecked" })
	@Override
	public void getSubItems(Item itm, CreativeTabs tabs, List lst)
	{
		for(int i = 0; i < types.length; ++i)
		{
			lst.add(new ItemStack(itm,1,i));
			ItemStack max = new ItemStack(itm,1,i);
			NBTTagCompound tag = new NBTTagCompound();
			tag.setInteger(Aspect.AIR.getTag(), this.getMaxVis(max));
			tag.setInteger(Aspect.FIRE.getTag(), this.getMaxVis(max));
			tag.setInteger(Aspect.WATER.getTag(), this.getMaxVis(max));
			tag.setInteger(Aspect.EARTH.getTag(), this.getMaxVis(max));
			tag.setInteger(Aspect.ENTROPY.getTag(), this.getMaxVis(max));
			tag.setInteger(Aspect.ORDER.getTag(), this.getMaxVis(max));
			max.setTagCompound(tag);
			lst.add(max);
		}
	}
	
} public class TileAuraLinker extends TileEntity implements IWandable,ITickable{
	
	public Coord3D linkCoord;
	public int syncTimer;
	public int instability;
	Object beam;
	@Override
	public void update() {
		
		if(syncTimer <= 0)
		{
			syncTimer = 100;
			NBTTagCompound tg = new NBTTagCompound();
			if(linkCoord != null)
			{
				tg.setFloat("coordsX", linkCoord.x);
				tg.setFloat("coordsY", linkCoord.y);
				tg.setFloat("coordsZ", linkCoord.z);
			}
			tg.setInteger("x", pos.getX());
			tg.setInteger("y", pos.getY());
			tg.setInteger("z", pos.getZ());
			MiscUtils.syncTileEntity(tg, 0);
		}else
			--syncTimer;
		
		if(linkCoord != null)
		{
			int x = MathHelper.floor_double(linkCoord.x);
			int y = MathHelper.floor_double(linkCoord.y);
			int z = MathHelper.floor_double(linkCoord.z);
			
			if(this.worldObj.getTileEntity(new BlockPos(x, y, z)) instanceof TileAuraLinker && TileAuraLinker.class.cast(this.worldObj.getTileEntity(new BlockPos(x, y, z))).linkCoord == null)
			{
				double sX = linkCoord.x+0.5D;
				double sY = linkCoord.y+0.925D;
				double sZ = linkCoord.z+0.5D;
				
				double eX = pos.getX()+0.5D;
				double eY = pos.getY()+0.925D;
				double eZ = pos.getZ()+0.5D;
				
				int cX = pos.getX() / 16;
				int cZ = pos.getZ() / 16;
				int ecX = x / 16;
				int ecZ = z / 16;
				
				boolean same = cX == ecX && cZ == ecZ;
				
				if(this.worldObj.isRemote)
					beam = Thaumcraft.proxy.getFX().beamBore(sX, sY, sZ, eX, eY, eZ, 1, same ? 0xff0000 : 0xffffff, true, 1, beam, 1);
				
				if(syncTimer % 10 == 0 && !this.worldObj.isRemote && !same && !this.worldObj.isBlockPowered(pos) && !this.worldObj.isBlockPowered(pos.down()))
				{
					int aPos = this.worldObj.rand.nextInt(Aspect.getPrimalAspects().size());
					Aspect a = Aspect.getPrimalAspects().get(aPos);
					int aPullFrom = AuraHelper.getAura(worldObj, getPos(), a);
					BlockPos to = new BlockPos(x,y,z);
					
					if(!this.worldObj.isBlockPowered(to) && !this.worldObj.isBlockPowered(to.down()) && aPullFrom > 0 && AuraHelper.drainAura(worldObj, pos, a, 1))
					{
						int pIndex = a == Aspect.AIR ? 1 : a == Aspect.WATER ? 2 : a == Aspect.EARTH ? 3 : a == Aspect.ENTROPY ? 5 : a == Aspect.ORDER ? 6 : a == Aspect.FIRE ? 4 : 0;
						boolean iB = instabilityCheck();
						if(iB)
							AuraHelper.addAura(worldObj, to, a, 1);
						
						if(iB)
							for(int i = 0; i < 10; ++i)
								Thaumcraft.proxy.getFX().sparkle((float)sX, (float)sY+0.1F, (float)sZ, 3, pIndex, -this.worldObj.rand.nextFloat());
							
						for(int i = 0; i < 10; ++i)
						{
							float addition = this.worldObj.rand.nextFloat();
							Thaumcraft.proxy.getFX().sparkle((float)eX, (float)eY+0.1F+addition, (float)eZ, 3, pIndex, addition);
						}
						
						if(this.worldObj.rand.nextInt(100) > aPullFrom)
							++instability;
					}
				}
			}else
			{
				linkCoord = null;
				beam = null;
			}
		}else
		{
			instability = 0;
			beam = null;
		}
	}
	
	public boolean instabilityCheck()
	{
		if(instability > 0 && this.worldObj.rand.nextInt(50) <= this.instability)
		{
			int rnd = this.worldObj.rand.nextInt(this.instability);
			if(rnd == 49)
			{
				instability -= explodeTransmitter();
			}else
			{
				if(rnd >= 45)
				{
					instability -= harmTransmitter();
				}else
				{
					if(rnd >= 31)
					{
						instability -= wisp();
					}else
					{
						if(rnd >= 20)
						{
							instability -= zap();
						}else
						{
							if(rnd >= 10)
							{
								instability -= fluxNode();
							}else
							{
								instability -= fluxTransmission();
							}
						}
					}
				}
			}
			return false;
		}
		return true;
	}
	
	public int harmTransmitter()
	{
		int destroyed = 0;
		for(Aspect a : Aspect.getPrimalAspects())
		{
			int current = AuraHelper.getAura(worldObj, getPos(), a);
			if(current > 0)
			{
				int reduced = this.worldObj.rand.nextInt(Math.min(current, 6));
				if(reduced > 0)
					AuraHelper.drainAura(worldObj, getPos(), a, reduced);
				
				destroyed += reduced;
			}
			
		}
		return destroyed;
	}
	
	public int zap()
	{
		int x = pos.getX();
		int y = pos.getY();
		int z = pos.getZ();
		List<EntityPlayer> players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(x-5, y-6, z-5, x+5, y+4, z+5));
		if(!players.isEmpty())
		{
			EntityPlayer target = players.get(worldObj.rand.nextInt(players.size()));
			target.attackEntityFrom(DamageSource.magic, 4 + this.worldObj.rand.nextInt(4));
			return 9;
		}
		return 0;
	}
	
	public int wisp()
	{
		boolean side = this.worldObj.rand.nextBoolean();
		int x = side ? MathHelper.floor_double(linkCoord.x) : pos.getX();
		int y = side ? MathHelper.floor_double(linkCoord.y) : pos.getY();
		int z = side ? MathHelper.floor_double(linkCoord.z) : pos.getZ();
		ArrayList<Aspect> aspects = new ArrayList<Aspect>();
		Collection<Aspect> pa = Aspect.aspects.values();
		aspects.addAll(pa);
		
		EntityWisp wisp = new EntityWisp(worldObj);
		wisp.setPositionAndRotation(x+0.5D, y-0.5D, z+0.5D, 0, 0);
		wisp.setType(aspects.get(worldObj.rand.nextInt(aspects.size())).getTag());
		worldObj.spawnEntityInWorld(wisp);
		
		return 9;
	}
	
	public int fluxNode()
	{
		AuraHelper.pollute(getWorld(), getPos(), 3, true);
		return 5;
	}
	
	public int fluxTransmission()
	{
		AuraHelper.pollute(getWorld(), getPos(), 3, true);
		return 3;
	}
	
	public int explodeTransmitter()
	{
		int x = MathHelper.floor_double(pos.getX());
		int y = MathHelper.floor_double(pos.getY());
		int z = MathHelper.floor_double(pos.getZ());
		this.worldObj.setBlockToAir(pos);
		this.worldObj.createExplosion(null, x+0.5D, y-0.5D, z+0.5D, 2, true);
		return instability;
	}
	
    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
    {
    	if(pkt.getNbtCompound().hasKey("coordsX"))
    	{
    		linkCoord = new Coord3D(pkt.getNbtCompound().getFloat("coordsX"),pkt.getNbtCompound().getFloat("coordsY"),pkt.getNbtCompound().getFloat("coordsZ"));
    	}else
    		linkCoord = null;
    }
    
    public void readFromNBT(NBTTagCompound tag)
    {
        super.readFromNBT(tag);
    	if(tag.hasKey("coordsX"))
    	{
    		linkCoord = new Coord3D(tag.getFloat("coordsX"),tag.getFloat("coordsY"),tag.getFloat("coordsZ"));
    	}
    	instability = tag.getInteger("instability");
    }
    
    public void writeToNBT(NBTTagCompound tag)
    {
        super.writeToNBT(tag);
		if(linkCoord != null)
		{
			tag.setFloat("coordsX", linkCoord.x);
			tag.setFloat("coordsY", linkCoord.y);
			tag.setFloat("coordsZ", linkCoord.z);
		}
		tag.setInteger("instability", instability);
    }

	@Override
	public boolean onWandRightClick(World paramWorld, ItemStack paramItemStack, EntityPlayer paramEntityPlayer,BlockPos paramBlockPos, EnumFacing paramEnumFacing) {
	
		
		paramEntityPlayer.swingItem();
		if(!paramItemStack.hasTagCompound())
			paramItemStack.setTagCompound(new NBTTagCompound());
		
		if(paramItemStack.getTagCompound().hasKey("linkCoordX"))
		{
			float x = paramItemStack.getTagCompound().getFloat("linkCoordX");
			float y = paramItemStack.getTagCompound().getFloat("linkCoordY");
			float z = paramItemStack.getTagCompound().getFloat("linkCoordZ");
			if(this.worldObj.getTileEntity(new BlockPos(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z))) instanceof TileAuraLinker)
			{
				TileAuraLinker tile = (TileAuraLinker) this.worldObj.getTileEntity(new BlockPos(MathHelper.floor_double(x), MathHelper.floor_double(y), MathHelper.floor_double(z)));
				tile.linkCoord = new Coord3D(pos.getX(),pos.getY(),pos.getZ());
				paramItemStack.getTagCompound().removeTag("linkCoordX");
				paramItemStack.getTagCompound().removeTag("linkCoordY");
				paramItemStack.getTagCompound().removeTag("linkCoordZ");
				if(paramWorld.isRemote)
					paramEntityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.linkEstabilished")));
			}
		}else
		{
			paramItemStack.getTagCompound().setFloat("linkCoordX", pos.getX());
			paramItemStack.getTagCompound().setFloat("linkCoordY", pos.getY());
			paramItemStack.getTagCompound().setFloat("linkCoordZ", pos.getZ());
			if(paramWorld.isRemote)
				paramEntityPlayer.addChatMessage(new ChatComponentText(StatCollector.translateToLocal("tb.txt.linkStarted")));
		}
		
		return false;
	}

	@Override
	public void onUsingWandTick(ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt) {
		
	}

	@Override
	public void onWandStoppedUsing(ItemStack paramItemStack, World paramWorld, EntityPlayer paramEntityPlayer,
			int paramInt) {
		
	}

} public class TileNodeManipulator extends TileEntity implements ITickable{
	public int workTime = 0;
	public EntityAuraNode node = null;
	public boolean firstTick = true;
	public int ticksExisted;
	Object beam;
	
    public void readFromNBT(NBTTagCompound tag)
    {
        super.readFromNBT(tag);
        workTime = tag.getInteger("workTime");
    }
	
    public void writeToNBT(NBTTagCompound tag)
    {
        super.writeToNBT(tag);
        tag.setInteger("workTime", workTime);
    }
	
	@Override
	public void update(){
		++ticksExisted;
		if(ticksExisted % 20 == 0)
			beam = null;
		if((firstTick || ticksExisted % 20 == 0) && node == null)
		{
			List<Entity> nodes = TBUtils.castLst(this.worldObj.getEntitiesWithinAABB(EntityAuraNode.class, AxisAlignedBB.fromBounds(pos.getX(), pos.getY(), pos.getZ(), pos.getX(), pos.getY(), pos.getZ()).expand(3, 3, 3)));
			if(!nodes.isEmpty())
				node = (EntityAuraNode) MiscUtils.getClosestEntity(nodes, pos.getX(), pos.getY(), pos.getZ());
		}
		
		if(node != null && (node.isDead || MathHelper.sqrt_double(node.getDistanceSq(getPos())) > 3))
			node = null;
		
		if(node != null)
		{
			int meta = BlockStateMetadata.getBlockMetadata(worldObj, getPos());
			EnumEffect ee = EnumEffect.fromMetadata(meta);
			NodeType nt = NodeType.nodeTypes[node.getNodeType()];
			switch(ee)
			{
				case BRIGHTEN:
				{
					if(nt instanceof NTNormal)
					{
						if(workTime > 20*60*20)
						{
							workTime = 0;
							node.setNodeType(6);
						}else
						{
							++workTime;
						}
					}
					break;
				}
				
				case DESTRUCT:
				{
					int maxTimeRequired = nt instanceof NTAstral ? 1*60*20 : 2*60*20;
					if(workTime >= maxTimeRequired)
					{
						workTime = 0;
						if(!(nt instanceof NTAstral))
						{
							node.setDead();
							node = null;
							return;
						}
						node.setNodeType(0);
						
					}else
					{
						++workTime;
						if(ticksExisted % 10 == 0)
						{
							Aspect asp = node.getAspect();
							AspectList al = AspectHelper.reduceToPrimals(new AspectList().add(asp,1));
							Aspect a = al.getAspects()[this.worldObj.rand.nextInt(al.size())];
							EntityAspectOrb aspect = new EntityAspectOrb(worldObj, node.posX,node.posY,node.posZ, a, 1);
							if(!this.worldObj.isRemote)
								this.worldObj.spawnEntityInWorld(aspect);
						}
					}
					break;
				}
				
				case EFFICIENCY:
				{
					if(this.worldObj.rand.nextDouble() < 0.05D)
					{
						Aspect asp = node.getAspect();
						AspectList al = AspectHelper.reduceToPrimals(new AspectList().add(asp,1));
						Aspect a = al.getAspects()[this.worldObj.rand.nextInt(al.size())];
						AuraHelper.addAura(getWorld(), node.getPosition(), a, 1+this.worldObj.rand.nextInt(5));
					}
					break;
				}
				
				case HUNGER:
				{
					if(nt instanceof NTNormal)
					{
						if(workTime > 5*60*20)
						{
							workTime = 0;
							node.setNodeType(2);
						}else
							++workTime;
					}
					break;
				}
				
				case INSTABILITY:
				{
					if(nt instanceof NTNormal)
					{
						if(workTime > 7*60*20)
						{
							workTime = 0;
							node.setNodeType(5);
						}else
							++workTime;
					}
					break;
				}
				
				case PURITY:
				{
					if(nt instanceof NTNormal)
					{
						if(workTime > 3*60*20)
						{
							workTime = 0;
							node.setNodeType(3);
						}else
							++workTime;
					}
					break;
				}
				
				case SINISTER:
				{
					if(nt instanceof NTNormal)
					{
						if(workTime > 6*60*20)
						{
							workTime = 0;
							node.setNodeType(1);
						}else
							++workTime;
					}
					break;
				}
				
				case SPEED:
				{
					for(int i = 0; i < 4; ++i)
						node.onEntityUpdate();
					
					break;
				}
				
				case STABILITY:
				{
					int maxTimeRequired = 0;
					
					if(nt instanceof NTDark)
						maxTimeRequired = 2*60*20;
					
					if(nt instanceof NTHungry)
						maxTimeRequired = 30*20;
					
					if(nt instanceof NTUnstable)
						maxTimeRequired = 7*60*20;
					
					if(nt instanceof NTTaint)
						maxTimeRequired = 3*60*20;
					
					if(nt instanceof NTAstral)
						maxTimeRequired = 60*20;
					
					if(workTime >= maxTimeRequired)
					{
						workTime = 0;
						
						if(nt instanceof NTDark || nt instanceof NTUnstable || nt instanceof NTHungry || nt instanceof NTTaint || nt instanceof NTAstral)
							node.setNodeType(0);
					}else
						++workTime;
					
					break;
				}
				
				case TAINT:
				{
					if(nt instanceof NTNormal)
					{
						if(workTime > 6*60*20)
						{
							workTime = 0;
							node.setNodeType(4);
						}else
							++workTime;
					}
					break;
				}
			
				case NONE:
				default:
					break;
			}
			
			if(!firstTick && this.worldObj.isRemote && ee != EnumEffect.NONE)
				beam = Thaumcraft.proxy.getFX().beamBore(node.posX, node.posY, node.posZ, pos.getX()+0.5D, pos.getY()+0.5D, pos.getZ()+0.5D, 2, ee.getColor(), true, 0.5F, beam, 1);
		
		}
		
		if(firstTick)
			firstTick = false;
	}
	
    public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newSate)
    {
    	return oldState.getBlock() == newSate.getBlock() ? false : super.shouldRefresh(world, pos, oldState, newSate);
    }
	
    public enum EnumEffect
    {
    	NONE, //Do nothing
    	BRIGHTEN, //Turn into etherial
    	DESTRUCT, //Destroy aspects and node, but create tons of aspect orbs
    	EFFICIENCY, //Recharge aura with current aspect faster
    	HUNGER, //Turn into Hungry
    	INSTABILITY, //Turn into unstable
    	PURITY, //Turn into pure
    	SINISTER, //Turn into sinister
    	SPEED, //+4 additional ticks each tick
    	STABILITY, //Turn onto normal
    	TAINT; //Turn into tainted
    	
    	public static EnumEffect fromMetadata(int meta)
    	{
    		return EnumEffect.values()[Math.min(EnumEffect.values().length-1, meta)];
    	}
    	
    	public int getColor()
    	{
    		return colors[ordinal()];
    	}
    	
    	private static final int[] colors = new int[]{
    		0xffffff,
    		0xffffff,
    		0x4e4756,
    		0xd2d200,
    		0xaf7c23,
    		0x0b4d42,
    		0xccc8f7,
    		0x643c5b,
    		0xeaeaea,
    		0xd0e0f8,
    		0x713496
    	};
    }
} public class TileOverchanter extends TileEntity implements IInventory, IWandable,ITickable{

	public ItemStack inventory;
	
	public int enchantingTime;
	public boolean xpAbsorbed;
	public boolean isEnchantingStarted;
	public int syncTimer;
	int ticksExisted;
	
	public Lightning renderedLightning;
	
	@Override
	public int getSizeInventory() {
		return 1;
	}
	
	public void update() 
	{
		++ticksExisted;
		if(syncTimer <= 0)
		{
			syncTimer = 100;
			NBTTagCompound tg = new NBTTagCompound();
			tg.setInteger("0", enchantingTime);
			tg.setBoolean("1", xpAbsorbed);
			tg.setBoolean("2", isEnchantingStarted);
			tg.setInteger("x", this.pos.getX());
			tg.setInteger("y", this.pos.getY());
			tg.setInteger("z", this.pos.getZ());
			MiscUtils.syncTileEntity(tg, 0);
		}else
			--syncTimer;
		
		if(this.inventory == null)
		{
			isEnchantingStarted = false;
			xpAbsorbed = false;
			enchantingTime = 0;
			renderedLightning = null;
		}else
        {
        	if(this.isEnchantingStarted)
        	{
        		if(ticksExisted % 20 == 0)
        		{
        			renderedLightning = new Lightning(this.worldObj.rand, new Coord3D(0,0,0), new Coord3D(MathUtils.randomDouble(this.worldObj.rand)/50,MathUtils.randomDouble(this.worldObj.rand)/50,MathUtils.randomDouble(this.worldObj.rand)/50), 0.3F, 1,0,1);
        			this.worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "thaumcraft:infuserstart", 1F, 1.0F);
	        		if(EssentiaHandler.drainEssentia(this, Aspect.ENERGY, null, 8, false, 8))
	        		{
	        			++enchantingTime;
	        			if(enchantingTime >= 16 && !this.xpAbsorbed)
	        			{
	        				List<EntityPlayer> players = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.fromBounds(pos.getX(), pos.getY(), pos.getZ(), pos.getX()+1, pos.getY()+1, pos.getZ()+1).expand(6, 3, 6));
	        				if(!players.isEmpty())
	        				{
	        					for(int i = 0; i < players.size(); ++i)
	        					{
	        						EntityPlayer p = players.get(i);
	        						if(p.experienceLevel >= 30)
	        						{
	        							p.attackEntityFrom(DamageSource.magic, 8);
	        							this.worldObj.playSoundEffect(p.posX,p.posY,p.posZ, "thaumcraft:zap", 1F, 1.0F);
	        							p.experienceLevel -= 30;
	        							xpAbsorbed = true;
	        							break;
	        						}
	        					}
	        				}
	        			}
	        			
	        			if(xpAbsorbed && enchantingTime >= 32)
	        			{
	        				int enchId = this.findEnchantment(inventory);
	        				NBTTagList nbttaglist = this.inventory.getEnchantmentTagList();
	        				for(int i = 0; i < nbttaglist.tagCount(); ++i)
	        				{
	        					NBTTagCompound tag = nbttaglist.getCompoundTagAt(i);
	        					if(tag != null && Integer.valueOf(tag.getShort("id"))==enchId)
	        					{
	        						tag.setShort("lvl", (short) (Integer.valueOf(tag.getShort("lvl"))+1));
	        						NBTTagCompound stackTag = MiscUtils.getStackTag(inventory);
	        						if(!stackTag.hasKey("overchants"))
	        						{
	        							stackTag.setIntArray("overchants", new int[]{enchId});
	        						}else
	        						{
	        							int[] arrayInt = stackTag.getIntArray("overchants");
	        							int[] newArrayInt = new int[arrayInt.length+1];
	        							for(int j = 0; j < arrayInt.length; ++j)
	        							{
	        								newArrayInt[j] = arrayInt[j];
	        							}
	        							newArrayInt[newArrayInt.length-1]=enchId;
	        							
	        							stackTag.setIntArray("overchants", newArrayInt);
	        						}
	        						break;
	        					}
	        				}
	        				isEnchantingStarted = false;
	        				xpAbsorbed = false;
	        				enchantingTime = 0;
	        				renderedLightning = null;
	        				this.worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "thaumcraft:wand", 1F, 1F);
	        			}
	        			
	        		}else
	        		{
	        			--enchantingTime;
	        		}
        		}
        	}
        }
	}
	
	public boolean canStartEnchanting()
	{
		if(!this.isEnchantingStarted)
			if(this.inventory != null)
			{
				if(this.inventory.getEnchantmentTagList() != null && this.inventory.getEnchantmentTagList().tagCount() > 0)
				{
					if(findEnchantment(inventory) != -1)
					{
						return true;
					}
				}
			}
		return false;
	}
	
	public int findEnchantment(ItemStack enchanted)
	{
		NBTTagCompound stackTag = MiscUtils.getStackTag(inventory);
		LinkedHashMap<Integer,Integer> ench = (LinkedHashMap<Integer, Integer>) EnchantmentHelper.getEnchantments(enchanted);
		Set<Integer> keys = ench.keySet();
		Iterator<Integer> $i = keys.iterator();
		
		while($i.hasNext())
		{
			int i = $i.next();
			if(!stackTag.hasKey("overchants"))
			{
				return i;
			}
			int[] overchants = stackTag.getIntArray("overchants");
			if(MathUtils.arrayContains(overchants, i))
				continue;
			
			return i;
		}
		
		return -1;
	}
	
    public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
    {
    	enchantingTime = pkt.getNbtCompound().getInteger("0");
    	xpAbsorbed = pkt.getNbtCompound().getBoolean("1");
    	isEnchantingStarted = pkt.getNbtCompound().getBoolean("2");
    }

	@Override
	public ItemStack getStackInSlot(int slot) {
		return inventory;
	}

	@Override
	public ItemStack decrStackSize(int slot, int num) {
        if (this.inventory != null)
        {
            ItemStack itemstack;

            if (this.inventory.stackSize <= num)
            {
                itemstack = this.inventory;
                this.inventory = null;
                this.markDirty();
                return itemstack;
            }
			itemstack = this.inventory.splitStack(num);

			if (this.inventory.stackSize == 0)
			{
			    this.inventory = null;
			}

			this.markDirty();
			return itemstack;
        }
		return null;
	}

	@Override
	public void setInventorySlotContents(int slot, ItemStack stk) {
		inventory = stk;
	}

	@Override
	public int getInventoryStackLimit() {
		return 1;
	}

	@Override
	public boolean isUseableByPlayer(EntityPlayer player) {
		return player.dimension == this.worldObj.provider.getDimensionId() && !this.worldObj.isAirBlock(pos);
	}

	@Override
	public boolean isItemValidForSlot(int slot, ItemStack stk) {
		return stk.hasTagCompound() && stk.getEnchantmentTagList() != null;
	}
	
    public void readFromNBT(NBTTagCompound tag)
    {
        super.readFromNBT(tag);
        
        enchantingTime = tag.getInteger("enchTime");
        xpAbsorbed = tag.getBoolean("xpAbsorbed");
        isEnchantingStarted = tag.getBoolean("enchStarted");
        
        if(tag.hasKey("itm"))
        	inventory = ItemStack.loadItemStackFromNBT(tag.getCompoundTag("itm"));
    }
    
    public void writeToNBT(NBTTagCompound tag)
    {
        super.writeToNBT(tag);
        
        tag.setInteger("enchTime", enchantingTime);
        tag.setBoolean("xpAbsorbed",xpAbsorbed);
        tag.setBoolean("enchStarted", isEnchantingStarted);
        
        if(inventory != null)
        {
        	NBTTagCompound t = new NBTTagCompound();
        	inventory.writeToNBT(t);
        	tag.setTag("itm", t);
        }
    }
    

	@Override
	public boolean onWandRightClick(World paramWorld, ItemStack paramItemStack, EntityPlayer paramEntityPlayer, BlockPos paramBlockPos, EnumFacing paramEnumFacing)
	{
		if(canStartEnchanting())
		{
			isEnchantingStarted = true;
			paramEntityPlayer.swingItem();
			syncTimer = 0;
			this.worldObj.playSoundEffect(pos.getX(), pos.getY(), pos.getZ(), "thaumcraft:craftstart", 0.5F, 1.0F);
			return true;
		}
		return false;
	}

	@Override
	public void onUsingWandTick(ItemStack wandstack, EntityPlayer player,
			int count) {
	}

	@Override
	public void onWandStoppedUsing(ItemStack wandstack, World world,
			EntityPlayer player, int count) {
	}

	@Override
	public String getName() {
		return "tb.overchanter";
	}

	@Override
	public boolean hasCustomName() {
		return false;
	}

	@Override
	public IChatComponent getDisplayName() {
		return new ChatComponentText(getName());
	}

	@Override
	public void openInventory(EntityPlayer player) {
		
	}

	@Override
	public void closeInventory(EntityPlayer player) {
		
	}

	@Override
	public int getField(int id) {
		return 0;
	}

	@Override
	public void setField(int id, int value) {
		
	}

	@Override
	public int getFieldCount() {
		return 0;
	}

	@Override
	public void clear() {
		inventory = null;
	}

	@Override
	public ItemStack removeStackFromSlot(int index) {
		return inventory;
	}


} public class TBBlocks {
	
	public static void setup()
	{
		BlocksRegistry.registerBlock(crystalBlock,"crystalBlock",core, ItemBlockCrystal.class);
		OreDictionary.registerOre("blockCrystalCluster", new ItemStack(crystalBlock,1,OreDictionary.WILDCARD_VALUE));
		BlocksRegistry.registerBlock(genLogs, "genLogs",core,ItemBlockTBLogs.class);
		OreDictionary.registerOre("logWood", new ItemStack(genLogs,1,OreDictionary.WILDCARD_VALUE));
		BlocksRegistry.registerBlock(genLeaves, "genLeaves",core,ItemBlockTBLeaves.class);
		BlocksRegistry.registerBlock(sapling, "goldenOakSapling",core,ItemBlockTBSapling.class);
		OreDictionary.registerOre("treeSapling", sapling);
		BlocksRegistry.registerBlock(planks, "planks",core,ItemBlockTBPlanks.class);
		OreDictionary.registerOre("plankWood", new ItemStack(planks,1,OreDictionary.WILDCARD_VALUE));
		
		BlocksRegistry.registerBlock(quicksilverBlock, "quicksilverBlock",core,ItemBlock.class);
		OreDictionary.registerOre("blockQuicksilver", quicksilverBlock);
		BlocksRegistry.registerBlock(quicksilverBrick, "quicksilverBrick",core,ItemBlock.class);
		OreDictionary.registerOre("blockQuicksilver", quicksilverBrick);
		BlocksRegistry.registerBlock(dustBlock, "blockSalisMundus",core,ItemBlock.class);
		OreDictionary.registerOre("blockSalisMundus", dustBlock);
		BlocksRegistry.registerBlock(thauminiteBlock, "thauminiteBlock",core,ItemBlock.class);
		OreDictionary.registerOre("blockThauminite", thauminiteBlock);
		BlocksRegistry.registerBlock(eldritchArk, "eldritchArk",core,ItemBlock.class);
		BlocksRegistry.registerBlock(ironGreatwood, "ironGreatwood",core,ItemBlock.class);
		
		BlocksRegistry.registerBlock(oldCobble, "oldCobble",core,ItemBlock.class);
		oldCobble.setHarvestLevel("pickaxe", 0);
		OreDictionary.registerOre("cobblestone", oldCobble);
		BlocksRegistry.registerBlock(oldCobbleMossy, "oldCobbleMossy",core,ItemBlock.class);
		oldCobbleMossy.setHarvestLevel("pickaxe", 0);
		OreDictionary.registerOre("cobblestone", oldCobbleMossy);
		OreDictionary.registerOre("mossyCobblestone", oldCobbleMossy);
		BlocksRegistry.registerBlock(oldGravel, "oldGravel",core,ItemBlock.class);
		oldGravel.setHarvestLevel("shovel", 0);
		OreDictionary.registerOre("gravel", oldGravel);
		BlocksRegistry.registerBlock(oldBrick, "oldBrick",core,ItemBlock.class);
		oldBrick.setHarvestLevel("pickaxe", 0);
		OreDictionary.registerOre("brick", oldBrick);
		BlocksRegistry.registerBlock(oldLapis, "oldLapis",core,ItemBlock.class);
		oldLapis.setHarvestLevel("pickaxe", 0);
		OreDictionary.registerOre("blockLapis", oldLapis);
		BlocksRegistry.registerBlock(oldIron, "oldIron",core,ItemBlock.class);
		oldIron.setHarvestLevel("pickaxe", 0);
		OreDictionary.registerOre("blockIron", oldIron);
		BlocksRegistry.registerBlock(oldGold, "oldGold",core,ItemBlock.class);
		oldGold.setHarvestLevel("pickaxe", 0);
		OreDictionary.registerOre("blockGold", oldGold);
		BlocksRegistry.registerBlock(oldDiamond, "oldDiamond",core,ItemBlock.class);
		oldDiamond.setHarvestLevel("pickaxe", 0);
		OreDictionary.registerOre("blockDiamond", oldDiamond);
		
		BlocksRegistry.registerBlock(plax, "plax",core,ItemBlock.class);
		BlocksRegistry.registerBlock(aureliaPetal, "aureliaPetal",core,ItemBlock.class);
		BlocksRegistry.registerBlock(aurelia, "aurelia",core,ItemBlock.class);
		BlocksRegistry.registerBlock(metalleat, "metalleat",core,ItemBlock.class);
		BlocksRegistry.registerBlock(lucrite, "lucrite",core,ItemBlock.class);
		BlocksRegistry.registerBlock(knose, "knose",core,ItemBlock.class);
		BlocksRegistry.registerBlock(sweed, "sweed",core,ItemBlock.class);
		BlocksRegistry.registerBlock(lazullia, "lazullia",core,ItemBlock.class);
		BlocksRegistry.registerBlock(ashroom, "ashroom",core,ItemBlock.class);
		BlocksRegistry.registerBlock(flaxium, "flaxium",core,ItemBlock.class);
		BlocksRegistry.registerBlock(glieonia, "glieonia",core,ItemBlock.class);
		BlocksRegistry.registerBlock(briar, "briar",core,ItemBlock.class);
		BlocksRegistry.registerBlock(tobacco, "tobacco",core,ItemBlock.class);
		BlocksRegistry.registerBlock(voidPlant, "voidPlant",core,ItemBlock.class);
		BlocksRegistry.registerBlock(rainbowCactus, "rainbowCactus",core,ItemBlock.class);
		BlocksRegistry.registerBlock(redlonStem, "redlonStem",core,ItemBlock.class);
		
		BlocksRegistry.registerBlock(spike, "spike",core,ItemBlockSpike.class);
		BlocksRegistry.registerBlock(cryingObsidian, "cryingObsidian",core,ItemBlock.class);
		BlocksRegistry.registerBlock(pyrofluid,"pyrofluid",core, ItemBlockPyrofluid.class);
		BlocksRegistry.registerBlock(thaumicAnvil, "thaumicAnvil",core,ItemAnvilBlock.class);
		BlocksRegistry.registerBlock(voidAnvil, "voidAnvil",core,ItemAnvilBlock.class);
		
		BlocksRegistry.registerBlock(crystalSlab, "crystalSlab",core,ItemBlockCrystalSlab.class);
		BlocksRegistry.registerBlock(crystalSlab_full, "crystalSlab_full",core,ItemBlockCrystalSlab.class);
		BlocksRegistry.registerBlock(genericSlab, "genericSlab",core,ItemBlockHalfSlab.class);
		BlocksRegistry.registerBlock(genericSlab_full, "genericSlab_full",core,ItemBlockHalfSlab.class);
		BlocksRegistry.registerBlock(woodSlab, "woodSlab",core,ItemBlockWoodSlab.class);
		BlocksRegistry.registerBlock(woodSlab_full, "woodSlab_full",core,ItemBlockWoodSlab.class);
		
		BlocksRegistry.registerBlock(overchanter, "overchanter",core,ItemBlock.class);
		BlocksRegistry.registerBlock(campfire, "campfire",core,ItemBlock.class);
		BlocksRegistry.registerBlock(braizer, "brazier",core,ItemBlock.class);
		BlocksRegistry.registerBlock(auraLinker, "auraLinker",core,ItemBlock.class);
		BlocksRegistry.registerBlock(nodeManipulator, "nodeManipulator",core,ItemBlock.class);
		
		Blocks.fire.setFireInfo(genLogs, 5, 5);
		Blocks.fire.setFireInfo(genLeaves, 30, 60);
		Blocks.fire.setFireInfo(planks, 5, 20);
	}
	
	public static Block quicksilverBlock = new TBBlock(Material.rock,false).setBlockTextureName("thaumicbases:quicksilverBlock").stabilise().setUnlocalizedName("quicksilverBlock").setHardness(0.5F);
	public static Block quicksilverBrick = new TBBlock(Material.rock,true).setBlockTextureName("thaumicbases:quicksilverBrick").stabilise().setUnlocalizedName("quicksilverBrick").setHardness(0.5F);
	public static Block dustBlock = new TBBlock(Material.sand,false).setBlockTextureName("thaumicbases:dust_block").stabilise().setStepSound(Block.soundTypeSand).setUnlocalizedName("salisMundusBlock").setHardness(1);
	public static Block thauminiteBlock = new TBBlock(Material.iron,false).setBlockTextureName("thaumicbases:thauminiteblock").stabilise().setUnlocalizedName("thauminiteBlock").setHardness(2F);
	public static Block eldritchArk = new TBBlock(Material.rock,false).setBlockTextureName("thaumicbases:eldritchArk").setUnlocalizedName("eldritchArk").setHardness(3F);
	public static Block ironGreatwood = new TBBlock(Material.wood,false).setBlockTextureName("thaumicbases:ironGreatwood").setUnlocalizedName("ironGreatwood").setHardness(1F).setStepSound(Block.soundTypeWood);
	
	public static Block oldCobble = new TBBlock(Material.rock,false).setBlockName("TBoldCobblestone").setBlockTextureName("thaumicbases:cobblestone").setHardness(1).setResistance(1);
	public static Block oldCobbleMossy = new TBBlock(Material.rock,false).setBlockName("TBoldCobblestoneMossy").setBlockTextureName("thaumicbases:cobblestone_mossy").setHardness(1).setResistance(1);
	public static Block oldGravel = new TBBlock(Material.sand, false).setBlockName("TBoldGravel").setBlockTextureName("thaumicbases:gravel").setHardness(0.6F).setResistance(0).setStepSound(Block.soundTypeGravel);
	public static Block oldBrick = new TBBlock(Material.rock,false).setBlockName("TBoldBricks").setBlockTextureName("thaumicbases:brick").setHardness(1).setResistance(1);
	public static Block oldLapis = new TBBlock(Material.rock,false).setBlockName("TBoldLapis").setBlockTextureName("thaumicbases:lapis_block").setHardness(1).setResistance(1);
	public static Block oldIron = new TBSidedBlock(Material.rock,false).setBlockName("TBoldIron").setBlockTextureName("thaumicbases:iron_block").setHardness(1).setResistance(1);
	public static Block oldGold = new TBSidedBlock(Material.rock,false).setBlockName("TBoldGold").setBlockTextureName("thaumicbases:gold_block").setHardness(1).setResistance(1);
	public static Block oldDiamond = new TBSidedBlock(Material.rock,false).setBlockName("TBoldDiamond").setBlockTextureName("thaumicbases:diamond_block").setHardness(1).setResistance(1);
	
	
	public static Block crystalBlock = new BlockCrystalBlock().setUnlocalizedName("crystalBlock");
	public static Block genLogs = new BlockTBLog();
	public static Block genLeaves = new BlockTBLeaves();
	public static Block sapling = new BlockTBSapling();
	public static Block planks = new BlockTBPlanks().setUnlocalizedName("tb.planks");
	
	public static Block ashroom = new BlockAshroom(4,8,false).setBlockName("ashroom").setBlockTextureName("thaumicbases:aspectshroom/");
	public static Block plax = new BlockTBPlant(8,4,true).setBlockName("plax").setBlockTextureName("thaumicbases:plax/");
	public static Block aureliaPetal = new BlockAureliaLeaf().setBlockName("aureliaPetal").setBlockTextureName("thaumicbases:aurelia/petal").setHardness(0).setStepSound(Block.soundTypeGrass);
	public static Block aurelia = new BlockAureliaPlant().setBlockName("aurelia").setBlockTextureName("thaumicbases:aurelia/").setHardness(0).setStepSound(Block.soundTypeGrass);
	public static Block metalleat = new BlockTBPlant(8,8,true).setBlockName("metalleat").setBlockTextureName("thaumicbases:metalleat/");
	public static Block lucrite = new BlockLucritePlant(8,16,true).setBlockName("lucrite").setBlockTextureName("thaumicbases:lucrite/");
	public static Block knose = new BlockKnose(4,16,false).setBlockName("knose").setBlockTextureName("thaumicbases:knoze/");
	public static Block sweed = new BlockSweed(4,4,false).setBlockName("sweed").setBlockTextureName("thaumicbases:sweed/");
	public static Block lazullia = new BlockTBPlant(8,16,true).setBlockName("lazullia").setBlockTextureName("thaumicbases:lazullia/");
	public static Block flaxium = new BlockFlaxium().setBlockName("flaxium").setBlockTextureName("thaumicbases:flaxium").setStepSound(Block.soundTypeGrass);
	public static Block glieonia = new BlockTBPlant(4,12,false).setBlockName("glieonia").setBlockTextureName("thaumicbases:glieonia/");
	public static Block briar = new BlockBriar(8,4).setBlockName("briar").setBlockTextureName("thaumicbases:briar/").setStepSound(Block.soundTypeGrass);
	public static Block tobacco = new BlockTBPlant(8,16,true).setBlockName("tobacco").setBlockTextureName("thaumicbases:tobacco/");
	public static Block voidPlant = new BlockTBPlant(4,32,true).setBlockName("voidPlant").setBlockTextureName("thaumicbases:voidPlant/");
	public static Block rainbowCactus = new BlockRainbowCactus().setBlockName("rainbowCactus").setBlockTextureName("thaumicbases:rainbowCacti/").setStepSound(Block.soundTypeCloth).setHardness(0.5F);
	public static Block redlonStem = new BlockRedlonStem(Blocks.redstone_block).setBlockName("redlonStem").setBlockTextureName("thaumicbases:redlon/redlon").setStepSound(Block.soundTypeGrass);
	
	public static Block spike = new BlockSpike().setUnlocalizedName("spike").setHardness(3).setResistance(3).setStepSound(Block.soundTypeMetal);
	public static Block cryingObsidian = new BlockCryingObelisk().setBlockName("cryingObsidian").setBlockTextureName("thaumicbases:cryingObelisk/").setHardness(10).setResistance(10);
	public static Block pyrofluid = new BlockPyrofluid().setUnlocalizedName("pyrofluid").setLightLevel(1);
	public static Block thaumicAnvil = new BlockThaumicAnvil().setBlockName("thaumicAnvil").setBlockTextureName("thaumicbases:thaumiumAnvil/").setHardness(6).setResistance(16).setStepSound(Block.soundTypeAnvil);
	public static Block voidAnvil = new BlockVoidAnvil().setBlockName("voidAnvil").setBlockTextureName("thaumicbases:voidAnvil/");
	
	public static Block crystalSlab = new BlockCrystalSlab(false,Material.glass).setUnlocalizedName("tb.crystalslab.");
	public static Block crystalSlab_full = new BlockCrystalSlab(true,Material.glass).setUnlocalizedName("tb.crystalslab.");
	public static Block genericSlab = new BlockHalfSlab(false,Material.rock).setHardness(1).setResistance(10).setUnlocalizedName("tb.slab.");
	public static Block genericSlab_full = new BlockHalfSlab(true,Material.rock).setHardness(1).setResistance(10).setUnlocalizedName("tb.slab.");
	public static Block woodSlab = new BlockWoodSlab(false,Material.wood).setUnlocalizedName("tb.woodSlab.");
	public static Block woodSlab_full = new BlockWoodSlab(true,Material.wood).setUnlocalizedName("tb.woodSlab.");
	
	public static Block overchanter = new BlockOverchanter().setUnlocalizedName("overchanter").setHardness(5).setResistance(5);
	public static Block campfire = new BlockCampfire().setBlockTextureName("thaumicbases:campfire").setUnlocalizedName("tb.campfire").setLightLevel(1);
	public static Block braizer = new BlockBraizer().setUnlocalizedName("tb.brazier").setLightLevel(1);
	public static Block auraLinker = new BlockAuraLinker().setUnlocalizedName("nodeLinker").setHardness(1);
	public static Block nodeManipulator = new BlockNodeManipulator().setUnlocalizedName("nodeManipulator").setHardness(1);
	
	public static final Class<TBCore> core = TBCore.class;
} public class TBItems {
	
	public static void setup()
	{
		ItemRegistry.registerItem(resource, "resource",core);
		ItemRegistry.registerItem(spawnerCompass, "spawnerCompass",core);
		
		ItemRegistry.registerItem(tobacco, "tobaccoPowder",core);
		ItemRegistry.registerItem(greatwoodPipe, "greatwoodPipe",core);
		ItemRegistry.registerItem(silverwoodPipe, "silverwoodPipe",core);
		
		ItemRegistry.registerItem(bloodyChest, "bloodyChest",core);
		ItemRegistry.registerItem(bloodyLeggings, "bloodyLeggings",core);
		ItemRegistry.registerItem(bloodyBoots, "bloodyBoots",core);
		ItemRegistry.registerItem(knoseFragment, "knoseFragment",core);
		
		ItemRegistry.registerItem(castingBracelet, "castingBracelet",core);
		ItemRegistry.registerItem(herobrinesScythe, "herobrinesScythe",core);
		
		ItemRegistry.registerItem(nodeFoci, "nodeFoci",core);
		ItemRegistry.registerItem(voidShears, "voidShears",core);
		ItemRegistry.registerItem(voidFAS, "voidFAS",core);
		
		ItemRegistry.registerItem(thauminiteHelmet, "thauminiteHelmet",core);
		ItemRegistry.registerItem(thauminiteChest, "thauminiteChest",core);
		ItemRegistry.registerItem(thauminiteLeggings, "thauminiteLeggings",core);
		ItemRegistry.registerItem(thauminiteBoots, "thauminiteBoots",core);
		ItemRegistry.registerItem(pyroBucket, "pyroBucket",core);
		ItemRegistry.registerItem(plaxSeed, "plaxSeed",core);
		ItemRegistry.registerItem(metalleatSeeds, "metalleatSeeds",core);
		ItemRegistry.registerItem(lucriteSeeds, "lucriteSeeds",core);
		ItemRegistry.registerItem(knoseSeed, "knoseSeed",core);
		ItemRegistry.registerItem(sweedSeeds, "sweedSeeds",core);
		ItemRegistry.registerItem(lazulliaSeeds, "lazulliaSeeds",core);
		ItemRegistry.registerItem(redlonSeeds, "redlonSeeds",core);
		ItemRegistry.registerItem(glieoniaSeed, "glieoniaSeed",core);
		ItemRegistry.registerItem(rosehipSyrup, "rosehipSyrup",core);
		ItemRegistry.registerItem(tobaccoSeeds, "tobaccoSeeds",core);
		ItemRegistry.registerItem(mortar, "mortar",core);
		ItemRegistry.registerItem(voidSeed, "voidSeed",core);
		
		ItemRegistry.registerItem(thauminiteAxe, "thauminiteAxe",core);
		thauminiteAxe.setHarvestLevel("axe", 3);
		ItemRegistry.registerItem(thauminiteHoe, "thauminiteHoe",core);
		thauminiteHoe.setHarvestLevel("hoe", 3);
		ItemRegistry.registerItem(thauminitePickaxe, "thauminitePickaxe",core);
		thauminitePickaxe.setHarvestLevel("pickaxe", 3);
		ItemRegistry.registerItem(thauminiteShears, "thauminiteShears",core);
		thauminiteShears.setHarvestLevel("shears", 3);
		ItemRegistry.registerItem(thauminiteShovel, "thauminiteShovel",core);
		thauminiteShovel.setHarvestLevel("shovel", 3);
		ItemRegistry.registerItem(thauminiteSword, "thauminiteSword",core);
		thauminiteSword.setHarvestLevel("sword", 3);
		ItemRegistry.registerItem(revolver, "revolver",core);
		ItemRegistry.registerItem(ukulele, "ukulele",core);
		ItemRegistry.registerItem(shardCluster, "shardCluster",core);
		
		WAND_CAP_THAUMINITE = new WandCap("thauminite",0.85F,1,new ItemStack(resource,1,2),6,new ResourceLocation("thaumicbases","items/thauminite/wand_cap_thauminite_uv"));	
		WAND_ROD_THAUMIUM = new WandRod("tbthaumium", 450, new ItemStack(resource,1,3), 6, new WandRodPrimalOnUpdate(), new ResourceLocation("thaumicbases","items/wand_rod_thaumium_uv"));
		WAND_ROD_VOID = new WandRod("tbvoid", 750, new ItemStack(resource,1,4), 16, new WandRodPrimalOnUpdate(), new ResourceLocation("thaumicbases","items/wand_rod_void_uv"));

	}
	
	public static ToolMaterial thauminite = EnumHelper.addToolMaterial("THAUMINITE", 3, 974, 7F, 2.8F, 15);
	public static ArmorMaterial thauminiteA = EnumHelper.addArmorMaterial("ATHAUMINITE", "thaumicbases:textures/items/armor/thauminite/thauminite", 27, new int[]{3, 8, 6, 3}, 17);
	public static ArmorMaterial bloodyA = EnumHelper.addArmorMaterial("TBBLOODY", "thaumicbases:textures/items/armor/bloody/bloody" ,21, new int[]{2, 6, 5, 2}, 21);
	
	public static Item resource = new TBResource().setUnlocalizedName("resource");
	public static Item spawnerCompass = new ItemSpawnerCompass().setFull3D().setMaxStackSize(1).setMaxDamage(0).setUnlocalizedName("tb.spawnerCompass");
	
	public static Item tobacco = new TBTobacco().setUnlocalizedName("tobacco");
	public static Item greatwoodPipe = new ItemSmokingPipe(false).setTextureName("thaumicbases:smokingPipe").setUnlocalizedName("greatwoodPipe");
	public static Item silverwoodPipe = new ItemSmokingPipe(true).setTextureName("thaumicbases:smokingPipe_silverwood").setUnlocalizedName("silverwoodPipe");
	
	public static Item bloodyChest = new ItemBloodyArmor(bloodyA,1).setTextureName("thaumicbases:bloodyRobes/bloodychest").setUnlocalizedName("bloodyChest");
	public static Item bloodyLeggings = new ItemBloodyArmor(bloodyA,2).setTextureName("thaumicbases:bloodyRobes/bloodylegs").setUnlocalizedName("bloodyLegs");
	public static Item bloodyBoots = new ItemBloodyArmor(bloodyA,3).setTextureName("thaumicbases:bloodyRobes/bloodyboots").setUnlocalizedName("bloodyBoots");
	
	public static Item knoseFragment = new ItemKnoseFragment().setTextureName("thaumicbases:knose/").setUnlocalizedName("knoseFragment.");
	
	public static Item castingBracelet = new ItemCastingBracelet().setUnlocalizedName("tb.bracelet");
	public static Item herobrinesScythe = new ItemHerobrinesScythe().setTextureName("thaumicbases:herobrinesScythe").setUnlocalizedName("herobrinesScythe");
	
	public static Item thauminiteAxe = new ItemThauminiteAxe(thauminite).setTextureName("thaumicbases:thauminite/thauminiteaxe").setUnlocalizedName("thauminiteAxe");
	public static Item thauminiteHoe = new ItemThauminiteHoe(thauminite).setTextureName("thaumicbases:thauminite/thauminitehoe").setUnlocalizedName("thauminiteHoe");
	public static Item thauminitePickaxe = new ItemThauminitePickaxe(thauminite).setTextureName("thaumicbases:thauminite/thauminitepick").setUnlocalizedName("thauminitePickaxe");
	public static Item thauminiteShears = new ItemThauminiteShears().setTextureName("thaumicbases:thauminite/thauminiteshears").setUnlocalizedName("thauminiteShears").setFull3D().setMaxStackSize(1).setMaxDamage(974);
	public static Item thauminiteShovel = new ItemThauminiteShovel(thauminite).setTextureName("thaumicbases:thauminite/thauminiteshovel").setUnlocalizedName("thauminiteShovel");
	public static Item thauminiteSword = new ItemThauminiteSword(thauminite).setTextureName("thaumicbases:thauminite/thauminitesword").setUnlocalizedName("thauminiteSword");

	public static Item thauminiteHelmet = new ItemThauminiteArmor(thauminiteA,0).setTextureName("thaumicbases:thauminite/thauminitehelm").setUnlocalizedName("thauminiteHelmet");
	public static Item thauminiteChest = new ItemThauminiteArmor(thauminiteA,1).setTextureName("thaumicbases:thauminite/thauminitechest").setUnlocalizedName("thauminiteChest");
	public static Item thauminiteLeggings = new ItemThauminiteArmor(thauminiteA,2).setTextureName("thaumicbases:thauminite/thauminitelegs").setUnlocalizedName("thauminiteLegs");
	public static Item thauminiteBoots = new ItemThauminiteArmor(thauminiteA,3).setTextureName("thaumicbases:thauminite/thauminiteboots").setUnlocalizedName("thauminiteBoots");

	public static Item pyroBucket = new ItemPyrofluidBucket().setTextureName("thaumicbases:bucket_blazing_fluid").setUnlocalizedName("pyrofluidBucket");
	
	public static Item plaxSeed = new ItemSeeds(TBBlocks.plax, Blocks.farmland).setTextureName("thaumicbases:plax_seeds").setUnlocalizedName("plaxSeeds");
	public static Item metalleatSeeds = new ItemSeeds(TBBlocks.metalleat, Blocks.farmland).setTextureName("thaumicbases:metalleat_seeds").setUnlocalizedName("metalleatSeeds");
	public static Item lucriteSeeds = new ItemSeeds(TBBlocks.lucrite, Blocks.farmland).setTextureName("thaumicbases:lucrite_seeds").setUnlocalizedName("lucriteSeeds");
	public static Item knoseSeed = new ItemSeeds(TBBlocks.knose, TBBlocks.crystalBlock).setTextureName("thaumicbases:knose_seed").setUnlocalizedName("knoseSeed");
	public static Item sweedSeeds = new ItemSeeds(TBBlocks.sweed,Blocks.grass).setTextureName("thaumicbases:seeds_sweed").setUnlocalizedName("sweedSeeds");
	public static Item lazulliaSeeds = new ItemSeeds(TBBlocks.lazullia,Blocks.farmland).setTextureName("thaumicbases:lazullia_seeds").setUnlocalizedName("lazulliaSeeds");
	public static Item redlonSeeds = new ItemSeeds(TBBlocks.redlonStem,Blocks.farmland).setTextureName("thaumicbases:redlon_seed").setUnlocalizedName("redlonSeeds");
	public static Item glieoniaSeed = new ItemSeeds(TBBlocks.glieonia,Blocks.grass).setTextureName("thaumicbases:glieonia_seed").setUnlocalizedName("glieoniaSeed");
	public static Item rosehipSyrup = new ItemRosehipSyrup().setTextureName("thaumicbases:rosehip_syrup").setUnlocalizedName("rosehipSyrup").setMaxStackSize(16);
	public static Item tobaccoSeeds = new ItemSeeds(TBBlocks.tobacco,Blocks.farmland).setTextureName("thaumicbases:tobacco_seeds").setUnlocalizedName("tobaccoSeeds");
	public static Item mortar = new ItemMortarAndPestle().setTextureName("thaumicbases:mortar").setUnlocalizedName("mortar");
	public static Item voidSeed = new ItemSeeds(TBBlocks.voidPlant,Blocks.farmland).setTextureName("thaumicbases:void_seed").setUnlocalizedName("voidSeed");
	
	public static Item nodeFoci = new ItemNodeFoci().setUnlocalizedName("nodeFoci.");
	public static Item voidShears = new ItemVoidShears().setTextureName("thaumicbases:shears").setUnlocalizedName("tb.voidShears").setFull3D().setMaxDamage(184).setFull3D().setMaxStackSize(1);
	public static Item voidFAS = new ItemVoidFlintAndSteel().setTextureName("thaumicbases:flint_and_steel").setUnlocalizedName("tb.voidFAS").setFull3D().setMaxDamage(184).setFull3D().setMaxStackSize(1);
	public static Item revolver = new ItemRevolver().setMaxDamage(1561).setMaxStackSize(1).setFull3D().setUnlocalizedName("tb.revolver");
	public static Item ukulele = new ItemUkulele().setFull3D().setMaxStackSize(1).setMaxDamage(0).setUnlocalizedName("tb.ukulele");
	public static Item shardCluster = new ItemShardCluster();
	
	public static WandCap WAND_CAP_THAUMINITE;
	
	public static WandRod WAND_ROD_THAUMIUM;
	public static WandRod WAND_ROD_VOID;
	
	
	public static final Class<TBCore> core = TBCore.class;
}
import java.lang.reflect.Field;
import DummyCore.Client.GuiCommon;
import DummyCore.Client.RenderAccessLibrary;
import DummyCore.Utils.ASMManager;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.MovingSound;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.client.FMLClientHandler;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import tb.client.RevolverEvents;
import tb.client.gui.GuiRevolver;
import tb.client.gui.GuiThaumicAnvil;
import tb.client.gui.GuiVoidAnvil;
import tb.client.render.block.BraizerRenderer;
import tb.client.render.block.CampfireRenderer;
import tb.client.render.entity.RenderAspectOrb;
import tb.client.render.entity.RenderBullet;
import tb.client.render.item.AuraLinkerItemRenderer;
import tb.client.render.item.CastingBraceletRenderer;
import tb.client.render.item.HerobrinesScytheMH;
import tb.client.render.item.NodeFociRenderer;
import tb.client.render.item.NodeManipulatorItemRenderer;
import tb.client.render.item.RenderRevolver;
import tb.client.render.item.SpawnerCompassRenderer;
import tb.client.render.item.UkuleleRenderer;
import tb.client.render.tile.RenderAuraLinker;
import tb.client.render.tile.RenderNodeManipulator;
import tb.client.render.tile.RenderOverchanter;
import tb.common.entity.EntityAspectOrb;
import tb.common.entity.EntityRevolverBullet;
import tb.common.event.TBEventHandler;
import tb.common.inventory.ContainerOverchanter;
import tb.common.item.ItemUkulele;
import tb.common.tile.TileAuraLinker;
import tb.common.tile.TileNodeManipulator;
import tb.common.tile.TileOverchanter;
import tb.init.TBBlocks;
import tb.init.TBItems;
import thaumcraft.client.fx.ParticleEngine;
import thaumcraft.client.fx.beams.FXArc;
import thaumcraft.client.fx.particles.FXSparkle;
package tb.network.proxy;



public class TBClient extends TBServer {
	
	public static class GuitarSound extends MovingSound
	{
		public int notUsingTicks = 0;
		protected GuitarSound(ResourceLocation snd) 
		{
			super(snd);
		}
		
		@Override
		public void update() 
		{
			if(Minecraft.getMinecraft().thePlayer == null || !Minecraft.getMinecraft().thePlayer.isUsingItem() || Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem() == null || Minecraft.getMinecraft().thePlayer.isDead || Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() == null || !(Minecraft.getMinecraft().thePlayer.getCurrentEquippedItem().getItem() instanceof ItemUkulele))
			{
				++notUsingTicks;
				if(notUsingTicks >= 8)
				{
					TBEventHandler.clientUkuleleSoundPlayDelay = 0;
					this.donePlaying = true;
					notUsingTicks = 0;
				}
			}
			else
			{
				notUsingTicks = 0;
				this.xPosF = (float) Minecraft.getMinecraft().thePlayer.posX;
				this.yPosF = (float) Minecraft.getMinecraft().thePlayer.posY;
				this.zPosF = (float) Minecraft.getMinecraft().thePlayer.posZ;
			}
		}
		
	}
	
	public void playGuitarSound(String sound)
	{
		MovingSound snd = new GuitarSound(new ResourceLocation(sound)); 
		Minecraft.getMinecraft().getSoundHandler().playSound(snd);
	}
	
	@Override
	public Object getClientGuiElement(int ID, EntityPlayer player, World world,	int x, int y, int z) {
		if(ID == 0x421922)
		{
			TileEntity tile = world.getTileEntity(new BlockPos(x, y, z));
			
			if(tile != null)
			{
				if(tile instanceof TileOverchanter)
				{
					return new GuiCommon(new ContainerOverchanter(player.inventory,tile), tile);
				}
			}
		}else
		{
			if(ID == 0x421921)
				return new GuiThaumicAnvil(player.inventory, world, x, y, z);
			
			if(ID == 0x421920)
				return new GuiVoidAnvil(player.inventory, world, x, y, z);
			
			if(ID == 0x421919)
				return new GuiRevolver(player.inventory, world, x, y, z);
		}
		
		return null;
	}
	
	@SuppressWarnings({ "unchecked", "deprecation" })
	@Override
	public void registerRenderInformation()
	{
		ClientRegistry.bindTileEntitySpecialRenderer(TileOverchanter.class, new RenderOverchanter());
		ClientRegistry.bindTileEntitySpecialRenderer(TileAuraLinker.class, new RenderAuraLinker());
		ClientRegistry.bindTileEntitySpecialRenderer(TileNodeManipulator.class, new RenderNodeManipulator());
		MinecraftForge.EVENT_BUS.register(new RevolverEvents());
		
		RenderAccessLibrary.registerItemRenderingHandler(TBItems.ukulele, new UkuleleRenderer());
		RenderAccessLibrary.registerItemRenderingHandler(TBItems.revolver, new RenderRevolver());
		RenderAccessLibrary.registerItemRenderingHandler(Item.getItemFromBlock(TBBlocks.nodeManipulator), new NodeManipulatorItemRenderer());
		RenderAccessLibrary.registerItemRenderingHandler(Item.getItemFromBlock(TBBlocks.auraLinker), new AuraLinkerItemRenderer());
		RenderAccessLibrary.registerRenderingHandler(new BraizerRenderer());
		RenderAccessLibrary.registerRenderingHandler(new CampfireRenderer());
		RenderAccessLibrary.registerItemRenderingHandler(TBItems.nodeFoci, new NodeFociRenderer());