diff --git a/plugin/src/main/java/com/denizenscript/denizen/nms/abstracts/BiomeNMS.java b/plugin/src/main/java/com/denizenscript/denizen/nms/abstracts/BiomeNMS.java index f60e1129ad..bc012894ef 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/nms/abstracts/BiomeNMS.java +++ b/plugin/src/main/java/com/denizenscript/denizen/nms/abstracts/BiomeNMS.java @@ -101,6 +101,22 @@ public void setWaterFogColor(int color) { throw new UnsupportedOperationException(); } + public int getSkyColor() { + throw new UnsupportedOperationException(); + } + + public void setSkyColor(int color) { + throw new UnsupportedOperationException(); + } + + public int getSkyLightColor() { + throw new UnsupportedOperationException(); + } + + public void setSkyLightColor(int color) { + throw new UnsupportedOperationException(); + } + public abstract void setTo(Block block); public ColorTag getColor(int x, int y) { diff --git a/plugin/src/main/java/com/denizenscript/denizen/objects/BiomeTag.java b/plugin/src/main/java/com/denizenscript/denizen/objects/BiomeTag.java index d0f02e6750..f849e67d87 100644 --- a/plugin/src/main/java/com/denizenscript/denizen/objects/BiomeTag.java +++ b/plugin/src/main/java/com/denizenscript/denizen/objects/BiomeTag.java @@ -506,6 +506,71 @@ else if (attribute.startsWith("water", 2)) { object.biome.setPrecipitation(input.asEnum(BiomeNMS.DownfallType.class)); } }); + + if (NMSHandler.getVersion().isAtLeast(NMSVersion.v1_21)) { + + // <--[tag] + // @attribute + // @returns ColorTag + // @mechanism BiomeTag.sky_color + // @description + // Returns the biome's sky color. + // @example + // # Sends the player a message in their current biome's sky color. + // - narrate "You are currently seeing sky that looks like <&color[]>this!" + // --> + tagProcessor.registerTag(ColorTag.class, "sky_color", (attribute, object) -> { + return ColorTag.fromRGB(object.biome.getSkyColor()); + }); + + // <--[tag] + // @attribute + // @returns ColorTag + // @mechanism BiomeTag.sky_light_color + // @description + // Returns the biome's skylight color. + // @example + // # Sends the player a message in their current biome's skylight color. + // - narrate "You are currently seeing skylight that looks like <&color[]>this!" + // --> + tagProcessor.registerTag(ColorTag.class, "sky_light_color", (attribute, object) -> { + return ColorTag.fromRGB(object.biome.getSkyLightColor()); + }); + + // <--[mechanism] + // @object BiomeTag + // @name sky_color + // @input ColorTag + // @description + // Sets the biome's sky color. + // @tags + // + // @example + // # Makes the plains biome's sky color red permanently, using a server start event to keep it applied. + // on server start: + // - adjust sky_color:red + // --> + tagProcessor.registerMechanism("sky_color", false, ColorTag.class, (object, mechanism, input) -> { + object.biome.setSkyColor(input.asRGB()); + }); + + // <--[mechanism] + // @object BiomeTag + // @name sky_light_color + // @input ColorTag + // @description + // Sets the biome's skylight color. + // @tags + // + // @example + // # Makes the plains biome's skylight color red permanently, using a server start event to keep it applied. + // on server start: + // - adjust sky_light_color:red + // --> + tagProcessor.registerMechanism("sky_light_color", false, ColorTag.class, (object, mechanism, input) -> { + object.biome.setSkyLightColor(input.asRGB()); + }); + } } public static final ObjectTagProcessor tagProcessor = new ObjectTagProcessor<>(); diff --git a/v1_21/src/main/java/com/denizenscript/denizen/nms/v1_21/impl/BiomeNMSImpl.java b/v1_21/src/main/java/com/denizenscript/denizen/nms/v1_21/impl/BiomeNMSImpl.java index d360c4318a..3eb8f2bd44 100644 --- a/v1_21/src/main/java/com/denizenscript/denizen/nms/v1_21/impl/BiomeNMSImpl.java +++ b/v1_21/src/main/java/com/denizenscript/denizen/nms/v1_21/impl/BiomeNMSImpl.java @@ -179,6 +179,26 @@ public void setWaterFogColor(int color) { setEnvironmentAttribute(EnvironmentAttributes.WATER_FOG_COLOR, color); } + @Override + public int getSkyColor() { + return getEnvironmentAttribute(EnvironmentAttributes.SKY_COLOR); + } + + @Override + public void setSkyColor(int color) { + setEnvironmentAttribute(EnvironmentAttributes.SKY_COLOR, color); + } + + @Override + public int getSkyLightColor() { + return getEnvironmentAttribute(EnvironmentAttributes.SKY_LIGHT_COLOR); + } + + @Override + public void setSkyLightColor(int color) { + setEnvironmentAttribute(EnvironmentAttributes.SKY_LIGHT_COLOR, color); + } + public T getEnvironmentAttribute(EnvironmentAttribute attribute) { return biomeHolder.value().getAttributes().applyModifier(attribute, attribute.defaultValue()); }