Jump to content

GUI Immediately Closes


DuhEggroll

Recommended Posts

I've been trying to create a block with minecraft forge and I'm making a new custom enchantment table. I created the block but I'm having trouble with the GUI. It works but when I right click on the block, the GUI immediately closes.

Here's my code:

GuiBE

 

 

package duheggroll.archer.common;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import java.util.Random;

 

import net.minecraft.client.gui.FontRenderer;

import net.minecraft.client.gui.ScaledResolution;

import net.minecraft.client.gui.inventory.GuiContainer;

import net.minecraft.client.model.ModelBook;

import net.minecraft.client.renderer.RenderHelper;

import net.minecraft.entity.Entity;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.inventory.ContainerEnchantment;

import net.minecraft.item.ItemStack;

import net.minecraft.util.EnchantmentNameParts;

import net.minecraft.util.MathHelper;

import net.minecraft.util.StatCollector;

import net.minecraft.world.World;

import org.lwjgl.opengl.GL11;

import org.lwjgl.opengl.GL12;

import org.lwjgl.util.glu.GLU;

 

@SideOnly(Side.CLIENT)

public class GuiBE extends GuiContainer

{

    /** The book model used on the GUI. */

    private static ModelBook bookModel = new ModelBook();

    private Random rand = new Random();

 

    /** ContainerEnchantment object associated with this gui */

    private ContainerEnchantment containerEnchantment;

    public int field_74214_o;

    public float field_74213_p;

    public float field_74212_q;

    public float field_74211_r;

    public float field_74210_s;

    public float field_74209_t;

    public float field_74208_u;

    ItemStack theItemStack;

 

    public GuiBE(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)

    {

        super(new ContainerEnchantment(par1InventoryPlayer, par2World, par3, par4, par5));

        this.containerEnchantment = (ContainerEnchantment)this.inventorySlots;

    }

 

    /**

    * Draw the foreground layer for the GuiContainer (everything in front of the items)

    */

    protected void drawGuiContainerForegroundLayer(int par1, int par2)

