Skip to content

Commit

Permalink
Add mass craft toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrews54757 committed Jul 27, 2020
1 parent e03c559 commit 4a5caaf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/main/java/fi/dy/masa/itemscroller/config/Configs.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class Configs implements IConfigHandler

public static class Generic
{
public static final ConfigBoolean MASS_CRAFT_HOLD = new ConfigBoolean("massCraftHold", false, "Mass craft continuously");
public static final ConfigBoolean CARPET_CTRL_Q_CRAFTING = new ConfigBoolean("carpetCtrlQCraftingEnabledOnServer", false, "Set to true if the server is running the Carpet mod,\nand has the ctrlQCrafting option enabled.\nThis just changes which method Item Scroller uses\nfor the Drop key + Shift + Right click crafting.");
public static final ConfigBoolean CLIENT_CRAFTING_FIX = new ConfigBoolean("clientCraftingFixOn1.12", true, "Enable updating the crafting recipe output directly on the client side.\nThis fixes the quick/mass crafting and right-click-to-craft-a-stack\nfeatures othrwise being broken in 1.12.");
public static final ConfigBoolean CRAFTING_RENDER_RECIPE_ITEMS = new ConfigBoolean("craftingRenderRecipeItems", true, "If enabled, then the recipe items are also rendered\nin the crafting recipe view.");
Expand All @@ -38,6 +39,7 @@ public static class Generic
public static final ConfigBoolean VILLAGER_TRADE_LIST_REMEMBER_PAGE = new ConfigBoolean("villagerTradeListRememberPage", true, "Remember and restore the last looked at page/trade when re-opening the GUI");

public static final ImmutableList<IConfigValue> OPTIONS = ImmutableList.of(
MASS_CRAFT_HOLD,
CARPET_CTRL_Q_CRAFTING,
CLIENT_CRAFTING_FIX,
CRAFTING_RENDER_RECIPE_ITEMS,
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class Hotkeys
public static final ConfigHotkey KEY_DROP_ALL_MATCHING = new ConfigHotkey("dropAllMatching", "LEFT_CONTROL,LEFT_SHIFT,Q", GUI_NO_ORDER, "Drop all stacks identical to the hovered stack");
public static final ConfigHotkey KEY_MAIN_TOGGLE = new ConfigHotkey("mainToggle", "LEFT_CONTROL,S", KeybindSettings.GUI, "Toggle all functionality ON/OFF");
public static final ConfigHotkey KEY_MASS_CRAFT = new ConfigHotkey("massCraft", "LEFT_CONTROL,LEFT_ALT,C", GUI_NO_ORDER, "Mass craft and throw out the results with the\ncurrently selected recipe as long as this\nkeybind is held down");
public static final ConfigHotkey KEY_MASS_CRAFT_TOGGLE = new ConfigHotkey("massCraftToggle", "", "Toggle mass craft");
public static final ConfigHotkey KEY_MOVE_CRAFT_RESULTS = new ConfigHotkey("moveCraftResults", "LEFT_CONTROL,M", GUI_NO_ORDER, "Move all of the currently selected recipe's\noutput items from the player inventory\nto the other inventory");
public static final ConfigHotkey KEY_MOVE_STACK_TO_OFFHAND = new ConfigHotkey("moveStackToOffhand", "F", KeybindSettings.GUI, "Swap the hovered stack with the offhand");
public static final ConfigHotkey KEY_RECIPE_VIEW = new ConfigHotkey("recipeView", "A", GUI_RELAXED, "Show the Item Scroller recipe GUI");
Expand Down Expand Up @@ -72,6 +73,7 @@ public class Hotkeys
KEY_DROP_ALL_MATCHING,
KEY_MAIN_TOGGLE,
KEY_MASS_CRAFT,
KEY_MASS_CRAFT_TOGGLE,
KEY_MOVE_CRAFT_RESULTS,
KEY_MOVE_STACK_TO_OFFHAND,
KEY_RECIPE_VIEW,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import fi.dy.masa.malilib.hotkeys.KeyAction;
import fi.dy.masa.malilib.interfaces.IClientTickHandler;
import fi.dy.masa.malilib.util.GuiUtils;
import fi.dy.masa.malilib.hotkeys.KeyCallbackToggleBooleanConfigWithMessage;

public class KeybindCallbacks implements IHotkeyCallback, IClientTickHandler
{
Expand All @@ -48,6 +49,8 @@ public void setCallbacks()
{
hotkey.getKeybind().setCallback(this);
}

Hotkeys.KEY_MASS_CRAFT_TOGGLE.getKeybind().setCallback(new KeyCallbackToggleBooleanConfigWithMessage(Configs.Generic.MASS_CRAFT_HOLD));
}

public boolean functionalityEnabled()
Expand Down Expand Up @@ -174,7 +177,7 @@ public void onClientTick(MinecraftClient mc)
GuiUtils.getCurrentScreen() instanceof HandledScreen &&
(GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false &&
Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false &&
Hotkeys.KEY_MASS_CRAFT.getKeybind().isKeybindHeld())
(Hotkeys.KEY_MASS_CRAFT.getKeybind().isKeybindHeld() || Configs.Generic.MASS_CRAFT_HOLD.getBooleanValue()))
{
Screen guiScreen = GuiUtils.getCurrentScreen();
HandledScreen<?> gui = (HandledScreen<?>) guiScreen;
Expand Down

0 comments on commit 4a5caaf

Please sign in to comment.