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