當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。