3
0

Fix for map decoration

This commit is contained in:
Sergey Shatunov 2016-01-05 14:48:56 +07:00
parent 0011dd0d9a
commit 6911f3485a
3 changed files with 72 additions and 7 deletions

View File

@ -14,6 +14,15 @@
this.func_146065_b(p_70097_1_.getEntity(), false); this.func_146065_b(p_70097_1_.getEntity(), false);
this.setDisplayedItem((ItemStack)null); this.setDisplayedItem((ItemStack)null);
} }
@@ -115,7 +122,7 @@
if (p_110131_1_.getItem() == Items.filled_map)
{
MapData mapdata = ((ItemMap)p_110131_1_.getItem()).getMapData(p_110131_1_, this.worldObj);
- mapdata.playersVisibleOnMap.remove("frame-" + this.getEntityId());
+ mapdata.playersVisibleOnMap.remove(java.util.UUID.nameUUIDFromBytes(("frame-" + this.getEntityId()).getBytes(org.apache.commons.codec.Charsets.US_ASCII))); // Spigot
}
p_110131_1_.setItemFrame((EntityItemFrame)null);
@@ -203,4 +210,11 @@ @@ -203,4 +210,11 @@
return true; return true;

View File

@ -15,10 +15,16 @@
public class MapData extends WorldSavedData public class MapData extends WorldSavedData
{ {
public int xCenter; public int xCenter;
@@ -24,11 +32,21 @@ @@ -21,14 +29,24 @@
public List playersArrayList = new ArrayList(); public int dimension;
private Map playersHashMap = new HashMap(); public byte scale;
public Map playersVisibleOnMap = new LinkedHashMap(); public byte[] colors = new byte[16384];
- public List playersArrayList = new ArrayList();
- private Map playersHashMap = new HashMap();
- public Map playersVisibleOnMap = new LinkedHashMap();
+ public List<MapInfo> playersArrayList = new ArrayList<MapInfo>(); // Spigot
+ private Map<EntityPlayer, MapInfo> playersHashMap = new HashMap<EntityPlayer, MapInfo>(); // Spigot
+ public Map<java.util.UUID, MapCoord> playersVisibleOnMap = new LinkedHashMap<java.util.UUID, MapCoord>(); // Spigot
+ +
+ // CraftBukkit start + // CraftBukkit start
+ public final CraftMapView mapView; + public final CraftMapView mapView;
@ -37,7 +43,7 @@
} }
public void readFromNBT(NBTTagCompound p_76184_1_) public void readFromNBT(NBTTagCompound p_76184_1_)
@@ -107,7 +125,7 @@ @@ -107,14 +125,14 @@
{ {
if (!this.playersHashMap.containsKey(p_76191_1_)) if (!this.playersHashMap.containsKey(p_76191_1_))
{ {
@ -46,6 +52,55 @@
this.playersHashMap.put(p_76191_1_, mapinfo); this.playersHashMap.put(p_76191_1_, mapinfo);
this.playersArrayList.add(mapinfo); this.playersArrayList.add(mapinfo);
} }
if (!p_76191_1_.inventory.hasItemStack(p_76191_2_))
{
- this.playersVisibleOnMap.remove(p_76191_1_.getCommandSenderName());
+ this.playersVisibleOnMap.remove(p_76191_1_.getUniqueID());
}
for (int i = 0; i < this.playersArrayList.size(); ++i)
@@ -125,7 +143,7 @@
{
if (!p_76191_2_.isOnItemFrame() && mapinfo1.entityplayerObj.dimension == this.dimension)
{
- this.func_82567_a(0, mapinfo1.entityplayerObj.worldObj, mapinfo1.entityplayerObj.getCommandSenderName(), mapinfo1.entityplayerObj.posX, mapinfo1.entityplayerObj.posZ, (double)mapinfo1.entityplayerObj.rotationYaw);
+ this.func_82567_a(0, mapinfo1.entityplayerObj.worldObj, mapinfo1.entityplayerObj.getCommandSenderName(), mapinfo1.entityplayerObj.getUniqueID(), mapinfo1.entityplayerObj.posX, mapinfo1.entityplayerObj.posZ, (double)mapinfo1.entityplayerObj.rotationYaw);
}
}
else
@@ -137,11 +155,11 @@
if (p_76191_2_.isOnItemFrame())
{
- this.func_82567_a(1, p_76191_1_.worldObj, "frame-" + p_76191_2_.getItemFrame().getEntityId(), (double)p_76191_2_.getItemFrame().field_146063_b, (double)p_76191_2_.getItemFrame().field_146062_d, (double)(p_76191_2_.getItemFrame().hangingDirection * 90));
+ this.func_82567_a(1, p_76191_1_.worldObj, "frame-" + p_76191_2_.getItemFrame().getEntityId(), UUID.nameUUIDFromBytes(("frame-" + p_76191_2_.getItemFrame().getEntityId()).getBytes(org.apache.commons.codec.Charsets.US_ASCII)), (double)p_76191_2_.getItemFrame().field_146063_b, (double)p_76191_2_.getItemFrame().field_146062_d, (double)(p_76191_2_.getItemFrame().hangingDirection * 90));
}
}
- private void func_82567_a(int p_82567_1_, World p_82567_2_, String p_82567_3_, double p_82567_4_, double p_82567_6_, double p_82567_8_)
+ private void func_82567_a(int p_82567_1_, World p_82567_2_, String entityName, UUID p_82567_3_, double p_82567_4_, double p_82567_6_, double p_82567_8_)
{
int j = 1 << this.scale;
float f = (float)(p_82567_4_ - (double)this.xCenter) / (float)j;
@@ -156,7 +174,7 @@
p_82567_8_ += p_82567_8_ < 0.0D ? -8.0D : 8.0D;
b2 = (byte)((int)(p_82567_8_ * 16.0D / 360.0D));
- if (p_82567_2_.provider.shouldMapSpin(p_82567_3_, p_82567_4_, p_82567_6_, p_82567_8_))
+ if (p_82567_2_.provider.shouldMapSpin(entityName, p_82567_4_, p_82567_6_, p_82567_8_))
{
int k = (int)(p_82567_2_.getWorldInfo().getWorldTime() / 10L);
b2 = (byte)(k * k * 34187121 + k * 121 >> 15 & 15);
@@ -250,7 +268,7 @@
byte b3 = p_76192_1_[i * 3 + 2];
byte b0 = p_76192_1_[i * 3 + 3];
byte b1 = (byte)(p_76192_1_[i * 3 + 1] & 15);
- this.playersVisibleOnMap.put("icon-" + i, new MapData.MapCoord(b2, b3, b0, b1));
+ this.playersVisibleOnMap.put(UUID.nameUUIDFromBytes(("icon-" + i).getBytes(org.apache.commons.codec.Charsets.US_ASCII)), new MapData.MapCoord(b2, b3, b0, b1));
}
}
else if (p_76192_1_[0] == 2)
@@ -265,7 +283,7 @@ @@ -265,7 +283,7 @@
if (mapinfo == null) if (mapinfo == null)

View File

@ -1,5 +1,6 @@
package org.bukkit.craftbukkit.map; package org.bukkit.craftbukkit.map;
import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -32,9 +33,9 @@ public class CraftMapRenderer extends MapRenderer {
cursors.removeCursor(cursors.getCursor(0)); cursors.removeCursor(cursors.getCursor(0));
} }
for (Object key : worldMap.playersVisibleOnMap.keySet()) { for (UUID key : worldMap.playersVisibleOnMap.keySet()) { // Spigot string -> uuid
// If this cursor is for a player check visibility with vanish system // 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)) { if (other != null && !player.canSee(other)) {
continue; continue;
} }