Jump to content

Recommended Posts

Posted

hi guys, ive been playing around with custom block renders and block animations(like buildcraft engines). i have a block that when powered by redstone part of it moves, however, all the blocks of that type move including the one in my inventory, how do i make this model only affect one block?

 

Posted

 

Model File:

 

 

package naturemod.client.models;

 

import net.minecraft.client.model.ModelBase;

import net.minecraft.client.model.ModelRenderer;

import net.minecraft.entity.Entity;

 

public class ModelGrinder extends ModelBase

{

  //fields

    ModelRenderer Base;

    ModelRenderer Pilar;

    ModelRenderer Pilar1;

    ModelRenderer Pilar2;

    ModelRenderer Pilar3;

    ModelRenderer Pole;

    public static ModelRenderer GrindWheel;

    public static ModelRenderer GrindWheel1;

    ModelRenderer Hopper;

    ModelRenderer HopperSide;

    ModelRenderer HopperSide1;

    ModelRenderer HopperSide2;

    ModelRenderer HopperSide3;

    ModelRenderer Strut;

    ModelRenderer StrutTop;

    ModelRenderer Strut1;

    ModelRenderer StrutTop1;

    ModelRenderer Strut2;

    ModelRenderer Strut3;

    ModelRenderer StrutTop3;

    ModelRenderer StrutTop2;

    ModelRenderer Item;

 

  public ModelGrinder()

