Fix up torch placement logic to handle more vanilla special-casing (#5426)

This commit is contained in:
Ben Staddon 2019-04-23 17:39:50 -04:00 committed by tterrag
parent dd9077d52d
commit 18d0f7ba0d
2 changed files with 9 additions and 4 deletions

View File

@ -465,10 +465,14 @@ public interface IForgeBlock
*/
default boolean canPlaceTorchOnTop(IBlockState state, IWorldReaderBase world, BlockPos pos)
{
if (state.isTopSolid() || state.getBlockFaceShape(world, pos, EnumFacing.UP) == BlockFaceShape.SOLID)
return this.getBlock() != Blocks.END_GATEWAY;
else
return this.getBlock() instanceof BlockFence || this.getBlock() instanceof BlockStainedGlass || this.getBlock() == Blocks.GLASS || this.getBlock() == Blocks.COBBLESTONE_WALL || this.getBlock() == Blocks.MOSSY_COBBLESTONE_WALL;
if (this == Blocks.END_GATEWAY) {
return false;
} else if (state.isTopSolid() || this instanceof BlockFence || this == Blocks.GLASS || this == Blocks.COBBLESTONE_WALL || this instanceof BlockStainedGlass) {
return true;
} else {
BlockFaceShape shape = state.getBlockFaceShape(world, pos, EnumFacing.UP);
return (shape == BlockFaceShape.SOLID || shape == BlockFaceShape.CENTER || shape == BlockFaceShape.CENTER_BIG) && !Block.isExceptionBlockForAttaching(getBlock());
}
}
/**

View File

@ -10,6 +10,7 @@ public net.minecraft.block.Block func_149715_a(F)Lnet.minecraft.block.Block; #se
public net.minecraft.block.Block func_149722_s()Lnet.minecraft.block.Block; #setBlockUnbreakable
public net.minecraft.block.Block func_149675_a(Z)Lnet.minecraft.block.Block; #setTickRandomly
public net.minecraft.block.Block func_180637_b(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;I)V # dropXpOnBlockBreak
public net.minecraft.block.Block func_193384_b(Lnet/minecraft/block/Block;)Z # isExceptionBlockForAttaching
# BlockFire
public net.minecraft.block.BlockFire func_176532_c(Lnet/minecraft/block/Block;)I # getFireSpreadSpeed
public net.minecraft.block.BlockFire func_176534_d(Lnet/minecraft/block/Block;)I # getFireSpreadSpeed