mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-28 19:47:45 +01:00
Added support of round visibility limits
This commit is contained in:
parent
c8b1f71949
commit
6a5eebcc00
@ -91,6 +91,7 @@ import org.dynmap.common.DynmapListenerManager.EventType;
|
||||
import org.dynmap.hdmap.HDMap;
|
||||
import org.dynmap.markers.MarkerAPI;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.VisibilityLimit;
|
||||
|
||||
public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
private DynmapCore core;
|
||||
@ -428,14 +429,14 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
|
||||
return null;
|
||||
}
|
||||
if(w.visibility_limits != null) {
|
||||
for(MapChunkCache.VisibilityLimit limit: w.visibility_limits) {
|
||||
for(VisibilityLimit limit: w.visibility_limits) {
|
||||
c.setVisibleRange(limit);
|
||||
}
|
||||
c.setHiddenFillStyle(w.hiddenchunkstyle);
|
||||
c.setAutoGenerateVisbileRanges(w.do_autogenerate);
|
||||
}
|
||||
if(w.hidden_limits != null) {
|
||||
for(MapChunkCache.VisibilityLimit limit: w.hidden_limits) {
|
||||
for(VisibilityLimit limit: w.hidden_limits) {
|
||||
c.setHiddenRange(limit);
|
||||
}
|
||||
c.setHiddenFillStyle(w.hiddenchunkstyle);
|
||||
|
@ -21,6 +21,7 @@ import org.dynmap.utils.DynIntHashMap;
|
||||
import org.dynmap.utils.MapChunkCache;
|
||||
import org.dynmap.utils.MapIterator;
|
||||
import org.dynmap.utils.BlockStep;
|
||||
import org.dynmap.utils.VisibilityLimit;
|
||||
import org.getspout.spoutapi.block.SpoutChunk;
|
||||
|
||||
/**
|
||||
@ -801,7 +802,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
if(visible_limits != null) {
|
||||
vis = false;
|
||||
for(VisibilityLimit limit : visible_limits) {
|
||||
if((chunk.x >= limit.x0) && (chunk.x <= limit.x1) && (chunk.z >= limit.z0) && (chunk.z <= limit.z1)) {
|
||||
if (limit.doIntersectChunk(chunk.x, chunk.z)) {
|
||||
vis = true;
|
||||
break;
|
||||
}
|
||||
@ -809,7 +810,7 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
}
|
||||
if(vis && (hidden_limits != null)) {
|
||||
for(VisibilityLimit limit : hidden_limits) {
|
||||
if((chunk.x >= limit.x0) && (chunk.x <= limit.x1) && (chunk.z >= limit.z0) && (chunk.z <= limit.z1)) {
|
||||
if (limit.doIntersectChunk(chunk.x, chunk.z)) {
|
||||
vis = false;
|
||||
break;
|
||||
}
|
||||
@ -1053,22 +1054,9 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
* Coordinates are block coordinates
|
||||
*/
|
||||
public void setVisibleRange(VisibilityLimit lim) {
|
||||
VisibilityLimit limit = new VisibilityLimit();
|
||||
if(lim.x0 > lim.x1) {
|
||||
limit.x0 = (lim.x1 >> 4); limit.x1 = ((lim.x0+15) >> 4);
|
||||
}
|
||||
else {
|
||||
limit.x0 = (lim.x0 >> 4); limit.x1 = ((lim.x1+15) >> 4);
|
||||
}
|
||||
if(lim.z0 > lim.z1) {
|
||||
limit.z0 = (lim.z1 >> 4); limit.z1 = ((lim.z0+15) >> 4);
|
||||
}
|
||||
else {
|
||||
limit.z0 = (lim.z0 >> 4); limit.z1 = ((lim.z1+15) >> 4);
|
||||
}
|
||||
if(visible_limits == null)
|
||||
visible_limits = new ArrayList<VisibilityLimit>();
|
||||
visible_limits.add(limit);
|
||||
visible_limits.add(lim);
|
||||
}
|
||||
/**
|
||||
* Add hidden area limit - can be called more than once
|
||||
@ -1076,22 +1064,9 @@ public class NewMapChunkCache implements MapChunkCache {
|
||||
* Coordinates are block coordinates
|
||||
*/
|
||||
public void setHiddenRange(VisibilityLimit lim) {
|
||||
VisibilityLimit limit = new VisibilityLimit();
|
||||
if(lim.x0 > lim.x1) {
|
||||
limit.x0 = (lim.x1 >> 4); limit.x1 = ((lim.x0+15) >> 4);
|
||||
}
|
||||
else {
|
||||
limit.x0 = (lim.x0 >> 4); limit.x1 = ((lim.x1+15) >> 4);
|
||||
}
|
||||
if(lim.z0 > lim.z1) {
|
||||
limit.z0 = (lim.z1 >> 4); limit.z1 = ((lim.z0+15) >> 4);
|
||||
}
|
||||
else {
|
||||
limit.z0 = (lim.z0 >> 4); limit.z1 = ((lim.z1+15) >> 4);
|
||||
}
|
||||
if(hidden_limits == null)
|
||||
hidden_limits = new ArrayList<VisibilityLimit>();
|
||||
hidden_limits.add(limit);
|
||||
hidden_limits.add(lim);
|
||||
}
|
||||
@Override
|
||||
public boolean setChunkDataTypes(boolean blockdata, boolean biome, boolean highestblocky, boolean rawbiome) {
|
||||
|
Loading…
Reference in New Issue
Block a user