    {

        this.fontRenderer.drawString(StatCollector.translateToLocal("container.enchant"), 12, 6, 4210752);

        this.fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, 4210752);

    }

 

    /**

    * Called from the main game loop to update the screen.

    */

    public void updateScreen()

    {

        super.updateScreen();

        this.func_74205_h();

    }

 

    /**

    * Called when the mouse is clicked.

    */

    protected void mouseClicked(int par1, int par2, int par3)

    {

        super.mouseClicked(par1, par2, par3);

        int var4 = (this.width - this.xSize) / 2;

        int var5 = (this.height - this.ySize) / 2;

 

        for (int var6 = 0; var6 < 3; ++var6)

        {

            int var7 = par1 - (var4 + 60);

            int var8 = par2 - (var5 + 14 + 19 * var6);

 

            if (var7 >= 0 && var8 >= 0 && var7 < 108 && var8 < 19 && this.containerEnchantment.enchantItem(this.mc.thePlayer, var6))

            {

                this.mc.playerController.sendEnchantPacket(this.containerEnchantment.windowId, var6);

            }

        }

    }

 

    /**

    * Draw the background layer for the GuiContainer (everything behind the items)

    */

    protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3)

    {

        int var4 = this.mc.renderEngine.getTexture("/gui/enchant.png");

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        this.mc.renderEngine.bindTexture(var4);

        int var5 = (this.width - this.xSize) / 2;

        int var6 = (this.height - this.ySize) / 2;

        this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);

        GL11.glPushMatrix();

        GL11.glMatrixMode(GL11.GL_PROJECTION);

        GL11.glPushMatrix();

        GL11.glLoadIdentity();

        ScaledResolution var7 = new ScaledResolution(this.mc.gameSettings, this.mc.displayWidth, this.mc.displayHeight);

        GL11.glViewport((var7.getScaledWidth() - 320) / 2 * var7.getScaleFactor(), (var7.getScaledHeight() - 240) / 2 * var7.getScaleFactor(), 320 * var7.getScaleFactor(), 240 * var7.getScaleFactor());

        GL11.glTranslatef(-0.34F, 0.23F, 0.0F);

        GLU.gluPerspective(90.0F, 1.3333334F, 9.0F, 80.0F);

        float var8 = 1.0F;

        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        GL11.glLoadIdentity();

        RenderHelper.enableStandardItemLighting();

        GL11.glTranslatef(0.0F, 3.3F, -16.0F);

        GL11.glScalef(var8, var8, var8);

        float var9 = 5.0F;

        GL11.glScalef(var9, var9, var9);

        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);

        this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture("/item/book.png"));

        GL11.glRotatef(20.0F, 1.0F, 0.0F, 0.0F);

        float var10 = this.field_74208_u + (this.field_74209_t - this.field_74208_u) * par1;

        GL11.glTranslatef((1.0F - var10) * 0.2F, (1.0F - var10) * 0.1F, (1.0F - var10) * 0.25F);

        GL11.glRotatef(-(1.0F - var10) * 90.0F - 90.0F, 0.0F, 1.0F, 0.0F);

        GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);

        float var11 = this.field_74212_q + (this.field_74213_p - this.field_74212_q) * par1 + 0.25F;

        float var12 = this.field_74212_q + (this.field_74213_p - this.field_74212_q) * par1 + 0.75F;

        var11 = (var11 - (float)MathHelper.truncateDoubleToInt((double)var11)) * 1.6F - 0.3F;

        var12 = (var12 - (float)MathHelper.truncateDoubleToInt((double)var12)) * 1.6F - 0.3F;

 

        if (var11 < 0.0F)

        {

            var11 = 0.0F;

        }

 

        if (var12 < 0.0F)

        {

            var12 = 0.0F;

        }

 

        if (var11 > 1.0F)

        {

            var11 = 1.0F;

        }

 

        if (var12 > 1.0F)

        {

            var12 = 1.0F;

        }

 

        GL11.glEnable(GL12.GL_RESCALE_NORMAL);

        bookModel.render((Entity)null, 0.0F, var11, var12, var10, 0.0F, 0.0625F);

        GL11.glDisable(GL12.GL_RESCALE_NORMAL);

        RenderHelper.disableStandardItemLighting();

        GL11.glMatrixMode(GL11.GL_PROJECTION);

        GL11.glViewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);

        GL11.glPopMatrix();

        GL11.glMatrixMode(GL11.GL_MODELVIEW);

        GL11.glPopMatrix();

        RenderHelper.disableStandardItemLighting();

        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

        this.mc.renderEngine.bindTexture(var4);

        EnchantmentNameParts.instance.setRandSeed(this.containerEnchantment.nameSeed);

 

        for (int var13 = 0; var13 < 3; ++var13)

        {

            String var14 = EnchantmentNameParts.instance.generateRandomEnchantName();

            this.zLevel = 0.0F;

            this.mc.renderEngine.bindTexture(var4);

            int var15 = this.containerEnchantment.enchantLevels[var13];

            GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

 

            if (var15 == 0)

            {

                this.drawTexturedModalRect(var5 + 60, var6 + 14 + 19 * var13, 0, 185, 108, 19);

            }

            else

            {

                String var16 = "" + var15;

                FontRenderer var17 = this.mc.standardGalacticFontRenderer;

                int var18 = 6839882;

 

                if (this.mc.thePlayer.experienceLevel < var15 && !this.mc.thePlayer.capabilities.isCreativeMode)

                {

                    this.drawTexturedModalRect(var5 + 60, var6 + 14 + 19 * var13, 0, 185, 108, 19);

                    var17.drawSplitString(var14, var5 + 62, var6 + 16 + 19 * var13, 104, (var18 & 16711422) >> 1);

                    var17 = this.mc.fontRenderer;

                    var18 = 4226832;

                    var17.drawStringWithShadow(var16, var5 + 62 + 104 - var17.getStringWidth(var16), var6 + 16 + 19 * var13 + 7, var18);

                }

                else

                {

                    int var19 = par2 - (var5 + 60);

                    int var20 = par3 - (var6 + 14 + 19 * var13);

 

                    if (var19 >= 0 && var20 >= 0 && var19 < 108 && var20 < 19)

                    {

                        this.drawTexturedModalRect(var5 + 60, var6 + 14 + 19 * var13, 0, 204, 108, 19);

                        var18 = 16777088;

                    }

                    else

                    {

                        this.drawTexturedModalRect(var5 + 60, var6 + 14 + 19 * var13, 0, 166, 108, 19);

                    }

 

                    var17.drawSplitString(var14, var5 + 62, var6 + 16 + 19 * var13, 104, var18);

                    var17 = this.mc.fontRenderer;

                    var18 = 8453920;

                    var17.drawStringWithShadow(var16, var5 + 62 + 104 - var17.getStringWidth(var16), var6 + 16 + 19 * var13 + 7, var18);

                }

            }

        }

    }

 

    public void func_74205_h()

    {

        ItemStack var1 = this.inventorySlots.getSlot(0).getStack();

 

        if (!ItemStack.areItemStacksEqual(var1, this.theItemStack))

        {

            this.theItemStack = var1;

 

            do

            {

                this.field_74211_r += (float)(this.rand.nextInt(4) - this.rand.nextInt(4));

            }

            while (this.field_74213_p <= this.field_74211_r + 1.0F && this.field_74213_p >= this.field_74211_r - 1.0F);

        }

 

        ++this.field_74214_o;

        this.field_74212_q = this.field_74213_p;

        this.field_74208_u = this.field_74209_t;

        boolean var2 = false;

 

        for (int var3 = 0; var3 < 3; ++var3)

        {

            if (this.containerEnchantment.enchantLevels[var3] != 0)

            {

                var2 = true;

            }

        }

 

        if (var2)

        {

            this.field_74209_t += 0.2F;

        }

        else

        {

            this.field_74209_t -= 0.2F;

        }

 

        if (this.field_74209_t < 0.0F)

        {

            this.field_74209_t = 0.0F;

        }

 

        if (this.field_74209_t > 1.0F)

        {

            this.field_74209_t = 1.0F;

        }

 

        float var5 = (this.field_74211_r - this.field_74213_p) * 0.4F;

        float var4 = 0.2F;

 

        if (var5 < -var4)

        {

            var5 = -var4;

        }

 

        if (var5 > var4)

        {

            var5 = var4;

        }

 

        this.field_74210_s += (var5 - this.field_74210_s) * 0.9F;

        this.field_74213_p += this.field_74210_s;

    }

}

 

 

