xXRoboJackXx Posted April 14, 2013 Share Posted April 14, 2013 I've tried everything to try and mod a bow into 1.5.1 but I can't seem to find the right code for the icons when it's firing, I have everything else just not the bow pulling. So can anyone help me this is the code I have so far (Haven't updated since 1.4, package mods.blueeagle.common.items; 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.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 AngelBow(int par1) { super(par1); this.maxStackSize = 1; this.setMaxDamage(384); this.setCreativeTab(CreativeTabs.tabCombat); }[glow=red,2,300] public int getIconIndex(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) return 8; if (X > 13) return 7; if (X > 0) return 6; } return Icon(stack);[/glow] } /** * 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 var6 = this.getMaxItemUseDuration(par1ItemStack) - par4; ArrowLooseEvent event = new ArrowLooseEvent(par3EntityPlayer, par1ItemStack, var6); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { return; } var6 = event.charge; boolean var5 = par3EntityPlayer.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, par1ItemStack) > 0; if (var5 || par3EntityPlayer.inventory.hasItem(Item.arrow.itemID)) { float var7 = (float)var6 / 20.0F; var7 = (var7 * var7 + var7 * 2.0F) / 3.0F; if ((double)var7 < 0.1D) { return; } if (var7 > 1.0F) { var7 = 1.0F; } EntityArrow var8 = new EntityArrow(par2World, par3EntityPlayer, var7 * 2.0F); if (var7 == 1.0F) { var8.setIsCritical(true); } int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, par1ItemStack); if (var9 > 0) { var8.setDamage(var8.getDamage() + (double)var9 * 0.5D + 0.5D); } int var10 = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, par1ItemStack); if (var10 > 0) { var8.setKnockbackStrength(var10); } if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, par1ItemStack) > 0) { var8.setFire(100); } par1ItemStack.damageItem(1, par3EntityPlayer); par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + var7 * 0.5F); if (var5) { var8.canBePickedUp = 2; } else { par3EntityPlayer.inventory.consumeInventoryItem(Item.arrow.itemID); } if (!par2World.isRemote) { par2World.spawnEntityInWorld(var8); } } } public ItemStack onFoodEaten(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 func_94581_a(IconRegister iconRegister) { iconIndex = iconRegister.func_94245_a("blueeagle:AngelBow"); } } The red glowing parts is what I need help changing, thanks in advance. Quote Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 14, 2013 Author Share Posted April 14, 2013 I have a feeling it's something like this public Icon getItemIcon(ItemStack par1ItemStack, int par2) { Icon icon = super.getItemIcon(par1ItemStack, par2); if (par1ItemStack.itemID == Item.fishingRod.itemID && this.fishEntity != null) { icon = Item.fishingRod.func_94597_g(); } else { if (par1ItemStack.getItem().requiresMultipleRenderPasses()) { return par1ItemStack.getItem().getIcon(par1ItemStack, par2); } if (this.itemInUse != null && par1ItemStack.itemID == Item.bow.itemID) { int j = par1ItemStack.getMaxItemUseDuration() - this.itemInUseCount; if (j >= 18) { return Item.bow.func_94599_c(2); } if (j > 13) { return Item.bow.func_94599_c(1); } if (j > 0) { return Item.bow.func_94599_c(0); } } icon = par1ItemStack.getItem().getIcon(par1ItemStack, par2, this, itemInUse, itemInUseCount); } return icon; } Which I found in the entity player file but I wouldn't know what to change. (I know nearly everything but how to code a pulling texture :I) Quote Link to comment Share on other sites More sharing options...
ashtonr12 Posted April 14, 2013 Share Posted April 14, 2013 Quote Use examples, i have aspergers. Examples make sense to me. Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 14, 2013 Author Share Posted April 14, 2013 Didn't help, I'm looking how to animate the bow. I know the rest. Quote Link to comment Share on other sites More sharing options...
ashtonr12 Posted April 14, 2013 Share Posted April 14, 2013 dont you think that would be part of it? Quote Use examples, i have aspergers. Examples make sense to me. Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 14, 2013 Author Share Posted April 14, 2013 dont you think that would be part of it? I just watched it and he said he'll make another video about it, so no I don't think it'll be part of it. Quote Link to comment Share on other sites More sharing options...
ashtonr12 Posted April 14, 2013 Share Posted April 14, 2013 you just want the action? try public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.bow; } just plonk that right in there Quote Use examples, i have aspergers. Examples make sense to me. Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 14, 2013 Author Share Posted April 14, 2013 you just want the action? try public EnumAction getItemUseAction(ItemStack par1ItemStack) { return EnumAction.bow; } just plonk that right in there I mean the texture like what happens when you right click aka the pulling. Quote Link to comment Share on other sites More sharing options...
ashtonr12 Posted April 14, 2013 Share Posted April 14, 2013 yes that is the action? i dont understand your question? that is the action that is perfomred upon holding right click if you mean how to get it to happen to your texture then either it should auto happen in which case your coding is wrong somewhere or your texture is wrong, sometimes you have to have weird textures to suit actions, go and look at the bow texture in the items, but i think its probably the former. Quote Use examples, i have aspergers. Examples make sense to me. Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 14, 2013 Author Share Posted April 14, 2013 yes that is the action? i dont understand your question? that is the action that is perfomred upon holding right click if you mean how to get it to happen to your texture then either it should auto happen in which case your coding is wrong somewhere or your texture is wrong, sometimes you have to have weird textures to suit actions, go and look at the bow texture in the items, but i think its probably the former. Oh so don't I need separate textures for the bow anymore? Quote Link to comment Share on other sites More sharing options...
ashtonr12 Posted April 14, 2013 Share Posted April 14, 2013 i imagine its the same for 1.4 but i am in 1.51 so no garentees, you need four textures for the bow animation and this code 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]); } } the png's this use are bow_pull_0.png bow_pull_1.png bow_pull_2.png Quote Use examples, i have aspergers. Examples make sense to me. Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 14, 2013 Author Share Posted April 14, 2013 i imagine its the same for 1.4 but i am in 1.51 so no garentees, you need four textures for the bow animation and this code 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]); } } the png's this use are bow_pull_0.png bow_pull_1.png bow_pull_2.png No no no, I am 1.5 now I just only updated. Quote Link to comment Share on other sites More sharing options...
ashtonr12 Posted April 14, 2013 Share Posted April 14, 2013 so do that ^ Quote Use examples, i have aspergers. Examples make sense to me. Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 14, 2013 Author Share Posted April 14, 2013 i imagine its the same for 1.4 but i am in 1.51 so no garentees, you need four textures for the bow animation and this code 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]); } } the png's this use are bow_pull_0.png bow_pull_1.png bow_pull_2.png kk so this code recognises bow_pull_0.png bow_pull_1.png bow_pull_2.png as the textures Thanks I'll go try it. Quote Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 14, 2013 Author Share Posted April 14, 2013 so do that ^ Just realized I could copy the bow file and use it like this: package mods.blueeagle.common.items; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; 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[] {"bow_pull_0", "bow_pull_1", "bow_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]); } } @SideOnly(Side.CLIENT) public Icon func_94599_c(int par1) { return this.iconArray[par1]; } } So now I'm guessing public static final String[] bowPullIconNameArray = new String[] {"bow_pull_0", "bow_pull_1", "bow_pull_2"}; Will search for the textures. Quote Link to comment Share on other sites More sharing options...
ashtonr12 Posted April 14, 2013 Share Posted April 14, 2013 am guessing too, it work yet? Quote Use examples, i have aspergers. Examples make sense to me. Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 14, 2013 Author Share Posted April 14, 2013 am guessing too, it work yet? I still have to fix the rest of the errors that the update gave me (Which is A LOT) I'll get back to you on it. Quote Link to comment Share on other sites More sharing options...
Ninjusk Posted April 15, 2013 Share Posted April 15, 2013 I've tried everything to try and mod a bow into 1.5.1 but I can't seem to find the right code for the icons when it's firing, I have everything else just not the bow pulling. So can anyone help me this is the code I have so far (Haven't updated since 1.4, what you need to do is create a forge custom item render and make it work only for equipped and you check how long the bow has been in uses and you render the appropriate texture. i don't know of any other way to do this because the bows shooting animation is not done from within the bow file so you have to use a custom render. Quote Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 16, 2013 Author Share Posted April 16, 2013 This is my new code for the texture part of the bow: @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; } Even though the icon for the bow itself works, the pulling the bow itself still doesn't. Anyone know how to fix this? There are no errors either. Quote Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 16, 2013 Author Share Posted April 16, 2013 This is my new code for the texture part of the bow: @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; } Even though the icon for the bow itself works, the pulling the bow itself still doesn't. Anyone know how to fix this? There are no errors either. Quote Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 16, 2013 Author Share Posted April 16, 2013 And this is the file if you need to see it: 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[] {"bow_pull_0", "bow_pull_1", "bow_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; } } I would appreciate any help thanks in advanced. Quote Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 16, 2013 Author Share Posted April 16, 2013 And this is the file if you need to see it: 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[] {"bow_pull_0", "bow_pull_1", "bow_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; } } I would appreciate any help thanks in advanced. Quote Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 17, 2013 Author Share Posted April 17, 2013 I would appreciate any help thanks in advanced. Maybe read what I wrote? -.- Already tried that Unless I write it wrong. Quote Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 17, 2013 Author Share Posted April 17, 2013 I would appreciate any help thanks in advanced. Maybe read what I wrote? -.- Already tried that Unless I write it wrong. Quote Link to comment Share on other sites More sharing options...
xXRoboJackXx Posted April 17, 2013 Author Share Posted April 17, 2013 Already tried that Unless I write it wrong. It's not in the last code you posted. That was what I tried before I used the code you told me to use. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.