Java Code Examples for org.lwjgl.opengl.GL11#glPushMatrix()

The following examples show how to use org.lwjgl.opengl.GL11#glPushMatrix() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderPlanetAnalyser.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public void render(TileEntity tile, double x,
		double y, double z, float f, int distance, float a) {
	TileMultiPowerConsumer multiBlockTile = (TileMultiPowerConsumer)tile;

	if(!multiBlockTile.canRender())
		return;

	GL11.glPushMatrix();

	//Rotate and move the model into position
	EnumFacing front = RotatableBlock.getFront(tile.getWorld().getBlockState(tile.getPos())); //tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord));//tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord));
	GL11.glTranslated(x + .5, y, z + .5);
	GL11.glRotatef((front.getFrontOffsetX() == 1 ? 180 : 0) + front.getFrontOffsetZ()*90f, 0, 1, 0);
	
	GL11.glTranslated(.5, -1, 0);

	bindTexture(texture);
	
	model.renderAll();
	
	GL11.glPopMatrix();
}
 
Example 2
Source File: ItemRenderTEKnowledgeBook.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    if(type.equals(ItemRenderType.INVENTORY)) {
        GL11.glScalef(1.4F, 1.4F, 1.4F);
    } else if(type.equals(ItemRenderType.ENTITY)) {
        GL11.glScalef(2F, 2F, 2F);
    } else if(type.equals(ItemRenderType.EQUIPPED)) {
        GL11.glRotatef(15F, 1, 0, 0);
        GL11.glRotatef(-50F, 0, 1, 0);
        GL11.glTranslatef(-0.4F, 0F, -1.25F);
        GL11.glScalef(1.8F, 1.8F, 1.8F);
    } else if(type.equals(ItemRenderType.EQUIPPED_FIRST_PERSON)) {
        GL11.glTranslatef(-0.2F, 0.4F, 0);
        GL11.glRotatef(30F, 0, 1, 0);
        GL11.glRotatef(55F, 0, 0, 1);
    }
    super.renderItem(type, item, data);
    GL11.glPopMatrix();
}
 
Example 3
Source File: ItemWrapperMethods.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
default void renderItem(IItemRenderer.ItemRenderType type, ItemStack itemStack, Object... data) {
	Item item = ItemConverter.instance().toNova(itemStack);
	if (item.components.has(Renderer.class)) {
		GL11.glPushAttrib(GL_TEXTURE_BIT);
		GL11.glEnable(GL12.GL_RESCALE_NORMAL);
		GL11.glPushMatrix();
		Tessellator.instance.startDrawingQuads();
		BWModel model = new BWModel();
		model.matrix.rotate(Direction.UP.toVector(), 1 / 4 * Math.PI);
		model.matrix.rotate(Direction.EAST.toVector(), 1 / 6 * Math.PI);
		model.matrix.scale(1.6, 1.6, 1.6);
		item.components.getSet(Renderer.class).forEach(r -> r.onRender.accept(model));
		model.render();
		Tessellator.instance.draw();
		GL11.glPopMatrix();
		GL11.glPopAttrib();
	}
}
 
