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

The following examples show how to use org.lwjgl.opengl.GL11#glScaled() . 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: RenderUtilsLiving.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public static void drawText(String str, double x, double y, double z, double scale) {
	glSetup(x, y, z);
	
	GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale);
      
	int i = mc.textRenderer.getStringWidth(str) / 2;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBufferBuilder();
    bufferbuilder.begin(7, VertexFormats.POSITION_COLOR);
    float f = mc.options.getTextBackgroundOpacity(0.25F);
    bufferbuilder.vertex(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
      
    mc.textRenderer.draw(str, -i, 0, 553648127);
    mc.textRenderer.draw(str, -i, 0, -1);
      
    glCleanup();
}
 
Example 2
Source File: Minigun.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public void render(double x, double y, double z, double gunRadius){
    if(isMinigunActivated() && getMinigunSpeed() == MAX_GUN_SPEED && gunAimedAtTarget && attackTarget != null) {
        GL11.glPushMatrix();
        GL11.glScaled(1, 1, 1);
        GL11.glTranslated(-x, -y, -z);
        GL11.glDisable(GL11.GL_TEXTURE_2D);
        //GL11.glDisable(GL11.GL_LIGHTING);
        RenderUtils.glColorHex(0xFF000000 | getAmmoColor());
        for(int i = 0; i < 5; i++) {

            Vec3 vec = Vec3.createVectorHelper(attackTarget.posX - x, attackTarget.posY - y, attackTarget.posZ - z).normalize();
            minigunFire.startX = x + vec.xCoord * gunRadius;
            minigunFire.startY = y + vec.yCoord * gunRadius;
            minigunFire.startZ = z + vec.zCoord * gunRadius;
            minigunFire.endX = attackTarget.posX + rand.nextDouble() - 0.5;
            minigunFire.endY = attackTarget.posY + attackTarget.height / 2 + rand.nextDouble() - 0.5;
            minigunFire.endZ = attackTarget.posZ + rand.nextDouble() - 0.5;
            minigunFire.render();
        }
        GL11.glColor4d(1, 1, 1, 1);
        // GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glPopMatrix();
    }
}
 
