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

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.

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

  • Author

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.

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! ;)

  • Author

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

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.