本文整理汇总了Java中cofh.api.tileentity.ITileInfo类的典型用法代码示例。如果您正苦于以下问题:Java ITileInfo类的具体用法?Java ITileInfo怎么用?Java ITileInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITileInfo类属于cofh.api.tileentity包,在下文中一共展示了ITileInfo类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemUseFirst
import cofh.api.tileentity.ITileInfo; //导入依赖的package包/类
@Override
public boolean onItemUseFirst(ItemStack itemStack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (AddonUtils.isClientWorld(world)) {
return false;
}
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if (tileEntity instanceof ITileInfo) {
((ITileInfo)tileEntity).sendTileInfoToPlayer(player);
return true;
}
if (tileEntity instanceof IPowerReceptor && ((IPowerReceptor)tileEntity).getPowerProvider() != null) {
IPowerReceptor tilePowered = (IPowerReceptor)tileEntity;
IPowerProvider tilePP = tilePowered.getPowerProvider();
player.sendChatToPlayer("Energy Requested: " + minF(tilePowered.powerRequest(ForgeDirection.UNKNOWN), tilePP.getMaxEnergyStored() - tilePP.getEnergyStored()));
return true;
}
return false;
}