  {

    textureWidth = 128;

    textureHeight = 64;

   

      Base = new ModelRenderer(this, 0, 0);

      Base.addBox(0F, 0F, 0F, 16, 3, 16);

      Base.setRotationPoint(-8F, 21F, -8F);

      Base.setTextureSize(128, 64);

      Base.mirror = true;

      setRotation(Base, 0F, 0F, 0F);

      Pilar = new ModelRenderer(this, 0, 32);

      Pilar.addBox(0F, 0F, 0F, 14, 2, 1);

      Pilar.setRotationPoint(-7F, 19F, 6.5F);

      Pilar.setTextureSize(128, 64);

      Pilar.mirror = true;

      setRotation(Pilar, 0F, 0F, 0F);

      Pilar1 = new ModelRenderer(this, 0, 32);

      Pilar1.addBox(0F, 0F, 0F, 1, 2, 14);

      Pilar1.setRotationPoint(6.5F, 19F, -7F);

      Pilar1.setTextureSize(128, 64);

      Pilar1.mirror = true;

      setRotation(Pilar1, 0F, 0F, 0F);

      Pilar2 = new ModelRenderer(this, 0, 32);

      Pilar2.addBox(0F, 0F, 0F, 14, 2, 1);

      Pilar2.setRotationPoint(-7F, 19F, -7.5F);

      Pilar2.setTextureSize(128, 64);

      Pilar2.mirror = true;

      setRotation(Pilar2, 0F, 0F, 0F);

      Pilar3 = new ModelRenderer(this, 0, 32);

      Pilar3.addBox(0F, 0F, 0F, 1, 2, 14);

      Pilar3.setRotationPoint(-7.5F, 19F, -7F);

      Pilar3.setTextureSize(128, 64);

      Pilar3.mirror = true;

      setRotation(Pilar3, 0F, 0F, 0F);

      Pole = new ModelRenderer(this, 44, 19);

      Pole.addBox(0F, 0F, 0F, 2, 7, 2);

      Pole.setRotationPoint(-1F, 14F, -1F);

      Pole.setTextureSize(128, 64);

      Pole.mirror = true;

      setRotation(Pole, 0F, 0F, 0F);

      GrindWheel = new ModelRenderer(this, 0, 19);

      GrindWheel.addBox(-5.5F, 0F, -5.5F, 11, 2, 11);

      GrindWheel.setRotationPoint(0F, 17F, 0F);

      GrindWheel.setTextureSize(128, 64);

      GrindWheel.mirror = true;

      setRotation(GrindWheel, 0F, 0F, 0F);

      GrindWheel1 = new ModelRenderer(this, 0, 19);

      GrindWheel1.addBox(-5.5F, 0F, -5.5F, 11, 2, 11);

      GrindWheel1.setRotationPoint(0F, 14.8F, 0F);

      GrindWheel1.setTextureSize(128, 64);

      GrindWheel1.mirror = true;

      setRotation(GrindWheel1, 0F, 0F, 0F);

      Hopper = new ModelRenderer(this, 52, 19);

      Hopper.addBox(0F, 0F, 0F, 6, 1, 6);

      Hopper.setRotationPoint(-3F, 13F, -3F);

      Hopper.setTextureSize(128, 64);

      Hopper.mirror = true;

      setRotation(Hopper, 0F, 0F, 0F);

      HopperSide = new ModelRenderer(this, 30, 32);

      HopperSide.addBox(0F, 0F, 0F, 1, 4, 7);

      HopperSide.setRotationPoint(-4F, 10F, -3F);

      HopperSide.setTextureSize(128, 64);

      HopperSide.mirror = true;

      setRotation(HopperSide, 0F, 0F, 0F);

      HopperSide1 = new ModelRenderer(this, 30, 32);

      HopperSide1.addBox(0F, 0F, 0F, 1, 4, 7);

      HopperSide1.setRotationPoint(3F, 10F, -4F);

      HopperSide1.setTextureSize(128, 64);

      HopperSide1.mirror = true;

      setRotation(HopperSide1, 0F, 0F, 0F);

      HopperSide2 = new ModelRenderer(this, 30, 32);

      HopperSide2.addBox(0F, 0F, 0F, 7, 4, 1);

      HopperSide2.setRotationPoint(-4F, 10F, -4F);

      HopperSide2.setTextureSize(128, 64);

      HopperSide2.mirror = true;

      setRotation(HopperSide2, 0F, 0F, 0F);

      HopperSide3 = new ModelRenderer(this, 30, 32);

      HopperSide3.addBox(0F, 0F, 0F, 7, 4, 1);

      HopperSide3.setRotationPoint(-3F, 10F, 3F);

      HopperSide3.setTextureSize(128, 64);

      HopperSide3.mirror = true;

      setRotation(HopperSide3, 0F, 0F, 0F);

      Strut = new ModelRenderer(this, 64, 0);

      Strut.addBox(0F, 0F, 0F, 1, 10, 2);

      Strut.setRotationPoint(7F, 11F, -1F);

      Strut.setTextureSize(128, 64);

      Strut.mirror = true;

      setRotation(Strut, 0F, 0F, 0F);

      StrutTop = new ModelRenderer(this, 70, 0);

      StrutTop.addBox(0F, 0F, 0F, 4, 1, 2);

      StrutTop.setRotationPoint(3F, 11F, -1F);

      StrutTop.setTextureSize(128, 64);

      StrutTop.mirror = true;

      setRotation(StrutTop, 0F, 0F, 0F);

      Strut1 = new ModelRenderer(this, 64, 0);

      Strut1.addBox(0F, 0F, 0F, 1, 10, 2);

      Strut1.setRotationPoint(-8F, 11F, -1F);

      Strut1.setTextureSize(128, 64);

      Strut1.mirror = true;

      setRotation(Strut1, 0F, 0F, 0F);

      StrutTop1 = new ModelRenderer(this, 70, 0);

      StrutTop1.addBox(0F, 0F, 0F, 4, 1, 2);

      StrutTop1.setRotationPoint(-7F, 11F, -1F);

      StrutTop1.setTextureSize(128, 64);

      StrutTop1.mirror = true;

      setRotation(StrutTop1, 0F, 0F, 0F);

      Strut2 = new ModelRenderer(this, 64, 0);

      Strut2.addBox(0F, 0F, 0F, 2, 10, 1);

      Strut2.setRotationPoint(-1F, 11F, -8F);

      Strut2.setTextureSize(128, 64);

      Strut2.mirror = true;

      setRotation(Strut2, 0F, 0F, 0F);

      Strut3 = new ModelRenderer(this, 64, 0);

      Strut3.addBox(0F, 0F, 0F, 2, 10, 1);

      Strut3.setRotationPoint(-1F, 11F, 7F);

      Strut3.setTextureSize(128, 64);

      Strut3.mirror = true;

      setRotation(Strut3, 0F, 0F, 0F);

      StrutTop3 = new ModelRenderer(this, 70, 0);

      StrutTop3.addBox(0F, 0F, 0F, 2, 1, 4);

      StrutTop3.setRotationPoint(-1F, 11F, 3F);

      StrutTop3.setTextureSize(128, 64);

      StrutTop3.mirror = true;

      setRotation(StrutTop3, 0F, 0F, 0F);

      StrutTop2 = new ModelRenderer(this, 70, 0);

      StrutTop2.addBox(0F, 0F, 0F, 2, 1, 4);

      StrutTop2.setRotationPoint(-1F, 11F, -7F);

      StrutTop2.setTextureSize(128, 64);

      StrutTop2.mirror = true;

      setRotation(StrutTop2, 0F, 0F, 0F);

      Item = new ModelRenderer(this, 64, 12);

      Item.addBox(0F, 0F, 0F, 6, 1, 6);

      Item.setRotationPoint(-3F, 11F, -3F);

      Item.setTextureSize(128, 64);

      Item.mirror = true;

      setRotation(Item, 0F, 0F, 0F);

  }

 