Example 3
Source File: RenderUtilsLiving.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public static void drawText(String str, double x, double y, double z, double scale) {
	glSetup(x, y, z);
	
	GL11.glScaled(-0.025*scale, -0.025*scale, 0.025*scale);
      
	int i = mc.textRenderer.getStringWidth(str) / 2;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferbuilder = tessellator.getBuffer();
    bufferbuilder.begin(7, VertexFormats.POSITION_COLOR);
    float f = mc.options.getTextBackgroundOpacity(0.25F);
    bufferbuilder.vertex(-i - 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(-i - 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, 8, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    bufferbuilder.vertex(i + 1, -1, 0.0D).color(0.0F, 0.0F, 0.0F, f).next();
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
      
    mc.textRenderer.draw(str, -i, 0, 553648127);
    mc.textRenderer.draw(str, -i, 0, -1);
      
    glCleanup();
}
 
Example 4
Source File: ItemEspHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void renderBoxes(double partialTicks)
{
	double extraSize = boxSize.getSelected().extraSize;
	
	for(ItemEntity e : items)
	{
		GL11.glPushMatrix();
		
		GL11.glTranslated(e.prevX + (e.getX() - e.prevX) * partialTicks,
			e.prevY + (e.getY() - e.prevY) * partialTicks,
			e.prevZ + (e.getZ() - e.prevZ) * partialTicks);
		
		if(style.getSelected().boxes)
		{
			GL11.glPushMatrix();
			GL11.glScaled(e.getWidth() + extraSize,
				e.getHeight() + extraSize, e.getWidth() + extraSize);
			GL11.glCallList(itemBox);
			GL11.glPopMatrix();
		}
		
		if(names.isChecked())
		{
			// ItemStack stack = e.getStack();
			// GameRenderer.renderFloatingText(MC.textRenderer,
			// stack.getCount() + "x "
			// + stack.getName().asFormattedString(),
			// 0, 1, 0, 0, MC.getEntityRenderManager().cameraYaw,
			// MC.getEntityRenderManager().cameraPitch, false);
			// GL11.glDisable(GL11.GL_LIGHTING);
		}
		
		GL11.glPopMatrix();
	}
}
 
Example 5
Source File: SemiBlockRendererHeatFrame.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void render(SemiBlockHeatFrame semiBlock, float partialTick){
    GL11.glPushMatrix();
    Minecraft.getMinecraft().renderEngine.bindTexture(Textures.MODEL_HEAT_FRAME);
    int heatLevel = semiBlock.getHeatLevel();
    double[] color = TileEntityCompressedIronBlock.getColorForHeatLevel(heatLevel);
    GL11.glColor4d(color[0], color[1], color[2], 1);

    AxisAlignedBB aabb;
    if(semiBlock.getWorld() != null) {
        semiBlock.getBlock().setBlockBoundsBasedOnState(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ);
        aabb = semiBlock.getBlock().getSelectedBoundingBoxFromPool(semiBlock.getWorld(), semiBlock.getPos().chunkPosX, semiBlock.getPos().chunkPosY, semiBlock.getPos().chunkPosZ);
        aabb.minX -= semiBlock.getX();
        aabb.maxX -= semiBlock.getX();
        aabb.minY -= semiBlock.getY();
        aabb.maxY -= semiBlock.getY();
        aabb.minZ -= semiBlock.getZ();
        aabb.maxZ -= semiBlock.getZ();
    } else {
        aabb = AxisAlignedBB.getBoundingBox(1 / 16D, 1 / 16D, 1 / 16D, 15 / 16D, 15 / 16D, 15 / 16D);
    }
    GL11.glTranslated(aabb.minX, aabb.minY, aabb.minZ);
    GL11.glScaled(aabb.maxX - aabb.minX, aabb.maxY - aabb.minY, aabb.maxZ - aabb.minZ);
    GL11.glTranslated(0.5, -0.5, 0.5);
    model.render(null, 0, 0, 0, 0, 0, 1 / 16F);
    GL11.glPopMatrix();
    GL11.glColor4d(1, 1, 1, 1);
}
 
Example 6
Source File: EditBlockListScreen.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
private String renderIconAndGetName(ItemStack stack, int y)
{
	if(WItem.isNullOrEmpty(stack))
	{
		GL11.glPushMatrix();
		GL11.glTranslated(52, y, 0);
		GL11.glScaled(0.75, 0.75, 0.75);
		
		RenderHelper.enableGUIStandardItemLighting();
		mc.getRenderItem().renderItemAndEffectIntoGUI(
			new ItemStack(Blocks.GRASS), 0, 0);
		RenderHelper.disableStandardItemLighting();
		GL11.glPopMatrix();
		
		GL11.glDisable(GL11.GL_DEPTH_TEST);
		FontRenderer fr = WMinecraft.getFontRenderer();
		fr.drawString("?", 55, y + 2, 0xf0f0f0, true);
		GL11.glEnable(GL11.GL_DEPTH_TEST);
		
		return ChatFormatting.ITALIC + "unknown block"
			+ ChatFormatting.RESET;
		
	}else
	{
		GL11.glPushMatrix();
		GL11.glTranslated(52, y, 0);
		GL11.glScaled(0.75, 0.75, 0.75);
		
		RenderHelper.enableGUIStandardItemLighting();
		mc.getRenderItem().renderItemAndEffectIntoGUI(stack, 0, 0);
		RenderHelper.disableStandardItemLighting();
		
		GL11.glPopMatrix();
		
		return stack.getDisplayName();
	}
}
 
Example 7
Source File: RenderGolemHelper.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
public static void renderCarriedItemsFix(EntityGolemBase golem) {
    GL11.glPushMatrix();

    GL11.glScaled(0.4D, 0.4D, 0.4D);

    GL11.glTranslatef(-0.5F, 2.5F, -1.25F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);

    ItemStack item = golem.getCarriedForDisplay();

    int renderPass = 0;
    do {
        IIcon icon = item.getItem().getIcon(item, renderPass);
        if (icon != null) {
            Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
            GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());

            ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                    icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }
        renderPass++;
    } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));

    GL11.glPopMatrix();
}
 
