mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fix some rendering weirdness between slabs and stairs
This commit is contained in:
parent
be55bd4e75
commit
f7c462ac7e
2 changed files with 36 additions and 8 deletions
|
@ -128,7 +128,7 @@ public class BlockCloudSlab extends BlockSlab implements ICloudBlock {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (face == EnumFacing.UP || face == EnumFacing.DOWN) {
|
if (face == EnumFacing.UP || face == EnumFacing.DOWN) {
|
||||||
return true;
|
return (state.getValue(HALF) == EnumBlockHalf.TOP) && (face == EnumFacing.UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (beside.getBlock() == this) {
|
if (beside.getBlock() == this) {
|
||||||
|
|
|
@ -8,7 +8,9 @@ import com.minelittlepony.unicopia.CloudType;
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockSlab;
|
import net.minecraft.block.BlockSlab;
|
||||||
|
import net.minecraft.block.BlockSlab.EnumBlockHalf;
|
||||||
import net.minecraft.block.BlockStairs;
|
import net.minecraft.block.BlockStairs;
|
||||||
|
import net.minecraft.block.state.BlockFaceShape;
|
||||||
import net.minecraft.block.state.IBlockState;
|
import net.minecraft.block.state.IBlockState;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -102,24 +104,50 @@ public class BlockCloudStairs extends BlockStairs implements ICloudBlock {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) {
|
public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) {
|
||||||
|
state = state.getActualState(world, pos);
|
||||||
|
|
||||||
IBlockState beside = world.getBlockState(pos.offset(face));
|
IBlockState beside = world.getBlockState(pos.offset(face)).getActualState(world, pos);
|
||||||
|
|
||||||
if (beside.getBlock() instanceof ICloudBlock) {
|
if (beside.getBlock() instanceof ICloudBlock) {
|
||||||
ICloudBlock cloud = ((ICloudBlock)beside.getBlock());
|
ICloudBlock cloud = ((ICloudBlock)beside.getBlock());
|
||||||
|
|
||||||
EnumFacing front = state.getValue(FACING);
|
|
||||||
EnumHalf half = state.getValue(HALF);
|
|
||||||
|
|
||||||
if (cloud.getCloudMaterialType(beside) == getCloudMaterialType(state)) {
|
if (cloud.getCloudMaterialType(beside) == getCloudMaterialType(state)) {
|
||||||
|
EnumFacing front = state.getValue(FACING);
|
||||||
|
EnumHalf half = state.getValue(HALF);
|
||||||
|
|
||||||
|
boolean sideIsBack = state.getBlockFaceShape(world, pos, face) == BlockFaceShape.SOLID;
|
||||||
|
boolean sideIsFront = state.getBlockFaceShape(world, pos, face.getOpposite()) == BlockFaceShape.SOLID;
|
||||||
|
boolean sideIsSide = !(sideIsBack || sideIsFront);
|
||||||
|
|
||||||
if (beside.getBlock() == this) {
|
if (beside.getBlock() == this) {
|
||||||
EnumFacing bfront = beside.getValue(FACING);
|
EnumFacing bfront = beside.getValue(FACING);
|
||||||
EnumHalf bhalf = beside.getValue(HALF);
|
EnumHalf bhalf = beside.getValue(HALF);
|
||||||
|
|
||||||
return (bfront == front && front != face && half == bhalf)
|
if (face == EnumFacing.UP || face == EnumFacing.DOWN) {
|
||||||
|| (bfront.getOpposite() == front && front == face);
|
return half != bhalf
|
||||||
|
&& ( (face == EnumFacing.UP && half == EnumHalf.TOP)
|
||||||
|
|| (face == EnumFacing.DOWN && half == EnumHalf.BOTTOM)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean bsideIsBack = beside.getBlockFaceShape(world, pos, face) == BlockFaceShape.SOLID;
|
||||||
|
boolean bsideIsFront = beside.getBlockFaceShape(world, pos, face.getOpposite()) == BlockFaceShape.SOLID;
|
||||||
|
boolean bsideIsSide = !(bsideIsBack || bsideIsFront);
|
||||||
|
|
||||||
|
return sideIsBack
|
||||||
|
|| (sideIsSide && bsideIsSide && front == bfront && half == bhalf);
|
||||||
} else if (beside.getBlock() instanceof BlockCloudSlab) {
|
} else if (beside.getBlock() instanceof BlockCloudSlab) {
|
||||||
return beside.getValue(BlockSlab.HALF).ordinal() == half.ordinal();
|
EnumBlockHalf bhalf = beside.getValue(BlockSlab.HALF);
|
||||||
|
|
||||||
|
if (face == EnumFacing.UP || face == EnumFacing.DOWN) {
|
||||||
|
return bhalf == EnumBlockHalf.TOP && half == EnumHalf.BOTTOM;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bhalf == EnumBlockHalf.TOP && half == EnumHalf.BOTTOM;
|
||||||
|
} else {
|
||||||
|
if (face == EnumFacing.UP || face == EnumFacing.DOWN) {
|
||||||
|
return half == EnumHalf.BOTTOM && face == EnumFacing.DOWN;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return front == face;
|
return front == face;
|
||||||
|
|
Loading…
Reference in a new issue