Jump to content

Faster Drawback on my bow


kenoba10

Recommended Posts

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);
                
            }
            
        }
        
    }

Link to comment
Share on other sites

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 :D

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 xD

Link to comment
Share on other sites

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 :D

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

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • They are heartless scammers, they ruined my life, by making me develop an interest in investing my hard-earned money. I deposited 67,000 USD which was later turned into 110,450 USD including my payout bonus, there was an impressive improvement in a few weeks, later I had an emergency and needed money to pay my insurance fee, I tried reaching out to them to collect the money I invested, they cut the live chats and got me harassed then I realized that I was being scammed. I just wanted my money back! I was advised by a friend to seek help from a recovery firm to assist me in recovering my invested funds, God was so kind I came across some great positive reviews about BETAFORT ONLINE on how they helped scammed victims like me to recover their lost cryptocurrency assets, I took no delay and got in touch with BETAFORT ONLINE, the Expert immediately looked into my case and after providing all the required information they need, and it took them less then a day to recover all my funds. And now I really feel obligated to recommend BETAFORT ONLINE and their team, their recovery strategies, and for working relentlessly to help me recover my funds. Feel free to reach out to BETAFORT ONLINE via google search and they will guide you on how to recover your invested funds, I advise everyone to be careful with these heartless cryptocurrency scammers.  
    • yeah I believe so, its been something deep with the modpack I'm guessing. ill fix each error it states if its saying to replace or download a mod but I'm not sure where to go from here. I have been spending days and have yet to find the issue    
    • It worked, thank you very much 😭
    • https://spark.lucko.me/0ZaR1OAi2F I use spark mod to do a scan and send it here to search for help and if someone know about this issue I dont know to much about, but one thing i see in the record of the minecraft launcher when i play says: can't keep up server overloaded and etc, etc.  I assign 6GB ram to minecraft from the 16 GB of my pc, and fps is not a problem...(no to much) its something about tic rate/second and i am in SINGLE PLAYER. The funny thing is, minecraft vanilla (No mods) works normaly. My mods list (130): https://imgur.com/a/kY3yQr1  Datapacks: https://imgur.com/CTDBe7D ResourcePacks: https://imgur.com/AztTOOw so plis, is someone help me T_T a work  a loot of time in downloading and trying to all mods work but i dont know what to do anymore. Last thing  I SPEAK SPANISH so... sorry if my english is a little scuff or ... werever... bad. Thanks :3
    • Whenever I try to create an world my game crashes. I´ve tried to figure it out myself but wasnt able to do it.   Here are the logs
  • Topics

×
×
  • Create New...

Important Information

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