From c6fdadf78b8718154cb6ae53726f3c334469cd9e Mon Sep 17 00:00:00 2001 From: Alexander01998 Date: Tue, 12 Dec 2023 14:55:26 +0100 Subject: [PATCH] Fix transparency bug with glass stairs --- .../wurstclient/glass/GlassStairsBlock.java | 27 ++++++++++++++++--- .../glass/StainedGlassStairsBlock.java | 27 ++++++++++++++++--- .../glass/TintedGlassStairsBlock.java | 27 ++++++++++++++++--- .../glass/mixin/GlassBlockMixin.java | 14 +++++++++- .../glass/mixin/StainedGlassBlockMixin.java | 14 +++++++++- .../glass/mixin/TintedGlassBlockMixin.java | 14 +++++++++- 6 files changed, 111 insertions(+), 12 deletions(-) diff --git a/src/main/java/net/wurstclient/glass/GlassStairsBlock.java b/src/main/java/net/wurstclient/glass/GlassStairsBlock.java index 1ff4405..a00de0f 100644 --- a/src/main/java/net/wurstclient/glass/GlassStairsBlock.java +++ b/src/main/java/net/wurstclient/glass/GlassStairsBlock.java @@ -228,18 +228,29 @@ private boolean isInvisibleToGlassStairs(BlockState state, } // other stairs rear - if(facingFrom == direction.getOpposite()) + if(facingFrom == direction.getOpposite() + && shapeFrom != StairShape.OUTER_LEFT + && shapeFrom != StairShape.OUTER_RIGHT) + return true; + + // other curved stairs fully covered side + if(facingFrom == direction.rotateYClockwise() + && shapeFrom == StairShape.INNER_RIGHT) + return true; + if(facingFrom == direction.rotateYCounterclockwise() + && shapeFrom == StairShape.INNER_LEFT) return true; // rear - if(direction == facing && half == halfFrom - && shape != StairShape.STRAIGHT) + if(direction == facing && half == halfFrom) { if(facingFrom == facing.rotateYCounterclockwise() + && shape == StairShape.OUTER_LEFT && shapeFrom != StairShape.OUTER_RIGHT) return true; if(facingFrom == facing.rotateYClockwise() + && shape == StairShape.OUTER_RIGHT && shapeFrom != StairShape.OUTER_LEFT) return true; } @@ -269,6 +280,11 @@ private boolean isInvisibleToGlassStairs(BlockState state, if(facingFrom == facing && shapeFrom != StairShape.OUTER_LEFT) return true; + if(facingFrom == facing.rotateYClockwise() + && shapeFrom == StairShape.OUTER_LEFT + && shape != StairShape.INNER_LEFT) + return true; + if(facingFrom == facing.getOpposite() && shape == StairShape.OUTER_RIGHT) return true; @@ -284,6 +300,11 @@ private boolean isInvisibleToGlassStairs(BlockState state, if(facingFrom == facing && shapeFrom != StairShape.OUTER_RIGHT) return true; + if(facingFrom == facing.rotateYCounterclockwise() + && shapeFrom == StairShape.OUTER_RIGHT + && shape != StairShape.INNER_RIGHT) + return true; + if(facingFrom == facing.getOpposite() && shape == StairShape.OUTER_LEFT) return true; diff --git a/src/main/java/net/wurstclient/glass/StainedGlassStairsBlock.java b/src/main/java/net/wurstclient/glass/StainedGlassStairsBlock.java index d5ae81d..53a620f 100644 --- a/src/main/java/net/wurstclient/glass/StainedGlassStairsBlock.java +++ b/src/main/java/net/wurstclient/glass/StainedGlassStairsBlock.java @@ -232,18 +232,29 @@ private boolean isInvisibleToGlassStairs(BlockState state, } // other stairs rear - if(facingFrom == direction.getOpposite()) + if(facingFrom == direction.getOpposite() + && shapeFrom != StairShape.OUTER_LEFT + && shapeFrom != StairShape.OUTER_RIGHT) + return true; + + // other curved stairs fully covered side + if(facingFrom == direction.rotateYClockwise() + && shapeFrom == StairShape.INNER_RIGHT) + return true; + if(facingFrom == direction.rotateYCounterclockwise() + && shapeFrom == StairShape.INNER_LEFT) return true; // rear - if(direction == facing && half == halfFrom - && shape != StairShape.STRAIGHT) + if(direction == facing && half == halfFrom) { if(facingFrom == facing.rotateYCounterclockwise() + && shape == StairShape.OUTER_LEFT && shapeFrom != StairShape.OUTER_RIGHT) return true; if(facingFrom == facing.rotateYClockwise() + && shape == StairShape.OUTER_RIGHT && shapeFrom != StairShape.OUTER_LEFT) return true; } @@ -273,6 +284,11 @@ private boolean isInvisibleToGlassStairs(BlockState state, if(facingFrom == facing && shapeFrom != StairShape.OUTER_LEFT) return true; + if(facingFrom == facing.rotateYClockwise() + && shapeFrom == StairShape.OUTER_LEFT + && shape != StairShape.INNER_LEFT) + return true; + if(facingFrom == facing.getOpposite() && shape == StairShape.OUTER_RIGHT) return true; @@ -288,6 +304,11 @@ private boolean isInvisibleToGlassStairs(BlockState state, if(facingFrom == facing && shapeFrom != StairShape.OUTER_RIGHT) return true; + if(facingFrom == facing.rotateYCounterclockwise() + && shapeFrom == StairShape.OUTER_RIGHT + && shape != StairShape.INNER_RIGHT) + return true; + if(facingFrom == facing.getOpposite() && shape == StairShape.OUTER_LEFT) return true; diff --git a/src/main/java/net/wurstclient/glass/TintedGlassStairsBlock.java b/src/main/java/net/wurstclient/glass/TintedGlassStairsBlock.java index 3381a8b..9a0cc80 100644 --- a/src/main/java/net/wurstclient/glass/TintedGlassStairsBlock.java +++ b/src/main/java/net/wurstclient/glass/TintedGlassStairsBlock.java @@ -228,18 +228,29 @@ private boolean isInvisibleToGlassStairs(BlockState state, } // other stairs rear - if(facingFrom == direction.getOpposite()) + if(facingFrom == direction.getOpposite() + && shapeFrom != StairShape.OUTER_LEFT + && shapeFrom != StairShape.OUTER_RIGHT) + return true; + + // other curved stairs fully covered side + if(facingFrom == direction.rotateYClockwise() + && shapeFrom == StairShape.INNER_RIGHT) + return true; + if(facingFrom == direction.rotateYCounterclockwise() + && shapeFrom == StairShape.INNER_LEFT) return true; // rear - if(direction == facing && half == halfFrom - && shape != StairShape.STRAIGHT) + if(direction == facing && half == halfFrom) { if(facingFrom == facing.rotateYCounterclockwise() + && shape == StairShape.OUTER_LEFT && shapeFrom != StairShape.OUTER_RIGHT) return true; if(facingFrom == facing.rotateYClockwise() + && shape == StairShape.OUTER_RIGHT && shapeFrom != StairShape.OUTER_LEFT) return true; } @@ -269,6 +280,11 @@ private boolean isInvisibleToGlassStairs(BlockState state, if(facingFrom == facing && shapeFrom != StairShape.OUTER_LEFT) return true; + if(facingFrom == facing.rotateYClockwise() + && shapeFrom == StairShape.OUTER_LEFT + && shape != StairShape.INNER_LEFT) + return true; + if(facingFrom == facing.getOpposite() && shape == StairShape.OUTER_RIGHT) return true; @@ -284,6 +300,11 @@ private boolean isInvisibleToGlassStairs(BlockState state, if(facingFrom == facing && shapeFrom != StairShape.OUTER_RIGHT) return true; + if(facingFrom == facing.rotateYCounterclockwise() + && shapeFrom == StairShape.OUTER_RIGHT + && shape != StairShape.INNER_RIGHT) + return true; + if(facingFrom == facing.getOpposite() && shape == StairShape.OUTER_LEFT) return true; diff --git a/src/main/java/net/wurstclient/glass/mixin/GlassBlockMixin.java b/src/main/java/net/wurstclient/glass/mixin/GlassBlockMixin.java index 3b30a11..50906d7 100644 --- a/src/main/java/net/wurstclient/glass/mixin/GlassBlockMixin.java +++ b/src/main/java/net/wurstclient/glass/mixin/GlassBlockMixin.java @@ -16,6 +16,7 @@ import net.minecraft.block.StairsBlock; import net.minecraft.block.enums.BlockHalf; import net.minecraft.block.enums.SlabType; +import net.minecraft.block.enums.StairShape; import net.minecraft.util.math.Direction; import net.wurstclient.glass.MoGlass; import net.wurstclient.glass.MoGlassBlocks; @@ -67,6 +68,7 @@ private boolean isInvisibleToGlassStairs(BlockState state, { BlockHalf halfFrom = stateFrom.get(StairsBlock.HALF); Direction facingFrom = stateFrom.get(StairsBlock.FACING); + StairShape shapeFrom = stateFrom.get(StairsBlock.SHAPE); // up if(direction == Direction.UP) @@ -79,7 +81,17 @@ private boolean isInvisibleToGlassStairs(BlockState state, return true; // other stairs rear - if(facingFrom == direction.getOpposite()) + if(facingFrom == direction.getOpposite() + && shapeFrom != StairShape.OUTER_LEFT + && shapeFrom != StairShape.OUTER_RIGHT) + return true; + + // other curved stairs fully covered side + if(facingFrom == direction.rotateYClockwise() + && shapeFrom == StairShape.INNER_RIGHT) + return true; + if(facingFrom == direction.rotateYCounterclockwise() + && shapeFrom == StairShape.INNER_LEFT) return true; return false; diff --git a/src/main/java/net/wurstclient/glass/mixin/StainedGlassBlockMixin.java b/src/main/java/net/wurstclient/glass/mixin/StainedGlassBlockMixin.java index 76667ea..848ff2e 100644 --- a/src/main/java/net/wurstclient/glass/mixin/StainedGlassBlockMixin.java +++ b/src/main/java/net/wurstclient/glass/mixin/StainedGlassBlockMixin.java @@ -20,6 +20,7 @@ import net.minecraft.block.StairsBlock; import net.minecraft.block.enums.BlockHalf; import net.minecraft.block.enums.SlabType; +import net.minecraft.block.enums.StairShape; import net.minecraft.util.DyeColor; import net.minecraft.util.math.Direction; import net.wurstclient.glass.MoGlass; @@ -82,6 +83,7 @@ private boolean isInvisibleToGlassStairs(BlockState state, { BlockHalf halfFrom = stateFrom.get(StairsBlock.HALF); Direction facingFrom = stateFrom.get(StairsBlock.FACING); + StairShape shapeFrom = stateFrom.get(StairsBlock.SHAPE); // up if(direction == Direction.UP) @@ -94,7 +96,17 @@ private boolean isInvisibleToGlassStairs(BlockState state, return true; // other stairs rear - if(facingFrom == direction.getOpposite()) + if(facingFrom == direction.getOpposite() + && shapeFrom != StairShape.OUTER_LEFT + && shapeFrom != StairShape.OUTER_RIGHT) + return true; + + // other curved stairs fully covered side + if(facingFrom == direction.rotateYClockwise() + && shapeFrom == StairShape.INNER_RIGHT) + return true; + if(facingFrom == direction.rotateYCounterclockwise() + && shapeFrom == StairShape.INNER_LEFT) return true; return false; diff --git a/src/main/java/net/wurstclient/glass/mixin/TintedGlassBlockMixin.java b/src/main/java/net/wurstclient/glass/mixin/TintedGlassBlockMixin.java index 1ad8d84..e39b953 100644 --- a/src/main/java/net/wurstclient/glass/mixin/TintedGlassBlockMixin.java +++ b/src/main/java/net/wurstclient/glass/mixin/TintedGlassBlockMixin.java @@ -16,6 +16,7 @@ import net.minecraft.block.TintedGlassBlock; import net.minecraft.block.enums.BlockHalf; import net.minecraft.block.enums.SlabType; +import net.minecraft.block.enums.StairShape; import net.minecraft.util.math.Direction; import net.wurstclient.glass.MoGlass; import net.wurstclient.glass.MoGlassBlocks; @@ -67,6 +68,7 @@ private boolean isInvisibleToGlassStairs(BlockState state, { BlockHalf halfFrom = stateFrom.get(StairsBlock.HALF); Direction facingFrom = stateFrom.get(StairsBlock.FACING); + StairShape shapeFrom = stateFrom.get(StairsBlock.SHAPE); // up if(direction == Direction.UP) @@ -79,7 +81,17 @@ private boolean isInvisibleToGlassStairs(BlockState state, return true; // other stairs rear - if(facingFrom == direction.getOpposite()) + if(facingFrom == direction.getOpposite() + && shapeFrom != StairShape.OUTER_LEFT + && shapeFrom != StairShape.OUTER_RIGHT) + return true; + + // other curved stairs fully covered side + if(facingFrom == direction.rotateYClockwise() + && shapeFrom == StairShape.INNER_RIGHT) + return true; + if(facingFrom == direction.rotateYCounterclockwise() + && shapeFrom == StairShape.INNER_LEFT) return true; return false;