ContainerBE

 

 

package duheggroll.archer.common;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import java.util.List;

import java.util.Random;

import net.minecraft.block.Block;

import net.minecraft.enchantment.Enchantment;

import net.minecraft.enchantment.EnchantmentData;

import net.minecraft.enchantment.EnchantmentHelper;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.player.InventoryPlayer;

import net.minecraft.inventory.Container;

import net.minecraft.inventory.ICrafting;

import net.minecraft.inventory.IInventory;

import net.minecraft.inventory.Slot;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.world.World;

 

public class ContainerBE extends Container

{

    /** SlotEnchantmentTable object with ItemStack to be enchanted */

    public IInventory tableInventory = new SlotEnchantmentTable(this, "Enchant", 1);

 

    /** current world (for bookshelf counting) */

    private World worldPointer;

    private int posX;

    private int posY;

    private int posZ;

    private Random rand = new Random();

 

    /** used as seed for EnchantmentNameParts (see GuiEnchantment) */

    public long nameSeed;

 

    /** 3-member array storing the enchantment levels of each slot */

    public int[] enchantLevels = new int[3];

 

    public ContainerBE(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5)

    {

        this.worldPointer = par2World;

        this.posX = par3;

        this.posY = par4;

        this.posZ = par5;

        this.addSlotToContainer(new SlotEnchantment(this, this.tableInventory, 0, 25, 47));

        int var6;

 

        for (var6 = 0; var6 < 3; ++var6)

        {

            for (int var7 = 0; var7 < 9; ++var7)

            {

                this.addSlotToContainer(new Slot(par1InventoryPlayer, var7 + var6 * 9 + 9, 8 + var7 * 18, 84 + var6 * 18));

            }

        }

 

        for (var6 = 0; var6 < 9; ++var6)

        {

            this.addSlotToContainer(new Slot(par1InventoryPlayer, var6, 8 + var6 * 18, 142));

        }

    }

 

