Jump to content

Recommended Posts

Posted

so did his code work? if not you might want to show him your effort at using his suggested code and then he can help you, he is a smart guy dont argue you will lose.

Use examples, i have aspergers.

Examples make sense to me.

Posted

so did his code work? if not you might want to show him your effort at using his suggested code and then he can help you, he is a smart guy dont argue you will lose.

Use examples, i have aspergers.

Examples make sense to me.

Posted

so did his code work? if not you might want to show him your effort at using his suggested code and then he can help you, he is a smart guy dont argue you will lose.

 

As I said I probably typed it wrong so I'm going to keep going till I found it out, also I'm not arguing I know he's a smart guy so if he says that's probably the code I'm going to keep trying with that code.

Posted

so did his code work? if not you might want to show him your effort at using his suggested code and then he can help you, he is a smart guy dont argue you will lose.

 

As I said I probably typed it wrong so I'm going to keep going till I found it out, also I'm not arguing I know he's a smart guy so if he says that's probably the code I'm going to keep trying with that code.

Posted

so show him what you have so far, how you have come to this decision and why you don't think it works. he can then extend your knowledge of the method and give you a greater understanding of it.

Use examples, i have aspergers.

Examples make sense to me.

Posted

so show him what you have so far, how you have come to this decision and why you don't think it works. he can then extend your knowledge of the method and give you a greater understanding of it.

Use examples, i have aspergers.

Examples make sense to me.

Posted

so did his code work? if not you might want to show him your effort at using his suggested code and then he can help you, he is a smart guy dont argue you will lose.

 

As I said I probably typed it wrong so I'm going to keep going till I found it out, also I'm not arguing I know he's a smart guy so if he says that's probably the code I'm going to keep trying with that code.

 

would be much easier if you just posted the code where you tried his solution and then you can get help to what you typed wrongly? :P

If you guys dont get it.. then well ya.. try harder...

Posted

so did his code work? if not you might want to show him your effort at using his suggested code and then he can help you, he is a smart guy dont argue you will lose.

 

As I said I probably typed it wrong so I'm going to keep going till I found it out, also I'm not arguing I know he's a smart guy so if he says that's probably the code I'm going to keep trying with that code.

 

would be much easier if you just posted the code where you tried his solution and then you can get help to what you typed wrongly? :P

If you guys dont get it.. then well ya.. try harder...

Posted

so show him what you have so far, how you have come to this decision and why you don't think it works. he can then extend your knowledge of the method and give you a greater understanding of it.

.  I will tomorrow I'm on my iPod right now.
Posted

so show him what you have so far, how you have come to this decision and why you don't think it works. he can then extend your knowledge of the method and give you a greater understanding of it.

.  I will tomorrow I'm on my iPod right now.
Posted

so did his code work? if not you might want to show him your effort at using his suggested code and then he can help you, he is a smart guy dont argue you will lose.

 

As I said I probably typed it wrong so I'm going to keep going till I found it out, also I'm not arguing I know he's a smart guy so if he says that's probably the code I'm going to keep trying with that code.

 

would be much easier if you just posted the code where you tried his solution and then you can get help to what you typed wrongly? :P

 

 

Kk Here is my tries from today:

Try one:

 

 

