ContentTweaker

ContentTweaker

27M Downloads

Basic created blocks don't cull faces

CroshB opened this issue ยท 2 comments

commented

I think there is an issue with the default block model for blocks created with contenttweaker where it doesn't cull it's faces.

To reproduce it just use this script that creates the simplest block possible:

#loader contenttweaker

import mods.contenttweaker.VanillaFactory;

var test = VanillaFactory.createBlock("test", <blockmaterial:rock>);
test.register();

This block is created, but the default model doesn't cull faces, here is a demonstration:

The block:
image

Not being culled:
image

What should be hapenning (same example using a vanilla block):
2019-07-12_00 01 54

commented

Here's a fix:
Make a block model and put it into your resources/contenttweaker/models/block folder
Here's a template:

{
  "parent": "block/cube",
  "textures": {
    "all": "contenttweaker:blocks/BLOCK_NAME_HERE"},
  "elements": [
    {
      "from": [ 0, 0, 0 ],
      "to": [ 16, 16, 16 ],
      "faces": {
        "down":  { "texture": "#all", "cullface": "down" },
        "up":    { "texture": "#all", "cullface": "up" },
        "north": { "texture": "#all", "cullface": "north" },
        "south": { "texture": "#all", "cullface": "south" },
        "west":  { "texture": "#all", "cullface": "west" },
        "east":  { "texture": "#all", "cullface": "east" }
      }
    }
  ]
}

I suggest naming it after your block. Your "all" texture should point to your texture in contenttweaker/textures/blocks folder. Don't add the .json part of the file name.

Next, go to contenttweaker/blockstates
Find your block.json file and open it up. It should look something like this:

  "forge_marker": 1,
  "defaults": {
    "textures": {
      "texture": "contenttweaker:blocks/BLOCK_NAME",
      "particle": "contenttweaker:blocks/BLOCK_NAME"
    },
    "model": "base:storage",
    "uvlock": true,
    "transform": "forge:default-block"
  },
  "variants": {
    "normal": [{}],
    "inventory": [{}]
  }
}

Change the model from base:storage to contenttweaker:BLOCK_NAME

You should now have the base cube model with your texture of choice with culling. There's probably a better way to do it, but this is what I come up after a few hours of tinkering with it.

commented

Big Thanks to you!