Example 8
Source File: CosmeticHat.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@InvokeEvent
public void onPlayerRender(RenderPlayerEvent e) {
    Minecraft mc = Minecraft.getMinecraft();
    AbstractClientPlayer player = e.getEntity();
    if (CosmeticsUtil.shouldHide(getPurchaseType())) return;

    if (isPurchasedBy(player.getUniqueID()) && !player.isInvisible()) {
        HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(player.getUniqueID());
        if (packageIfReady.getCachedSettings().getCurrentHatType() != getPurchaseType()) return;

        GlStateManager.pushMatrix();
        GlStateManager.translate(e.getX(), e.getY(), e.getZ());

        double scale = 1.0F;
        double rotate = interpolate(player.prevRotationYawHead, player.rotationYawHead, e.getPartialTicks());
        double rotate1 = interpolate(player.prevRotationPitch, player.rotationPitch, e.getPartialTicks());

        GL11.glScaled(-scale, -scale, scale);
        GL11.glTranslated(0.0, -((player.height - (player.isSneaking() ? .25 : 0)) - .38) / scale, 0.0);
        GL11.glRotated(180.0 + rotate, 0.0, 1.0, 0.0);
        GL11.glRotated(rotate1, 1.0D, 0.0D, 0.0D);
        GlStateManager.translate(0, -.45, 0);

        /* Bind the hat texture and render the model */
        mc.getTextureManager().bindTexture(hatTexture);
        hatModel.render(player, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);

        GlStateManager.popMatrix();
    }
}
 
Example 9
Source File: LocatedString.java    From IGW-mod with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void renderBackground(GuiWiki gui, int mouseX, int mouseY){
    GL11.glPushMatrix();
    GL11.glScaled(GuiWiki.TEXT_SCALE, GuiWiki.TEXT_SCALE, 1);
    //GlStateManager.enableLighting();
    // RenderHelper.enableStandardItemLighting();
    if(getLinkAddress() != null) {
        Rectangle mouseSpace = getMouseSpace();
        fontRenderer.drawString(TextFormatting.UNDERLINE + cappedText, x, y, mouseSpace.contains(mouseX - gui.getGuiLeft(), mouseY - gui.getGuiTop()) ? 0xFFFFFF00 : 0xFF3333FF, shadow);
    } else {
        GL11.glColor4d(0, 0, 0, 1);
        fontRenderer.drawString(cappedText, x, y, color, shadow);
    }
    GL11.glPopMatrix();
}
 
Example 10
Source File: HUDTickHandler.java    From SimplyJetpacks with MIT License 5 votes vote down vote up
private static void tickEnd() {
    if (mc.thePlayer != null) {
        if ((mc.currentScreen == null || Config.showHUDWhileChatting && mc.currentScreen instanceof GuiChat) && !mc.gameSettings.hideGUI && !mc.gameSettings.showDebugInfo) {
            ItemStack chestplate = mc.thePlayer.getCurrentArmor(2);
            if (chestplate != null && chestplate.getItem() instanceof IHUDInfoProvider) {
                IHUDInfoProvider provider = (IHUDInfoProvider) chestplate.getItem();
                
                List<String> info = new ArrayList<String>();
                provider.addHUDInfo(info, chestplate, Config.enableFuelHUD, Config.enableStateHUD);
                if (info.isEmpty()) {
                    return;
                }
                
                GL11.glPushMatrix();
                mc.entityRenderer.setupOverlayRendering();
                GL11.glScaled(Config.HUDScale, Config.HUDScale, 1.0D);
                
                int i = 0;
                for (String s : info) {
                    RenderUtils.drawStringAtHUDPosition(s, HUDPositions.values()[Config.HUDPosition], mc.fontRenderer, Config.HUDOffsetX, Config.HUDOffsetY, Config.HUDScale, 0xeeeeee, true, i);
                    i++;
                }
                
                GL11.glPopMatrix();
            }
        }
    }
}
 
