Posted August 11, 201312 yr I'm working on a mod with bows and I want each one to start having faster drawback times. Does anybody know how to do this?
August 11, 201312 yr Author Look at the ItemBow class ? I did and nothing I think its in the Bow EnumAction or something
August 11, 201312 yr Author It is an hardcoded value. Ik somehow it can be done the More Bows mod has it
August 11, 201312 yr Yes, you just have to override the main method with a copy and replace the values where needed.
August 11, 201312 yr Author Yes, you just have to override the main method with a copy and replace the values where needed. Do you know which value is it? I'm guessing it's: int j = this.getMaxItemUseDuration(par1ItemStack) - par4; float f = (float)j / 20.0F;
August 11, 201312 yr Author Looks like this is it When i change the value it just shoots nothing no difference in drawback: public void onPlayerStoppedUsing(ItemStack itemStack, World world, EntityPlayer player, int par4) { int j = getMaxItemUseDuration(itemStack) - par4; ArrowLooseEvent event = new ArrowLooseEvent(player, itemStack, j); MinecraftForge.EVENT_BUS.post(event); if (event.isCanceled()) { return; } j = event.charge; boolean flag = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, itemStack) > 0; if (flag || player.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(world, player, f * 2.0F); if (f == 1.0F) { entityArrow.setIsCritical(true); } int k = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, itemStack); if (k > 0) { entityArrow.setDamage(entityArrow.getDamage() + (double)k * 0.5D + 0.5D); } int l = EnchantmentHelper.getEnchantmentLevel(Enchantment.punch.effectId, itemStack); if (l > 0) { entityArrow.setKnockbackStrength(l); } if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, itemStack) > 0) { entityArrow.setFire(100); } itemStack.damageItem(1, player); world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + f * 0.5F); if (flag) { entityArrow.canBePickedUp = 2; } else { player.inventory.consumeInventoryItem(Item.arrow.itemID); } if (!world.isRemote) { world.spawnEntityInWorld(entityArrow); } } }
August 11, 201312 yr Author float f = (float)j / 20.0F; You didn't change anything... I changed it back
August 11, 201312 yr If you want the visibility of the bow to draw faster, try changing when the bow texture changes. @SideOnly(Side.CLIENT) /** * Gets the Icon Index of the item currently held */ 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.getItemIconForUseDuration(2); } if (j > 13) { return Item.bow.getItemIconForUseDuration(1); } if (j > 0) { return Item.bow.getItemIconForUseDuration(0); } } icon = par1ItemStack.getItem().getIcon(par1ItemStack, par2, this, itemInUse, itemInUseCount); } return icon; } I found the above code in the EntityPlayer class. But that is not where you can edit it. Since you are wanting this for custom bows, that method should be like this: @SideOnly(Side.CLIENT) /** * Gets the Icon Index of the item currently held */ public Icon getItemIcon(ItemStack par1ItemStack, int par2) { int j = par1ItemStack.getMaxItemUseDuration() - this.itemInUseCount; if (j >= 18) { return Item.bow.getItemIconForUseDuration(2); } if (j > 13) { return Item.bow.getItemIconForUseDuration(1); } if (j > 0) { return Item.bow.getItemIconForUseDuration(0); } return icon; } Also, it would be a good idea to change it to the bowPull array directly, seeing as you can access it directly. I hope you get the drift of what to do I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes. I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there
August 12, 201312 yr Author If you want the visibility of the bow to draw faster, try changing when the bow texture changes. @SideOnly(Side.CLIENT) /** * Gets the Icon Index of the item currently held */ 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.getItemIconForUseDuration(2); } if (j > 13) { return Item.bow.getItemIconForUseDuration(1); } if (j > 0) { return Item.bow.getItemIconForUseDuration(0); } } icon = par1ItemStack.getItem().getIcon(par1ItemStack, par2, this, itemInUse, itemInUseCount); } return icon; } I found the above code in the EntityPlayer class. But that is not where you can edit it. Since you are wanting this for custom bows, that method should be like this: @SideOnly(Side.CLIENT) /** * Gets the Icon Index of the item currently held */ public Icon getItemIcon(ItemStack par1ItemStack, int par2) { int j = par1ItemStack.getMaxItemUseDuration() - this.itemInUseCount; if (j >= 18) { return Item.bow.getItemIconForUseDuration(2); } if (j > 13) { return Item.bow.getItemIconForUseDuration(1); } if (j > 0) { return Item.bow.getItemIconForUseDuration(0); } return icon; } Also, it would be a good idea to change it to the bowPull array directly, seeing as you can access it directly. I hope you get the drift of what to do I've done this and thats not exactly what im talking about. I decided to give up on this because I think its a value that can't be changed
August 12, 201312 yr I think its a value that can't be changed ASM how to debug 101:http://www.minecraftforge.net/wiki/Debug_101 -hydroflame, author of the forge revolution-
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.