Update to Minecraft 1.20.5

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-04-24 01:15:00 +10:00
parent 4deda9501f
commit 65bc2541a3
524 changed files with 7788 additions and 6181 deletions

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/saveddata/maps/WorldMap.java
+++ b/net/minecraft/world/level/saveddata/maps/WorldMap.java
@@ -32,6 +32,16 @@
@@ -44,6 +44,17 @@
import net.minecraft.world.level.saveddata.PersistentBase;
import org.slf4j.Logger;
@@ -10,6 +10,7 @@
+import org.bukkit.Bukkit;
+import org.bukkit.craftbukkit.CraftServer;
+import org.bukkit.craftbukkit.CraftWorld;
+import org.bukkit.craftbukkit.map.CraftMapCursor;
+import org.bukkit.craftbukkit.map.CraftMapView;
+import org.bukkit.craftbukkit.util.CraftChatMessage;
+// CraftBukkit end
@@ -17,7 +18,7 @@
public class WorldMap extends PersistentBase {
private static final Logger LOGGER = LogUtils.getLogger();
@@ -54,6 +64,13 @@
@@ -66,6 +77,13 @@
private final Map<String, WorldMapFrame> frameMarkers = Maps.newHashMap();
private int trackedDecorationCount;
@@ -25,13 +26,13 @@
+ public final CraftMapView mapView;
+ private CraftServer server;
+ public UUID uniqueId = null;
+ public String id;
+ public MapId id;
+ // CraftBukkit end
+
public static PersistentBase.a<WorldMap> factory() {
return new PersistentBase.a<>(() -> {
throw new IllegalStateException("Should never create an empty map saved data");
@@ -69,6 +86,10 @@
@@ -81,6 +99,10 @@
this.unlimitedTracking = flag1;
this.locked = flag2;
this.setDirty();
@@ -42,19 +43,19 @@
}
public static WorldMap createFresh(double d0, double d1, byte b0, boolean flag, boolean flag1, ResourceKey<World> resourcekey) {
@@ -86,12 +107,30 @@
@@ -98,12 +120,30 @@
}
public static WorldMap load(NBTTagCompound nbttagcompound) {
public static WorldMap load(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
- DataResult dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("dimension")));
+ DataResult<ResourceKey<World>> dataresult = DimensionManager.parseLegacy(new Dynamic(DynamicOpsNBT.INSTANCE, nbttagcompound.get("dimension"))); // CraftBukkit - decompile error
Logger logger = WorldMap.LOGGER;
Objects.requireNonNull(logger);
- ResourceKey<World> resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElseThrow(() -> {
- return new IllegalArgumentException("Invalid map dimension: " + nbttagcompound.get("dimension"));
- return new IllegalArgumentException("Invalid map dimension: " + String.valueOf(nbttagcompound.get("dimension")));
+ // CraftBukkit start
+ ResourceKey<World> resourcekey = dataresult.resultOrPartial(logger::error).orElseGet(() -> {
+ ResourceKey<World> resourcekey = (ResourceKey) dataresult.resultOrPartial(logger::error).orElseGet(() -> {
+ long least = nbttagcompound.getLong("UUIDLeast");
+ long most = nbttagcompound.getLong("UUIDMost");
+
@@ -71,15 +72,25 @@
+ return world.getHandle().dimension();
+ }
+ }
+ throw new IllegalArgumentException("Invalid map dimension: " + nbttagcompound.get("dimension"));
+ throw new IllegalArgumentException("Invalid map dimension: " + String.valueOf(nbttagcompound.get("dimension")));
+ // CraftBukkit end
});
int i = nbttagcompound.getInt("xCenter");
int j = nbttagcompound.getInt("zCenter");
@@ -129,13 +168,32 @@
@@ -128,7 +168,8 @@
MapIconBanner mapiconbanner = (MapIconBanner) iterator.next();
worldmap.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
- worldmap.addDecoration(mapiconbanner.getDecoration(), (GeneratorAccess) null, mapiconbanner.getId(), (double) mapiconbanner.pos().getX(), (double) mapiconbanner.pos().getZ(), 180.0D, (IChatBaseComponent) mapiconbanner.name().orElse((Object) null));
+ // CraftBukkit - decompile error
+ worldmap.addDecoration(mapiconbanner.getDecoration(), (GeneratorAccess) null, mapiconbanner.getId(), (double) mapiconbanner.pos().getX(), (double) mapiconbanner.pos().getZ(), 180.0D, (IChatBaseComponent) mapiconbanner.name().orElse(null));
}
NBTTagList nbttaglist = nbttagcompound.getList("frames", 10);
@@ -147,13 +188,32 @@
@Override
public NBTTagCompound save(NBTTagCompound nbttagcompound) {
public NBTTagCompound save(NBTTagCompound nbttagcompound, HolderLookup.a holderlookup_a) {
- DataResult dataresult = MinecraftKey.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.dimension.location());
+ DataResult<NBTBase> dataresult = MinecraftKey.CODEC.encodeStart(DynamicOpsNBT.INSTANCE, this.dimension.location()); // CraftBukkit - decompile error
Logger logger = WorldMap.LOGGER;
@@ -110,7 +121,16 @@
nbttagcompound.putInt("xCenter", this.centerX);
nbttagcompound.putInt("zCenter", this.centerZ);
nbttagcompound.putByte("scale", this.scale);
@@ -510,7 +568,7 @@
@@ -408,7 +468,7 @@
if (!this.isTrackedCountOverLimit(256)) {
this.bannerMarkers.put(mapiconbanner.getId(), mapiconbanner);
- this.addDecoration(mapiconbanner.getDecoration(), generatoraccess, mapiconbanner.getId(), d0, d1, 180.0D, (IChatBaseComponent) mapiconbanner.name().orElse((Object) null));
+ this.addDecoration(mapiconbanner.getDecoration(), generatoraccess, mapiconbanner.getId(), d0, d1, 180.0D, (IChatBaseComponent) mapiconbanner.name().orElse(null)); // CraftBukkit - decompile error
return true;
}
}
@@ -514,7 +574,7 @@
this.player = entityhuman;
}
@@ -119,7 +139,7 @@
int i = this.minDirtyX;
int j = this.minDirtyY;
int k = this.maxDirtyX + 1 - this.minDirtyX;
@@ -519,7 +577,7 @@
@@ -523,7 +583,7 @@
for (int i1 = 0; i1 < k; ++i1) {
for (int j1 = 0; j1 < l; ++j1) {
@@ -128,9 +148,9 @@
}
}
@@ -529,19 +587,29 @@
@@ -533,19 +593,29 @@
@Nullable
Packet<?> nextUpdatePacket(int i) {
Packet<?> nextUpdatePacket(MapId mapid) {
WorldMap.b worldmap_b;
+ org.bukkit.craftbukkit.map.RenderData render = WorldMap.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.player.getBukkitEntity()); // CraftBukkit
@@ -153,7 +173,7 @@
+
+ for (org.bukkit.map.MapCursor cursor : render.cursors) {
+ if (cursor.isVisible()) {
+ icons.add(new MapIcon(MapIcon.Type.byIcon(cursor.getRawType()), cursor.getX(), cursor.getY(), cursor.getDirection(), CraftChatMessage.fromStringOrNull(cursor.getCaption())));
+ icons.add(new MapIcon(CraftMapCursor.CraftType.bukkitToMinecraftHolder(cursor.getType()), cursor.getX(), cursor.getY(), cursor.getDirection(), CraftChatMessage.fromStringOrOptional(cursor.getCaption())));
+ }
+ }
+ collection = icons;