package mods.blueeagle.common.items;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.blueeagle.common.mod.mod_TheGodMod;
import net.minecraft.client.renderer.texture.IconRegister;
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.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
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 AngelBow extends Item
{
    public static final String[] bowPullIconNameArray = new String[] {"blueeagle:angelbow_pull_0", "blueeagle:angelbow_pull_1", "blueeagle:angelbow_pull_2"};
    @SideOnly(Side.CLIENT)
    private Icon[] iconArray;

    public AngelBow(int par1)
    {
        super(par1);
        this.maxStackSize = 1;
        this.setMaxDamage(384);
        this.setCreativeTab(CreativeTabs.tabCombat);
    }

    /**
     * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
     */
    public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
    {
        int j = this.getMaxItemUseDuration(par1ItemStack) - par4;

        ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j);
        MinecraftForge.EVENT_BUS.post(event);
        if (event.isCanceled())
        {
            return;
        }
        j = event.charge;

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

        if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
        {
            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(par2World, par3EntityPlayer, f * 2.0F);

            if (f == 1.0F)
            {
                entityarrow.setIsCritical(true);
            }

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

            if (k > 0)
            {
                entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
            }

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

            if (l > 0)
            {
                entityarrow.setKnockbackStrength(l);
            }

            if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
            {
                entityarrow.setFire(100);
            }

            par1ItemStack.damageItem(1, par3EntityPlayer);
            par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

            if (flag)
            {
                entityarrow.canBePickedUp = 2;
            }
            else
            {
                par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
            }

            if (!par2World.isRemote)
            {
                par2World.spawnEntityInWorld(entityarrow);
            }
        }
    }

    public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        return par1ItemStack;
    }

    /**
     * How long it takes to use or consume an item
     */
    public int getMaxItemUseDuration(ItemStack par1ItemStack)
    {
        return 72000;
    }

    /**
     * returns the action that specifies what animation to play when the items is being used
     */
    public EnumAction getItemUseAction(ItemStack par1ItemStack)
    {
        return EnumAction.bow;
    }

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
        MinecraftForge.EVENT_BUS.post(event);
        if (event.isCanceled())
        {
            return event.result;
        }

        if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
        {
            par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
        }

        return par1ItemStack;
    }

    /**
     * Return the enchantability factor of the item, most of the time is based on material.
     */
    public int getItemEnchantability()
    {
        return 1;
    }
    


    @Override
    public void updateIcons(IconRegister reg)
    {
             this.iconIndex = reg.registerIcon("blueeagle:AngelBow");
    }
             public Icon getIconIndex(IconRegister reg, ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
    {
       if (usingItem != null && usingItem.getItem().itemID == mod_TheGodMod.AngelBow.itemID)
       {
          int X = usingItem.getMaxItemUseDuration() - useRemaining;
          if (X >= 18) this.iconIndex = reg.registerIcon("blueeagle:AngelBow1");
          if (X >  13) this.iconIndex = reg.registerIcon("blueeagle:AngelBow2");
          if (X >   0) this.iconIndex = reg.registerIcon("blueeagle:AngelBow3");
       
       
}
return iconIndex;
}
}

 

 

Try 2:

 

