Jump to content

Recommended Posts

Posted

I've been able to create a custom bow with different range and damage that the usual bow, now the bow doesn't animate as needed and after looking through the ItemBow class and referred classes inside I cannot make up where the actual animation length and "zooming-in" effect comes from.

 

I have been able to find where the animation is decided which should be this:

/**
     * 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;
    }

 

But there is nothing in that EnumAction class that declares the parameters of the animation.

 

As far as the "zooming-in" effect goes, I'm confused as to why it isn't already functioning since I'm just extending the base ItemBow class which should have that in it.

--Remember to "Thank you" posts that actually helped you, and if a person seems nice, why not give them an applaud while you're at it--

Posted

Thanks, I already got the texture transformation now. The animation I was referring to is the one that makes the bow move towards the camera and start to shake a bit, that animation is not defined as far as I can see in the base item class for the bow.

--Remember to "Thank you" posts that actually helped you, and if a person seems nice, why not give them an applaud while you're at it--

Posted

As I check the FOVUpdateEvent I cannot see anything else than the fov variable, and the shaking occurs on the item itself, not the camera. May there be a function for it inside the Item class maybe?

--Remember to "Thank you" posts that actually helped you, and if a person seems nice, why not give them an applaud while you're at it--

Posted

Yea, it does work, somewhat(The animation enum is set to bow by default at the base ItemBow class so no further code needed).

The animation first slowly moves the bow closer to the player and at full tension the bow starts to shake, when I modify the pulltimes the animation gets offset from what the custom bow actually does. This isn't a big issue though so I'll manage without going deep into the coding for it to fix a fraction of a second.

--Remember to "Thank you" posts that actually helped you, and if a person seems nice, why not give them an applaud while you're at it--

Posted

As noted before it's not the texture that is the issue, it is synchronized based on the pulltime so no problem there.

 

A bow kinda has 3 different animations:

- Fov change

- Texture change

- Bow position change(move and then shake)

 

The Fov and texture is working properly, its the moving and shaking of the bow that's the issue(The time when the bow start to shake is hardcoded to the default bow pulltime). I'm not sure if this requires some extra classes or some deep minecraft source digging to find the root of the shaking or what.

--Remember to "Thank you" posts that actually helped you, and if a person seems nice, why not give them an applaud while you're at it--

Posted

The thing is that I do not know if it's hardcoded or not because I cannot find where the code for it lies.

 

Anyway, this issue isn't noticed if you use the bow normally so I'm just going to leave that as is for now. At least I got the Fov to change thanks to you!

--Remember to "Thank you" posts that actually helped you, and if a person seems nice, why not give them an applaud while you're at it--

Posted

Uhm, one last thing here.

 

I noted that the position and rotation of the bow in the hand is way off now. I tried with setting the setFull3D() function but it's still not correctly placed.

 

Is there a way I can change the position and rotation of the bow while pullin it?

--Remember to "Thank you" posts that actually helped you, and if a person seems nice, why not give them an applaud while you're at it--

Posted

I was curious about this myself so I did a quick search. The bow rendering stuff you care about is in two different places I could find.

 

*.renderer.ItemRenderer (lines 459-488), handles the first person view entity renders, deals with the EnumAction.bow animations, and *renderer.entity.RenderPlayer (lines 345-353), which looks like it sets the position, rotation, and scaling of the bow item in the hands of the third person player entity. You said you looked at the ItemBow class so you know about how the draw animation is handled no doubt.

 

The ItemRenderer bit involves checking the getMaxItemUseDuration on the held ItemStack, which is something you'd be able to influence.

 

Unfortunately it looks like the bit in RenderPlayer tests whether the held ItemStack == Items.bow, which obviously won't work for your mod item.

Posted

So does that mean that I'd have to create my own itemrenderer for the bow only?

--Remember to "Thank you" posts that actually helped you, and if a person seems nice, why not give them an applaud while you're at it--

Posted

It certainly does seem that way, unfortunately. If you want it to resemble the way the vanilla bow item is scaled and rotated when held by a third-person entity and not just the way a held item is, you will need a special renderer to tell Minecraft to do that.

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

    • When I first heard about Bitcoin back in 2018, I was skeptical. The idea of a decentralized, digital currency seemed too good to be true. But I was intrigued as I learned more about the technology behind it and its potential. I started small, investing just a few hundred dollars, dipping my toes into the cryptocurrency waters. At first, it was exhilarating to watch the value of my investment grow exponentially. I felt like I was part of the future, an early adopter of this revolutionary new asset. But that euphoria was short-lived. One day, I logged into my digital wallet only to find it empty - my Bitcoin had vanished without a trace. It turned out that the online exchange I had trusted had been hacked, and my funds were stolen. I was devastated, both financially and emotionally. All the potential I had seen in Bitcoin was tainted by the harsh reality that with decentralization came a lack of regulation and oversight. My hard-earned money was gone, lost to the ether of the digital world. This experience taught me a painful lesson about the price of trust in the uncharted territory of cryptocurrency. While the technology holds incredible promise, the risks can be catastrophic if you don't approach it with extreme caution. My Bitcoin investment gamble had failed, and I was left to pick up the pieces, wiser but poorer for having placed my faith in the wrong hands. My sincere appreciation goes to MUYERN TRUST HACKER. You are my hero in recovering my lost funds. Send a direct m a i l ( muyerntrusted ( @ ) mail-me ( . )c o m ) or message on whats app : + 1 ( 4-4-0 ) ( 3 -3 -5 ) ( 0-2-0-5 )
    • You could try posting a log (if there is no log at all, it may be the launcher you are using, the FAQ may have info on how to enable the log) as described in the FAQ, however this will probably need to be reported to/remedied by the mod author.
    • So me and a couple of friends are playing with a shitpost mod pack and one of the mods in the pack is corail tombstone and for some reason there is a problem with it, where on death to fire the player will get kicked out of the server and the tombstone will not spawn basically deleting an entire inventory, it doesn't matter what type of fire it is, whether it's from vanilla fire/lava, or from modded fire like ice&fire/lycanites and it's common enough to where everyone on the server has experienced at least once or twice and it doesn't give any crash log. a solution to this would be much appreciated thank you!
    • It is 1.12.2 - I have no idea if there is a 1.12 pack
  • Topics

×
×
  • Create New...

Important Information

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