Add support for multiple world event markers

This commit is contained in:
Sam 2017-02-26 17:13:35 +00:00
parent dc66a79ef7
commit 31efd50489

View File

@ -128,15 +128,11 @@ public class ItemMapRenderer extends MapRenderer
} }
else else
{ {
// int chunkBX = blockX & 0xF; // int chunkBX = blockX & 0xF;
// int chunkBZ = blockZ & 0xF; // int chunkBZ = blockZ & 0xF;
// Border // Border
if ( if (_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX - 1, STANDARD_Y, blockZ)) || _safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ - 1)) || _safezone.isInSafeZone(new Location(mapView.getWorld(), blockX + 16, STANDARD_Y, blockZ)) || _safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ + 1)))
_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX - 1, STANDARD_Y, blockZ)) ||
_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ - 1)) ||
_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX + 16, STANDARD_Y, blockZ)) ||
_safezone.isInSafeZone(new Location(mapView.getWorld(), blockX, STANDARD_Y, blockZ + 1)))
{ {
Color cColor = MapPalette.getColor(color); Color cColor = MapPalette.getColor(color);
double clans = colorAll ? 1 : 0.8; double clans = colorAll ? 1 : 0.8;
@ -157,7 +153,8 @@ public class ItemMapRenderer extends MapRenderer
double clans = 0.065; double clans = 0.065;
// Stripes // Stripes
//boolean checker = (mapX + (mapZ % 4)) % 4 == 0; // boolean checker = (mapX + (mapZ % 4))
// % 4 == 0;
double base = 1 - clans; double base = 1 - clans;
int r = (int) ((cColor.getRed() * base) + (areaColor.getRed() * clans)); int r = (int) ((cColor.getRed() * base) + (areaColor.getRed() * clans));
@ -194,29 +191,32 @@ public class ItemMapRenderer extends MapRenderer
for (WorldEvent event : _worldEvent.getActiveEvents()) for (WorldEvent event : _worldEvent.getActiveEvents())
{ {
if (!event.isInProgress()) if (!event.isInProgress() || event.getEventLocations() == null)
{ {
continue; continue;
} }
Location point = event.getCurrentLocation(); for (Location point : event.getEventLocations())
double mapX = (point.getX() - info.getX()) / zoom;
double mapZ = (point.getZ() - info.getZ()) / zoom;
// To make these appear at the edges of the map, just change it from
// 64 to something like 128 for double the map size
if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64)
{ {
byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D); double mapX = (point.getX() - info.getX()) / zoom;
byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D); double mapZ = (point.getZ() - info.getZ()) / zoom;
byte cursorType = 5; // http://i.imgur.com/wpH6PT8.png // To make these appear at the edges of the map, just change it
// Those are byte 5 and 6 // from
byte rotation = (byte) (int) ((point.getYaw() * 16D) / 360D); // 64 to something like 128 for double the map size
if (mapX > -64 && mapX < 64 && mapZ > -64 && mapZ < 64)
{
byte b0 = (byte) (int) Math.min(127, (double) (mapX * 2.0F) + 0.5D);
byte b1 = (byte) (int) Math.max(-127, (double) (mapZ * 2.0F) + 0.5D);
MapCursor cursor = new MapCursor(b0, b1, rotation, cursorType, true); byte cursorType = 5; // http://i.imgur.com/wpH6PT8.png
// Those are byte 5 and 6
byte rotation = (byte) (int) (((point.getYaw() + 180) * 16D) / 360D);
cursors.addCursor(cursor); MapCursor cursor = new MapCursor(b0, b1, rotation, cursorType, true);
cursors.addCursor(cursor);
}
} }
} }