Example 11
Source File: PlayerEspHack.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void renderBoxes(double partialTicks)
{
	double extraSize = boxSize.getSelected().extraSize;
	
	for(PlayerEntity e : players)
	{
		GL11.glPushMatrix();
		
		GL11.glTranslated(e.prevX + (e.getX() - e.prevX) * partialTicks,
			e.prevY + (e.getY() - e.prevY) * partialTicks,
			e.prevZ + (e.getZ() - e.prevZ) * partialTicks);
		
		GL11.glScaled(e.getWidth() + extraSize, e.getHeight() + extraSize,
			e.getWidth() + extraSize);
		
		// set color
		if(WURST.getFriends().contains(e.getEntityName()))
			GL11.glColor4f(0, 0, 1, 0.5F);
		else
		{
			float f = MC.player.distanceTo(e) / 20F;
			GL11.glColor4f(2 - f, f, 0, 0.5F);
		}
		
		GL11.glCallList(playerBox);
		
		GL11.glPopMatrix();
	}
}
 
Example 12
Source File: RenderPresent.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
private void renderBlock(float x, float y, float z) {
	GL11.glPushMatrix();
	GL11.glTranslatef(x, y, z);
	GL11.glScaled(-1, -1, 1);
	smallChest.renderAll();
	GL11.glPopMatrix();
}
 
Example 13
Source File: NukerHack.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onRenderWorldLast(RenderWorldLastEvent event)
{
	if(currentBlock == 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.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	
	GL11.glPushMatrix();
	GL11.glTranslated(-TileEntityRendererDispatcher.staticPlayerX,
		-TileEntityRendererDispatcher.staticPlayerY,
		-TileEntityRendererDispatcher.staticPlayerZ);
	
	AxisAlignedBB box = new AxisAlignedBB(BlockPos.ORIGIN);
	float p =
		prevProgress + (progress - prevProgress) * event.getPartialTicks();
	float red = p * 2F;
	float green = 2 - red;
	
	GL11.glTranslated(currentBlock.getX(), currentBlock.getY(),
		currentBlock.getZ());
	if(p < 1)
	{
		GL11.glTranslated(0.5, 0.5, 0.5);
		GL11.glScaled(p, p, p);
		GL11.glTranslated(-0.5, -0.5, -0.5);
	}
	
	GL11.glColor4f(red, green, 0, 0.25F);
	GL11.glBegin(GL11.GL_QUADS);
	RenderUtils.drawSolidBox(box);
	GL11.glEnd();
	
	GL11.glColor4f(red, green, 0, 0.5F);
	GL11.glBegin(GL11.GL_LINES);
	RenderUtils.drawOutlinedBox(box);
	GL11.glEnd();
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}
 
Example 14
Source File: OverlayHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	if(MC.crosshairTarget == null
		|| MC.crosshairTarget.getType() != HitResult.Type.BLOCK)
		return;
	
	BlockHitResult blockHitResult = (BlockHitResult)MC.crosshairTarget;
	BlockPos pos = new BlockPos(blockHitResult.getBlockPos());
	
	// check if hitting block
	if(!MC.interactionManager.isBreakingBlock())
		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.glEnable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	// set position
	GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ());
	
	// get progress
	float progress =
		IMC.getInteractionManager().getCurrentBreakingProgress();
	
	// set size
	GL11.glTranslated(0.5, 0.5, 0.5);
	GL11.glScaled(progress, progress, progress);
	GL11.glTranslated(-0.5, -0.5, -0.5);
	
	// get color
	float red = progress * 2F;
	float green = 2 - red;
	
	// draw box
	GL11.glColor4f(red, green, 0, 0.25F);
	RenderUtils.drawSolidBox();
	GL11.glColor4f(red, green, 0, 0.5F);
	RenderUtils.drawOutlinedBox();
	
	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);
}
 
