ContentTweaker

ContentTweaker

27M Downloads

Can't figure how to make a directional block

CelestialPhoenix opened this issue ยท 1 comments

commented

Trying to make a block that can be placed in different orientations/directions (such as the dispenser/log)
The result is a block with the purple/block error texture on 6 sides (can't tell if its actually rotated or not).
[the textures work fine as a normal block]

Been looking at the vanilla blockstates and models to try and figure this; but I can't see what I'm missing. Am I on the right track or barking up the wrong tree?

TestRotation.zs

#loader contenttweaker

import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Block;

var Test1 = VanillaFactory.createBlock("test", <blockmaterial:rock>);
Test1.setBlockHardness(5.0);
Test1.setBlockResistance(15.0);
Test1.setToolClass("pickaxe");
Test1.setToolLevel(2);
Test1.setBlockSoundType(<soundtype:stone>);
Test1.setSlipperiness(0.6);
Test1.register();

test.json (blockstate)

{  
   "forge_marker":1,
   "defaults":{  
      "facing=up":{  
         "model":"contenttweaker/models/block/testmodel"
      },
      "model":"cube_all",
      "uvlock":false,
      "transform":"forge:default-block"
   },
   "variants":{  
      "normal":[  
         {  

         }
      ],
      "inventory":[  
         {  

         }
      ],
      "facing=down":{  
         "model":"contenttweaker/models/block/testmodel",
         "x":180
      },
      "facing=north":{  
         "model":"contenttweaker/models/block/testmodel",
         "x":90
      },
      "facing=south":{  
         "model":"contenttweaker/models/block/testmodel",
         "y":180,
         "x":90
      },
      "facing=west":{  
         "model":"contenttweaker/models/block/testmodel",
         "y":270,
         "x":90
      },
      "facing=east":{  
         "model":"contenttweaker/models/block/testmodel",
         "y":90,
         "x":90
      }
   }
}

testmodel.json (model)

{  
   "parent":"block/orientable",
   "textures":{  
      "up":"contenttweaker:blocks/test/testfront",
      "down":"contenttweaker:blocks/test/testback",
      "north":"contenttweaker:blocks/test/testside",
      "south":"contenttweaker:blocks/test/testside",
      "east":"contenttweaker:blocks/test/testside",
      "west":"contenttweaker:blocks/test/testside",
      "particle":"contenttweaker:blocks/test/testside"
   }
}
commented

It's not possible to add states to ContentTweaker blocks. You'd basically have to create 6 blocks. I've continued to try and figure out how best to handle blockstates but have never been able to handle it in a simple way on the script side.