Jump to content

Recommended Posts

Posted (edited)

Hello everyone,

I'm attempting to set the rotation angles of my model, however, it's not working. So what I've done so far: Made a Living entity, cancelled render player event at pre. Then I called a dorender method for the custom living entity. The new model loads fine. Just the animations do not. I'm thinking that it's because I'm typing this line in the render player event pre, which i suppose only fires when the player is being rendered the first time? I'm really not sure though. Any help is appreciated!

Here's what I've tried.

    @SubscribeEvent
    public static void onPlayerRender(RenderPlayerEvent.Pre event) {
        if (event.getEntity() instanceof EntityPlayer) {
            event.setCanceled(true);
        }

        RenderRealPlayer renderRealPlayer = new RenderRealPlayer(Minecraft.getMinecraft().getRenderManager(), new ModelRealPlayer());
        EntityRealPlayer player = new EntityRealPlayer(Minecraft.getMinecraft().world);
        renderRealPlayer.doRender(player, 0, 0, 0, 0.5f, event.getPartialRenderTick());
        renderRealPlayer.getMainModel().setRotationAngles(player.limbSwing, player.limbSwingAmount, player.ticksExisted, player.rotationYawHead, player.rotationPitch, 0.0f, player);

Also tried setting the rotation angles in living update event and didn't get very far because it felt wrong.

 

Edited by LittleOne
Posted
  On 7/1/2018 at 12:11 AM, LittleOne said:
    @SubscribeEvent
    public static void onPlayerRender(RenderPlayerEvent.Pre event) {
        if (event.getEntity() instanceof EntityPlayer) {
            event.setCanceled(true);
        }

        RenderRealPlayer renderRealPlayer = new RenderRealPlayer(Minecraft.getMinecraft().getRenderManager(), new ModelRealPlayer());
        EntityRealPlayer player = new EntityRealPlayer(Minecraft.getMinecraft().world);
        renderRealPlayer.doRender(player, 0, 0, 0, 0.5f, event.getPartialRenderTick());
        renderRealPlayer.getMainModel().setRotationAngles(player.limbSwing, player.limbSwingAmount, player.ticksExisted, player.rotationYawHead, player.rotationPitch, 0.0f, player);

 

 

Expand  
 

You are creating a new instance of EntityRealPlayer every time the player is rendering and then using the variables from that instance, instead of the player that is already in the world.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I might understand. Thanks for the help! 

Tried a few things but still can't get it to work. Would I have to pull everything from event. ? From where I would have to change what my entity and render class inherits from? Right now they're not from renderplayer or entityplayer.

 

Or do I just need to pull the variables from event and apply them to set rotation angles? I tried this, but perhaps I did it wrong?

Posted
  On 7/1/2018 at 1:14 AM, LittleOne said:

I might understand. Thanks for the help! 

Tried a few things but still can't get it to work. Would I have to pull everything from event. ? From where I would have to change what my entity and render class inherits from? Right now they're not from renderplayer or entityplayer.

 

Or do I just need to pull the variables from event and apply them to set rotation angles? I tried this, but perhaps I did it wrong?

Expand  
event.getEntityPlayer().limbSwing;

Will give you the actual players limbSwing, also why not make your renderer use EntityPlayer, what is the point of using a new Entity?

  • Like 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Honestly, I thought that was the only way to render a new model onto the player. While learning, I gathered that an entity has three things. Entity, render, and model classes. Going to test a few things now to try and fix it. Thank you.

Posted

I attempted to render the entityplayer in the new renderer. Is there a way to change the main model though? I'm not seeing getmainmodel or setrotationangles. Perhaps I didn't follow your suggestion right?

 

What I did: public class RenderRealPlayer extends Render<EntityPlayer>

Posted
  On 7/1/2018 at 3:09 AM, LittleOne said:

What I did: public class RenderRealPlayer extends Render<EntityPlayer> 

Expand  

Extend RenderPlayer and then in the constructor set the mainModel variable to whatever your model is, and if this doesn't work for you then tell me exactly what you are trying to accomplish by setting the rotation angles and overriding the main model.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I'm trying to get the animations set in the rotation angles in the model class to work. They're supposed to be consistent back and forth animations of the designated box. The method does fire but it auto rotates to only one side instead of going back and forth. The animations work for a mob entity extending, for example, entity horse, just not the player. That's why I was using entityliving because the animations definitely work for it. However, since it doesn't work, it leads me to believe it's something with how I render the player. And you said that I'm creating a new instance of the player every time it's rendering and using the variables from that instance. If set rotation angles is already being called then I finally see that it doesn't need to be called again. Just the way I'm rendering it is wrong. Is it impossible to render what I'm attempting to render through entityliving/renderliving? If it is, I did try your way. I got a stack overflow error null at the dorender method in the renderplayerevent, pre. I've never learned about this type of error. What I tried was:

EntityPlayer player = event.getEntityPlayer();
EntityPlayerSP playerSP = (EntityPlayerSP)player;
RenderRealPlayer renderRealPlayer = new RenderRealPlayer(insert proper perameters here);
renderRealPlayer.doRender(playerSP, 0, 0, 0, 0.5f, event.getPartialRenderTicks);

So I looked up this type of error and found that the usual cause is deep recursion or an infinite loop of some sort. After reading this, I attempted to realize how it was calling itself. My IQ is very low so I, of course, was not able to accomplish this goal. Therefore, I'm unsure how to fix this and what I did wrong. Moving into uncharted territory, I was scared. So I went back to extending renderliving<EntityRealPlayer>. This does not mean that I'm not willing to return to this method. 

 

Next, I contacted someone more experienced in programming minecraft mods. Specifically animations. They too have not yet figured out what's going on. It seems you know exactly what's going on though. I'm just really hard headed and unlikely to learn quickly. You're giving me the answers. It's just that I have so many presumptions that it's making it difficult to process new information.


Truly sorry if I'm giving you a headache. It's not my intention even if it's occurring. I really do appreciate your time in helping me solve this.

Posted
  On 7/1/2018 at 5:15 PM, LittleOne said:

Truly sorry if I'm giving you a headache. It's not my intention even if it's occurring. I really do appreciate your time in helping me solve this.

Expand  

Honestly, this is not a problem. If I received a headache from this I would have just gone to sleep, taken some medicine, or just took a break in general.

 

  On 7/1/2018 at 5:15 PM, LittleOne said:

So I looked up this type of error and found that the usual cause is deep recursion or an infinite loop of some sort. After reading this, I attempted to realize how it was calling itself. My IQ is very low so I, of course, was not able to accomplish this goal. Therefore, I'm unsure how to fix this and what I did wrong.

Expand  

The recursion was caused by RenderPlayer.doRender calling the RenderPlayerEvent.Pre

if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.RenderPlayerEvent.Pre(entity, this, partialTicks, x, y, z))) return;

