This commit is contained in:
Brian Neumann-Fopiano
2026-06-14 01:21:11 -04:00
parent b0a5d97e9c
commit 796d81e58b
2 changed files with 31 additions and 26 deletions
@@ -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
@@ -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"));
}
}