mirror of https://github.com/webbukkit/dynmap.git
Handle waterlogged block states
This commit is contained in:
parent
2a23ec10e9
commit
4d1602c418
|
@ -79,6 +79,8 @@ public class IsoHDPerspective implements HDPerspective {
|
|||
|
||||
private static final BlockStep [] semi_steps = { BlockStep.Y_PLUS, BlockStep.X_MINUS, BlockStep.X_PLUS, BlockStep.Z_MINUS, BlockStep.Z_PLUS };
|
||||
|
||||
private DynmapBlockState full_water = null;
|
||||
|
||||
private class OurPerspectiveState implements HDPerspectiveState {
|
||||
DynmapBlockState blocktype = DynmapBlockState.AIR;
|
||||
DynmapBlockState lastblocktype = DynmapBlockState.AIR;
|
||||
|
@ -518,6 +520,28 @@ public class IsoHDPerspective implements HDPerspective {
|
|||
}
|
||||
}
|
||||
else if(nonairhit || blocktype.isNotAir()) {
|
||||
// If waterlogged, start by rendering as if full water block
|
||||
if (blocktype.isWaterlogged()) {
|
||||
DynmapBlockState saved_type = blocktype;
|
||||
if (full_water == null) {
|
||||
full_water = DynmapBlockState.getBaseStateByName(DynmapBlockState.WATER_BLOCK);
|
||||
}
|
||||
blocktype = full_water; // Switch to water state
|
||||
boolean done = true;
|
||||
subalpha = -1;
|
||||
for (int i = 0; i < shaderstate.length; i++) {
|
||||
if(!shaderdone[i]) {
|
||||
shaderdone[i] = shaderstate[i].processBlock(this);
|
||||
}
|
||||
done = done && shaderdone[i];
|
||||
}
|
||||
// Restore block type
|
||||
blocktype = saved_type;
|
||||
/* If all are done, we're out */
|
||||
if (done)
|
||||
return true;
|
||||
nonairhit = true;
|
||||
}
|
||||
RenderPatch[] patches = scalemodels.getPatchModel(blocktype);
|
||||
/* If no patches, see if custom model */
|
||||
if(patches == null) {
|
||||
|
|
|
@ -134,7 +134,8 @@ texture:id=bedrock
|
|||
#texture:id=water_still,material=WATER
|
||||
#TODO: fix when I figure out 1.13 biome shading logic
|
||||
texturefile:id=water_still,filename=assets/minecraft/textures/blocks/water_still.png,xcount=1,ycount=1
|
||||
texture:id=water_flow,material=WATER
|
||||
#texture:id=water_flow,material=WATER
|
||||
texturefile:id=water_flow,filename=assets/minecraft/textures/blocks/water_flow.png,xcount=1,ycount=1
|
||||
texture:id=lava_still
|
||||
texture:id=lava_flow
|
||||
texture:id=sand
|
||||
|
@ -2025,6 +2026,7 @@ texture:id=brain_coral_fan
|
|||
texture:id=bubble_coral_fan
|
||||
texture:id=fire_coral_fan
|
||||
texture:id=horn_coral_fan
|
||||
texture:id=blue_ice
|
||||
|
||||
# Kelp
|
||||
block:id=kelp,patch0-1=1000:kelp,stdrot=true,transparency=TRANSPARENT
|
||||
|
@ -2136,7 +2138,10 @@ block:id=horn_coral_fan,patch0-3=0:horn_coral_fan,stdrot=true,transparency=TRANS
|
|||
#[18:55:16] [Server thread/INFO]: [dynmap] 8569: blk=minecraft:sea_pickle, idx=5, state=pickles=3,waterlogged=false
|
||||
#[18:55:16] [Server thread/INFO]: [dynmap] 8570: blk=minecraft:sea_pickle, idx=6, state=pickles=4,waterlogged=true
|
||||
#[18:55:16] [Server thread/INFO]: [dynmap] 8571: blk=minecraft:sea_pickle, idx=7, state=pickles=4,waterlogged=false
|
||||
#[18:55:16] [Server thread/INFO]: [dynmap] 8572: blk=minecraft:blue_ice, idx=0, state=
|
||||
|
||||
# Blue Ice
|
||||
block:id=bloe_ice,allfaces=0:blue_ice,stdrot=true
|
||||
|
||||
#[18:55:16] [Server thread/INFO]: [dynmap] 8573: blk=minecraft:conduit, idx=0, state=
|
||||
#[18:55:16] [Server thread/INFO]: [dynmap] 8574: blk=minecraft:void_air, idx=0, state=
|
||||
#[18:55:16] [Server thread/INFO]: [dynmap] 8575: blk=minecraft:cave_air, idx=0, state=
|
||||
|
|
|
@ -33,6 +33,7 @@ public class DynmapBlockState {
|
|||
private static int MATCH_SNOW = 1 << 2;
|
||||
private static int MATCH_LOG = 1 << 3;
|
||||
private static int MATCH_GRASS = 1 << 4;
|
||||
private static int MATCH_WATERLOGGED = 1 << 5;
|
||||
|
||||
// Map of base blocks by name
|
||||
private static HashMap<String, DynmapBlockState> blocksByName = new HashMap<String, DynmapBlockState>();
|
||||
|
@ -84,7 +85,7 @@ public class DynmapBlockState {
|
|||
public DynmapBlockState(DynmapBlockState base, int stateidx, String blkname, String statename) {
|
||||
globalStateIndex = (nextGlobalStateIndex++); // Assign index
|
||||
if (base == null) base = this;
|
||||
baseState = this;
|
||||
baseState = base;
|
||||
stateIndex = stateidx;
|
||||
if (blkname.indexOf(':') == -1) { // No mod:, assume minecraft:
|
||||
blkname = "minecraft:" + blkname;
|
||||
|
@ -123,6 +124,7 @@ public class DynmapBlockState {
|
|||
matchflags |= isWater(blockName) ? MATCH_WATER : 0;
|
||||
matchflags |= (blockName.equals(SNOW_BLOCK) || blockName.equals(SNOW_LAYER_BLOCK)) ? MATCH_SNOW : 0;
|
||||
matchflags |= blockName.equals(GRASS_BLOCK) ? MATCH_GRASS : 0;
|
||||
matchflags |= stateName.contains("waterlogged=true") ? MATCH_WATERLOGGED : 0;
|
||||
}
|
||||
/**
|
||||
* Get state for same base block with given index
|
||||
|
@ -273,6 +275,12 @@ public class DynmapBlockState {
|
|||
public final boolean isGrass() {
|
||||
return (matchflags & MATCH_GRASS) != 0;
|
||||
}
|
||||
/**
|
||||
* Test if block is waterlogged (in block filled with water)
|
||||
*/
|
||||
public final boolean isWaterlogged() {
|
||||
return (matchflags & MATCH_WATERLOGGED) != 0;
|
||||
}
|
||||
/**
|
||||
* Test for matching blockname
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue