Update to Minecraft 1.20.3

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2023-12-06 03:40:00 +11:00
parent afdb1d9bc3
commit 8398e12b34
256 changed files with 2745 additions and 1911 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/storage/Convertable.java
+++ b/net/minecraft/world/level/storage/Convertable.java
@@ -80,6 +80,10 @@
@@ -81,6 +81,10 @@
import net.minecraft.world.level.validation.PathAllowList;
import org.slf4j.Logger;
@@ -11,16 +11,24 @@
public class Convertable {
static final Logger LOGGER = LogUtils.getLogger();
@@ -169,7 +173,7 @@
@@ -151,7 +155,7 @@
}
private static WorldDataConfiguration readDataConfig(Dynamic<?> dynamic) {
public static WorldDataConfiguration readDataConfig(Dynamic<?> dynamic) {
- DataResult dataresult = WorldDataConfiguration.CODEC.parse(dynamic);
+ DataResult<WorldDataConfiguration> dataresult = WorldDataConfiguration.CODEC.parse(dynamic); // CraftBukkit - decompile error
Logger logger = Convertable.LOGGER;
Objects.requireNonNull(logger);
@@ -185,7 +189,7 @@
@@ -174,6 +178,7 @@
WorldDimensions.b worlddimensions_b = generatorsettings.dimensions().bake(iregistry);
Lifecycle lifecycle = worlddimensions_b.lifecycle().add(iregistrycustom_dimension.allRegistriesLifecycle());
WorldDataServer worlddataserver = WorldDataServer.parse(dynamic1, worldsettings, worlddimensions_b.specialWorldProperty(), generatorsettings.options(), lifecycle);
+ worlddataserver.pdc = ((Dynamic<NBTBase>) dynamic1).getElement("BukkitValues", null); // CraftBukkit - Add PDC to world
return new LevelDataAndDimensions(worlddataserver, worlddimensions_b);
}
@@ -193,7 +198,7 @@
throw new LevelStorageException(IChatBaseComponent.translatable("selectWorld.load_folder_access"));
} else {
try {
@@ -29,15 +37,7 @@
Convertable.a convertable_a;
@@ -343,6 +347,7 @@
WorldDimensions.b worlddimensions_b = generatorsettings.dimensions().bake(iregistry);
Lifecycle lifecycle1 = worlddimensions_b.lifecycle().add(lifecycle);
WorldDataServer worlddataserver = WorldDataServer.parse(dynamic, datafixer, i, nbttagcompound2, worldsettings, levelversion, worlddimensions_b.specialWorldProperty(), generatorsettings.options(), lifecycle1);
+ worlddataserver.pdc = nbttagcompound1.get("BukkitValues"); // CraftBukkit - Add PDC to world
return Pair.of(worlddataserver, worlddimensions_b);
};
@@ -441,27 +446,41 @@
@@ -423,27 +428,41 @@
return this.backupDir;
}
@@ -83,7 +83,7 @@
public static record a(List<Convertable.b> levels) implements Iterable<Convertable.b> {
public boolean isEmpty() {
@@ -513,8 +532,12 @@
@@ -502,8 +521,12 @@
public final Convertable.b levelDirectory;
private final String levelId;
private final Map<SavedFile, Path> resources = Maps.newHashMap();
@@ -97,7 +97,7 @@
this.levelId = s;
this.levelDirectory = new Convertable.b(path);
this.lock = SessionLock.create(path);
@@ -529,7 +552,7 @@
@@ -531,7 +554,7 @@
}
public Path getLevelPath(SavedFile savedfile) {
@@ -106,7 +106,7 @@
Convertable.b convertable_b = this.levelDirectory;
Objects.requireNonNull(this.levelDirectory);
@@ -537,7 +560,7 @@
@@ -539,7 +562,7 @@
}
public Path getDimensionPath(ResourceKey<World> resourcekey) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/storage/WorldDataServer.java
+++ b/net/minecraft/world/level/storage/WorldDataServer.java
@@ -45,6 +45,19 @@
@@ -43,6 +43,19 @@
import net.minecraft.world.level.timers.CustomFunctionCallbackTimers;
import org.slf4j.Logger;
@@ -20,7 +20,7 @@
public class WorldDataServer implements IWorldDataServer, SaveData {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -86,6 +99,20 @@
@@ -81,6 +94,20 @@
private boolean wasModded;
private final Set<String> removedFeatureFlags;
private final CustomFunctionCallbackTimerQueue<MinecraftServer> scheduledEvents;
@@ -39,18 +39,27 @@
+ }
+ // CraftBukkit end
private WorldDataServer(@Nullable DataFixer datafixer, int i, @Nullable NBTTagCompound nbttagcompound, boolean flag, int j, int k, int l, float f, long i1, long j1, int k1, int l1, int i2, boolean flag1, int j2, boolean flag2, boolean flag3, boolean flag4, WorldBorder.c worldborder_c, int k2, int l2, @Nullable UUID uuid, Set<String> set, Set<String> set1, CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue, @Nullable NBTTagCompound nbttagcompound1, EnderDragonBattle.a enderdragonbattle_a, WorldSettings worldsettings, WorldOptions worldoptions, WorldDataServer.a worlddataserver_a, Lifecycle lifecycle) {
this.fixerUpper = datafixer;
@@ -144,7 +171,7 @@
private WorldDataServer(@Nullable NBTTagCompound nbttagcompound, boolean flag, int i, int j, int k, float f, long l, long i1, int j1, int k1, int l1, boolean flag1, int i2, boolean flag2, boolean flag3, boolean flag4, WorldBorder.c worldborder_c, int j2, int k2, @Nullable UUID uuid, Set<String> set, Set<String> set1, CustomFunctionCallbackTimerQueue<MinecraftServer> customfunctioncallbacktimerqueue, @Nullable NBTTagCompound nbttagcompound1, EnderDragonBattle.a enderdragonbattle_a, WorldSettings worldsettings, WorldOptions worldoptions, WorldDataServer.a worlddataserver_a, Lifecycle lifecycle) {
this.wasModded = flag;
@@ -120,7 +147,7 @@
public static <T> WorldDataServer parse(Dynamic<T> dynamic, WorldSettings worldsettings, WorldDataServer.a worlddataserver_a, WorldOptions worldoptions, Lifecycle lifecycle) {
long i = dynamic.get("Time").asLong(0L);
- NBTTagCompound nbttagcompound = (NBTTagCompound) NBTTagCompound.CODEC.parse(dynamic.get("Player").orElseEmptyMap()).result().orElse((Object) null);
+ NBTTagCompound nbttagcompound = (NBTTagCompound) NBTTagCompound.CODEC.parse(dynamic.get("Player").orElseEmptyMap()).result().orElse(null); // CraftBukkit - decompile error
boolean flag = dynamic.get("WasModded").asBoolean(false);
int j = dynamic.get("SpawnX").asInt(0);
int k = dynamic.get("SpawnY").asInt(0);
@@ -138,7 +165,7 @@
WorldBorder.c worldborder_c = WorldBorder.c.read(dynamic, WorldBorder.DEFAULT_SETTINGS);
int k2 = dynamic.get("WanderingTraderSpawnDelay").asInt(0);
int l2 = dynamic.get("WanderingTraderSpawnChance").asInt(0);
int j2 = dynamic.get("WanderingTraderSpawnDelay").asInt(0);
int k2 = dynamic.get("WanderingTraderSpawnChance").asInt(0);
- UUID uuid = (UUID) dynamic.get("WanderingTraderId").read(UUIDUtil.CODEC).result().orElse((Object) null);
+ UUID uuid = (UUID) dynamic.get("WanderingTraderId").read(UUIDUtil.CODEC).result().orElse(null); // CraftBukkit - decompile error
Set set = (Set) dynamic.get("ServerBrands").asStream().flatMap((dynamic1) -> {
return dynamic1.asString().result().stream();
}).collect(Collectors.toCollection(Sets::newLinkedHashSet));
@@ -153,7 +180,7 @@
@@ -147,7 +174,7 @@
}).collect(Collectors.toSet());
CustomFunctionCallbackTimerQueue customfunctioncallbacktimerqueue = new CustomFunctionCallbackTimerQueue<>(CustomFunctionCallbackTimers.SERVER_CALLBACKS, dynamic.get("ScheduledEvents").asStream());
NBTTagCompound nbttagcompound1 = (NBTTagCompound) dynamic.get("CustomBossEvents").orElseEmptyMap().getValue();
@@ -59,7 +68,7 @@
Logger logger = WorldDataServer.LOGGER;
Objects.requireNonNull(logger);
@@ -189,7 +216,7 @@
@@ -182,7 +209,7 @@
nbttagcompound.put("Version", nbttagcompound2);
GameProfileSerializer.addCurrentDataVersion(nbttagcompound);
DynamicOps<NBTBase> dynamicops = RegistryOps.create(DynamicOpsNBT.INSTANCE, (HolderLookup.b) iregistrycustom);
@@ -68,7 +77,7 @@
Logger logger = WorldDataServer.LOGGER;
Objects.requireNonNull(logger);
@@ -241,11 +268,13 @@
@@ -234,11 +261,13 @@
nbttagcompound.putUUID("WanderingTraderId", this.wanderingTraderId);
}
@@ -83,7 +92,7 @@
Objects.requireNonNull(nbttaglist);
stream.forEach(nbttaglist::add);
@@ -367,6 +396,20 @@
@@ -346,6 +375,20 @@
@Override
public void setThundering(boolean flag) {
@@ -104,7 +113,7 @@
this.thundering = flag;
}
@@ -387,6 +430,20 @@
@@ -366,6 +409,20 @@
@Override
public void setRaining(boolean flag) {
@@ -125,7 +134,7 @@
this.raining = flag;
}
@@ -453,6 +510,12 @@
@@ -432,6 +489,12 @@
@Override
public void setDifficulty(EnumDifficulty enumdifficulty) {
this.settings = this.settings.withDifficulty(enumdifficulty);
@@ -138,7 +147,7 @@
}
@Override
@@ -589,6 +652,14 @@
@@ -568,6 +631,14 @@
return this.settings.copy();
}

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/storage/WorldNBTStorage.java
+++ b/net/minecraft/world/level/storage/WorldNBTStorage.java
@@ -12,6 +12,13 @@
@@ -15,6 +15,13 @@
import net.minecraft.world.entity.player.EntityHuman;
import org.slf4j.Logger;
@@ -14,7 +14,7 @@
public class WorldNBTStorage {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -55,6 +62,16 @@
@@ -59,6 +66,16 @@
}
if (nbttagcompound != null) {
@@ -30,8 +30,8 @@
+ // CraftBukkit end
int i = GameProfileSerializer.getDataVersion(nbttagcompound, -1);
entityhuman.load(DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, nbttagcompound, i));
@@ -63,6 +80,22 @@
nbttagcompound = DataFixTypes.PLAYER.updateToCurrentVersion(this.fixerUpper, nbttagcompound, i);
@@ -68,6 +85,22 @@
return nbttagcompound;
}
@@ -41,7 +41,7 @@
+ File file1 = new File(this.playerDir, s + ".dat");
+
+ if (file1.exists()) {
+ return NBTCompressedStreamTools.readCompressed((InputStream) (new FileInputStream(file1)));
+ return NBTCompressedStreamTools.readCompressed(file1.toPath(), NBTReadLimiter.unlimitedHeap());
+ }
+ } catch (Exception exception) {
+ LOGGER.warn("Failed to load player data for " + s);
@@ -54,7 +54,7 @@
public String[] getSeenPlayers() {
String[] astring = this.playerDir.list();
@@ -78,4 +111,10 @@
@@ -83,4 +116,10 @@
return astring;
}

View File

@@ -1,7 +1,7 @@
--- a/net/minecraft/world/level/storage/loot/LootDataManager.java
+++ b/net/minecraft/world/level/storage/loot/LootDataManager.java
@@ -21,6 +21,8 @@
import net.minecraft.server.packs.resources.ResourceDataJson;
@@ -22,6 +22,8 @@
import net.minecraft.util.ProblemReporter;
import net.minecraft.util.profiling.GameProfilerFiller;
import net.minecraft.world.level.storage.loot.parameters.LootContextParameterSets;
+import org.bukkit.craftbukkit.CraftLootTable;
@@ -9,7 +9,7 @@
import org.slf4j.Logger;
public class LootDataManager implements IReloadListener, LootDataResolver {
@@ -87,7 +89,7 @@
@@ -89,7 +91,7 @@
@Nullable
@Override
public <T> T getElement(LootDataId<T> lootdataid) {
@@ -18,8 +18,8 @@
}
});
@@ -97,18 +99,25 @@
lootcollector.getProblems().forEach((s, s1) -> {
@@ -99,18 +101,25 @@
problemreporter_a.get().forEach((s, s1) -> {
LootDataManager.LOGGER.warn("Found loot table element validation problem in {}: {}", s, s1);
});
+ // CraftBukkit start