Add block info into debug tool output
This commit is contained in:
parent
89ca71386f
commit
bdf53c9094
1 changed files with 10 additions and 6 deletions
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
package techreborn.items.tool;
|
package techreborn.items.tool;
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.Item;
|
import net.minecraft.item.Item;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -47,20 +48,23 @@ public class ItemDebugTool extends Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos,
|
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand,
|
||||||
EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
|
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);
|
TileEntity tile = worldIn.getTileEntity(pos);
|
||||||
if (tile instanceof IEnergyInterfaceTile) {
|
if (tile instanceof IEnergyInterfaceTile) {
|
||||||
if (!tile.getWorld().isRemote) {
|
if (!tile.getWorld().isRemote) {
|
||||||
playerIn.sendMessage(
|
playerIn.sendMessage(new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE
|
||||||
new TextComponentString(TextFormatting.GREEN + "Power" + TextFormatting.BLUE
|
|
||||||
+ PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
|
+ PowerSystem.getLocaliszedPower(((IEnergyInterfaceTile) tile).getEnergy())));
|
||||||
}
|
}
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
} else if (tile != null && tile.hasCapability(CapabilityEnergy.ENERGY, facing)) {
|
} else if (tile != null && tile.hasCapability(CapabilityEnergy.ENERGY, facing)) {
|
||||||
if (!tile.getWorld().isRemote) {
|
if (!tile.getWorld().isRemote) {
|
||||||
playerIn.sendMessage(
|
playerIn.sendMessage(new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED
|
||||||
new TextComponentString(TextFormatting.GREEN + "Power " + TextFormatting.RED
|
|
||||||
+ tile.getCapability(CapabilityEnergy.ENERGY, facing).getEnergyStored() + "FU"));
|
+ tile.getCapability(CapabilityEnergy.ENERGY, facing).getEnergyStored() + "FU"));
|
||||||
}
|
}
|
||||||
return EnumActionResult.SUCCESS;
|
return EnumActionResult.SUCCESS;
|
||||||
|
|
Loading…
Add table
Reference in a new issue