diff --git a/core/src/main/java/art/arcane/iris/core/nms/datapack/v1217/DataFixerV1217.java b/core/src/main/java/art/arcane/iris/core/nms/datapack/v1217/DataFixerV1217.java index 6ad102b94..4890bea9b 100644 --- a/core/src/main/java/art/arcane/iris/core/nms/datapack/v1217/DataFixerV1217.java +++ b/core/src/main/java/art/arcane/iris/core/nms/datapack/v1217/DataFixerV1217.java @@ -89,32 +89,7 @@ public class DataFixerV1217 extends DataFixerV1213 { @Override public JSONObject fixCustomBiome(IrisBiomeCustom biome, JSONObject json) { - json = super.fixCustomBiome(biome, json); - JSONObject effects = json.getJSONObject("effects"); - JSONObject attributes = new JSONObject(); - - attributes.put("minecraft:visual/fog_color", effects.remove("fog_color")); - attributes.put("minecraft:visual/sky_color", effects.remove("sky_color")); - attributes.put("minecraft:visual/water_color", effects.remove("water_color")); - attributes.put("minecraft:visual/water_fog_color", effects.remove("water_fog_color")); - Object grassColor = effects.remove("grass_color"); - if (grassColor != null) { - attributes.put("minecraft:visual/grass_color", grassColor); - } - Object foliageColor = effects.remove("foliage_color"); - if (foliageColor != null) { - attributes.put("minecraft:visual/foliage_color", foliageColor); - } - - JSONObject particle = (JSONObject) effects.remove("particle"); - if (particle != null) { - particle.put("particle", particle.remove("options")); - attributes.put("minecraft:visual/ambient_particles", new JSONArray() - .put(particle)); - } - json.put("attributes", attributes); - - return json; + return super.fixCustomBiome(biome, json); } @Override diff --git a/core/src/test/java/art/arcane/iris/core/nms/datapack/v1217/DataFixerV1217CustomBiomeTest.java b/core/src/test/java/art/arcane/iris/core/nms/datapack/v1217/DataFixerV1217CustomBiomeTest.java new file mode 100644 index 000000000..580f8084b --- /dev/null +++ b/core/src/test/java/art/arcane/iris/core/nms/datapack/v1217/DataFixerV1217CustomBiomeTest.java @@ -0,0 +1,30 @@ +package art.arcane.iris.core.nms.datapack.v1217; + +import art.arcane.iris.engine.object.IrisBiomeCustom; +import art.arcane.volmlib.util.json.JSONObject; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +public class DataFixerV1217CustomBiomeTest { + private final DataFixerV1217 fixer = new DataFixerV1217(); + + @Test + public void keepsSpigotBiomeColorsInEffects() { + IrisBiomeCustom biome = new IrisBiomeCustom(); + biome.setId("spigot_colors"); + biome.setGrassColor("#28a040"); + biome.setFoliageColor("#249030"); + + JSONObject json = new JSONObject(biome.generateJson(fixer)); + JSONObject effects = json.getJSONObject("effects"); + + assertFalse(json.has("attributes")); + assertTrue(effects.has("water_color")); + assertTrue(effects.has("water_fog_color")); + assertEquals(0x28a040, effects.getInt("grass_color")); + assertEquals(0x249030, effects.getInt("foliage_color")); + } +}