当前位置: 首页>>代码示例>>Java>>正文


Java EntityLivingBase.getDistance方法代码示例

本文整理汇总了Java中net.minecraft.entity.EntityLivingBase.getDistance方法的典型用法代码示例。如果您正苦于以下问题:Java EntityLivingBase.getDistance方法的具体用法?Java EntityLivingBase.getDistance怎么用?Java EntityLivingBase.getDistance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.EntityLivingBase的用法示例。


在下文中一共展示了EntityLivingBase.getDistance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: renderTileEntityAt

import net.minecraft.entity.EntityLivingBase; //导入方法依赖的package包/类
private void renderTileEntityAt(BlockInfusedBlockOre block, TileInfusedOre tile, double x, double y, double z,
		float partialTicks) {
	GL11.glPushMatrix();
	GL11.glTranslated(x - 0.001D, y - 0.001D, z - 0.001D);
	double scale = 1.002F;
	GL11.glScaled(scale, scale, scale);
	Tessellator tessellator = Tessellator.instance;
	int brightness = setBrightness(tessellator, tile.getWorldObj(), tile.xCoord, tile.yCoord, tile.zCoord, block);
	int metadata = tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord);
	if (metadata < 6) {
		EntityLivingBase viewer = Minecraft.getMinecraft().renderViewEntity;
		double viewDistance = 0D;
		double currentDistance = viewer.getDistance(tile.xCoord + 0.5D, tile.yCoord + 0.5D, tile.zCoord + 0.5D);
		boolean hasVisualAcuity = false;
		boolean hasWarpVisualAcuity = false;
		boolean canView = false;
		if (viewer instanceof EntityPlayer) {
			hasVisualAcuity = ThaumUtils.isComplete((EntityPlayer) viewer, TOThaum.riVisualAcuity);
			hasWarpVisualAcuity = ThaumUtils.isComplete((EntityPlayer) viewer, TOThaum.riWarpVisualAcuity);
			if ((((EntityPlayer) viewer).inventory.armorItemInSlot(3) != null)
					&& (((EntityPlayer) viewer).inventory.armorItemInSlot(3).getItem() instanceof IRevealer)
					&& (((IRevealer) ((EntityPlayer) viewer).inventory.armorItemInSlot(3).getItem())
							.showNodes(((EntityPlayer) viewer).inventory.armorItemInSlot(3), viewer))) {
				canView = true;
				viewDistance = hasVisualAcuity ? 32.0D : 16.0D;
			} else if ((((EntityPlayer) viewer).inventory.getCurrentItem() != null)
					&& (((EntityPlayer) viewer).inventory.getCurrentItem().getItem() instanceof ItemThaumometer)
					&& (UtilsFX.isVisibleTo(0.44F, viewer, tile.xCoord, tile.yCoord, tile.zCoord))) {
				canView = true;
				viewDistance = hasVisualAcuity ? 16.0D : 8.0D;
			}
			if (hasWarpVisualAcuity) {
				int warp = ThaumUtils.getWarp((EntityPlayer) viewer);
				canView = true;
				double warpViewDistance = warp * TOConfig.generalWarpVisualAcuityModifier;
				if (warpViewDistance > viewDistance)
					viewDistance = warpViewDistance;
			}
		}
		if (canView && currentDistance <= viewDistance) {
			if (TOConfig.generalGraphicsRenderInfusedOreParticlesGlasses && viewer.worldObj.rand
					.nextInt(TOConfig.generalGraphicsRenderInfusedOreParticlesGlassesChance) == 0)
				UtilsFX.infusedStoneSparkle(viewer.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, metadata + 1);
			draw(tessellator, block.icon[6], brightness, metadata);
		} else if (TOConfig.generalGraphicsRenderInfusedOreParticles
				&& viewer.worldObj.rand.nextInt(TOConfig.generalGraphicsRenderInfusedOreParticlesChance) == 0)
			UtilsFX.infusedStoneSparkle(viewer.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, metadata + 1);
	}
	GL11.glPopMatrix();
}
 
开发者ID:MJaroslav,项目名称:ThaumOres,代码行数:51,代码来源:TileInfusedBlockOreRenderer.java


注:本文中的net.minecraft.entity.EntityLivingBase.getDistance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。