mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-01 06:33:38 +01:00
Add single chest orientation calculation
This commit is contained in:
parent
1c6ececd62
commit
4be9ccb1b2
@ -81,6 +81,14 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
SINGLE_WEST, SINGLE_SOUTH, SINGLE_EAST, SINGLE_NORTH, LEFT_WEST, LEFT_SOUTH, LEFT_EAST, LEFT_NORTH, RIGHT_WEST, RIGHT_SOUTH, RIGHT_EAST, RIGHT_NORTH
|
SINGLE_WEST, SINGLE_SOUTH, SINGLE_EAST, SINGLE_NORTH, LEFT_WEST, LEFT_SOUTH, LEFT_EAST, LEFT_NORTH, RIGHT_WEST, RIGHT_SOUTH, RIGHT_EAST, RIGHT_NORTH
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* Orientation lookup for single chest - index bits: occupied blocks NESW */
|
||||||
|
private static final ChestData[] SINGLE_LOOKUP = {
|
||||||
|
ChestData.SINGLE_WEST, ChestData.SINGLE_EAST, ChestData.SINGLE_NORTH, ChestData.SINGLE_NORTH,
|
||||||
|
ChestData.SINGLE_WEST, ChestData.SINGLE_WEST, ChestData.SINGLE_NORTH, ChestData.SINGLE_NORTH,
|
||||||
|
ChestData.SINGLE_SOUTH, ChestData.SINGLE_SOUTH, ChestData.SINGLE_WEST, ChestData.SINGLE_EAST,
|
||||||
|
ChestData.SINGLE_SOUTH, ChestData.SINGLE_SOUTH, ChestData.SINGLE_WEST, ChestData.SINGLE_EAST
|
||||||
|
};
|
||||||
|
|
||||||
private class OurPerspectiveState implements HDPerspectiveState {
|
private class OurPerspectiveState implements HDPerspectiveState {
|
||||||
int blocktypeid = 0;
|
int blocktypeid = 0;
|
||||||
int blockdata = 0;
|
int blockdata = 0;
|
||||||
@ -289,19 +297,19 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
private int generateFenceBlockData(MapIterator mapiter) {
|
private int generateFenceBlockData(MapIterator mapiter) {
|
||||||
int blockdata = 0;
|
int blockdata = 0;
|
||||||
/* Check north */
|
/* Check north */
|
||||||
if(mapiter.getBlockTypeIDAt(BlockStep.X_MINUS) == 85) { /* Fence? */
|
if(mapiter.getBlockTypeIDAt(BlockStep.X_MINUS) == FENCE_BLKTYPEID) { /* Fence? */
|
||||||
blockdata |= 1;
|
blockdata |= 1;
|
||||||
}
|
}
|
||||||
/* Look east */
|
/* Look east */
|
||||||
if(mapiter.getBlockTypeIDAt(BlockStep.Z_MINUS) == 85) { /* Fence? */
|
if(mapiter.getBlockTypeIDAt(BlockStep.Z_MINUS) == FENCE_BLKTYPEID) { /* Fence? */
|
||||||
blockdata |= 2;
|
blockdata |= 2;
|
||||||
}
|
}
|
||||||
/* Look south */
|
/* Look south */
|
||||||
if(mapiter.getBlockTypeIDAt(BlockStep.X_PLUS) == 85) { /* Fence? */
|
if(mapiter.getBlockTypeIDAt(BlockStep.X_PLUS) == FENCE_BLKTYPEID) { /* Fence? */
|
||||||
blockdata |= 4;
|
blockdata |= 4;
|
||||||
}
|
}
|
||||||
/* Look west */
|
/* Look west */
|
||||||
if(mapiter.getBlockTypeIDAt(BlockStep.Z_PLUS) == 85) { /* Fence? */
|
if(mapiter.getBlockTypeIDAt(BlockStep.Z_PLUS) == FENCE_BLKTYPEID) { /* Fence? */
|
||||||
blockdata |= 8;
|
blockdata |= 8;
|
||||||
}
|
}
|
||||||
return blockdata;
|
return blockdata;
|
||||||
@ -343,6 +351,15 @@ public class IsoHDPerspective implements HDPerspective {
|
|||||||
else if(ids[3] == CHEST_BLKTYPEID) { /* Another to north - assume west facing */
|
else if(ids[3] == CHEST_BLKTYPEID) { /* Another to north - assume west facing */
|
||||||
cd = ChestData.RIGHT_WEST; /* We're right side */
|
cd = ChestData.RIGHT_WEST; /* We're right side */
|
||||||
}
|
}
|
||||||
|
else { /* Else, single - build index into lookup table */
|
||||||
|
int idx = 0;
|
||||||
|
for(int i = 0; i < ids.length; i++) {
|
||||||
|
if((ids[i] != 0) && (HDTextureMap.getTransparency(ids[i]) != BlockTransparency.TRANSPARENT)) {
|
||||||
|
idx |= (1<<i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cd = SINGLE_LOOKUP[idx];
|
||||||
|
}
|
||||||
|
|
||||||
return cd.ordinal();
|
return cd.ordinal();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user