diff --git a/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java b/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java index 01971e88..3b477329 100644 --- a/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java +++ b/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java @@ -80,7 +80,9 @@ 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 static final int IRONFENCE_BLKTYPEID = 101; + private static final int GLASSPANE_BLKTYPEID = 102; + private static final int FENCEGATE_BLKTYPEID = 107; 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 }; @@ -326,20 +328,25 @@ public class IsoHDPerspective implements HDPerspective { } private int generateFenceBlockData(MapIterator mapiter) { int blockdata = 0; + int id; /* Check north */ - if(mapiter.getBlockTypeIDAt(BlockStep.X_MINUS) == FENCE_BLKTYPEID) { /* Fence? */ + id = mapiter.getBlockTypeIDAt(BlockStep.X_MINUS); + if((id == FENCE_BLKTYPEID) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */ blockdata |= 1; } /* Look east */ - if(mapiter.getBlockTypeIDAt(BlockStep.Z_MINUS) == FENCE_BLKTYPEID) { /* Fence? */ + id = mapiter.getBlockTypeIDAt(BlockStep.Z_MINUS); + if((id == FENCE_BLKTYPEID) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */ blockdata |= 2; } /* Look south */ - if(mapiter.getBlockTypeIDAt(BlockStep.X_PLUS) == FENCE_BLKTYPEID) { /* Fence? */ + id = mapiter.getBlockTypeIDAt(BlockStep.X_PLUS); + if((id == FENCE_BLKTYPEID) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */ blockdata |= 4; } /* Look west */ - if(mapiter.getBlockTypeIDAt(BlockStep.Z_PLUS) == FENCE_BLKTYPEID) { /* Fence? */ + id = mapiter.getBlockTypeIDAt(BlockStep.Z_PLUS); + if((id == FENCE_BLKTYPEID) || (id == FENCEGATE_BLKTYPEID)) { /* Fence? */ blockdata |= 8; } return blockdata; @@ -449,6 +456,42 @@ public class IsoHDPerspective implements HDPerspective { } return 0; } + /** + * Generate block render data for glass pane and iron fence. + * - bit 0 = X-minus axis + * - bit 1 = Z-minus axis + * - bit 2 = X-plus axis + * - bit 3 = Z-plus axis + * + * @param mapiter - iterator + * @param typeid - ID of our material (test is for adjacent material OR nontransparent) + * @return + */ + private int generateIronFenceGlassBlockData(MapIterator mapiter, int typeid) { + int blockdata = 0; + int id; + /* Check north */ + id = mapiter.getBlockTypeIDAt(BlockStep.X_MINUS); + if((id == typeid) || ((id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { + blockdata |= 1; + } + /* Look east */ + id = mapiter.getBlockTypeIDAt(BlockStep.Z_MINUS); + if((id == typeid) || ((id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { + blockdata |= 2; + } + /* Look south */ + id = mapiter.getBlockTypeIDAt(BlockStep.X_PLUS); + if((id == typeid) || ((id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { + blockdata |= 4; + } + /* Look west */ + id = mapiter.getBlockTypeIDAt(BlockStep.Z_PLUS); + if((id == typeid) || ((id > 0) && (HDTextureMap.getTransparency(id) == BlockTransparency.OPAQUE))) { + blockdata |= 8; + } + return blockdata; + } private final boolean handleSubModel(short[] model, HDShaderState[] shaderstate, boolean[] shaderdone) { boolean firststep = true; @@ -482,6 +525,7 @@ public class IsoHDPerspective implements HDPerspective { blockdata = mapiter.getBlockData(); switch(blocktypeid) { case FENCE_BLKTYPEID: /* Special case for fence - need to fake data so we can render properly */ + case FENCEGATE_BLKTYPEID: /* Special case for fence gate */ blockrenderdata = generateFenceBlockData(mapiter); break; case CHEST_BLKTYPEID: /* Special case for chest - need to fake data so we can render */ @@ -490,6 +534,10 @@ public class IsoHDPerspective implements HDPerspective { case REDSTONE_BLKTYPEID: /* Special case for redstone - fake data for wire pattern */ blockrenderdata = generateRedstoneWireBlockData(mapiter); break; + case IRONFENCE_BLKTYPEID: /* Special case for iron fence - fake data for adjacent block info */ + case GLASSPANE_BLKTYPEID: /* Special case for glass pane - fake data for adjacent block info */ + blockrenderdata = generateIronFenceGlassBlockData(mapiter, blocktypeid); + break; default: blockrenderdata = -1; break; diff --git a/src/main/java/org/dynmap/hdmap/TexturePack.java b/src/main/java/org/dynmap/hdmap/TexturePack.java index bec264d8..a452672c 100644 --- a/src/main/java/org/dynmap/hdmap/TexturePack.java +++ b/src/main/java/org/dynmap/hdmap/TexturePack.java @@ -74,6 +74,7 @@ public class TexturePack { private static final int BLOCKINDEX_BLANK = -1; private static final int BLOCKINDEX_GRASSMASK = 38; private static final int BLOCKINDEX_PISTONSIDE = 108; + private static final int BLOCKINDEX_GLASSPANETOP = 148; 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; @@ -84,7 +85,8 @@ public class TexturePack { private static final int BLOCKINDEX_MOVINGLAVA = 260; private static final int BLOCKINDEX_PISTONEXTSIDE = 261; private static final int BLOCKINDEX_PISTONSIDE_EXT = 262; - private static final int MAX_BLOCKINDEX = 262; + private static final int BLOCKINDEX_PANETOP_X = 263; + private static final int MAX_BLOCKINDEX = 263; private static final int BLOCKTABLELEN = MAX_BLOCKINDEX+1; private static class LoadedImage { @@ -433,6 +435,15 @@ public class TexturePack { terrain_argb[BLOCKINDEX_PISTONSIDE][native_scale*i + j]; } } + /* Build glass pane top in NSEW config (we use model to clip it) */ + terrain_argb[BLOCKINDEX_PANETOP_X] = new int[native_scale*native_scale]; + System.arraycopy(terrain_argb[BLOCKINDEX_GLASSPANETOP], 0, terrain_argb[BLOCKINDEX_PANETOP_X], 0, native_scale*native_scale); + for(i = native_scale*7/16; i < native_scale*9/16; i++) { + for(j = 0; j < native_scale; j++) { + terrain_argb[BLOCKINDEX_PANETOP_X][native_scale*i + j] = terrain_argb[BLOCKINDEX_PANETOP_X][native_scale*j + i]; + } + } + img.flush(); } diff --git a/src/main/resources/models.txt b/src/main/resources/models.txt index 82f6b4be..7bd6e103 100644 --- a/src/main/resources/models.txt +++ b/src/main/resources/models.txt @@ -1,6 +1,8 @@ # Wood Stair - up south # Cobblestone Stair - up south -block:id=53,id=67,data=0,scale=2 +# Brick Stair - up south +# Stone Brick Stair - up south +block:id=53,id=67,id=108,id=109,data=0,scale=2 layer:0 ** ** @@ -9,15 +11,21 @@ layer:1 ** # Wood Stair - up north # Cobblestone Stair - up north -block:id=53,id=67,data=1,scale=2 +# Brick Stair - up north +# Stone Brick Stair - up north +block:id=53,id=67,id=108,id=109,data=1,scale=2 rotate:id=53,data=0,rot=180 # Wood Stair - up west # Cobblestone Stair - up west -block:id=53,id=67,data=2,scale=2 +# Brick Stair - up west +# Stone Brick Stair - up west +block:id=53,id=67,id=108,id=109,data=2,scale=2 rotate:id=53,data=0,rot=90 # Wood Stair - up east # Cobblestone Stair - up east -block:id=53,id=67,data=3,scale=2 +# Brick Stair - up east +# Stone Brick Stair - up east +block:id=53,id=67,id=108,id=109,data=3,scale=2 rotate:id=53,data=0,rot=270 # Slab (stone, sandstone, wood, cobblestone) block:id=44,data=*,scale=4 @@ -1331,7 +1339,7 @@ layer:6,7 --*--*-- -------- -------- - Tall grass +# Tall grass block:id=31,data=1,scale=16 layer:0,1,2,3,4,5,6,7,8,9 *--------------* @@ -2082,3 +2090,269 @@ rotate:id=34,data=2,rot=270 # Piston extension - extended facing west block:id=34,data=5,data=13,scale=8 rotate:id=34,data=2,rot=90 +# Glass pane - no adjacent (0), all adjacent (15) +# Iron fence - no adjacent (0), all adjacent (15) +block:id=102,id=101,data=0,data=15,scale=16 +layer:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +**************** +**************** +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +# Glass pane - N adjacent (1) +# Iron fence - N adjacent (1) +block:id=102,id=101,data=1,scale=16 +layer:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +---------------- +---------------- +---------------- +---------------- +---------------- +---------------- +---------------- +---------------- +# Glass pane - E adjacent (2) +# Iron fence - E adjacent (2) +block:id=102,id=101,data=2,scale=16 +rotate:id=102,data=1,rot=90 +# Glass pane - S adjacent (4) +# Iron fence - S adjacent (4) +block:id=102,id=101,data=4,scale=16 +rotate:id=102,data=1,rot=180 +# Glass pane - W adjacent (8) +# Iron fence - W adjacent (8) +block:id=102,id=101,data=8,scale=16 +rotate:id=102,data=1,rot=270 +# Glass pane - NS adjacent (5) +# Iron fence - NS adjacent (5) +block:id=102,id=101,data=5,scale=16 +layer:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +# Glass pane - EW adjacent (10) +# Iron fence - EW adjacent (10) +block:id=102,id=101,data=10,scale=16 +rotate:id=102,data=5,rot=90 +# Glass pane - NSE adjacent (7) +# Iron fence - NSE adjacent (7) +block:id=102,id=101,data=7,scale=16 +layer:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------********* +-------********* +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +# Glass pane - ESW adjacent (14) +# Iron fence - ESW adjacent (14) +block:id=102,id=101,data=14,scale=16 +rotate:id=102,data=7,rot=90 +# Glass pane - SWN adjacent (13) +# Iron fence - SWN adjacent (13) +block:id=102,id=101,data=13,scale=16 +rotate:id=102,data=7,rot=180 +# Glass pane - WNE adjacent (11) +# Iron fence - WNE adjacent (11) +block:id=102,id=101,data=11,scale=16 +rotate:id=102,data=7,rot=270 +# Glass pane - SE adjacent (6) +# Iron fence - SE adjacent (6) +block:id=102,id=101,data=6,scale=16 +layer:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 +---------------- +---------------- +---------------- +---------------- +---------------- +---------------- +---------------- +-------********* +-------********* +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +# Glass pane - SW adjacent (12) +# Iron fence - SW adjacent (12) +block:id=102,id=101,data=12,scale=16 +rotate:id=102,data=6,rot=90 +# Glass pane - NW adjacent (9) +# Iron fence - NW adjacent (9) +block:id=102,id=101,data=9,scale=16 +rotate:id=102,data=6,rot=180 +# Glass pane - NE adjacent (3) +# Iron fence - NE adjacent (3) +block:id=102,id=101,data=3,scale=16 +rotate:id=102,data=6,rot=270 +# Web +block:id=30,data=*,scale=16 +layer:0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15 +*--------------* +-*------------*- +--*----------*-- +---*--------*--- +----*------*---- +-----*----*----- +------*--*------ +-------**------- +-------**------- +------*--*------ +-----*----*----- +----*------*---- +---*--------*--- +--*----------*-- +-*------------*- +*--------------* +# Vines - N side of block +block:id=106,data=2,scale=8 +layer:0,1,2,3,4,5,6,7 +******** +-------- +-------- +-------- +-------- +-------- +-------- +-------- +# Vines - E side of block +block:id=106,data=4,scale=8 +rotate:id=106,data=2,rot=90 +# Vines - S side of block +block:id=106,data=8,scale=8 +rotate:id=106,data=2,rot=180 +# Vines - W side of block +block:id=106,data=1,scale=8 +rotate:id=106,data=2,rot=270 +# Vines - N+E sides of block +block:id=106,data=6,scale=8 +layer:0,1,2,3,4,5,6,7 +******** +-------* +-------* +-------* +-------* +-------* +-------* +-------* +# Vines - E+S side of block +block:id=106,data=12,scale=8 +rotate:id=106,data=6,rot=90 +# Vines - S+W side of block +block:id=106,data=9,scale=8 +rotate:id=106,data=6,rot=180 +# Vines - W+N side of block +block:id=106,data=3,scale=8 +rotate:id=106,data=6,rot=270 +# Vines - N+S sides of block +block:id=106,data=10,scale=8 +layer:0,1,2,3,4,5,6,7 +******** +-------- +-------- +-------- +-------- +-------- +-------- +******** +# Vines - E+W side of block +block:id=106,data=5,scale=8 +rotate:id=106,data=10,rot=90 +# Vines - N+E+W sides of block +block:id=106,data=7,scale=8 +layer:0,1,2,3,4,5,6,7 +******** +*------* +*------* +*------* +*------* +*------* +*------* +*------* +# Vines - N+E+S side of block +block:id=106,data=14,scale=8 +rotate:id=106,data=7,rot=90 +# Vines - E+S+W side of block +block:id=106,data=13,scale=8 +rotate:id=106,data=7,rot=180 +# Vines - N+S+W side of block +block:id=106,data=11,scale=8 +rotate:id=106,data=7,rot=270 +# Vines - N+S+E+W sides of block +block:id=106,data=15,scale=8 +layer:0,1,2,3,4,5,6,7 +******** +*------* +*------* +*------* +*------* +*------* +*------* +******** +# Fence gate - north and south neighbor +block:id=107,data=5,scale=16 +layer:6,7,8,12,13,14 +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +---------------- +---------------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +-------**------- +# Fence gate - east and west neighbor +block:id=107,data=10,scale=16 +rotate:id=107,data=5,rot=90 diff --git a/src/main/resources/texture.txt b/src/main/resources/texture.txt index 1ba3366c..69ec5e10 100644 --- a/src/main/resources/texture.txt +++ b/src/main/resources/texture.txt @@ -1,7 +1,7 @@ # Mapping of texture resources to block ID and data values # block:id=,data=,top=,bottom=,north=,south=,east=,west=,allfaces=,allsides= # =0-255 (index of patch in terrain.png), -1=clear, 1xxx=biome tint from grasscolor.png,257=stationary water,258=moving water, -# 259=stationary lava,260=moving lava,261=extended piston side,262=piston side while extended,2xxx=biome tint from foliagecolor.png,4xxx=rotate texture 90, +# 259=stationary lava,260=moving lava,261=extended piston side,262=piston side while extended,263=glass pane top,2xxx=biome tint from foliagecolor.png,4xxx=rotate texture 90, # 5xxx=rotate texture 180, 6xxx=rotate texture 270, 7xxx=flip texture horizontally, 8xxx=shift down 1/2 block, 9=shift down 1/2,flip horiz, # 10xxx=inclined-torch,11xxx=grass-side,12xxx=clear if same block ###### @@ -251,6 +251,10 @@ block:id=43,data=1,top=176,bottom=208,allsides=192 block:id=43,data=2,allsides=4,topbottom=4004 # Double Slab - Cobblestone block:id=43,data=3,allfaces=16 +# Double Slab - Brick +block:id=43,data=4,allfaces=7 +# Double Slab - Stone Brick +block:id=43,data=5,allfaces=54 # Slab - stone block:id=44,data=0,allsides=5,topbottom=6,transparency=SEMITRANSPARENT # Slab - Sandstone @@ -259,6 +263,10 @@ block:id=44,data=1,top=176,bottom=208,allsides=192,transparency=SEMITRANSPARENT block:id=44,data=2,allsides=4,topbottom=4004,transparency=SEMITRANSPARENT # Slab - Cobblestone block:id=44,data=3,allfaces=16,transparency=SEMITRANSPARENT +# Slab - Brick +block:id=44,data=4,allfaces=7,transparency=SEMITRANSPARENT +# Slab - Stone Brick +block:id=44,data=5,allfaces=54,transparency=SEMITRANSPARENT # Brick Block block:id=45,allfaces=7 # TNT @@ -439,3 +447,31 @@ block:id=94,top=147,allsides=1,bottom=1,transparency=TRANSPARENT block:id=95,top=25,south=27,north=27,east=26,west=26 # Trap door block:id=96,topbottom=84,allsides=4,transparency=TRANSPARENT +# Stone w/ silverfish inside +block:id=97,allfaces=1 +# Stone Bricks +block:id=98,data=0,allfaces=54 +# Mossy Stone Bricks +block:id=98,data=1,allfaces=100 +# Cracked Stone Bricks +block:id=98,data=2,allfaces=101 +# Brown Mushroom Blocks +block:id=99,allfaces=126 +# Red Mushroom Blocks +block:id=100,allfaces=125 +# Iron bars +block:id=101,allsides=85,topbottom=22,transparency=TRANSPARENT +# Glass pane +block:id=102,allsides=12049,topbottom=12263,transparency=TRANSPARENT +# Watermellon +block:id=103,allsides=136,topbottom=137 +# Pumpkin stem (104) +# Melon stem (105) +# Vines +block:id=106,allsides=1143,transparency=TRANSPARENT +# Fence gate +block:id=107,allsides=4,topbottom=4004,transparency=TRANSPARENT +# Brick stair +block:id=108,allfaces=7 +# Stone brick stair +block:id=109,allfaces=54 diff --git a/texturepacks/standard/terrain.png b/texturepacks/standard/terrain.png index 244f7668..a19461b1 100644 Binary files a/texturepacks/standard/terrain.png and b/texturepacks/standard/terrain.png differ