New hook to allow Trapdoors be climbable for custom ladders (#7816)

This commit is contained in:
cech12 authored and GitHub committed 2021-07-16 18:01:27 -07:00
1 parent 5169f1f6fe
commit 043e49a694
2 files changed
+17 -3

No files matched your search

@@ -116,6 +116,20 @@ public interface IForgeBlock
return state.getBlock().is(BlockTags.CLIMBABLE);
}
/**
* Checks if this block makes an open trapdoor above it climbable.
*
* @param state The current state
* @param world The current world
* @param pos Block position in world
* @param trapdoorState The current state of the open trapdoor above
* @return True if the block should act like a ladder
*/
default boolean makesOpenTrapdoorAboveClimbable(BlockState state, IWorldReader world, BlockPos pos, BlockState trapdoorState)
{
return state.getBlock() instanceof LadderBlock && state.getValue(LadderBlock.FACING) == trapdoorState.getValue(TrapDoorBlock.FACING);
}
/**
* Determines if this block should set fire and deal fire damage
* to entities coming into contact with it.