net.minecraft.client.render.DiffuseLighting Java Examples
The following examples show how to use
net.minecraft.client.render.DiffuseLighting.
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: EditBlockScreen.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
private void renderIcon(MatrixStack matrixStack, ItemStack stack, int x, int y, boolean large) { GL11.glPushMatrix(); GL11.glTranslated(x, y, 0); double scale = large ? 1.5 : 0.75; GL11.glScaled(scale, scale, scale); DiffuseLighting.enable(); ItemStack grass = new ItemStack(Blocks.GRASS_BLOCK); ItemStack renderStack = !stack.isEmpty() ? stack : grass; WurstClient.MC.getItemRenderer().renderInGuiWithOverrides(renderStack, 0, 0); DiffuseLighting.disable(); GL11.glPopMatrix(); if(stack.isEmpty()) renderQuestionMark(matrixStack, x, y, large); }
Example #2
Source File: BlockComponent.java From Wurst7 with GNU General Public License v3.0 | 6 votes |
private void renderIcon(MatrixStack matrixStack, ItemStack stack, int x, int y, boolean large) { GL11.glPushMatrix(); GL11.glTranslated(x, y, 0); double scale = large ? 1.5 : 0.75; GL11.glScaled(scale, scale, scale); DiffuseLighting.enable(); ItemStack grass = new ItemStack(Blocks.GRASS_BLOCK); ItemStack renderStack = !stack.isEmpty() ? stack : grass; WurstClient.MC.getItemRenderer().renderInGuiWithOverrides(renderStack, 0, 0); DiffuseLighting.disable(); GL11.glPopMatrix(); if(stack.isEmpty()) renderQuestionMark(matrixStack, x, y, large); }
Example #3
Source File: CottonInventoryScreen.java From LibGui with MIT License | 6 votes |
@SuppressWarnings("deprecation") @Override public void render(MatrixStack matrices, int mouseX, int mouseY, float partialTicks) { paint(matrices, mouseX, mouseY); super.render(matrices, mouseX, mouseY, partialTicks); DiffuseLighting.disable(); //Needed because super.render leaves dirty state if (description!=null) { WPanel root = description.getRootPanel(); if (root!=null) { WWidget hitChild = root.hit(mouseX-x, mouseY-y); if (hitChild!=null) hitChild.renderTooltip(matrices, x, y, mouseX-x, mouseY-y); } } drawMouseoverTooltip(matrices, mouseX, mouseY); //Draws the itemstack tooltips }
Example #4
Source File: PlayerInventoryGCScreen.java From Galacticraft-Rewoven with MIT License | 5 votes |
@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 #5
Source File: InGameHudMixin.java From Galacticraft-Rewoven with MIT License | 5 votes |
@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 #6
Source File: PlayerInventoryScreenMixin.java From Galacticraft-Rewoven with MIT License | 5 votes |
@Inject(method = "render", at = @At("TAIL")) public void render(MatrixStack stack, int mouseX, int mouseY, float v, CallbackInfo callbackInfo) { DiffuseLighting.enable(); 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); DiffuseLighting.disable(); }
Example #7
Source File: Peek.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public void renderTooltipBox(int x1, int y1, int x2, int y2, boolean wrap) { GL12.glDisable(GL12.GL_RESCALE_NORMAL); DiffuseLighting.disable(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glTranslatef(0.0F, 0.0F, 300.0F); int int_5 = x1 + 12; int int_6 = y1 - 12; if (wrap) { if (int_5 + y2 > mc.currentScreen.width) int_5 -= 28 + y2; if (int_6 + x2 + 6 > mc.currentScreen.height) int_6 = mc.currentScreen.height - x2 - 6; } /* why the fork is this private? */ FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 4, int_5 + y2 + 3, int_6 - 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 3, int_5 + y2 + 3, int_6 + x2 + 4, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 4, int_6 - 3, int_5 - 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 3, int_6 - 3, int_5 + y2 + 4, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3 + 1, int_5 - 3 + 1, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 2, int_6 - 3 + 1, int_5 + y2 + 3, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 - 3 + 1, 1347420415, 1347420415); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 2, int_5 + y2 + 3, int_6 + x2 + 3, 1344798847, 1344798847); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); DiffuseLighting.enable(); GL12.glEnable(GL12.GL_RESCALE_NORMAL); }
Example #8
Source File: Window.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
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 #9
Source File: Peek.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
public void renderTooltipBox(int x1, int y1, int x2, int y2, boolean wrap) { GL12.glDisable(GL12.GL_RESCALE_NORMAL); DiffuseLighting.disable(); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glTranslatef(0.0F, 0.0F, 300.0F); int int_5 = x1 + 12; int int_6 = y1 - 12; if (wrap) { if (int_5 + y2 > mc.currentScreen.width) int_5 -= 28 + y2; if (int_6 + x2 + 6 > mc.currentScreen.height) int_6 = mc.currentScreen.height - x2 - 6; } /* why the fork is this private? */ FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 4, int_5 + y2 + 3, int_6 - 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 3, int_5 + y2 + 3, int_6 + x2 + 4, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 4, int_6 - 3, int_5 - 3, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 3, int_6 - 3, int_5 + y2 + 4, int_6 + x2 + 3, -267386864, -267386864); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3 + 1, int_5 - 3 + 1, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 + y2 + 2, int_6 - 3 + 1, int_5 + y2 + 3, int_6 + x2 + 3 - 1, 1347420415, 1344798847); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 - 3, int_5 + y2 + 3, int_6 - 3 + 1, 1347420415, 1347420415); FabricReflect.invokeMethod(mc.currentScreen, "", "fillGradient", int_5 - 3, int_6 + x2 + 2, int_5 + y2 + 3, int_6 + x2 + 3, 1344798847, 1344798847); GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthMask(true); GL11.glEnable(GL11.GL_DEPTH_TEST); DiffuseLighting.enable(); GL12.glEnable(GL12.GL_RESCALE_NORMAL); }
Example #10
Source File: Window.java From bleachhack-1.14 with GNU General Public License v3.0 | 5 votes |
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 #11
Source File: DefaultCompressingCategory.java From Galacticraft-Rewoven with MIT License | 4 votes |
public List<Widget> setupDisplay(DefaultCompressingDisplay recipeDisplay, Rectangle bounds) { final Point startPoint = new Point(bounds.getCenterX() - 68, bounds.getCenterY() - 37); class BaseWidget extends Widget { BaseWidget() { } public void render(MatrixStack stack, int mouseX, int mouseY, float delta) { //super.render(stack, mouseX, mouseY, delta); DiffuseLighting.disable(); MinecraftClient.getInstance().getTextureManager().bindTexture(DefaultCompressingCategory.DISPLAY_TEXTURE); this.drawTexture(stack, startPoint.x, startPoint.y, 0, 83, 137, 157); int height = MathHelper.ceil((double) (System.currentTimeMillis() / 250L) % 14.0D / 1.0D); this.drawTexture(stack, startPoint.x + 2, startPoint.y + 21 + (14 - height), 82, 77 + (14 - height), 14, height); int width = MathHelper.ceil((double) (System.currentTimeMillis() / 250L) % 24.0D / 1.0D); this.drawTexture(stack, startPoint.x + 24, startPoint.y + 18, 82, 91, width, 17); } @Override public List<? extends Element> children() { return new ArrayList<>(); } } List<Widget> widgets = new LinkedList<>(Collections.singletonList(new BaseWidget())); List<List<EntryStack>> input = recipeDisplay.getInputEntries(); List<Slot> slots = Lists.newArrayList(); // 3x3 grid // Output int i; for (i = 0; i < 3; ++i) { for (int x = 0; x < 3; ++x) { slots.add(Widgets.createSlot(new Point(startPoint.x + (x * 18) + 1, startPoint.y + (i * 18) + 1))); } } for (i = 0; i < input.size(); ++i) { if (!input.get(i).isEmpty()) { slots.get(this.getSlotWithSize(recipeDisplay, i)).entries(input.get(i)); } } widgets.addAll(slots); widgets.add(Widgets.createSlot(new Point(startPoint.x + 120, startPoint.y + (18) + 3)).entries(new ArrayList<>(Objects.requireNonNull(recipeDisplay).getOutputEntries()))); widgets.add(Widgets.createSlot(new Point(startPoint.x + (2 * 18) + 1, startPoint.y + (18 * 3) + 4)).entries(AbstractFurnaceBlockEntity.createFuelTimeMap().keySet().stream().map(EntryStack::create).collect(Collectors.toList()))); return widgets; }
Example #12
Source File: DefaultFabricationCategory.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override public List<Widget> setupDisplay(DefaultFabricationDisplay recipeDisplay, Rectangle bounds) { final Point startPoint = new Point(bounds.getCenterX() - 81, bounds.getCenterY() - 41); class BaseWidget extends Widget { private BaseWidget() { } public void render(MatrixStack stack, int mouseX, int mouseY, float delta) { //super.render(mouseX, mouseY, delta); DiffuseLighting.disable(); MinecraftClient.getInstance().getTextureManager().bindTexture(DefaultFabricationCategory.DISPLAY_TEXTURE); this.drawTexture(stack, startPoint.x, startPoint.y, 0, 0, 162, 82); int height = MathHelper.ceil((double) (System.currentTimeMillis() / 250L) % 14.0D / 1.0D); this.drawTexture(stack, startPoint.x + 2, startPoint.y + 21 + (14 - height), 82, 77 + (14 - height), 14, height); int width = MathHelper.ceil((double) (System.currentTimeMillis() / 250L) % 24.0D / 1.0D); this.drawTexture(stack, startPoint.x + 24, startPoint.y + 18, 82, 91, width, 17); } @Override public List<? extends Element> children() { return new ArrayList<>(); } } List<Widget> widgets = new LinkedList<>(); widgets.add(new BaseWidget()); // Diamond input // Silicon // Silicon // Redstone // User input // Output widgets.add(Widgets.createSlot(new Point(startPoint.x + 1, startPoint.y + 1)).entry(EntryStack.create(new ItemStack(Items.DIAMOND)))); widgets.add(Widgets.createSlot(new Point(startPoint.x + (18 * 7) + 1, startPoint.y + 1)).entries(recipeDisplay.getInput().get(0))); widgets.add(Widgets.createSlot(new Point(startPoint.x + (18 * 3) + 1, startPoint.y + 47)).entry(EntryStack.create(new ItemStack(GalacticraftItems.RAW_SILICON)))); widgets.add(Widgets.createSlot(new Point(startPoint.x + (18 * 3) + 1, startPoint.y + 47 + 18)).entry(EntryStack.create(new ItemStack(GalacticraftItems.RAW_SILICON)))); widgets.add(Widgets.createSlot(new Point(startPoint.x + (18 * 6) + 1, startPoint.y + 47)).entry(EntryStack.create(new ItemStack(Items.REDSTONE)))); widgets.add(Widgets.createSlot(new Point(startPoint.x + (18 * 8) + 1, startPoint.y + 47 + 18)).entries(recipeDisplay.getOutputEntries())); return widgets; }
Example #13
Source File: EditBlockListScreen.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private String renderIconAndGetName(MatrixStack matrixStack, ItemStack stack, int x, int y, boolean large) { if(stack.isEmpty()) { GL11.glPushMatrix(); GL11.glTranslated(x, y, 0); if(large) GL11.glScaled(1.5, 1.5, 1.5); else GL11.glScaled(0.75, 0.75, 0.75); DiffuseLighting.enable(); mc.getItemRenderer().renderInGuiWithOverrides( new ItemStack(Blocks.GRASS_BLOCK), 0, 0); DiffuseLighting.disable(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(x, y, 0); if(large) GL11.glScaled(2, 2, 2); GL11.glDisable(GL11.GL_DEPTH_TEST); TextRenderer fr = mc.textRenderer; fr.drawWithShadow(matrixStack, "?", 3, 2, 0xf0f0f0); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); return "\u00a7ounknown block\u00a7r"; }else { GL11.glPushMatrix(); GL11.glTranslated(x, y, 0); if(large) GL11.glScaled(1.5, 1.5, 1.5); else GL11.glScaled(0.75, 0.75, 0.75); DiffuseLighting.enable(); mc.getItemRenderer().renderInGuiWithOverrides(stack, 0, 0); DiffuseLighting.disable(); GL11.glPopMatrix(); return stack.getName().getString(); } }
Example #14
Source File: EditItemListScreen.java From Wurst7 with GNU General Public License v3.0 | 4 votes |
private String renderIconAndGetName(MatrixStack matrixStack, ItemStack stack, int x, int y, boolean large) { if(stack.isEmpty()) { GL11.glPushMatrix(); GL11.glTranslated(x, y, 0); if(large) GL11.glScaled(1.5, 1.5, 1.5); else GL11.glScaled(0.75, 0.75, 0.75); DiffuseLighting.enable(); mc.getItemRenderer().renderInGuiWithOverrides( new ItemStack(Blocks.GRASS_BLOCK), 0, 0); DiffuseLighting.disable(); GL11.glPopMatrix(); GL11.glPushMatrix(); GL11.glTranslated(x, y, 0); if(large) GL11.glScaled(2, 2, 2); GL11.glDisable(GL11.GL_DEPTH_TEST); TextRenderer fr = mc.textRenderer; fr.drawWithShadow(matrixStack, "?", 3, 2, 0xf0f0f0); GL11.glEnable(GL11.GL_DEPTH_TEST); GL11.glPopMatrix(); return "\u00a7ounknown item\u00a7r"; }else { GL11.glPushMatrix(); GL11.glTranslated(x, y, 0); if(large) GL11.glScaled(1.5, 1.5, 1.5); else GL11.glScaled(0.75, 0.75, 0.75); DiffuseLighting.enable(); mc.getItemRenderer().renderInGuiWithOverrides(stack, 0, 0); DiffuseLighting.disable(); GL11.glPopMatrix(); return stack.getName().getString(); } }
Example #15
Source File: NotebotScreen.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
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 #16
Source File: NotebotScreen.java From bleachhack-1.14 with GNU General Public License v3.0 | 4 votes |
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); } } }