Handle waterlogged block states

This commit is contained in:
Mike Primm 2018-08-19 23:09:55 -04:00
parent 2a23ec10e9
commit 4d1602c418
3 changed files with 40 additions and 3 deletions

View file

@ -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) {

View file

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