package mods.blueeagle.common.items;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.blueeagle.common.mod.mod_TheGodMod;
import net.minecraft.client.renderer.texture.IconRegister;
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.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
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 AngelBow extends Item
{
    public static final String[] bowPullIconNameArray = new String[] {"blueeagle:angelbow_pull_0", "blueeagle:angelbow_pull_1", "blueeagle:angelbow_pull_2"};
    @SideOnly(Side.CLIENT)
    private Icon[] iconArray;

    public AngelBow(int par1)
    {
        super(par1);
        this.maxStackSize = 1;
        this.setMaxDamage(384);
        this.setCreativeTab(CreativeTabs.tabCombat);
    }

    /**
     * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
     */
    public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
    {
        int j = this.getMaxItemUseDuration(par1ItemStack) - par4;

        ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j);
        MinecraftForge.EVENT_BUS.post(event);
        if (event.isCanceled())
        {
            return;
        }
        j = event.charge;

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

        if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
        {
            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(par2World, par3EntityPlayer, f * 2.0F);

            if (f == 1.0F)
            {
                entityarrow.setIsCritical(true);
            }

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

            if (k > 0)
            {
                entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
            }

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

            if (l > 0)
            {
                entityarrow.setKnockbackStrength(l);
            }

            if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
            {
                entityarrow.setFire(100);
            }

            par1ItemStack.damageItem(1, par3EntityPlayer);
            par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

            if (flag)
            {
                entityarrow.canBePickedUp = 2;
            }
            else
            {
                par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
            }

            if (!par2World.isRemote)
            {
                par2World.spawnEntityInWorld(entityarrow);
            }
        }
    }

    public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        return par1ItemStack;
    }

    /**
     * How long it takes to use or consume an item
     */
    public int getMaxItemUseDuration(ItemStack par1ItemStack)
    {
        return 72000;
    }

    /**
     * returns the action that specifies what animation to play when the items is being used
     */
    public EnumAction getItemUseAction(ItemStack par1ItemStack)
    {
        return EnumAction.bow;
    }

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
        MinecraftForge.EVENT_BUS.post(event);
        if (event.isCanceled())
        {
            return event.result;
        }

        if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
        {
            par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
        }

        return par1ItemStack;
    }

    /**
     * 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 updateIcons(IconRegister par1IconRegister)
    {
        super.updateIcons(par1IconRegister);
        this.iconArray = new Icon[bowPullIconNameArray.length];

        for (int i = 0; i < this.iconArray.length; ++i)
        {
            this.iconArray[i] = par1IconRegister.registerIcon(bowPullIconNameArray[i]);
            this.iconIndex = par1IconRegister.registerIcon("blueeagle:AngelBow");

        }
    }

    @SideOnly(Side.CLIENT)
    public Icon func_94599_c(int par1)
    {
        return this.iconArray[par1];
    }
    
}

 

Posted

so did his code work? if not you might want to show him your effort at using his suggested code and then he can help you, he is a smart guy dont argue you will lose.

 

As I said I probably typed it wrong so I'm going to keep going till I found it out, also I'm not arguing I know he's a smart guy so if he says that's probably the code I'm going to keep trying with that code.

 

would be much easier if you just posted the code where you tried his solution and then you can get help to what you typed wrongly? :P

 

 

Kk Here is my tries from today:

Try one:

 

 

package mods.blueeagle.common.items;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.blueeagle.common.mod.mod_TheGodMod;
import net.minecraft.client.renderer.texture.IconRegister;
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.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
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 AngelBow extends Item
{
    public static final String[] bowPullIconNameArray = new String[] {"blueeagle:angelbow_pull_0", "blueeagle:angelbow_pull_1", "blueeagle:angelbow_pull_2"};
    @SideOnly(Side.CLIENT)
    private Icon[] iconArray;

    public AngelBow(int par1)
    {
        super(par1);
        this.maxStackSize = 1;
        this.setMaxDamage(384);
        this.setCreativeTab(CreativeTabs.tabCombat);
    }

    /**
     * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
     */
    public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
    {
        int j = this.getMaxItemUseDuration(par1ItemStack) - par4;

        ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j);
        MinecraftForge.EVENT_BUS.post(event);
        if (event.isCanceled())
        {
            return;
        }
        j = event.charge;

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

        if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
        {
            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(par2World, par3EntityPlayer, f * 2.0F);

            if (f == 1.0F)
            {
                entityarrow.setIsCritical(true);
            }

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

            if (k > 0)
            {
                entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
            }

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

            if (l > 0)
            {
                entityarrow.setKnockbackStrength(l);
            }

            if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
            {
                entityarrow.setFire(100);
            }

            par1ItemStack.damageItem(1, par3EntityPlayer);
            par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

            if (flag)
            {
                entityarrow.canBePickedUp = 2;
            }
            else
            {
                par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
            }

            if (!par2World.isRemote)
            {
                par2World.spawnEntityInWorld(entityarrow);
            }
        }
    }

    public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        return par1ItemStack;
    }

    /**
     * How long it takes to use or consume an item
     */
    public int getMaxItemUseDuration(ItemStack par1ItemStack)
    {
        return 72000;
    }

    /**
     * returns the action that specifies what animation to play when the items is being used
     */
    public EnumAction getItemUseAction(ItemStack par1ItemStack)
    {
        return EnumAction.bow;
    }

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
        MinecraftForge.EVENT_BUS.post(event);
        if (event.isCanceled())
        {
            return event.result;
        }

        if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
        {
            par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
        }

        return par1ItemStack;
    }

    /**
     * Return the enchantability factor of the item, most of the time is based on material.
     */
    public int getItemEnchantability()
    {
        return 1;
    }
    


    @Override
    public void updateIcons(IconRegister reg)
    {
             this.iconIndex = reg.registerIcon("blueeagle:AngelBow");
    }
             public Icon getIconIndex(IconRegister reg, ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
    {
       if (usingItem != null && usingItem.getItem().itemID == mod_TheGodMod.AngelBow.itemID)
       {
          int X = usingItem.getMaxItemUseDuration() - useRemaining;
          if (X >= 18) this.iconIndex = reg.registerIcon("blueeagle:AngelBow1");
          if (X >  13) this.iconIndex = reg.registerIcon("blueeagle:AngelBow2");
          if (X >   0) this.iconIndex = reg.registerIcon("blueeagle:AngelBow3");
       
       
}
return iconIndex;
}
}

 

 

