net.minecraft.client.gui.screen.Screen Java Examples

The following examples show how to use net.minecraft.client.gui.screen.Screen. 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: Peek.java    From bleachhack-1.14 with GNU General Public License v3.0 6 votes vote down vote up
public void drawMapToolTip(Slot slot, int mX, int mY) {
	if (slot.getStack().getItem() != Items.FILLED_MAP) return;
	
	MapState data = FilledMapItem.getMapState(slot.getStack(), mc.world);
	byte[] colors = data.colors;
	
	double size = getSettings().get(3).toSlider().getValue();
	
	GL11.glPushMatrix();
	GL11.glScaled(size, size, 1.0);
	GL11.glTranslatef(0.0F, 0.0F, 300.0F);
	int x = (int) (mX*(1/size) + 12*(1/size));
	int y = (int) (mY*(1/size) - 12*(1/size) - 140);
	
	renderTooltipBox(x - 12, y + 12, 128, 128, false);
	for (byte c: colors) {
		int c1 = c & 255;
		
		if (c1 / 4 != 0) Screen.fill(x, y, x+1, y+1, getRenderColorFix(MaterialColor.COLORS[c1 / 4].color, c1 & 3));
		if (x - (int) (mX*(1/size)+12*(1/size)) == 127) { x = (int) (mX*(1/size)+12*(1/size)); y++; }
		else x++;
	}
	
	GL11.glPopMatrix();
}
 
Example #2
Source File: RecipeBook_1_12.java    From multiconnect with MIT License 6 votes vote down vote up
private int calcCraftCount(int possibleCraftCount, boolean alreadyPlaced) {
    int stackSize = 1;

    if (Screen.hasShiftDown()) {
        // craft all
        stackSize = possibleCraftCount;
    } else if (alreadyPlaced) {
        // craft single, find the item already in place with the minimum count and add one more craft than that
        stackSize = 64;
        for (int i = 0; i < container.getCraftingSlotCount(); i++) {
            if (i == container.getCraftingResultSlotIndex()) continue;

            ItemStack stack = container.getSlot(i).getStack();
            if (!stack.isEmpty() && stack.getCount() < stackSize) {
                stackSize = stack.getCount();
            }
        }

        if (stackSize < 64) {
            stackSize++;
        }
    }

    return stackSize;
}
 
Example #3
Source File: BlockComponent.java    From Wurst7 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void handleMouseClick(double mouseX, double mouseY, int mouseButton)
{
	if(mouseX < getX() + getWidth() - BLOCK_WITDH)
		return;
	
	if(mouseButton == 0)
	{
		Screen currentScreen = WurstClient.MC.currentScreen;
		EditBlockScreen editScreen =
			new EditBlockScreen(currentScreen, setting);
		WurstClient.MC.openScreen(editScreen);
		
	}else if(mouseButton == 1)
		setting.resetToDefault();
}
 
Example #4
Source File: MixinKeyboard.java    From patchwork-api with GNU Lesser General Public License v2.1 6 votes vote down vote up
@Inject(method = "method_1454", at = @At("HEAD"), cancellable = true)
private void preKeyEvent(int i, boolean[] bls, ParentElement element, int key, int scanCode, int mods, CallbackInfo info) {
	if (i != 1 && (i != 2 || !this.repeatEvents)) {
		if (i == 0) {
			if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.KeyboardKeyReleasedEvent.Pre((Screen) element, key, scanCode, mods))) {
				bls[0] = true;
				info.cancel();
			}
		}
	} else {
		if (MinecraftForge.EVENT_BUS.post(new GuiScreenEvent.KeyboardKeyPressedEvent.Pre((Screen) element, key, scanCode, mods))) {
			bls[0] = true;
			info.cancel();
		}
	}
}
 
Example #5
Source File: ClientPacketHandler.java    From CodeChickenLib with GNU Lesser General Public License v2.1 6 votes vote down vote up
@SuppressWarnings ("unchecked")
private void handleOpenContainer(PacketCustom packet, Minecraft mc) {
    ContainerType<?> rawType = packet.readRegistryIdUnsafe(ForgeRegistries.CONTAINERS);
    int windowId = packet.readVarInt();
    ITextComponent name = packet.readTextComponent();
    if (rawType instanceof ICCLContainerType<?>) {
        ICCLContainerType<?> type = (ICCLContainerType<?>) rawType;
        ScreenManager.getScreenFactory(rawType, mc, windowId, name)//
                .map(e -> (ScreenManager.IScreenFactory<Container, ?>) e)//
                .ifPresent(screenFactory -> {
                    Container container = type.create(windowId, Minecraft.getInstance().player.inventory, packet);
                    Screen screen = screenFactory.create(container, mc.player.inventory, name);
                    mc.player.openContainer = ((IHasContainer<?>) screen).getContainer();
                    mc.displayGuiScreen(screen);
                });

    }
}
 
