• 1

    posted a message on [1.8] MinecraftForge Video & Text Modding Tutorials [Updated May 2] Now in English and German
    Quote from Dragonisser

    Well, i made a custom chest but the chest disappear if i look in the right angle ._.

    Picture



    TileEntityCobaltChestRenderer

    package cobaltmod.renderer;
    
    import java.util.Calendar;
    
    import net.minecraft.block.Block;
    import net.minecraft.client.model.ModelChest;
    import net.minecraft.client.model.ModelLargeChest;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    
    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;
    
    import cobaltmod.blocks.BlockCobaltChest;
    import cobaltmod.entity.TileEntityCobaltChest;
    import cpw.mods.fml.common.FMLLog;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    
    [MENTION=29904]Side[/MENTION]Only(Side.CLIENT)
    public class TileEntityCobaltChestRenderer extends TileEntitySpecialRenderer
    {
    private static final ResourceLocation RES_TRAPPED_DOUBLE = new ResourceLocation("textures/entity/chest/trapped_double.png");
    private static final ResourceLocation RES_CHRISTMAS_DOUBLE = new ResourceLocation("textures/entity/chest/christmas_double.png");
    private static final ResourceLocation RES_NORMAL_DOUBLE = new ResourceLocation("mod_cobalt:textures/models/normal_double.png");
    private static final ResourceLocation RES_TRAPPED_SINGLE = new ResourceLocation("textures/entity/chest/trapped.png");
    private static final ResourceLocation RES_CHRISTMAS_SINGLE = new ResourceLocation("textures/entity/chest/christmas.png");
    private static final ResourceLocation RES_NORMAL_SINGLE = new ResourceLocation("mod_cobalt:textures/models/normal.png");
    
    /** The normal small chest model. */
    private ModelChest chestModel = new ModelChest();
    
    /** The large double chest model. */
    private ModelChest largeChestModel = new ModelLargeChest();
    
    /** If true, chests will be rendered with the Christmas present textures. */
    private boolean isChristmas;
    
    public TileEntityCobaltChestRenderer()
    {
    Calendar calendar = Calendar.getInstance();
    
    if (calendar.get(2) + 1 == 12 && calendar.get(5) >= 24 && calendar.get(5) <= 26)
    {
    this.isChristmas = true;
    }
    }
    
    /**
    * Renders the TileEntity for the chest at a position.
    */
    public void renderTileEntityChestAt(TileEntityCobaltChest par1TileEntityChest, double par2, double par4, double par6, float par8)
    {
    int i;
    
    if (!par1TileEntityChest.hasWorldObj())
    {
    i = 0;
    }
    else
    {
    Block block = par1TileEntityChest.getBlockType();
    i = par1TileEntityChest.getBlockMetadata();
    
    if (block instanceof BlockCobaltChest && i == 0)
    {
    try
    {
    ((BlockCobaltChest)block).unifyAdjacentChests(par1TileEntityChest.getWorldObj(), par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord);
    }
    catch (ClassCastException e)
    {
    FMLLog.severe("Attempted to render a chest at %d, %d, %d that was not a chest",
    par1TileEntityChest.xCoord, par1TileEntityChest.yCoord, par1TileEntityChest.zCoord);
    }
    i = par1TileEntityChest.getBlockMetadata();
    }
    
    par1TileEntityChest.checkForAdjacentChests();
    }
    
    if (par1TileEntityChest.adjacentChestZNeg == null && par1TileEntityChest.adjacentChestXNeg == null)
    {
    ModelChest modelchest;
    
    if (par1TileEntityChest.adjacentChestXPos == null && par1TileEntityChest.adjacentChestZPosition == null)
    {
    modelchest = this.chestModel;
    
    if (par1TileEntityChest.getChestType() == 1)
    {
    this.bindTexture(RES_TRAPPED_SINGLE);
    }
    else if (this.isChristmas)
    {
    this.bindTexture(RES_CHRISTMAS_SINGLE);
    }
    else
    {
    this.bindTexture(RES_NORMAL_SINGLE);
    }
    }
    else
    {
    modelchest = this.largeChestModel;
    
    if (par1TileEntityChest.getChestType() == 1)
    {
    this.bindTexture(RES_TRAPPED_DOUBLE);
    }
    else if (this.isChristmas)
    {
    this.bindTexture(RES_CHRISTMAS_DOUBLE);
    }
    else
    {
    this.bindTexture(RES_NORMAL_DOUBLE);
    }
    }
    
    GL11.glPushMatrix();
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glTranslatef((float)par2, (float)par4 + 1.0F, (float)par6 + 1.0F);
    GL11.glScalef(1.0F, -1.0F, -1.0F);
    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    short short1 = 0;
    
    if (i == 2)
    {
    short1 = 180;
    }
    
    if (i == 3)
    {
    short1 = 0;
    }
    
    if (i == 4)
    {
    short1 = 90;
    }
    
    if (i == 5)
    {
    short1 = -90;
    }
    
    if (i == 2 && par1TileEntityChest.adjacentChestXPos != null)
    {
    GL11.glTranslatef(1.0F, 0.0F, 0.0F);
    }
    
    if (i == 5 && par1TileEntityChest.adjacentChestZPosition != null)
    {
    GL11.glTranslatef(0.0F, 0.0F, -1.0F);
    }
    
    GL11.glRotatef((float)short1, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    float f1 = par1TileEntityChest.prevLidAngle + (par1TileEntityChest.lidAngle - par1TileEntityChest.prevLidAngle) * par8;
    float f2;
    
    if (par1TileEntityChest.adjacentChestZNeg != null)
    {
    f2 = par1TileEntityChest.adjacentChestZNeg.prevLidAngle + (par1TileEntityChest.adjacentChestZNeg.lidAngle - par1TileEntityChest.adjacentChestZNeg.prevLidAngle) * par8;
    
    if (f2 > f1)
    {
    f1 = f2;
    }
    }
    
    if (par1TileEntityChest.adjacentChestXNeg != null)
    {
    f2 = par1TileEntityChest.adjacentChestXNeg.prevLidAngle + (par1TileEntityChest.adjacentChestXNeg.lidAngle - par1TileEntityChest.adjacentChestXNeg.prevLidAngle) * par8;
    
    if (f2 > f1)
    {
    f1 = f2;
    }
    }
    
    f1 = 1.0F - f1;
    f1 = 1.0F - f1 * f1 * f1;
    modelchest.chestLid.rotateAngleX = -(f1 * (float)Math.PI / 2.0F);
    modelchest.renderAll();
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    }
    }
    
    public void renderTileEntityAt(TileEntity par1TileEntity, double par2, double par4, double par6, float par8)
    {
    this.renderTileEntityChestAt((TileEntityCobaltChest)par1TileEntity, par2, par4, par6, par8);
    }
    }


    RenderCobaltChest

    package cobaltmod.renderer;
    
    import net.minecraft.block.Block;
    import net.minecraft.client.model.ModelChest;
    import net.minecraft.client.renderer.RenderBlocks;
    import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.ResourceLocation;
    import net.minecraft.world.IBlockAccess;
    
    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;
    
    import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    
    public class RenderCobaltChest extends TileEntitySpecialRenderer implements ISimpleBlockRenderingHandler
    {
    protected ModelChest modelMixer = new ModelChest();
    public static int chestRenderId = RenderingRegistry.getNextAvailableRenderId();
    public static final ResourceLocation altar_texture = new ResourceLocation("mod_cobalt:textures/models/normal.png");
    
    public void renderInventoryBlock(Block var1, int var2, int var3, RenderBlocks var4)
    {
    if (var3 == this.getRenderId())
    {
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    TileEntityRendererCobaltChestHelper.instance.renderChest(var1, var2, 0.0F);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    }
    }
    
    public boolean renderWorldBlock(IBlockAccess var1, int var2, int var3, int var4, Block var5, int var6, RenderBlocks var7)
    {
    return false;
    }
    public int getRenderId()
    {
    return chestRenderId;
    }
    @Override
    public boolean shouldRender3DInInventory(int modelId) {
    // TODO Auto-generated method stub
    return true;
    }
    
    @Override
    public void renderTileEntityAt(TileEntity var1, double var2, double var4,
    double var6, float var8) {
    // TODO Auto-generated method stub
    
    }
    }


    TileEntityCobaltChest

    package cobaltmod.entity;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import java.util.Iterator;
    import java.util.List;
    
    import cobaltmod.blocks.BlockCobaltChest;
    import net.minecraft.block.Block;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.inventory.ContainerChest;
    import net.minecraft.inventory.IInventory;
    import net.minecraft.inventory.InventoryLargeChest;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.nbt.NBTTagList;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.AxisAlignedBB;
    
    public class TileEntityCobaltChest extends TileEntity implements IInventory
    {
    private ItemStack[] chestContents = new ItemStack[36];
    
    /** Determines if the check for adjacent chests has taken place. */
    public boolean adjacentChestChecked;
    
    /** Contains the chest tile located adjacent to this one (if any) */
    public TileEntityCobaltChest adjacentChestZNeg;
    
    /** Contains the chest tile located adjacent to this one (if any) */
    public TileEntityCobaltChest adjacentChestXPos;
    
    /** Contains the chest tile located adjacent to this one (if any) */
    public TileEntityCobaltChest adjacentChestXNeg;
    
    /** Contains the chest tile located adjacent to this one (if any) */
    public TileEntityCobaltChest adjacentChestZPosition;
    
    /** The current angle of the lid (between 0 and 1) */
    public float lidAngle;
    
    /** The angle of the lid last tick */
    public float prevLidAngle;
    
    /** The number of players currently using this chest */
    public int numUsingPlayers;
    
    /** Server sync counter (once per 20 ticks) */
    private int ticksSinceSync;
    private int cachedChestType;
    private String customName;
    
    public TileEntityCobaltChest()
    {
    this.cachedChestType = -1;
    }
    
    [MENTION=29904]Side[/MENTION]Only(Side.CLIENT)
    public TileEntityCobaltChest(int par1)
    {
    this.cachedChestType = par1;
    }
    
    /**
    * Returns the number of slots in the inventory.
    */
    public int getSizeInventory()
    {
    return 27;
    }
    
    /**
    * Returns the stack in slot i
    */
    public ItemStack getStackInSlot(int par1)
    {
    return this.chestContents[par1];
    }
    
    /**
    * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
    * new stack.
    */
    public ItemStack decrStackSize(int par1, int par2)
    {
    if (this.chestContents[par1] != null)
    {
    ItemStack itemstack;
    
    if (this.chestContents[par1].stackSize <= par2)
    {
    itemstack = this.chestContents[par1];
    this.chestContents[par1] = null;
    this.markDirty();
    return itemstack;
    }
    else
    {
    itemstack = this.chestContents[par1].splitStack(par2);
    
    if (this.chestContents[par1].stackSize == 0)
    {
    this.chestContents[par1] = null;
    }
    
    this.markDirty();
    return itemstack;
    }
    }
    else
    {
    return null;
    }
    }
    
    /**
    * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem -
    * like when you close a workbench GUI.
    */
    public ItemStack getStackInSlotOnClosing(int par1)
    {
    if (this.chestContents[par1] != null)
    {
    ItemStack itemstack = this.chestContents[par1];
    this.chestContents[par1] = null;
    return itemstack;
    }
    else
    {
    return null;
    }
    }
    
    /**
    * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
    */
    public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
    {
    this.chestContents[par1] = par2ItemStack;
    
    if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())
    {
    par2ItemStack.stackSize = this.getInventoryStackLimit();
    }
    
    this.markDirty();
    }
    
    /**
    * Returns the name of the inventory.
    */
    public String getInvName()
    {
    return this.isInvNameLocalized() ? this.customName : "container.chest";
    }
    
    /**
    * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's
    * language. Otherwise it will be used directly.
    */
    public boolean isInvNameLocalized()
    {
    return this.customName != null && this.customName.length() > 0;
    }
    
    /**
    * Sets the custom display name to use when opening a GUI for this specific TileEntityChest.
    */
    public void setChestGuiName(String par1Str)
    {
    this.customName = par1Str;
    }
    
    /**
    * Reads a tile entity from NBT.
    */
    public void readFromNBT(NBTTagCompound par1NBTTagCompound)
    {
    super.readFromNBT(par1NBTTagCompound);
    NBTTagList nbttaglist = par1NBTTagCompound.getTagList("Items", 10);
    this.chestContents = new ItemStack[this.getSizeInventory()];
    
    if (par1NBTTagCompound.hasKey("CustomName"))
    {
    this.customName = par1NBTTagCompound.getString("CustomName");
    }
    
    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
    NBTTagCompound nbttagcompound1 = nbttaglist.getCompoundTagAt(i);
    int j = nbttagcompound1.getByte("Slot") & 255;
    
    if (j >= 0 && j < this.chestContents.length)
    {
    this.chestContents[j] = ItemStack.loadItemStackFromNBT(nbttagcompound1);
    }
    }
    }
    
    /**
    * Writes a tile entity to NBT.
    */
    public void writeToNBT(NBTTagCompound par1NBTTagCompound)
    {
    super.writeToNBT(par1NBTTagCompound);
    NBTTagList nbttaglist = new NBTTagList();
    
    for (int i = 0; i < this.chestContents.length; ++i)
    {
    if (this.chestContents[i] != null)
    {
    NBTTagCompound nbttagcompound1 = new NBTTagCompound();
    nbttagcompound1.setByte("Slot", (byte)i);
    this.chestContents[i].writeToNBT(nbttagcompound1);
    nbttaglist.appendTag(nbttagcompound1);
    }
    }
    
    par1NBTTagCompound.setTag("Items", nbttaglist);
    
    if (this.isInvNameLocalized())
    {
    par1NBTTagCompound.setString("CustomName", this.customName);
    }
    }
    
    /**
    * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't
    * this more of a set than a get?*
    */
    public int getInventoryStackLimit()
    {
    return 64;
    }
    
    /**
    * Do not make give this method the name canInteractWith because it clashes with Container
    */
    public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
    {
    return this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord) != this ? false : par1EntityPlayer.getDistanceSq((double)this.xCoord + 0.5D, (double)this.yCoord + 0.5D, (double)this.zCoord + 0.5D) <= 64.0D;
    }
    
    /**
    * Causes the TileEntity to reset all it's cached values for it's container block, blockID, metaData and in the case
    * of chests, the adjcacent chest check
    */
    public void updateContainingBlockInfo()
    {
    super.updateContainingBlockInfo();
    this.adjacentChestChecked = false;
    }
    
    private void func_90009_a(TileEntityCobaltChest par1TileEntityChest, int par2)
    {
    if (par1TileEntityChest.isInvalid())
    {
    this.adjacentChestChecked = false;
    }
    else if (this.adjacentChestChecked)
    {
    switch (par2)
    {
    case 0:
    if (this.adjacentChestZPosition != par1TileEntityChest)
    {
    this.adjacentChestChecked = false;
    }
    
    break;
    case 1:
    if (this.adjacentChestXNeg != par1TileEntityChest)
    {
    this.adjacentChestChecked = false;
    }
    
    break;
    case 2:
    if (this.adjacentChestZNeg != par1TileEntityChest)
    {
    this.adjacentChestChecked = false;
    }
    
    break;
    case 3:
    if (this.adjacentChestXPos != par1TileEntityChest)
    {
    this.adjacentChestChecked = false;
    }
    }
    }
    }
    
    /**
    * Performs the check for adjacent chests to determine if this chest is double or not.
    */
    public void checkForAdjacentChests()
    {
    if (!this.adjacentChestChecked)
    {
    this.adjacentChestChecked = true;
    this.adjacentChestZNeg = null;
    this.adjacentChestXPos = null;
    this.adjacentChestXNeg = null;
    this.adjacentChestZPosition = null;
    
    if (this.func_94044_a(this.xCoord - 1, this.yCoord, this.zCoord))
    {
    this.adjacentChestXNeg = (TileEntityCobaltChest)this.worldObj.getTileEntity(this.xCoord - 1, this.yCoord, this.zCoord);
    }
    
    if (this.func_94044_a(this.xCoord + 1, this.yCoord, this.zCoord))
    {
    this.adjacentChestXPos = (TileEntityCobaltChest)this.worldObj.getTileEntity(this.xCoord + 1, this.yCoord, this.zCoord);
    }
    
    if (this.func_94044_a(this.xCoord, this.yCoord, this.zCoord - 1))
    {
    this.adjacentChestZNeg = (TileEntityCobaltChest)this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord - 1);
    }
    
    if (this.func_94044_a(this.xCoord, this.yCoord, this.zCoord + 1))
    {
    this.adjacentChestZPosition = (TileEntityCobaltChest)this.worldObj.getTileEntity(this.xCoord, this.yCoord, this.zCoord + 1);
    }
    
    if (this.adjacentChestZNeg != null)
    {
    this.adjacentChestZNeg.func_90009_a(this, 0);
    }
    
    if (this.adjacentChestZPosition != null)
    {
    this.adjacentChestZPosition.func_90009_a(this, 2);
    }
    
    if (this.adjacentChestXPos != null)
    {
    this.adjacentChestXPos.func_90009_a(this, 1);
    }
    
    if (this.adjacentChestXNeg != null)
    {
    this.adjacentChestXNeg.func_90009_a(this, 3);
    }
    }
    }
    
    private boolean func_94044_a(int par1, int par2, int par3)
    {
    Block block = this.worldObj.getBlock(par1, par2, par3);
    return block != null && block instanceof BlockCobaltChest ? ((BlockCobaltChest)block).chestType == this.getChestType() : false;
    }
    
    /**
    * Allows the entity to update its state. Overridden in most subclasses, e.g. the mob spawner uses this to count
    * ticks and creates a new spawn inside its implementation.
    */
    public void updateEntity()
    {
    super.updateEntity();
    this.checkForAdjacentChests();
    ++this.ticksSinceSync;
    float f;
    
    if (!this.worldObj.isRemote && this.numUsingPlayers != 0 && (this.ticksSinceSync + this.xCoord + this.yCoord + this.zCoord) % 200 == 0)
    {
    this.numUsingPlayers = 0;
    f = 5.0F;
    List list = this.worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getAABBPool().getAABB((double)((float)this.xCoord - f), (double)((float)this.yCoord - f), (double)((float)this.zCoord - f), (double)((float)(this.xCoord + 1) + f), (double)((float)(this.yCoord + 1) + f), (double)((float)(this.zCoord + 1) + f)));
    Iterator iterator = list.iterator();
    
    while (iterator.hasNext())
    {
    EntityPlayer entityplayer = (EntityPlayer)iterator.next();
    
    if (entityplayer.openContainer instanceof ContainerChest)
    {
    IInventory iinventory = ((ContainerChest)entityplayer.openContainer).getLowerChestInventory();
    
    if (iinventory == this || iinventory instanceof InventoryLargeChest && ((InventoryLargeChest)iinventory).isPartOfLargeChest(this))
    {
    ++this.numUsingPlayers;
    }
    }
    }
    }
    
    this.prevLidAngle = this.lidAngle;
    f = 0.1F;
    double d0;
    
    if (this.numUsingPlayers > 0 && this.lidAngle == 0.0F && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null)
    {
    double d1 = (double)this.xCoord + 0.5D;
    d0 = (double)this.zCoord + 0.5D;
    
    if (this.adjacentChestZPosition != null)
    {
    d0 += 0.5D;
    }
    
    if (this.adjacentChestXPos != null)
    {
    d1 += 0.5D;
    }
    
    this.worldObj.playSoundEffect(d1, (double)this.yCoord + 0.5D, d0, "random.chestopen", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
    }
    
    if (this.numUsingPlayers == 0 && this.lidAngle > 0.0F || this.numUsingPlayers > 0 && this.lidAngle < 1.0F)
    {
    float f1 = this.lidAngle;
    
    if (this.numUsingPlayers > 0)
    {
    this.lidAngle += f;
    }
    else
    {
    this.lidAngle -= f;
    }
    
    if (this.lidAngle > 1.0F)
    {
    this.lidAngle = 1.0F;
    }
    
    float f2 = 0.5F;
    
    if (this.lidAngle < f2 && f1 >= f2 && this.adjacentChestZNeg == null && this.adjacentChestXNeg == null)
    {
    d0 = (double)this.xCoord + 0.5D;
    double d2 = (double)this.zCoord + 0.5D;
    
    if (this.adjacentChestZPosition != null)
    {
    d2 += 0.5D;
    }
    
    if (this.adjacentChestXPos != null)
    {
    d0 += 0.5D;
    }
    
    this.worldObj.playSoundEffect(d0, (double)this.yCoord + 0.5D, d2, "random.chestclosed", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
    }
    
    if (this.lidAngle < 0.0F)
    {
    this.lidAngle = 0.0F;
    }
    }
    }
    
    /**
    * Called when a client event is received with the event number and argument, see World.sendClientEvent
    */
    public boolean receiveClientEvent(int par1, int par2)
    {
    if (par1 == 1)
    {
    this.numUsingPlayers = par2;
    return true;
    }
    else
    {
    return super.receiveClientEvent(par1, par2);
    }
    }
    
    public void openChest()
    {
    if (this.numUsingPlayers < 0)
    {
    this.numUsingPlayers = 0;
    }
    
    ++this.numUsingPlayers;
    this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numUsingPlayers);
    this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
    this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType());
    }
    
    public void closeChest()
    {
    if (this.getBlockType() != null && this.getBlockType() instanceof BlockCobaltChest)
    {
    --this.numUsingPlayers;
    this.worldObj.addBlockEvent(this.xCoord, this.yCoord, this.zCoord, this.getBlockType(), 1, this.numUsingPlayers);
    this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord, this.zCoord, this.getBlockType());
    this.worldObj.notifyBlocksOfNeighborChange(this.xCoord, this.yCoord - 1, this.zCoord, this.getBlockType());
    }
    }
    
    /**
    * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
    */
    public boolean isItemValidForSlot(int par1, ItemStack par2ItemStack)
    {
    return true;
    }
    
    /**
    * invalidates a tile entity
    */
    public void invalidate()
    {
    super.invalidate();
    this.updateContainingBlockInfo();
    this.checkForAdjacentChests();
    }
    
    public int getChestType()
    {
    if (this.cachedChestType == -1)
    {
    if (this.worldObj == null || !(this.getBlockType() instanceof BlockCobaltChest))
    {
    return 0;
    }
    
    this.cachedChestType = ((BlockCobaltChest)this.getBlockType()).chestType;
    }
    
    return this.cachedChestType;
    }
    
    @Override
    public String getInventoryName() {
    // TODO Auto-generated method stub
    return null;
    }
    
    @Override
    public boolean hasCustomInventoryName() {
    // TODO Auto-generated method stub
    return false;
    }
    
    @Override
    public void openInventory() {
    // TODO Auto-generated method stub
    
    }
    
    @Override
    public void closeInventory() {
    // TODO Auto-generated method stub
    
    }
    
    }


    BlockCobaltChest

    package cobaltmod.blocks;
    
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    import java.util.Iterator;
    import java.util.Random;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockContainer;
    import net.minecraft.block.material.Material;
    import net.minecraft.client.renderer.texture.IIconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.EntityLivingBase;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.entity.passive.EntityOcelot;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.inventory.Container;
    import net.minecraft.inventory.IInventory;
    import net.minecraft.inventory.InventoryLargeChest;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.tileentity.TileEntity;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.MathHelper;
    import net.minecraft.world.IBlockAccess;
    import net.minecraft.world.World;
    
    import cobaltmod.entity.TileEntityCobaltChest;
    
    import static net.minecraftforge.common.util.ForgeDirection.*;
    
    import cobaltmod.renderer.RenderCobaltChest;
    
    public class BlockCobaltChest extends BlockContainer {
    private final Random random = new Random();
    
    /** 1 for trapped chests, 0 for normal chests. */
    public final int chestType;
    
    public BlockCobaltChest(int par2) {
    super(Material.wood);
    this.chestType = par2;
    this.setCreativeTab(CreativeTabs.tabDecorations);
    this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
    }
    
    /**
    * 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;
    }
    
    /**
    * If this block doesn't render as an ordinary block it will return False
    * (examples: signs, buttons, stairs, etc)
    */
    public boolean renderAsNormalBlock() {
    return false;
    }
    
    /**
    * The type of render function that is called for this block
    */
    public int getRenderType() {
    return RenderCobaltChest.chestRenderId;
    //return 22;
    }
    
    /**
    * Updates the blocks bounds based on its current state. Args: world, x, y,
    * z
    */
    public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess,
    int par2, int par3, int par4) {
    if (par1IBlockAccess.getBlock(par2, par3, par4 - 1) == this) {
    this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F);
    } else if (par1IBlockAccess.getBlock(par2, par3, par4 + 1) == this) {
    this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F);
    } else if (par1IBlockAccess.getBlock(par2 - 1, par3, par4) == this) {
    this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
    } else if (par1IBlockAccess.getBlock(par2 + 1, par3, par4) == this) {
    this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F);
    } else {
    this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F,
    0.9375F);
    }
    }
    
    /**
    * Called whenever the block is added into the world. Args: world, x, y, z
    */
    public void onBlockAdded(World par1World, int par2, int par3, int par4) {
    super.onBlockAdded(par1World, par2, par3, par4);
    this.unifyAdjacentChests(par1World, par2, par3, par4);
    Block l = par1World.getBlock(par2, par3, par4 - 1);
    Block i1 = par1World.getBlock(par2, par3, par4 + 1);
    Block j1 = par1World.getBlock(par2 - 1, par3, par4);
    Block k1 = par1World.getBlock(par2 + 1, par3, par4);
    
    if (l == this) {
    this.unifyAdjacentChests(par1World, par2, par3, par4 - 1);
    }
    
    if (i1 == this) {
    this.unifyAdjacentChests(par1World, par2, par3, par4 + 1);
    }
    
    if (j1 == this) {
    this.unifyAdjacentChests(par1World, par2 - 1, par3, par4);
    }
    
    if (k1 == this) {
    this.unifyAdjacentChests(par1World, par2 + 1, par3, par4);
    }
    }
    
    /**
    * Called when the block is placed in the world.
    */
    public void onBlockPlacedBy(World par1World, int par2, int par3, int par4,
    EntityLivingBase par5EntityLivingBase, ItemStack par6ItemStack) {
    Block l = par1World.getBlock(par2, par3, par4 - 1);
    Block i1 = par1World.getBlock(par2, par3, par4 + 1);
    Block j1 = par1World.getBlock(par2 - 1, par3, par4);
    Block k1 = par1World.getBlock(par2 + 1, par3, par4);
    byte b0 = 0;
    int l1 = MathHelper
    .floor_double((double) (par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
    
    if (l1 == 0) {
    b0 = 2;
    }
    
    if (l1 == 1) {
    b0 = 5;
    }
    
    if (l1 == 2) {
    b0 = 3;
    }
    
    if (l1 == 3) {
    b0 = 4;
    }
    
    if (l != this && i1 != this && j1 != this && k1 != this) {
    par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 3);
    } else {
    if ((l == this || i1 == this) && (b0 == 4 || b0 == 5)) {
    if (l == this) {
    par1World.setBlockMetadataWithNotify(par2, par3, par4 - 1,
    b0, 3);
    } else {
    par1World.setBlockMetadataWithNotify(par2, par3, par4 + 1,
    b0, 3);
    }
    
    par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 3);
    }
    
    if ((j1 == this || k1 == this) && (b0 == 2 || b0 == 3)) {
    if (j1 == this) {
    par1World.setBlockMetadataWithNotify(par2 - 1, par3, par4,
    b0, 3);
    } else {
    par1World.setBlockMetadataWithNotify(par2 + 1, par3, par4,
    b0, 3);
    }
    
    par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 3);
    }
    }
    
    if (par6ItemStack.hasDisplayName()) {
    ((TileEntityCobaltChest) par1World.getTileEntity(par2, par3, par4))
    .setChestGuiName(par6ItemStack.getDisplayName());
    }
    }
    
    /**
    * Turns the adjacent chests to a double chest.
    */
    public void unifyAdjacentChests(World par1World, int par2, int par3,
    int par4) {
    if (!par1World.isRemote) {
    Block l = par1World.getBlock(par2, par3, par4 - 1);
    Block i1 = par1World.getBlock(par2, par3, par4 + 1);
    Block j1 = par1World.getBlock(par2 - 1, par3, par4);
    Block k1 = par1World.getBlock(par2 + 1, par3, par4);
    Block l1;
    Block i2;
    
    byte b0;
    int j2;
    
    if (l != this && i1 != this) {
    if (j1 != this && k1 != this) {
    b0 = 3;
    
    if (l.func_149730_j() && !i1.func_149730_j()) {
    b0 = 3;
    }
    
    if (i1.func_149730_j() && !l.func_149730_j()) {
    b0 = 2;
    }
    
    if (j1.func_149730_j() && !k1.func_149730_j()) {
    b0 = 5;
    }
    
    if (k1.func_149730_j() && !j1.func_149730_j()) {
    b0 = 4;
    }
    } else {
    l1 = par1World.getBlock(j1 == this ? par2 - 1 : par2 + 1,
    par3, par4 - 1);
    i2 = par1World.getBlock(j1 == this ? par2 - 1 : par2 + 1,
    par3, par4 + 1);
    b0 = 3;
    
    if (j1 == this) {
    j2 = par1World.getBlockMetadata(par2 - 1, par3, par4);
    } else {
    j2 = par1World.getBlockMetadata(par2 + 1, par3, par4);
    }
    
    if (j2 == 2) {
    b0 = 2;
    }
    
    if ((l.func_149730_j() || l1.func_149730_j())
    && !i1.func_149730_j() && !i2.func_149730_j()) {
    b0 = 3;
    }
    
    if ((i1.func_149730_j() || i2.func_149730_j())
    && !l.func_149730_j() && !l1.func_149730_j()) {
    b0 = 2;
    }
    }
    } else {
    l1 = par1World.getBlock(par2 - 1, par3, l == this ? par4 - 1
    : par4 + 1);
    i2 = par1World.getBlock(par2 + 1, par3, l == this ? par4 - 1
    : par4 + 1);
    b0 = 5;
    
    if (l == this) {
    j2 = par1World.getBlockMetadata(par2, par3, par4 - 1);
    } else {
    j2 = par1World.getBlockMetadata(par2, par3, par4 + 1);
    }
    
    if (j2 == 4) {
    b0 = 4;
    }
    
    if ((j1.func_149730_j() || l1.func_149730_j())
    && !k1.func_149730_j() && !i2.func_149730_j()) {
    b0 = 5;
    }
    
    if ((k1.func_149730_j() || i2.func_149730_j())
    && !j1.func_149730_j() && !l1.func_149730_j()) {
    b0 = 4;
    }
    }
    
    par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 3);
    }
    }
    
    /**
    * Checks to see if its valid to put this block at the specified
    * coordinates. Args: world, x, y, z
    */
    public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
    int l = 0;
    
    if (par1World.getBlock(par2 - 1, par3, par4) == this) {
    ++l;
    }
    
    if (par1World.getBlock(par2 + 1, par3, par4) == this) {
    ++l;
    }
    
    if (par1World.getBlock(par2, par3, par4 - 1) == this) {
    ++l;
    }
    
    if (par1World.getBlock(par2, par3, par4 + 1) == this) {
    ++l;
    }
    
    return l > 1 ? false : (this.isThereANeighborChest(par1World, par2 - 1,
    par3, par4) ? false : (this.isThereANeighborChest(par1World,
    par2 + 1, par3, par4) ? false : (this.isThereANeighborChest(
    par1World, par2, par3, par4 - 1) ? false : !this
    .isThereANeighborChest(par1World, par2, par3, par4 + 1))));
    }
    
    /**
    * Checks the neighbor blocks to see if there is a chest there. Args: world,
    * x, y, z
    */
    private boolean isThereANeighborChest(World par1World, int par2, int par3,
    int par4) {
    return par1World.getBlock(par2, par3, par4) != this ? false
    : (par1World.getBlock(par2 - 1, par3, par4) == this ? true
    : (par1World.getBlock(par2 + 1, par3, par4) == this ? true
    : (par1World.getBlock(par2, par3, par4 - 1) == this ? true
    : par1World.getBlock(par2, par3,
    par4 + 1) == this)));
    }
    
    /**
    * Lets the block know when one of its neighbor changes. Doesn't know which
    * neighbor changed (coordinates passed are their own) Args: x, y, z,
    * neighbor blockID
    */
    public void onNeighborBlockChange(World par1World, int par2, int par3,
    int par4, Block par5) {
    super.onNeighborBlockChange(par1World, par2, par3, par4, par5);
    TileEntityCobaltChest tileentitychest = (TileEntityCobaltChest) par1World
    .getTileEntity(par2, par3, par4);
    
    if (tileentitychest != null) {
    tileentitychest.updateContainingBlockInfo();
    }
    }
    
    /**
    * Called on server worlds only when the block has been replaced by a
    * different block ID, or the same block with a different metadata value,
    * but before the new metadata value is set. Args: World, x, y, z, old block
    * ID, old metadata
    */
    public void breakBlock(World par1World, int par2, int par3, int par4,
    Block par5, int par6) {
    TileEntityCobaltChest tileentitychest = (TileEntityCobaltChest) par1World
    .getTileEntity(par2, par3, par4);
    
    if (tileentitychest != null) {
    for (int j1 = 0; j1 < tileentitychest.getSizeInventory(); ++j1) {
    ItemStack itemstack = tileentitychest.getStackInSlot(j1);
    
    if (itemstack != null) {
    float f = this.random.nextFloat() * 0.8F + 0.1F;
    float f1 = this.random.nextFloat() * 0.8F + 0.1F;
    EntityItem entityitem;
    
    for (float f2 = this.random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World
    .spawnEntityInWorld(entityitem)) {
    int k1 = this.random.nextInt(21) + 10;
    
    if (k1 > itemstack.stackSize) {
    k1 = itemstack.stackSize;
    }
    
    itemstack.stackSize -= k1;
    entityitem = new EntityItem(par1World,
    (double) ((float) par2 + f),
    (double) ((float) par3 + f1),
    (double) ((float) par4 + f2), new ItemStack(
    itemstack.getItem(), k1,
    itemstack.getItemDamage()));
    float f3 = 0.05F;
    entityitem.motionX = (double) ((float) this.random
    .nextGaussian() * f3);
    entityitem.motionY = (double) ((float) this.random
    .nextGaussian() * f3 + 0.2F);
    entityitem.motionZ = (double) ((float) this.random
    .nextGaussian() * f3);
    
    if (itemstack.hasTagCompound()) {
    entityitem.getEntityItem().setTagCompound(
    (NBTTagCompound) itemstack.getTagCompound()
    .copy());
    }
    }
    }
    }
    
    par1World.func_147453_f(par2, par3, par4, par5);
    }
    
    super.breakBlock(par1World, par2, par3, par4, par5, par6);
    }
    
    /**
    * Called upon block activation (right click on the block.)
    */
    public boolean onBlockActivated(World par1World, int par2, int par3,
    int par4, EntityPlayer par5EntityPlayer, int par6, float par7,
    float par8, float par9) {
    if (par1World.isRemote) {
    return true;
    } else {
    IInventory iinventory = this.getInventory(par1World, par2, par3,
    par4);
    
    if (iinventory != null) {
    par5EntityPlayer.displayGUIChest(iinventory);
    }
    
    return true;
    }
    }
    
    /**
    * Gets the inventory of the chest at the specified coords, accounting for
    * blocks or ocelots on top of the chest, and double chests.
    */
    public IInventory getInventory(World par1World, int par2, int par3, int par4) {
    Object object = (TileEntityCobaltChest) par1World.getTileEntity(par2,
    par3, par4);
    
    if (object == null) {
    return null;
    } else if (par1World.isSideSolid(par2, par3 + 1, par4, DOWN)) {
    return null;
    } else if (isOcelotBlockingChest(par1World, par2, par3, par4)) {
    return null;
    } else if (par1World.getBlock(par2 - 1, par3, par4) == this
    && (par1World.isSideSolid(par2 - 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(
    par1World, par2 - 1, par3, par4))) {
    return null;
    } else if (par1World.getBlock(par2 + 1, par3, par4) == this
    && (par1World.isSideSolid(par2 + 1, par3 + 1, par4, DOWN) || isOcelotBlockingChest(
    par1World, par2 + 1, par3, par4))) {
    return null;
    } else if (par1World.getBlock(par2, par3, par4 - 1) == this
    && (par1World.isSideSolid(par2, par3 + 1, par4 - 1, DOWN) || isOcelotBlockingChest(
    par1World, par2, par3, par4 - 1))) {
    return null;
    } else if (par1World.getBlock(par2, par3, par4 + 1) == this
    && (par1World.isSideSolid(par2, par3 + 1, par4 + 1, DOWN) || isOcelotBlockingChest(
    par1World, par2, par3, par4 + 1))) {
    return null;
    } else {
    if (par1World.getBlock(par2 - 1, par3, par4) == this) {
    object = new InventoryLargeChest("container.chestDouble",
    (TileEntityCobaltChest) par1World.getTileEntity(
    par2 - 1, par3, par4), (IInventory) object);
    }
    
    if (par1World.getBlock(par2 + 1, par3, par4) == this) {
    object = new InventoryLargeChest("container.chestDouble",
    (IInventory) object,
    (TileEntityCobaltChest) par1World.getTileEntity(
    par2 + 1, par3, par4));
    }
    
    if (par1World.getBlock(par2, par3, par4 - 1) == this) {
    object = new InventoryLargeChest("container.chestDouble",
    (TileEntityCobaltChest) par1World.getTileEntity(par2,
    par3, par4 - 1), (IInventory) object);
    }
    
    if (par1World.getBlock(par2, par3, par4 + 1) == this) {
    object = new InventoryLargeChest("container.chestDouble",
    (IInventory) object,
    (TileEntityCobaltChest) par1World.getTileEntity(par2,
    par3, par4 + 1));
    }
    
    return (IInventory) object;
    }
    }
    
    /**
    * Returns a new instance of a block's tile entity class. Called on placing
    * the block.
    */
    public TileEntity createNewTileEntity(World par1World) {
    TileEntityCobaltChest tileentitychest = new TileEntityCobaltChest();
    return tileentitychest;
    }
    
    /**
    * Can this block provide power. Only wire currently seems to have this
    * change based on its state.
    */
    public boolean canProvidePower() {
    return this.chestType == 1;
    }
    
    /**
    * Returns true if the block is emitting indirect/weak redstone power on the
    * specified side. If isBlockNormalCube returns true, standard redstone
    * propagation rules will apply instead and this will not be called. Args:
    * World, X, Y, Z, side. Note that the side is reversed - eg it is 1 (up)
    * when checking the bottom of the block.
    */
    public int isProvidingWeakPower(IBlockAccess par1IBlockAccess, int par2,
    int par3, int par4, int par5) {
    if (!this.canProvidePower()) {
    return 0;
    } else {
    int i1 = ((TileEntityCobaltChest) par1IBlockAccess.getTileEntity(
    par2, par3, par4)).numUsingPlayers;
    return MathHelper.clamp_int(i1, 0, 15);
    }
    }
    
    /**
    * Returns true if the block is emitting direct/strong redstone power on the
    * specified side. Args: World, X, Y, Z, side. Note that the side is
    * reversed - eg it is 1 (up) when checking the bottom of the block.
    */
    public int isProvidingStrongPower(IBlockAccess par1IBlockAccess, int par2,
    int par3, int par4, int par5) {
    return par5 == 1 ? this.isProvidingWeakPower(par1IBlockAccess, par2,
    par3, par4, par5) : 0;
    }
    
    /**
    * Looks for a sitting ocelot within certain bounds. Such an ocelot is
    * considered to be blocking access to the chest.
    */
    public static boolean isOcelotBlockingChest(World par0World, int par1,
    int par2, int par3) {
    Iterator<?> iterator = par0World.getEntitiesWithinAABB(
    EntityOcelot.class,
    AxisAlignedBB.getAABBPool().getAABB((double) par1,
    (double) (par2 + 1), (double) par3,
    (double) (par1 + 1), (double) (par2 + 2),
    (double) (par3 + 1))).iterator();
    EntityOcelot entityocelot;
    
    do {
    if (!iterator.hasNext()) {
    return false;
    }
    
    EntityOcelot entityocelot1 = (EntityOcelot) iterator.next();
    entityocelot = (EntityOcelot) entityocelot1;
    } while (!entityocelot.isSitting());
    
    return true;
    }
    
    /**
    * If this returns true, then comparators facing away from this block will
    * use the value from getComparatorInputOverride instead of the actual
    * redstone signal strength.
    */
    public boolean hasComparatorInputOverride() {
    return true;
    }
    
    /**
    * If hasComparatorInputOverride returns true, the return value from this is
    * used instead of the redstone signal strength when this block inputs to a
    * comparator.
    */
    public int getComparatorInputOverride(World par1World, int par2, int par3,
    int par4, int par5) {
    return Container.calcRedstoneFromInventory(this.getInventory(par1World,
    par2, par3, par4));
    }
    
    [MENTION=29904]Side[/MENTION]Only(Side.CLIENT)
    /**
    * When this method is called, your block should register all the icons it needs with the given IconRegister. This
    * is the only chance you get to register icons.
    */
    public void registerIcons(IIconRegister par1IconRegister) {
    this.blockIcon = par1IconRegister.registerIcon("planks_oak");
    }
    
    @Override
    public TileEntity createNewTileEntity(World var1, int var2) {
    // TODO Auto-generated method stub
    return new TileEntityCobaltChest();
    }
    }


    ClientProxyCobalt

    package cobaltmod.main;
    
    import java.util.Map;
    
    import net.minecraft.tileentity.TileEntity;
    import cobaltmod.entity.EntityCobaltArrow;
    import cobaltmod.entity.EntityCobaltGuardian;
    import cobaltmod.entity.EntityCobaltZombie;
    import cobaltmod.entity.ModelCobaltGuardian;
    import cobaltmod.entity.ModelCobaltZombie;
    import cobaltmod.entity.TileEntityAltar;
    import cobaltmod.entity.TileEntityCobaltChest;
    import cobaltmod.entity.TileEntityRitualStone;
    import cobaltmod.renderer.RenderAltar;
    import cobaltmod.renderer.RenderCobaltArrow;
    import cobaltmod.renderer.RenderCobaltChest;
    import cobaltmod.renderer.RenderCobaltGuardian;
    import cobaltmod.renderer.RenderCobaltZombie;
    import cobaltmod.renderer.RenderRitualStone;
    import cobaltmod.renderer.TileEntityCobaltChestRenderer;
    import cpw.mods.fml.client.registry.ClientRegistry;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    
    public class ClientProxyCobalt extends CommonProxyCobalt
    {
    @Override
    public int addArmor(String armor){
    return RenderingRegistry.addNewArmourRendererPrefix(armor);
    }
    
    
    
    public void AddRenderer(Map<?, ?> map)
    {
    //map.put(EntityCobaltArrow.class, new RenderCobaltArrow());
    }
    public void registerClientStuff()
    {
    RenderingRegistry.registerEntityRenderingHandler(EntityCobaltArrow.class, new RenderCobaltArrow());
    RenderingRegistry.registerEntityRenderingHandler(EntityCobaltZombie.class, new RenderCobaltZombie(new ModelCobaltZombie(), 0.3F));
    RenderingRegistry.registerEntityRenderingHandler(EntityCobaltGuardian.class, new RenderCobaltGuardian(new ModelCobaltGuardian(), 0.3F));
    RenderingRegistry.registerBlockHandler(new RenderAltar());
    RenderingRegistry.registerBlockHandler(new RenderRitualStone());
    RenderingRegistry.registerBlockHandler(new RenderCobaltChest());
    
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityAltar.class, new RenderAltar());
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityCobaltChest.class, new TileEntityCobaltChestRenderer());
    ClientRegistry.bindTileEntitySpecialRenderer(TileEntityRitualStone.class, new RenderRitualStone());
    
    TileEntity.addMapping(TileEntityCobaltChest.class, "CobaltChest");
    }
    }


    In terms of the picture, vanilla chests do that also sometimes.
    Posted in: Mapping and Modding Tutorials
  • 1

    posted a message on [1.8] MinecraftForge Video & Text Modding Tutorials [Updated May 2] Now in English and German
    Quote from wuppy21

    Yes. Simply create some kind of int or boolean in a config file and then simple set the texture according to that value. If you don't really know how to do it I suggest learning some more basic Java.


    I just figured it out on my own. I had to find a tutorial on config files, but after that I just used a boolean option for if the user wanted the tool to be tinted one color or the other. Then I just used the registerIcon() method for the item with a different result for true or false.
    Posted in: Mapping and Modding Tutorials
  • 1

    posted a message on [1.8] MinecraftForge Video & Text Modding Tutorials [Updated May 2] Now in English and German
    Quote from lightning_slash1

    My mod is crashing for some reason and I can not figure out how to fix it :'( please help!

    ---- Minecraft Crash Report ----
    // You're mean.

    Time: 9/19/13 7:10 PM
    Description: Initializing game

    java.lang.ArrayIndexOutOfBoundsException: 70266
    at net.minecraft.item.Item.(Item.java:265)
    at net.minecraft.item.ItemSword.(ItemSword.java:22)
    at finalFantasy.ItemSwords.(ItemSwords.java:15)
    at finalFantasy.FinalFantasy.load(FinalFantasy.java:233)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:540)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:194)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:174)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:105)
    at cpw.mods.fml.common.Loader.initializeMods(Loader.java:697)
    at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:232)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:506)
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:796)
    at net.minecraft.client.main.Main.main(Main.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:18)


    A detailed walkthrough of the error, its code path and all known details is as follows:
    ---------------------------------------------------------------------------------------

    -- Head --
    Stacktrace:
    at net.minecraft.item.Item.(Item.java:265)
    at net.minecraft.item.ItemSword.(ItemSword.java:22)
    at finalFantasy.ItemSwords.(ItemSwords.java:15)
    at finalFantasy.FinalFantasy.load(FinalFantasy.java:233)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:540)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:194)
    at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:174)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.google.common.eventbus.EventHandler.handleEvent(EventHandler.java:74)
    at com.google.common.eventbus.SynchronizedEventHandler.handleEvent(SynchronizedEventHandler.java:45)
    at com.google.common.eventbus.EventBus.dispatch(EventBus.java:313)
    at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:296)
    at com.google.common.eventbus.EventBus.post(EventBus.java:267)
    at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:105)
    at cpw.mods.fml.common.Loader.initializeMods(Loader.java:697)
    at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:232)
    at net.minecraft.client.Minecraft.startGame(Minecraft.java:506)

    -- Initialization --
    Details:
    Stacktrace:
    at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:796)
    at net.minecraft.client.main.Main.main(Main.java:93)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:57)
    at net.minecraft.launchwrapper.Launch.main(Launch.java:18)

    -- System Details --
    Details:
    Minecraft Version: 1.6.2
    Operating System: Windows 8 (amd64) version 6.2
    Java Version: 1.7.0_25, Oracle Corporation
    Java VM Version: Java HotSpot™ 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 973036416 bytes (927 MB) / 1056309248 bytes (1007 MB) up to 1056309248 bytes (1007 MB)
    JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M
    AABB Pool Size: 0 (0 bytes; 0 MB) allocated, 0 (0 bytes; 0 MB) used
    Suspicious classes: FML and Forge are installed
    IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0
    FML: MCP v8.04 FML v6.2.35.804 Minecraft Forge 9.10.0.804 4 mods loaded, 4 mods active
    mcp{8.04} [Minecraft Coder Pack] (minecraft.jar) Unloaded->Constructed->Pre-initialized->Initialized
    FML{6.2.35.804} [Forge Mod Loader] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
    Forge{9.10.0.804} [Minecraft Forge] (coremods) Unloaded->Constructed->Pre-initialized->Initialized
    turcotte1_FinalFantasy{1.0} [Final Fantasy Mod] (bin) Unloaded->Constructed->Pre-initialized->Errored
    Launched Version: 1.6
    LWJGL: 2.9.0
    OpenGL: Intel® HD Graphics 4000 GL version 4.0.0 - Build 9.17.10.2963, Intel
    Is Modded: Definitely; Client brand changed to 'fml,forge'
    Type: Client (map_client.txt)
    Resource Pack: Default
    Current Language: English (US)
    Profiler Position: N/A (disabled)
    Vec3 Pool Size: ~~ERROR~~ NullPointerException: null


    Can you show us FinalFantasy.java and ItemSwords.java? those are the only two non-vanilla classes in the crash report.

    The reason for the crash also gives a clue. ArrayIndexOutOfBoundsException means you tried to find, for example, the fourth item in a group of three.
    Posted in: Mapping and Modding Tutorials
  • 1

    posted a message on [1.8] MinecraftForge Video & Text Modding Tutorials [Updated May 2] Now in English and German
    Quote from ApoloD

    How Create a 3D item? for Example a Sword, I need add a 3D Sword in my mod, As i do (I need the code, model the swords is very easy), and the code for put the Sword in the hand of Steve, but only if you can, but only the code for the sword to add...

    check iChun's tutorial for 3d items. It's on YouTube
    Posted in: Mapping and Modding Tutorials
  • To post a comment, please .