Nowadays, Minecraft resources have been implemented in block state since 1.8, so I have to write Json to assign textures accordingly. Because of that, it has become possible to easily implement 3D models. However, at the time of modding, I had to write at least one Json for all the additional content, which I found very annoying.
Actually, I made the code itself a few months ago, but after a long time I rewrote it to make it easier to use.
I will publish it because it is a big deal!
The source code is available on GitHub. In addition, we referred to some source code from ** GitHub defeatedcrow / HeatAndClimateLib ** for development. You are free to divert or modify it based on the terms of the reference source.
GitHub NaturalStyle2 (repository) GitHub NaturalStyle2-JsonHelper (link that jumps directly to the class)
Originally it was a part of a mod that I made slowly as a hobby, so the name etc. are for that. If you want to use it in your own environment, please modify at least the following parts.
** isDebug ** is used for the judgment because I want to run the process only in debug mode so that the operation does not become heavy. I am able to change it with config, but if I am not particular about it, can I rewrite it directly with false / true?
For ** modID **, write the ModID of your development environment. Enter ** the path of the resources folder of the development environment ** in the argument. You can copy and paste the path that you can see in Explorer etc.
--Basic block (soil, stone ...) --Blocks with north, south, east and west directions (Kamado, dispenser ...)
Since the direction is fixed to the north side, you need to write a code to rotate it accordingly.
--Basic block (1 sheet) --Blocks with north, south, east and west directions (3: top, front, side) --Blocks with top and bottom and side textures (2: top, side) --Blocks with top, bottom and side textures (3: top, side, bottom)
The number in parentheses is the required number of textures. ** top ** etc. are names that need to be added after the base texture name along with ** _ **.
--Block items --Basic items --Tool items
The model for the block is used for display in the inventory.
The class ** JsonHelper ** is the class that actually does the processing. For example, in the case of an image, the method that performs the processing is called in the constructor of the class of the block to be added.
public void registerJson(Object target, JsonType type, String name)
instance of target Block or Item type Select the type you want to implement from within JsonType name The name used for output
The name part is written on the assumption that ** getUnlocalizedName () ** is used, so please use that.
This class is expected to work with 1.12.2, so there is a high probability that it will not work with other versions.
In that case, in the process of ** generateJson (...) **, I think that the contents of substituting ** output ** in the middle for each JsonType should be changed.
I think this class will dramatically increase the development speed. It's a pretty confident work. Lol Please use it. Well then!
Recommended Posts