Jump to content

[1.12.2] Creating a custom ItemMap and rendering it in hand & in ItemFrame

Major Squirrel

Recommended Posts

Good evening everyone,


I am working on a custom map item (original MC is ItemEmptyMap and ItemMap which inherit from ItemMapBase), the purpose is to act the same way as the original one except that I would like some information rendered on it. Also, I would like it to be an item apart but I basically make my item inherit from ItemMap.


The part I am struggling with is rendering the map in player's hand and in an item frame. From what I observe in the code, the concerned renderer is the ItemRenderer which renders instances of ItemMap and also MapItemRenderer which renders icons and decorations.


Is there any way to affect a specific ItemRenderer for my custom map or an event that could catch the rendering and to play with ?



Squirrel ! Squirrel ! Squirrel !

Link to comment
Share on other sites


I found out that there is the Forge event RenderSpecificHandEvent which is called for each hand (MAIN_HAND and OFF_HAND). I ended up subscribing to it and making my own rendering functions, based on the ItemRenderer class. Functions that I simply copy-pasted are renderItemInFirstPerson and renderMapFirstPerson.

I find it a bit "dirty" that there is a conditional branching only to render an ItemMap inside the rendering pass of Minecraft. Also, certain rendering functions such as renderArms are private and thus could not be overriden or properly called : I have to copy-paste those functions to simulate the same behavior.


Do you think it would be possible create a specific event for the map rendering, considering its unique condition in the code ? What do you think ?

Squirrel ! Squirrel ! Squirrel !

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.

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.

  • Create New...

Important Information

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