Java Code Examples for net.minecraft.client.render.DiffuseLighting#enableGuiDepthLighting()

The following examples show how to use net.minecraft.client.render.DiffuseLighting#enableGuiDepthLighting() . 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: PlayerInventoryGCScreen.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
public void render(MatrixStack stack, int x, int y, float lastFrameDuration) {
    this.renderBackground(stack);
    super.render(stack, x, y, lastFrameDuration);
    this.drawMouseoverTooltip(stack, x, y);

    this.mouseX = (float) x;
    this.mouseY = (float)/*y*/ this.client.getWindow().getScaledHeight() / 2;

    DiffuseLighting.enableGuiDepthLighting();
    this.itemRenderer.renderInGuiWithOverrides(Items.CRAFTING_TABLE.getStackForRender(), this.x + 6, this.y - 20);
    this.itemRenderer.renderInGuiWithOverrides(GalacticraftItems.OXYGEN_MASK.getStackForRender(), this.x + 35, this.y - 20);
}
 
Example 2
Source File: InGameHudMixin.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Inject(method = "render", at = @At(value = "TAIL"))
private void draw(MatrixStack stack, float float_1, CallbackInfo ci) {
    if (CelestialBodyType.getByDimType(client.player.world.getRegistryKey()).isPresent() && !CelestialBodyType.getByDimType(client.player.world.getRegistryKey()).get().getAtmosphere().getComposition().containsKey(AtmosphericGas.OXYGEN)) {
        DiffuseLighting.enableGuiDepthLighting();
        client.getTextureManager().bindTexture(new Identifier(Constants.MOD_ID, Constants.ScreenTextures.getRaw(Constants.ScreenTextures.OVERLAY)));

        this.drawTexture(stack, this.scaledWidth - 17, 5, OXYGEN_X, OXYGEN_Y, OXYGEN_WIDTH, OXYGEN_HEIGHT);
        this.drawTexture(stack, this.scaledWidth - 34, 5, OXYGEN_X, OXYGEN_Y, OXYGEN_WIDTH, OXYGEN_HEIGHT);

        if (!client.player.isCreative()) {
            SimpleInventoryComponent gearInventory = ((GCPlayerAccessor) this.client.player).getGearInventory();
            if (gearInventory.getStack(6).getItem() instanceof OxygenTankItem) {
                this.drawTexture(stack, this.scaledWidth - 17 + OXYGEN_WIDTH, 5 + OXYGEN_HEIGHT, OXYGEN_OVERLAY_X, OXYGEN_OVERLAY_Y, -OXYGEN_WIDTH, (int) -((double) OXYGEN_HEIGHT - ((double) OXYGEN_HEIGHT * (((double) gearInventory.getStack(6).getMaxDamage() - (double) gearInventory.getStack(6).getDamage()) / (double) gearInventory.getStack(6).getMaxDamage()))));
            } else if (client.player.isCreative()) {
                this.drawTexture(stack, this.scaledWidth - 17 + OXYGEN_WIDTH, 5 + OXYGEN_HEIGHT, OXYGEN_OVERLAY_X, OXYGEN_OVERLAY_Y, -OXYGEN_WIDTH, -OXYGEN_HEIGHT);
            }
            if (gearInventory.getStack(7).getItem() instanceof OxygenTankItem) {
                this.drawTexture(stack, this.scaledWidth - 34 + OXYGEN_WIDTH, 5 + OXYGEN_HEIGHT, OXYGEN_OVERLAY_X, OXYGEN_OVERLAY_Y, -OXYGEN_WIDTH, (int) -((double) OXYGEN_HEIGHT - ((double) OXYGEN_HEIGHT * (((double) gearInventory.getStack(7).getMaxDamage() - (double) gearInventory.getStack(7).getDamage()) / (double) gearInventory.getStack(7).getMaxDamage()))));
            } else if (client.player.isCreative()) {
                this.drawTexture(stack, this.scaledWidth - 34 + OXYGEN_WIDTH, 5 + OXYGEN_HEIGHT, OXYGEN_OVERLAY_X, OXYGEN_OVERLAY_Y, -OXYGEN_WIDTH, -OXYGEN_HEIGHT);
            }
        } else {
            this.drawTexture(stack, this.scaledWidth - 17, 5, 12, 40, OXYGEN_WIDTH, OXYGEN_HEIGHT);
            this.drawTexture(stack, this.scaledWidth - 34, 5, 12, 40, OXYGEN_WIDTH, OXYGEN_HEIGHT);
        }
    }
}
 
