User:Umucraft/How to obtain technical blocks as an item

This is a tutorial that shows how to register and obtain technical blocks as an item (Java Edition exclusive) This tutorial is referenced on 1.12.2. The versions 1.13 and onwards uses a completely different system to define items.

At first, you have to set up your environment. You can download MCP from this link: http://www.modcoderpack.com/

After you downloaded, run decompile.bat for decompliation and deobfuscation of Minecraft. Wait it to finish.

Now, decompiled code is outputted in "src" folder. Find net.minecraft.item.Item.

After you found the class, open with a text editor and write this to register nether portal block (to the registerItems field):

registerItemBlock(Blocks.PORTAL);

!! Important: Do not forget to run recompile.bat to apply your changes !!

Run startclient.bat to start the modified client and try this command:

/give @p minecraft:portal

It should give you an item with numerical id #0090 and resource location minecraft:portal. It has initially missing texture. Try to place. It should place a nether portal block tilted to X axis.

Let's solve missing texture problem. Firstly, find net.minecraft.client.renderer.RenderItem.

After write this to register portal ItemBlock in the renderer:

this.registerBlock(Blocks.PORTAL, "portal")

Define a model for item "portal".

Try again to obtain minecraft:portal. Now it should have the texture and animation of nether portal block.

You can register other technical blocks with this method. For example, if you intend to register stationary water ItemBlock, the only difference is the block registry key and string id. In this case, it is "Blocks.WATER" and "water".

If you have any kind of problem (such as bugs, crashes etc.) with this tutorial, you can write in my user talk page.