public static void renderItemWithTransform(World world, ItemStack stack,
ItemCameraTransforms.TransformType transform)
{
GlStateManager.pushMatrix();
GlStateManager.pushAttrib();
GlStateManager.enableCull();
GlStateManager.depthMask(true);
RenderHelper.enableStandardItemLighting();
GlStateManager.enableAlpha();
GlStateManager.enableRescaleNormal();
GlStateManager.alphaFunc(516, 0.1F);
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA,
GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE,
GlStateManager.DestFactor.ZERO);
IBakedModel ibakedmodel = Minecraft.getMinecraft().getRenderItem().getItemModelWithOverrides(stack, world,
(EntityLivingBase) null);
IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(ibakedmodel,
transform, false);
Minecraft.getMinecraft().getRenderItem().renderItem(stack, transformedModel);
GlStateManager.disableBlend();
GlStateManager.disableAlpha();
RenderHelper.disableStandardItemLighting();
GlStateManager.depthMask(false);
GlStateManager.disableCull();
GlStateManager.popAttrib();
GlStateManager.popMatrix();
}
java类net.minecraft.client.renderer.RenderHelper的实例源码
GLHelper.java 文件源码
项目:ArcaneMagic
阅读 23
收藏 0
点赞 0
评论 0
ArcaneTransfigurationTableTESR.java 文件源码
项目:ArcaneMagic
阅读 22
收藏 0
点赞 0
评论 0
private void renderItem(ItemStack stack, int slot)
{
if (stack != null && !stack.isEmpty())
{
int slotX = slot;
int slotY = 0;
if (slot >= 6)
{
slotX = slot - 6;
slotY = 2;
} else if (slot >= 3)
{
slotX = slot - 3;
slotY = 1;
}
RenderHelper.enableStandardItemLighting();
GlStateManager.enableLighting();
GlStateManager.pushMatrix();
GlStateManager.translate((slotX / 5.35d) + 0.315, .675, (slotY / 5.35d) + 0.315);
GlStateManager.scale(.1f, .1f, .1f);
if (!(stack.getItem() instanceof ItemBlock))
{
GlStateManager.rotate(-90, 1, 0, 0);
GlStateManager.translate(0, 0, -0.5);
}
Minecraft.getMinecraft().getRenderItem().renderItem(stack, ItemCameraTransforms.TransformType.NONE);
GlStateManager.popMatrix();
}
}
TomeGui.java 文件源码
项目:Randores2
阅读 18
收藏 0
点赞 0
评论 0
public void renderItem(ItemStack stack, int x, int y) {
RenderHelper.disableStandardItemLighting();
RenderHelper.enableGUIStandardItemLighting();
this.getItem().renderItemAndEffectIntoGUI(this.mc.player, stack, x, y);
this.getItem().renderItemOverlayIntoGUI(this.getFont(), stack, x, y, this.det(stack));
RenderHelper.enableStandardItemLighting();
}
EntityLargeExplodeFX.java 文件源码
项目:DecompiledMinecraft
阅读 21
收藏 0
点赞 0
评论 0
/**
* Renders the particle
*/
public void renderParticle(WorldRenderer worldRendererIn, Entity entityIn, float partialTicks, float p_180434_4_, float p_180434_5_, float p_180434_6_, float p_180434_7_, float p_180434_8_)
{
int i = (int)(((float)this.field_70581_a + partialTicks) * 15.0F / (float)this.field_70584_aq);
if (i <= 15)
{
this.theRenderEngine.bindTexture(EXPLOSION_TEXTURE);
float f = (float)(i % 4) / 4.0F;
float f1 = f + 0.24975F;
float f2 = (float)(i / 4) / 4.0F;
float f3 = f2 + 0.24975F;
float f4 = 2.0F * this.field_70582_as;
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
RenderHelper.disableStandardItemLighting();
worldRendererIn.begin(7, field_181549_az);
worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
worldRendererIn.pos((double)(f5 - p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 - p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 + p_180434_7_ * f4), (double)(f6 + p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 + p_180434_8_ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
worldRendererIn.pos((double)(f5 + p_180434_4_ * f4 - p_180434_7_ * f4), (double)(f6 - p_180434_5_ * f4), (double)(f7 + p_180434_6_ * f4 - p_180434_8_ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
Tessellator.getInstance().draw();
GlStateManager.enableLighting();
}
}
ParticleExplosionLarge.java 文件源码
项目:CustomWorldGen
阅读 16
收藏 0
点赞 0
评论 0
/**
* Renders the particle
*/
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ)
{
int i = (int)(((float)this.life + partialTicks) * 15.0F / (float)this.lifeTime);
if (i <= 15)
{
this.theRenderEngine.bindTexture(EXPLOSION_TEXTURE);
float f = (float)(i % 4) / 4.0F;
float f1 = f + 0.24975F;
float f2 = (float)(i / 4) / 4.0F;
float f3 = f2 + 0.24975F;
float f4 = 2.0F * this.size;
float f5 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)partialTicks - interpPosX);
float f6 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)partialTicks - interpPosY);
float f7 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)partialTicks - interpPosZ);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableLighting();
RenderHelper.disableStandardItemLighting();
worldRendererIn.begin(7, VERTEX_FORMAT);
worldRendererIn.pos((double)(f5 - rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 - rotationYZ * f4 - rotationXZ * f4)).tex((double)f1, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
worldRendererIn.pos((double)(f5 - rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 - rotationYZ * f4 + rotationXZ * f4)).tex((double)f1, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
worldRendererIn.pos((double)(f5 + rotationX * f4 + rotationXY * f4), (double)(f6 + rotationZ * f4), (double)(f7 + rotationYZ * f4 + rotationXZ * f4)).tex((double)f, (double)f2).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
worldRendererIn.pos((double)(f5 + rotationX * f4 - rotationXY * f4), (double)(f6 - rotationZ * f4), (double)(f7 + rotationYZ * f4 - rotationXZ * f4)).tex((double)f, (double)f3).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).normal(0.0F, 1.0F, 0.0F).endVertex();
Tessellator.getInstance().draw();
GlStateManager.enableLighting();
}
}
GuiCreateFlatWorld.java 文件源码
项目:DecompiledMinecraft
阅读 18
收藏 0
点赞 0
评论 0
private void func_148225_a(int p_148225_1_, int p_148225_2_, ItemStack p_148225_3_)
{
this.func_148226_e(p_148225_1_ + 1, p_148225_2_ + 1);
GlStateManager.enableRescaleNormal();
if (p_148225_3_ != null && p_148225_3_.getItem() != null)
{
RenderHelper.enableGUIStandardItemLighting();
GuiCreateFlatWorld.this.itemRender.renderItemIntoGUI(p_148225_3_, p_148225_1_ + 2, p_148225_2_ + 2);
RenderHelper.disableStandardItemLighting();
}
GlStateManager.disableRescaleNormal();
}
GuiIngame.java 文件源码
项目:DecompiledMinecraft
阅读 24
收藏 0
点赞 0
评论 0
protected void renderTooltip(ScaledResolution sr, float partialTicks)
{
if (this.mc.getRenderViewEntity() instanceof EntityPlayer)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(widgetsTexPath);
EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity();
int i = sr.getScaledWidth() / 2;
float f = this.zLevel;
this.zLevel = -90.0F;
this.drawTexturedModalRect(i - 91, sr.getScaledHeight() - 22, 0, 0, 182, 22);
this.drawTexturedModalRect(i - 91 - 1 + entityplayer.inventory.currentItem * 20, sr.getScaledHeight() - 22 - 1, 0, 22, 24, 22);
this.zLevel = f;
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
RenderHelper.enableGUIStandardItemLighting();
for (int j = 0; j < 9; ++j)
{
int k = sr.getScaledWidth() / 2 - 90 + j * 20 + 2;
int l = sr.getScaledHeight() - 16 - 3;
this.renderHotbarItem(j, k, l, partialTicks, entityplayer);
}
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
}
}
GuiInventory.java 文件源码
项目:CustomWorldGen
阅读 23
收藏 0
点赞 0
评论 0
/**
* Draws an entity on the screen looking toward the cursor.
*/
public static void drawEntityOnScreen(int posX, int posY, int scale, float mouseX, float mouseY, EntityLivingBase ent)
{
GlStateManager.enableColorMaterial();
GlStateManager.pushMatrix();
GlStateManager.translate((float)posX, (float)posY, 50.0F);
GlStateManager.scale((float)(-scale), (float)scale, (float)scale);
GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
float f = ent.renderYawOffset;
float f1 = ent.rotationYaw;
float f2 = ent.rotationPitch;
float f3 = ent.prevRotationYawHead;
float f4 = ent.rotationYawHead;
GlStateManager.rotate(135.0F, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GlStateManager.rotate(-135.0F, 0.0F, 1.0F, 0.0F);
GlStateManager.rotate(-((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
ent.renderYawOffset = (float)Math.atan((double)(mouseX / 40.0F)) * 20.0F;
ent.rotationYaw = (float)Math.atan((double)(mouseX / 40.0F)) * 40.0F;
ent.rotationPitch = -((float)Math.atan((double)(mouseY / 40.0F))) * 20.0F;
ent.rotationYawHead = ent.rotationYaw;
ent.prevRotationYawHead = ent.rotationYaw;
GlStateManager.translate(0.0F, 0.0F, 0.0F);
RenderManager rendermanager = Minecraft.getMinecraft().getRenderManager();
rendermanager.setPlayerViewY(180.0F);
rendermanager.setRenderShadow(false);
rendermanager.doRenderEntity(ent, 0.0D, 0.0D, 0.0D, 0.0F, 1.0F, false);
rendermanager.setRenderShadow(true);
ent.renderYawOffset = f;
ent.rotationYaw = f1;
ent.rotationPitch = f2;
ent.prevRotationYawHead = f3;
ent.rotationYawHead = f4;
GlStateManager.popMatrix();
RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.setActiveTexture(OpenGlHelper.lightmapTexUnit);
GlStateManager.disableTexture2D();
GlStateManager.setActiveTexture(OpenGlHelper.defaultTexUnit);
}
GuiContainerCreative.java 文件源码
项目:DecompiledMinecraft
阅读 26
收藏 0
点赞 0
评论 0
/**
* Args : renderPartialTicks, mouseX, mouseY
*/
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
{
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
RenderHelper.enableGUIStandardItemLighting();
CreativeTabs creativetabs = CreativeTabs.creativeTabArray[selectedTabIndex];
for (CreativeTabs creativetabs1 : CreativeTabs.creativeTabArray)
{
this.mc.getTextureManager().bindTexture(creativeInventoryTabs);
if (creativetabs1.getTabIndex() != selectedTabIndex)
{
this.func_147051_a(creativetabs1);
}
}
this.mc.getTextureManager().bindTexture(new ResourceLocation("textures/gui/container/creative_inventory/tab_" + creativetabs.getBackgroundImageName()));
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
this.searchField.drawTextBox();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int i = this.guiLeft + 175;
int j = this.guiTop + 18;
int k = j + 112;
this.mc.getTextureManager().bindTexture(creativeInventoryTabs);
if (creativetabs.shouldHidePlayerInventory())
{
this.drawTexturedModalRect(i, j + (int)((float)(k - j - 17) * this.currentScroll), 232 + (this.needsScrollBars() ? 0 : 12), 0, 12, 15);
}
this.func_147051_a(creativetabs);
if (creativetabs == CreativeTabs.tabInventory)
{
GuiInventory.drawEntityOnScreen(this.guiLeft + 43, this.guiTop + 45, 20, (float)(this.guiLeft + 43 - mouseX), (float)(this.guiTop + 45 - 30 - mouseY), this.mc.thePlayer);
}
}
EventHandler.java 文件源码
项目:ItemZoom
阅读 21
收藏 0
点赞 0
评论 0
private static void renderZoomedStack(ItemStack itemStack, GuiContainer guiContainer, Minecraft minecraft) {
ScaledResolution scaledResolution = new ScaledResolution(minecraft);
final float scale = Config.getZoomAmount() / 100f * guiContainer.getGuiLeft() / 17f; // item is 16 wide, give it some extra space on each side
final float xPosition = (guiContainer.getGuiLeft() / scale - 16f) / 2f;
final float yPosition = (scaledResolution.getScaledHeight() / scale - 16f) / 2f;
FontRenderer font = getFontRenderer(minecraft, itemStack);
GlStateManager.pushMatrix();
GlStateManager.scale(scale, scale, 1);
GlStateManager.translate(xPosition, yPosition, 0);
ZoomRenderHelper.enableGUIStandardItemLighting(scale);
minecraft.getRenderItem().zLevel += 100;
minecraft.getRenderItem().renderItemAndEffectIntoGUI(minecraft.player, itemStack, 0, 0);
renderItemOverlayIntoGUI(font, itemStack);
minecraft.getRenderItem().zLevel -= 100;
GlStateManager.disableBlend();
RenderHelper.disableStandardItemLighting();
GlStateManager.popMatrix();
if (Config.showHelpText()) {
String modName = ItemZoom.MOD_NAME;
int stringWidth = font.getStringWidth(modName);
int x = (guiContainer.getGuiLeft() - stringWidth) / 2;
int y = (scaledResolution.getScaledHeight() + Math.round(17 * scale)) / 2;
font.drawString(modName, x, y, 4210752);
if (Config.isToggledEnabled()) {
String toggleText = KeyBindings.TOGGLE.getDisplayName();
stringWidth = font.getStringWidth(toggleText);
x = (guiContainer.getGuiLeft() - stringWidth) / 2;
y += font.FONT_HEIGHT;
font.drawString(toggleText, x, y, 4210752);
}
}
}