diff --git a/docs/scarpet/api/BlocksAndWorldAccess.md b/docs/scarpet/api/BlocksAndWorldAccess.md index e900466e..17684cf5 100644 --- a/docs/scarpet/api/BlocksAndWorldAccess.md +++ b/docs/scarpet/api/BlocksAndWorldAccess.md @@ -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)` diff --git a/src/main/java/carpet/script/api/WorldAccess.java b/src/main/java/carpet/script/api/WorldAccess.java index 43e55faa..51cef699 100644 --- a/src/main/java/carpet/script/api/WorldAccess.java +++ b/src/main/java/carpet/script/api/WorldAccess.java @@ -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) ->