Try 2:

 

package mods.blueeagle.common.items;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import mods.blueeagle.common.mod.mod_TheGodMod;
import net.minecraft.client.renderer.texture.IconRegister;
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.item.EnumAction;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
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 AngelBow extends Item
{
    public static final String[] bowPullIconNameArray = new String[] {"blueeagle:angelbow_pull_0", "blueeagle:angelbow_pull_1", "blueeagle:angelbow_pull_2"};
    @SideOnly(Side.CLIENT)
    private Icon[] iconArray;

    public AngelBow(int par1)
    {
        super(par1);
        this.maxStackSize = 1;
        this.setMaxDamage(384);
        this.setCreativeTab(CreativeTabs.tabCombat);
    }

    /**
     * called when the player releases the use item button. Args: itemstack, world, entityplayer, itemInUseCount
     */
    public void onPlayerStoppedUsing(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer, int par4)
    {
        int j = this.getMaxItemUseDuration(par1ItemStack) - par4;

        ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, j);
        MinecraftForge.EVENT_BUS.post(event);
        if (event.isCanceled())
        {
            return;
        }
        j = event.charge;

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

        if (flag || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
        {
            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(par2World, par3EntityPlayer, f * 2.0F);

            if (f == 1.0F)
            {
                entityarrow.setIsCritical(true);
            }

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

            if (k > 0)
            {
                entityarrow.setDamage(entityarrow.getDamage() + (double)k * 0.5D + 0.5D);
            }

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

            if (l > 0)
            {
                entityarrow.setKnockbackStrength(l);
            }

            if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0)
            {
                entityarrow.setFire(100);
            }

            par1ItemStack.damageItem(1, par3EntityPlayer);
            par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F);

            if (flag)
            {
                entityarrow.canBePickedUp = 2;
            }
            else
            {
                par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID);
            }

            if (!par2World.isRemote)
            {
                par2World.spawnEntityInWorld(entityarrow);
            }
        }
    }

    public ItemStack onEaten(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        return par1ItemStack;
    }

    /**
     * How long it takes to use or consume an item
     */
    public int getMaxItemUseDuration(ItemStack par1ItemStack)
    {
        return 72000;
    }

    /**
     * returns the action that specifies what animation to play when the items is being used
     */
    public EnumAction getItemUseAction(ItemStack par1ItemStack)
    {
        return EnumAction.bow;
    }

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
    {
        ArrowNockEvent event = new ArrowNockEvent(par3EntityPlayer, par1ItemStack);
        MinecraftForge.EVENT_BUS.post(event);
        if (event.isCanceled())
        {
            return event.result;
        }

        if (par3EntityPlayer.capabilities.isCreativeMode || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID))
        {
            par3EntityPlayer.setItemInUse(par1ItemStack, this.getMaxItemUseDuration(par1ItemStack));
        }

        return par1ItemStack;
    }

    /**
     * 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 updateIcons(IconRegister par1IconRegister)
    {
        super.updateIcons(par1IconRegister);
        this.iconArray = new Icon[bowPullIconNameArray.length];

        for (int i = 0; i < this.iconArray.length; ++i)
        {
            this.iconArray[i] = par1IconRegister.registerIcon(bowPullIconNameArray[i]);
            this.iconIndex = par1IconRegister.registerIcon("blueeagle:AngelBow");

        }
    }

    @SideOnly(Side.CLIENT)
    public Icon func_94599_c(int par1)
    {
        return this.iconArray[par1];
    }
    
}

 

Posted

Did you even read my post? You have NOT done anything that looks anywhere near what I have suggested. If you are just copy-pasting code (your code looks like that!) you need to go and learn java first. making a copy-paste mod is not a good idea.

 

Fixed it thanks for the help. Topic locked.

Posted

Did you even read my post? You have NOT done anything that looks anywhere near what I have suggested. If you are just copy-pasting code (your code looks like that!) you need to go and learn java first. making a copy-paste mod is not a good idea.

 

Fixed it thanks for the help. Topic locked.

Posted

Topic Unlocked.

 

Well let me give the code and explain a bit of it.

 

Just a note the "Texture" from the code (a name I use) Can be anything like wibbly wobbaly or anything it's just a name that you give it, but if you call it something like bow then you'll need to write bow for all of them. Same with N and Time.

  @SideOnly(Side.CLIENT)
    
    private Icon[] Texture = new Icon[4];
    public void updateIcons(IconRegister iconRegister)
    
    {
    	
             iconIndex = iconRegister.registerIcon("blueeagle:" + this.getUnlocalizedName().substring(5) + "_0");
             for (int N = 0; N < 4; N++)
             {
                     this.Texture[N] = iconRegister.registerIcon("blueeagle:" + this.getUnlocalizedName().substring(5) + "_" + N);
                     
             }
    }
    public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
    {
             if(player.getItemInUse() == null) return this.iconIndex;
             int time = stack.getMaxItemUseDuration() - useRemaining;
             if (time >= 18)
             {
                     return Texture[3];
             }
             else if (time > 13)
             {
                     return Texture[2];
             }
             else if (time > 0)
             {
                     return Texture[1];
             }             
             return Texture[0];
             }
    }

What this:

    private Icon[] Texture= new Icon[4];

Is doing is registering what the Texture does so that code works.

 

This:

    public void updateIcons(IconRegister iconRegister)

Is the method.

 

This:

             iconIndex = iconRegister.registerIcon("blueeagle:" + this.getUnlocalizedName().substring(5) + "_0");

Is saying that the mod folder location is at blueeagle and the : is saying that it's going to find a texture in there.

The + getUnlocalizedName() is saying that the unlocalized name for this item is the first part of the texture (the name)

The .substring(5) gets rid of the "item." from the beginning of the string.

The +_0 is adding on a "_0" to the code of the texture. And then the for (int N = 0 < 4; N++) is saying that the number 0 = N and the can only be less then 4.

                     this.Texture[N] = iconRegister.registerIcon("blueeagle:" + this.getUnlocalizedName().substring(5) + "_" + N);

Which is saying this Icon[number] = the method iconRegisterIcon("Foldername:" and then it gets the name, takes off the item and adds on the _ and number of the image.

 

This:

    public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)

Is the method that will be needed for the rest of the code.

 

This:

             if(player.getItemInUse() == null) return this.iconIndex;
             int time = stack.getMaxItemUseDuration() - useRemaining;

Is when the player is using the bow and int time is: stack.getMaxItemUseDuration() - useRemaining;

 

this:

  if (time >= 18)
             {
                     return Texture[3];
             }
             else if (time > 13)
             {
                     return Texture[2];
             }
             else if (time > 0)
             {
                     return Texture[1];
             }             
             return Texture[0];
             }
    }

This is saying that if time is greater then 18 (The time)

then it will = the return Texture[3]

which is the texture.

So this is going back to the method we write for the Texture which is the unlocalized name and the foldername with the _ and remember that the [N] will be a number so you write [3] in there which will make the code know that inside the [] is a number and this will make the code know now that the texture is located somewhere in the folder blueeagle (and my unlocalized name is AngelBow) it'll add a _ and the number which in this case is 3 so it's looking for the texture which is called

AngelBow_3

then I'm pretty sure you can work out what the else ifs mean.

 

and the return Texture[0] is the bow when not in use.

 

Hope I explained that well :)

Posted

Topic Unlocked.

 

Well let me give the code and explain a bit of it.

 

Just a note the "Texture" from the code (a name I use) Can be anything like wibbly wobbaly or anything it's just a name that you give it, but if you call it something like bow then you'll need to write bow for all of them. Same with N and Time.

  @SideOnly(Side.CLIENT)
    
    private Icon[] Texture = new Icon[4];
    public void updateIcons(IconRegister iconRegister)
    
    {
    	
             iconIndex = iconRegister.registerIcon("blueeagle:" + this.getUnlocalizedName().substring(5) + "_0");
             for (int N = 0; N < 4; N++)
             {
                     this.Texture[N] = iconRegister.registerIcon("blueeagle:" + this.getUnlocalizedName().substring(5) + "_" + N);
                     
             }
    }
    public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
    {
             if(player.getItemInUse() == null) return this.iconIndex;
             int time = stack.getMaxItemUseDuration() - useRemaining;
             if (time >= 18)
             {
                     return Texture[3];
             }
             else if (time > 13)
             {
                     return Texture[2];
             }
             else if (time > 0)
             {
                     return Texture[1];
             }             
             return Texture[0];
             }
    }

What this:

    private Icon[] Texture= new Icon[4];

Is doing is registering what the Texture does so that code works.

 

This:

    public void updateIcons(IconRegister iconRegister)

Is the method.

 

This:

             iconIndex = iconRegister.registerIcon("blueeagle:" + this.getUnlocalizedName().substring(5) + "_0");

Is saying that the mod folder location is at blueeagle and the : is saying that it's going to find a texture in there.

The + getUnlocalizedName() is saying that the unlocalized name for this item is the first part of the texture (the name)

The .substring(5) gets rid of the "item." from the beginning of the string.

The +_0 is adding on a "_0" to the code of the texture. And then the for (int N = 0 < 4; N++) is saying that the number 0 = N and the can only be less then 4.

                     this.Texture[N] = iconRegister.registerIcon("blueeagle:" + this.getUnlocalizedName().substring(5) + "_" + N);

Which is saying this Icon[number] = the method iconRegisterIcon("Foldername:" and then it gets the name, takes off the item and adds on the _ and number of the image.

 

This:

    public Icon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)

Is the method that will be needed for the rest of the code.

 

This:

             if(player.getItemInUse() == null) return this.iconIndex;
             int time = stack.getMaxItemUseDuration() - useRemaining;

Is when the player is using the bow and int time is: stack.getMaxItemUseDuration() - useRemaining;

 

this:

  if (time >= 18)
             {
                     return Texture[3];
             }
             else if (time > 13)
             {
                     return Texture[2];
             }
             else if (time > 0)
             {
                     return Texture[1];
             }             
             return Texture[0];
             }
    }

This is saying that if time is greater then 18 (The time)

then it will = the return Texture[3]

which is the texture.

So this is going back to the method we write for the Texture which is the unlocalized name and the foldername with the _ and remember that the [N] will be a number so you write [3] in there which will make the code know that inside the [] is a number and this will make the code know now that the texture is located somewhere in the folder blueeagle (and my unlocalized name is AngelBow) it'll add a _ and the number which in this case is 3 so it's looking for the texture which is called

AngelBow_3

then I'm pretty sure you can work out what the else ifs mean.

 

and the return Texture[0] is the bow when not in use.

 

Hope I explained that well :)

Posted

RoboJack, thanks for posting your solution once you figured it out. I've been struggling with the same thing, and that was really helpful.

 

Why did you pick the numbers 13 and 18 for the times? Is that the same timing for regular bows or your own timing?

Posted

RoboJack, thanks for posting your solution once you figured it out. I've been struggling with the same thing, and that was really helpful.

 

Why did you pick the numbers 13 and 18 for the times? Is that the same timing for regular bows or your own timing?

 

It's the same timing as regular bows, glad I could help :)

Join the conversation

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

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

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

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

×   Your previous content has been restored.   Clear editor

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

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Reach Out To Rapid Digital: What sapp Info: +1 41 4 80 7 14 85 Email INFO: rap iddi gita lrecov ery @ exe cs. com Hello, my name is Jayson, and I’m 35 years old from the United Kingdom. My family and I recently endured an incredibly challenging experience that I wouldn’t wish on anyone. We became victims of a cryptocurrency investment fraud scheme that saw us lose a staggering $807,000 in USDT and Bitcoins. The fraudsters had created a convincing facade, and we were lured into investing, only to discover later that the platform was a complete scam. We were left devastated, not just financially, but emotionally, as we had trusted these people and believed in the legitimacy of the investment. After the initial shock wore off, we desperately searched for ways to recover the lost funds. It seemed like an impossible task, and we felt as though there was no hope. That’s when, by sheer luck, we stumbled across a post about Rapid Digital Recovery, a cryptocurrency and funds recovery organization with a proven track record in cybersecurity and fraud recovery. We decided to reach out to them, and from the first interaction, we were impressed with their professionalism and transparency. They explained the recovery process in detail and reassured us that they had the skills and expertise to track down the perpetrators and recover our funds. This gave us a renewed sense of hope, something we hadn’t felt in months. What truly stood out during our experience with Rapid Digital Recovery was their dedication to the recovery process. The team went above and beyond, using sophisticated tracking tools and cyber forensics to gather critical information. Within a matter of weeks, they had successfully located the funds and traced the scam back to the fraudsters responsible. They worked with the authorities to ensure the criminals were held accountable for their actions. To our relief, the team at Rapid Digital Recovery was able to recover every single penny we had lost. The funds were returned in full, and the sense of closure we felt was invaluable. We couldn’t have imagined such a positive outcome in the early stages of our recovery journey, and we are deeply grateful for the work they did. If you ever find yourself in a similar situation, I highly recommend contacting Rapid Digital Recovery. Their expertise, transparency, and dedication to their clients make them the go-to choice for anyone seeking to recover lost cryptocurrency or funds. They truly gave us back our financial future.  
    • This is my first time modding anything, so maybe just skill issue. I'm using Forge 54.0.12 and Temurin 21.0.5+11-LTS I wanted to create a custom keybind and to check whether it works I'd like to send a chat message. I tried using Minecraft.getInstance().player.sendSystemMessage(Component.literal("test")); but IntelliJ couldnt resolve sendSystemMessage(...). Since I saw people using it in earlier versions, I tried the same thing with 1.20.6(- 50.1.0), where it works fine, now I can't figure out if this is intentional and whether there are other options for sending chat messages. On that note, is there more documentation than https://docs.minecraftforge.net/en/1.21.x/? It seems very incomplete compared to something like the Oracle Java docs
    • Hi, i'm having this error and I wanna fix it. we try: -Reload drivers -Eliminate .minecraft -Eliminate Java -Restart launcher -Verify if minecraft is using gpu -Mods  in .minecraft is empty -Install the latest and recomended version of forge idk what i have to do, help me pls. the lastest log is: https://mclo.gs/WAMao8x  
    • Read the FAQ, Rule #2. (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/)  
  • Topics

×
×
  • Create New...

Important Information

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