    public void addCraftingToCrafters(ICrafting par1ICrafting)

    {

        super.addCraftingToCrafters(par1ICrafting);

        par1ICrafting.sendProgressBarUpdate(this, 0, this.enchantLevels[0]);

        par1ICrafting.sendProgressBarUpdate(this, 1, this.enchantLevels[1]);

        par1ICrafting.sendProgressBarUpdate(this, 2, this.enchantLevels[2]);

    }

 

    /**

    * Looks for changes made in the container, sends them to every listener.

    */

    public void detectAndSendChanges()

    {

        super.detectAndSendChanges();

 

        for (int var1 = 0; var1 < this.crafters.size(); ++var1)

        {

            ICrafting var2 = (ICrafting)this.crafters.get(var1);

            var2.sendProgressBarUpdate(this, 0, this.enchantLevels[0]);

            var2.sendProgressBarUpdate(this, 1, this.enchantLevels[1]);

            var2.sendProgressBarUpdate(this, 2, this.enchantLevels[2]);

        }

    }

 

    @SideOnly(Side.CLIENT)

    public void updateProgressBar(int par1, int par2)

    {

        if (par1 >= 0 && par1 <= 2)

        {

            this.enchantLevels[par1] = par2;

        }

        else

        {

            super.updateProgressBar(par1, par2);

        }

    }

 

    /**

    * Callback for when the crafting matrix is changed.

    */

    public void onCraftMatrixChanged(IInventory par1IInventory)

