Jump to content

Recommended Posts

Posted

You know when a player aims a bow and the player's arms rotate up a bit? I'm trying to rotate the player's arms in a similar fashion.

 

I've overrided the player model and the player renderer.

 

This is my code:

This code doesn't work. The customrenderplayer and customrendermodel dont even get called for some reason.

 

CustomRenderPlayer

public class CustomRenderPlayer extends RenderPlayer
{
Minecraft minecraft = Minecraft.getMinecraft();
EntityPlayer player = minecraft.thePlayer;

public CustomRenderPlayer(RenderManager renderManager) {
	super(renderManager);
	// TODO Auto-generated constructor stub
	mainModel = new CustomRenderModel();
}




}

 

 

CustomRenderModel

public class CustomRenderModel extends ModelPlayer
{

 public CustomRenderModel() 
 {
  super(0.0F, false);
 }

 @Override
 public void setRotationAngles(float paramFloat1, float paramFloat2, float paramFloat3, float paramFloat4, float paramFloat5, float paramFloat6, net.minecraft.entity.Entity paramEntity)
 {
	 System.out.println("pls");
	 this.bipedRightArm.rotateAngleX = 90.0F;
 } 

}

 

 

ClientProxy

@SideOnly(Side.CLIENT)
public class ClientProxy extends CommonProxy {

    private static final Minecraft mc = Minecraft.getMinecraft();
    public static CustomRenderPlayer renderCustomPlayer;
    @Override
    public void preInit(FMLPreInitializationEvent event)
    {
        super.preInit(event);
        MinecraftForge.EVENT_BUS.register(new ClientEventHandler());
        renderCustomPlayer = new CustomRenderPlayer(Minecraft.getMinecraft().getRenderManager());
    }

    @Override
    public void init(FMLInitializationEvent event)
    {
        super.init(event);
    }

    @Override
    public void postInit(FMLPostInitializationEvent event)
    {
        super.postInit(event);
        Minecraft.getMinecraft().getRenderManager().entityRenderMap.put(EntityPlayer.class, renderCustomPlayer);

    }

 

ClientEventHandler

public class ClientEventHandler {

    
public void rplyr(RenderPlayerEvent.Post event){
	Minecraft.getMinecraft().getRenderManager().entityRenderMap.put(EntityPlayer.class, ClientProxy.renderCustomPlayer);
}
}

Posted

 

i see people doing this before

 

but i cant get it to work,

i have made some entities base on the player model, but idont get how to pase values to the vainilla ModelBiped 

 

the only thing i can thing is what you made, create a custom Model, and make it works based on NBT's aplied to player Entity

but later how you do this model to work in the server for the others clients to use it   

 

Posted

Why don't you cancel the render player event when needed, and use your renderer in its place?

 

So: (Pseudo-code, may or may not work exactly as written)

@SubscribeEvent
public void onRenderPlayerPre(RenderPlayerEvent.Pre event) {
    if (event.entityPlayer.getHeldItem() != null && event.entityPlayer.getHeldItem().getItem().equals(MOD.ITEM)) {
        event.setCancelled(true);
        this.customRenderer,render(/*args*/);
    }
}

Posted

I'm pretty sure there is a mod (Maybe battlegear?) that has a shield in it. I noticed they rotated the player's arm when holding the shield. You could try running through their code to find out how they did it.

I am not a cat. I know my profile picture is sexy and amazing beyond anything you could imagine but my cat like features only persist in my fierce eyes. I might be a cat.

Posted
JD-GUI may be in order.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

  • 2 weeks later...
Posted

JD-GUI is very annoying. While its the only thing possible to decompile a mod, it is very obfuscated and it requires another program to manually type in each and every function or method and in a class with 200 lines of obfuscated code, this method become impractical at best.

 

 

I'm not trying to make them aim like a bow, I'm trying to make it so that the arm rotates LIKE it does when you aim a bow, but I want the rotation to be completely different.

Posted

JD-GUI is very annoying. While its the only thing possible to decompile a mod, it is very obfuscated and it requires another program to manually type in each and every function or method and in a class with 200 lines of obfuscated code, this method become impractical at best.

 

Use BON to deobfuscate mods before decompiling them with a decompiler like JD-GUI, FernFlower, Procyon or CFR.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted

Battle gear (2) is open source. And I don't really recommend it as a source of knowledge. Unless something changed - they are overhauling a lot of stuff there. Stay safe with forge hooks. Just cancel goddamn arm rendering and render new one. What is so hard (I should re-read thread, but can't now, so maybe I'll repost).?

1.7.10 is no longer supported by forge, you are on your own.

Posted

Then PLEASE tell me how to do it. Please. It's been weeks. I just need someone to help me cancel the rendering and re-render and everything I've tried didnt work so please tell me how to do it man just please.

Posted

I think a big reason to why your class doesn't work is because of the way the RenderPlayer object is retrived from the RenderManager. This code here:

   public Render getEntityRenderObject(Entity p_78713_1_)
    {
        if (p_78713_1_ instanceof AbstractClientPlayer)
        {
            String s = ((AbstractClientPlayer)p_78713_1_).getSkinType();
            RenderPlayer renderplayer = (RenderPlayer)this.skinMap.get(s);
            return renderplayer != null ? renderplayer : this.field_178637_m;
        }
        else
        {
            return this.getEntityClassRenderObject(p_78713_1_.getClass());
        }
    }

 

Now, every player is an instance of

AbstractClientPlayer

and I think you can see one reason to why it doesn't work. You put the

RenderPlayer

object in

entityRenderMap

, but it should actually be in

skinMap

. Even with this I am not sure if your code will work, but at least this will point you in the right direction.

 

Good luck.

 

Edit: Well I see that

EntityPlayerMP

is not a child of

AbstractClientPlayer

, which makes things different. My knowledge about these things is limited but I hope it helps nontheless.

Posted

Edit: Well I see that

EntityPlayerMP

is not a child of

AbstractClientPlayer

, which makes things different. My knowledge about these things is limited but I hope it helps nontheless.

Every player on the client side is a subclass of
AbstractClientPlayer

, and every player on the server side is a subclass of

EntityPlayerMP

.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Posted

1. Cancel the rendering event of the player on the Pre stage

2. Launch your own renderer DoRender. Make sure it's actually called via debugger

3. Do whatever logic you need to in the renderer.

 

You can't replace the player's renderer/model, short of doing the above or using the popular API designed to replace player renderers.

I do pony stuff :3

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



×
×
  • Create New...

Important Information

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