2016-03-01 00:23:45 +00:00
|
|
|
From 6b40527380526915e7a782674806510418b98bcd Mon Sep 17 00:00:00 2001
|
2015-06-05 06:43:14 +00:00
|
|
|
From: Antony Riley <antony@cyberiantiger.org>
|
|
|
|
Date: Sun, 26 Apr 2015 02:14:13 +0300
|
|
|
|
Subject: [PATCH] map decoration fix
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java
|
2016-02-29 21:33:06 +00:00
|
|
|
index 1a9b5cc..1d9f569 100644
|
2015-06-05 06:43:14 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/EntityItemFrame.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/EntityItemFrame.java
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -1,5 +1,7 @@
|
2015-06-05 06:43:14 +00:00
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
+import java.util.UUID;
|
|
|
|
+import org.apache.commons.codec.Charsets;
|
2016-02-29 21:33:06 +00:00
|
|
|
import com.google.common.base.Optional;
|
2015-06-05 06:43:14 +00:00
|
|
|
|
2016-02-29 21:33:06 +00:00
|
|
|
public class EntityItemFrame extends EntityHanging {
|
|
|
|
@@ -95,7 +97,7 @@ public class EntityItemFrame extends EntityHanging {
|
2015-06-05 06:43:14 +00:00
|
|
|
if (itemstack.getItem() == Items.FILLED_MAP) {
|
|
|
|
WorldMap worldmap = ((ItemWorldMap) itemstack.getItem()).getSavedMap(itemstack, this.world);
|
|
|
|
|
|
|
|
- worldmap.decorations.remove("frame-" + this.getId());
|
|
|
|
+ worldmap.decorations.remove(UUID.nameUUIDFromBytes(("frame-" + this.getId()).getBytes(Charsets.US_ASCII))); // Spigot
|
|
|
|
}
|
|
|
|
|
|
|
|
itemstack.a((EntityItemFrame) null);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java
|
2016-02-29 21:33:06 +00:00
|
|
|
index d0d7c9d..e090fea 100644
|
2015-06-05 06:43:14 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/WorldMap.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/WorldMap.java
|
|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
package net.minecraft.server;
|
|
|
|
|
|
|
|
+import com.google.common.base.Charsets;
|
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
import java.util.Iterator;
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -24,7 +25,7 @@ public class WorldMap extends PersistentBase {
|
2015-06-05 06:43:14 +00:00
|
|
|
public byte[] colors = new byte[16384];
|
2016-02-29 21:33:06 +00:00
|
|
|
public List<WorldMap.WorldMapHumanTracker> h = Lists.newArrayList();
|
|
|
|
public Map<EntityHuman, WorldMap.WorldMapHumanTracker> j = Maps.newHashMap(); // Spigot
|
2015-06-05 06:43:14 +00:00
|
|
|
- public Map<String, MapIcon> decorations = Maps.newLinkedHashMap();
|
|
|
|
+ public Map<UUID, MapIcon> decorations = Maps.newLinkedHashMap(); // Spigot
|
|
|
|
|
|
|
|
// CraftBukkit start
|
|
|
|
public final CraftMapView mapView;
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -152,7 +153,7 @@ public class WorldMap extends PersistentBase {
|
2015-06-05 06:43:14 +00:00
|
|
|
}
|
|
|
|
|
2016-02-29 21:33:06 +00:00
|
|
|
if (!entityhuman.inventory.f(itemstack)) {
|
2015-06-05 06:43:14 +00:00
|
|
|
- this.decorations.remove(entityhuman.getName());
|
|
|
|
+ this.decorations.remove(entityhuman.getUniqueID()); // Spigot
|
|
|
|
}
|
|
|
|
|
2016-02-29 21:33:06 +00:00
|
|
|
for (int i = 0; i < this.h.size(); ++i) {
|
|
|
|
@@ -160,7 +161,7 @@ public class WorldMap extends PersistentBase {
|
2015-06-05 06:43:14 +00:00
|
|
|
|
2016-02-29 21:33:06 +00:00
|
|
|
if (!worldmap_worldmaphumantracker1.trackee.dead && (worldmap_worldmaphumantracker1.trackee.inventory.f(itemstack) || itemstack.y())) {
|
|
|
|
if (!itemstack.y() && worldmap_worldmaphumantracker1.trackee.dimension == this.map && this.track) {
|
2015-06-05 06:43:14 +00:00
|
|
|
- this.a(0, worldmap_worldmaphumantracker1.trackee.world, worldmap_worldmaphumantracker1.trackee.getName(), worldmap_worldmaphumantracker1.trackee.locX, worldmap_worldmaphumantracker1.trackee.locZ, (double) worldmap_worldmaphumantracker1.trackee.yaw);
|
|
|
|
+ this.a(0, worldmap_worldmaphumantracker1.trackee.world, worldmap_worldmaphumantracker1.trackee.getUniqueID(), worldmap_worldmaphumantracker1.trackee.locX, worldmap_worldmaphumantracker1.trackee.locZ, (double) worldmap_worldmaphumantracker1.trackee.yaw); // Spigot
|
|
|
|
}
|
|
|
|
} else {
|
2016-02-29 21:33:06 +00:00
|
|
|
this.j.remove(worldmap_worldmaphumantracker1.trackee);
|
|
|
|
@@ -172,7 +173,7 @@ public class WorldMap extends PersistentBase {
|
2015-06-05 06:43:14 +00:00
|
|
|
EntityItemFrame entityitemframe = itemstack.z();
|
|
|
|
BlockPosition blockposition = entityitemframe.getBlockPosition();
|
|
|
|
|
2016-02-29 21:33:06 +00:00
|
|
|
- this.a(1, entityhuman.world, "frame-" + entityitemframe.getId(), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.direction.get2DRotationValue() * 90));
|
|
|
|
+ this.a(1, entityhuman.world, UUID.nameUUIDFromBytes(("frame-" + entityitemframe.getId()).getBytes(Charsets.US_ASCII)), (double) blockposition.getX(), (double) blockposition.getZ(), (double) (entityitemframe.direction.get2DRotationValue() * 90)); // Spigot
|
2015-06-05 06:43:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (itemstack.hasTag() && itemstack.getTag().hasKeyOfType("Decorations", 9)) {
|
2016-02-29 21:33:06 +00:00
|
|
|
@@ -181,15 +182,18 @@ public class WorldMap extends PersistentBase {
|
2015-06-05 06:43:14 +00:00
|
|
|
for (int j = 0; j < nbttaglist.size(); ++j) {
|
|
|
|
NBTTagCompound nbttagcompound = nbttaglist.get(j);
|
|
|
|
|
|
|
|
- if (!this.decorations.containsKey(nbttagcompound.getString("id"))) {
|
|
|
|
- this.a(nbttagcompound.getByte("type"), entityhuman.world, nbttagcompound.getString("id"), nbttagcompound.getDouble("x"), nbttagcompound.getDouble("z"), nbttagcompound.getDouble("rot"));
|
|
|
|
+ // Spigot - start
|
|
|
|
+ UUID uuid = UUID.nameUUIDFromBytes(nbttagcompound.getString("id").getBytes(Charsets.US_ASCII));
|
|
|
|
+ if (!this.decorations.containsKey(uuid)) {
|
|
|
|
+ this.a(nbttagcompound.getByte("type"), entityhuman.world, uuid, nbttagcompound.getDouble("x"), nbttagcompound.getDouble("z"), nbttagcompound.getDouble("rot"));
|
|
|
|
+ // Spigot - end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
- private void a(int i, World world, String s, double d0, double d1, double d2) {
|
|
|
|
+ private void a(int i, World world, UUID s, double d0, double d1, double d2) {
|
|
|
|
int j = 1 << this.scale;
|
|
|
|
float f = (float) (d0 - (double) this.centerX) / (float) j;
|
|
|
|
float f1 = (float) (d1 - (double) this.centerZ) / (float) j;
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
|
|
|
|
index d56a291..ad47bdd 100644
|
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/map/CraftMapRenderer.java
|
|
|
|
@@ -1,5 +1,6 @@
|
|
|
|
package org.bukkit.craftbukkit.map;
|
|
|
|
|
|
|
|
+import java.util.UUID;
|
|
|
|
import net.minecraft.server.WorldMap;
|
|
|
|
import net.minecraft.server.MapIcon;
|
|
|
|
|
|
|
|
@@ -34,13 +35,12 @@ public class CraftMapRenderer extends MapRenderer {
|
|
|
|
cursors.removeCursor(cursors.getCursor(0));
|
|
|
|
}
|
|
|
|
|
|
|
|
- for (Object key : worldMap.decorations.keySet()) {
|
|
|
|
+ for (UUID key : worldMap.decorations.keySet()) { // Spigot string -> uuid.
|
|
|
|
// If this cursor is for a player check visibility with vanish system
|
|
|
|
- Player other = Bukkit.getPlayerExact((String) key);
|
|
|
|
+ Player other = Bukkit.getPlayer(key); // Spigot
|
|
|
|
if (other != null && !player.canSee(other)) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
-
|
|
|
|
|
|
|
|
MapIcon decoration = (MapIcon) worldMap.decorations.get(key);
|
|
|
|
cursors.addCursor(decoration.getX(), decoration.getY(), (byte) (decoration.getRotation() & 15), decoration.getType());
|
|
|
|
--
|
2016-02-29 21:33:06 +00:00
|
|
|
2.5.0
|
2015-06-05 06:43:14 +00:00
|
|
|
|