Example #6
Source File: PressAKeyScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
public PressAKeyScreen(PressAKeyCallback prevScreen)
{
	super(new LiteralText(""));
	
	if(!(prevScreen instanceof Screen))
		throw new IllegalArgumentException("prevScreen is not a screen");
	
	this.prevScreen = prevScreen;
}
 
Example #7
Source File: SliderComponent.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
private void handleLeftClick()
{
	if(Screen.hasControlDown())
		MC.openScreen(new EditSliderScreen(MC.currentScreen, setting));
	else
		dragging = true;
}
 
Example #8
Source File: StandardWrenchItem.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
@Environment(EnvType.CLIENT)
public void appendTooltip(ItemStack itemStack_1, World world_1, List<Text> list_1, TooltipContext tooltipContext_1) {
    if (Screen.hasShiftDown()) {
        list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.standard_wrench").setStyle(Style.EMPTY.withColor(Formatting.GRAY)));
    } else {
        list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY)));
    }
}
 
Example #9
Source File: ClickGuiScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBindSetting(Module m, int key, int x, int y) {
	Screen.fill(x, y+11, x+len-2, y+12, 0x90b0b0b0);
	Screen.fill(x+len - 2, y, x+len-1, y+12, 0x90b0b0b0);
	Screen.fill(x, y - 1, x + 1, y+11, 0x90000000);
	
	if (key != -1 && mouseOver(x, y, x+len, y+12)) m.setKey((key != 261 && key != 256) ? key : -1);
	String name = InputUtil.getKeycodeName(m.getKey());
	if (name == null) name = "KEY" + m.getKey();
	if (name.isEmpty()) name = "NONE";
	
	font.drawWithShadow("Bind: " + name + (mouseOver(x, y, x+len, y+12) ? "..." : "")
			, x+2, y+2, mouseOver(x, y, x+len, y+12) ? 0xcfc3cf : 0xcfe0cf);
}
 
Example #10
Source File: ClientPlayNetworkHandlerMixin.java    From the-hallow with MIT License 5 votes vote down vote up
@Redirect(method = "onPlayerRespawn(Lnet/minecraft/client/network/packet/PlayerRespawnS2CPacket;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;openScreen(Lnet/minecraft/client/gui/screen/Screen;)V", ordinal = 0))
private void redirectOpenScreen_onPlayerRespawn(MinecraftClient client, Screen screen, PlayerRespawnS2CPacket packet) {
	if (packet.getDimension() == HallowedDimensions.THE_HALLOW) {
		Screen current = client.currentScreen;
		if (!(current instanceof HallowedLoadingScreen)) {
			client.openScreen(new HallowedLoadingScreen());
		}
	} else {
		client.openScreen(screen);
	}
}
 
Example #11
Source File: CompressorBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
@Environment(EnvType.CLIENT)
public final void buildTooltip(ItemStack itemStack_1, BlockView blockView_1, List<Text> list_1, TooltipContext tooltipContext_1) {
    if (Screen.hasShiftDown()) {
        list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.compressor").setStyle(Style.EMPTY.withColor(Formatting.GRAY)));
    } else {
        list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY)));
    }
}
 
Example #12
Source File: GlowstoneWallTorchBlock.java    From Galacticraft-Rewoven with MIT License 5 votes vote down vote up
@Override
@Environment(EnvType.CLIENT)
public void buildTooltip(ItemStack itemStack, BlockView blockView, List<Text> list, TooltipContext tooltipContext) {
    if (Screen.hasShiftDown()) {
        list.add(new TranslatableText("tooltip.galacticraft-rewoven.glowstone_torch").setStyle(Style.EMPTY.withColor(Formatting.GRAY)));
    } else {
        list.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.GRAY)));
    }
}
 