Example 15
Source File: SpeedTelegraphTileEntityRenderer.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public void render(TileEntitySpeedTelegraph tileentity, double x, double y, double z,
    float partialTick, int destroyStage, float alpha) {
    IBlockState telegraphState = tileentity.getWorld().getBlockState(tileentity.getPos());

    if (telegraphState.getBlock()
        != ValkyrienSkiesControl.INSTANCE.vsControlBlocks.speedTelegraph) {
        return;
    }

    GlStateManager.resetColor();
    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    GlStateManager.pushMatrix();
    GlStateManager.disableLighting();
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder tessellatorBuffer = tessellator.getBuffer();

    double oldX = tessellatorBuffer.xOffset;
    double oldY = tessellatorBuffer.yOffset;
    double oldZ = tessellatorBuffer.zOffset;

    tessellatorBuffer.setTranslation(0, 0, 0);
    GL11.glTranslated(x, y, z);
    GlStateManager.disableAlpha();
    GlStateManager.disableBlend();

    BlockPos originPos = tileentity.getPos();

    int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0);

    double multiplier = 1.9D;

    GL11.glTranslated((1D - multiplier) / 2.0D, 0, (1D - multiplier) / 2.0D);
    GL11.glScaled(multiplier, multiplier, multiplier);
    EnumFacing enumfacing = telegraphState.getValue(BlockSpeedTelegraph.FACING);
    double wheelAndCompassStateRotation = enumfacing.getHorizontalAngle();

    GL11.glTranslated(0.5D, 0, 0.5D);
    GL11.glRotated(wheelAndCompassStateRotation, 0, 1, 0);
    GL11.glTranslated(-0.5D, 0, -0.5D);

    // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), helmStateToRender, brightness);

    GibsModelRegistry.renderGibsModel("chadburn_speed_telegraph_simplevoxel_geo", brightness);

    // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), dialState, brightness);

    GibsModelRegistry.renderGibsModel("chadburn_dial_simplevoxel_geo", brightness);

    GL11.glPushMatrix();

    GL11.glTranslated(0.497D, 0.857D, 0.5D);
    GL11.glRotated(tileentity.getHandleRenderRotation(partialTick), 0D, 0D, 1D);
    GL11.glTranslated(-0.497D, -0.857D, -0.5D);

    // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), rightHandleState, brightness);

    GibsModelRegistry.renderGibsModel("chadburn_handles_simplevoxel_geo", brightness);

    // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), leftHandleState, brightness);

    GL11.glPopMatrix();

    GlStateManager.enableAlpha();
    GlStateManager.enableBlend();
    // GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    // FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(), glassState, brightness);
    GibsModelRegistry.renderGibsModel("chadburn_glass_simplevoxel_geo", brightness);

    GlStateManager.disableAlpha();
    GlStateManager.disableBlend();

    GL11.glPopMatrix();
    tessellatorBuffer.setTranslation(oldX, oldY, oldZ);

    GlStateManager.enableLighting();
    GlStateManager.resetColor();
}
 
Example 16
Source File: GuiWiki.java    From IGW-mod with GNU General Public License v2.0 4 votes vote down vote up
private void drawWikiPage(int mouseX, int mouseY){
    currentTab.renderBackground(this, mouseX, mouseY);
    GL11.glPushMatrix();
    GL11.glTranslated(guiLeft, guiTop, 0);

    // Draw the wiki page images.
    GL11.glColor4d(1, 1, 1, 1);
    GL11.glPushMatrix();
    GL11.glScaled(TEXT_SCALE, TEXT_SCALE, 1);
    for(IWidget texture : locatedTextures) {
        texture.renderBackground(this, mouseX, mouseY);
    }

    GL11.glPopMatrix();

    for(LocatedString locatedString : locatedStrings) {
        if(locatedString.getY() > MIN_TEXT_Y && locatedString.getReservedSpace().height + locatedString.getY() <= MAX_TEXT_Y) {
            locatedString.renderBackground(this, mouseX, mouseY);
        }
    }
    GL11.glColor4d(1, 1, 1, 1);

    //Draw wiki tab images.
    List<IReservedSpace> reservedSpaces = currentTab.getReservedSpaces();
    if(reservedSpaces != null) {
        for(IReservedSpace space : reservedSpaces) {
            if(space instanceof LocatedTexture) {
                ((LocatedTexture)space).renderBackground(this, mouseX, mouseY);
            }
        }
    }

    GL11.glPushMatrix();
    GL11.glTranslated(0, 4, 0);
    List<IWikiTab> visibleTabs = getVisibleTabs();

    RenderHelper.enableGUIStandardItemLighting();
    for(IWikiTab tab : visibleTabs) {
        ItemStack drawingStack = tab.renderTabIcon(this);
        if(drawingStack != null) {
            if(drawingStack.getItem() instanceof ItemBlock) {
                renderRotatingBlockIntoGUI(this, drawingStack, 11, 23, 1.5F);
            } else {
                boolean oldSetting = mc.gameSettings.fancyGraphics;
                mc.gameSettings.fancyGraphics = true;
                renderRotatingBlockIntoGUI(this, drawingStack, 12, 20, 1.2F);
                mc.gameSettings.fancyGraphics = oldSetting;
            }
        }
        GL11.glTranslated(0, 35, 0);
    }
    GL11.glPopMatrix();

    //render the wiki links
    for(IPageLink link : visibleWikiPages) {
        link.renderBackground(this, mouseX, mouseY);
    }
    GL11.glPopMatrix();

}
 
