Jump to content

change the texture of a custome item on rigth click.


perromercenary00

Recommended Posts

good days

bad english advertishment

 

i have like two days triying to figure this.

 

a have a vara and i wand to charge this vara after shot ind a want it to change their look on the charge process so i take the bow for starting point , the bow change skin on charge using skins named bow__standby.png, bow_pulling_0.png, bow_pulling_1.png, bow_pulling_2.png

soo i create mi textures for mi vara in mi textures folder modmercenario/textures/items/

 

varamercenaria00_pulling_0.png

varamercenaria00_pulling_1.png

varamercenaria00_pulling_2.png

varamercenaria00_standby.png

 

but minecraft refuses to load mi textures and insist in search in minecraft textures folder

06:47:15] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/items/varamercenaria00_pulling_0.png

 

it mus be something like  modmercenario:textures/items/varamercenaria00_pulling_0.png

 

where is mi wrong doing ??

 

 

the code of mi vara

 

//##############################################################################

 

package mercenary00.mercenarymod.items;

 

 

import java.io.IOException;

 

import net.minecraft.init.Items;

import mercenary00.mercenarymod.utilidades.cfg;

import net.minecraft.item.EnumAction;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import mercenary00.mercenarymod.Mercenary;

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

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.block.Block;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.Item;

import net.minecraft.util.IChatComponent;

import net.minecraft.util.IIcon;

import net.minecraft.util.MovingObjectPosition;

import net.minecraft.world.World;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.entity.player.ArrowNockEvent;

import mercenary00.mercenarymod.utilidades.util;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.enchantment.Enchantment;

import net.minecraft.enchantment.EnchantmentHelper;

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.entity.projectile.EntityArrow;

import net.minecraft.init.Items;

import net.minecraft.util.IIcon;

import net.minecraft.world.World;

import net.minecraftforge.common.MinecraftForge;

import net.minecraftforge.event.entity.player.ArrowLooseEvent;

import net.minecraftforge.event.entity.player.ArrowNockEvent;

 

 

public class varaMercenaria00 extends Item{

 

public static String name="varamercenaria00";

public static final String[] bowPullIconNameArray = new String[] {"pulling_0", "pulling_1", "pulling_2"};

@SideOnly(Side.CLIENT)

private IIcon[] iconArray;

private static final String __OBFID = "CL_00001777";

 

 

//#############################################################################################

public varaMercenaria00() {

setUnlocalizedName(Mercenary.MODID + "_" + name);

GameRegistry.registerItem(this, name);

setCreativeTab(CreativeTabs.tabTools);

//  setTextureName(Mercenary.MODID + ":" + name);

    this.maxStackSize = 1;

    this.setMaxDamage(500);

    this.setCreativeTab(CreativeTabs.tabCombat);

 

 

}

//#############################################################################################

//#############################################################################################

 

 

 

 

    public void onPlayerStoppedUsing(ItemStack p_77615_1_, World p_77615_2_, EntityPlayer p_77615_3_, int p_77615_4_)

    {

        int j = this.getMaxItemUseDuration(p_77615_1_) - p_77615_4_;

 

        ArrowLooseEvent event = new ArrowLooseEvent(p_77615_3_, p_77615_1_, j);

        MinecraftForge.EVENT_BUS.post(event);

        if (event.isCanceled())

        {

            return;

        }

        j = event.charge;

 

        boolean flag = p_77615_3_.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, p_77615_1_) > 0;

 

        if (flag || p_77615_3_.inventory.hasItem(Items.arrow))

        {

            float f = (float)j / 20.0F;

            f = (f * f + f * 2.0F) / 3.0F;

 

            if ((double)f < 0.1D)

            {

                return;

            }

 

            if (f > 1.0F)

            {

                f = 1.0F;

            }

 

            EntityArrow entityarrow = new EntityArrow(p_77615_2_, p_77615_3_, f * 2.0F);

 

            if (f == 1.0F)

            {

                entityarrow.setIsCritical(true);

            }

 

            int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, p_77615_1_);

 

            if (k > 0)

            {

                entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);

            }

 

            int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, p_77615_1_);

 

            if (l > 0)

            {

                entityarrow.setKnockbackStrength(l);

            }

 

            if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, p_77615_1_) > 0)

            {

                entityarrow.setFire(100);

            }

 

            p_77615_1_.damageItem(1, p_77615_3_);

            p_77615_2_.playSoundAtEntity(p_77615_3_, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

 

            if (flag)

            {

                entityarrow.canBePickedUp = 2;

            }

            else

            {

                p_77615_3_.inventory.consumeInventoryItem(Items.arrow);

            }

 

            if (!p_77615_2_.isRemote)

            {

                p_77615_2_.spawnEntityInWorld(entityarrow);

            }

        }

    }

 

 

    public ItemStack onEaten(ItemStack p_77654_1_, World p_77654_2_, EntityPlayer p_77654_3_)

    {

        return p_77654_1_;

    }

 

    /**

    * How long it takes to use or consume an item

    */

    public int getMaxItemUseDuration(ItemStack p_77626_1_)

    {

        return 72000;

    }

 

    /**

    * returns the action that specifies what animation to play when the items is being used

    */

    public EnumAction getItemUseAction(ItemStack p_77661_1_)

    {

        return EnumAction.bow;

    }

 

    /**

    * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer

    */

    public ItemStack onItemRightClick(ItemStack p_77659_1_, World p_77659_2_, EntityPlayer p_77659_3_)

    {

        ArrowNockEvent event = new ArrowNockEvent(p_77659_3_, p_77659_1_);

        MinecraftForge.EVENT_BUS.post(event);

        if (event.isCanceled())

        {

            return event.result;

        }

 

        if (p_77659_3_.capabilities.isCreativeMode || p_77659_3_.inventory.hasItem(Items.arrow))

        {

            p_77659_3_.setItemInUse(p_77659_1_, this.getMaxItemUseDuration(p_77659_1_));

        }

 

        return p_77659_1_;

    }

 

    /**

    * Return the enchantability factor of the item, most of the time is based on material.

    */

    public int getItemEnchantability()

    {

        return 1;

    }

 

    @SideOnly(Side.CLIENT)

    public void registerIcons(IIconRegister p_94581_1_)

    {

    System.out.println("###### registerIcons"+this.getIconString());

   

      //this.itemIcon = p_94581_1_.registerIcon(this.getIconString() + "_standby");

    this.itemIcon = p_94581_1_.registerIcon("varamercenaria00" + "_standby");

   

        this.iconArray = new IIcon[bowPullIconNameArray.length];

 

        for (int i = 0; i < this.iconArray.length; ++i)

        {

        //this.iconArray = p_94581_1_.registerIcon(this.getIconString() + "_" + bowPullIconNameArray);

        this.iconArray = p_94581_1_.registerIcon("varamercenaria00" + "_" + bowPullIconNameArray);

            System.out.println("###### "+"varamercenaria00" + "_" + bowPullIconNameArray);

        }

    }

 

    /**

    * used to cycle through icons based on their used duration, i.e. for the bow

    */

    @SideOnly(Side.CLIENT)

    public IIcon getItemIconForUseDuration(int p_94599_1_)

    {

    System.out.println("###### getItemIconForUseDuration"+ p_94599_1_ );

   

        return this.iconArray[p_94599_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.



×
×
  • Create New...

Important Information

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