Commits
md_5 authored c905a715e99
9 9 | +import net.minecraft.server.level.ChunkProviderServer; |
10 10 | +import net.minecraft.server.level.WorldServer; |
11 11 | +import net.minecraft.world.level.GeneratorAccess; |
12 12 | +import net.minecraft.world.level.chunk.status.ChunkStatus; |
13 13 | +import net.minecraft.world.level.dimension.WorldDimension; |
14 14 | +// CraftBukkit end |
15 15 | + |
16 16 | public class IChunkLoader implements AutoCloseable { |
17 17 | |
18 18 | public static final int LAST_MONOLYTH_STRUCTURE_DATA_VERSION = 1493; |
19 - | |
19 + | |
20 20 | return this.worker.isOldChunkAround(chunkcoordintpair, i); |
21 21 | } |
22 22 | |
23 23 | - public NBTTagCompound upgradeChunkTag(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier, NBTTagCompound nbttagcompound, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> optional) { |
24 24 | + // CraftBukkit start |
25 25 | + private boolean check(ChunkProviderServer cps, int x, int z) { |
26 26 | + ChunkCoordIntPair pos = new ChunkCoordIntPair(x, z); |
27 27 | + if (cps != null) { |
28 - | + com.google.common.base.Preconditions.checkState(org.bukkit.Bukkit.isPrimaryThread(), "primary thread"); |
29 28 | + if (cps.hasChunk(x, z)) { |
30 29 | + return true; |
31 30 | + } |
32 31 | + } |
33 32 | + |
34 33 | + NBTTagCompound nbt; |
35 34 | + try { |
36 35 | + nbt = read(pos).get().orElse(null); |
37 36 | + } catch (InterruptedException | ExecutionException ex) { |
38 37 | + throw new RuntimeException(ex); |
68 67 | + if (check(cps, pos.x - 1, pos.z) && check(cps, pos.x - 1, pos.z - 1) && check(cps, pos.x, pos.z - 1)) { |
69 68 | + level.putBoolean("LightPopulated", true); |
70 69 | + } |
71 70 | + } |
72 71 | + } |
73 72 | + // CraftBukkit end |
74 73 | + |
75 74 | if (i < 1493) { |
76 75 | nbttagcompound = DataFixTypes.CHUNK.update(this.fixerUpper, nbttagcompound, i, 1493); |
77 76 | if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) { |
78 - | |
77 + | |
79 78 | } |
80 79 | } |
81 80 | |
82 81 | - private PersistentStructureLegacy getLegacyStructureHandler(ResourceKey<World> resourcekey, Supplier<WorldPersistentData> supplier) { |
83 82 | + private PersistentStructureLegacy getLegacyStructureHandler(ResourceKey<WorldDimension> resourcekey, Supplier<WorldPersistentData> supplier) { // CraftBukkit |
84 83 | PersistentStructureLegacy persistentstructurelegacy = this.legacyStructureHandler; |
85 84 | |
86 85 | if (persistentstructurelegacy == null) { |
87 - | |
86 + | |
88 87 | return persistentstructurelegacy; |
89 88 | } |
90 89 | |
91 90 | - public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<World> resourcekey, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> optional) { |
92 91 | + public static void injectDatafixingContext(NBTTagCompound nbttagcompound, ResourceKey<WorldDimension> resourcekey, Optional<ResourceKey<MapCodec<? extends ChunkGenerator>>> optional) { // CraftBukkit |
93 92 | NBTTagCompound nbttagcompound1 = new NBTTagCompound(); |
94 93 | |
95 94 | nbttagcompound1.putString("dimension", resourcekey.location().toString()); |