Jump to content

[1.16] Custom item rendering | custom map item rendering


Recommended Posts

Posted

Hello fellow minecraft modding enthusiasts,

 

i'm trying to make a custom map item, similar to the existing one in vanilla minecraft. This custom map item should use different colors for the grass block for each biome.

 

Where I stay so far:

In my first step i tried to play around with the colorValue of MaterialColors in making my own CustomMaterialColors. After that, I created a CustomFilledMapItem extending FilledMapItem and overwrote the method updateMapData(...) (just letting minecraft pick the index of the color out of CustomMaterialColors instead of MaterialColors). This logically didn't work, because when the CustomFilledMapItem is rendered in MapItemRenderer, the public method updateMapTexture(MapData mapdataIn) is called which leads to the private method updateMapTexture(). In this method the colorValue is get from MaterialColors. So i think that i have to implement my own custom version of MapItemRender but i don't how to register a custom renderer and link it to my new items in minecraft forge.

 

My Questions are:

How can i say to minecraft: "If the player helds an instance of my custom made item in his main hand, render it by my custom made renderer instead of the allready implemented ones."

Do i have to use the ItemStackTileEntityRenderer in that case? If yes, how exactly do i use it and do you have an example where i can look at? My approach would be something like: 

  1. CustomFilledMapItem would not extending FilledMapItem anymore. 
  2. CustomFilledMapItem extends now AbstractMapItem (Maybe not so good idea -> Mc using its own MapItemRenderer again). Maybe implementing the Interface IBakedModel as written in the documentation?
  3. The constructor of CustomFilledMapItem would call super(new Item.Properties().setISTER(...)). But what is the argument needed for #setISTER(...)?
  4. I would create a CustomMapItemRenderer class extending ItemStackTileEntityRenderer and implement the #render(...) method.
  5. In addition to step four i would copy paste the needed and adjusted behavior of MapItemRenderer.

If no, do i have to handle the rendering within events? Let's say each game tick it checks if the item held is instance of CustomFilledMap -> render it with custom Renderer (Possible IllegalStateException - Not right thread to render?).

 

I am new to minecraft modding and i know it's more complex then adding a simple item. Therefore i don't now the hole scope of this "little one new added item project". In the first step it should only be rendered correctly if the player selected the item in the menu bar and if he's in first person mode. Thanks in advance!

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.