Jump to content

[1.20.1] Resource & DataGen


1HA

Recommended Posts

I want to know why the item textures are not loaded. As far as I know, I did everything that I had to. (models/item/example.json & textures/items/example.json). Has something changed with /resource?

https://github.com/1hwai/Firstman/tree/master/src

Meanwhile, I want Datagenerator to generate only the block state of CableBlock, not the block model. 

Since CableBlock has too many connection states, I made auto-generating code for its block model .json file, which is written in TypeScript. And it's working very fine. But the problem is, that block state builder also builds block models too. I know this is not an error, but every time I run runData, I have to remove those files(generated\resources\assets\firstman\models\block\cable\...). I tried to fix it, but the reflection error came out.

(ModBlockStates.java)

 protected void registerCables() {
        CableBlock[] cables = {BlockInit.CABLE_BLOCK.get()};
        for (CableBlock cableBlock : cables) {
            VariantBlockStateBuilder bld = getVariantBuilder(cableBlock);

            Queue<ArrayList<Boolean>> queue = new LinkedList<>();
            ArrayList<Boolean> start = new ArrayList<>();
            queue.add(start);

            while (!queue.isEmpty()) {
                ArrayList<Boolean> element = queue.poll();
                if (element.size() < 6) {
                    ArrayList<Boolean> temp1 = new ArrayList<>(element);
                    ArrayList<Boolean> temp2 = new ArrayList<>(element);
                    temp1.add(true);
                    temp2.add(false);
                    queue.add(temp1);
                    queue.add(temp2);
                } else if (element.size() == 6) {
                    String status = (element.get(0) ? "u" : "") + (element.get(1) ? "d" : "")
                            + (element.get(2) ? "n" : "") + (element.get(3) ? "s" : "") + (element.get(4) ? "e" : "") + (element.get(5) ? "w" : "");
                    if (status.equals("")) status = "none";

                    String path = "block/cable/" + status;
                    BlockModelBuilder cable = models().getBuilder(path);
                    bld.partialState().with(UP, element.get(0)).with(DOWN, element.get(1)).with(NORTH, element.get(2)).with(SOUTH, element.get(3)).with(EAST, element.get(4)).with(WEST, element.get(5))
                            .modelForState().modelFile(cable).addModel();
                }
            }
        }
    }

 

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.

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.