use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class ChestRenderer method getRenderPatchList.
@Override
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
DynmapBlockState blktype = ctx.getBlockType().baseState;
if (!double_chest) {
// Force mismatch - always single
blktype = DynmapBlockState.AIR;
}
int blkdata = blktype.stateIndex;
/* Get block data */
ChestData cd = ChestData.SINGLE_NORTH;
/* Default to single facing north */
switch(blkdata) {
/* First, use orientation data */
case 2:
/* North */
if (ctx.getBlockTypeAt(-1, 0, 0).baseState == blktype) {
cd = ChestData.LEFT_NORTH;
} else if (ctx.getBlockTypeAt(1, 0, 0).baseState == blktype) {
cd = ChestData.RIGHT_NORTH;
} else {
cd = ChestData.SINGLE_NORTH;
}
break;
case 4:
/* West */
if (ctx.getBlockTypeAt(0, 0, -1).baseState == blktype) {
cd = ChestData.RIGHT_WEST;
} else if (ctx.getBlockTypeAt(0, 0, 1).baseState == blktype) {
cd = ChestData.LEFT_WEST;
} else {
cd = ChestData.SINGLE_WEST;
}
break;
case 5:
/* East */
if (ctx.getBlockTypeAt(0, 0, -1).baseState == blktype) {
cd = ChestData.LEFT_EAST;
} else if (ctx.getBlockTypeAt(0, 0, 1).baseState == blktype) {
cd = ChestData.RIGHT_EAST;
} else {
cd = ChestData.SINGLE_EAST;
}
break;
case 3:
/* South */
default:
if (ctx.getBlockTypeAt(-1, 0, 0).baseState == blktype) {
cd = ChestData.RIGHT_SOUTH;
} else if (ctx.getBlockTypeAt(1, 0, 0).baseState == blktype) {
cd = ChestData.LEFT_SOUTH;
} else {
cd = ChestData.SINGLE_SOUTH;
}
break;
}
return models[cd.ordinal()];
}
use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class CopyStairBlockRenderer method getBaseRenderPatchList.
private RenderPatch[] getBaseRenderPatchList(MapDataContext ctx) {
int data = ctx.getBlockType().stateIndex & 0x07;
/* Get block data */
/* Check block behind stair */
DynmapBlockState corner = ctx.getBlockTypeAt(off_x[data], 0, off_z[data]);
if (stair_ids.get(corner.globalStateIndex)) {
/* If it is a stair */
int cornerdat = corner.stateIndex & 0x07;
if (cornerdat == match1[data]) {
/* If right orientation */
/* Make sure we don't have matching stair to side */
DynmapBlockState side = ctx.getBlockTypeAt(-off_x[cornerdat], 0, -off_z[cornerdat]);
if ((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
return step_1_4_meshes[corner1[data]];
}
} else if (cornerdat == match2[data]) {
/* If other orientation */
/* Make sure we don't have matching stair to side */
DynmapBlockState side = ctx.getBlockTypeAt(-off_x[cornerdat], 0, -off_z[cornerdat]);
if ((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
return step_1_4_meshes[corner2[data]];
}
}
}
/* Check block in front of stair */
corner = ctx.getBlockTypeAt(-off_x[data], 0, -off_z[data]);
if (stair_ids.get(corner.globalStateIndex)) {
/* If it is a stair */
int cornerdat = corner.stateIndex & 0x07;
if (cornerdat == match1[data]) {
/* If right orientation */
/* Make sure we don't have matching stair to side */
DynmapBlockState side = ctx.getBlockTypeAt(off_x[cornerdat], 0, off_z[cornerdat]);
if ((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
return step_3_4_meshes[icorner1[data]];
}
} else if (cornerdat == match2[data]) {
/* If other orientation */
/* Make sure we don't have matching stair to side */
DynmapBlockState side = ctx.getBlockTypeAt(off_x[cornerdat], 0, off_z[cornerdat]);
if ((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
return step_3_4_meshes[icorner2[data]];
}
}
}
return stepmeshes[data];
}
use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class RailCraftSlabBlockRenderer method setID.
private void setID(String bname) {
DynmapBlockState bss = DynmapBlockState.getBaseStateByName(bname);
if (bss.isNotAir()) {
for (int i = 0; i < bss.getStateCount(); i++) {
DynmapBlockState bs = bss.getState(i);
stair_ids.set(bs.globalStateIndex);
}
}
}
use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class StairBlockRenderer method getBaseRenderPatchList.
private RenderPatch[] getBaseRenderPatchList(MapDataContext ctx) {
int data = ctx.getBlockType().stateIndex & 0x07;
/* Get block data */
/* Check block behind stair */
DynmapBlockState corner = ctx.getBlockTypeAt(off_x[data], 0, off_z[data]);
if (stair_ids.get(corner.globalStateIndex)) {
/* If it is a stair */
int cornerdat = corner.stateIndex & 0x07;
if (cornerdat == match1[data]) {
/* If right orientation */
/* Make sure we don't have matching stair to side */
DynmapBlockState side = ctx.getBlockTypeAt(-off_x[cornerdat], 0, -off_z[cornerdat]);
if ((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
return step_1_4_meshes[corner1[data]];
}
} else if (cornerdat == match2[data]) {
/* If other orientation */
/* Make sure we don't have matching stair to side */
DynmapBlockState side = ctx.getBlockTypeAt(-off_x[cornerdat], 0, -off_z[cornerdat]);
if ((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
return step_1_4_meshes[corner2[data]];
}
}
}
/* Check block in front of stair */
corner = ctx.getBlockTypeAt(-off_x[data], 0, -off_z[data]);
if (stair_ids.get(corner.globalStateIndex)) {
/* If it is a stair */
int cornerdat = corner.stateIndex & 0x07;
if (cornerdat == match1[data]) {
/* If right orientation */
/* Make sure we don't have matching stair to side */
DynmapBlockState side = ctx.getBlockTypeAt(off_x[cornerdat], 0, off_z[cornerdat]);
if ((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
return step_3_4_meshes[icorner1[data]];
}
} else if (cornerdat == match2[data]) {
/* If other orientation */
/* Make sure we don't have matching stair to side */
DynmapBlockState side = ctx.getBlockTypeAt(off_x[cornerdat], 0, off_z[cornerdat]);
if ((!stair_ids.get(side.globalStateIndex)) || ((side.stateIndex & 0x07) != data)) {
return step_3_4_meshes[icorner2[data]];
}
}
}
return stepmeshes[data];
}
use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class PaneRenderer method getRenderPatchList.
@Override
public RenderPatch[] getRenderPatchList(MapDataContext ctx) {
/* Build connection map - check each axis */
int blockdata = 0;
DynmapBlockState t;
DynmapBlockState type = ctx.getBlockType();
/* Check north */
t = ctx.getBlockTypeAt(-1, 0, 0);
if ((t == type) || t.is(DynmapBlockState.GLASS_BLOCK) || (HDBlockStateTextureMap.getTransparency(t) == BlockTransparency.OPAQUE)) {
blockdata |= SIDE_XN;
}
/* Look east */
t = ctx.getBlockTypeAt(0, 0, -1);
if ((t == type) || t.is(DynmapBlockState.GLASS_BLOCK) || (HDBlockStateTextureMap.getTransparency(t) == BlockTransparency.OPAQUE)) {
blockdata |= SIDE_ZN;
}
/* Look south */
t = ctx.getBlockTypeAt(1, 0, 0);
if ((t == type) || t.is(DynmapBlockState.GLASS_BLOCK) || (HDBlockStateTextureMap.getTransparency(t) == BlockTransparency.OPAQUE)) {
blockdata |= SIDE_XP;
}
/* Look west */
t = ctx.getBlockTypeAt(0, 0, 1);
if ((t == type) || t.is(DynmapBlockState.GLASS_BLOCK) || (HDBlockStateTextureMap.getTransparency(t) == BlockTransparency.OPAQUE)) {
blockdata |= SIDE_ZP;
}
return meshes[blockdata];
}
Aggregations