More 1.8 block support - gates, glass panes, iron fences, vines

This commit is contained in:
Mike Primm 2011-09-10 23:15:57 -05:00
parent 00f16304a4
commit d53ef57ae1
3 changed files with 329 additions and 11 deletions

View File

@ -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;

View File

@ -1339,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
*--------------*
@ -2090,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

View File

@ -450,19 +450,23 @@ block:id=96,topbottom=84,allsides=4,transparency=TRANSPARENT
# Stone w/ silverfish inside
block:id=97,allfaces=1
# Stone Bricks
block:id=98,allfaces=54
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,allfaces=85,transparency=TRANSPARENT
block:id=101,allsides=85,topbottom=22,transparency=TRANSPARENT
# Glass pane
block:id=102,allsides=49,topbottom=148,transparency=TRANSPARENT
block:id=102,allsides=12049,topbottom=12148,transparency=TRANSPARENT
# Watermellon
block:id=103,allsides=136,topbottom=137
# 104 (mossy stone bricks?)
# 105 (cracked stone bricks?)
# Pumpkin stem (104)
# Melon stem (105)
# Vines
block:id=106,allsides=1143,transparency=TRANSPARENT
# Fence gate