Example 4
Source File: RenderBlockArrows.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void drawArrow(float progress){
    double arrowBaseWidth = 0.4D;
    double arrowBaseLength = 0.8D;
    double arrowLength = 1.5D;
    double arrowWidth = 0.7D;
    double scale = 0.1D;
    GL11.glPushMatrix();
    GL11.glScaled(scale, scale, scale);
    GL11.glTranslatef(0, progress * 4, 0);
    Tessellator tess = Tessellator.instance;
    tess.startDrawing(GL11.GL_LINE_STRIP);
    tess.addVertex(-arrowBaseWidth, -arrowLength * 0.5D, 0);
    tess.addVertex(-arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(-arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(0, arrowLength * 0.5D, 0);
    tess.addVertex(arrowWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(arrowBaseWidth, -arrowLength * 0.5D + arrowBaseLength, 0);
    tess.addVertex(arrowBaseWidth, -arrowLength * 0.5D, 0);
    tess.draw();
    GL11.glPopMatrix();
}
 
Example 5
Source File: MobEspHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
private void renderBoxes(double partialTicks)
{
	for(EntityLiving e : mobs)
	{
		GL11.glPushMatrix();
		GL11.glTranslated(e.prevPosX + (e.posX - e.prevPosX) * partialTicks,
			e.prevPosY + (e.posY - e.prevPosY) * partialTicks,
			e.prevPosZ + (e.posZ - e.prevPosZ) * partialTicks);
		GL11.glScaled(e.width + 0.1, e.height + 0.1, e.width + 0.1);
		
		float f = WEntity.getDistance(WMinecraft.getPlayer(), e) / 20F;
		GL11.glColor4f(2 - f, f, 0, 0.5F);
		
		GL11.glCallList(mobBox);
		
		GL11.glPopMatrix();
	}
}
 
Example 6
Source File: ItemEspHack.java    From ForgeWurst with GNU General Public License v3.0 6 votes vote down vote up
private void renderBoxes(double partialTicks)
{
	for(EntityItem e : items)
	{
		GL11.glPushMatrix();
		GL11.glTranslated(e.prevPosX + (e.posX - e.prevPosX) * partialTicks,
			e.prevPosY + (e.posY - e.prevPosY) * partialTicks,
			e.prevPosZ + (e.posZ - e.prevPosZ) * partialTicks);
		
		if(style.getSelected().boxes)
			GL11.glCallList(itemBox);
		
		if(names.isChecked())
		{
			ItemStack stack = WItem.getItemStack(e);
			EntityRenderer.drawNameplate(WMinecraft.getFontRenderer(),
				WItem.getStackSize(stack) + "x " + stack.getDisplayName(),
				0, 1, 0, 0, mc.getRenderManager().playerViewY,
				mc.getRenderManager().playerViewX,
				mc.getRenderManager().options.thirdPersonView == 2, false);
			GL11.glDisable(GL11.GL_LIGHTING);
		}
		
		GL11.glPopMatrix();
	}
}
 
Example 7
Source File: RenderItemCannonParts.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void render(float x, float y, float z, float scale){

        GL11.glPushMatrix();
        GL11.glRotatef(-90F, 1F, 0, 0);
        // GL11.glDisable(GL11.GL_LIGHTING);

        // Scale, Translate, Rotate
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(x, y, z);
        GL11.glRotatef(-90F, 1F, 0, 0);

        // Bind texture
        FMLClientHandler.instance().getClient().getTextureManager().bindTexture(Textures.MODEL_AIR_CANNON);

        // Render
        model.renderModel(1F / 16F, 0F, 00F, !cannonBase, cannonBase);

        // GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }
 
Example 8
Source File: ModelWandPart.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void drawRune(double x, double y, double z, int rune, EntityPlayer player) {
    GL11.glPushMatrix();
    UtilsFX.bindTexture("textures/misc/script.png");
    float r = MathHelper.sin((player.ticksExisted + rune * 5) / 5.0F) * 0.1F + 0.88F;
    float g = MathHelper.sin((player.ticksExisted + rune * 5) / 7.0F) * 0.1F + 0.63F;
    float alpha = MathHelper.sin((player.ticksExisted + rune * 5) / 10.0F) * 0.2F;
    GL11.glColor4f(r, g, 0.2F, alpha + 0.6F);
    GL11.glRotated(90.0D, 0.0D, 0.0D, 1.0D);
    GL11.glTranslated(x, y, z);

    Tessellator tessellator = Tessellator.instance;
    float var8 = 0.0625F * rune;
    float var9 = var8 + 0.0625F;
    float var10 = 0.0F;
    float var11 = 1.0F;
    tessellator.startDrawingQuads();
    tessellator.setColorRGBA_F(r, g, 0.2F, alpha + 0.6F);
    tessellator.addVertexWithUV(-0.06D - alpha / 40.0F, 0.06D + alpha / 40.0F, 0.0D, var9, var11);
    tessellator.addVertexWithUV(0.06D + alpha / 40.0F, 0.06D + alpha / 40.0F, 0.0D, var9, var10);
    tessellator.addVertexWithUV(0.06D + alpha / 40.0F, -0.06D - alpha / 40.0F, 0.0D, var8, var10);
    tessellator.addVertexWithUV(-0.06D - alpha / 40.0F, -0.06D - alpha / 40.0F, 0.0D, var8, var11);
    tessellator.draw();
    GL11.glPopMatrix();
}
 
Example 9
Source File: MobSpawnEspHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	for(ChunkScanner scanner : new ArrayList<>(scanners.values()))
	{
		if(scanner.displayList == 0)
			continue;
		
		GL11.glCallList(scanner.displayList);
	}
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 10
Source File: PlacingDelegate.java    From tribaltrouble with GNU General Public License v2.0 5 votes vote down vote up
public final void render3D(LandscapeRenderer renderer, RenderQueues queues) {
	getViewer().getPicker().pickLocation(getCamera().getState(), landscape_hit);
	UnitGrid unit_grid = getViewer().getWorld().getUnitGrid();
	int placing_grid_x = UnitGrid.toGridCoordinate(landscape_hit.x) - (getTemplate().getPlacingSize() - 1);
	int placing_grid_y = UnitGrid.toGridCoordinate(landscape_hit.y) - (getTemplate().getPlacingSize() - 1);
	int placing_center_grid_x = UnitGrid.toGridCoordinate(landscape_hit.x);
	int placing_center_grid_y = UnitGrid.toGridCoordinate(landscape_hit.y);

	float center_x = HeightMap.METERS_PER_UNIT_GRID*(placing_grid_x + (getTemplate().getPlacingSize() - .5f));
	float center_y = HeightMap.METERS_PER_UNIT_GRID*(placing_grid_y + (getTemplate().getPlacingSize() - .5f));

	BuildingSiteScanFilter filter = new BuildingSiteScanFilter(unit_grid, getTemplate(), GRID_RADIUS, false);
	unit_grid.scan(filter, placing_center_grid_x, placing_center_grid_y);
	List target_list = filter.getResult();
	site_renderer.renderSites(renderer, target_list, center_x, center_y, 2*GRID_RADIUS);
	

	
//	GL11.glEnable(GL11.GL_BLEND);
	//renderPlaceGrid(placing_grid_x, placing_grid_y, getTemplate().getPlacingSize()*2 - 1);
//	GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_MODULATE);
	SpriteRenderer built_renderer = queues.getRenderer(getTemplate().getBuiltRenderer());
	built_renderer.setupWithColor(0, color, false, true);
	if (Building.isPlacingLegal(unit_grid, getTemplate(), placing_center_grid_x, placing_center_grid_y))
		GL11.glColor4f(1f, 1f, 1f, .8f);
	else 
		GL11.glColor4f(1f, 0f, 0f, .8f);
	float z = getViewer().getWorld().getHeightMap().getNearestHeight(center_x, center_y);
	GL11.glPushMatrix();
	GL11.glTranslatef(center_x, center_y, z);
	//Model.setupDecalColor(getViewer().getLocalPlayer().getColor());
	built_renderer.getSpriteList().render(0, 0, 0);
	built_renderer.getSpriteList().reset(0, false, true);
	GL11.glPopMatrix();
//	GL11.glTexEnvf(GL11.GL_TEXTURE_ENV, GL11.GL_TEXTURE_ENV_MODE, GL11.GL_REPLACE);
//	GL11.glDisable(GL11.GL_BLEND);
}
 
Example 11
Source File: RenderTileInfusionClaw.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void renderWand(ItemStack wandStack, float ticks) {
    GL11.glRotatef(((ticks/3) / 20.0F) * (180F / (float)Math.PI), 0, 1f, 0);

    renderTopPart();

    if (wandStack != null && wandStack.stackSize > 0) {
        GL11.glPushMatrix();

        ItemWandCasting item = (ItemWandCasting) ConfigItems.itemWandCasting;
        ItemStack wandFocusStack = wandStack.copy();
        item.setFocus(wandFocusStack, new ItemStack(ConfigItems.itemFocusPrimal));

        GL11.glRotatef(180, 1, 0, 0);
        GL11.glScalef(0.5f, 0.5f, 0.5f);
        GL11.glTranslatef(0, MathHelper.sin((ticks / 3) / 10.0F) * 0.08F + 0.08F, 0);

        GL11.glTranslatef(0, -1.4924f, 0);
        if(item.isStaff(wandFocusStack)) {
            GL11.glTranslatef(0, -0.5f, 0);

            STAFF_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        } else {
            WAND_RENDERER.renderItem(IItemRenderer.ItemRenderType.ENTITY, wandFocusStack);
        }
        GL11.glPopMatrix();
    }
}
 
Example 12
Source File: RenderTileInfusionClaw.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void render(TileInfusionClaw tile, double x, double y, double z, float partialTicks) {
    float ticks = Minecraft.getMinecraft().renderViewEntity.ticksExisted + partialTicks;
    float elapsed = ticks - tile.lastRenderTick;
    tile.lastRenderTick = ticks;

    GL11.glPushMatrix();

    GL11.glTranslated(x, y, z);
    renderPart(tile, elapsed, ticks);

    renderPrimalOrb(tile, elapsed);

    GL11.glPopMatrix();
}
 
Example 13
Source File: ModelPedestal.java    From Artifacts with MIT License 5 votes vote down vote up
public void render(TileEntity te, double x, double y, double z) {
	TileEntityDisplayPedestal es = (TileEntityDisplayPedestal)te;

	if(es.itemEnt != null) {
		GL11.glPushMatrix();
		//System.out.println("Rot: " + es.rotation);
		double angle = Math.toRadians(es.rotation);
		float sin = (float)(Math.sin(angle));
		float cos = (float)(Math.cos(angle));
		sin = Math.round(sin*100)/100;
		cos = Math.round(cos*100)/100;
		//System.out.println("Sin: " + sin);
		//System.out.println("Cos: " + cos);
		
		GL11.glTranslatef((float)x + 0.5F + (float)(sin*0.25), (float)y + 0.76F, (float)z + 0.5F - (float)(cos*0.25));
		
		GL11.glRotatef(-1*es.rotation, 0, 1, 0);
		GL11.glRotatef(90, 1, 0, 0);
		
		//RenderHelper.enableStandardItemLighting();
		RenderManager.instance.renderEntityWithPosYaw(es.itemEnt, 0, 0, 0, 0, 0);
		//RenderHelper.disableStandardItemLighting();
		GL11.glPopMatrix();
	}
	GL11.glPushMatrix();
	GL11.glTranslatef((float)x + 0.5f, (float)y - 0.5f, (float)z + 0.5f);
	//GL11.glScalef(0.5f, 0.5f, 0.5f);
	//FMLClientHandler.instance().getClient().renderEngine.bindTexture(es.getModelTexture());
	ResourceLocation rl = new ResourceLocation("artifacts:textures/blocks/pedestal.png");
	Minecraft.getMinecraft().renderEngine.bindTexture(rl);
	this.render();
	GL11.glPopMatrix();
}
 
Example 14
Source File: RenderItemPneumaticHelmet.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private void render(float x, float y, float z, float scale){

        GL11.glPushMatrix();
        GL11.glRotatef(-90F, 1F, 0, 0);
        // GL11.glDisable(GL11.GL_LIGHTING);
        // Scale, Translate, Rotate
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslatef(x, y, z);
        //     GL11.glRotatef(-90F, 1F, 0, 0);
        GL11.glRotatef(-90F, 1F, 0, 0);
        // Render
        render();
        // GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glPopMatrix();
    }
 
Example 15
Source File: RenderPresent.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
public void renderTileEntityAt(TileEntityPresent present, double x, double y, double z, float partialTicks) {
	GL11.glPushMatrix();
	GL11.glEnable(GL12.GL_RESCALE_NORMAL);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
	GL11.glScalef(1.0F, -1.0F, -1.0F);
	int rotation = present.getRotation();
	bindTexture(present);
	if (!present.isConnected()) {
		GL11.glRotatef(90 * rotation + 180, 0, 1, 0);
		switch(rotation) {
		case 0:
			GL11.glTranslatef(-1, 0, -1);
			break;
		case 1:
			GL11.glTranslatef(0, 0, -1);
			break;
		case 3:
			GL11.glTranslatef(-1, 0, 0);
			break;
		}
		smallChest.renderAll();
	} else if (present.isParent()) {
		ForgeDirection dir = present.getConnectionDir();
		switch(dir) {
		case NORTH:
			GL11.glRotatef(-90, 0, 1, 0);
			GL11.glTranslatef(0, 0, -1);
			break;
		case SOUTH:
			GL11.glRotatef(-90, 0, 1, 0);
			GL11.glTranslatef(-1, 0, -1);
			break;
		case WEST:
			GL11.glTranslatef(-1, 0, 0);
			break;
		default:
			break;
		}
		if (rotation == 0 || rotation == 3) {
			GL11.glRotatef(180, 0, 1, 0);
			GL11.glTranslatef(-2, 0, -1);
		}
		largeChest.renderAll();
	}
	GL11.glPopMatrix();
}
 
Example 16
Source File: HyperiumFontRenderer.java    From Hyperium with GNU Lesser General Public License v3.0 4 votes vote down vote up
public int drawString(String text, float x, float y, int color) {
    if (text == null) return 0;

    ScaledResolution resolution = new ScaledResolution(Minecraft.getMinecraft());

    try {
        if (resolution.getScaleFactor() != prevScaleFactor) {
            prevScaleFactor = resolution.getScaleFactor();
            unicodeFont = new UnicodeFont(getFontByName(name).deriveFont(size * prevScaleFactor / 2));
            unicodeFont.addAsciiGlyphs();
            unicodeFont.getEffects().add(new ColorEffect(java.awt.Color.WHITE));
            unicodeFont.loadGlyphs();
        }
    } catch (FontFormatException | IOException | SlickException e) {
        e.printStackTrace();
    }

    this.antiAliasingFactor = resolution.getScaleFactor();

    GL11.glPushMatrix();
    GlStateManager.scale(1 / antiAliasingFactor, 1 / antiAliasingFactor, 1 / antiAliasingFactor);
    x *= antiAliasingFactor;
    y *= antiAliasingFactor;
    float originalX = x;
    float red = (float) (color >> 16 & 255) / 255.0F;
    float green = (float) (color >> 8 & 255) / 255.0F;
    float blue = (float) (color & 255) / 255.0F;
    float alpha = (float) (color >> 24 & 255) / 255.0F;
    GlStateManager.color(red, green, blue, alpha);

    int currentColor = color;

    char[] characters = text.toCharArray();

    GlStateManager.disableLighting();
    GlStateManager.enableBlend();
    GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    String[] parts = COLOR_CODE_PATTERN.split(text);
    int index = 0;
    for (String s : parts) {
        for (String s2 : s.split("\n")) {
            for (String s3 : s2.split("\r")) {

                unicodeFont.drawString(x, y, s3, new org.newdawn.slick.Color(currentColor));
                x += unicodeFont.getWidth(s3);

                index += s3.length();
                if (index  < characters.length && characters[index ] == '\r') {
                    x = originalX;
                    index++;
                }
            }
            if (index < characters.length && characters[index] == '\n') {
                x = originalX;
                y += getHeight(s2) * 2;
                index++;
            }
        }
        if (index < characters.length) {
            char colorCode = characters[index];
            if (colorCode == 'ยง') {
                char colorChar = characters[index + 1];
                int codeIndex = ("0123456789" +
                    "abcdef").indexOf(colorChar);
                if (codeIndex < 0) {
                    if (colorChar == 'r') {
                        currentColor = color;
                    }
                } else {
                    currentColor = colorCodes[codeIndex];
                }
                index += 2;
            }
        }
    }

    GlStateManager.color(1F, 1F, 1F, 1F);
    GlStateManager.bindTexture(0);
    GlStateManager.popMatrix();
    return (int) x;
}
 
Example 17
Source File: PowerDisplay.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public void renderElement(int x, int y, EntityPlayer p, ScaledResolution resolution, boolean hudjackAvailable, boolean isConfigOpen, float partialTicks)
{
	if (!isHidden() && hudjackAvailable)
	{
		boolean flipHoriz = getHorizontalAnchor() == EnumAnchorHorizontal.RIGHT;

		float currTime = p.ticksExisted + partialTicks;
		
		GL11.glPushMatrix();
		GlStateManager.enableBlend();
		ICyberwareUserData data = CyberwareAPI.getCapability(p);
		
		Minecraft.getMinecraft().getTextureManager().bindTexture(HudHandler.HUD_TEXTURE);

		
		FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
		
		if (p.ticksExisted % 20 == 0)
		{
			cachedPercent = data.getPercentFull();
			cachedCap = data.getCapacity();
			cachedTotal = data.getStoredPower();
			cachedProd = data.getProduction();
			cachedCons = data.getConsumption();
		}
		
		float[] color = CyberwareAPI.getHUDColor();
		int colorHex = CyberwareAPI.getHUDColorHex();
		
		if (cachedPercent != -1)
		{
			int amount = Math.round((21F * cachedPercent));

			boolean danger = (cachedPercent <= .2F);
			boolean superDanger = danger && (cachedPercent <= .05F);
			int xOffset = (danger ? 39 : 0);
			
			if (!superDanger || p.ticksExisted % 4 != 0)
			{
				int moveX = flipHoriz ? (x + getWidth() - 13) : x;
				GlStateManager.pushMatrix();
				if (!danger) GlStateManager.color(color[0], color[1], color[2]);
				ClientUtils.drawTexturedModalRect(moveX, y, xOffset, 0, 13, 2 + (21 - amount));
				ClientUtils.drawTexturedModalRect(moveX, y + 2 + (21 - amount), 13 + xOffset, 2 + (21 - amount), 13, amount + 2);
				
				ClientUtils.drawTexturedModalRect(moveX, y + 2 + (21 - amount), 26 + xOffset, 2 + (21 - amount), 13, amount + 2);
				GlStateManager.popMatrix();

				String output = cachedTotal + " / " + cachedCap;
				int textX = flipHoriz ? x + getWidth() - 15 - fr.getStringWidth(output) : x + 15;
				fr.drawStringWithShadow(output, textX, y + 4, danger ? 0xFF0000 : colorHex);
				
				output = "-" + cachedCons + " / +" + cachedProd;
				textX = flipHoriz ? x + getWidth() - 15 - fr.getStringWidth(output) : x + 15;
				fr.drawStringWithShadow(output, textX, y + 14, danger ? 0xFF0000 : colorHex);
			}
		}
		
		GL11.glPopMatrix();
	}
}
 
Example 18
Source File: NotebotScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public void onRenderWindow(MatrixStack matrix, int window, int mX, int mY) {
	super.onRenderWindow(matrix, window, mX, mY);
	
	if (window == 0) {
		int x = windows.get(0).x1,
				y = windows.get(0).y1 + 10,
				w = width / 2,
				h = height / 2;
		
		drawCenteredString(matrix, textRenderer, "Tutorial..", x + w - 24, y + 4, 0x9090c0);
		
		int pageEntries = 0;
		for (int i = y + 20; i < y + h - 27; i += 10) pageEntries++;
		
		drawCenteredString(matrix, textRenderer, "<  Page " + (page + 1) + "  >", x + 55, y + 5, 0xc0c0ff);
		
		fillButton(matrix, x + 10, y + h - 13, x + 99, y + h - 3, 0xff3a3a3a, 0xff353535, mX, mY);
		drawCenteredString(matrix, textRenderer, "Download Songs..", x + 55, y + h - 12, 0xc0dfdf);
		
		int c = 0, c1 = -1;
		for (String s: files) {
			c1++;
			if (c1 < page * pageEntries) continue;
			if (c1 > (page + 1) * pageEntries) break;
			
			fillButton(matrix, x + 5, y + 15 + c * 10, x + 105, y + 25 + c * 10, 
					Notebot.filePath.equals(s) ? 0xf0408040 : selected.equals(s) ? 0xf0202020 : 0xf0404040, 0xf0303030, mX, mY);
			if (cutText(s, 105).equals(s)) drawCenteredString(matrix, textRenderer, s, x + 55, y + 16 + c * 10, -1);
			else drawStringWithShadow(matrix, textRenderer, cutText(s, 105), x + 5, y + 16 + c * 10, -1);
			c++;
		}
		
		if (entry != null) {
			drawCenteredString(matrix, textRenderer, entry.fileName, x + w - w / 4, y + 10, 0xa030a0);
			drawCenteredString(matrix, textRenderer, entry.length / 20 + "s", x + w - w / 4, y + 20, 0xc000c0);
			drawCenteredString(matrix, textRenderer, "Notes: ", x + w - w / 4, y + 38, 0x80f080);
			
			int c2 = 0;
			for (Entry<Instrument, Integer> e: entry.notes.entrySet()) {
				itemRenderer.zOffset = 500 - c2 * 20;
				drawCenteredString(matrix, textRenderer, StringUtils.capitalize(e.getKey().asString()) + " x" + e.getValue(), 
						x + w - w / 4, y + 50 + c2 * 10, 0x50f050);
				GL11.glPushMatrix();
				DiffuseLighting.enableGuiDepthLighting();
				if (e.getKey() == Instrument.HARP) itemRenderer.renderGuiItemIcon(new ItemStack(Items.DIRT), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BASEDRUM) itemRenderer.renderGuiItemIcon(new ItemStack(Items.STONE), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.SNARE) itemRenderer.renderGuiItemIcon(new ItemStack(Items.SAND), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.HAT) itemRenderer.renderGuiItemIcon(new ItemStack(Items.GLASS), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BASS) itemRenderer.renderGuiItemIcon(new ItemStack(Items.OAK_WOOD), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.FLUTE) itemRenderer.renderGuiItemIcon(new ItemStack(Items.CLAY), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BELL) itemRenderer.renderGuiItemIcon(new ItemStack(Items.GOLD_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.GUITAR) itemRenderer.renderGuiItemIcon(new ItemStack(Items.WHITE_WOOL), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.CHIME) itemRenderer.renderGuiItemIcon(new ItemStack(Items.PACKED_ICE), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.XYLOPHONE) itemRenderer.renderGuiItemIcon(new ItemStack(Items.BONE_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.IRON_XYLOPHONE) itemRenderer.renderGuiItemIcon(new ItemStack(Items.IRON_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.COW_BELL) itemRenderer.renderGuiItemIcon(new ItemStack(Items.SOUL_SAND), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.DIDGERIDOO) itemRenderer.renderGuiItemIcon(new ItemStack(Items.PUMPKIN), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BIT) itemRenderer.renderGuiItemIcon(new ItemStack(Items.EMERALD_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BANJO) itemRenderer.renderGuiItemIcon(new ItemStack(Items.HAY_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.PLING) itemRenderer.renderGuiItemIcon(new ItemStack(Items.GLOWSTONE), x + w - w / 4 + 40, y + 46 + c2 * 10);
				c2++;
				GL11.glPopMatrix();
			}
			
			fillButton(matrix, x + w - w / 2 + 10, y + h - 15, x + w - w / 4, y + h - 5, 0xff903030, 0xff802020, mX, mY);
			fillButton(matrix, x + w - w / 4 + 5, y + h - 15, x + w - 5, y + h - 5, 0xff308030, 0xff207020, mX, mY);
			fillButton(matrix, x + w - w / 4 - w / 8, y + h - 27, x + w - w / 4 + w / 8, y + h - 17, 0xff303080, 0xff202070, mX, mY);
			
			int pixels = (int) Math.round(MathHelper.clamp((w / 4)*((double)entry.playTick / (double)entry.length), 0, w / 4));
			fill(matrix, x + w - w / 4 - w / 8, y + h - 27, (x + w - w / 4 - w / 8) + pixels, y + h - 17, 0x507050ff);
			
			drawCenteredString(matrix, textRenderer, "Delete", (int)(x + w - w / 2.8), y + h - 14, 0xff0000);
			drawCenteredString(matrix, textRenderer, "Select", x + w - w / 8, y + h - 14, 0x00ff00);
			drawCenteredString(matrix, textRenderer, (entry.playing ? "Playing" : "Play") + " (scuffed)", x + w - w / 4, y + h - 26, 0x6060ff);
		}
	}
}
 
Example 19
Source File: AntibuilderParticle.java    From Artifacts with MIT License 4 votes vote down vote up
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
	par1Tessellator.draw();
	GL11.glPushMatrix();

	ParticleUtils.bindTexture("textures/items/radarparticle.png");

	//GL11.glDepthMask(false);
	GL11.glDepthFunc(GL11.GL_ALWAYS);
	//GL11.glEnable(3042);
	//GL11.glBlendFunc(770, 1);
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_SRC_ALPHA);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1F);
	//GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	par1Tessellator.startDrawingQuads();
	/*int bright = -1;
	try {
		bright = ReflectionHelper.getPrivateValue(Tessellator.class, par1Tessellator, new String[] { "brightness", "b", "field_78401_l" });
	}
	catch (Exception e) {
		System.out.println("Bad reflection");
	}*/
	
	par1Tessellator.setBrightness(255);
	
	float var8 = ((float)this.particleAge + par2) / (float)this.particleMaxAge * 32.0F;

	if (var8 < 0.0F)
	{
		var8 = 0.0F;
	}

	if (var8 > 1.0F)
	{
		var8 = 1.0F;
	}

	this.particleScale = this.reddustParticleScale;// * var8;
	//replace this
	//super.renderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
	
	//Minecraft.getMinecraft().renderEngine.bindTexture(rl);

	float f6 = (float)this.particleTextureIndexX / 32.0F;
	float f7 = f6 + 0.029375F;
	//              0.0624375
	//              0.0625
	float f8 = (float)this.particleTextureIndexY / 32.0F;
	float f9 = f8 + 0.029375F;
	float f10 = 0.15F;// * this.particleScale;

	float f11 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
	float f12 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
	float f13 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
	float f14 = 1.0F;
	//par1Tessellator.draw();
	//GL11.glDepthFunc(GL11.GL_ALWAYS);
	//par1Tessellator.startDrawingQuads();
	//par1Tessellator.setBrightness(255);
	//GL11.glDisable(GL11.GL_DEPTH_TEST);
	float al = 0.0F;
	EntityPlayer player = (EntityPlayer) this.worldObj.findNearestEntityWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(this.posX - 16, this.posY-16, this.posZ-16, this.posX+16, this.posY+16, this.posZ+16), this);
	if(player != null) {
		double d = player.getDistanceToEntity(this);
		if(d < 6 && d > 1) {
			al = (float)(d / 8D);
		}
		else if(d > 1)
			al = 6F / 8F;
	}/**/
	par1Tessellator.setColorRGBA_F(this.particleRed * f14 - al/2, this.particleGreen * f14, this.particleBlue * f14 + al, 0.05F);
	par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 - par5 * f10 - par7 * f10), (double)f7, (double)f9);
	par1Tessellator.addVertexWithUV((double)(f11 - par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 - par5 * f10 + par7 * f10), (double)f7, (double)f8);
	par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 + par6 * f10), (double)(f12 + par4 * f10), (double)(f13 + par5 * f10 + par7 * f10), (double)f6, (double)f8);
	par1Tessellator.addVertexWithUV((double)(f11 + par3 * f10 - par6 * f10), (double)(f12 - par4 * f10), (double)(f13 + par5 * f10 - par7 * f10), (double)f6, (double)f9);
	par1Tessellator.draw();
	//GL11.glDepthFunc(GL11.GL_LEQUAL);
	//par1Tessellator.startDrawingQuads();
	//rl = new ResourceLocation("textures/particle/particles.png");
	//Minecraft.getMinecraft().renderEngine.bindTexture(rl2);
	//GL11.glEnable(GL11.GL_DEPTH_TEST);

	GL11.glDepthFunc(GL11.GL_LEQUAL);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glPopMatrix();
	Minecraft.getMinecraft().renderEngine.bindTexture(ParticleUtils.getParticleTexture());
	
	par1Tessellator.startDrawingQuads();
	par1Tessellator.setBrightness(0);
}
 
Example 20
Source File: BowAimbotHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	if(target == null)
		return;
	
	// GL settings
	GL11.glEnable(GL11.GL_BLEND);
	GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
	GL11.glEnable(GL11.GL_LINE_SMOOTH);
	GL11.glLineWidth(2);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// set position
	GL11.glTranslated(target.getX(), target.getY(), target.getZ());
	
	// set size
	double boxWidth = target.getWidth() + 0.1;
	double boxHeight = target.getHeight() + 0.1;
	GL11.glScaled(boxWidth, boxHeight, boxWidth);
	
	// move to center
	GL11.glTranslated(0, 0.5, 0);
	
	double v = 1 / velocity;
	GL11.glScaled(v, v, v);
	
	// draw outline
	GL11.glColor4d(1, 0, 0, 0.5F * velocity);
	RenderUtils.drawOutlinedBox(TARGET_BOX);
	
	// draw box
	GL11.glColor4d(1, 0, 0, 0.25F * velocity);
	RenderUtils.drawSolidBox(TARGET_BOX);
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}