To fix this just simply override RenderPlayer#doRender and use the same code but exclude that line of code.

 

Mind you this will just render your model with the default vanilla way so you may have to override the whole doRender method.

  • Thanks 1

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

I followed your instructions and everything worked out! Thank you soooo much!.

 

I ended up creating a RenderLivingBaseEx that inherits from renderlivingbase and changed the dorender method as instructed. Then I inherited from the class in my RenderLivBaseExEx and did some more things, then finally in my renderrealplayer class I used RenderLivBaseExEx, plugged in my model and texture and the animations are now playing. 

 

I love this site.

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

    • My name is Richie Leo, and I’m sharing this message with a heart full of gratitude and hope. Several months ago, I was a victim of a devastating online scam that cost me a staggering $873,463. I was devastated, confused, and had nearly given up on ever recovering my money — until I came across Wizard George Cyber Service. Through their exceptional cyber recovery expertise and deep investigative skills, Wizard George and his team were able to trace, track, and recover the full amount that was stolen from me. Their professionalism, speed, and transparency truly amazed me. If you’re reading this and you’ve been scammed — whether it’s crypto, investment fraud, or any kind of online theft — don’t give up. I strongly recommend reaching out to Wizard George Cyber Service. 📧 Em: wizardgeorgecyberservice(AT) g m a l L. C o M
    • Alright, here is the log file https://mclo.gs/5eCwafV
    • Please read the FAQ (https://forums.minecraftforge.net/topic/125488-rules-and-frequently-asked-questions-faq/) and post log files as described there, using a site such as https://mclo.gs/ and post the link here.  
    • I tried updating the mods in my modpack which caused incompatibilities so i have tried to revert them back to their older versions i was using before. In the logs it doesnt show me any clear incompatibilities except for tfmg & entity texture features, but when i try to remove those it still doesn't work. I have tried removing the forge-client.toml file which was a suggestion i found on  a few other posts. This is the log file i get. [inline log removed] Any help would be appreciated. Thanks in advance
    • I don't use KubeJS, never even heard of it. But after doing what "Ugdhar" suggested earlier in this post with the "config/Mekanism/generator-storage.toml", I tried going into an individual save's serverconfig folder, and just deleting everything except the parcool folder (I have that mod installed.) Then, a bit of loading and temporary freezing later, seems to have worked. Even when quitting to menu and loading back in, or also when quitting to menu, exiting to desktop, and re-launching MC, choose a save and loading it.
  • Topics

  • Who's Online (See full list)

    • There are no registered users currently online
×
×
  • Create New...

Important Information

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