Example 3
Source File: Window.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void render(MatrixStack matrix, int mX, int mY) {
	TextRenderer textRend = MinecraftClient.getInstance().textRenderer;
	
	if (dragging) {
		x2 = (x2 - x1) + mX - dragOffX;
		y2 = (y2 - y1) + mY - dragOffY;
		x1 = mX - dragOffX;
		y1 = mY - dragOffY;
	}
	
	drawBar(matrix, mX, mY, textRend);
	
	for (WindowButton w: buttons) {
		int bx1 = x1 + w.x1;
		int by1 = y1 + w.y1;
		int bx2 = x1 + w.x2;
		int by2 = y1 + w.y2;
		
		Screen.fill(matrix, bx1, by1, bx2 - 1, by2 - 1, 0xffb0b0b0);
		Screen.fill(matrix, bx1 + 1, by1 + 1, bx2, by2, 0xff000000);
		Screen.fill(matrix, bx1 + 1, by1 + 1, bx2 - 1, by2 - 1,
				selected && mX >= bx1 && mX <= bx2 && mY >= by1 && mY <= by2 ? 0xff959595 : 0xff858585);
		textRend.drawWithShadow(matrix, w.text, bx1 + (bx2 - bx1) / 2 - textRend.getWidth(w.text) / 2, by1 + (by2 - by1) / 2 - 4, -1);
	}
	
	/* window icon */
	if (icon != null && selected) {
		GL11.glPushMatrix();
		GL11.glScaled(0.55, 0.55, 1);
		DiffuseLighting.enableGuiDepthLighting();
		MinecraftClient.getInstance().getItemRenderer().renderGuiItemIcon(icon, (int)((x1 + 3) * 1/0.55), (int)((y1 + 3) * 1/0.55));
		GL11.glPopMatrix();
	}
	
	/* window title */
	textRend.drawWithShadow(matrix, title, x1 + (icon == null || !selected || icon.getItem() == Items.AIR ? 4 : 15), y1 + 3, -1);
}
 
Example 4
Source File: Window.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void render(int mX, int mY) {
	TextRenderer textRend = MinecraftClient.getInstance().textRenderer;
	
	if (dragging) {
		x2 = (x2 - x1) + mX - dragOffX;
		y2 = (y2 - y1) + mY - dragOffY;
		x1 = mX - dragOffX;
		y1 = mY - dragOffY;
	}
	
	drawBar(mX, mY, textRend);
	
	for (WindowButton w: buttons) {
		int bx1 = x1 + w.x1;
		int by1 = y1 + w.y1;
		int bx2 = x1 + w.x2;
		int by2 = y1 + w.y2;
		
		Screen.fill(bx1, by1, bx2 - 1, by2 - 1, 0xffb0b0b0);
		Screen.fill(bx1 + 1, by1 + 1, bx2, by2, 0xff000000);
		Screen.fill(bx1 + 1, by1 + 1, bx2 - 1, by2 - 1,
				selected && mX >= bx1 && mX <= bx2 && mY >= by1 && mY <= by2 ? 0xff959595 : 0xff858585);
		textRend.drawWithShadow(w.text, bx1 + (bx2 - bx1) / 2 - textRend.getStringWidth(w.text) / 2, by1 + (by2 - by1) / 2 - 4, -1);
	}
	
	/* window icon */
	if (icon != null && selected) {
		GL11.glPushMatrix();
		GL11.glScaled(0.55, 0.55, 1);
		DiffuseLighting.enableGuiDepthLighting();
		MinecraftClient.getInstance().getItemRenderer().renderGuiItem(icon, (int)((x1 + 3) * 1/0.55), (int)((y1 + 3) * 1/0.55));
		GL11.glPopMatrix();
	}
	
	/* window title */
	textRend.drawWithShadow(title, x1 + (icon == null || !selected || icon.getItem() == Items.AIR ? 4 : 15), y1 + 3, -1);
}
 
