Skip to content

Instantly share code, notes, and snippets.

@covers1624
Last active December 5, 2016 11:20
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save covers1624/4722399d7782f376c58c0600a50b87fc to your computer and use it in GitHub Desktop.
Save covers1624/4722399d7782f376c58c0600a50b87fc to your computer and use it in GitHub Desktop.
CCL Blockstate format.
The CCL blockstate format is a super flexiable blockstate format, similar to forges BlockstateV1 format.
The similarities include variants modify the final model instead of vanillas "This SPECIFIC combo == this SPECIFIC model".
The differences, Sub Variants (Shall i continue?). You are able to define a variant block inside a variant value, infinitely..
So why is this needed?
Forges format does not let you override specific things for one variant based on the value of another variant.
So in my case it was, not being able to override things in the type=furnace variant based on the value of active=true
Instead you had to define exact variant combos for active=true,type=furnace AND active=false,type=furnace
resulting in duplicated data inside your json.
The CCL example shows how you can override something on a specific variant based on the value of the other variant.
In my case active based on type.
Another key difference between the CCL format and the Forge format is the way the parser compiles the variants for a ModelBlockDeffiniton.
CCL's format requires you to define a string array with the name "variant_sets" containing the values and order in whitch to generate all possible combos for.
For example: if you define just "type" inside the variant sets array, the parser will only create ModelBlockDeffinitions for all the type=value variants.
But if we define "active,facinghoz,type" it will generate all possible combontations of values assigned to those keys in that order.
Additional Tweaks.
You can define a default texture domain if one is not ser for a given texture, simply add "texture_domain" : "mymod", to the top of the blockstate file.
{
"ccl_marker": "This actually means nothing.",//This is needed to tell the loader to use the CCL parser. The value does not matter.
"variant_sets" :[//This is used to define what variants the parser needs to compile for a model.
"active,facinghoz,type",// In this instance we need a active,facinghoz,type variant and a type variant, type is used for inventory and active,facinghoz,type is used for world.
"type"
],
"defaults": {//Any defaults.
"model": "minecraft:cube",
"transform": "ccl:default-block"//Full list of supported transforms can be found in TransformUtils inside CCL.
},
"variants": {//Main variants block. Anything defined in here will be applied to the model first.
"type": {//Main Variant Key.
"furnace": {//Main Variant value
"textures": {//Overriden from default.
"particle": "mymod:blocks/machine/furnace/side",
"down": "mymod:blocks/machine/furnace/top",
"up": "mymod:blocks/machine/furnace/top",
"north": "mymod:blocks/machine/furnace/front",
"south": "mymod:blocks/machine/furnace/side",
"east": "mymod:blocks/machine/furnace/side",
"west": "mymod:blocks/machine/furnace/side"
},
"variants": {//Sub variants.
"active": {//Sub variant key, Notice the key does not have to be defined in the main variants block.
"true": {//Sub variant value.
"textures": {//Overrides the north texture when active is true.
"north": "mymod:blocks/machine/furnace/active"
}
},
"false" : {
"textures" : {//Restores the north texture when active is false.
"north" : "mymod:blocks/machine/furnace/front"
}
}
}
}
}
},
"facinghoz": {
"north": {},
"south": {
"y": 180
},
"west": {
"y": 270
},
"east": {
"y": 90
}
}
}
}
{
"forge_marker": 1,
"defaults": {
"model": "minecraft:cube",
"transform": "forge:default-block"
},
"variants": {
"type": {
"furnace": {
"textures": {
"particle": "mymod:blocks/machine/furnace/side",
"down": "mymod:blocks/machine/furnace/top",
"up": "mymod:blocks/machine/furnace/top",
"north": "mymod:blocks/machine/furnace/front",
"south": "mymod:blocks/machine/furnace/side",
"east": "mymod:blocks/machine/furnace/side",
"west": "mymod:blocks/machine/furnace/side"
}
}
},
"type=furnace": [
{
"textures": {
"particle": "mymod:blocks/machine/furnace/side",
"down": "mymod:blocks/machine/furnace/top",
"up": "mymod:blocks/machine/furnace/top",
"north": "mymod:blocks/machine/furnace/front",
"south": "mymod:blocks/machine/furnace/side",
"east": "mymod:blocks/machine/furnace/side",
"west": "mymod:blocks/machine/furnace/side"
}
}
],
"active=true,type=furnace": [
{
"textures": {
"particle": "mymod:blocks/machine/furnace/side",
"down": "mymod:blocks/machine/furnace/top",
"up": "mymod:blocks/machine/furnace/top",
"north": "mymod:blocks/machine/furnace/active",
"south": "mymod:blocks/machine/furnace/side",
"east": "mymod:blocks/machine/furnace/side",
"west": "mymod:blocks/machine/furnace/side"
}
}
],
"active=false,type=furnace": [
{
"textures": {
"down": "mymod:blocks/machine/furnace/top",
"up": "mymod:blocks/machine/furnace/top",
"north": "mymod:blocks/machine/furnace/front",
"south": "mymod:blocks/machine/furnace/side",
"east": "mymod:blocks/machine/furnace/side",
"west": "mymod:blocks/machine/furnace/side"
}
}
],
"active": {
"true": {
},
"false": {
}
},
"facinghoz": {
"north": {},
"south": {
"y": 180
},
"west": {
"y": 270
},
"east": {
"y": 90
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment