use of WayofTime.bloodmagic.iface.IDocumentedBlock in project BloodMagic by WayofTime.
the class ItemSanguineBook method onItemUse.
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (world.isRemote)
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
IBlockState hitState = world.getBlockState(pos);
if (player.isSneaking()) {
if (hitState.getBlock() instanceof IDocumentedBlock) {
trySetDisplayedTier(world, pos);
IDocumentedBlock documentedBlock = (IDocumentedBlock) hitState.getBlock();
List<ITextComponent> docs = documentedBlock.getDocumentation(player, world, pos, hitState);
if (!docs.isEmpty()) {
ChatUtil.sendNoSpam(player, docs.toArray(new ITextComponent[docs.size()]));
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
}
}
}
return super.onItemUse(player, world, pos, hand, facing, hitX, hitY, hitZ);
}
Aggregations