Example 17
Source File: FreecamHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	if(fakePlayer == null || !tracer.isChecked())
		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();
	
	GL11.glColor4f(1, 1, 1, 0.5F);
	
	// box
	GL11.glPushMatrix();
	GL11.glTranslated(fakePlayer.getX(), fakePlayer.getY(),
		fakePlayer.getZ());
	GL11.glScaled(fakePlayer.getWidth() + 0.1, fakePlayer.getHeight() + 0.1,
		fakePlayer.getWidth() + 0.1);
	GL11.glCallList(playerBox);
	GL11.glPopMatrix();
	
	// line
	Vec3d start =
		RotationUtils.getClientLookVec().add(RenderUtils.getCameraPos());
	Vec3d end = fakePlayer.getBoundingBox().getCenter();
	
	GL11.glBegin(GL11.GL_LINES);
	GL11.glVertex3d(start.x, start.y, start.z);
	GL11.glVertex3d(end.x, end.y, end.z);
	GL11.glEnd();
	
	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);
}
 
Example 18
Source File: PropellerEngineTileEntityRenderer.java    From Valkyrien-Skies with Apache License 2.0 4 votes vote down vote up
@Override
public void render(TileEntityPropellerEngine tileentity, double x, double y, double z,
    float partialTick,
    int destroyStage, float alpha) {
    IBlockState state = tileentity.getWorld().getBlockState(tileentity.getPos());
    if (state.getBlock() instanceof BlockAirshipEngine) {
        EnumFacing facing = state.getValue(BlockAirshipEngine.FACING);

        IBlockState engineRenderState = getRenderState(state);
        IBlockState propellerRenderState = ValkyrienSkiesControl.INSTANCE.vsControlBlocks.shipWheel
            .getStateFromMeta(14);

        this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        GlStateManager.pushMatrix();
        GlStateManager.disableLighting();
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder BufferBuilder = tessellator.getBuffer();

        double oldX = BufferBuilder.xOffset;
        double oldY = BufferBuilder.yOffset;
        double oldZ = BufferBuilder.zOffset;

        BufferBuilder.setTranslation(0, 0, 0);
        GL11.glTranslated(x, y, z);
        GlStateManager.disableAlpha();
        GlStateManager.disableBlend();

        int brightness = tileentity.getWorld().getCombinedLight(tileentity.getPos(), 0);

        // GL11.glScaled(1.2D, 1.2D, 1.2D);

        GL11.glTranslated(0.5D, 0.5D, 0.5D);

        switch (facing) {
            case UP:
                GL11.glRotated(-90, 1, 0, 0);
                break;
            case DOWN:
                GL11.glRotated(90, 1, 0, 0);
                break;
            case NORTH:
                GL11.glRotated(180, 0, 1, 0);
                break;
            case EAST:
                GL11.glRotated(90, 0, 1, 0);
                break;
            case SOUTH:
                GL11.glRotated(0, 0, 1, 0);
                break;
            case WEST:
                GL11.glRotated(270, 0, 1, 0);
                break;

        }

        GL11.glTranslated(-0.5D, -0.5D, -0.5D);

        FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(),
            engineRenderState, brightness);

        GL11.glPushMatrix();

        GL11.glTranslated(0.5D, 0.214D, 0.5D);
        GL11.glRotated(tileentity.getPropellerAngle(partialTick), 0, 0, 1);
        GL11.glScaled(1.5D, 1.5D, 1);
        GL11.glTranslated(-0.5D, -0.214D, -0.5D);

        FastBlockModelRenderer.renderBlockModel(tessellator, tileentity.getWorld(),
            propellerRenderState, brightness);

        GL11.glPopMatrix();

        GL11.glPopMatrix();

        BufferBuilder.setTranslation(oldX, oldY, oldZ);
    }
}
 
