diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockUpdateOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockUpdateOracle.java index 037788547..606e2ae34 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockUpdateOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaBlockUpdateOracle.java @@ -517,8 +517,34 @@ public final class VanillaBlockUpdateOracle { return new BlockPos(a.get(0).getAsInt(), a.get(1).getAsInt(), a.get(2).getAsInt()); } + /** + * The chunk source bone meal reaches for: saplings, grass and moss place + * their features with `getChunkSource().getGenerator()`, which none of + * them reads beyond passing it along. + */ + static final class Chunks extends net.minecraft.server.level.ServerChunkCache { + static net.minecraft.world.level.chunk.ChunkGenerator generator; + + private Chunks() { + super(null, null, null, null, null, null, 0, 0, false, null); + } + + @Override + public net.minecraft.world.level.chunk.ChunkGenerator getGenerator() { + return generator; + } + + /** Leads send entity link packets; nobody is tracking. */ + @Override + public void sendToTrackingPlayers(final net.minecraft.world.entity.Entity entity, final net.minecraft.network.protocol.Packet packet) { + } + } + static World build(JsonObject f) throws Exception { World w = make(World.class); + // Saplings, grass and moss place features through the chunk source's generator. + if (Chunks.generator == null) Chunks.generator = make(net.minecraft.world.level.levelgen.FlatLevelSource.class); + set(net.minecraft.server.level.ServerLevel.class, w, "chunkSource", make(Chunks.class)); w.cells = new HashMap<>(); w.log = new StringBuilder(); w.blockEvents = new java.util.LinkedHashSet<>(); diff --git a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java index ed8c01096..26bb9a745 100644 --- a/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java +++ b/mods/horizon/src/test/java/dev/horizonlab/parity/VanillaDispenserOracle.java @@ -138,29 +138,6 @@ public final class VanillaDispenserOracle { throw new IllegalStateException("no slots in " + be); } - /** - * The chunk source bone meal reaches for: saplings, grass and moss place - * their features with `getChunkSource().getGenerator()`, which none of - * them reads beyond passing it along. - */ - static final class Chunks extends net.minecraft.server.level.ServerChunkCache { - static net.minecraft.world.level.chunk.ChunkGenerator generator; - - private Chunks() { - super(null, null, null, null, null, null, 0, 0, false, null); - } - - @Override - public net.minecraft.world.level.chunk.ChunkGenerator getGenerator() { - return generator; - } - - /** Leads send entity link packets; nobody is tracking. */ - @Override - public void sendToTrackingPlayers(final Entity entity, final net.minecraft.network.protocol.Packet packet) { - } - } - static Method dispenseFrom(Class type) throws Exception { for (Class c = type; c != null; c = c.getSuperclass()) { try { @@ -218,8 +195,6 @@ public final class VanillaDispenserOracle { w.entities = new ArrayList<>(); w.registries = ParityData.access; w.server.loot.delegate = ParityData.loot; - if (Chunks.generator == null) Chunks.generator = VanillaBlockUpdateOracle.make(net.minecraft.world.level.levelgen.FlatLevelSource.class); - VanillaBlockUpdateOracle.set(ServerLevel.class, w, "chunkSource", VanillaBlockUpdateOracle.make(Chunks.class)); VanillaBlockUpdateOracle.set(Level.class, w, "damageSources", new net.minecraft.world.damagesource.DamageSources(ParityData.access)); if (f.has("rules")) { for (var rule : f.getAsJsonObject("rules").entrySet()) {