summaryrefslogtreecommitdiffstats
path: root/nms-patches/WorldMap.patch
diff options
context:
space:
mode:
authorThinkofdeath <thinkofdeath@spigotmc.org>2014-11-26 08:32:16 +1100
committermd_5 <git@md-5.net>2014-11-28 17:16:30 +1100
commit24557bc2b37deb6a0edf497d547471832457b1dd (patch)
treec560572889a3b0b34964a0cddb35dc87fda3c914 /nms-patches/WorldMap.patch
parenta4805dbd77da057cc1ea0bf344379bc6e53ca1f6 (diff)
downloadcraftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.gz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.lz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.tar.xz
craftbukkit-24557bc2b37deb6a0edf497d547471832457b1dd.zip
Update to Minecraft 1.8
For more information please see http://www.spigotmc.org/
Diffstat (limited to 'nms-patches/WorldMap.patch')
-rw-r--r--nms-patches/WorldMap.patch95
1 files changed, 95 insertions, 0 deletions
diff --git a/nms-patches/WorldMap.patch b/nms-patches/WorldMap.patch
new file mode 100644
index 00000000..86ba2aa6
--- /dev/null
+++ b/nms-patches/WorldMap.patch
@@ -0,0 +1,95 @@
+--- ../work/decompile-bb26c12b/net/minecraft/server/WorldMap.java 2014-11-27 08:59:46.941420790 +1100
++++ src/main/java/net/minecraft/server/WorldMap.java 2014-11-27 08:42:10.152850911 +1100
+@@ -6,6 +6,14 @@
+ import java.util.List;
+ import java.util.Map;
+
++// CraftBukkit start
++import java.util.UUID;
++
++import org.bukkit.craftbukkit.CraftServer;
++import org.bukkit.craftbukkit.CraftWorld;
++import org.bukkit.craftbukkit.map.CraftMapView;
++// CraftBukkit end
++
+ public class WorldMap extends PersistentBase {
+
+ public int centerX;
+@@ -16,9 +24,19 @@
+ public List g = Lists.newArrayList();
+ private Map i = Maps.newHashMap();
+ public Map decorations = Maps.newLinkedHashMap();
++
++ // CraftBukkit start
++ public final CraftMapView mapView;
++ private CraftServer server;
++ private UUID uniqueId = null;
++ // CraftBukkit end
+
+ public WorldMap(String s) {
+ super(s);
++ // CraftBukkit start
++ mapView = new CraftMapView(this);
++ server = (CraftServer) org.bukkit.Bukkit.getServer();
++ // CraftBukkit end
+ }
+
+ public void a(double d0, double d1, int i) {
+@@ -31,7 +49,30 @@
+ }
+
+ public void a(NBTTagCompound nbttagcompound) {
+- this.map = nbttagcompound.getByte("dimension");
++ // CraftBukkit start
++ byte dimension = nbttagcompound.getByte("dimension");
++
++ if (dimension >= 10) {
++ long least = nbttagcompound.getLong("UUIDLeast");
++ long most = nbttagcompound.getLong("UUIDMost");
++
++ if (least != 0L && most != 0L) {
++ this.uniqueId = new UUID(most, least);
++
++ CraftWorld world = (CraftWorld) server.getWorld(this.uniqueId);
++ // Check if the stored world details are correct.
++ if (world == null) {
++ /* All Maps which do not have their valid world loaded are set to a dimension which hopefully won't be reached.
++ This is to prevent them being corrupted with the wrong map data. */
++ dimension = 127;
++ } else {
++ dimension = (byte) world.getHandle().dimension;
++ }
++ }
++ }
++
++ this.map = dimension;
++ // CraftBukkit end
+ this.centerX = nbttagcompound.getInt("xCenter");
+ this.centerZ = nbttagcompound.getInt("zCenter");
+ this.scale = nbttagcompound.getByte("scale");
+@@ -66,6 +107,25 @@
+ }
+
+ public void b(NBTTagCompound nbttagcompound) {
++ // CraftBukkit start
++ if (this.map >= 10) {
++ if (this.uniqueId == null) {
++ for (org.bukkit.World world : server.getWorlds()) {
++ CraftWorld cWorld = (CraftWorld) world;
++ if (cWorld.getHandle().dimension == this.map) {
++ this.uniqueId = cWorld.getUID();
++ break;
++ }
++ }
++ }
++ /* Perform a second check to see if a matching world was found, this is a necessary
++ change incase Maps are forcefully unlinked from a World and lack a UID.*/
++ if (this.uniqueId != null) {
++ nbttagcompound.setLong("UUIDLeast", this.uniqueId.getLeastSignificantBits());
++ nbttagcompound.setLong("UUIDMost", this.uniqueId.getMostSignificantBits());
++ }
++ }
++ // CraftBukkit end
+ nbttagcompound.setByte("dimension", this.map);
+ nbttagcompound.setInt("xCenter", this.centerX);
+ nbttagcompound.setInt("zCenter", this.centerZ);