mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-25 21:40:05 +00:00
Overlay biome mob spawns
- 26.3 custom biomes write natural_mob_spawns as an overlay modifier with its argument, matching vanilla biomes - NeoForge biome modifiers can add spawns to Iris biomes again - The 26.3 custom biome codec test checks the overlay modifier
This commit is contained in:
1 parent
6fd877ebfc
commit
5e95248057
2 files changed
+8
-2
No files matched your search
+3
@@ -13,6 +13,7 @@ import net.minecraft.data.registries.VanillaRegistries;
|
|||||||
import net.minecraft.resources.RegistryOps;
|
import net.minecraft.resources.RegistryOps;
|
||||||
import net.minecraft.server.Bootstrap;
|
import net.minecraft.server.Bootstrap;
|
||||||
import net.minecraft.world.attribute.EnvironmentAttributes;
|
import net.minecraft.world.attribute.EnvironmentAttributes;
|
||||||
|
import net.minecraft.world.attribute.modifier.MobSpawnSettingsModifier;
|
||||||
import net.minecraft.world.entity.MobCategory;
|
import net.minecraft.world.entity.MobCategory;
|
||||||
import net.minecraft.world.level.biome.Biome;
|
import net.minecraft.world.level.biome.Biome;
|
||||||
import net.minecraft.world.level.biome.MobSpawnSettings;
|
import net.minecraft.world.level.biome.MobSpawnSettings;
|
||||||
@@ -53,5 +54,7 @@ public class CustomBiomeCodecTest {
|
|||||||
assertEquals(2, decoded.count().minInclusive());
|
assertEquals(2, decoded.count().minInclusive());
|
||||||
assertEquals(4, decoded.count().maxInclusive());
|
assertEquals(4, decoded.count().maxInclusive());
|
||||||
assertEquals(0x102030, biome.getWaterColor() & 0xFFFFFF);
|
assertEquals(0x102030, biome.getWaterColor() & 0xFFFFFF);
|
||||||
|
assertEquals(MobSpawnSettingsModifier.overlay(),
|
||||||
|
biome.getAttributes().get(EnvironmentAttributes.NATURAL_MOB_SPAWNS).modifier());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -34,9 +34,12 @@ public final class DataFixerV263 extends DataFixerV1217 {
|
|||||||
.put("max_inclusive", maximum));
|
.put("max_inclusive", maximum));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Vanilla writes spawns as an overlay. A bare value decodes as an override, which NeoForge biome modifiers refuse to edit.
|
||||||
attributes.put("minecraft:gameplay/natural_mob_spawns", new JSONObject()
|
attributes.put("minecraft:gameplay/natural_mob_spawns", new JSONObject()
|
||||||
.put("spawns_by_category", spawners)
|
.put("argument", new JSONObject()
|
||||||
.put("spawn_costs", fixed.getJSONObject("spawn_costs")));
|
.put("spawns_by_category", spawners)
|
||||||
|
.put("spawn_costs", fixed.getJSONObject("spawn_costs")))
|
||||||
|
.put("modifier", "overlay"));
|
||||||
Object probability = fixed.remove("creature_spawn_probability");
|
Object probability = fixed.remove("creature_spawn_probability");
|
||||||
if (probability != null) {
|
if (probability != null) {
|
||||||
attributes.put("minecraft:gameplay/creature_world_gen_spawn_probability", probability);
|
attributes.put("minecraft:gameplay/creature_world_gen_spawn_probability", probability);
|
||||||
|
|||||||
Reference in new issue
Block a user