remove all the rest of the import hunks

This commit is contained in:
Jake Potrebic
2024-12-15 11:42:40 -08:00
parent 62b6e85d1a
commit 8cca65b8ac
12 changed files with 102 additions and 354 deletions

View File

@@ -1,46 +1,11 @@
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -54,7 +_,6 @@
import net.minecraft.network.protocol.game.ClientboundDamageEventPacket;
import net.minecraft.network.protocol.game.ClientboundEntityEventPacket;
import net.minecraft.network.protocol.game.ClientboundExplodePacket;
-import net.minecraft.network.protocol.game.ClientboundGameEventPacket;
import net.minecraft.network.protocol.game.ClientboundLevelEventPacket;
import net.minecraft.network.protocol.game.ClientboundLevelParticlesPacket;
import net.minecraft.network.protocol.game.ClientboundSetDefaultSpawnPositionPacket;
@@ -120,6 +_,7 @@
import net.minecraft.world.level.StructureManager;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.biome.Biome;
+import net.minecraft.world.level.biome.BiomeSource;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.SnowLayerBlock;
@@ -145,7 +_,9 @@
import net.minecraft.world.level.gameevent.DynamicGameEventListener;
import net.minecraft.world.level.gameevent.GameEvent;
import net.minecraft.world.level.gameevent.GameEventDispatcher;
+import net.minecraft.world.level.levelgen.FlatLevelSource;
import net.minecraft.world.level.levelgen.Heightmap;
+import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
import net.minecraft.world.level.levelgen.structure.BoundingBox;
import net.minecraft.world.level.levelgen.structure.Structure;
import net.minecraft.world.level.levelgen.structure.StructureCheck;
@@ -161,7 +_,7 @@
import net.minecraft.world.level.saveddata.maps.MapItemSavedData;
import net.minecraft.world.level.storage.DimensionDataStorage;
import net.minecraft.world.level.storage.LevelStorageSource;
-import net.minecraft.world.level.storage.ServerLevelData;
+import net.minecraft.world.level.storage.PrimaryLevelData;
import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp;
@@ -182,7 +_,7 @@
final List<ServerPlayer> players = Lists.newArrayList();
public final ServerChunkCache chunkSource;
private final MinecraftServer server;
- public final ServerLevelData serverLevelData;
+ public final PrimaryLevelData serverLevelData; // CraftBukkit - type
+ public final net.minecraft.world.level.storage.PrimaryLevelData serverLevelData; // CraftBukkit - type
private int lastSpawnChunkRadius;
final EntityTickList entityTickList = new EntityTickList();
public final PersistentEntitySectionManager<Entity> entityManager;
@@ -204,11 +169,11 @@
+ this.serverLevelData.setWorld(this);
+
+ if (biomeProvider != null) {
+ BiomeSource worldChunkManager = new org.bukkit.craftbukkit.generator.CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().lookupOrThrow(Registries.BIOME), chunkGenerator.getBiomeSource()); // Paper - add vanillaBiomeProvider
+ if (chunkGenerator instanceof NoiseBasedChunkGenerator cga) {
+ chunkGenerator = new NoiseBasedChunkGenerator(worldChunkManager, cga.settings);
+ } else if (chunkGenerator instanceof FlatLevelSource cpf) {
+ chunkGenerator = new FlatLevelSource(cpf.settings(), worldChunkManager);
+ net.minecraft.world.level.biome.BiomeSource worldChunkManager = new org.bukkit.craftbukkit.generator.CustomWorldChunkManager(this.getWorld(), biomeProvider, this.server.registryAccess().lookupOrThrow(Registries.BIOME), chunkGenerator.getBiomeSource()); // Paper - add vanillaBiomeProvider
+ if (chunkGenerator instanceof net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator cga) {
+ chunkGenerator = new net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator(worldChunkManager, cga.settings);
+ } else if (chunkGenerator instanceof net.minecraft.world.level.levelgen.FlatLevelSource cpf) {
+ chunkGenerator = new net.minecraft.world.level.levelgen.FlatLevelSource(cpf.settings(), worldChunkManager);
+ }
+ }
+

View File

@@ -1,14 +1,5 @@
--- a/net/minecraft/server/players/GameProfileCache.java
+++ b/net/minecraft/server/players/GameProfileCache.java
@@ -17,8 +_,6 @@
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
import java.nio.charset.StandardCharsets;
import java.text.DateFormat;
import java.text.ParseException;
@@ -56,6 +_,10 @@
private final AtomicLong operationCount = new AtomicLong();
@Nullable
@@ -135,15 +126,6 @@
}
public void setExecutor(Executor exectutor) {
@@ -193,7 +_,7 @@
try {
Object var9;
- try (Reader reader = Files.newReader(this.file, StandardCharsets.UTF_8)) {
+ try (java.io.Reader reader = Files.newReader(this.file, StandardCharsets.UTF_8)) {
JsonArray jsonArray = this.gson.fromJson(reader, JsonArray.class);
if (jsonArray != null) {
DateFormat dateFormat = createDateFormat();
@@ -206,6 +_,11 @@
return (List<GameProfileCache.GameProfileInfo>)var9;
@@ -169,8 +151,7 @@
String string = this.gson.toJson((JsonElement)jsonArray);
+ Runnable save = () -> { // Paper - Perf: Async GameProfileCache saving
- try (Writer writer = Files.newWriter(this.file, StandardCharsets.UTF_8)) {
+ try (java.io.Writer writer = Files.newWriter(this.file, StandardCharsets.UTF_8)) {
try (Writer writer = Files.newWriter(this.file, StandardCharsets.UTF_8)) {
writer.write(string);
} catch (IOException var9) {
}