Add craftable items QOL features (tooltips / hold ALT to toggle craft request) (#241)

This commit is contained in:
Domi
2023-03-20 20:01:06 +01:00
committed by GitHub
parent af5921f9e8
commit eefb11544e
7 changed files with 22 additions and 4 deletions
@@ -49,6 +49,7 @@ import mezz.jei.api.gui.IGhostIngredientHandler;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
@@ -568,7 +569,10 @@ public abstract class AEBaseGui extends GuiContainer implements IMTModGuiContain
action = (mouseButton == 1) ? InventoryAction.SPLIT_OR_PLACE_SINGLE : InventoryAction.PICKUP_OR_SET_DOWN;
stack = ((SlotME) slot).getAEStack();
if (stack != null && action == InventoryAction.PICKUP_OR_SET_DOWN && stack.getStackSize() == 0 && player.inventory.getItemStack().isEmpty()) {
if (stack != null
&& action == InventoryAction.PICKUP_OR_SET_DOWN
&& (stack.getStackSize() == 0 || GuiScreen.isAltKeyDown())
&& player.inventory.getItemStack().isEmpty()) {
action = InventoryAction.AUTO_CRAFT;
}
@@ -76,6 +76,11 @@ public abstract class AEBaseMEGui extends AEBaseGui {
currentToolTip.add(format);
}
if (myStack.isCraftable() && AEConfig.instance().isShowCraftableTooltip()) {
final String local = ButtonToolTips.ItemCraftable.getLocal();
currentToolTip.add(TextFormatting.GRAY + local);
}
this.drawHoveringText(currentToolTip, x, y, this.fontRenderer);
return;
@@ -26,6 +26,7 @@ import appeng.util.ISlimReadableNumberConverter;
import appeng.util.IWideReadableNumberConverter;
import appeng.util.ReadableNumberConverter;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
@@ -48,7 +49,7 @@ public class StackSizeRenderer {
final boolean unicodeFlag = fontRenderer.getUnicodeFlag();
fontRenderer.setUnicodeFlag(false);
if (aeStack.getStackSize() == 0 && aeStack.isCraftable()) {
if ((aeStack.getStackSize() == 0 || GuiScreen.isAltKeyDown()) && aeStack.isCraftable()) {
final String craftLabelText = AEConfig.instance().useTerminalUseLargeFont() ? GuiText.LargeFontCraft.getLocal() : GuiText.SmallFontCraft
.getLocal();
GlStateManager.disableLighting();
@@ -64,8 +65,7 @@ public class StackSizeRenderer {
GlStateManager.enableDepth();
GlStateManager.enableBlend();
}
if (aeStack.getStackSize() > 0) {
else if (aeStack.getStackSize() > 0) {
final String stackSize = this.getToBeRenderedStackSize(aeStack.getStackSize());
GlStateManager.disableLighting();
+6
View File
@@ -82,6 +82,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
private boolean disableColoredCableRecipesInJEI = true;
private int craftingCalculationTimePerTick = 5;
private PowerUnits selectedPowerUnit = PowerUnits.AE;
private boolean showCraftableTooltip = true;
// Spatial IO/Dimension
private int storageProviderID = -1;
private int storageDimensionID = -1;
@@ -248,6 +249,7 @@ public final class AEConfig extends Configuration implements IConfigurableObject
this.enableEffects = this.get("Client", "enableEffects", true).getBoolean(true);
this.useLargeFonts = this.get("Client", "useTerminalUseLargeFont", false).getBoolean(false);
this.useColoredCraftingStatus = this.get("Client", "useColoredCraftingStatus", true).getBoolean(true);
this.showCraftableTooltip = this.get("Client", "showCraftableTooltip", true, "Whether to add \"Craftable\" to item tooltips when they can be crafted automatically.").getBoolean(true);
// load buttons..
for (int btnNum = 0; btnNum < 4; btnNum++) {
@@ -501,6 +503,10 @@ public final class AEConfig extends Configuration implements IConfigurableObject
return this.useColoredCraftingStatus;
}
public boolean isShowCraftableTooltip() {
return this.showCraftableTooltip;
}
public boolean isDisableColoredCableRecipesInJEI() {
return this.disableColoredCableRecipesInJEI;
}
@@ -161,6 +161,7 @@ public enum ButtonToolTips {
// Used in the tooltips of the items in the terminal, when moused over
ItemsStored,
ItemsRequestable,
ItemCraftable,
SchedulingMode,
SchedulingModeDefault,
@@ -323,6 +323,7 @@ gui.tooltips.appliedenergistics2.SchedulingModeRoundRobin=Exportiere im Round-Ro
gui.tooltips.appliedenergistics2.SchedulingModeRandom=Exportiere im Zufallsmodus.
gui.tooltips.appliedenergistics2.ItemsStored=Items gespeichert: %s
gui.tooltips.appliedenergistics2.ItemsRequestable=Anfragbare Items: %s
gui.tooltips.appliedenergistics2.ItemCraftable=Herstellbar
// Units
gui.appliedenergistics2.units.appliedenergstics=AE
@@ -354,6 +354,7 @@ gui.tooltips.appliedenergistics2.FilterModeKeep=Restore previous search filter.
gui.tooltips.appliedenergistics2.FilterModeClear=Clear on each opening.
gui.tooltips.appliedenergistics2.ItemsStored=Items Stored: %s
gui.tooltips.appliedenergistics2.ItemsRequestable=Items Requestable: %s
gui.tooltips.appliedenergistics2.ItemCraftable=Craftable
gui.tooltips.appliedenergistics2.P2PFrequency=Frequency: %s
gui.tooltips.appliedenergistics2.MultiplyByTwo=Double the items set
gui.tooltips.appliedenergistics2.MultiplyByTwoDesc=Will try to double the items set in the crafting slots