  public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)

  {

    super.render(entity, f, f1, f2, f3, f4, f5);

    setRotationAngles(f, f1, f2, f3, f4, f5, entity);

    Base.render(f5);

    Pilar.render(f5);

    Pilar1.render(f5);

    Pilar2.render(f5);

    Pilar3.render(f5);

    Pole.render(f5);

    GrindWheel.render(f5);

    GrindWheel1.render(f5);

    Hopper.render(f5);

    HopperSide.render(f5);

    HopperSide1.render(f5);

    HopperSide2.render(f5);

    HopperSide3.render(f5);

    Strut.render(f5);

    StrutTop.render(f5);

    Strut1.render(f5);

    StrutTop1.render(f5);

    Strut2.render(f5);

    Strut3.render(f5);

    StrutTop3.render(f5);

    StrutTop2.render(f5);

    Item.render(f5);

  }

 

  private void setRotation(ModelRenderer model, float x, float y, float z)

  {

    model.rotateAngleX = x;

    model.rotateAngleY = y;

    model.rotateAngleZ = z;

  }

 

  public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)

  {

    super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);

  }

 

  public void renderModel(float f1)

  {

    Base.render(f1);

    Pilar.render(f1);

    Pilar1.render(f1);

    Pilar2.render(f1);

    Pilar3.render(f1);

    Pole.render(f1);

    GrindWheel.render(f1);

    GrindWheel1.render(f1);

    Hopper.render(f1);

    HopperSide.render(f1);

    HopperSide1.render(f1);

    HopperSide2.render(f1);

    HopperSide3.render(f1);

    Strut.render(f1);

    StrutTop.render(f1);

    Strut1.render(f1);

    StrutTop1.render(f1);

    Strut2.render(f1);

    Strut3.render(f1);

    StrutTop3.render(f1);

    StrutTop2.render(f1);

    Item.render(f1);

  }

 

}

 

 

 

Render File:

 

 

package naturemod.client.renders;

 

import naturemod.client.models.ModelGrinder;

import naturemod.common.blocks.TileEntityGrinder;

import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;

import net.minecraft.tileentity.TileEntity;

 

import org.lwjgl.opengl.GL11;

 

public class RenderGrinder extends TileEntitySpecialRenderer

{

private ModelGrinder aModel;

 

public RenderGrinder()

{

aModel = new ModelGrinder();

}

 

public void renderAModelAt(TileEntityGrinder tileEntity, double d, double d1, double d2, float f)

{

GL11.glPushMatrix();

GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F);

GL11.glRotatef(180, 0F, 0F, 1F);

bindTextureByName("/warpcraft/blocks/Grinder.png");

GL11.glPushMatrix();

aModel.renderModel(0.0625F);

GL11.glPopMatrix();

GL11.glPopMatrix();

}

 

public boolean shouldRender3DInInventory()

{

    // This is where it asks if you want the renderInventory part called or not.

    return true; // Change to 'true' if you want the Inventory render to be called.

}

 

public void renderTileEntityAt(TileEntity tileEntity, double var2, double var4, double var6, float var8)

{

this.renderAModelAt((TileEntityGrinder)tileEntity, var2, var4, var6, var8);

}

}

 

 

 

Block File:

 

 

package naturemod.common.blocks;

 

import java.util.Random;

 

import naturemod.common.Nature;

import net.minecraft.block.Block;

import net.minecraft.block.BlockContainer;

import net.minecraft.block.material.Material;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.tileentity.TileEntity;

import net.minecraft.tileentity.TileEntityFurnace;

import net.minecraft.tileentity.TileEntityNote;

import net.minecraft.util.AxisAlignedBB;

import net.minecraft.world.World;

 

