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];
}
use of org.dynmap.renderer.DynmapBlockState in project dynmap by webbukkit.
the class CTMVertTextureRenderer method getRenderPatchList.
@Override
public RenderPatch[] getRenderPatchList(MapDataContext mapDataCtx) {
DynmapBlockState bs = mapDataCtx.getBlockType();
int meta = bs.stateIndex;
boolean above = false;
DynmapBlockState id_above = mapDataCtx.getBlockTypeAt(0, 1, 0);
if (id_above.baseState == blk) {
/* MIght match */
int id_meta = id_above.stateIndex;
if (meta == id_meta) {
above = true;
}
}
boolean below = false;
DynmapBlockState id_below = mapDataCtx.getBlockTypeAt(0, -1, 0);
if (id_below.baseState == blk) {
/* MIght match */
int id_meta = id_below.stateIndex;
if (meta == id_meta) {
below = true;
}
}
RenderPatch[] mesh;
if (above) {
if (below) {
mesh = this.mesh_both_neighbor;
} else {
mesh = this.mesh_above_neighbor;
}
} else {
if (below) {
mesh = this.mesh_below_neighbor;
} else {
mesh = this.mesh_no_neighbor;
}
}
return mesh;
}
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);
}
}
}
Aggregations