Example #13
Source File: ModuleWindowLight.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawToggleSetting(SettingToggle s, int x, int y) {
	int color;
	String color2;
	
	if (s.state) { if (mouseOver(x, y, x+len, y+12)) {color = 0x9020ff20; color2 = "§2";} else {color = 0x7020ff20; color2 = "§a";}
	} else { if (mouseOver(x, y, x+len, y+12)) {color = 0x90ff2020; color2 = "§4";} else {color = 0x70ff2020; color2 = "§c";} }
	
	Screen.fill(x, y, x+len, y+12, 0x70000000);
	Screen.fill(x, y, x+1, y+12, color);
	font.drawWithShadow(color2 + s.text, x+3, y+2, -1);
	
	if (mouseOver(x, y, x+len, y+12) && lmDown) s.state = !s.state;
}
 
Example #14
Source File: ModuleWindowLight.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBindSetting(Module m, int key, int x, int y) {
	Screen.fill(x, y, x+len, y+12, 0x70000000);
	
	if (key != -1 && mouseOver(x, y, x+len, y+12)) m.setKey((key != 261 && key != 256) ? key : -1);
	String name = InputUtil.getKeycodeName(m.getKey());
	if (name == null) name = "KEY" + m.getKey();
	if (name.isEmpty()) name = "NONE";
	
	font.drawWithShadow("Bind: " + name + (mouseOver(x, y, x+len, y+12) ? "..." : "")
			, x+2, y+2, mouseOver(x, y, x+len, y+12) ? 0xffc3ff : 0xffe0ff);
}
 
Example #15
Source File: ModuleWindowLight.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawSliderSetting(SettingSlider s, int x, int y) {
	int pixels = (int) Math.round(MathHelper.clamp(len*((s.getValue() - s.min) / (s.max - s.min)), 0, len));
	Screen.fill(x, y, x+len, y+12, 0x70000000);
	Screen.fill(x, y, x+pixels, y+12, 0xf03080a0);
	
	font.drawWithShadow(s.text + (s.round == 0  && s.getValue() > 100 ? Integer.toString((int)s.getValue()) : s.getValue()),
			x+2, y+2, mouseOver(x, y, x+len, y+12) ? 0xffc3ff : 0xffe0ff);
	
	if (mouseOver(x, y, x+len, y+12) && lmHeld) {
		int percent = ((mouseX - x) * 100) / len;
			
		s.setValue(s.round(percent*((s.max - s.min) / 100) + s.min, s.round));
	}
}
 
Example #16
Source File: MinecraftClientMixin.java    From the-hallow with MIT License 5 votes vote down vote up
@Redirect(method = "joinWorld(Lnet/minecraft/client/world/ClientWorld;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;reset(Lnet/minecraft/client/gui/screen/Screen;)V", ordinal = 0))
private void redirectReset_joinWorld(MinecraftClient client, Screen screen, ClientWorld world) {
	if (world.getDimension().getType() == HallowedDimensions.THE_HALLOW) {
		reset(new HallowedLoadingScreen());
	} else {
		reset(screen);
	}
}
 
Example #17
Source File: ModuleWindow.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public ModuleWindow(Screen screen, List<Module> mods, String name, int len, int len2, int posX, int posY) {
	this.screen = screen;
	this.mods = mods;
	this.name = name;
	this.len = len;
	this.len2 = len2;
	this.posX = posX;
	this.posY = posY;
}
 
Example #18
Source File: EditAltScreen.java    From Wurst7 with GNU General Public License v3.0 5 votes vote down vote up
public EditAltScreen(Screen prevScreen, AltManager altManager,
	Alt editedAlt)
{
	super(prevScreen, new LiteralText("Edit Alt"));
	this.altManager = altManager;
	this.editedAlt = editedAlt;
}
 
Example #19
Source File: ModuleWindowFuture.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawToggleSetting(SettingToggle s, int x, int y) {
	Screen.fill(x, y, x+len, y+14, mouseOver(x, y, x+len, y+14) ? 0x70303030 : 0x70000000);
	if (s.state) Screen.fill(x+1, y, x+len-1, y+14, mouseOver(x, y, x+len, y+14) ? 0x90ff0000 : 0x70ff0000);
	font.drawWithShadow(s.text, x+3, y+3, -1);
	
	if (mouseOver(x, y, x+len, y+14) && lmDown) s.state = !s.state;
}
 
Example #20
Source File: WWidget.java    From LibGui with MIT License 5 votes vote down vote up
/**
 * Internal method to render tooltip data. This requires an overriden {@link #addTooltip(List)
 * addTooltip} method to insert data into the tooltip - without this, the method returns early, because no work
 */
@Environment(EnvType.CLIENT)
public void renderTooltip(MatrixStack matrices, int x, int y, int tX, int tY) {
	List<StringRenderable> info = new ArrayList<>();
	addTooltip(info);

	if (info.size() == 0)
		return;

	Screen screen = MinecraftClient.getInstance().currentScreen;
	screen.renderTooltip(matrices, info, tX+x, tY+y);
}
 
