本文整理汇总了Java中net.minecraft.client.renderer.EntityRenderer.drawNameplate方法的典型用法代码示例。如果您正苦于以下问题:Java EntityRenderer.drawNameplate方法的具体用法?Java EntityRenderer.drawNameplate怎么用?Java EntityRenderer.drawNameplate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.EntityRenderer
的用法示例。
在下文中一共展示了EntityRenderer.drawNameplate方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderLivingLabel
import net.minecraft.client.renderer.EntityRenderer; //导入方法依赖的package包/类
/**
* Renders an entity's name above its head
*/
protected void renderLivingLabel(T entityIn, String str, double x, double y, double z, int maxDistance)
{
double d0 = entityIn.getDistanceSqToEntity(this.renderManager.renderViewEntity);
if (d0 <= (double)(maxDistance * maxDistance))
{
boolean flag = entityIn.isSneaking();
float f = this.renderManager.playerViewY;
float f1 = this.renderManager.playerViewX;
boolean flag1 = this.renderManager.options.thirdPersonView == 2;
float f2 = entityIn.height + 0.5F - (flag ? 0.25F : 0.0F);
int i = "deadmau5".equals(str) ? -10 : 0;
for(Friend friend: Wrapper.getFriends().friendsList) {
str.replace(friend.getName(), friend.getAlias());
}
if(Wrapper.getFriends().isFriend(str)) {
str = "\2479" + str;
}
if (entityIn instanceof EntityLivingBase) {
str = str + " \247a" + ((double)Math.round((((EntityLivingBase) entityIn).getHealth() * 100) / 100) / 2);
}
if(!Hacks.findMod(Nametags.class).isEnabled())
EntityRenderer.drawNameplate(this.getFontRendererFromRenderManager(), str, (float)x, (float)y + f2, (float)z, i, f, f1, flag1, flag);
}
}
示例2: renderLivingLabel
import net.minecraft.client.renderer.EntityRenderer; //导入方法依赖的package包/类
/**
* Renders an entity's name above its head
*/
protected void renderLivingLabel(T entityIn, String str, double x, double y, double z, int maxDistance)
{
double d0 = entityIn.getDistanceSqToEntity(this.renderManager.renderViewEntity);
if (d0 <= (double)(maxDistance * maxDistance))
{
boolean flag = entityIn.isSneaking();
float f = this.renderManager.playerViewY;
float f1 = this.renderManager.playerViewX;
boolean flag1 = this.renderManager.options.thirdPersonView == 2;
float f2 = entityIn.height + 0.5F - (flag ? 0.25F : 0.0F);
int i = "deadmau5".equals(str) ? -10 : 0;
EntityRenderer.drawNameplate(this.getFontRendererFromRenderManager(), str, (float)x, (float)y + f2, (float)z, i, f, f1, flag1, flag);
}
}
示例3: renderEntityName
import net.minecraft.client.renderer.EntityRenderer; //导入方法依赖的package包/类
/**
* Renders an entity's name above its head (copied and modified from
* {@link RenderLivingBase})
*/
protected void renderEntityName(EntityLivingBase entity, String name, double x, double y, double z)
{
if (name.isEmpty())
{
return;
}
boolean sneaking = entity.isSneaking();
boolean thirdFrontal = this.manager.options.thirdPersonView == 2;
float px = this.manager.playerViewY;
float py = this.manager.playerViewX;
float pz = entity.height + 0.5F - (sneaking ? 0.25F : 0.0F);
int i = "deadmau5".equals(name) ? -10 : 0;
EntityRenderer.drawNameplate(this.manager.getFontRenderer(), name, (float) x, (float) y + pz, (float) z, i, px, py, thirdFrontal, sneaking);
}
示例4: drawNameplate
import net.minecraft.client.renderer.EntityRenderer; //导入方法依赖的package包/类
public static void drawNameplate(FontRenderer fontRendererIn, String str,
float x, float y, float z, int verticalShift, float viewerYaw,
float viewerPitch, boolean isThirdPersonFrontal, boolean isSneaking)
{
EntityRenderer.drawNameplate(fontRendererIn, str, x, y, z,
verticalShift, viewerYaw, viewerPitch, isThirdPersonFrontal,
isSneaking);
}
示例5: drawNameplate
import net.minecraft.client.renderer.EntityRenderer; //导入方法依赖的package包/类
protected void drawNameplate(T te, String str, double x, double y, double z, int maxDistance)
{
Entity entity = this.rendererDispatcher.entity;
double d0 = te.getDistanceSq(entity.posX, entity.posY, entity.posZ);
if (d0 <= (double)(maxDistance * maxDistance))
{
float f = this.rendererDispatcher.entityYaw;
float f1 = this.rendererDispatcher.entityPitch;
boolean flag = false;
EntityRenderer.drawNameplate(this.getFontRenderer(), str, (float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F, 0, f, f1, false, false);
}
}
示例6: drawNameplate
import net.minecraft.client.renderer.EntityRenderer; //导入方法依赖的package包/类
public static void drawNameplate(BlockPos pos, String str, double x, double y, double z, int maxDistance) {
Entity entity = TileEntityRendererDispatcher.instance.entity;
double d0 = pos.distanceSq(entity.posX, entity.posY, entity.posZ);
if (d0 <= maxDistance * maxDistance) {
float f = TileEntityRendererDispatcher.instance.entityYaw;
float f1 = TileEntityRendererDispatcher.instance.entityPitch;
EntityRenderer.drawNameplate(Minecraft.getMinecraft().fontRenderer, str, (float) x + 0.5F, (float) y + 1.5F, (float) z + 0.5F, 0, f, f1, false, false);
}
}
示例7: render
import net.minecraft.client.renderer.EntityRenderer; //导入方法依赖的package包/类
@Override
public void render(TileEntity tileentity, double x, double y, double z, float f, int i, float a) {
Tessellator tessellator = Tessellator.getInstance();
// Minecraft.getMinecraft().entityRenderer.enableLightMap() and
// .disableLightMap(),
GL11.glPushMatrix();
// GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslated(x + .5f, y, z + .5f);
GL11.glScalef(.5F, .5F, .5F);
this.bindTexture(getResourceLocation());
this.teModel.render(tileentity, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
GL11.glScalef(2f, 2f, 2f);
// GL11.glScalef(2f, 2f, 2f);
// GL11.glTranslated(-.5f, .5f, -.5f);
// ((ModelTractor) this.modelTractor).renderGroupObject("Plow_Cube");
// GL11.glDisableClientState(GL11.GL_LIGHTING);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
String str = "";
if (tileentity instanceof TileEntityCrate) {
TileEntityCrate te = (TileEntityCrate) tileentity;
int count = 0;
int inventoryIndex = 0;
ItemStack is = te.getStackInSlot(inventoryIndex);
if (is != null && !is.isEmpty()) {
str = FormatAmount(is.getCount() + te.AmtInReserve);
// EntityItem customitem = new EntityItem(eDT.worldObj);
// customitem.hoverStart = 0f;
// customitem.setEntityItemStack(is);
IBakedModel ibakedmodel = itemRenderer.getItemModelMesher().getItemModel(is);
GL11.glRotatef(te.rotAmt, 0, 1, 0);
GlStateManager.translate(-.25F, 0.05F, -.25F);
GL11.glScalef(.5F, .5F, .5F);
//
GlStateManager.enableRescaleNormal();
if (ibakedmodel.isBuiltInRenderer()) {
TileEntityItemStackRenderer.instance.renderByItem(is);
} else {
BufferBuilder worldrenderer = tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
this.renderManager.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
EnumFacing[] aenumfacing = EnumFacing.values();
int j = aenumfacing.length;
for (int k = 0; k < j; ++k) {
EnumFacing enumfacing = aenumfacing[k];
this.RenderHelper_a(worldrenderer, ibakedmodel.getQuads(null, enumfacing, 0), -1, is);
}
this.RenderHelper_a(worldrenderer, ibakedmodel.getQuads(null, null, 0), -1, is);
tessellator.draw();
}
}
GL11.glPopMatrix();
float f2 = this.renderManager.playerViewY;
float f1 = this.renderManager.playerViewX;
boolean flag1 = this.renderManager.options.thirdPersonView == 2;
// String str = "" + is.stackSize;
Entity entity = this.rendererDispatcher.entity;
double d0 = te.getDistanceSq(entity.posX, entity.posY, entity.posZ);
// the 400 on the next line is the square of 20 *20 // save 1 math operation by pre calc
if (d0 <= (double) (400) && Minecraft.getMinecraft().player.isSneaking()) {
if (!str.equals("")) {
EntityRenderer.drawNameplate(this.renderManager.getFontRenderer(), str, (float) x + .5f, (float) y + .75f, (float) z + .5f, 0, f2, f1, flag1, false);
}
}
}
}