From bdf53c9094a8c962fb8ec8cc183e0542e81f96ba Mon Sep 17 00:00:00 2001 From: drcrazy Date: Mon, 17 Sep 2018 15:55:09 +0300 Subject: [PATCH] Add block info into debug tool output --- .../techreborn/items/tool/ItemDebugTool.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/techreborn/items/tool/ItemDebugTool.java b/src/main/java/techreborn/items/tool/ItemDebugTool.java index 97a2e663e..035a9b4ad 100644 --- a/src/main/java/techreborn/items/tool/ItemDebugTool.java +++ b/src/main/java/techreborn/items/tool/ItemDebugTool.java @@ -24,6 +24,7 @@ package techreborn.items.tool; +import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; @@ -47,20 +48,23 @@ public class ItemDebugTool extends Item { } @Override - public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, - EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, + EnumFacing facing, float hitX, float hitY, float hitZ) { + Block block = worldIn.getBlockState(pos).getBlock(); + if (block != null) { + playerIn.sendMessage(new TextComponentString( + TextFormatting.GREEN + "Block Registry Name:" + TextFormatting.BLUE + block.getRegistryName().toString())); + } TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof IEnergyInterfaceTile) { if (!tile.getWorld().isRemote) { - playerIn.sendMessage( - new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE + playerIn.sendMessage(new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE + PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy()))); } return EnumActionResult.SUCCESS; } else if (tile != null && tile.hasCapability(CapabilityEnergy.ENERGY, facing)) { if (!tile.getWorld().isRemote) { - playerIn.sendMessage( - new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED + playerIn.sendMessage(new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED + tile.getCapability(CapabilityEnergy.ENERGY, facing).getEnergyStored() + "FU")); } return EnumActionResult.SUCCESS;