Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package org.bukkit.craftbukkit.map;
2
3import net.minecraft.server.WorldMap;
4import net.minecraft.server.WorldMapOrienter;
5import org.bukkit.entity.Player;
6import org.bukkit.map.MapCanvas;
7import org.bukkit.map.MapCursorCollection;
8import org.bukkit.map.MapRenderer;
9import org.bukkit.map.MapView;
10
11public class CraftMapRenderer extends MapRenderer {
12
13 private final CraftMapView mapView;
14 private final WorldMap worldMap;
15
16 public CraftMapRenderer(CraftMapView mapView, WorldMap worldMap) {
17 super(false);
18 this.mapView = mapView;
19 this.worldMap = worldMap;
20 }
21
22 @Override
23 public void render(MapView map, MapCanvas canvas, Player player) {
24 // Map
25 for (int x = 0; x < 128; ++x) {
26 for (int y = 0; y < 128; ++y) {
27 canvas.setPixel(x, y, worldMap.f[y * 128 + x]);
28 }
29 }
30
31 // Cursors
32 MapCursorCollection cursors = canvas.getCursors();
33 while (cursors.size() > 0) {
34 cursors.removeCursor(cursors.getCursor(0));
35 }
36 for (int i = 0; i < worldMap.i.size(); ++i) {
37 WorldMapOrienter orienter = (WorldMapOrienter) worldMap.i.get(i);
38 cursors.addCursor(orienter.b, orienter.c, (byte) (orienter.d & 15), (byte) (orienter.a));
39 }
40 }
41
42}