Example 19
Source File: AutoBuildHack.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onRender(float partialTicks)
{
	if(status != Status.BUILDING)
		return;
	
	double scale = 1D * 7D / 8D;
	double offset = (1D - scale) / 2D;
	Vec3d eyesPos = RotationUtils.getEyesPos();
	double rangeSq = Math.pow(range.getValue(), 2);
	
	// 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(2F);
	GL11.glDisable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_CULL_FACE);
	GL11.glDisable(GL11.GL_LIGHTING);
	GL11.glColor4f(0F, 0F, 0F, 0.5F);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	int blocksDrawn = 0;
	for(Iterator<BlockPos> itr = remainingBlocks.iterator(); itr.hasNext()
		&& blocksDrawn < 1024;)
	{
		BlockPos pos = itr.next();
		if(!BlockUtils.getState(pos).getMaterial().isReplaceable())
			continue;
		
		GL11.glPushMatrix();
		GL11.glTranslated(pos.getX(), pos.getY(), pos.getZ());
		GL11.glTranslated(offset, offset, offset);
		GL11.glScaled(scale, scale, scale);
		
		Vec3d posVec = Vec3d.ofCenter(pos);
		
		if(eyesPos.squaredDistanceTo(posVec) <= rangeSq)
			drawGreenBox();
		else
			RenderUtils.drawOutlinedBox();
		
		GL11.glPopMatrix();
		blocksDrawn++;
	}
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
	GL11.glColor4f(1, 1, 1, 1);
}
 
Example 20
Source File: AutoFarmHack.java    From Wurst7 with GNU General Public License v3.0 4 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_DEPTH_TEST);
	GL11.glDisable(GL11.GL_LIGHTING);
	
	GL11.glPushMatrix();
	RenderUtils.applyRenderOffset();
	
	GL11.glCallList(displayList);
	
	if(currentBlock != null)
	{
		GL11.glPushMatrix();
		
		Box box = new Box(BlockPos.ORIGIN);
		float p = prevProgress + (progress - prevProgress) * partialTicks;
		float red = p * 2F;
		float green = 2 - red;
		
		GL11.glTranslated(currentBlock.getX(), currentBlock.getY(),
			currentBlock.getZ());
		if(p < 1)
		{
			GL11.glTranslated(0.5, 0.5, 0.5);
			GL11.glScaled(p, p, p);
			GL11.glTranslated(-0.5, -0.5, -0.5);
		}
		
		GL11.glColor4f(red, green, 0, 0.25F);
		RenderUtils.drawSolidBox(box);
		
		GL11.glColor4f(red, green, 0, 0.5F);
		RenderUtils.drawOutlinedBox(box);
		
		GL11.glPopMatrix();
	}
	
	GL11.glPopMatrix();
	
	// GL resets
	GL11.glColor4f(1, 1, 1, 1);
	GL11.glEnable(GL11.GL_DEPTH_TEST);
	GL11.glEnable(GL11.GL_TEXTURE_2D);
	GL11.glDisable(GL11.GL_BLEND);
	GL11.glDisable(GL11.GL_LINE_SMOOTH);
}