public class BlockGrinder extends BlockContainer

{

 

public BlockGrinder(int id)

{

super(id, Material.rock);

setHardness(3.0f);

 

setBlockName("Grinder");

blockIndexInTexture = 1;

 

//this.setRequiresSelfNotify();

//disableStats();

 

this.setCreativeTab(Nature.natureTab);

}

 

public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4, Block block)

    {

return null;

    }

 

public boolean isOpaqueCube()

    {

        return false;

    }

 

@Override

public boolean renderAsNormalBlock()

{

return false;

}

 

@Override

public int getRenderType()

{

return -1;

}

 

public TileEntity createNewTileEntity(World var1)

{

return new TileEntityGrinder();

}

 

 

public TileEntity getBlockEntity()

{

try{

return (TileEntity)TileEntityGrinder.class.newInstance();

}

catch(Exception exception){

throw new RuntimeException(exception);

}

}

 

 

public void onNeighborBlockChange(World world, int i, int j, int k, int l)

    {

        if(l > 0 && Block.blocksList[l].canProvidePower())

        {

                world.scheduleBlockUpdate(i, j, k, blockID, tickRate());

        }

    }

 

    public void updateTick(World world, int i, int j, int k, Random random)

    {

        if(!world.editingBlocks && (world.isBlockIndirectlyGettingPowered(i, j, k) || world.isBlockIndirectlyGettingPowered(i, j + 1, k)))

        {

        Nature.powered = true;

        }else

        {

        Nature.powered = false;

        }

    }

 

    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

        {

            TileEntityGrinder var10 = (TileEntityGrinder)par1World.getBlockTileEntity(par2, par3, par4);

 

            if (var10 != null)

            {

            par5EntityPlayer.openGui(Nature.instance, 0, par1World, par2, par3, par4);

            }

 

            return true;

        }

    }

}

 

 

 

 

say if you need any more

 

Posted

You didn't show us your TileEntityGrinder.class

 

In the BlockContainer.class there is a method called onBlockEventReceived that you might try using. Also you might try looking at how chests work. :) Hope this helps.

 

Posted

here is the tile entity, and unfortunatly, i could get it to work with those suggestions

 

 

 

package naturemod.common.blocks;

 

import naturemod.common.Nature;

import naturemod.common.recipes.GrinderRecipes;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.inventory.IInventory;

import net.minecraft.item.Item;

import net.minecraft.item.ItemBlock;

import net.minecraft.item.ItemHoe;

import net.minecraft.item.ItemStack;

import net.minecraft.item.ItemSword;

import net.minecraft.item.ItemTool;

import net.minecraft.nbt.NBTTagCompound;

import net.minecraft.nbt.NBTTagList;

import net.minecraft.tileentity.TileEntity;

import net.minecraftforge.common.ForgeDirection;

import net.minecraftforge.common.ISidedInventory;

import cpw.mods.fml.common.registry.GameRegistry;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class TileEntityGrinder extends TileEntity implements IInventory, ISidedInventory

