Jump to content

Make a weapon appear in both hands


Eastonium

Recommended Posts

So for my mod I am using my own Player Renderer, so that's not a problem. Currently I have been able to add a second weapon in the player's hand, but It only works in 3rd person. It doesn't show up in 1st person. Also, I can't get the player's left hand to rotate like it does when you're holding something. (Interesting thing there, there's already code for it in the model file.) But it won't work.

public void doRenderCustom(AbstractClientPlayer par1AbstractClientPlayer, double par2, double par4, double par6, float par8, float par9)
{
	if (MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Pre(par1AbstractClientPlayer, this, par9))) return;
	GL11.glColor3f(1.0F, 1.0F, 1.0F);
	ItemStack itemstack = par1AbstractClientPlayer.inventory.getCurrentItem();
	this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = itemstack != null ? 1 : 0;
	this.modelArmorChestplate.heldItemLeft = this.modelArmor.heldItemLeft = this.modelBipedMain.heldItemLeft = itemstack != null ? 1 : 0;

	if (itemstack != null && par1AbstractClientPlayer.getItemInUseCount() > 0)
	{
		EnumAction enumaction = itemstack.getItemUseAction();

		if (enumaction == EnumAction.block) 
		{
			this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 3;
		}
		else if (enumaction == EnumAction.bow)
		{
			this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = true;
		}
	}

	this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = par1AbstractClientPlayer.isSneaking();
	double d3 = par4 - (double)par1AbstractClientPlayer.yOffset;

	if (par1AbstractClientPlayer.isSneaking() && !(par1AbstractClientPlayer instanceof EntityPlayerSP))
	{
		d3 -= 0.125D;
	}

	super.doRender((EntityLivingBase)par1AbstractClientPlayer, par2, d3, par6, par8, par9);
	this.modelArmorChestplate.aimedBow = this.modelArmor.aimedBow = this.modelBipedMain.aimedBow = false;
	this.modelArmorChestplate.isSneak = this.modelArmor.isSneak = this.modelBipedMain.isSneak = false;
	this.modelArmorChestplate.heldItemRight = this.modelArmor.heldItemRight = this.modelBipedMain.heldItemRight = 0;
	this.modelArmorChestplate.heldItemLeft = this.modelArmor.heldItemLeft = this.modelBipedMain.heldItemLeft = 0;
	MinecraftForge.EVENT_BUS.post(new RenderPlayerEvent.Post(par1AbstractClientPlayer, this, par9));
}

This is what I have in my Custom PlayerRender. The left hand never rotates upward.

 

And for the 1st person part... I have no clue. this is what I have:

public void renderFirstPersonArm(EntityPlayer par1EntityPlayer)
{
	float f = 1.0F;
	GL11.glColor3f(f, f, f);
	this.modelBipedMain.onGround = 0.0F;
	this.modelBipedMain.setRotationAngles(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F, par1EntityPlayer);
	this.modelBipedMain.bipedRightArm.render(0.0625F);
	this.modelBipedMain.bipedLeftArm.render(0.0625F);
}

And the left hand is really low, and is hidden by the hotbar. ???? I don' know why... Could someone help?

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



×
×
  • Create New...

Important Information

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