    {

       

        if (par1IInventory == this.tableInventory)

        {

            ItemStack var2 = par1IInventory.getStackInSlot(0);

            int var3;

 

            if (var2 != null && var2.isItemEnchantable())

            {

                this.nameSeed = this.rand.nextLong();

 

                if (!this.worldPointer.isRemote)

                {

                    var3 = 0;

                    int var4;

 

                    for (var4 = -1; var4 <= 1; ++var4)

                    {

                        for (int var5 = -1; var5 <= 1; ++var5)

                        {

                            if ((var4 != 0 || var5 != 0) && this.worldPointer.isAirBlock(this.posX + var5, this.posY, this.posZ + var4) && this.worldPointer.isAirBlock(this.posX + var5, this.posY + 1, this.posZ + var4))

                            {

                                if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY, this.posZ + var4 * 2) == Block.bookShelf.blockID)

                                {

                                    ++var3;

                                }

 

                                if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY + 1, this.posZ + var4 * 2) == Block.bookShelf.blockID)

                                {

                                    ++var3;

                                }

 

                                if (var5 != 0 && var4 != 0)

                                {

                                    if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY, this.posZ + var4) == Block.bookShelf.blockID)

                                    {

                                        ++var3;

                                    }

 

                                    if (this.worldPointer.getBlockId(this.posX + var5 * 2, this.posY + 1, this.posZ + var4) == Block.bookShelf.blockID)

                                    {

                                        ++var3;

                                    }

 

                                    if (this.worldPointer.getBlockId(this.posX + var5, this.posY, this.posZ + var4 * 2) == Block.bookShelf.blockID)

                                    {

                                        ++var3;

                                    }

 

                                    if (this.worldPointer.getBlockId(this.posX + var5, this.posY + 1, this.posZ + var4 * 2) == Block.bookShelf.blockID)

                                    {

                                        ++var3;

                                    }

                                }

                            }

                        }

                    }

 

                    for (var4 = 0; var4 < 3; ++var4)

                    {

                        this.enchantLevels[var4] = EnchantmentHelper.calcItemStackEnchantability(this.rand, var4, var3, var2);

                    }

 

                    this.detectAndSendChanges();

                }

            }

            else

            {

                for (var3 = 0; var3 < 3; ++var3)

                {

                    this.enchantLevels[var3] = 0;

                }

            }

        }

    }

 

    /**

    * enchants the item on the table using the specified slot; also deducts XP from player

    */

    public boolean enchantItem(EntityPlayer par1EntityPlayer, int par2)

    {

        ItemStack var3 = this.tableInventory.getStackInSlot(0);

 

        if (this.enchantLevels[par2] > 0 && var3 != null && (par1EntityPlayer.experienceLevel >= this.enchantLevels[par2] || par1EntityPlayer.capabilities.isCreativeMode))

        {

            if (!this.worldPointer.isRemote)

            {

                List var4 = EnchantmentHelper.buildEnchantmentList(this.rand, var3, this.enchantLevels[par2]);

                boolean var5 = var3.itemID == Item.book.itemID;

 

                if (var4 != null)

                {

                    par1EntityPlayer.addExperienceLevel(-this.enchantLevels[par2]);

 

                    if (var5)

                    {

                        var3.itemID = Item.field_92053_bW.itemID;

                    }

 

                    int var6 = var5 ? this.rand.nextInt(var4.size()) : -1;

 

                    for (int var7 = 0; var7 < var4.size(); ++var7)

                    {

                        EnchantmentData var8 = (EnchantmentData)var4.get(var7);

 

                        if (!var5 || var7 == var6)

                        {

                            if (var5)

                            {

                                Item.field_92053_bW.func_92060_a(var3, var8);

                            }

                            else

                            {

                                var3.addEnchantment(var8.enchantmentobj, var8.enchantmentLevel);

                            }

                        }

                    }

 

                    this.onCraftMatrixChanged(this.tableInventory);

                }

            }

 

            return true;

        }

        else

        {

            return false;

        }

    }

 

    /**

    * Callback for when the crafting gui is closed.

    */

    public void onCraftGuiClosed(EntityPlayer par1EntityPlayer)

    {

        super.onCraftGuiClosed(par1EntityPlayer);

 

        if (!this.worldPointer.isRemote)

        {

            ItemStack var2 = this.tableInventory.getStackInSlotOnClosing(0);

 

            if (var2 != null)

            {

                par1EntityPlayer.dropPlayerItem(var2);

            }

        }

    }

 

    public boolean canInteractWith(EntityPlayer par1EntityPlayer)

    {

        return this.worldPointer.getBlockId(this.posX, this.posY, this.posZ) != Block.enchantmentTable.blockID ? false : par1EntityPlayer.getDistanceSq((double)this.posX + 0.5D, (double)this.posY + 0.5D, (double)this.posZ + 0.5D) <= 64.0D;

    }

 

    /**

    * Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.

    */

    public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2)

    {

        ItemStack var3 = null;

        Slot var4 = (Slot)this.inventorySlots.get(par2);

 

        if (var4 != null && var4.getHasStack())

        {

            ItemStack var5 = var4.getStack();

            var3 = var5.copy();

 

            if (par2 == 0)

            {

                if (!this.mergeItemStack(var5, 1, 37, true))

                {

                    return null;

                }

            }

            else

            {

                if (((Slot)this.inventorySlots.get(0)).getHasStack() || !((Slot)this.inventorySlots.get(0)).isItemValid(var5))

                {

                    return null;

                }

 

                if (var5.hasTagCompound() && var5.stackSize == 1)

                {

                    ((Slot)this.inventorySlots.get(0)).putStack(var5.copy());

                    var5.stackSize = 0;

                }

                else if (var5.stackSize >= 1)

                {

                    ((Slot)this.inventorySlots.get(0)).putStack(new ItemStack(var5.itemID, 1, var5.getItemDamage()));

                    --var5.stackSize;

                }

            }

 

            if (var5.stackSize == 0)

            {

                var4.putStack((ItemStack)null);

            }

            else

            {

                var4.onSlotChanged();

            }

 

            if (var5.stackSize == var3.stackSize)

            {

                return null;

            }

 

            var4.onPickupFromSlot(par1EntityPlayer, var5);

        }

 

        return var3;

    }

}

 

 

