Give every block update oracle level a chunk generator
Bone meal and saplings reach for getChunkSource().getGenerator(); the shared oracle level now answers it, as the dispenser oracle did. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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<? super net.minecraft.network.protocol.game.ClientGamePacketListener> 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<>();
|
||||
|
||||
@@ -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<? super net.minecraft.network.protocol.game.ClientGamePacketListener> 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()) {
|
||||
|
||||
Reference in New Issue
Block a user