{

 

    /**

    * The ItemStacks that hold the items currently being used in the grinder

    */

    private ItemStack[] grinderItemStacks = new ItemStack[3];

 

    /** The number of ticks that the grinder will keep burning */

    public int grinderBurnTime = -1;

 

    /**

    * The number of ticks that a fresh copy of the currently-burning item would keep the grinder burning for

    */

    public int currentItemBurnTime = -1;

 

    /** The number of ticks that the current item has been cooking for */

    public static int grinderCookTime = 0;

 

public String getInvName()

    {

        return "container.grinder";

    }

 

    /**

    * Returns the number of slots in the inventory.

    */

    public int getSizeInventory()

    {

        return this.grinderItemStacks.length;

    }

    /**

    * Returns the stack in slot i

    */

    public ItemStack getStackInSlot(int par1)

    {

        return this.grinderItemStacks[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.grinderItemStacks[par1] != null)

        {

            ItemStack var3;

 

            if (this.grinderItemStacks[par1].stackSize <= par2)

            {

                var3 = this.grinderItemStacks[par1];

                this.grinderItemStacks[par1] = null;

                return var3;

            }

            else

            {

                var3 = this.grinderItemStacks[par1].splitStack(par2);

 

                if (this.grinderItemStacks[par1].stackSize == 0)

                {

                    this.grinderItemStacks[par1] = null;

                }

 

                return var3;

            }

        }

        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.grinderItemStacks[par1] != null)

        {

            ItemStack var2 = this.grinderItemStacks[par1];

            this.grinderItemStacks[par1] = null;

            return var2;

        }

        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.grinderItemStacks[par1] = par2ItemStack;

 

        if (par2ItemStack != null && par2ItemStack.stackSize > this.getInventoryStackLimit())

        {

            par2ItemStack.stackSize = this.getInventoryStackLimit();

        }

    }

 

    /**

    * Reads a tile entity from NBT.

    */

    public void readFromNBT(NBTTagCompound par1NBTTagCompound)

    {

        super.readFromNBT(par1NBTTagCompound);

        NBTTagList var2 = par1NBTTagCompound.getTagList("Items");

        this.grinderItemStacks = new ItemStack[this.getSizeInventory()];

 

        for (int var3 = 0; var3 < var2.tagCount(); ++var3)

        {

            NBTTagCompound var4 = (NBTTagCompound)var2.tagAt(var3);

            byte var5 = var4.getByte("Slot");

 

            if (var5 >= 0 && var5 < this.grinderItemStacks.length)

            {

                this.grinderItemStacks[var5] = ItemStack.loadItemStackFromNBT(var4);

            }

        }

 

        this.grinderBurnTime = par1NBTTagCompound.getShort("BurnTime");

        this.grinderCookTime = par1NBTTagCompound.getShort("CookTime");

        this.currentItemBurnTime = getItemBurnTime(this.grinderItemStacks[1]);

    }

 

    /**

    * Writes a tile entity to NBT.

    */

    public void writeToNBT(NBTTagCompound par1NBTTagCompound)

    {

        super.writeToNBT(par1NBTTagCompound);

        par1NBTTagCompound.setShort("BurnTime", (short)this.grinderBurnTime);

        par1NBTTagCompound.setShort("CookTime", (short)this.grinderCookTime);

        NBTTagList var2 = new NBTTagList();

 

        for (int var3 = 0; var3 < this.grinderItemStacks.length; ++var3)

        {

            if (this.grinderItemStacks[var3] != null)

            {

                NBTTagCompound var4 = new NBTTagCompound();

                var4.setByte("Slot", (byte)var3);

                this.grinderItemStacks[var3].writeToNBT(var4);

                var2.appendTag(var4);

            }

        }

 

        par1NBTTagCompound.setTag("Items", var2);

    }

 

    /**

    * 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;

    }

 

    @SideOnly(Side.CLIENT)

 

    /**

    * Returns an integer between 0 and the passed value representing how close the current item is to being completely

    * cooked

    */

    public int getCookProgressScaled(int par1)

    {

        return this.grinderCookTime * par1 / 200;

    }

 

    @SideOnly(Side.CLIENT)

 

    /**

    * Returns an integer between 0 and the passed value representing how much burn time is left on the current fuel

    * item, where 0 means that the item is exhausted and the passed value means that the item is fresh

    */

    public int getBurnTimeRemainingScaled(int par1)

    {

        if (this.currentItemBurnTime == 0)

        {

            this.currentItemBurnTime = 200;

        }

 

        return this.grinderBurnTime * par1 / this.currentItemBurnTime;

    }

 

    /**

    * Returns true if the grinder is currently burning

    */

    public boolean isBurning()

    {

        return this.grinderBurnTime > 0;

    }

 

    /**

    * 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()

    {

        boolean var1 = this.grinderBurnTime < 0;

        boolean var2 = false;

 

        if (this.grinderBurnTime < 0)

        {

            --this.grinderBurnTime;

        }

 

        if (!this.worldObj.isRemote)

        {

            if (this.grinderCookTime > 0)

            {

            Nature.powered = true;

            }else

            {

            Nature.powered = false;

            }

           

        /*

            if (this.grinderBurnTime == 0 && this.canSmelt())

            {

 

                if (this.grinderBurnTime < 0)

                {

                    var2 = true;

 

                    if (this.grinderItemStacks[1] != null)

                    {

                        --this.grinderItemStacks[1].stackSize;

 

                        if (this.grinderItemStacks[1].stackSize == 0)

                        {

                            this.grinderItemStacks[1] = this.grinderItemStacks[1].getItem().getContainerItemStack(grinderItemStacks[1]);

                        }

                    }

                }

            }

            */

 

            if (this.canSmelt())

            {

                ++this.grinderCookTime;

 

                if (this.grinderCookTime == 200)

                {

                    this.grinderCookTime = 0;

                    this.smeltItem();

                    var2 = true;

                }

            }

            else

            {

                this.grinderCookTime = 0;

            }

 

            if (var1 != this.grinderBurnTime > 0)

            {

                var2 = true;

            }

        }

 

        if (var2)

        {

            this.onInventoryChanged();

        }

    }

 

    /**

    * Returns true if the grinder can smelt an item, i.e. has a source item, destination stack isn't full, etc.

    */

    private boolean canSmelt()

    {

        if (this.grinderItemStacks[0] == null)

        {

            return false;

        }

        else

        {

            ItemStack var1 = GrinderRecipes.smelting().getSmeltingResult(this.grinderItemStacks[0]);

            if (var1 == null) return false;

            if (this.grinderItemStacks[2] == null) return true;

            if (!this.grinderItemStacks[2].isItemEqual(var1)) return false;

            int result = grinderItemStacks[2].stackSize + var1.stackSize;

            return (result <= getInventoryStackLimit() && result <= var1.getMaxStackSize());

        }

    }

 

    /**

    * Turn one item from the grinder source stack into the appropriate smelted item in the grinder result stack

    */

    public void smeltItem()

    {

        if (this.canSmelt())

        {

            ItemStack var1 = GrinderRecipes.smelting().getSmeltingResult(this.grinderItemStacks[0]);

 

            if (this.grinderItemStacks[2] == null)

            {

                this.grinderItemStacks[2] = var1.copy();

            }

            else if (this.grinderItemStacks[2].isItemEqual(var1))

            {

                grinderItemStacks[2].stackSize += var1.stackSize;

            }

 

            --this.grinderItemStacks[0].stackSize;

 

            if (this.grinderItemStacks[0].stackSize <= 0)

            {

                this.grinderItemStacks[0] = null;

            }

        }

    }

 

    /**

    * Returns the number of ticks that the supplied fuel item will keep the grinder burning, or 0 if the item isn't

    * fuel

    */

    public static int getItemBurnTime(ItemStack par0ItemStack)

    {

        if (par0ItemStack == null)

        {

            return 0;

        }

        else

        {

            int var1 = par0ItemStack.getItem().shiftedIndex;

            Item var2 = par0ItemStack.getItem();

 

            if (par0ItemStack.getItem() instanceof ItemBlock && Block.blocksList[var1] != null)

            {

                Block var3 = Block.blocksList[var1];

 

                if (var3 == Block.woodSingleSlab)

                {

                    return 150;

                }

 

                if (var3.blockMaterial == Material.wood)

                {

                    return 300;

                }

            }

 

            if (var2 instanceof ItemTool && ((ItemTool) var2).getToolMaterialName().equals("WOOD")) return 200;

            if (var2 instanceof ItemSword && ((ItemSword) var2).func_77825_f().equals("WOOD")) return 200;

            if (var2 instanceof ItemHoe && ((ItemHoe) var2).func_77842_f().equals("WOOD")) return 200;

            if (var1 == Item.stick.shiftedIndex) return 100;

            if (var1 == Item.coal.shiftedIndex) return 1600;

            if (var1 == Item.bucketLava.shiftedIndex) return 20000;

            if (var1 == Block.sapling.blockID) return 100;

            if (var1 == Item.blazeRod.shiftedIndex) return 2400;

            return GameRegistry.getFuelValue(par0ItemStack);

        }

    }

 

    /**

    * Return true if item is a fuel source (getItemBurnTime() > 0).

    */

    public static boolean isItemFuel(ItemStack par0ItemStack)

    {

        return getItemBurnTime(par0ItemStack) > 0;

    }

 

    /**

    * Do not make give this method the name canInteractWith because it clashes with Container

    */

    public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)

    {

        return this.worldObj.getBlockTileEntity(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;

    }

 

    public void openChest() {}

 

    public void closeChest() {}

 

    @Override

    public int getStartInventorySide(ForgeDirection side)

    {

        if (side == ForgeDirection.DOWN) return 1;

        if (side == ForgeDirection.UP) return 0;

        return 2;

    }

 

    @Override

    public int getSizeInventorySide(ForgeDirection side)

    {

        return 1;

    }

}

 

 

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



×
×
  • Create New...

Important Information

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