Fixed cloud fences and banisters connecting to each other

This commit is contained in:
Sollace 2019-02-07 16:31:15 +02:00
parent 58f72a783b
commit 6329d5bd59
2 changed files with 24 additions and 0 deletions

View file

@ -52,6 +52,22 @@ public class BlockCloudBanister extends BlockCloudFence {
return BlockRenderLayer.SOLID;
}
@Override
public boolean canConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing) {
IBlockState myState = world.getBlockState(pos);
return myState.getBlock() instanceof BlockCloudBanister
&& super.canConnectTo(world, pos, facing);
}
@Override
public boolean canBeConnectedTo(IBlockAccess world, BlockPos pos, EnumFacing facing) {
IBlockState state = world.getBlockState(pos.offset(facing));
return state.getBlock() instanceof BlockCloudBanister
&& state.getMaterial() == world.getBlockState(pos).getMaterial();
}
@Deprecated
@Override
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entity, boolean isActualState) {

View file

@ -13,6 +13,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
@ -83,6 +84,13 @@ public class BlockCloudFence extends BlockFence implements ICloudBlock {
}
}
public boolean canConnectTo(IBlockAccess world, BlockPos pos, EnumFacing facing) {
IBlockState myState = world.getBlockState(pos);
return !(myState.getBlock() instanceof BlockCloudBanister)
&& super.canConnectTo(world, pos, facing);
}
@Override
public void onEntityCollision(World w, BlockPos pos, IBlockState state, Entity entity) {
if (!applyBouncyness(state, entity)) {