本文整理汇总了Java中net.minecraft.client.renderer.OpenGlHelper.glBlendFunc方法的典型用法代码示例。如果您正苦于以下问题:Java OpenGlHelper.glBlendFunc方法的具体用法?Java OpenGlHelper.glBlendFunc怎么用?Java OpenGlHelper.glBlendFunc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.renderer.OpenGlHelper
的用法示例。
在下文中一共展示了OpenGlHelper.glBlendFunc方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: rect
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public static void rect(double x1, double y1, double x2, double y2, int color) {
float r = (float)(color >> 16 & 255) / 255.0f;
float g = (float)(color >> 8 & 255) / 255.0f;
float b = (float)(color & 255) / 255.0f;
float a = (float)(color >> 24 & 255) / 255.0f;
Tessellator tes = Tessellator.getInstance();
WorldRenderer t = tes.getWorldRenderer();
GL11.glEnable((int)3042);
GL11.glDisable((int)3553);
OpenGlHelper.glBlendFunc((int)770, (int)771, (int)1, (int)0);
GL11.glColor4f((float)r, (float)g, (float)b, (float)a);
t.begin(7, DefaultVertexFormats.POSITION);
t.pos(x1, y2, 0.0).endVertex();
t.pos(x2, y2, 0.0).endVertex();
t.pos(x2, y1, 0.0).endVertex();
t.pos(x1, y1, 0.0).endVertex();
tes.draw();
GL11.glEnable((int)3553);
GL11.glColor4f((float)1.0f, (float)1.0f, (float)1.0f, (float)1.0f);
GL11.glDisable((int)3042);
}
示例2: guiRendered
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@SubscribeEvent
public void guiRendered(TickEvent.RenderTickEvent evt)
{
if (CreeperHost.instance.toastText != null)
{
long curTime = System.currentTimeMillis();
if (CreeperHost.instance.fadeTime > curTime)
{
long fadeDiff = CreeperHost.instance.fadeTime - CreeperHost.instance.endTime;
long curFade = Math.min(CreeperHost.instance.fadeTime - curTime, fadeDiff);
float alpha = (float) curFade / (float) fadeDiff;
RenderHelper.disableStandardItemLighting();
GL11.glColor4f(1.0F, 1.0F, 1.0F, alpha);
mc.renderEngine.bindTexture(getToastResourceLocation());
ScaledResolution res = new ScaledResolution(mc, mc.displayWidth, mc.displayHeight);
drawTexturedModalRect(res.getScaledWidth() - 160, 0, u, v, 160, 32);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
int textColour = (0xFFFFFF << 32) | ((int) (alpha * 255) << 24);
mc.fontRenderer.drawSplitString(CreeperHost.instance.toastText, res.getScaledWidth() - 160 + 5, 6, 160, textColour);
}
else
{
CreeperHost.instance.toastText = null;
}
}
}
示例3: drawGradientRect
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
private void drawGradientRect(int zLevel, int p_73733_1_, int p_73733_2_, int p_73733_3_, int p_73733_4_, int p_73733_5_, int p_73733_6_)
{
float f = (float) (p_73733_5_ >> 24 & 255) / 255.0F;
float f1 = (float) (p_73733_5_ >> 16 & 255) / 255.0F;
float f2 = (float) (p_73733_5_ >> 8 & 255) / 255.0F;
float f3 = (float) (p_73733_5_ & 255) / 255.0F;
float f4 = (float) (p_73733_6_ >> 24 & 255) / 255.0F;
float f5 = (float) (p_73733_6_ >> 16 & 255) / 255.0F;
float f6 = (float) (p_73733_6_ >> 8 & 255) / 255.0F;
float f7 = (float) (p_73733_6_ & 255) / 255.0F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(f1, f2, f3, f);
tessellator.addVertex((double) p_73733_3_, (double) p_73733_2_, (double) zLevel);
tessellator.addVertex((double) p_73733_1_, (double) p_73733_2_, (double) zLevel);
tessellator.setColorRGBA_F(f5, f6, f7, f4);
tessellator.addVertex((double) p_73733_1_, (double) p_73733_4_, (double) zLevel);
tessellator.addVertex((double) p_73733_3_, (double) p_73733_4_, (double) zLevel);
tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
示例4: drawButton
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@Override
public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_)
{
if (this.visible)
{
FontRenderer fontrenderer = p_146112_1_.fontRenderer;
p_146112_1_.getTextureManager().bindTexture(GuiStaticVariables.buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, this.yPosition, 0, 46 + k * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.xPosition + this.width / 2, this.yPosition, 200 - this.width / 2, 46 + k * 20, this.width / 2, this.height);
this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
int l = 14737632;
if (packedFGColour != 0)
{
l = packedFGColour;
}
else if (!this.enabled)
{
l = 10526880;
}
else if (this.field_146123_n)
{
l = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
}
}
示例5: drawGradientRect
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
protected void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6)
{
float f = (float)(par5 >> 24 & 255) / 255.0F;
float f1 = (float)(par5 >> 16 & 255) / 255.0F;
float f2 = (float)(par5 >> 8 & 255) / 255.0F;
float f3 = (float)(par5 & 255) / 255.0F;
float f4 = (float)(par6 >> 24 & 255) / 255.0F;
float f5 = (float)(par6 >> 16 & 255) / 255.0F;
float f6 = (float)(par6 >> 8 & 255) / 255.0F;
float f7 = (float)(par6 & 255) / 255.0F;
GL11.glDisable(GL11.GL_TEXTURE_2D);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_ALPHA_TEST);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glShadeModel(GL11.GL_SMOOTH);
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.setColorRGBA_F(f1, f2, f3, f);
tessellator.addVertex((double)par3, (double)par2, 0.0D);
tessellator.addVertex((double)par1, (double)par2, 0.0D);
tessellator.setColorRGBA_F(f5, f6, f7, f4);
tessellator.addVertex((double)par1, (double)par4, 0.0D);
tessellator.addVertex((double)par3, (double)par4, 0.0D);
tessellator.draw();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_TEXTURE_2D);
}
示例6: renderTileEntityAt
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@Override
public void renderTileEntityAt(TileEntityPictureFrameMultiple frame, double x, double y, double z,
float partialTicks, int destroyStage) {
if (frame.shouldrender) {
// 1:normal 2:failtoload 3:loding
int rendertype = 0;
if (frame.istextureLoaded()) {
if (frame.textureID != -1) {
rendertype = 1;
}
} else {
if (frame.hasImageName()) {
if (frame.canLoadImage()) {
frame.loadImage();
}
if (frame.isFailed()) {
rendertype = 2;
} else {
rendertype = 3;
}
}
}
//render
if (rendertype > 0) {
boolean flippedX = false;
boolean flippedY = false;
GlStateManager.enableBlend();
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GlStateManager.disableLighting();
GlStateManager.color(1, 1, 1, 1);
switch (rendertype) {
case 1:
GlStateManager.bindTexture(frame.textureID);
break;
case 2:
Minecraft.getMinecraft().getTextureManager().bindTexture(PictureFactory.FailToLoadImage);
break;
case 3:
Minecraft.getMinecraft().getTextureManager().bindTexture(PictureFactory.LODINGIMAGE);
break;
default:
return;
}
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_NEAREST);
GL11.glTexParameteri(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_NEAREST);
GlStateManager.pushMatrix();
GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
EnumFacing direction = EnumFacing.getFront(frame.getBlockMetadata() & 3);
EnumStateType stateType = EnumStateType.HANDGING;
applyDirection(direction);
GlStateManager.enableRescaleNormal();
GL11.glTranslated(0, (frame.height - 1) * 0.5, (frame.width - 1) * -0.5);
GL11.glScaled(1, frame.height - 0.4, frame.width - 0.4);
GL11.glTranslated(-0.93, 0, 0);
GL11.glBegin(GL11.GL_POLYGON);
GL11.glNormal3f(1.0f, 0.0F, 0.0f);
GL11.glTexCoord3f(flippedY ? 0 : 1, flippedX ? 0 : 1, 0);
GL11.glVertex3f(0.5F, -0.5f, -0.5f);
GL11.glTexCoord3f(flippedY ? 0 : 1, flippedX ? 1 : 0, 0);
GL11.glVertex3f(0.5f, 0.5f, -0.5f);
GL11.glTexCoord3f(flippedY ? 1 : 0, flippedX ? 1 : 0, 0);
GL11.glVertex3f(0.5f, 0.5f, 0.5f);
GL11.glTexCoord3f(flippedY ? 1 : 0, flippedX ? 0 : 1, 0);
GL11.glVertex3f(0.5f, -0.5f, 0.5f);
GL11.glEnd();
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
GlStateManager.enableLighting();
}
}
}
示例7: drawScreen
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public void drawScreen()
{
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_FOG);
Tessellator tessellator = Tessellator.instance;
this.mc.getTextureManager().bindTexture(Gui.optionsBackground);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
float f1 = 32.0F;
tessellator.startDrawingQuads();
tessellator.setColorOpaque_I(2105376);
tessellator.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, (double) ((float) this.left / f1), (double) ((float) this.bottom / f1));
tessellator.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, (double) ((float) this.right / f1), (double) ((float) this.bottom / f1));
tessellator.addVertexWithUV((double) this.right, (double) this.top, 0.0D, (double) ((float) this.right / f1), (double) ((float) this.top / f1));
tessellator.addVertexWithUV((double) this.left, (double) this.top, 0.0D, (double) ((float) this.left / f1), (double) ((float) this.top / f1));
tessellator.draw();
GL11.glDisable(GL11.GL_DEPTH_TEST);
byte b0 = 4;
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 0, 1);
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glShadeModel(GL11.GL_SMOOTH);
GL11.glDisable(GL11.GL_TEXTURE_2D);
tessellator.startDrawingQuads();
tessellator.setColorRGBA_I(0, 0);
tessellator.addVertexWithUV((double) this.left, (double) (this.top + b0), 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV((double) this.right, (double) (this.top + b0), 0.0D, 1.0D, 1.0D);
tessellator.setColorRGBA_I(0, 255);
tessellator.addVertexWithUV((double) this.right, (double) this.top, 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double) this.left, (double) this.top, 0.0D, 0.0D, 0.0D);
tessellator.draw();
tessellator.startDrawingQuads();
tessellator.setColorRGBA_I(0, 255);
tessellator.addVertexWithUV((double) this.left, (double) this.bottom, 0.0D, 0.0D, 1.0D);
tessellator.addVertexWithUV((double) this.right, (double) this.bottom, 0.0D, 1.0D, 1.0D);
tessellator.setColorRGBA_I(0, 0);
tessellator.addVertexWithUV((double) this.right, (double) (this.bottom - b0), 0.0D, 1.0D, 0.0D);
tessellator.addVertexWithUV((double) this.left, (double) (this.bottom - b0), 0.0D, 0.0D, 0.0D);
tessellator.draw();
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glDisable(GL11.GL_BLEND);
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
int titleWidth = fontRenderer.getStringWidth(title);
fontRenderer.drawStringWithShadow(title, this.left + ((this.right - this.left) / 2) - (titleWidth / 2), this.top + 2, 0xFFFFFF);
int topStart = this.top + 15;
for (String line : lines)
{
if (centeredF)
{
int stringWidth = fontRenderer.getStringWidth(line);
fontRenderer.drawStringWithShadow(line, this.left + ((this.right - this.left) / 2) - (stringWidth / 2), topStart, 0xFFFFFF);
}
else
{
fontRenderer.drawStringWithShadow(line, this.left, topStart, 0xFFFFFF);
}
topStart += 10;
}
}
示例8: drawButton
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@Override
public void drawButton(Minecraft mc, int x, int y)
{
if (this.visible)
{
int drawY = yPosition;
FontRenderer fontrenderer = mc.fontRenderer;
mc.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = x >= this.xPosition && y >= drawY && x < this.xPosition + this.width && y < drawY + this.height;
int i = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
this.drawTexturedModalRect(this.xPosition, drawY, 0, 46 + i * 20, this.width / 2, this.height);
this.drawTexturedModalRect(this.xPosition + this.width / 2, drawY, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
this.mouseDragged(mc, x, y);
int j = 14737632;
if (packedFGColour != 0)
{
j = packedFGColour;
}
else if (!this.enabled)
{
j = 10526880;
}
else if (this.field_146123_n)
{
j = 16777120;
}
this.drawCenteredString(fontrenderer, this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, j);
if (dropdownOpen)
{
drawY += 1;
for (E e : possibleVals)
{
drawY += height - 2;
boolean ourHovered = x >= this.xPosition && y >= drawY && x < this.xPosition + this.width && y < drawY + this.height - 2;
int subHovered = ourHovered ? 2 : 0;
mc.getTextureManager().bindTexture(buttonTextures);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.drawTexturedModalRect(this.xPosition, drawY, 0, 46 + subHovered * 20 + 1, this.width / 2, this.height - 1);
this.drawTexturedModalRect(this.xPosition + this.width / 2, drawY, 200 - this.width / 2, 46 + subHovered * 20 + 1, this.width / 2, this.height - 1);
String name = I18n.format(translateBase + e.name().toLowerCase());
int textColour = 14737632;
if (packedFGColour != 0)
{
textColour = packedFGColour;
}
else if (ourHovered)
{
textColour = 16777120;
}
this.drawCenteredString(fontrenderer, name, this.xPosition + this.width / 2, drawY + (this.height - 10) / 2, textColour);
}
}
}
}
示例9: drawButton
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@Override
public void drawButton(Minecraft p_146112_1_, int p_146112_2_, int p_146112_3_)
{
if ( ! gradientFlag ) {
super.drawButton(p_146112_1_, p_146112_2_, p_146112_3_);
return ;
}
if (this.visible)
{
FontRenderer fontrenderer = p_146112_1_.fontRenderer;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
this.field_146123_n = p_146112_2_ >= this.xPosition && p_146112_3_ >= this.yPosition && p_146112_2_ < this.xPosition + this.width && p_146112_3_ < this.yPosition + this.height;
int k = this.getHoverState(this.field_146123_n);
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if ( pressed ) {
k = 0 ;
}
int rgba = ( k == 0 ? -939458303 : k == 1 ? 1761673473 : -1694433023);// -1694433023 ) ;
this.drawGradientRect ( xPosition, yPosition, xPosition + width, yPosition+height, gradientVector ? 0 : rgba, gradientVector ? rgba : 0);
this.mouseDragged(p_146112_1_, p_146112_2_, p_146112_3_);
int l = 14737632;
if (packedFGColour != 0)
{
l = packedFGColour;
}
else if (!this.enabled || pressed)
{
l = -1258291201;
}
else if (this.field_146123_n)
{
l = -587202561;
}
this.drawCenteredString(fontrenderer, ( ( underlineFlag ? ( k > 1 || ( field_146123_n && stuckFlag ) ) : false ) ? EnumChatFormatting.UNDERLINE : "" ) + this.displayString, this.xPosition + this.width / 2, this.yPosition + (this.height - 8) / 2, l);
}
}
示例10: renderItem
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
ResourceLocation resource = textureManager.getResourceLocation(stack.getItemSpriteNumber());
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
ItemStack usingItem = player.getItemInUse();
int useRemaining = player.getItemInUseCount();
ItemBow bow = (ItemBow) stack.getItem();
IIcon icon = bow.getIcon(stack, 0);
if (usingItem != null && usingItem == stack) {
int charge = stack.getMaxItemUseDuration() - useRemaining;
if (charge >= 18)
icon = bow.getItemIconForUseDuration(2);
else if (charge > 13)
icon = bow.getItemIconForUseDuration(1);
else if (charge > 0)
icon = bow.getItemIconForUseDuration(0);
}
if (icon == null)
icon = ((TextureMap) textureManager.getTexture(resource)).getAtlasSprite("missingno");
OpenGLHelper.pushMatrix();
textureManager.bindTexture(resource);
OpenGLHelper.colour(bow.getColorFromItemStack(stack, 0));
OpenGLHelper.disableLighting();
OpenGLHelper.enableAlpha();
OpenGLHelper.enableBlend();
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
renderItem.renderIcon(0, 0, icon, 16, 16);
OpenGLHelper.enableLighting();
OpenGLHelper.disableAlpha();
OpenGLHelper.disableBlend();
if (stack.hasEffect(0))
renderItem.renderEffect(textureManager, 0, 0);
OpenGLHelper.popMatrix();
}
示例11: renderPlayer
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void renderPlayer(RenderPlayerEvent.Post event) {
ItemStack stack=event.getEntityPlayer().getHeldItemMainhand();
if(event.getEntity().getDataManager().get(SPIN_TIME)){
GlStateManager.popMatrix();
if(!stack.isEmpty()&&!event.getEntity().isInvisible()){
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder renderer = tessellator.getBuffer();
GlStateManager.pushMatrix();
GlStateManager.translate((float) 0, (float) 0 + 0.1D, (float) 0);
// GL11.glRotatef((living.prevRotationYawHead +
// (living.rotationYawHead - living.prevRotationYawHead) *
// p_76986_9_)*-1, 0.0F, 1.0F, 0.0F);
// GL11.glRotatef((living.prevRotationPitch + (living.rotationPitch
// - living.prevRotationPitch) * p_76986_9_), 1.0F, 0.0F, 0.0F);
// GlStateManager.disableTexture2D();
int cooldown=getSpinCooldown(stack,event.getEntityPlayer());
double range=SpinToWin.range + EnchantmentHelper.getEnchantmentLevel(ench, stack)*0.36+0.1;
float alpha= 0.3f + (float)((this.getDuration(stack, event.getEntityPlayer())-event.getEntityPlayer().getEntityData().getInteger("SpinTime"))%cooldown)/(float)cooldown*0.5f;
Minecraft.getMinecraft().getTextureManager().bindTexture(SPIN_TEXTURE);
GlStateManager.disableLighting();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
if(isSword(stack.getItem()))
GlStateManager.color(0.8F, 0.65F, 0.4F, alpha);
else
GlStateManager.color(0.6F, 0.18F, 0.1F, alpha);
/*
* if(TF2weapons.getTeamForDisplay(living)==0){ GL11.glColor4f(1.0F,
* 0.0F, 0.0F, 0.28F); } else{ GL11.glColor4f(0.0F, 0.0F, 1.0F,
* 0.28F); }
*/
renderer.begin(7, DefaultVertexFormats.POSITION_TEX);
renderer.pos(-range, 0.0D, range).tex(0D, 1D).endVertex();
renderer.pos(range, 0.0D, range).tex(1D, 1D).endVertex();
renderer.pos(range, 0.0D, -range).tex(1D, 0.0D).endVertex();
renderer.pos(-range, 0.0D, -range).tex(0D, 0.0D).endVertex();
tessellator.draw();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
GL11.glDisable(GL11.GL_BLEND);
// GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
}
}
示例12: doRender
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@Override
public void doRender(EntityDispenser living, double p_76986_2_, double p_76986_4_, double p_76986_6_,
float p_76986_8_, float p_76986_9_) {
if (living.isConstructing())
this.mainModel = this.box;
else {
if (living.getLevel() == 1)
this.mainModel = this.level1;
else if (living.getLevel() == 2)
this.mainModel = this.level2;
else
this.mainModel = this.level3;
}
super.doRender(living, p_76986_2_, p_76986_4_, p_76986_6_, p_76986_8_, p_76986_9_);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder renderer = tessellator.getBuffer();
if (living.dispenserTarget != null)
for (EntityLivingBase target : living.dispenserTarget) {
double xPos2 = target.prevPosX + (target.posX - target.prevPosX) * p_76986_9_;
double yPos2 = target.prevPosY + (target.posY - target.prevPosY) * p_76986_9_;
double zPos2 = target.prevPosZ + (target.posZ - target.prevPosZ) * p_76986_9_;
double xDist = xPos2 - (living.prevPosX + (living.posX - living.prevPosX) * p_76986_9_);
double yDist = (yPos2 + target.height / 2)
- (living.prevPosY + (living.posY - living.prevPosY) * p_76986_9_ + living.height / 2);
double zDist = zPos2 - (living.prevPosZ + (living.posZ - living.prevPosZ) * p_76986_9_);
float f = MathHelper.sqrt(xDist * xDist + zDist * zDist);
float fullDist = MathHelper.sqrt(xDist * xDist + yDist * yDist + zDist * zDist);
GlStateManager.pushMatrix();
GlStateManager.translate((float) p_76986_2_, (float) p_76986_4_ + living.height / 2,
(float) p_76986_6_);
GL11.glRotatef((float) (Math.atan2(xDist, zDist) * 180.0D / Math.PI), 0.0F, 1.0F, 0.0F);
GL11.glRotatef((float) (Math.atan2(yDist, f) * 180.0D / Math.PI) * -1, 1.0F, 0.0F, 0.0F);
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
ClientProxy.setColor(TF2Util.getTeamColor(living), 0.23f, 0, 0f, 1f);
renderer.begin(7, DefaultVertexFormats.POSITION);
renderer.pos(-0.04, -0.04, 0).endVertex();
renderer.pos(0.04, 0.04, 0).endVertex();
renderer.pos(0.04, 0.04, fullDist).endVertex();
renderer.pos(-0.04, -0.04, fullDist).endVertex();
tessellator.draw();
renderer.begin(7, DefaultVertexFormats.POSITION);
renderer.pos(-0.04, -0.04, fullDist).endVertex();
renderer.pos(0.04, 0.04, fullDist).endVertex();
renderer.pos(0.04, 0.04, 0).endVertex();
renderer.pos(-0.04, -0.04, 0).endVertex();
tessellator.draw();
renderer.begin(7, DefaultVertexFormats.POSITION);
renderer.pos(0.04, -0.04, 0).endVertex();
renderer.pos(-0.04, 0.04, 0).endVertex();
renderer.pos(-0.04, 0.04, fullDist).endVertex();
renderer.pos(0.04, -0.04, fullDist).endVertex();
tessellator.draw();
renderer.begin(7, DefaultVertexFormats.POSITION);
renderer.pos(0.04, -0.04, fullDist).endVertex();
renderer.pos(-0.04, 0.04, fullDist).endVertex();
renderer.pos(-0.04, 0.04, 0).endVertex();
renderer.pos(0.04, -0.04, 0).endVertex();
tessellator.draw();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
GlStateManager.enableLighting();
GlStateManager.enableTexture2D();
GlStateManager.popMatrix();
}
}
示例13: doRender
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
@Override
public void doRender(EntityTeleporter living, double x, double y, double z, float rot, float partial) {
if (living.isConstructing())
this.mainModel = this.box;
else
this.mainModel = this.main;
if (living.getSoundState() == 1)
living.spinRender = living.spin
+ ((float) Math.PI * (living.getLevel() == 1 ? 0.25f : (living.getLevel() == 2 ? 0.325f : 0.4f)))
* partial;
else
living.spinRender = 0;
super.doRender(living, x, y, z, rot, partial);
if (living.getSoundState() == 1) {
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder renderer = tessellator.getBuffer();
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y + 0.23D, (float) z);
// GL11.glRotatef((living.prevRotationYawHead +
// (living.rotationYawHead - living.prevRotationYawHead) *
// p_76986_9_)*-1, 0.0F, 1.0F, 0.0F);
// GL11.glRotatef((living.prevRotationPitch + (living.rotationPitch
// - living.prevRotationPitch) * p_76986_9_), 1.0F, 0.0F, 0.0F);
// GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.7F);
/*
* if(TF2weapons.getTeamForDisplay(living)==0){ GL11.glColor4f(1.0F,
* 0.0F, 0.0F, 0.28F); } else{ GL11.glColor4f(0.0F, 0.0F, 1.0F,
* 0.28F); }
*/
renderer.begin(7, DefaultVertexFormats.POSITION_TEX);
renderer.pos(-0.5, 0.0D, 0.5).tex(0.75D, 0.5D).endVertex();
renderer.pos(0.5, 0.0D, 0.5).tex(1D, 0.5D).endVertex();
renderer.pos(0.5, 0.0D, -0.5).tex(1D, 0.0D).endVertex();
renderer.pos(-0.5, 0.0D, -0.5).tex(0.75D, 0.0D).endVertex();
tessellator.draw();
if(living.getColor() != -1) {
float[] color=EntitySheep.getDyeRgb(EnumDyeColor.byDyeDamage(living.getColor()));
GL11.glColor4f(color[0], color[1], color[2], 0.85F);
renderer.begin(7, DefaultVertexFormats.POSITION_TEX);
renderer.pos(-0.5, 0.0D, 0.5).tex(0.75D, 1D).endVertex();
renderer.pos(0.5, 0.0D, 0.5).tex(1D, 1D).endVertex();
renderer.pos(0.5, 0.0D, -0.5).tex(1D, 0.5D).endVertex();
renderer.pos(-0.5, 0.0D, -0.5).tex(0.75D, 0.5D).endVertex();
tessellator.draw();
}
GL11.glColor4f(1F, 1F, 1F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
// GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
}
示例14: renderBeam
import net.minecraft.client.renderer.OpenGlHelper; //导入方法依赖的package包/类
public static void renderBeam(EntityLivingBase ent, float partialTicks) {
if (!ent.hasCapability(TF2weapons.WEAPONS_CAP, null))
return;
// System.out.println("Drawing");
Entity healTarget = ent.world.getEntityByID(ent.getCapability(TF2weapons.WEAPONS_CAP, null).getHealTarget());
if (healTarget != null) {
Entity camera = Minecraft.getMinecraft().getRenderViewEntity();
double cameraX = camera.prevPosX + (camera.posX - camera.prevPosX) * partialTicks;
double cameraY = camera.prevPosY + (camera.posY - camera.prevPosY) * partialTicks;
double cameraZ = camera.prevPosZ + (camera.posZ - camera.prevPosZ) * partialTicks;
// System.out.println("rendering");
double xPos1 = ent.prevPosX + (ent.posX - ent.prevPosX) * partialTicks;
double yPos1 = ent.prevPosY + (ent.posY - ent.prevPosY) * partialTicks;
double zPos1 = ent.prevPosZ + (ent.posZ - ent.prevPosZ) * partialTicks;
double xPos2 = healTarget.prevPosX + (healTarget.posX - healTarget.prevPosX) * partialTicks;
double yPos2 = healTarget.prevPosY + (healTarget.posY - healTarget.prevPosY) * partialTicks;
double zPos2 = healTarget.prevPosZ + (healTarget.posZ - healTarget.prevPosZ) * partialTicks;
double xDist = xPos2 - xPos1;
double yDist = (yPos2 + (healTarget.getEntityBoundingBox().maxY - healTarget.getEntityBoundingBox().minY) / 2 + 0.1) - (yPos1 + ent.getEyeHeight() - 0.1);
double zDist = zPos2 - zPos1;
float f = MathHelper.sqrt(xDist * xDist + zDist * zDist);
float fullDist = MathHelper.sqrt(xDist * xDist + yDist * yDist + zDist * zDist);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder renderer = tessellator.getBuffer();
GlStateManager.pushMatrix();
GlStateManager.translate((float) xPos1 - cameraX, (float) (yPos1 + ent.getEyeHeight() - 0.1) - cameraY, (float) zPos1 - cameraZ);
GL11.glRotatef((float) (Math.atan2(xDist, zDist) * 180.0D / Math.PI), 0.0F, 1.0F, 0.0F);
GL11.glRotatef((float) (Math.atan2(yDist, f) * 180.0D / Math.PI) * -1, 1.0F, 0.0F, 0.0F);
GlStateManager.disableTexture2D();
GlStateManager.disableLighting();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
ClientProxy.setColor(TF2Util.getTeamColor(ent), 0.23f, 0, 0f, 1f);
/*if (TF2Util.getTeamForDisplay(ent) == 0) {
GL11.glColor4f(1.0F, 0.0F, 0.0F, 0.23F);
} else {
GL11.glColor4f(0.0F, 0.0F, 1.0F, 0.23F);
}*/
renderer.begin(7, DefaultVertexFormats.POSITION);
renderer.pos(-0.04, -0.04, 0).endVertex();
renderer.pos(0.04, 0.04, 0).endVertex();
renderer.pos(0.04, 0.04, fullDist).endVertex();
renderer.pos(-0.04, -0.04, fullDist).endVertex();
tessellator.draw();
renderer.begin(7, DefaultVertexFormats.POSITION);
renderer.pos(-0.04, -0.04, fullDist).endVertex();
renderer.pos(0.04, 0.04, fullDist).endVertex();
renderer.pos(0.04, 0.04, 0).endVertex();
renderer.pos(-0.04, -0.04, 0).endVertex();
tessellator.draw();
renderer.begin(7, DefaultVertexFormats.POSITION);
renderer.pos(0.04, -0.04, 0).endVertex();
renderer.pos(-0.04, 0.04, 0).endVertex();
renderer.pos(-0.04, 0.04, fullDist).endVertex();
renderer.pos(0.04, -0.04, fullDist).endVertex();
tessellator.draw();
renderer.begin(7, DefaultVertexFormats.POSITION);
renderer.pos(0.04, -0.04, fullDist).endVertex();
renderer.pos(-0.04, 0.04, fullDist).endVertex();
renderer.pos(-0.04, 0.04, 0).endVertex();
renderer.pos(0.04, -0.04, 0).endVertex();
tessellator.draw();
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_BLEND);
GlStateManager.enableTexture2D();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
}