BlockBEnchanter

 

 

package duheggroll.archer.common;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.tileentity.TileEntityEnchantmentTable;

import net.minecraft.world.World;

 

public class BlockBEnchanter extends BlockContainer

{

    protected BlockBEnchanter(int id, int texture)

    {

        super(id, texture, Material.rock);

        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.75F, 1.0F);

        this.setLightOpacity(0);

        this.setCreativeTab(CreativeTabs.tabDecorations);

    }

 

    /**

    * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)

    */

    public boolean renderAsNormalBlock()

    {

        return false;

    }

 

    @SideOnly(Side.CLIENT)

 

    /**

    * A randomly called display update to be able to add particles or other items for display

    */

    public void randomDisplayTick(World par1World, int par2, int par3, int par4, Random par5Random)

    {

        super.randomDisplayTick(par1World, par2, par3, par4, par5Random);

 

        for (int var6 = par2 - 2; var6 <= par2 + 2; ++var6)

        {

            for (int var7 = par4 - 2; var7 <= par4 + 2; ++var7)

            {

                if (var6 > par2 - 2 && var6 < par2 + 2 && var7 == par4 - 1)

                {

                    var7 = par4 + 2;

                }

 

                if (par5Random.nextInt(16) == 0)

                {

                    for (int var8 = par3; var8 <= par3 + 1; ++var8)

                    {

                        if (par1World.getBlockId(var6, var8, var7) == Block.bookShelf.blockID)

                        {

                            if (!par1World.isAirBlock((var6 - par2) / 2 + par2, var8, (var7 - par4) / 2 + par4))

                            {

                                break;

                            }

 

                            par1World.spawnParticle("enchantmenttable", (double)par2 + 0.5D, (double)par3 + 2.0D, (double)par4 + 0.5D, (double)((float)(var6 - par2) + par5Random.nextFloat()) - 0.5D, (double)((float)(var8 - par3) - par5Random.nextFloat() - 1.0F), (double)((float)(var7 - par4) + par5Random.nextFloat()) - 0.5D);

                        }

                    }

                }

            }

        }

    }

 

    /**

    * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two

    * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.

    */

    public boolean isOpaqueCube()

    {

        return false;

    }

 

    /**

    * Returns the block texture based on the side being looked at.  Args: side

    */

    public int getBlockTextureFromSideAndMetadata(int par1, int par2)

    {

        return this.getBlockTextureFromSide(par1);

    }

 

    /**

    * Returns the block texture based on the side being looked at.  Args: side

    */

    public int getBlockTextureFromSide(int i){

        switch(i){

        case 0: return 6;

        case 1: return 4;

        default: return 5;

        }

    }

   

    @Override

    public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float a, float b, float c)

    {

    player.openGui(ArcherEnhancementCore.instance, 1, world, x, y, z);

    return true;

   

    }

 

    /**

    * Returns a new instance of a block's tile entity class. Called on placing the block.

    */

    public TileEntity createNewTileEntity(World par1World)

    {

        return new TileEntityEnchantmentTable();

    }

   

    public String getTextureFile() {

        return "/duheggroll/archer/textures/blocks-0.png";

    }

}

 

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I have been following these exact tutorials for quite a while, I must agree that they are amazing and easy to follow. I have registered the item in the ModFoods class, I tried to do it in ModItems (Where all the items should be registered) but got errors, I think I may need to revert this and figure it out from there. Once again, thank you for your help! 👍 Just looking back, I have noticed in your code you added ITEMS.register, which I am guessing means that they are being registered in ModFoods, I shall go through the process of trial and error to figure this out.
    • ♈+2349027025197ஜ Are you a pastor, business man or woman, politician, civil engineer, civil servant, security officer, entrepreneur, Job seeker, poor or rich Seeking how to join a brotherhood for protection and wealth here’s is your opportunity, but you should know there’s no ritual without repercussions but with the right guidance and support from this great temple your destiny is certain to be changed for the better and equally protected depending if you’re destined for greatness Call now for enquiry +2349027025197☎+2349027025197₩™ I want to join ILLUMINATI occult without human sacrificeGREATORLDRADO BROTHERHOOD OCCULT , Is The Club of the Riches and Famous; is the world oldest and largest fraternity made up of 3 Millions Members. We are one Family under one father who is the Supreme Being. In Greatorldrado BROTHERHOOD we believe that we were born in paradise and no member should struggle in this world. Hence all our new members are given Money Rewards once they join in order to upgrade their lifestyle.; interested viewers should contact us; on. +2349027025197 ۝ஐℰ+2349027025197 ₩Greatorldrado BROTHERHOOD OCCULT IS A SACRED FRATERNITY WITH A GRAND LODGE TEMPLE SITUATED IN G.R.A PHASE 1 PORT HARCOURT NIGERIA, OUR NUMBER ONE OBLIGATION IS TO MAKE EVERY INITIATE MEMBER HERE RICH AND FAMOUS IN OTHER RISE THE POWERS OF GUARDIANS OF AGE+. +2349027025197   SEARCHING ON HOW TO JOIN THE Greatorldrado BROTHERHOOD MONEY RITUAL OCCULT IS NOT THE PROBLEM BUT MAKE SURE YOU'VE THOUGHT ABOUT IT VERY WELL BEFORE REACHING US HERE BECAUSE NOT EVERYONE HAS THE HEART TO DO WHAT IT TAKES TO BECOME ONE OF US HERE, BUT IF YOU THINK YOU'RE SERIOUS MINDED AND READY TO RUN THE SPIRITUAL RACE OF LIFE IN OTHER TO ACQUIRE ALL YOU NEED HERE ON EARTH CONTACT SPIRITUAL GRANDMASTER NOW FOR INQUIRY +2349027025197   +2349027025197 Are you a pastor, business man or woman, politician, civil engineer, civil servant, security officer, entrepreneur, Job seeker, poor or rich Seeking how to join
    • Hi, I'm trying to use datagen to create json files in my own mod. This is my ModRecipeProvider class. public class ModRecipeProvider extends RecipeProvider implements IConditionBuilder { public ModRecipeProvider(PackOutput pOutput) { super(pOutput); } @Override protected void buildRecipes(Consumer<FinishedRecipe> pWriter) { ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', ModItems.COMPRESSED_DIAMOND.get()) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get(),9) .requires(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()) .unlockedBy(getHasName(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get()), has(ModBlocks.COMPRESSED_DIAMOND_BLOCK.get())) .save(pWriter); ShapedRecipeBuilder.shaped(RecipeCategory.MISC, ModItems.COMPRESSED_DIAMOND.get()) .pattern("SSS") .pattern("SSS") .pattern("SSS") .define('S', Blocks.DIAMOND_BLOCK) .unlockedBy(getHasName(ModItems.COMPRESSED_DIAMOND.get()), has(ModItems.COMPRESSED_DIAMOND.get())) .save(pWriter); } } When I try to run the runData client, it shows an error:  Caused by: java.lang.IllegalStateException: Duplicate recipe compressed:compressed_diamond I know that it's caused by the fact that there are two recipes for the ModItems.COMPRESSED_DIAMOND. But I need both of these recipes, because I need a way to craft ModItems.COMPRESSED_DIAMOND_BLOCK and restore 9 diamond blocks from ModItems.COMPRESSED_DIAMOND. Is there a way to solve this?
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.