Compare commits

..

5 Commits

Author SHA1 Message Date
Mike Primm bae2a48a83 Handle when Spout explodes during startup 2012-03-28 21:23:36 -05:00
Mike Primm 11b2123f14 Fix lighting problem with custom spout blocks 2012-03-28 21:04:12 -05:00
Mike Primm f93f37deea Handle 1.2.x world height in chunks with Spout plus custom blocks 2012-03-28 11:39:39 -05:00
Mike Primm cf5e2e00e6 Bump to 0.36.1 2012-03-27 23:21:54 -05:00
Mike Primm 121c1050ce Bump to 0.37 2012-03-25 23:21:36 -05:00
4 changed files with 24 additions and 7 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.dynmap</groupId>
<artifactId>dynmap</artifactId>
<version>0.36</version>
<version>0.36.1</version>
<name>dynmap</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -73,6 +73,7 @@ import org.dynmap.common.DynmapPlayer;
import org.dynmap.common.DynmapServerInterface;
import org.dynmap.common.DynmapListenerManager.EventType;
import org.dynmap.markers.MarkerAPI;
import org.getspout.spoutapi.plugin.SpoutPlugin;
public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
private DynmapCore core;
@@ -1107,7 +1108,10 @@ public class DynmapPlugin extends JavaPlugin implements DynmapAPI {
private boolean detectSpout() {
Plugin p = this.getServer().getPluginManager().getPlugin("Spout");
return (p != null);
if(p != null) {
return p.isEnabled();
}
return false;
}
public boolean hasSpout() {
@@ -590,11 +590,22 @@ public class NewMapChunkCache implements MapChunkCache {
private static class SpoutChunkSnapshot implements ChunkSnapshot {
private ChunkSnapshot chunk;
private short[] customids; /* (X << 11) | (Z << 7) | Y */
private short[] customids;
private final int shiftx;
private final int shiftz;
SpoutChunkSnapshot(ChunkSnapshot chunk, short[] customids) {
SpoutChunkSnapshot(ChunkSnapshot chunk, short[] customids, int height) {
this.chunk = chunk;
this.customids = customids.clone();
int sx = 11;
int sz = 7; /* 128 high values */
while(height > 128) {
sx++;
sz++;
height = (height >> 1);
}
shiftx = sx;
shiftz = sz;
}
/* Need these for interface, but not used */
public final int getX() { return chunk.getX(); }
@@ -606,7 +617,7 @@ public class NewMapChunkCache implements MapChunkCache {
public final long getCaptureFullTime() { return chunk.getCaptureFullTime(); }
public final int getBlockTypeId(int x, int y, int z) {
int id = customids[(x << 11) | (z << 7) | y];
int id = customids[(x << shiftx) | (z << shiftz) | y];
if(id != 0) return id;
return chunk.getBlockTypeId(x, y, z);
}
@@ -716,7 +727,7 @@ public class NewMapChunkCache implements MapChunkCache {
SpoutChunk sc = (SpoutChunk)c;
short[] custids = sc.getCustomBlockIds();
if(custids != null) {
return new SpoutChunkSnapshot(ss, custids);
return new SpoutChunkSnapshot(ss, custids, c.getWorld().getMaxHeight());
}
}
return ss;
@@ -14,6 +14,7 @@ import java.util.List;
import javax.imageio.ImageIO;
import org.bukkit.Material;
import org.dynmap.Log;
import org.getspout.spoutapi.block.design.BlockDesign;
import org.getspout.spoutapi.block.design.GenericBlockDesign;
@@ -73,6 +74,7 @@ public class SpoutPluginBlocks {
for(CustomBlock b : cb) {
BlockDesign bd = b.getBlockDesign();
String blkid = bd.getTexturePlugin() + "." + b.getName();
blkid = blkid.replace(' ', '_');
/* If not GenericCubiodBlockDesign, we don't handle it */
if((bd instanceof GenericCuboidBlockDesign) == false) {
Log.info("Block " + blkid + " not suppored - only cubiod blocks");
@@ -166,7 +168,7 @@ public class SpoutPluginBlocks {
blks.add(b);
sb.append("block:id=" + b.getCustomId() + ",data=*,bottom=" + txtidx[0] + ",west=" +txtidx[1] + ",south=" + txtidx[2] + ",east=" + txtidx[3] + ",north="+txtidx[4]+",top="+txtidx[5]);
if(b.isOpaque() == false)
if(b.getBlockId() == Material.GLASS.getId())
sb.append(",transparency=TRANSPARENT");
sb.append(",txtid=" + txfileid + "\n");
cnt++;