Example #21
Source File: WLabel.java    From LibGui with MIT License 5 votes vote down vote up
@Environment(EnvType.CLIENT)
@Override
public void onClick(int x, int y, int button) {
	Style hoveredTextStyle = getTextStyleAt(x, y);
	if (hoveredTextStyle != null) {
		Screen screen = MinecraftClient.getInstance().currentScreen;
		if (screen != null) {
			screen.handleTextClick(hoveredTextStyle);
		}
	}
}
 
Example #22
Source File: ModuleWindowLight.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawModeSetting(SettingMode s, int x, int y) {
	Screen.fill(x, y, x+len, y+12, 0x70000000);
	font.drawWithShadow(s.text + s.modes[s.mode],x+2, y+2,
			mouseOver(x, y, x+len, y+12) ? 0xffc3ff : 0xffe0ff);
	
	if (mouseOver(x, y, x+len, y+12) && lmDown) s.mode = s.getNextMode();
}
 
Example #23
Source File: ModuleWindow.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawToggleSetting(SettingToggle s, int x, int y) {
	String color;
	
	if (s.state) { if (mouseOver(x, y, x+len2, y+10)) color = "�2"; else color = "�a";
	} else { if (mouseOver(x, y, x+len2, y+10)) color = "�4"; else color = "�c"; }
	
	Screen.fill(x, y, x+len2, y+10, 0x70000000);
	screen.drawString(font, "| " + color + s.text, x+2, y+1, mouseOver(x, y, x+len2, y+10) ? 0xffc3ff : 0xffe0ff);
	
	if (mouseOver(x, y, x+len2, y+10) && lmDown) s.state = !s.state;
}
 
Example #24
Source File: ClientEventHandler.java    From Better-Sprinting with Mozilla Public License 2.0 5 votes vote down vote up
@SubscribeEvent
public static void onGuiInitPost(GuiScreenEvent.InitGuiEvent.Post e){
	Screen gui = e.getGui();
	
	if (gui instanceof ControlsScreen){
		ControlsScreen controls = (ControlsScreen)gui;
		
		e.getWidgetList()
		 .stream()
		 .filter(btn -> btn instanceof OptionButton && ((OptionButton)btn).enumOptions == AbstractOption.AUTO_JUMP)
		 .findFirst()
		 .ifPresent(e::removeWidget);
		
		controls.children()
		        .stream()
		        .filter(widget -> widget instanceof KeyBindingList)
		        .map(widget -> ((KeyBindingList)widget).children())
		        .findFirst()
		        .ifPresent(children -> children.removeIf(entry ->
		        	(entry instanceof KeyEntry && ArrayUtils.contains(ClientModManager.keyBindings, ((KeyEntry)entry).keybinding)) ||
		        	(entry instanceof CategoryEntry && ((CategoryEntry)entry).labelText.equals(I18n.format(ClientModManager.categoryName)))
		        ));
		
		if (!openedControlsFromSprintMenu){
			e.addWidget(new GuiButton((controls.width / 2) + 5, 18, 150, "Better Sprinting", () -> mc.displayGuiScreen(new GuiSprint(mc.currentScreen))));
		}
	}
}
 
Example #25
Source File: GuiPonySettings.java    From MineLittlePony with MIT License 5 votes vote down vote up
public GuiPonySettings(@Nullable Screen parent) {
    super(new LiteralText(OPTIONS_PREFIX + "title"), parent);

    config = (ClientPonyConfig)MineLittlePony.getInstance().getConfig();

    content.margin.top = 30;
    content.margin.bottom = 30;
    content.padding.top = 10;
    content.padding.right = 10;
    content.padding.bottom = 20;

    hiddenOptions = Screen.hasControlDown() && Screen.hasShiftDown();
}
 
Example #26
Source File: GuiOverlay.java    From XRay-Mod with GNU General Public License v3.0 5 votes vote down vote up
@OnlyIn(Dist.CLIENT)
@SubscribeEvent(priority = EventPriority.LOWEST)
public static void RenderGameOverlayEvent(RenderGameOverlayEvent event) {
    // Draw Indicator
    if(!Controller.isXRayActive() || !Configuration.general.showOverlay.get() || event.isCanceled() || event.getType() != RenderGameOverlayEvent.ElementType.TEXT )
        return;

    RenderSystem.color3f(0, 255, 0);
    XRay.mc.getTextureManager().bindTexture(circle);
    Screen.func_238463_a_(event.getMatrixStack(), 5, 5, 0f, 0f, 5, 5, 5, 5); // @mcp: func_238463_a_ = blit (7 parms) =

    // @mcp: func_238405_a_ = drawStringWithShadow
    XRay.mc.fontRenderer.func_238405_a_(event.getMatrixStack(), I18n.format("xray.overlay"), 15, 4, 0xffffffff);
}
 
