New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix inconsistency between vanilla and modded glass. Closes #4679 #4680
Conversation
Looks like a good, simple fix. |
do forge fluids handle this properly? they use |
I just checked and Forge fluids don't handle any kind of glass, the sides are always flowing. I think that can be considered a different issue though, the Forge fluids probably still have a few rendering inconsistencies vs vanilla. |
I think this will make water render incorrectly against glass panes. |
I don't think glass isSolid? |
@mezz The way it is now, water against glass panes renders water_overlay, which differs from vanilla behaviour, normally it would render water_overlay for glass blocks and water_flow for everything else (including glass panes). |
@mezz It does cause some issues with glass panes. :\ |
Water blocks against glass panes now render correctly. |
I think it's important to look at the reasoning behind why glass works this way, and look at the block's properties instead of using anything like |
Something like this |
It would also need to check the bottom otherwise slabs would not work properly. |
Improved over the example above. Now checks the block faces that are against the water block to see if they're solid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just need to fix the patches so there are no import changes.
-import net.minecraft.block.Block; | ||
import net.minecraft.block.BlockLiquid; | ||
import net.minecraft.block.material.Material; | ||
+import net.minecraft.block.state.BlockFaceShape; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Patches to Minecraft code should not change the imports.
Instead of importing, use the fully qualifies name where you need it, like net.minecraft.block.state.BlockFaceShape.SOLID
+ IBlockState state = p_178270_1_.func_180495_p(blockpos); | ||
|
||
- if (block == Blocks.field_150359_w || block == Blocks.field_150399_cn) | ||
+ if (state.func_193401_d(p_178270_1_, blockpos, EnumFacing.field_82609_l[i1+2].func_176734_d()) == net.minecraft.block.state.BlockFaceShape.SOLID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think EnumFacing.VALUES[i1+2]
should be EnumFacing.getHorizontal(i1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That doesn't work because VALUES
and HORIZONTALS
are ordered differently. (getHorizontal()
just returns the values from HORIZONTALS
)
VALUES[2] -> NORTH
VALUES[3] -> SOUTH
VALUES[4] -> WEST
VALUES[5] -> EAST
HORIZONTALS[0] -> SOUTH
HORIZONTALS[1] -> WEST
HORIZONTALS[2] -> NORTH
HORIZONTALS[3] -> EAST
BlockFluidRenderer::renderFluid
checks the adjacent blocks in the same order as VALUES
, so if I used EnumFacing.getHorizontal(i1)
it would check the wrong side of the block, it wouldn't check the side that's against water.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably would make sense to make HORIZONTALS
follow the same order as VALUES
. Then it would be possible to use getHorizontal(i1)
instead of VALUES[i1+2]
. Although it would break something that depends on it being in the current order. :\
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yuck, ok. Nothing we can do about that, yeah.
Can you make a final screenshot to show this off? |
I think just one check for |
Reset to previous commit, I don't know if that's the best way to do it, but I thought it would make more sense than leaving it in and having another undoing it. Anyway, now it only checks |
Fixes #4679.
Changed
BlockFluidRenderer::renderFluid
to check the material instead of the block itself, so all blocks with Material.GLASS should now work fine.