mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-05 06:32:17 -07:00
Update to Minecraft 1.13.1
This commit is contained in:
@@ -134,6 +134,7 @@ import com.mojang.brigadier.tree.LiteralCommandNode;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.buffer.ByteBufOutputStream;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import it.unimi.dsi.fastutil.longs.LongIterator;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
@@ -694,8 +695,8 @@ public final class CraftServer implements Server {
|
||||
((DedicatedServer) console).propertyManager = config;
|
||||
|
||||
boolean animals = config.getBoolean("spawn-animals", console.getSpawnAnimals());
|
||||
boolean monsters = config.getBoolean("spawn-monsters", console.worlds.get(0).getDifficulty() != EnumDifficulty.PEACEFUL);
|
||||
EnumDifficulty difficulty = EnumDifficulty.getById(config.getInt("difficulty", console.worlds.get(0).getDifficulty().ordinal()));
|
||||
boolean monsters = config.getBoolean("spawn-monsters", console.getWorldServer(DimensionManager.OVERWORLD).getDifficulty() != EnumDifficulty.PEACEFUL);
|
||||
EnumDifficulty difficulty = EnumDifficulty.getById(config.getInt("difficulty", console.getWorldServer(DimensionManager.OVERWORLD).getDifficulty().ordinal()));
|
||||
|
||||
online.value = config.getBoolean("online-mode", console.getOnlineMode());
|
||||
console.setSpawnAnimals(config.getBoolean("spawn-animals", console.getSpawnAnimals()));
|
||||
@@ -724,7 +725,7 @@ public final class CraftServer implements Server {
|
||||
logger.log(Level.WARNING, "Failed to load banned-players.json, " + ex.getMessage());
|
||||
}
|
||||
|
||||
for (WorldServer world : console.worlds) {
|
||||
for (WorldServer world : console.getWorlds()) {
|
||||
world.worldData.setDifficulty(difficulty);
|
||||
world.setSpawnFlags(monsters, animals);
|
||||
if (this.getTicksPerAnimalSpawns() < 0) {
|
||||
@@ -886,11 +887,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
console.convertWorld(name);
|
||||
|
||||
int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worlds.size();
|
||||
int dimension = CraftWorld.CUSTOM_DIMENSION_OFFSET + console.worldServer.size();
|
||||
boolean used = false;
|
||||
do {
|
||||
for (WorldServer server : console.worlds) {
|
||||
used = server.dimension == dimension;
|
||||
for (WorldServer server : console.getWorlds()) {
|
||||
used = server.dimension.getDimensionID() == dimension;
|
||||
if (used) {
|
||||
dimension++;
|
||||
break;
|
||||
@@ -900,6 +901,7 @@ public final class CraftServer implements Server {
|
||||
boolean hardcore = false;
|
||||
|
||||
IDataManager sdm = new ServerNBTManager(getWorldContainer(), name, getServer(), getHandle().getServer().dataConverterManager);
|
||||
PersistentCollection persistentcollection = new PersistentCollection(sdm);
|
||||
WorldData worlddata = sdm.getWorldData();
|
||||
WorldSettings worldSettings = null;
|
||||
if (worlddata == null) {
|
||||
@@ -911,7 +913,9 @@ public final class CraftServer implements Server {
|
||||
worlddata = new WorldData(worldSettings, name);
|
||||
}
|
||||
worlddata.checkName(name); // CraftBukkit - Migration did not rewrite the level.dat; This forces 1.8 to take the last loaded world as respawn (in this case the end)
|
||||
WorldServer internal = (WorldServer) new WorldServer(console, sdm, worlddata, dimension, console.methodProfiler, creator.environment(), generator).b();
|
||||
|
||||
DimensionManager internalDimension = new DimensionManager(dimension, name, name, () -> DimensionManager.a(creator.environment().getId()).e());
|
||||
WorldServer internal = (WorldServer) new WorldServer(console, sdm, persistentcollection, worlddata, internalDimension, console.methodProfiler, creator.environment(), generator).i_();
|
||||
|
||||
if (!(worlds.containsKey(name.toLowerCase(java.util.Locale.ENGLISH)))) {
|
||||
return null;
|
||||
@@ -925,10 +929,10 @@ public final class CraftServer implements Server {
|
||||
internal.addIWorldAccess(new WorldManager(console, internal));
|
||||
internal.worldData.setDifficulty(EnumDifficulty.EASY);
|
||||
internal.setSpawnFlags(true, true);
|
||||
console.worlds.add(internal);
|
||||
console.worldServer.put(internal.dimension, internal);
|
||||
|
||||
pluginManager.callEvent(new WorldInitEvent(internal.getWorld()));
|
||||
System.out.println("Preparing start region for level " + (console.worlds.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
||||
System.out.println("Preparing start region for level " + (console.worldServer.size() - 1) + " (Seed: " + internal.getSeed() + ")");
|
||||
|
||||
if (internal.getWorld().getKeepSpawnInMemory()) {
|
||||
short short1 = 196;
|
||||
@@ -950,10 +954,26 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
BlockPosition chunkcoordinates = internal.getSpawn();
|
||||
internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4);
|
||||
internal.getChunkProviderServer().getChunkAt(chunkcoordinates.getX() + j >> 4, chunkcoordinates.getZ() + k >> 4, true, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DimensionManager dimensionmanager = internalDimension.e().getDimensionManager();
|
||||
ForcedChunk forcedchunk = (ForcedChunk) persistentcollection.get(dimensionmanager, ForcedChunk::new, "chunks");
|
||||
|
||||
if (forcedchunk != null) {
|
||||
LongIterator longiterator = forcedchunk.a().iterator();
|
||||
|
||||
while (longiterator.hasNext()) {
|
||||
System.out.println("Loading forced chunks for dimension " + dimension + ", " + forcedchunk.a().size() * 100 / 625 + "%");
|
||||
long k = longiterator.nextLong();
|
||||
ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(k);
|
||||
|
||||
internal.getChunkProviderServer().getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
pluginManager.callEvent(new WorldLoadEvent(internal.getWorld()));
|
||||
return internal.getWorld();
|
||||
}
|
||||
@@ -971,11 +991,11 @@ public final class CraftServer implements Server {
|
||||
|
||||
WorldServer handle = ((CraftWorld) world).getHandle();
|
||||
|
||||
if (!(console.worlds.contains(handle))) {
|
||||
if (!(console.worldServer.containsKey(handle.dimension))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (handle.dimension == 0) {
|
||||
if (handle.dimension == DimensionManager.OVERWORLD) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1000,7 +1020,7 @@ public final class CraftServer implements Server {
|
||||
}
|
||||
|
||||
worlds.remove(world.getName().toLowerCase(java.util.Locale.ENGLISH));
|
||||
console.worlds.remove(console.worlds.indexOf(handle));
|
||||
console.worldServer.remove(handle.dimension);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1215,8 +1235,8 @@ public final class CraftServer implements Server {
|
||||
@Override
|
||||
@Deprecated
|
||||
public CraftMapView getMap(short id) {
|
||||
PersistentCollection collection = console.worlds.get(0).worldMaps;
|
||||
WorldMap worldmap = (WorldMap) collection.get(WorldMap::new, "map_" + id);
|
||||
PersistentCollection collection = console.getWorldServer(DimensionManager.OVERWORLD).worldMaps;
|
||||
WorldMap worldmap = (WorldMap) collection.get(DimensionManager.OVERWORLD, WorldMap::new, "map_" + id);
|
||||
if (worldmap == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -1388,7 +1408,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public GameMode getDefaultGameMode() {
|
||||
return GameMode.getByValue(console.worlds.get(0).getWorldData().getGameType().getId());
|
||||
return GameMode.getByValue(console.getWorldServer(DimensionManager.OVERWORLD).getWorldData().getGameType().getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1432,7 +1452,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
@Override
|
||||
public OfflinePlayer[] getOfflinePlayers() {
|
||||
WorldNBTStorage storage = (WorldNBTStorage) console.worlds.get(0).getDataManager();
|
||||
WorldNBTStorage storage = (WorldNBTStorage) console.getWorldServer(DimensionManager.OVERWORLD).getDataManager();
|
||||
String[] files = storage.getPlayerDir().list(new DatFileFilter());
|
||||
Set<OfflinePlayer> players = new HashSet<OfflinePlayer>();
|
||||
|
||||
@@ -1687,7 +1707,7 @@ public final class CraftServer implements Server {
|
||||
public Entity getEntity(UUID uuid) {
|
||||
Validate.notNull(uuid, "UUID cannot be null");
|
||||
|
||||
for (WorldServer world : getServer().worlds) {
|
||||
for (WorldServer world : getServer().getWorlds()) {
|
||||
net.minecraft.server.Entity entity = world.getEntity(uuid);
|
||||
if (entity != null) {
|
||||
return entity.getBukkitEntity();
|
||||
@@ -1769,8 +1789,8 @@ public final class CraftServer implements Server {
|
||||
public LootTable getLootTable(NamespacedKey key) {
|
||||
Validate.notNull(key, "NamespacedKey cannot be null");
|
||||
|
||||
LootTableRegistry registry = getServer().aP(); // PAIL getLootTableRegistry
|
||||
return new CraftLootTable(key, registry.a(CraftNamespacedKey.toMinecraft(key))); // PAIL rename getLootTable
|
||||
LootTableRegistry registry = getServer().getLootTableRegistry();
|
||||
return new CraftLootTable(key, registry.getLootTable(CraftNamespacedKey.toMinecraft(key)));
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
|
Reference in New Issue
Block a user