Example #27
Source File: BleachMainMenu.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void render(MatrixStack matrix, int mouseX, int mouseY, float delta) {
	this.renderBackground(matrix);
	fill(matrix, 0, 0, width, height, 0xff008080);
	
	int copyWidth = this.textRenderer.getWidth("Copyright Mojang AB. Do not distribute!") + 2;
	
	textRenderer.drawWithShadow(matrix, "Copyright Mojang AB. Do not distribute!", width - copyWidth, height - 24, -1);
	textRenderer.drawWithShadow(matrix, "Fabric: " + FabricLoader.getInstance().getModContainer("fabricloader").get().getMetadata().getVersion().getFriendlyString(), 4, height - 44, -1);
	textRenderer.drawWithShadow(matrix, "Minecraft " + SharedConstants.getGameVersion().getName(), 4, height - 34, -1);
	textRenderer.drawWithShadow(matrix, "Logged in as: \u00a7a" + client.getSession().getUsername(), 4, height - 24, -1);
	
	try {
		if (Integer.parseInt(versions.get(1)) > BleachHack.INTVERSION) {
			drawCenteredString(matrix, this.textRenderer, "\u00a7cOutdated BleachHack Version!", width/2, 2, -1);
			drawCenteredString(matrix, this.textRenderer,"\u00a74[" + versions.get(0) + " > " + BleachHack.VERSION + "]", width/2, 11, -1);
		}
	} catch (Exception e) { }
	
	drawButton(matrix, "", 0, height - 14, width, height);
	drawButton(matrix, "\u00a7cX", 0, height - 13, 20, height - 1);
	
	int wid = 20;
	for (Window w: windows) {
		if (w.closed) continue;
		Screen.fill(matrix, wid, height - 13, wid + 80 - 1, height - 1 - 1, 0xffb0b0b0);
		Screen.fill(matrix, wid + 1, height - 13 + 1, wid + 80, height - 1, 0xff000000);
		Screen.fill(matrix, wid + 1, height - 13 + 1, wid + 80 - 1, height - 1 - 1, (w.selected ? 0xffb0b0b0 : 0xff858585));
		textRenderer.draw(matrix, w.title, wid + 2, height - 11, 0x000000);
		wid += 80;
	}
	
	super.render(matrix, mouseX, mouseY, delta);
	
	particleMang.addParticle(mouseX, mouseY);
	particleMang.renderParticles(matrix);
	
}
 
Example #28
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 #29
Source File: ModuleWindowDark.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawModeSetting(SettingMode s, int x, int y) {
	Screen.fill(x, y, x+len, y+12, 0x70000000);
	font.drawWithShadow(s.text + s.modes[s.mode],x+2, y+2,
			mouseOver(x, y, x+len, y+12) ? 0xcfc3cf : 0xcfe0cf);
	
	if (mouseOver(x, y, x+len, y+12) && lmDown) s.mode = s.getNextMode();
}
 
Example #30
Source File: ClickGuiScreen.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public void drawBindSetting(MatrixStack matrix, Module m, int key, int x, int y) {
	Screen.fill(matrix, x, y+11, x+len-2, y+12, 0x90b0b0b0);
	Screen.fill(matrix, x+len - 2, y, x+len-1, y+12, 0x90b0b0b0);
	Screen.fill(matrix, x, y - 1, x + 1, y+11, 0x90000000);
	
	if (key != -1 && mouseOver(x, y, x+len, y+12)) m.setKey((key != 261 && key != 256) ? key : -1);
	String name = InputUtil.fromKeyCode(m.getKey(), -1).getLocalizedText().getString();
	if (name == null) name = "KEY" + m.getKey();
	if (name.isEmpty()) name = "NONE";
	
	textRenderer.drawWithShadow(matrix, "Bind: " + name + (mouseOver(x, y, x+len, y+12) ? "..." : "")
			, x+2, y+2, mouseOver(x, y, x+len, y+12) ? 0xcfc3cf : 0xcfe0cf);
}