Java Code Examples for net.minecraft.client.gui.screen.Screen#hasShiftDown()
The following examples show how to use
net.minecraft.client.gui.screen.Screen#hasShiftDown() .
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: RecipeBook_1_12.java From multiconnect with MIT License | 6 votes |
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 2
Source File: GlowstoneTorchBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@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 3
Source File: GlowstoneWallTorchBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@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 4
Source File: CompressorBlock.java From Galacticraft-Rewoven with MIT License | 5 votes |
@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 5
Source File: StandardWrenchItem.java From Galacticraft-Rewoven with MIT License | 5 votes |
@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 6
Source File: GuiPonySettings.java From MineLittlePony with MIT License | 5 votes |
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 7
Source File: ConfigurableElectricMachineBlock.java From Galacticraft-Rewoven with MIT License | 4 votes |
@Override @Environment(EnvType.CLIENT) public final void buildTooltip(ItemStack itemStack_1, BlockView blockView_1, List<Text> list_1, TooltipContext tooltipContext_1) { Text text = machineInfo(itemStack_1, blockView_1, tooltipContext_1); if (text != null) { List<Text> info = new ArrayList<>(); for (StringRenderable s : MinecraftClient.getInstance().textRenderer.wrapLines(text, 150)) { info.add(new LiteralText(s.getString()).setStyle(Style.EMPTY.withColor(Formatting.DARK_GRAY))); } if (!info.isEmpty()) { if (Screen.hasShiftDown()) { list_1.addAll(info); } else { list_1.add(new TranslatableText("tooltip.galacticraft-rewoven.press_shift").setStyle(Style.EMPTY.withColor(Formatting.DARK_GRAY))); } } } if (itemStack_1 != null && itemStack_1.getTag() != null && itemStack_1.getTag().contains("BlockEntityTag")) { list_1.add(new LiteralText("")); list_1.add(new TranslatableText("ui.galacticraft-rewoven.machine.current_energy", itemStack_1.getTag().getCompound("BlockEntityTag").getInt("Energy")).setStyle(Style.EMPTY.withColor(Formatting.AQUA))); list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config.owner", itemStack_1.getTag().getCompound("BlockEntityTag").getString("OwnerUsername")).setStyle(Style.EMPTY.withColor(Formatting.BLUE))); if (itemStack_1.getTag().getCompound("BlockEntityTag").getBoolean("Public")) { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config_2").setStyle(Style.EMPTY .withColor(Formatting.GRAY)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config.public_2") .setStyle(Style.EMPTY.withColor(Formatting.GREEN)))); } else if (itemStack_1.getTag().getCompound("BlockEntityTag").getBoolean("Party")) { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config_2").setStyle(Style.EMPTY .withColor(Formatting.GRAY)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config.space_race_2") .setStyle(Style.EMPTY.withColor(Formatting.DARK_GRAY)))); } else { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config_2").setStyle(Style.EMPTY .withColor(Formatting.GRAY)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.security_config.private_2") .setStyle(Style.EMPTY.withColor(Formatting.DARK_RED)))); } if (itemStack_1.getTag().getCompound("BlockEntityTag").getString("Redstone").equals("DISABLED")) { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config_2").setStyle(Style.EMPTY.withColor(Formatting.RED)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config.ignore_2").setStyle(Style.EMPTY.withColor(Formatting.GRAY)))); } else if (itemStack_1.getTag().getCompound("BlockEntityTag").getString("Redstone").equals("OFF")) { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config_2").setStyle(Style.EMPTY.withColor(Formatting.RED)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config.redstone_means_off_2").setStyle(Style.EMPTY.withColor(Formatting.DARK_RED)))); } else { list_1.add(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config_2").setStyle(Style.EMPTY.withColor(Formatting.RED)).append(new TranslatableText("ui.galacticraft-rewoven.tabs.redstone_activation_config.redstone_means_on_2").setStyle(Style.EMPTY.withColor(Formatting.DARK_RED)))); } } }