New hook for better custom scaffolding movement (#7261)

This commit is contained in:
ChampionAsh5357 authored and GitHub committed 2020-09-08 14:00:09 -07:00
1 parent f68344cd7c
commit 15733a18e4
8 files changed
+132 -1

No files matched your search

@@ -911,4 +911,18 @@ public interface IForgeBlock
else if(toolType == ToolType.HOE) return HoeItem.getHoeTillingState(state);
else return toolType == ToolType.SHOVEL ? ShovelItem.getShovelPathingState(state) : null;
}
/**
* Checks if a player or entity handles movement on this block like scaffolding.
*
* @param state The current state
* @param world The current world
* @param pos The block position in world
* @param entity The entity on the scaffolding
* @return True if the block should act like scaffolding
*/
default boolean isScaffolding(BlockState state, IWorldReader world, BlockPos pos, LivingEntity entity)
{
return state.isIn(Blocks.SCAFFOLDING);
}
}
@@ -798,4 +798,15 @@ public interface IForgeBlockState
BlockState eventState = net.minecraftforge.event.ForgeEventFactory.onToolUse(getBlockState(), world, pos, player, stack, toolType);
return eventState != getBlockState() ? eventState : getBlockState().getBlock().getToolModifiedState(getBlockState(), world, pos, player, stack, toolType);
}
/**
* Checks if a player or entity handles movement on this block like scaffolding.
*
* @param entity The entity on the scaffolding
* @return True if the block should act like scaffolding
*/
default boolean isScaffolding(LivingEntity entity)
{
return getBlockState().getBlock().isScaffolding(getBlockState(), entity.world, entity.func_233580_cy_(), entity);
}
}