Jump to content

Dropping wrong metadata item


AzureusNation123

Recommended Posts

Ive got a issue with my Cloud Capsule, ive got it to fill up when u go above Y:128 but when its been filling up and you drop it, it gives you back the first metadata item instead of 1,2,3,4,5,6,7,8,9,10.

 

Heres my CloudCapsule Code:

 

 

package skycraft.items;

 

import java.util.List;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import skycraft.SkyCraft;

import skycraft.core.common.CommonProxySkyCraft;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.util.MathHelper;

 

public class ItemCloudCapsule extends Item

{

public static final String[] cloudCapsule = new String[] {"", " : 1", " : 2", " : 3", " : 4", " : 5", " : 6", " : 7", " : 8", " : 9", " : 10"};

 

public ItemCloudCapsule(int id)

{

super(id);

this.setCreativeTab(SkyCraft.tabSkyCraftItems);

this.setMaxDamage(0);

this.setHasSubtypes(true);

this.setIconCoord(3, 0);

this.setItemName("Cloud Capsules");

}

 

@SideOnly(Side.CLIENT)

    public int getIconFromDamage(int par1)

    {

        int var2 = MathHelper.clamp_int(par1, 0, 10);

        return this.iconIndex + var2 % 1 * 1 + var2 / 1;

    }

 

@Override

public String getItemNameIS(ItemStack itemstack) {

return getItemName() + "." + cloudCapsule[itemstack.getItemDamage()];

}

 

@SideOnly(Side.CLIENT)

public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)

{

    for (int var2 = 0; var2 < 11; ++var2)

    {

        par3List.add(new ItemStack(par1, 1, var2));

        }

}

 

public String getTextureFile()

    {

            return CommonProxySkyCraft.Items_PNG;

    }

}

 

 

 

And also heres my tickupdate for this item:

 

 

package skycraft.core.client;

 

import java.util.EnumSet;

 

import net.minecraft.client.Minecraft;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.ItemStack;

import skycraft.SkyCraftItems;

import cpw.mods.fml.client.FMLClientHandler;

import cpw.mods.fml.common.ITickHandler;

import cpw.mods.fml.common.TickType;

 

public class CloudCollecterHandler implements ITickHandler {

 

@Override

public void tickStart(EnumSet<TickType> type, Object... tickData)

{

 

}

 

int ticker = 0;

@Override

public void tickEnd(EnumSet<TickType> type, Object... tickData)

{

Minecraft minecraft = FMLClientHandler.instance().getClient();

        EntityPlayer player = minecraft.thePlayer;

        ItemStack itemStack = null;

       

        if(player!= null)

        {

        itemStack = player.inventory.getCurrentItem();

        if(itemStack != null)

        {

        if(player.posY >= 128 && minecraft.inGameHasFocus && itemStack.getItem() == SkyCraftItems.cloudCapsule)

            {

        if(itemStack.getItemDamage() < 10 && ticker == 80)

        {

        itemStack.setItemDamage(itemStack.getItemDamage() + 1);

        ticker = 0;

        }

        else

        ticker++;

            }

        else

        ticker = 0;

        }

        }

}

 

@Override

public EnumSet<TickType> ticks()

{

return EnumSet.of(TickType.CLIENT, TickType.CLIENTGUI, TickType.RENDER);

}

 

@Override

public String getLabel()

{

return null;

}

 

}

 

 

 

thanks in advance

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.



×
×
  • Create New...

Important Information

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