Add 'fence-to-block-join' flag to enable 1.9+ fence rendering behavior

This commit is contained in:
Mike Primm 2011-10-01 07:49:28 +08:00 committed by mikeprimm
parent 842d255c07
commit bd182ef9df
3 changed files with 20 additions and 5 deletions

View file

@ -84,6 +84,8 @@ public class DynmapPlugin extends JavaPlugin {
public Events events = new Events();
public String deftemplatesuffix = "";
boolean swampshading = false;
boolean fencejoin = false;
/* Flag to let code know that we're doing reload - make sure we don't double-register event handlers */
public boolean is_reload = false;
private boolean generate_only = false;
@ -251,6 +253,8 @@ public class DynmapPlugin extends JavaPlugin {
deftemplatesuffix = configuration.getString("deftemplatesuffix", "");
/* Default swamp shading off for 1.8, on after */
swampshading = configuration.getBoolean("swampshaded", !getServer().getVersion().contains("(MC: 1.8"));
/* Default fence-to-block-join off for 1.8, on after */
fencejoin = configuration.getBoolean("fence-to-block-join", !getServer().getVersion().contains("(MC: 1.8"));
loadDebuggers();

View file

@ -1144,7 +1144,11 @@ public class MapManager {
public boolean getSwampShading() {
return plug_in.swampshading;
}
public boolean getFenceJoin() {
return plug_in.fencejoin;
}
public boolean getHideOres() {
return hideores;
}

View file

@ -45,6 +45,7 @@ public class IsoHDPerspective implements HDPerspective {
public double scale; /* Scale - tile pixel widths per block */
public double maxheight;
public double minheight;
private boolean fencejoin;
/* Coordinate space for tiles consists of a plane (X, Y), corresponding to the projection of each tile on to the
* plane of the bottom of the world (X positive to the right, Y positive to the top), with Z+ corresponding to the
* height above this plane on a vector towards the viewer). Logically, this makes the parallelogram representing the
@ -345,22 +346,26 @@ public class IsoHDPerspective implements HDPerspective {
int id;
/* Check north */
id = mapiter.getBlockTypeIDAt(BlockStep.X_MINUS);
if((id == blkid) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */
if((id == blkid) || (id == FENCEGATE_BLKTYPEID) ||
(fencejoin && (id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { /* Fence? */
blockdata |= 1;
}
/* Look east */
id = mapiter.getBlockTypeIDAt(BlockStep.Z_MINUS);
if((id == blkid) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */
if((id == blkid) || (id == FENCEGATE_BLKTYPEID) ||
(fencejoin && (id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { /* Fence? */
blockdata |= 2;
}
/* Look south */
id = mapiter.getBlockTypeIDAt(BlockStep.X_PLUS);
if((id == blkid) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */
if((id == blkid) || (id == FENCEGATE_BLKTYPEID) ||
(fencejoin && (id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { /* Fence? */
blockdata |= 4;
}
/* Look west */
id = mapiter.getBlockTypeIDAt(BlockStep.Z_PLUS);
if((id == blkid) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */
if((id == blkid) || (id == FENCEGATE_BLKTYPEID) ||
(fencejoin && (id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { /* Fence? */
blockdata |= 8;
}
return blockdata;
@ -739,6 +744,8 @@ public class IsoHDPerspective implements HDPerspective {
if(maxheight > 127) maxheight = 127;
minheight = configuration.getInteger("minimumheight", 0);
if(minheight < 0) minheight = 0;
/* Fence-to-block-join setting */
fencejoin = configuration.getBoolean("fence-to-block-join", MapManager.mapman.getFenceJoin());
/* Generate transform matrix for world-to-tile coordinate mapping */
/* First, need to fix basic coordinate mismatches before rotation - we want zero azimuth to have north to top