mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-05 01:59:44 +01:00
Merge remote branch 'origin/master'
This commit is contained in:
commit
2ee49fd82e
@ -406,7 +406,7 @@ public class DynmapPlugin extends JavaPlugin {
|
||||
pm.registerEvent(org.bukkit.event.Event.Type.BLOCK_PLACE, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this);
|
||||
onbreak = isTrigger("blockbreak");
|
||||
pm.registerEvent(org.bukkit.event.Event.Type.BLOCK_BREAK, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this);
|
||||
if(isTrigger("snowform")) Log.info("The 'snowform' trigger has been deprecated due to Bukkit changes - use 'blockform'");
|
||||
if(isTrigger("snowform")) Log.info("The 'snowform' trigger has been deprecated due to Bukkit changes - use 'blockformed'");
|
||||
onleaves = isTrigger("leavesdecay");
|
||||
pm.registerEvent(org.bukkit.event.Event.Type.LEAVES_DECAY, renderTrigger, org.bukkit.event.Event.Priority.Monitor, this);
|
||||
onburn = isTrigger("blockburn");
|
||||
|
@ -310,7 +310,9 @@ public class MapManager {
|
||||
tile.render(cache);
|
||||
}
|
||||
else {
|
||||
if ((cache.isEmpty() == false) && tile.render(cache)) {
|
||||
/* Switch to not checking if rendered tile is blank - breaks us on skylands, where tiles can be nominally blank - just work off chunk cache empty */
|
||||
if (cache.isEmpty() == false) {
|
||||
tile.render(cache);
|
||||
found.remove(tile);
|
||||
rendered.add(tile);
|
||||
for (MapTile adjTile : map.getAdjecentTiles(tile)) {
|
||||
|
@ -76,6 +76,7 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
|
||||
private static final int CHEST_BLKTYPEID = 54;
|
||||
private static final int FENCE_BLKTYPEID = 85;
|
||||
private static final int REDSTONE_BLKTYPEID = 55;
|
||||
|
||||
private enum ChestData {
|
||||
SINGLE_WEST, SINGLE_SOUTH, SINGLE_EAST, SINGLE_NORTH, LEFT_WEST, LEFT_SOUTH, LEFT_EAST, LEFT_NORTH, RIGHT_WEST, RIGHT_SOUTH, RIGHT_EAST, RIGHT_NORTH
|
||||
@ -386,6 +387,62 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
|
||||
return cd.ordinal();
|
||||
}
|
||||
/**
|
||||
* Generate redstone wire model data:
|
||||
* 0 = NSEW wire
|
||||
* 1 = NS wire
|
||||
* 2 = EW wire
|
||||
* 3 = NE wire
|
||||
* 4 = NW wire
|
||||
* 5 = SE wire
|
||||
* 6 = SW wire
|
||||
* 7 = NSE wire
|
||||
* 8 = NSW wire
|
||||
* 9 = NEW wire
|
||||
* 10 = SEW wire
|
||||
* @param mapiter
|
||||
* @return
|
||||
*/
|
||||
private int generateRedstoneWireBlockData(MapIterator mapiter) {
|
||||
/* Check adjacent block IDs */
|
||||
int ids[] = { mapiter.getBlockTypeIDAt(BlockStep.Z_PLUS), /* To west */
|
||||
mapiter.getBlockTypeIDAt(BlockStep.X_PLUS), /* To south */
|
||||
mapiter.getBlockTypeIDAt(BlockStep.Z_MINUS), /* To east */
|
||||
mapiter.getBlockTypeIDAt(BlockStep.X_MINUS) }; /* To north */
|
||||
int flags = 0;
|
||||
for(int i = 0; i < 4; i++)
|
||||
if(ids[i] == REDSTONE_BLKTYPEID) flags |= (1<<i);
|
||||
switch(flags) {
|
||||
case 0: /* Nothing nearby */
|
||||
case 15: /* NSEW */
|
||||
return 0; /* NSEW graphic */
|
||||
case 2: /* S */
|
||||
case 8: /* N */
|
||||
case 10: /* NS */
|
||||
return 1; /* NS graphic */
|
||||
case 1: /* W */
|
||||
case 4: /* E */
|
||||
case 5: /* EW */
|
||||
return 2; /* EW graphic */
|
||||
case 12: /* NE */
|
||||
return 3;
|
||||
case 9: /* NW */
|
||||
return 4;
|
||||
case 6: /* SE */
|
||||
return 5;
|
||||
case 3: /* SW */
|
||||
return 6;
|
||||
case 14: /* NSE */
|
||||
return 7;
|
||||
case 11: /* NSW */
|
||||
return 8;
|
||||
case 13: /* NEW */
|
||||
return 9;
|
||||
case 7: /* SEW */
|
||||
return 10;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
private final boolean handleSubModel(short[] model, HDShaderState[] shaderstate, boolean[] shaderdone) {
|
||||
boolean firststep = true;
|
||||
|
||||
@ -423,6 +480,9 @@ public class IsoHDPerspective implements HDPerspective {
|
||||
case CHEST_BLKTYPEID: /* Special case for chest - need to fake data so we can render */
|
||||
blockdata = generateChestBlockData(mapiter);
|
||||
break;
|
||||
case REDSTONE_BLKTYPEID: /* Special case for redstone - fake data for wire pattern */
|
||||
blockdata = generateRedstoneWireBlockData(mapiter);
|
||||
break;
|
||||
default:
|
||||
blockdata = mapiter.getBlockData();
|
||||
break;
|
||||
|
@ -71,6 +71,10 @@ public class TexturePack {
|
||||
|
||||
/* Special tile index values */
|
||||
private static final int BLOCKINDEX_BLANK = -1;
|
||||
private static final int BLOCKINDEX_REDSTONE_NSEW_TONE = 164;
|
||||
private static final int BLOCKINDEX_REDSTONE_EW_TONE = 165;
|
||||
private static final int BLOCKINDEX_REDSTONE_NSEW = 180;
|
||||
private static final int BLOCKINDEX_REDSTONE_EW = 181;
|
||||
private static final int BLOCKINDEX_STATIONARYWATER = 257;
|
||||
private static final int BLOCKINDEX_MOVINGWATER = 258;
|
||||
private static final int BLOCKINDEX_STATIONARYLAVA = 259;
|
||||
@ -344,7 +348,22 @@ public class TexturePack {
|
||||
/* Fallbacks */
|
||||
terrain_argb[BLOCKINDEX_STATIONARYLAVA] = terrain_argb[255];
|
||||
terrain_argb[BLOCKINDEX_MOVINGLAVA] = terrain_argb[255];
|
||||
|
||||
/* Now, build redstone textures with active wire color (since we're not messing with that) */
|
||||
Color tc = new Color();
|
||||
for(i = 0; i < native_scale*native_scale; i++) {
|
||||
if(terrain_argb[BLOCKINDEX_REDSTONE_NSEW_TONE][i] != 0) {
|
||||
/* Overlay NSEW redstone texture with toned wire color */
|
||||
tc.setARGB(terrain_argb[BLOCKINDEX_REDSTONE_NSEW_TONE][i]);
|
||||
tc.blendColor(0xFFC00000); /* Blend in red */
|
||||
terrain_argb[BLOCKINDEX_REDSTONE_NSEW][i] = tc.getARGB();
|
||||
}
|
||||
if(terrain_argb[BLOCKINDEX_REDSTONE_EW_TONE][i] != 0) {
|
||||
/* Overlay NSEW redstone texture with toned wire color */
|
||||
tc.setARGB(terrain_argb[BLOCKINDEX_REDSTONE_EW_TONE][i]);
|
||||
tc.blendColor(0xFFC00000); /* Blend in red */
|
||||
terrain_argb[BLOCKINDEX_REDSTONE_EW][i] = tc.getARGB();
|
||||
}
|
||||
}
|
||||
img.flush();
|
||||
}
|
||||
|
||||
|
@ -15,13 +15,59 @@ public class Json {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static void escape(String s, StringBuilder s2) {
|
||||
for(int i=0;i<s.length();i++){
|
||||
char ch=s.charAt(i);
|
||||
switch(ch){
|
||||
case '"':
|
||||
s2.append("\\\"");
|
||||
break;
|
||||
case '\\':
|
||||
s2.append("\\\\");
|
||||
break;
|
||||
case '\b':
|
||||
s2.append("\\b");
|
||||
break;
|
||||
case '\f':
|
||||
s2.append("\\f");
|
||||
break;
|
||||
case '\n':
|
||||
s2.append("\\n");
|
||||
break;
|
||||
case '\r':
|
||||
s2.append("\\r");
|
||||
break;
|
||||
case '\t':
|
||||
s2.append("\\t");
|
||||
break;
|
||||
case '/':
|
||||
s2.append("\\/");
|
||||
break;
|
||||
default:
|
||||
if((ch>='\u0000' && ch<='\u001F') || (ch>='\u007F')){
|
||||
String ss=Integer.toHexString(ch);
|
||||
s2.append("\\u");
|
||||
for(int k=0;k<4-ss.length();k++){
|
||||
s2.append('0');
|
||||
}
|
||||
s2.append(ss.toUpperCase());
|
||||
}
|
||||
else{
|
||||
s2.append(ch);
|
||||
}
|
||||
}
|
||||
}//for
|
||||
}
|
||||
|
||||
public static void appendJson(Object o, StringBuilder s) {
|
||||
if (o == null) {
|
||||
s.append("null");
|
||||
} else if (o instanceof Boolean) {
|
||||
s.append(((Boolean) o) ? "true" : "false");
|
||||
} else if (o instanceof String) {
|
||||
s.append("\"" + JSONObject.escape((String)o) + "\"");
|
||||
s.append("\"");
|
||||
escape((String)o, s);
|
||||
s.append("\"");
|
||||
} else if (o instanceof Integer || o instanceof Long || o instanceof Float || o instanceof Double) {
|
||||
s.append(o.toString());
|
||||
} else if (o instanceof Map<?, ?>) {
|
||||
|
@ -903,25 +903,103 @@ rotate:id=68,data=2,rot=270
|
||||
# Wall sign - facing south
|
||||
block:id=68,data=5,scale=4
|
||||
rotate:id=68,data=2,rot=90
|
||||
# Redstone wire
|
||||
block:id=55,data=*,scale=16
|
||||
layer:0
|
||||
-------**-------
|
||||
--------**------
|
||||
-------**-------
|
||||
------**--------
|
||||
-------**-------
|
||||
--------**------
|
||||
-*---*-**---*---
|
||||
***-******-***-*
|
||||
*-***-******-***
|
||||
---*---**-*---*-
|
||||
------**--------
|
||||
-------**-------
|
||||
--------**------
|
||||
-------**-------
|
||||
------**--------
|
||||
-------**-------
|
||||
# Redstone wire (NSEW)
|
||||
block:id=55,data=0,scale=16
|
||||
layer:0,1
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
****************
|
||||
****************
|
||||
****************
|
||||
****************
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
# Redstone wire (NS)
|
||||
block:id=55,data=1,scale=16
|
||||
layer:0,1
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
# Redstone wire (EW)
|
||||
block:id=55,data=2,scale=16
|
||||
rotate:id=55,data=1,rot=90
|
||||
# Redstone wire (NE)
|
||||
block:id=55,data=3,scale=16
|
||||
layer:0,1
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------**********
|
||||
------**********
|
||||
------**********
|
||||
------**********
|
||||
----------------
|
||||
----------------
|
||||
----------------
|
||||
----------------
|
||||
----------------
|
||||
----------------
|
||||
# Redstone wire (NW)
|
||||
block:id=55,data=4,scale=16
|
||||
rotate:id=55,data=3,rot=270
|
||||
# Redstone wire (SE)
|
||||
block:id=55,data=5,scale=16
|
||||
rotate:id=55,data=3,rot=90
|
||||
# Redstone wire (SW)
|
||||
block:id=55,data=6,scale=16
|
||||
rotate:id=55,data=3,rot=180
|
||||
# Redstone wire (NSE)
|
||||
block:id=55,data=7,scale=16
|
||||
layer:0,1
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------**********
|
||||
------**********
|
||||
------**********
|
||||
------**********
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
------****------
|
||||
# Redstone wire (NSW)
|
||||
block:id=55,data=8,scale=16
|
||||
rotate:id=55,data=7,rot=180
|
||||
# Redstone wire (NEW)
|
||||
block:id=55,data=9,scale=16
|
||||
rotate:id=55,data=7,rot=270
|
||||
# Redstone wire (SEW)
|
||||
block:id=55,data=10,scale=16
|
||||
rotate:id=55,data=7,rot=90
|
||||
# Signpost - facing west
|
||||
block:id=63,data=0,scale=16
|
||||
layer:0,1,2,3,4,5
|
||||
|
@ -255,8 +255,8 @@ block:id=54,data=9,topbottom=25,south=42,north=57,east=26,west=26
|
||||
block:id=54,data=10,topbottom=25,south=26,north=26,east=42,west=57
|
||||
# Chest - right side of double, facing north
|
||||
block:id=54,data=11,topbottom=25,south=57,north=42,east=26,west=26
|
||||
# Redstone wire (model handling shape - use red wool for color)
|
||||
block:id=55,allfaces=129,transparency=TRANSPARENT
|
||||
# Redstone wire (use processed tile - pretoned to active)
|
||||
block:id=55,allfaces=180,transparency=TRANSPARENT
|
||||
# Diamond ore
|
||||
block:id=56,allfaces=50
|
||||
# Diamond block
|
||||
|
@ -11,10 +11,6 @@
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.regioninfo .owners {
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.regioninfo .regionflags .regionflag {
|
||||
display: block;
|
||||
font-size: 90%;
|
||||
|
@ -26,7 +26,7 @@ componentconstructors['chatballoon'] = function(dynmap, configuration) {
|
||||
var popup = me.chatpopups[message.name];
|
||||
if (!popup) {
|
||||
me.chatpopups[message.name] = popup = {
|
||||
layer: new L.Popup({autopan: false, closeButton: false}),
|
||||
layer: new L.Popup({autoPan: configuration.focuschatballoons, closeButton: false}),
|
||||
content: $('<div/>').addClass('balloonmessages')[0]
|
||||
};
|
||||
popup.layer.setContent(popup.content);
|
||||
|
@ -319,6 +319,11 @@ DynMap.prototype = {
|
||||
me.world = mapWorld;
|
||||
me.maptype = map;
|
||||
|
||||
me.map.addLayer(me.maptype);
|
||||
if(me.maptype.options.maxZoom < prevzoom)
|
||||
prevzoom = me.maptype.options.maxZoom;
|
||||
me.map.options.maxZoom = me.maptype.options.maxZoom;
|
||||
me.map.options.minZoom = me.maptype.options.minZoom;
|
||||
|
||||
if (projectionChanged || worldChanged) {
|
||||
var centerPoint;
|
||||
@ -329,11 +334,11 @@ DynMap.prototype = {
|
||||
else {
|
||||
centerPoint = me.map.getCenter();
|
||||
}
|
||||
me.map.setView(centerPoint, 0, true);
|
||||
me.map.setView(centerPoint, prevzoom, true);
|
||||
}
|
||||
me.map.addLayer(me.maptype);
|
||||
|
||||
else {
|
||||
me.map.setZoom(prevzoom);
|
||||
}
|
||||
|
||||
if (worldChanged) {
|
||||
$(me).trigger('worldchanged');
|
||||
|
@ -69,16 +69,24 @@ componentconstructors['regions'] = function(dynmap, configuration) {
|
||||
}
|
||||
|
||||
function createPopupContent(name, region) {
|
||||
function join(a) {
|
||||
if (a instanceof Array) {
|
||||
return a.join(', ');
|
||||
} else if (typeof a === 'string') {
|
||||
return a;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var members = region.members || {};
|
||||
return $('<div/>').addClass('regioninfo')
|
||||
.append($('<span/>').addClass('regionname').text(name))
|
||||
.append($('<span/>').addClass('owners')
|
||||
.append(region.owners.players && $('<span/>').addClass('playerowners').text(region.owners.players.concat()))
|
||||
.append(region.owners.groups && $('<span/>').addClass('groupowners').text(region.owners.groups.concat()))
|
||||
.append(region.owners.players && $('<span/>').addClass('playerowners').text(join(region.owners.players)))
|
||||
.append(region.owners.groups && $('<span/>').addClass('groupowners').text(join(region.owners.groups)))
|
||||
)
|
||||
.append($('<span/>').addClass('members')
|
||||
.append(members.players && $('<span/>').addClass('playermembers').text(members.players.concat()))
|
||||
.append(members.groups && $('<span/>').addClass('groupmembers').text(members.groups.concat()))
|
||||
.append(members.players && $('<span/>').addClass('playermembers').text(join(members.players)))
|
||||
.append(members.groups && $('<span/>').addClass('groupmembers').text(join(members.groups)))
|
||||
)
|
||||
.append(region.parent && $('<span/>').addClass('regionparent').text(region.parent))
|
||||
.append(region.flags && function() {
|
||||
|
@ -18,6 +18,16 @@ regionConstructors['Residence'] = function(dynmap, configuration) {
|
||||
|
||||
boxLayers.push(boxLayer);
|
||||
});
|
||||
$.each(residence.Subzones, function(szname, subzone) {
|
||||
$.each(subzone.Areas, function(name2, area2) {
|
||||
var subzoneLayer = configuration.createBoxLayer(area2.X1, area2.X2, area2.Y1, area2.Y2, area2.Z1, area2.Z2);
|
||||
subzoneLayer.bindPopup(configuration.createPopupContent(name2, $.extend(subzone, {
|
||||
owners: { players: [subzone.Permissions.Owner] },
|
||||
flags: subzone.Permissions.AreaFlags
|
||||
})));
|
||||
boxLayers.push(subzoneLayer);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
configuration.result(new L.LayerGroup(boxLayers));
|
||||
|
Loading…
Reference in New Issue
Block a user