I made a class that automatically generates Json that specifies Minecraft texture etc. [1.12.2]

Introduction

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!

Development environment

Source code

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.

0b7ba4beb506998c18ebdbfa128f1b98.png ** 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. 2ca6399ba26c62e31ac69f61bcbef145.png 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.

What you can do

Automatic block state generation

6d546cd92438a2cec97c2a3acfc254d0.png

--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.

Automatic block model generation

007f8ec437b36eb656432ebb23f563a6.png

--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 ** _ **.

Automatic generation of item model

--Block items --Basic items --Tool items

The model for the block is used for display in the inventory.

How to use

2cb47f13461cde9d162247862c06d62d.png

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.

I want to use it in other versions!

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. 67788e672eb17e461253f197ad0a33dd.png

At the end

I think this class will dramatically increase the development speed. It's a pretty confident work. Lol Please use it. Well then!

Recommended Posts

I made a class that automatically generates Json that specifies Minecraft texture etc. [1.12.2]
I made a source that automatically generates JPA Entity class files
I made a mod that instantly calls a vehicle with Minecraft
I made a viewer app that displays a PDF
I made a JAVA framework "numatrix" that easily generates unique numbers in a distributed environment & multithreading.
I made a question that can be used for a technical interview