mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 09:26:08 +03:00
73 lines
3.7 KiB
Diff
73 lines
3.7 KiB
Diff
--- ../src-base/minecraft/net/minecraft/world/storage/MapData.java
|
|
+++ ../src-work/minecraft/net/minecraft/world/storage/MapData.java
|
|
@@ -17,7 +17,16 @@
|
|
import net.minecraft.util.math.Vec4b;
|
|
import net.minecraft.world.World;
|
|
import net.minecraft.world.WorldSavedData;
|
|
+import org.bukkit.craftbukkit.map.CraftMapView;
|
|
|
|
+//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 MapData extends WorldSavedData
|
|
{
|
|
public int xCenter;
|
|
@@ -27,12 +36,21 @@
|
|
public byte scale;
|
|
public byte[] colors = new byte[16384];
|
|
public List<MapData.MapInfo> playersArrayList = Lists.<MapData.MapInfo>newArrayList();
|
|
- private final Map<EntityPlayer, MapData.MapInfo> playersHashMap = Maps.<EntityPlayer, MapData.MapInfo>newHashMap();
|
|
+ public final Map<EntityPlayer, MapData.MapInfo> playersHashMap = Maps.<EntityPlayer, MapData.MapInfo>newHashMap(); // Spigot private -> public
|
|
public Map<String, Vec4b> mapDecorations = Maps.<String, Vec4b>newLinkedHashMap();
|
|
+ // CraftBukkit start
|
|
+ public final CraftMapView mapView;
|
|
+ private CraftServer server;
|
|
+ private UUID uniqueId = null;
|
|
+ // CraftBukkit end
|
|
|
|
public MapData(String mapname)
|
|
{
|
|
super(mapname);
|
|
+ // CraftBukkit start
|
|
+ mapView = new CraftMapView(this);
|
|
+ server = (CraftServer) org.bukkit.Bukkit.getServer();
|
|
+ // CraftBukkit end
|
|
}
|
|
|
|
public void calculateMapCenter(double x, double z, int mapScale)
|
|
@@ -278,14 +296,27 @@
|
|
|
|
public Packet<?> getPacket(ItemStack stack)
|
|
{
|
|
+ // CraftBukkit start
|
|
+ org.bukkit.craftbukkit.map.RenderData render = MapData.this.mapView.render((org.bukkit.craftbukkit.entity.CraftPlayer) this.entityplayerObj.getBukkitEntity()); // CraftBukkit
|
|
+
|
|
+ java.util.Collection<Vec4b> icons = new java.util.ArrayList<Vec4b>();
|
|
+
|
|
+ for ( org.bukkit.map.MapCursor cursor : render.cursors) {
|
|
+
|
|
+ if (cursor.isVisible()) {
|
|
+ icons.add(new Vec4b(cursor.getRawType(), cursor.getX(), cursor.getY(), cursor.getDirection()));
|
|
+ }
|
|
+ }
|
|
if (this.isDirty)
|
|
{
|
|
this.isDirty = false;
|
|
- return new SPacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.trackingPosition, MapData.this.mapDecorations.values(), MapData.this.colors, this.minX, this.minY, this.maxX + 1 - this.minX, this.maxY + 1 - this.minY);
|
|
+ //return new SPacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.trackingPosition, MapData.this.mapDecorations.values(), MapData.this.colors, this.minX, this.minY, this.maxX + 1 - this.minX, this.maxY + 1 - this.minY);
|
|
+ return new SPacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.trackingPosition, icons, render.buffer, this.minX, this.minY, this.maxX + 1 - this.minX, this.maxY + 1 - this.minY);
|
|
}
|
|
else
|
|
{
|
|
- return this.tick++ % 5 == 0 ? new SPacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.trackingPosition, MapData.this.mapDecorations.values(), MapData.this.colors, 0, 0, 0, 0) : null;
|
|
+ //return this.tick++ % 5 == 0 ? new SPacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.trackingPosition, MapData.this.mapDecorations.values(), MapData.this.colors, 0, 0, 0, 0) : null;
|
|
+ return (this.tick++ % 5 == 0) ? new SPacketMaps(stack.getMetadata(), MapData.this.scale, MapData.this.trackingPosition, icons, render.buffer, 0, 0, 0, 0) : null;
|
|
}
|
|
}
|
|
|