本文整理匯總了Java中net.minecraft.entity.item.EntityItemFrame.getDistanceSqToEntity方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityItemFrame.getDistanceSqToEntity方法的具體用法?Java EntityItemFrame.getDistanceSqToEntity怎麽用?Java EntityItemFrame.getDistanceSqToEntity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.entity.item.EntityItemFrame
的用法示例。
在下文中一共展示了EntityItemFrame.getDistanceSqToEntity方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: renderName
import net.minecraft.entity.item.EntityItemFrame; //導入方法依賴的package包/類
protected void renderName(EntityItemFrame entity, double x, double y, double z)
{
if (Minecraft.isGuiEnabled() && !entity.getDisplayedItem().func_190926_b() && entity.getDisplayedItem().hasDisplayName() && this.renderManager.pointedEntity == entity)
{
double d0 = entity.getDistanceSqToEntity(this.renderManager.renderViewEntity);
float f = entity.isSneaking() ? 32.0F : 64.0F;
if (d0 < (double)(f * f))
{
String s = entity.getDisplayedItem().getDisplayName();
this.renderLivingLabel(entity, s, x, y, z, 64);
}
}
}
示例2: renderName
import net.minecraft.entity.item.EntityItemFrame; //導入方法依賴的package包/類
protected void renderName(EntityItemFrame entity, double x, double y, double z)
{
if (Minecraft.isGuiEnabled() && entity.getDisplayedItem() != null && entity.getDisplayedItem().hasDisplayName() && this.renderManager.pointedEntity == entity)
{
double d0 = entity.getDistanceSqToEntity(this.renderManager.renderViewEntity);
float f = entity.isSneaking() ? 32.0F : 64.0F;
if (d0 < (double)(f * f))
{
String s = entity.getDisplayedItem().getDisplayName();
this.renderLivingLabel(entity, s, x, y, z, 64);
}
}
}
示例3: renderName
import net.minecraft.entity.item.EntityItemFrame; //導入方法依賴的package包/類
protected void renderName(EntityItemFrame entity, double x, double y, double z)
{
if (Minecraft.isGuiEnabled() && entity.getDisplayedItem() != null && entity.getDisplayedItem().hasDisplayName() && this.renderManager.pointedEntity == entity)
{
float f = 1.6F;
float f1 = 0.016666668F * f;
double d0 = entity.getDistanceSqToEntity(this.renderManager.livingPlayer);
float f2 = entity.isSneaking() ? 32.0F : 64.0F;
if (d0 < (double)(f2 * f2))
{
String s = entity.getDisplayedItem().getDisplayName();
if (entity.isSneaking())
{
FontRenderer fontrenderer = this.getFontRendererFromRenderManager();
GlStateManager.pushMatrix();
GlStateManager.translate((float)x + 0.0F, (float)y + entity.height + 0.5F, (float)z);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GlStateManager.scale(-f1, -f1, f1);
GlStateManager.disableLighting();
GlStateManager.translate(0.0F, 0.25F / f1, 0.0F);
GlStateManager.depthMask(false);
GlStateManager.enableBlend();
GlStateManager.blendFunc(770, 771);
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
int i = fontrenderer.getStringWidth(s) / 2;
GlStateManager.disableTexture2D();
worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR);
worldrenderer.pos((double)(-i - 1), -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos((double)(-i - 1), 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos((double)(i + 1), 8.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
worldrenderer.pos((double)(i + 1), -1.0D, 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex();
tessellator.draw();
GlStateManager.enableTexture2D();
GlStateManager.depthMask(true);
fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127);
GlStateManager.enableLighting();
GlStateManager.disableBlend();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.popMatrix();
}
else
{
this.renderLivingLabel(entity, s, x, y, z, 64);
}
}
}
}
示例4: func_147914_a
import net.minecraft.entity.item.EntityItemFrame; //導入方法依賴的package包/類
protected void func_147914_a(EntityItemFrame p_147914_1_, double p_147914_2_, double p_147914_4_, double p_147914_6_)
{
if (Minecraft.isGuiEnabled() && p_147914_1_.getDisplayedItem() != null && p_147914_1_.getDisplayedItem().hasDisplayName() && this.renderManager.field_147941_i == p_147914_1_)
{
float var8 = 1.6F;
float var9 = 0.016666668F * var8;
double var10 = p_147914_1_.getDistanceSqToEntity(this.renderManager.livingPlayer);
float var12 = p_147914_1_.isSneaking() ? 32.0F : 64.0F;
if (var10 < (double)(var12 * var12))
{
String var13 = p_147914_1_.getDisplayedItem().getDisplayName();
if (p_147914_1_.isSneaking())
{
FontRenderer var14 = this.getFontRendererFromRenderManager();
GL11.glPushMatrix();
GL11.glTranslatef((float)p_147914_2_ + 0.0F, (float)p_147914_4_ + p_147914_1_.height + 0.5F, (float)p_147914_6_);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GL11.glScalef(-var9, -var9, var9);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glTranslatef(0.0F, 0.25F / var9, 0.0F);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Tessellator var15 = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
var15.startDrawingQuads();
int var16 = var14.getStringWidth(var13) / 2;
var15.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
var15.addVertex((double)(-var16 - 1), -1.0D, 0.0D);
var15.addVertex((double)(-var16 - 1), 8.0D, 0.0D);
var15.addVertex((double)(var16 + 1), 8.0D, 0.0D);
var15.addVertex((double)(var16 + 1), -1.0D, 0.0D);
var15.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(true);
var14.drawString(var13, -var14.getStringWidth(var13) / 2, 0, 553648127);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
}
else
{
}
}
}
}
示例5: func_147914_a
import net.minecraft.entity.item.EntityItemFrame; //導入方法依賴的package包/類
protected void func_147914_a(EntityItemFrame p_147914_1_, double p_147914_2_, double p_147914_4_, double p_147914_6_)
{
if (Minecraft.isGuiEnabled() && p_147914_1_.getDisplayedItem() != null && p_147914_1_.getDisplayedItem().hasDisplayName() && this.renderManager.field_147941_i == p_147914_1_)
{
float f = 1.6F;
float f1 = 0.016666668F * f;
double d3 = p_147914_1_.getDistanceSqToEntity(this.renderManager.livingPlayer);
float f2 = p_147914_1_.isSneaking() ? 32.0F : 64.0F;
if (d3 < (double)(f2 * f2))
{
String s = p_147914_1_.getDisplayedItem().getDisplayName();
if (p_147914_1_.isSneaking())
{
FontRenderer fontrenderer = this.getFontRendererFromRenderManager();
GL11.glPushMatrix();
GL11.glTranslatef((float)p_147914_2_ + 0.0F, (float)p_147914_4_ + p_147914_1_.height + 0.5F, (float)p_147914_6_);
GL11.glNormal3f(0.0F, 1.0F, 0.0F);
GL11.glRotatef(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
GL11.glScalef(-f1, -f1, f1);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glTranslatef(0.0F, 0.25F / f1, 0.0F);
GL11.glDepthMask(false);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
Tessellator tessellator = Tessellator.instance;
GL11.glDisable(GL11.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
int i = fontrenderer.getStringWidth(s) / 2;
tessellator.setColorRGBA_F(0.0F, 0.0F, 0.0F, 0.25F);
tessellator.addVertex((double)(-i - 1), -1.0D, 0.0D);
tessellator.addVertex((double)(-i - 1), 8.0D, 0.0D);
tessellator.addVertex((double)(i + 1), 8.0D, 0.0D);
tessellator.addVertex((double)(i + 1), -1.0D, 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glDepthMask(true);
fontrenderer.drawString(s, -fontrenderer.getStringWidth(s) / 2, 0, 553648127);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glPopMatrix();
}
else
{
this.func_147906_a(p_147914_1_, s, p_147914_2_, p_147914_4_, p_147914_6_, 64);
}
}
}
}