Fix gauge not rendering behind door

This commit is contained in:
Snownee 2021-01-30 21:14:58 +08:00
parent 08a20972aa
commit c77e7c28d7

View File

@ -14,7 +14,6 @@ import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.MaterialColor; import net.minecraft.block.material.MaterialColor;
import net.minecraft.item.BlockItemUseContext; import net.minecraft.item.BlockItemUseContext;
import net.minecraft.particles.RedstoneParticleData; import net.minecraft.particles.RedstoneParticleData;
@ -114,6 +113,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock {
return context.getFace(); return context.getFace();
} }
@Override
protected boolean getAxisAlignmentForPlacement(BlockItemUseContext context) { protected boolean getAxisAlignmentForPlacement(BlockItemUseContext context) {
return context.getPlacementHorizontalFacing().getAxis() != Axis.X; return context.getPlacementHorizontalFacing().getAxis() != Axis.X;
} }
@ -127,8 +127,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock {
return false; return false;
if (getRotationAxis(state) == Axis.Y && face != state.get(FACING)) if (getRotationAxis(state) == Axis.Y && face != state.get(FACING))
return false; return false;
BlockState blockState = world.getBlockState(pos.offset(face)); if (!Block.shouldSideBeRendered(state, world, pos, face)
if (Block.hasSolidSide(blockState, world, pos, face.getOpposite()) && blockState.getMaterial() != Material.GLASS
&& !(world instanceof WrappedWorld)) && !(world instanceof WrappedWorld))
return false; return false;
return true; return true;