Fix lava and water matching

This commit is contained in:
Sollace 2022-09-08 18:49:58 +02:00
parent b674b74d4d
commit fe1e6172c7
3 changed files with 21 additions and 8 deletions

View file

@ -106,6 +106,8 @@ public abstract class StatePredicate implements Predicate<BlockState> {
switch (type) {
case "plants": return StatePredicate::isPlant;
case "ores": return StatePredicate::isOre;
case "water": return StatePredicate::isWater;
case "lava": return StatePredicate::isLava;
default: throw new IllegalArgumentException("Invalid builtin type: " + type);
}
}
@ -118,6 +120,14 @@ public abstract class StatePredicate implements Predicate<BlockState> {
return s.getBlock() instanceof OreBlock;
}
static boolean isWater(BlockState s) {
return s.getMaterial() == Material.WATER;
}
static boolean isLava(BlockState s) {
return s.getMaterial() == Material.LAVA;
}
public static Predicate<BlockState> ofState(String state) {
Identifier id = new Identifier(state.split("\\{")[0]);
List<PropertyOp> properties = Optional.of(state)

View file

@ -13,7 +13,10 @@
}
},
{
"match": { "state": "minecraft:ice" },
"match": [
{ "state": "minecraft:ice" },
{ "state": "minecraft:frosted_ice" }
],
"apply": {
"action": "unicopia:set_state",
"state": "minecraft:water"

View file

@ -9,14 +9,14 @@
}
},
{
"match": { "tag": "minecraft:water" },
"match": { "builtin": "water" },
"apply": {
"action": "unicopia:set_state",
"state": "minecraft:frosted_ice"
}
},
{
"match": { "state": "minecraft:lava" },
"match": { "builtin": "lava" },
"apply": {
"action": "unicopia:set_state",
"state": "unicopia:frosted_obsidian"