Jump to content

Recommended Posts

Posted

I am trying to render an item which looks different in first person and third person view. And in vanillia minecraft, filled map is the only item satisfies it.

I read the code but got confused. I didn't find the methods rendering hands and map, and even json model named "item/filled_map" is rendered.

So I need help about rendering mechanism of filled map. And is it feasible to render my own items in this way?

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

Posted

You can probably hack that by using Item.getModel, where you return a different model depending on whether the current view is first person or third person.

 

Custom rendering like the map can probably be done the same way, perhaps using ISmartItemModel. 

 

Maps are rendered as a "special case" in ItemRenderer.renderItemInFirstPerson() - see           

if (this.itemToRender.getItem() == Items.filled_map)

            {

                this.func_178097_a(entityplayersp, f3, f1, f2);

            }

It probably won't be much help to you...

 

-TGG

Posted

You can probably hack that by using Item.getModel, where you return a different model depending on whether the current view is first person or third person.

Thanks a lot.

But my Item.getModel looks like this:

public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) { ... }

There's no camera informations in this method. I don't know whether it's first person or third.

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

Posted

public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) { ... }

There's no camera informations in this method. I don't know whether it's first person or third.

 

Inside the player perhaps?

just you wait! ;)

Posted

Minecraft.getMinecraft().gameSettings.thirdPersonView

 

Considering multiplayer:

@Override
@SideOnly(Side.CLIENT)
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
	Minecraft mc = Minecraft.getMinecraft();
	boolean isFirstPersonView = mc.thePlayer.getUniqueID().equals(player.getUniqueID()) &&
			mc.gameSettings.thirdPersonView == 0;
	if(isFirstPersonView) {
		/* ... */
	} else {
		/* ... */
	}
	return null;
}

 

Thank you, TGG.

Author of Tao Land Mod.

width=200 height=69http://taoland.herbix.me/images/1/14/TaoLandLogo.png[/img]

Also, author of RenderTo

----

I'm not an English native speaker. I just try my best.

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.