deprecation of material(...), fix map_colour(...)

This commit is contained in:
gnembon committed 2023-04-05 20:09:52 +02:00
1 parent fdb0936df7
commit 9a5c2d5fc3
2 files changed
+8 -13

No files matched your search

+2 -8
View File
@@ -486,15 +486,9 @@ Returns the name of sound type made by the block at position. One of:
`'candle'`', `'amethyst'`', `'amethyst_cluster'`', `'small_amethyst_bud'`', `'large_amethyst_bud'`', `'medium_amethyst_bud'`',
`'tuff'`', `'calcite'`', `'copper'`'
### `material(pos)`
### `(Deprecated) material(pos)`
Returns the name of material of the block at position. very useful to target a group of blocks. One of:
`'air'`, `'void'`, `'portal'`, `'carpet'`, `'plant'`, `'water_plant'`, `'vine'`, `'sea_grass'`, `'water'`,
`'bubble_column'`, `'lava'`, `'snow_layer'`, `'fire'`, `'redstone_bits'`, `'cobweb'`, `'redstone_lamp'`, `'clay'`,
`'dirt'`, `'grass'`, `'packed_ice'`, `'sand'`, `'sponge'`, `'wood'`, `'wool'`, `'tnt'`, `'leaves'`, `'glass'`,
`'ice'`, `'cactus'`, `'stone'`, `'iron'`, `'snow'`, `'anvil'`, `'barrier'`, `'piston'`, `'coral'`, `'gourd'`,
`'dragon_egg'`, `'cake'`, `'amethyst'`
Returns the name of material of the block at position. Very limited as the use of material for blocks is removed.
### `map_colour(pos)`
@@ -1160,14 +1160,15 @@ public class WorldAccess
stateStringQuery(c, "block_sound", lv, (s, p) ->
Colors.soundName.get(s.getSoundType())));
expression.addContextFunction("material", -1, (c, t, lv) ->
stateStringQuery(c, "material", lv, (s, p) ->
Colors.materialName.get(s.getMaterial())));
expression.addContextFunction("material", -1, (c, t, lv) -> {
c.host.issueDeprecation("material(...)"); // deprecated for block_state()
return stateStringQuery(c, "material", lv, (s, p) ->
Colors.materialName.getOrDefault(s.getMaterial(), "unknown"));
});
expression.addContextFunction("map_colour", -1, (c, t, lv) ->
stateStringQuery(c, "map_colour", lv, (s, p) ->
Colors.materialName.get(s.getMapColor(((CarpetContext) c).level(), p))));
Colors.mapColourName.get(s.getMapColor(((CarpetContext) c).level(), p))));
// Deprecated for block_state()
expression.addContextFunction("property", -1, (c, t, lv) ->