Jump to content

[SOLVED] [1.8] Returning .JSON Model In Third Person


EverythingGames

Recommended Posts

Hi

As the title says, I want to return a .json model in third person. How would I be able to check if I was in third person and change the ModelResourceLocation of an item? I have the model, I just need to know if this is possible and if players on a multiplayer server would be able to see the third person model rather than the first person model. If I could also add that I would like to also return a texture rather than a model for the inventory (Gui) view. Thanks all in advance!

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

I did it in my item class, override getModel method:

@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) {
		return /* some resource */
	} else {
		return /* some other resource */
	}
}

 

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.

Link to comment
Share on other sites

That looks like that'll work! I thought about doing exactly that, but I wanted to make sure it was fullproof. May I ask why you are checking the player's unique ID? Thanks so much for the response!

Development of Plugins [2012 - 2014] Development of Mods [2012 - Current]

Link to comment
Share on other sites

Sure.

These code works on client side. When rendering other players, they are looked from your eyes. That means they are always in third view. If not check unique ID, other players' item are rendered as first view when you are in first view.

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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