use of com.cjm721.overloaded.block.tile.TilePlayerInterface in project Overloaded by CJ-MC-Mods.
the class BlockPlayerInterface method onBlockActivated.
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!worldIn.isRemote && hand == EnumHand.MAIN_HAND) {
TileEntity te = worldIn.getTileEntity(pos);
if (te instanceof TilePlayerInterface) {
UUID placer = ((TilePlayerInterface) te).getPlacer();
GameProfile profile = worldIn.getMinecraftServer().getPlayerProfileCache().getProfileByUUID(placer);
if (profile == null) {
playerIn.sendMessage(new TextComponentString(String.format("Bound to offline player: %s", placer.toString())));
} else {
playerIn.sendMessage(new TextComponentString("Bound to player: " + profile.getName()));
}
}
}
return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
}
Aggregations