Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Anyone knows how to access and rotate the player right arm a bit up?

Of corse i have an ItemRedner class and its working.

I want the player to hold something up.

 

I've tryed with ModelBiped but no luck.

 

Thanks

This tutorial by Ichun (the creator of the portalgun mod) shows how to create custom rendered Items. He also shows how to edit the players arm rotation.

Its a bit old but most of the code is still working.

 

 

Good luck :D

Busti

PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.

  • Author

I saw that video and bow anim isn't god fpr me.

I want only the right hand up. Like holding a lantern.

You want to hold it like a lantern right? Go into the ModelBiped class, and then look into the setRotationAngles function:

 

public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)

{

    //ALL THAT DIFFERENT UNDERSTANABLE CODE HERE xD

}

 

The second step, is to add new code to the end of the function.

 

public void setRotationAngles(float par1, float par2, float par3, float par4, float par5, float par6, Entity par7Entity)

{

    //ALL THAT DIFFERENT UNDERSTANABLE CODE HERE xD

 

    if(par7Entity instanceof EntityPlayer){ //CHECKING IF THE ENTITY IS A PLAYER

        EntityPlayer player = (EntityPlayer) par7Entity;

        if(player.getCurrectItem().itemID == ItemSometgingasda.item_Lantern.itemID){ //CHECKING IF THE PLAYER IS HOLDING THE LANTERN. CHANGE THAT IF YOU NEED

        this.bipedRightArm.rotateAngleX+=90.0f/180f*3.14f; //APPLYING THE ROTATION TO THE RIGHT ARM :)

    }

}

 

Remember, the new code should be at the end of the setRotationAngles function :).

 

 

  • Author

Thaks for that, but in 1.7.2 i can't edit base classes.

Any way wihout editing base classes.

Im trying to get an instance of that class but no luck.

You have to make a new RenderPlayer class with a new ModelBiped class, and attack the new RenderPlayer class to the player.

 

Do it the same as you would register a renderer for a mob, but do it for EntityPlayer instead.

 

Copy RenderPlayer class, and rename it, and tweak a little bit.

Note that doing so will make your mod incompatible with any other mod that attempts to modify the player's rendering. It is much better for compatibility's sake if you can manage to do what you want using the Forge RenderPlayerEvent hooks. I imagine it would be basically the same, using the post player render event to hook in at the end of rendering to modify the player's arm rotation like GoblinBob mentioned above.

  • Author

So far i made:

LanternRenderEventHandler:

 

 

@SideOnly(Side.CLIENT)

@SubscribeEvent

public void lanternHolding(RenderLivingEvent.Pre event)

{

if (!event.isCanceled() && event.entity instanceof EntityPlayer)

{

ItemStack item = event.entity.getHeldItem();

 

if (item == null)

{

return;

}

 

RenderPlayer rp;

 

if (item.getItem() != Lantern.lanternonItem)

{

if (item.getItem() == Lantern.lanternoffItem)

{

rp = (RenderPlayer)event.renderer;

                rp.modelArmorChestplate.heldItemRight = rp.modelArmor.heldItemRight = rp.modelBipedMain.heldItemRight = 6;

}

}

else

{

rp = (RenderPlayer)event.renderer;

                rp.modelArmorChestplate.heldItemRight = rp.modelArmor.heldItemRight = rp.modelBipedMain.heldItemRight = 6;

}

}

}

 

 

 

So in the RenderPlayer some methods are private.

I have to create new one as GoblinBob said and its done?

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.