本文整理汇总了Java中net.minecraft.client.renderer.ItemRenderer.renderItemIn2D方法的典型用法代码示例。如果您正苦于以下问题:Java ItemRenderer.renderItemIn2D方法的具体用法?Java ItemRenderer.renderItemIn2D怎么用?Java ItemRenderer.renderItemIn2D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.ItemRenderer
的用法示例。
在下文中一共展示了ItemRenderer.renderItemIn2D方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: renderItemIn2D
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
private static void renderItemIn2D(Tessellator tess, float minU, float minV, float maxU, float maxV, int scaleX, int scaleY, float negZLevel, boolean isGlowing) {
if( isGlowing ) {
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
GL11.glDisable(GL11.GL_LIGHT1);
GL11.glDisable(GL11.GL_COLOR_MATERIAL);
float prevLGTX = OpenGlHelper.lastBrightnessX;
float prevLGTY = OpenGlHelper.lastBrightnessY;
char bright = 0x000F0;
int brightX = bright % 65536;
int brightY = bright / 65536;
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F);
ItemRenderer.renderItemIn2D(tess, minU, minV, maxU, maxV, scaleX, scaleY, negZLevel);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHT0);
GL11.glEnable(GL11.GL_LIGHT1);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
} else {
ItemRenderer.renderItemIn2D(tess, minU, minV, maxU, maxV, scaleX, scaleY, negZLevel);
}
}
示例2: renderItem
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
// ====================== Render item texture ======================
FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(item);
int color = fluidStack.getFluid().getColor();
IIcon fluidIcon = item.getIconIndex();
IIcon bucketIcon = Items.bucket.getIconIndex(new ItemStack(Items.bucket));
if(type == ItemRenderType.INVENTORY) {
GL11.glEnable(GL11.GL_ALPHA_TEST);
RenderItem.getInstance().renderIcon(0, 0, bucketIcon, 16, 16);
GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));
RenderItem.getInstance().renderIcon(0, 0, fluidIcon, 16, 16);
GL11.glColor3f(1f, 1f, 1f);
}
else {
ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)bucketIcon).getMinU(), ((IIcon)bucketIcon).getMinV(), ((IIcon)bucketIcon).getMaxU(), ((IIcon)bucketIcon).getMaxV(), ((IIcon)bucketIcon).getIconWidth(), ((IIcon)bucketIcon).getIconHeight(), 0.1f);
GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));
ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)fluidIcon).getMinU(), ((IIcon)fluidIcon).getMinV(), ((IIcon)fluidIcon).getMaxU(), ((IIcon)fluidIcon).getMaxV(), ((IIcon)fluidIcon).getIconWidth(), ((IIcon)fluidIcon).getIconHeight(), 0.1f);
GL11.glColor3f(1f, 1f, 1f);
}
}
示例3: renderItem
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
IIcon icon = item.getIconIndex();
GL11.glPushMatrix();
if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
GL11.glTranslatef(1.3f, .3f, 0);
GL11.glRotated(210, 0, 0, 1);
GL11.glRotated(180, 1, 0, 0);
ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)icon).getMinU(), ((IIcon)icon).getMinV(), ((IIcon)icon).getMaxU(), ((IIcon)icon).getMaxV(), ((IIcon)icon).getIconWidth(), ((IIcon)icon).getIconHeight(), 0.1f);
}
else if(type == ItemRenderType.EQUIPPED) {
GL11.glTranslatef(0.7f, 1.3f, 0);
GL11.glRotated(-70, 0, 0, 1);
GL11.glRotated(180, 1, 0, 0);
ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)icon).getMinU(), ((IIcon)icon).getMinV(), ((IIcon)icon).getMaxU(), ((IIcon)icon).getMaxV(), ((IIcon)icon).getIconWidth(), ((IIcon)icon).getIconHeight(), 0.1f);
}
GL11.glPopMatrix();
}
示例4: renderCore
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
public static void renderCore(EntityGolemBase golem, AdditionalGolemCore core) {
GL11.glPushMatrix();
GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslatef(0.0875F, -0.96F, 0.15F + (golem.getGolemDecoration().contains("P") ? 0.03F : 0.0F));
GL11.glScaled(0.175D, 0.175D, 0.175D);
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
ItemStack coreItem = core.getItem();
IIcon icon = coreItem.getItem().getIcon(coreItem, 0);
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMinU();
float f4 = icon.getMaxV();
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F);
GL11.glPopMatrix();
}
示例5: renderItem
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
EntityClientPlayerMP player = ((EntityClientPlayerMP) data[1]);
float scopeMult = Math.min((FarragoMod.scopeTicks+ClientProxy.timer.renderPartialTicks)/5f, 1.0f);
GL11.glTranslatef(1.0f, 0f, 0f);
GL11.glRotatef(180F, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(180F, 0.0f, 0.0f, 1.0f);
if (FarragoMod.scoped) {
if (player.isUsingItem()) {
GL11.glTranslatef(0f, scopeMult*-0.5f, scopeMult*0.4f);
GL11.glRotatef(5F, 0.0f, scopeMult, 0.0f);
GL11.glRotatef(10F, scopeMult, 0.0f, 0.0f);
} else {
GL11.glTranslatef(0f, 0f, scopeMult);
GL11.glRotatef(-2F, scopeMult, scopeMult, 0.0f);
}
}
IIcon icon = item.getItem().getIcon(item, 0, player, player.getItemInUse(), player.getItemInUseCount());
ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMinU(), icon.getMinV(), icon.getMaxU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625f);
}
示例6: renderRack
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
private void renderRack(TileEntityOven tile, int x, int y, int w, int h,
int tw, int th) {
Minecraft mc = Minecraft.getMinecraft();
float f = 0.01F / (float) tw;
float f1 = 0.01F / (float) th;
float x1 = (float) x / (float) tw + f;
float x2 = (float) (x + w) / tw - f;
float y1 = (float) y / th + f1;
float y2 = (float) (y + h) / th - f1;
Tessellator image = Tessellator.instance;
float xPos = 0.5F;
float yPos = 0.0F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
float var13 = 1F;
GL11.glScalef(var13, var13, var13);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1F, -1F, 0.0F);
ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);
}
示例7: renderWheel
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
private void renderWheel(TileEntityTripHammer tile, int x, int y, int w, int h, int tw, int th) {
Minecraft mc = Minecraft.getMinecraft();
float f = 0.01F / (float)tw;
float f1 = 0.01F / (float)th;
float x1 = (float)x / (float)tw + f;
float x2 = (float)(x + w) / tw - f;
float y1 = (float)y / th + f1;
float y2 = (float)(y + h) / th - f1;
Tessellator image = Tessellator.instance;
float xPos = 0.5F;
float yPos = 0.5F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
float var13 = 1F;
GL11.glScalef(var13, var13, var13);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1F, -1F, 0.0F);
ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);
}
示例8: renderWheel
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
private void renderWheel(TileEntitySpinningWheel tile, int x, int y, int w, int h, int tw, int th) {
Minecraft mc = Minecraft.getMinecraft();
float f = 0.01F / (float)tw;
float f1 = 0.01F / (float)th;
float x1 = (float)x / (float)tw + f;
float x2 = (float)(x + w) / tw - f;
float y1 = (float)y / th + f1;
float y2 = (float)(y + h) / th - f1;
Tessellator image = Tessellator.instance;
float xPos = 0.5F;
float yPos = 0.5F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
float var13 = 1F;
GL11.glScalef(var13, var13, var13);
GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-1F, -1F, 0.0F);
ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);
}
示例9: renderItem
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
float mult = 1;
if (type == ItemRenderType.INVENTORY) {
mult = 16;
}
if (Minecraft.getMinecraft().thePlayer != null) {
rand.setSeed((int)((Minecraft.getMinecraft().thePlayer.ticksExisted+ClientProxy.timer.renderPartialTicks)*100)*item.hashCode());
}
IIcon icon = item.getIconIndex();
for (int i = 0; i < rand.nextInt(80)+30; i++) {
GL11.glPushMatrix();
GL11.glScalef(mult*rand.nextFloat(), mult*rand.nextFloat(), 0);
GL11.glTranslatef((mult*((rand.nextFloat()*4)-2)), (mult*((rand.nextFloat()*4)-2)), (mult*((rand.nextFloat()*4)-2)));
ItemRenderer.renderItemIn2D(Tessellator.instance, rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), icon.getIconWidth(), icon.getIconHeight(), rand.nextFloat());
GL11.glPopMatrix();
}
}
示例10: render3D
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
public void render3D(ItemStack item) {
glPushMatrix();
IIcon icon = item.getItem().getIcon(item, 0);
if (icon == null)
return;
Tessellator tess = Tessellator.instance;
float uv1 = icon.getMinU();
float uv2 = icon.getMaxU();
float uv3 = icon.getMinV();
float uv4 = icon.getMaxV();
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glColor4f(1f, 1f, 1f, 0.5f);
ItemRenderer.renderItemIn2D(tess, uv2, uv3, uv1, uv4, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
glColor4f(1f, 1f, 1f, 1f);
glDisable(GL_BLEND);
glPopMatrix();
}
示例11: renderItem
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
FMLClientHandler.instance().getClient().renderEngine
.bindTexture("/gui/items.png");
Icon icon = item.getItem().getIcon(item, 0);
Tessellator tessellator = Tessellator.instance;
float f = icon.getMinU();
float f1 = icon.getMaxU();
float f2 = icon.getMinV();
float f3 = icon.getMaxV();
float f4 = 0.0F;
float f5 = 0.3F;
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
GL11.glTranslatef(-f4, -f5, 0.0F);
float f6 = 1.5F;
GL11.glScalef(f6, f6, f6);
GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3,
icon.getSheetWidth(), icon.getSheetHeight(), 0.0625F);
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
}
示例12: renderSign
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
private void renderSign() {
final IIcon iicon = Items.sign.getIconFromDamage(0);
TextureUtil.func_152777_a(false, false, 1f);
final float f = iicon.getMinU();
final float f1 = iicon.getMaxU();
final float f2 = iicon.getMinV();
final float f3 = iicon.getMaxV();
ItemRenderer.renderItemIn2D(WRenderer.t, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625f);
}
示例13: render3DTexture
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
public void render3DTexture(int index, float thickness)
{
Tessellator tess = Tessellator.instance;
float var9 = (float)(index % 16 * 16 + 0) / 256.0F;
float var10 = (float)(index % 16 * 16 + 16) / 256.0F;
float var11 = (float)(index / 16 * 16 + 0) / 256.0F;
float var12 = (float)(index / 16 * 16 + 16) / 256.0F;
ItemRenderer.renderItemIn2D(tess, var10, var11, var9, var12, 256, 256, thickness);
}
示例14: renderOverlayEquip
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
public static void renderOverlayEquip(ResourceLocation src) {
//Setup
GL11.glDepthFunc(GL11.GL_EQUAL);
GL11.glDisable(GL11.GL_LIGHTING);
loadTexture(src);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
float f7 = 0.76F;
GL11.glMatrixMode(GL11.GL_TEXTURE);
//Push texture mat
GL11.glPushMatrix();
float f8 = 0.125F;
GL11.glScalef(f8, f8, f8);
float f9 = GameTimer.getAbsTime() % 3000L / 3000.0F * 8.0F;
GL11.glTranslatef(f9, 0.0F, 0.0F); //xOffset loops between 0.0 and 8.0
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
//Second pass
GL11.glPushMatrix();
GL11.glScalef(f8, f8, f8);
f9 = GameTimer.getAbsTime() % 4873L / 4873.0F * 8.0F; //Loop between 0 and 8, longer loop
GL11.glTranslatef(-f9, 0.0F, 0.0F); //Still xOffset
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); //However, different rotation!
ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
GL11.glPopMatrix();
//Pop texture mat
GL11.glMatrixMode(GL11.GL_MODELVIEW);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
示例15: renderEquipped
import net.minecraft.client.renderer.ItemRenderer; //导入方法依赖的package包/类
private void renderEquipped(ItemStack stack) {
GL11.glPushMatrix();
Tessellator tessellator = Tessellator.instance;
int meta = stack.getItemDamage();
for (int pass = 0; pass < stack.getItem().getRenderPasses(meta); ++pass) {
IIcon icon = stack.getItem().getIconFromDamageForRenderPass(meta, pass);
if (icon == null) {
continue;
}
if (renderItem.renderWithColor) {
int color = stack.getItem().getColorFromItemStack(stack, pass);
float c1 = (float) (color >> 16 & 255) / 255.0F;
float c2 = (float) (color >> 8 & 255) / 255.0F;
float c3 = (float) (color & 255) / 255.0F;
GL11.glColor4f(c1, c2, c3, 1.0F);
}
float uv1 = icon.getMinU();
float uv2 = icon.getMaxU();
float uv3 = icon.getMinV();
float uv4 = icon.getMaxV();
ItemRenderer.renderItemIn2D(tessellator, uv2, uv3, uv1, uv4, icon.getIconWidth(), icon.getIconHeight(), PIXEL);
}
GL11.glPopMatrix();
}