Skip to content

Custom Sector Coloring

omori_sunny edited this page Aug 11, 2026 · 1 revision

Sector blocks in a waterslide can be dyed. Hold a dye item and right-click the slide.

The dye result comes from a rules file. The rules file is a resource pack asset:

assets/create_waterparked/waterslide_dye.json

Built-in rules

The mod ships with built-in rules. They cover the vanilla dyeable block families.

Uncolored blocks become their colored variants:

  • glass
  • glass pane
  • terracotta
  • candle
  • shulker box

Colored blocks in these families can be re-dyed:

  • wool
  • carpet
  • concrete
  • concrete powder
  • terracotta
  • stained glass
  • stained glass pane
  • bed
  • candle
  • candle cake
  • shulker box
  • banner
  • wall banner

Rule lookup

The dye lookup works in this order:

  1. Check the resource pack rules for the block id.
  2. If a rule exists, use it.
  3. If no rule exists, use the built-in rule.
  4. If neither exists, the block is not dyeable.

A rule with "dyeable": false always wins. It forbids the block even if another rule matches.

The result must exist in the block registry. If it does not exist, the block is not dyeable.

Resource pack rules

Create a resource pack with the file assets/create_waterparked/waterslide_dye.json.

{
  "blocks": {
    "minecraft:glass": {
      "target": "minecraft:%s_stained_glass"
    },
    "create:framed_glass": {
      "dyeable": false
    },
    "mymod:magic_glass": {
      "mapping": {
        "white": "mymod:white_magic_glass",
        "yellow": "mymod:yellow_magic_glass",
        "red": "mymod:red_magic_glass"
      }
    }
  }
}

Each entry uses the block id as the key. The value is a rule object.

target

target is a template. %s is replaced with the dye color name.

{
  "minecraft:gray_concrete": {
    "target": "minecraft:%s_concrete"
  }
}

Yellow dye on gray concrete gives minecraft:yellow_concrete.

Dye color names:

white, orange, magenta, light_blue, yellow, lime, pink, gray, light_gray, cyan, purple, blue, brown, green, red, black

mapping

mapping lists the result for each color explicitly. Use it for non-standard results.

{
  "mymod:magic_glass": {
    "mapping": {
      "yellow": "mymod:yellow_magic_glass",
      "red": "mymod:red_magic_glass"
    }
  }
}

If a rule has both mapping and target, mapping wins.

dyeable

"dyeable": false forbids the block.

{
  "create:framed_glass": {
    "dyeable": false
  }
}

Pack priority

If several packs define the same block, the pack with higher priority wins.

Datagen

The default rules file is generated by data generation.

The base class is AssetJsonProvider in net.omori_sunny.create_waterparked.datagen.

class MyJsonProvider(output: PackOutput, modId: String) :
    AssetJsonProvider(output, modId, "My assets") {

    override fun gather(): Map<ResourceLocation, JsonObject> {
        val obj = JsonObject()
        obj.addProperty("hello", "world")
        return mapOf(ResourceLocation.fromNamespaceAndPath(modId, "my_file") to obj)
    }
}
public class MyJsonProvider extends AssetJsonProvider {

    public MyJsonProvider(PackOutput output, String modId) {
        super(output, modId, "My assets");
    }

    @Override
    protected Map<ResourceLocation, JsonObject> gather() {
        JsonObject obj = new JsonObject();
        obj.addProperty("hello", "world");
        return Map.of(ResourceLocation.fromNamespaceAndPath(modId, "my_file"), obj);
    }
}

The provider writes each entry to assets/<namespace>/<path>.json.

Register the provider in CreateWaterparkedDataGen:

@JvmStatic
fun gatherData(event: GatherDataEvent) {
    val generator = event.generator
    generator.addProvider(true, MyJsonProvider(generator.packOutput, "create_waterparked"))
}
public static void gatherData(GatherDataEvent event) {
    DataGenerator generator = event.getGenerator();
    generator.addProvider(true, new MyJsonProvider(generator.getPackOutput(), "create_waterparked"));
}

Run data generation:

./gradlew runData

Generated files go to src/generated/resources.

Example pack

A ready-to-use example pack is in examples/waterslide-dye-pack.

Clone this wiki locally