Example 5
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 6
Source File: NotebotScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 4 votes vote down vote up
public void onRenderWindow(int window, int mX, int mY) {
	super.onRenderWindow(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(font, "Tutorial..", x + w - 24, y + 4, 0x9090c0);
		
		int pageEntries = 0;
		for (int i = y + 20; i < y + h - 27; i += 10) pageEntries++;
		
		drawCenteredString(font, "<  Page " + (page + 1) + "  >", x + 55, y + 5, 0xc0c0ff);
		
		fillButton(x + 10, y + h - 13, x + 99, y + h - 3, 0xff3a3a3a, 0xff353535, mX, mY);
		drawCenteredString(font, "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(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(font, s, x + 55, y + 16 + c * 10, -1);
			else drawString(font, cutText(s, 105), x + 5, y + 16 + c * 10, -1);
			c++;
		}
		
		if (entry != null) {
			drawCenteredString(font, entry.fileName, x + w - w / 4, y + 10, 0xa030a0);
			drawCenteredString(font, entry.length / 20 + "s", x + w - w / 4, y + 20, 0xc000c0);
			drawCenteredString(font, "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(font, 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.renderGuiItem(new ItemStack(Items.DIRT), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BASEDRUM) itemRenderer.renderGuiItem(new ItemStack(Items.STONE), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.SNARE) itemRenderer.renderGuiItem(new ItemStack(Items.SAND), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.HAT) itemRenderer.renderGuiItem(new ItemStack(Items.GLASS), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BASS) itemRenderer.renderGuiItem(new ItemStack(Items.OAK_WOOD), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.FLUTE) itemRenderer.renderGuiItem(new ItemStack(Items.CLAY), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BELL) itemRenderer.renderGuiItem(new ItemStack(Items.GOLD_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.GUITAR) itemRenderer.renderGuiItem(new ItemStack(Items.WHITE_WOOL), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.CHIME) itemRenderer.renderGuiItem(new ItemStack(Items.PACKED_ICE), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.XYLOPHONE) itemRenderer.renderGuiItem(new ItemStack(Items.BONE_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.IRON_XYLOPHONE) itemRenderer.renderGuiItem(new ItemStack(Items.IRON_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.COW_BELL) itemRenderer.renderGuiItem(new ItemStack(Items.SOUL_SAND), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.DIDGERIDOO) itemRenderer.renderGuiItem(new ItemStack(Items.PUMPKIN), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BIT) itemRenderer.renderGuiItem(new ItemStack(Items.EMERALD_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.BANJO) itemRenderer.renderGuiItem(new ItemStack(Items.HAY_BLOCK), x + w - w / 4 + 40, y + 46 + c2 * 10);
				if (e.getKey() == Instrument.PLING) itemRenderer.renderGuiItem(new ItemStack(Items.GLOWSTONE), x + w - w / 4 + 40, y + 46 + c2 * 10);
				c2++;
				GL11.glPopMatrix();
			}
			
			fillButton(x + w - w / 2 + 10, y + h - 15, x + w - w / 4, y + h - 5, 0xff903030, 0xff802020, mX, mY);
			fillButton(x + w - w / 4 + 5, y + h - 15, x + w - 5, y + h - 5, 0xff308030, 0xff207020, mX, mY);
			fillButton(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(x + w - w / 4 - w / 8, y + h - 27, (x + w - w / 4 - w / 8) + pixels, y + h - 17, 0x507050ff);
			
			drawCenteredString(font, "Delete", (int)(x + w - w / 2.8), y + h - 14, 0xff0000);
			drawCenteredString(font, "Select", x + w - w / 8, y + h - 14, 0x00ff00);
			drawCenteredString(font, (entry.playing ? "Playing" : "Play") + " (scuffed)", x + w - w / 4, y + h - 26, 0x6060ff);
		}
	}
}