From 2608cacf1f24e5fee2182b4795114b39ca749416 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 5 Dec 2018 00:20:30 +0200 Subject: [PATCH 001/107] Port to Rift for MC 1.13.2 --- build.gradle | 42 ++--- build.properties | 8 +- .../fi/dy/masa/itemscroller/ItemScroller.java | 52 ++++++ .../itemscroller/LiteModItemScroller.java | 85 ---------- .../dy/masa/itemscroller/config/Configs.java | 18 ++- .../dy/masa/itemscroller/config/Hotkeys.java | 56 ++++--- .../config/ItemScrollerConfigPanel.java | 24 --- .../masa/itemscroller/event/InputHandler.java | 149 ++++++++++-------- .../itemscroller/event/KeybindCallbacks.java | 22 ++- .../event/RenderEventHandler.java | 93 ++++++----- .../dy/masa/itemscroller/gui/GuiConfigs.java | 144 +++++++++++++++++ .../mixin/IMixinGuiContainer.java | 4 +- .../itemscroller/mixin/MixinContainer.java | 6 +- ...tyRenderer.java => MixinGameRenderer.java} | 12 +- .../itemscroller/mixin/MixinMinecraft.java | 24 +++ .../itemscroller/recipes/CraftingHandler.java | 4 +- .../itemscroller/recipes/CraftingRecipe.java | 30 ++-- .../itemscroller/recipes/RecipeStorage.java | 34 ++-- .../dy/masa/itemscroller/util/InputUtils.java | 57 +------ .../itemscroller/util/InventoryUtils.java | 96 ++++++----- .../dy/masa/itemscroller/util/ItemType.java | 8 +- .../assets/itemscroller/lang/en_us.json | 6 + .../assets/itemscroller/lang/en_us.lang | 5 - src/main/resources/litemod.json | 5 - src/main/resources/mixins.itemscroller.json | 5 +- src/main/resources/pack.mcmeta | 4 +- src/main/resources/riftmod.json | 6 + 27 files changed, 557 insertions(+), 442 deletions(-) create mode 100644 src/main/java/fi/dy/masa/itemscroller/ItemScroller.java delete mode 100644 src/main/java/fi/dy/masa/itemscroller/LiteModItemScroller.java delete mode 100644 src/main/java/fi/dy/masa/itemscroller/config/ItemScrollerConfigPanel.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java rename src/main/java/fi/dy/masa/itemscroller/mixin/{MixinEntityRenderer.java => MixinGameRenderer.java} (74%) create mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraft.java create mode 100644 src/main/resources/assets/itemscroller/lang/en_us.json delete mode 100644 src/main/resources/assets/itemscroller/lang/en_us.lang delete mode 100644 src/main/resources/litemod.json create mode 100644 src/main/resources/riftmod.json diff --git a/build.gradle b/build.gradle index 2ae0a9839..cff6f4fc5 100644 --- a/build.gradle +++ b/build.gradle @@ -2,31 +2,31 @@ buildscript { repositories { jcenter() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } - maven { - name = 'sponge' - url = 'http://repo.spongepowered.org/maven' - } + maven { url 'http://files.minecraftforge.net/maven' } + maven { url 'http://repo.spongepowered.org/maven' } + maven { url 'https://www.jitpack.io' } } dependencies { - classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT" + classpath 'com.github.Chocohead:ForgeGradle:moderniser-SNAPSHOT' classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' } } +apply plugin: 'net.minecraftforge.gradle.tweaker-client' +apply plugin: 'org.spongepowered.mixin' +apply plugin: 'java' +apply plugin: 'maven-publish' + +sourceCompatibility = 1.8 +targetCompatibility = 1.8 + repositories { - maven { - url 'https://masa.dy.fi/maven' - } + mavenCentral() + maven { url 'https://www.jitpack.io' } + maven { url 'http://repo.strezz.org/artifactory/list/Strezz-Central' } } -apply plugin: 'net.minecraftforge.gradle.liteloader' -apply plugin: 'org.spongepowered.mixin' - ext.configFile = file "build.properties" configFile.withReader { @@ -40,6 +40,7 @@ minecraft { mappings = config.mappings_version runDir = 'minecraft' makeObfSourceJar = false + tweakClass = 'org.dimdev.riftloader.launch.RiftLoaderClientTweaker' ext.mod_version = config.mod_version @@ -52,14 +53,17 @@ minecraft { } dependencies { + implementation 'com.github.Chocohead:Rift:jitpack-SNAPSHOT:dev' deobfCompile "fi.dy.masa.malilib:malilib-" + config.minecraft_version_out + ":" + config.malilib_version + ":deobf" } +/* sourceSets { main { ext.refMap = 'mixins.' + config.mod_id + '.refmap.json' } } +*/ group = config.group + config.mod_id // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = config.mod_id + '-' + config.minecraft_version_out @@ -68,6 +72,7 @@ version = project.minecraft.mod_version /** * This section allows you to customise the generated litemod.json file */ + /* litemod { json { name = config.mod_id @@ -83,6 +88,7 @@ litemod { mixinConfigs = [ 'mixins.' + config.mod_id + '.json' ] } } +*/ /** * This section allows you to customise your generated jar (litemod) file. By @@ -91,12 +97,11 @@ litemod { */ jar { // Remove the "-mc1.12" suffix from the file name - classifier = "" - + //classifier = "" // Don't append a 'mod-' filename prefix >_> baseName = archivesBaseName - from litemod.outputs + //from litemod.outputs /* manifest.mainAttributes ( @@ -110,6 +115,7 @@ jar { mixin { defaultObfuscationEnv notch + add sourceSets.main, 'mixins.' + config.mod_id + '.refmap.json' } //tasks.withType(Jar)*.baseName = archivesBaseName diff --git a/build.properties b/build.properties index 3c1d2f7e8..97e141ca7 100644 --- a/build.properties +++ b/build.properties @@ -6,7 +6,7 @@ mod_version = 0.14.2 author = masa # Minecraft, Forge and MCP mappings versions -minecraft_version_out = 1.12.0 -minecraft_version = 1.12 -mappings_version = stable_39 -malilib_version = 0.8.0 +minecraft_version_out = 1.13.2 +minecraft_version = 1.13.2 +mappings_version = snapshot_20181129 +malilib_version = 0.9.0 diff --git a/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java b/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java new file mode 100644 index 000000000..813faa6d3 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java @@ -0,0 +1,52 @@ +package fi.dy.masa.itemscroller; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.dimdev.rift.listener.client.ClientTickable; +import org.dimdev.riftloader.listener.InitializationListener; +import org.spongepowered.asm.launch.MixinBootstrap; +import org.spongepowered.asm.mixin.Mixins; +import fi.dy.masa.itemscroller.config.Configs; +import fi.dy.masa.itemscroller.event.InputHandler; +import fi.dy.masa.itemscroller.event.KeybindCallbacks; +import fi.dy.masa.malilib.config.ConfigManager; +import fi.dy.masa.malilib.event.InitializationHandler; +import fi.dy.masa.malilib.event.InputEventHandler; +import fi.dy.masa.malilib.interfaces.IInitializationHandler; +import net.minecraft.client.Minecraft; + +public class ItemScroller implements ClientTickable, InitializationListener +{ + public static final Logger logger = LogManager.getLogger(Reference.MOD_ID); + + @Override + public void onInitialization() + { + MixinBootstrap.init(); + Mixins.addConfiguration("mixins.itemscroller.json"); + + InitializationHandler.getInstance().registerInitializationHandler(new InitHandler()); + } + + @Override + public void clientTick(Minecraft mc) + { + KeybindCallbacks.getInstance().onTick(mc); + } + + private static class InitHandler implements IInitializationHandler + { + @Override + public void registerModHandlers() + { + ConfigManager.getInstance().registerConfigHandler(Reference.MOD_ID, new Configs()); + + InputHandler handler = new InputHandler(); + InputEventHandler.getInstance().registerKeybindProvider(handler); + InputEventHandler.getInstance().registerKeyboardInputHandler(handler); + InputEventHandler.getInstance().registerMouseInputHandler(handler); + + KeybindCallbacks.getInstance().setCallbacks(); + } + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/LiteModItemScroller.java b/src/main/java/fi/dy/masa/itemscroller/LiteModItemScroller.java deleted file mode 100644 index 6be128368..000000000 --- a/src/main/java/fi/dy/masa/itemscroller/LiteModItemScroller.java +++ /dev/null @@ -1,85 +0,0 @@ -package fi.dy.masa.itemscroller; - -import java.io.File; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import com.mojang.realmsclient.dto.RealmsServer; -import com.mumfrey.liteloader.Configurable; -import com.mumfrey.liteloader.InitCompleteListener; -import com.mumfrey.liteloader.JoinGameListener; -import com.mumfrey.liteloader.LiteMod; -import com.mumfrey.liteloader.Tickable; -import com.mumfrey.liteloader.core.LiteLoader; -import com.mumfrey.liteloader.modconfig.ConfigPanel; -import fi.dy.masa.itemscroller.config.Configs; -import fi.dy.masa.itemscroller.config.ItemScrollerConfigPanel; -import fi.dy.masa.itemscroller.event.InputHandler; -import fi.dy.masa.itemscroller.event.KeybindCallbacks; -import fi.dy.masa.malilib.config.ConfigManager; -import fi.dy.masa.malilib.event.InputEventHandler; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.network.INetHandler; -import net.minecraft.network.play.server.SPacketJoinGame; - -public class LiteModItemScroller implements LiteMod, Configurable, InitCompleteListener, JoinGameListener, Tickable -{ - public static final Logger logger = LogManager.getLogger(Reference.MOD_ID); - - public LiteModItemScroller() - { - } - - @Override - public String getName() - { - return Reference.MOD_NAME; - } - - @Override - public String getVersion() - { - return Reference.MOD_VERSION; - } - - @Override - public Class getConfigPanelClass() - { - return ItemScrollerConfigPanel.class; - } - - @Override - public void init(File configPath) - { - Configs.loadFromFile(); - ConfigManager.getInstance().registerConfigHandler(Reference.MOD_ID, new Configs()); - - InputHandler handler = new InputHandler(); - InputEventHandler.getInstance().registerKeybindProvider(handler); - InputEventHandler.getInstance().registerKeyboardInputHandler(handler); - InputEventHandler.getInstance().registerMouseInputHandler(handler); - } - - @Override - public void upgradeSettings(String version, File configPath, File oldConfigPath) - { - } - - @Override - public void onInitCompleted(Minecraft mc, LiteLoader loader) - { - KeybindCallbacks.getInstance().setCallbacks(); - } - - @Override - public void onJoinGame(INetHandler netHandler, SPacketJoinGame joinGamePacket, ServerData serverData, RealmsServer realmsServer) - { - KeybindCallbacks.getInstance().onWorldChanged(); - } - - @Override - public void onTick(Minecraft mc, float partialTicks, boolean inGame, boolean clock) - { - KeybindCallbacks.getInstance().onTick(mc); - } -} diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index be1cd36c5..56018920e 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -7,7 +7,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import com.mumfrey.liteloader.core.LiteLoader; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; @@ -15,6 +14,7 @@ import fi.dy.masa.malilib.config.IConfigHandler; import fi.dy.masa.malilib.config.IConfigValue; import fi.dy.masa.malilib.config.options.ConfigBoolean; +import fi.dy.masa.malilib.util.FileUtils; import fi.dy.masa.malilib.util.JsonUtils; import net.minecraft.client.gui.inventory.GuiCrafting; import net.minecraft.client.gui.inventory.GuiInventory; @@ -76,12 +76,12 @@ public static class Toggles ); } - public static final Set GUI_BLACKLIST = new HashSet(); - public static final Set SLOT_BLACKLIST = new HashSet(); + public static final Set GUI_BLACKLIST = new HashSet<>(); + public static final Set SLOT_BLACKLIST = new HashSet<>(); public static void loadFromFile() { - File configFile = new File(LiteLoader.getCommonConfigFolder(), CONFIG_FILE_NAME); + File configFile = new File(FileUtils.getConfigDirectory(), CONFIG_FILE_NAME); if (configFile.exists() && configFile.isFile() && configFile.canRead()) { @@ -110,9 +110,9 @@ public static void loadFromFile() public static void saveToFile() { - File dir = LiteLoader.getCommonConfigFolder(); + File dir = FileUtils.getConfigDirectory(); - if (dir.exists() && dir.isDirectory()) + if ((dir.exists() && dir.isDirectory()) || dir.mkdirs()) { JsonObject root = new JsonObject(); @@ -134,6 +134,12 @@ public void onConfigsChanged() loadFromFile(); } + @Override + public void load() + { + loadFromFile(); + } + @Override public void save() { diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java b/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java index a9a1c3e72..1c9075bb3 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java @@ -11,41 +11,45 @@ public class Hotkeys private static final KeybindSettings GUI_RELAXED = KeybindSettings.create(KeybindSettings.Context.GUI, KeyAction.PRESS, true, false, false, false); private static final KeybindSettings GUI_NO_ORDER = KeybindSettings.create(KeybindSettings.Context.GUI, KeyAction.PRESS, false, false, false, true); - public static final ConfigHotkey KEY_CRAFT_EVERYTHING = new ConfigHotkey("craftEverything", "LCONTROL,C", GUI_NO_ORDER, "Craft everything possible once with the currently selected recipe"); - public static final ConfigHotkey KEY_DROP_ALL_MATCHING = new ConfigHotkey("dropAllMatching", "LCONTROL,LSHIFT,Q", GUI_NO_ORDER, "Drop all stacks identical to the hovered stack"); - public static final ConfigHotkey KEY_MAIN_TOGGLE = new ConfigHotkey("mainToggle", "LCONTROL,S", KeybindSettings.GUI, "Toggle all functionality ON/OFF"); - public static final ConfigHotkey KEY_MASS_CRAFT = new ConfigHotkey("massCraft", "LCONTROL,LMENU,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_MOVE_CRAFT_RESULTS = new ConfigHotkey("moveCraftResults", "LCONTROL,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_OPEN_CONFIG_GUI = new ConfigHotkey("openConfigGui", "I,C", "Open the in-game config GUI"); + + public static final ConfigHotkey KEY_CRAFT_EVERYTHING = new ConfigHotkey("craftEverything", "LEFT_CONTROL,C", GUI_NO_ORDER, "Craft everything possible once with the currently selected recipe"); + 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_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"); - public static final ConfigHotkey KEY_SLOT_DEBUG = new ConfigHotkey("slotDebug", "LCONTROL,LMENU,LSHIFT,I", GUI_NO_ORDER, "Print debug info for the hovered slot or GUI"); - public static final ConfigHotkey KEY_THROW_CRAFT_RESULTS = new ConfigHotkey("throwCraftResults", "LCONTROL,T", GUI_NO_ORDER, "Throw all of the currently selected recipe's\noutput items to the ground from the player inventory"); + public static final ConfigHotkey KEY_SLOT_DEBUG = new ConfigHotkey("slotDebug", "LEFT_CONTROL,LEFT_ALT,LEFT_SHIFT,I", GUI_NO_ORDER, "Print debug info for the hovered slot or GUI"); + public static final ConfigHotkey KEY_THROW_CRAFT_RESULTS = new ConfigHotkey("throwCraftResults", "LEFT_CONTROL,T", GUI_NO_ORDER, "Throw all of the currently selected recipe's\noutput items to the ground from the player inventory"); - public static final ConfigHotkey KEY_DRAG_LEAVE_ONE = new ConfigHotkey("keyDragMoveLeaveOne", "LSHIFT,BUTTON1", GUI_NO_ORDER, "Key to move all but the last item from\nall the stacks dragged over"); - public static final ConfigHotkey KEY_DRAG_MATCHING = new ConfigHotkey("keyDragMoveMatching", "LMENU,BUTTON0", GUI_NO_ORDER, "Key to move all matching items dragged over"); - public static final ConfigHotkey KEY_DRAG_MOVE_ONE = new ConfigHotkey("keyDragMoveOne", "LCONTROL,BUTTON0", GUI_NO_ORDER, "Key to move one item from each stack dragged over"); - public static final ConfigHotkey KEY_DRAG_FULL_STACKS = new ConfigHotkey("keyDragMoveStacks", "LSHIFT,BUTTON0", GUI_NO_ORDER, "Key to move the entire stacks dragged over"); + public static final ConfigHotkey KEY_DRAG_LEAVE_ONE = new ConfigHotkey("keyDragMoveLeaveOne", "LEFT_SHIFT,BUTTON_2", GUI_NO_ORDER, "Key to move all but the last item from\nall the stacks dragged over"); + public static final ConfigHotkey KEY_DRAG_MATCHING = new ConfigHotkey("keyDragMoveMatching", "LEFT_ALT,BUTTON_1", GUI_NO_ORDER, "Key to move all matching items dragged over"); + public static final ConfigHotkey KEY_DRAG_MOVE_ONE = new ConfigHotkey("keyDragMoveOne", "LEFT_CONTROL,BUTTON_1", GUI_NO_ORDER, "Key to move one item from each stack dragged over"); + public static final ConfigHotkey KEY_DRAG_FULL_STACKS = new ConfigHotkey("keyDragMoveStacks", "LEFT_SHIFT,BUTTON_1", GUI_NO_ORDER, "Key to move the entire stacks dragged over"); - public static final ConfigHotkey KEY_DRAG_DROP_LEAVE_ONE = new ConfigHotkey("keyDragDropLeaveOne", "LSHIFT,Q,BUTTON1", GUI_NO_ORDER, "Key to drop all but the last item from each stack dragged over"); - public static final ConfigHotkey KEY_DRAG_DROP_SINGLE = new ConfigHotkey("keyDragDropSingle", "Q,BUTTON0", GUI_NO_ORDER, "Key to drop one item from each stack dragged over"); - public static final ConfigHotkey KEY_DRAG_DROP_STACKS = new ConfigHotkey("keyDragDropStacks", "LSHIFT,Q,BUTTON0", GUI_NO_ORDER, "Key to drop the entire stacks dragged over"); + public static final ConfigHotkey KEY_DRAG_DROP_LEAVE_ONE = new ConfigHotkey("keyDragDropLeaveOne", "LEFT_SHIFT,Q,BUTTON_2", GUI_NO_ORDER, "Key to drop all but the last item from each stack dragged over"); + public static final ConfigHotkey KEY_DRAG_DROP_SINGLE = new ConfigHotkey("keyDragDropSingle", "Q,BUTTON_1", GUI_NO_ORDER, "Key to drop one item from each stack dragged over"); + public static final ConfigHotkey KEY_DRAG_DROP_STACKS = new ConfigHotkey("keyDragDropStacks", "LEFT_SHIFT,Q,BUTTON_1", GUI_NO_ORDER, "Key to drop the entire stacks dragged over"); - public static final ConfigHotkey KEY_MOVE_EVERYTHING = new ConfigHotkey("keyMoveEverything", "LMENU,LSHIFT,BUTTON0", GUI_NO_ORDER, "Key to move ALL items to the other\ninventory when clicking a stack"); + public static final ConfigHotkey KEY_MOVE_EVERYTHING = new ConfigHotkey("keyMoveEverything", "LEFT_ALT,LEFT_SHIFT,BUTTON_1", GUI_NO_ORDER, "Key to move ALL items to the other\ninventory when clicking a stack"); - public static final ConfigHotkey KEY_WS_MOVE_DOWN_LEAVE_ONE = new ConfigHotkey("wsMoveDownLeaveOne", "S,BUTTON1", GUI_NO_ORDER, "The key to move all but the last item from each stack\n\"down\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_DOWN_MATCHING = new ConfigHotkey("wsMoveDownMatching", "LMENU,S,BUTTON0", GUI_NO_ORDER, "The key to move all matching items \"down\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_DOWN_SINGLE = new ConfigHotkey("wsMoveDownSingle", "S,BUTTON0", GUI_NO_ORDER, "The key to move single items \"down\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_DOWN_STACKS = new ConfigHotkey("wsMoveDownStacks", "LSHIFT,S,BUTTON0", GUI_NO_ORDER, "The key to move stacks \"down\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_UP_LEAVE_ONE = new ConfigHotkey("wsMoveUpLeaveOne", "W,BUTTON1", GUI_NO_ORDER, "The key to move all but the last item from each stack\n\"up\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_UP_MATCHING = new ConfigHotkey("wsMoveUpMatching", "LMENU,W,BUTTON0", GUI_NO_ORDER, "The key to move all matching items \"up\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_UP_SINGLE = new ConfigHotkey("wsMoveUpSingle", "W,BUTTON0", GUI_NO_ORDER, "The key to move single items \"up\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_UP_STACKS = new ConfigHotkey("wsMoveUpStacks", "LSHIFT,W,BUTTON0", GUI_NO_ORDER, "The key to move stacks \"up\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_DOWN_LEAVE_ONE = new ConfigHotkey("wsMoveDownLeaveOne", "S,BUTTON_2", GUI_NO_ORDER, "The key to move all but the last item from each stack\n\"down\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_DOWN_MATCHING = new ConfigHotkey("wsMoveDownMatching", "LEFT_ALT,S,BUTTON_1", GUI_NO_ORDER, "The key to move all matching items \"down\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_DOWN_SINGLE = new ConfigHotkey("wsMoveDownSingle", "S,BUTTON_1", GUI_NO_ORDER, "The key to move single items \"down\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_DOWN_STACKS = new ConfigHotkey("wsMoveDownStacks", "LEFT_SHIFT,S,BUTTON_1", GUI_NO_ORDER, "The key to move stacks \"down\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_UP_LEAVE_ONE = new ConfigHotkey("wsMoveUpLeaveOne", "W,BUTTON_2", GUI_NO_ORDER, "The key to move all but the last item from each stack\n\"up\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_UP_MATCHING = new ConfigHotkey("wsMoveUpMatching", "LEFT_ALT,W,BUTTON_1", GUI_NO_ORDER, "The key to move all matching items \"up\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_UP_SINGLE = new ConfigHotkey("wsMoveUpSingle", "W,BUTTON_1", GUI_NO_ORDER, "The key to move single items \"up\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_UP_STACKS = new ConfigHotkey("wsMoveUpStacks", "LEFT_SHIFT,W,BUTTON_1", GUI_NO_ORDER, "The key to move stacks \"up\" in the inventory"); - public static final ConfigHotkey MODIFIER_MOVE_EVERYTHING = new ConfigHotkey("modifierMoveEverything", "LMENU,LSHIFT", GUI_NO_ORDER, "Modifier key to move ALL items to the other\ninventory when scrolling over a stack"); - public static final ConfigHotkey MODIFIER_MOVE_MATCHING = new ConfigHotkey("modifierMoveMatching", "LMENU", GUI_NO_ORDER, "Modifier key to move all matching items to the other\ninventory when scrolling over a stack"); - public static final ConfigHotkey MODIFIER_MOVE_STACK = new ConfigHotkey("modifierMoveStack", "LSHIFT", GUI_NO_ORDER, "Modifier key to move the entire stack to the other\ninventory when scrolling over it"); + public static final ConfigHotkey MODIFIER_MOVE_EVERYTHING = new ConfigHotkey("modifierMoveEverything", "LEFT_ALT,LEFT_SHIFT", GUI_NO_ORDER, "Modifier key to move ALL items to the other\ninventory when scrolling over a stack"); + public static final ConfigHotkey MODIFIER_MOVE_MATCHING = new ConfigHotkey("modifierMoveMatching", "LEFT_ALT", GUI_NO_ORDER, "Modifier key to move all matching items to the other\ninventory when scrolling over a stack"); + public static final ConfigHotkey MODIFIER_MOVE_STACK = new ConfigHotkey("modifierMoveStack", "LEFT_SHIFT", GUI_NO_ORDER, "Modifier key to move the entire stack to the other\ninventory when scrolling over it"); public static final List HOTKEY_LIST = ImmutableList.of( + KEY_OPEN_CONFIG_GUI, + MODIFIER_MOVE_EVERYTHING, MODIFIER_MOVE_MATCHING, MODIFIER_MOVE_STACK, diff --git a/src/main/java/fi/dy/masa/itemscroller/config/ItemScrollerConfigPanel.java b/src/main/java/fi/dy/masa/itemscroller/config/ItemScrollerConfigPanel.java deleted file mode 100644 index 50da7eecc..000000000 --- a/src/main/java/fi/dy/masa/itemscroller/config/ItemScrollerConfigPanel.java +++ /dev/null @@ -1,24 +0,0 @@ -package fi.dy.masa.itemscroller.config; - -import fi.dy.masa.itemscroller.Reference; -import fi.dy.masa.malilib.config.gui.ConfigPanelBase; -import fi.dy.masa.malilib.config.gui.GuiModConfigs; - -public class ItemScrollerConfigPanel extends ConfigPanelBase -{ - @Override - protected String getPanelTitlePrefix() - { - return Reference.MOD_NAME + " options"; - } - - @Override - protected void createSubPanels() - { - String modId = Reference.MOD_ID; - - this.addSubPanel((new GuiModConfigs(modId, "Toggles", Configs.Toggles.OPTIONS)).setConfigWidth(100)); - this.addSubPanel((new GuiModConfigs(modId, "Generic", Configs.Generic.OPTIONS)).setConfigWidth(160)); - this.addSubPanel((new GuiModConfigs(modId, "Hotkeys", Hotkeys.HOTKEY_LIST)).setConfigWidth(210)); - } -} diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index a324f86e5..7aeba5b75 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -1,6 +1,6 @@ package fi.dy.masa.itemscroller.event; -import org.lwjgl.input.Keyboard; +import org.lwjgl.glfw.GLFW; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -48,9 +48,9 @@ public void addHotkeys(IKeybindManager manager) @Override public boolean onKeyInput(int eventKey, boolean eventKeyState) { - if (InputUtils.isRecipeViewOpen() && eventKey >= Keyboard.KEY_1 && eventKey <= Keyboard.KEY_9) + if (InputUtils.isRecipeViewOpen() && eventKey >= GLFW.GLFW_KEY_1 && eventKey <= GLFW.GLFW_KEY_9) { - int index = MathHelper.clamp(eventKey - Keyboard.KEY_1, 0, 8); + int index = MathHelper.clamp(eventKey - GLFW.GLFW_KEY_1, 0, 8); this.callbacks.getRecipes().changeSelectedRecipe(index); return true; } @@ -66,7 +66,7 @@ public boolean onKeyInput(int eventKey, boolean eventKeyState) } @Override - public boolean onMouseInput(int eventButton, int dWheel, boolean eventButtonState) + public boolean onMouseScroll(int mouseX, int mouseY, double amount) { MoveAction action = InventoryUtils.getActiveMoveAction(); @@ -75,10 +75,11 @@ public boolean onMouseInput(int eventButton, int dWheel, boolean eventButtonStat InventoryUtils.stopDragging(); } - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); boolean cancel = false; if (this.callbacks.functionalityEnabled() && + amount != 0 && mc != null && mc.player != null && mc.currentScreen instanceof GuiContainer && @@ -88,74 +89,94 @@ public boolean onMouseInput(int eventButton, int dWheel, boolean eventButtonStat GuiContainer gui = (GuiContainer) mc.currentScreen; RecipeStorage recipes = this.callbacks.getRecipes(); - if (dWheel != 0) + // When scrolling while the recipe view is open, change the selection instead of moving items + if (InputUtils.isRecipeViewOpen()) { - // When scrolling while the recipe view is open, change the selection instead of moving items - if (InputUtils.isRecipeViewOpen()) - { - recipes.scrollSelection(dWheel < 0); - cancel = true; - } - else - { - cancel = InventoryUtils.tryMoveItems(gui, recipes, dWheel > 0); - } + recipes.scrollSelection(amount < 0); + cancel = true; } else { - Slot slot = AccessorUtils.getSlotUnderMouse(gui); - final boolean isLeftClick = InputUtils.mouseEventIsLeftClick(); - final boolean isRightClick = InputUtils.mouseEventIsRightClick(); - final boolean isPickBlock = InputUtils.mouseEventIsPickBlock(); - final boolean isShiftDown = GuiScreen.isShiftKeyDown(); + cancel = InventoryUtils.tryMoveItems(gui, recipes, amount > 0); + } + } - if (eventButtonState && (isLeftClick || isRightClick || isPickBlock)) - { - final int mouseX = InputUtils.getMouseX(); - final int mouseY = InputUtils.getMouseY(); - int hoveredRecipeId = RenderEventHandler.instance().getHoveredRecipeId(mouseX, mouseY, recipes, gui, mc); - - // Hovering over an item in the recipe view - if (hoveredRecipeId >= 0) - { - InventoryUtils.handleRecipeClick(gui, mc, recipes, hoveredRecipeId, isLeftClick, isRightClick, isPickBlock, isShiftDown); - return true; - } - // Pick-blocking over a crafting output slot with the recipe view open, store the recipe - else if (isPickBlock && InputUtils.isRecipeViewOpen() && InventoryUtils.isCraftingSlot(gui, slot)) - { - recipes.storeCraftingRecipeToCurrentSelection(slot, gui, true); - cancel = true; - } - } + return cancel; + } - InventoryUtils.checkForItemPickup(gui, mc); + @Override + public boolean onMouseClick(int mouseX, int mouseY, int eventButton, boolean eventButtonState) + { + MoveAction action = InventoryUtils.getActiveMoveAction(); - if (eventButtonState && (isLeftClick || isRightClick)) - { - InventoryUtils.storeSourceSlotCandidate(slot, mc); - } + if (action != MoveAction.NONE && InputUtils.isActionKeyActive(action) == false) + { + InventoryUtils.stopDragging(); + } - if (Configs.Toggles.RIGHT_CLICK_CRAFT_STACK.getBooleanValue() && - isRightClick && eventButtonState && - InventoryUtils.isCraftingSlot(gui, slot)) - { - InventoryUtils.rightClickCraftOneStack(gui); - } - else if (Configs.Toggles.SHIFT_PLACE_ITEMS.getBooleanValue() && - isLeftClick && isShiftDown && - InventoryUtils.canShiftPlaceItems(gui)) + Minecraft mc = Minecraft.getInstance(); + boolean cancel = false; + + if (this.callbacks.functionalityEnabled() && + mc != null && + mc.player != null && + mc.currentScreen instanceof GuiContainer && + (mc.currentScreen instanceof GuiContainerCreative) == false && + Configs.GUI_BLACKLIST.contains(mc.currentScreen.getClass().getName()) == false) + { + GuiContainer gui = (GuiContainer) mc.currentScreen; + RecipeStorage recipes = this.callbacks.getRecipes(); + + Slot slot = AccessorUtils.getSlotUnderMouse(gui); + final boolean isLeftClick = mc.gameSettings.keyBindAttack.func_197984_a(eventButton); + final boolean isRightClick = mc.gameSettings.keyBindUseItem.func_197984_a(eventButton); + final boolean isPickBlock = mc.gameSettings.keyBindPickBlock.func_197984_a(eventButton); + final boolean isShiftDown = GuiScreen.isShiftKeyDown(); + + if (eventButtonState && (isLeftClick || isRightClick || isPickBlock)) + { + int hoveredRecipeId = RenderEventHandler.instance().getHoveredRecipeId(mouseX, mouseY, recipes, gui, mc); + + // Hovering over an item in the recipe view + if (hoveredRecipeId >= 0) { - cancel |= InventoryUtils.shiftPlaceItems(slot, gui); + InventoryUtils.handleRecipeClick(gui, mc, recipes, hoveredRecipeId, isLeftClick, isRightClick, isPickBlock, isShiftDown); + return true; } - else if (Configs.Toggles.SHIFT_DROP_ITEMS.getBooleanValue() && - isLeftClick && isShiftDown && - InputUtils.canShiftDropItems(gui, mc)) + // Pick-blocking over a crafting output slot with the recipe view open, store the recipe + else if (isPickBlock && InputUtils.isRecipeViewOpen() && InventoryUtils.isCraftingSlot(gui, slot)) { - cancel |= InventoryUtils.shiftDropItems(gui); + recipes.storeCraftingRecipeToCurrentSelection(slot, gui, true); + cancel = true; } } + InventoryUtils.checkForItemPickup(gui, mc); + + if (eventButtonState && (isLeftClick || isRightClick)) + { + InventoryUtils.storeSourceSlotCandidate(slot, mc); + } + + if (Configs.Toggles.RIGHT_CLICK_CRAFT_STACK.getBooleanValue() && + isRightClick && eventButtonState && + InventoryUtils.isCraftingSlot(gui, slot)) + { + InventoryUtils.rightClickCraftOneStack(gui); + } + else if (Configs.Toggles.SHIFT_PLACE_ITEMS.getBooleanValue() && + isLeftClick && isShiftDown && + InventoryUtils.canShiftPlaceItems(gui)) + { + cancel |= InventoryUtils.shiftPlaceItems(slot, gui); + } + else if (Configs.Toggles.SHIFT_DROP_ITEMS.getBooleanValue() && + isLeftClick && isShiftDown && + InputUtils.canShiftDropItems(gui, mc, mouseX, mouseY)) + { + cancel |= InventoryUtils.shiftDropItems(gui); + } + if (Configs.Generic.SCROLL_CRAFT_STORE_RECIPES_TO_FILE.getBooleanValue()) { recipes.writeToDisk(); @@ -166,9 +187,9 @@ else if (Configs.Toggles.SHIFT_DROP_ITEMS.getBooleanValue() && } @Override - public void onMouseMoved() + public void onMouseMove(int mouseX, int mouseY) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); if (this.callbacks.functionalityEnabled() && mc != null && @@ -176,17 +197,17 @@ public void onMouseMoved() mc.currentScreen instanceof GuiContainer && Configs.GUI_BLACKLIST.contains(mc.currentScreen.getClass().getName()) == false) { - this.handleDragging((GuiContainer) mc.currentScreen, mc, false); + this.handleDragging((GuiContainer) mc.currentScreen, mc, mouseX, mouseY, false); } } - private boolean handleDragging(GuiContainer gui, Minecraft mc, boolean isClick) + private boolean handleDragging(GuiContainer gui, Minecraft mc, int mouseX, int mouseY, boolean isClick) { MoveAction action = InventoryUtils.getActiveMoveAction(); if (InputUtils.isActionKeyActive(action)) { - return InventoryUtils.dragMoveItems(gui, mc, action, false); + return InventoryUtils.dragMoveItems(gui, mc, action, mouseX, mouseY, false); } else if (action != MoveAction.NONE) { diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 017585c75..7845c54e2 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -1,8 +1,9 @@ package fi.dy.masa.itemscroller.event; -import fi.dy.masa.itemscroller.LiteModItemScroller; +import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; +import fi.dy.masa.itemscroller.gui.GuiConfigs; import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.itemscroller.recipes.CraftingRecipe; import fi.dy.masa.itemscroller.recipes.RecipeStorage; @@ -14,6 +15,7 @@ import fi.dy.masa.malilib.hotkeys.IHotkeyCallback; import fi.dy.masa.malilib.hotkeys.IKeybind; import fi.dy.masa.malilib.hotkeys.KeyAction; +import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiContainer; @@ -72,7 +74,7 @@ public void onWorldChanged() @Override public boolean onKeyAction(KeyAction action, IKeybind key) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); if (key == Hotkeys.KEY_MAIN_TOGGLE.getKeybind()) { @@ -80,15 +82,20 @@ public boolean onKeyAction(KeyAction action, IKeybind key) if (this.disabled) { - mc.player.playSound(SoundEvents.BLOCK_NOTE_BASS, 0.8f, 0.8f); + mc.player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BASS, 0.8f, 0.8f); } else { - mc.player.playSound(SoundEvents.BLOCK_NOTE_PLING, 0.5f, 1.0f); + mc.player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_PLING, 0.5f, 1.0f); } return true; } + else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) + { + mc.displayGuiScreen(new GuiConfigs()); + return true; + } if (this.disabled || mc == null || mc.player == null || (mc.currentScreen instanceof GuiContainer) == false) { @@ -104,7 +111,10 @@ public boolean onKeyAction(KeyAction action, IKeybind key) { if (moveAction != MoveAction.NONE) { - return InventoryUtils.dragMoveItems(gui, mc, moveAction, true); + MainWindow window = mc.mainWindow; + final int mouseX = (int) (mc.mouseHelper.getMouseX() * (double) window.getScaledWidth() / (double) window.getWidth()); + final int mouseY = (int) (mc.mouseHelper.getMouseY() * (double) window.getScaledHeight() / (double) window.getHeight()); + return InventoryUtils.dragMoveItems(gui, mc, moveAction, mouseX, mouseY, true); } else if (key == Hotkeys.KEY_MOVE_EVERYTHING.getKeybind()) { @@ -155,7 +165,7 @@ else if (key == Hotkeys.KEY_SLOT_DEBUG.getKeybind()) } else { - LiteModItemScroller.logger.info("GUI class: {}", gui.getClass().getName()); + ItemScroller.logger.info("GUI class: {}", gui.getClass().getName()); } return true; diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 774054369..7d5b2cecf 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -9,10 +9,10 @@ import fi.dy.masa.itemscroller.util.AccessorUtils; import fi.dy.masa.itemscroller.util.InputUtils; import fi.dy.masa.itemscroller.util.InventoryUtils; +import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GlStateManager; @@ -22,6 +22,8 @@ import net.minecraft.client.util.ITooltipFlag; import net.minecraft.item.ItemStack; import net.minecraft.util.math.Vec3d; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextFormatting; public class RenderEventHandler @@ -37,7 +39,7 @@ public static RenderEventHandler instance() public void onDrawBackgroundPost() { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); if (mc.currentScreen instanceof GuiContainer && InputUtils.isRecipeViewOpen()) { @@ -55,15 +57,16 @@ public void onDrawBackgroundPost() public void onDrawScreenPost() { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); if (mc.currentScreen instanceof GuiContainer && InputUtils.isRecipeViewOpen()) { GuiContainer gui = (GuiContainer) mc.currentScreen; RecipeStorage recipes = KeybindCallbacks.getInstance().getRecipes(); - final int mouseX = InputUtils.getMouseX(); - final int mouseY = InputUtils.getMouseY(); + MainWindow window = mc.mainWindow; + final int mouseX = (int) (mc.mouseHelper.getMouseX() * (double) window.getScaledWidth() / (double) window.getWidth()); + final int mouseY = (int) (mc.mouseHelper.getMouseY() * (double) window.getScaledHeight() / (double) window.getHeight()); final int recipeId = this.getHoveredRecipeId(mouseX, mouseY, recipes, gui, mc); if (recipeId >= 0) @@ -106,11 +109,11 @@ public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, Gui { if (InputUtils.isRecipeViewOpen()) { - ScaledResolution scaledResolution = new ScaledResolution(mc); + MainWindow window = mc.mainWindow; final int gap = 40; final int recipesPerColumn = 9; final int stackBaseHeight = 16; - final int usableHeight = scaledResolution.getScaledHeight() - 2 * gap; // leave a gap on the top and bottom + final int usableHeight = window.getScaledHeight() - 2 * gap; // leave a gap on the top and bottom // height of each entry; 9 stored recipes final int entryHeight = (int) (usableHeight / recipesPerColumn); // leave 0.25-th of a stack height gap between each entry @@ -141,11 +144,11 @@ private void renderStoredRecipeStack(int recipeId, int recipeCount, ItemStack st final String indexStr = String.valueOf(recipeId + 1); final int strWidth = font.getStringWidth(indexStr); - ScaledResolution scaledResolution = new ScaledResolution(mc); + MainWindow window = mc.mainWindow; final int verticalGap = 40; final int recipesPerColumn = 9; final int stackBaseHeight = 16; - final int usableHeight = scaledResolution.getScaledHeight() - 2 * verticalGap; // leave a gap on the top and bottom + final int usableHeight = window.getScaledHeight() - 2 * verticalGap; // leave a gap on the top and bottom // height of each entry; 9 stored recipes final int entryHeight = (int) (usableHeight / recipesPerColumn); // leave 0.25-th of a stack height gap between each entry @@ -183,11 +186,11 @@ private void renderRecipeItems(CraftingRecipe recipe, int recipeCount, GuiContai private RecipeLocation getRecipeLocation(CraftingRecipe recipe, int recipeCount, GuiContainer gui, Minecraft mc) { - ScaledResolution scaledResolution = new ScaledResolution(mc); + MainWindow window = mc.mainWindow; final int verticalGap = 40; final int recipesPerColumn = 9; final int stackBaseHeight = 16; - final int usableHeight = scaledResolution.getScaledHeight() - 2 * verticalGap; // leave a gap on the top and bottom + final int usableHeight = window.getScaledHeight() - 2 * verticalGap; // leave a gap on the top and bottom // height of each entry; 9 stored recipes final int entryHeight = (int) (usableHeight / recipesPerColumn); // leave 0.25-th of a stack height gap between each entry @@ -198,7 +201,7 @@ private RecipeLocation getRecipeLocation(CraftingRecipe recipe, int recipeCount, final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength())); final float x = AccessorUtils.getGuiLeft(gui) - (columnOffsetCount + 0.2f) * stackScaledSize - (columnOffsetCount - 1) * scale * 20 - (stackBaseHeight + 1) * (recipeDimensions + 1) * scale; - final float y = scaledResolution.getScaledHeight() / 2 - (stackBaseHeight + 1) * recipeDimensions * scale * 0.5f; + final float y = window.getScaledHeight() / 2 - (stackBaseHeight + 1) * recipeDimensions * scale * 0.5f; return new RecipeLocation(x, y, scale, stackBaseHeight, recipeDimensions); } @@ -248,8 +251,8 @@ public RecipeLocation(float x, float y, float scale, int stackBaseHeight, int re private void renderStackAt(ItemStack stack, float x, float y, boolean border, float scale, int stackBaseHeight, Minecraft mc) { GlStateManager.pushMatrix(); - GlStateManager.translate(x, y, 0); - GlStateManager.scale(scale, scale, 1); + GlStateManager.translatef(x, y, 0); + GlStateManager.scalef(scale, scale, 1); GlStateManager.disableLighting(); final int w = stackBaseHeight; @@ -274,10 +277,10 @@ private void renderStackAt(ItemStack stack, float x, float y, boolean border, fl stack = stack.copy(); InventoryUtils.setStackSize(stack, 1); - mc.getRenderItem().zLevel += 100; - mc.getRenderItem().renderItemAndEffectIntoGUI(mc.player, stack, 0, 0); + mc.getItemRenderer().zLevel += 100; + mc.getItemRenderer().renderItemAndEffectIntoGUI(mc.player, stack, 0, 0); //mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRenderer, stack, 0, 0, null); - mc.getRenderItem().zLevel -= 100; + mc.getItemRenderer().zLevel -= 100; } GlStateManager.disableBlend(); @@ -288,8 +291,8 @@ private void renderStackAt(ItemStack stack, float x, float y, boolean border, fl public static void enableGUIStandardItemLighting(float scale) { GlStateManager.pushMatrix(); - GlStateManager.rotate(-30.0F, 0.0F, 1.0F, 0.0F); - GlStateManager.rotate(165.0F, 1.0F, 0.0F, 0.0F); + GlStateManager.rotatef(-30.0F, 0.0F, 1.0F, 0.0F); + GlStateManager.rotatef(165.0F, 1.0F, 0.0F, 0.0F); enableStandardItemLighting(scale); @@ -303,35 +306,35 @@ public static void enableStandardItemLighting(float scale) GlStateManager.enableLight(1); GlStateManager.enableColorMaterial(); GlStateManager.colorMaterial(1032, 5634); - GlStateManager.glLight(16384, 4611, RenderHelper.setColorBuffer((float) LIGHT0_POS.x, (float) LIGHT0_POS.y, (float) LIGHT0_POS.z, 0.0f)); + GlStateManager.lightfv(16384, 4611, RenderHelper.setColorBuffer((float) LIGHT0_POS.x, (float) LIGHT0_POS.y, (float) LIGHT0_POS.z, 0.0f)); float lightStrength = 0.3F * scale; - GlStateManager.glLight(16384, 4609, RenderHelper.setColorBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); - GlStateManager.glLight(16384, 4608, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.glLight(16384, 4610, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.glLight(16385, 4611, RenderHelper.setColorBuffer((float) LIGHT1_POS.x, (float) LIGHT1_POS.y, (float) LIGHT1_POS.z, 0.0f)); - GlStateManager.glLight(16385, 4609, RenderHelper.setColorBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); - GlStateManager.glLight(16385, 4608, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.glLight(16385, 4610, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.lightfv(16384, 4609, RenderHelper.setColorBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); + GlStateManager.lightfv(16384, 4608, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.lightfv(16384, 4610, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.lightfv(16385, 4611, RenderHelper.setColorBuffer((float) LIGHT1_POS.x, (float) LIGHT1_POS.y, (float) LIGHT1_POS.z, 0.0f)); + GlStateManager.lightfv(16385, 4609, RenderHelper.setColorBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); + GlStateManager.lightfv(16385, 4608, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.lightfv(16385, 4610, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); GlStateManager.shadeModel(7424); float ambientLightStrength = 0.4F; - GlStateManager.glLightModel(2899, RenderHelper.setColorBuffer(ambientLightStrength, ambientLightStrength, ambientLightStrength, 1.0F)); + GlStateManager.lightModelfv(2899, RenderHelper.setColorBuffer(ambientLightStrength, ambientLightStrength, ambientLightStrength, 1.0F)); } private void renderStackToolTip(int x, int y, ItemStack stack, GuiContainer gui, Minecraft mc) { - List list = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); + List list = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); for (int i = 0; i < list.size(); ++i) { if (i == 0) { - list.set(i, stack.getRarity().color + (String)list.get(i)); + list.set(i, new TextComponentString(stack.getRarity().color + list.get(i).getString())); } else { - list.set(i, TextFormatting.GRAY + (String)list.get(i)); + list.set(i, new TextComponentString(TextFormatting.GRAY + list.get(i).getString())); } } @@ -340,30 +343,36 @@ private void renderStackToolTip(int x, int y, ItemStack stack, GuiContainer gui, drawHoveringText(stack, list, x, y, gui.width, gui.height, -1, font); } - private static void drawHoveringText(@Nonnull final ItemStack stack, List textLines, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) + private static void drawHoveringText(@Nonnull final ItemStack stack, List components, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) { - if (!textLines.isEmpty()) + List textLines = new ArrayList<>(); + + if (!components.isEmpty()) { GlStateManager.disableRescaleNormal(); RenderHelper.disableStandardItemLighting(); GlStateManager.disableLighting(); - GlStateManager.disableDepth(); + GlStateManager.disableDepthTest(); int tooltipTextWidth = 0; - for (String textLine : textLines) + for (ITextComponent entry : components) { - int textLineWidth = font.getStringWidth(textLine); + String text = entry.getString(); + int textLineWidth = font.getStringWidth(text); if (textLineWidth > tooltipTextWidth) { tooltipTextWidth = textLineWidth; } + + textLines.add(text); } boolean needsWrap = false; int titleLinesCount = 1; int tooltipX = mouseX + 12; + if (tooltipX + tooltipTextWidth + 4 > screenWidth) { tooltipX = mouseX - 16 - tooltipTextWidth; @@ -390,11 +399,13 @@ private static void drawHoveringText(@Nonnull final ItemStack stack, List wrappedTextLines = new ArrayList(); + List wrappedTextLines = new ArrayList<>(); + for (int i = 0; i < textLines.size(); i++) { String textLine = textLines.get(i); List wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth); + if (i == 0) { titleLinesCount = wrappedLine.size(); @@ -471,7 +482,7 @@ else if (tooltipY + tooltipHeight + 4 > screenHeight) } GlStateManager.enableLighting(); - GlStateManager.enableDepth(); + GlStateManager.enableDepthTest(); RenderHelper.enableStandardItemLighting(); GlStateManager.enableRescaleNormal(); } @@ -490,8 +501,8 @@ public static void drawGradientRect(int zLevel, int left, int top, int right, in GlStateManager.disableTexture2D(); GlStateManager.enableBlend(); - GlStateManager.disableAlpha(); - GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); + GlStateManager.disableAlphaTest(); + GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); GlStateManager.shadeModel(7425); Tessellator tessellator = Tessellator.getInstance(); @@ -505,7 +516,7 @@ public static void drawGradientRect(int zLevel, int left, int top, int right, in GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); - GlStateManager.enableAlpha(); + GlStateManager.enableAlphaTest(); GlStateManager.enableTexture2D(); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java new file mode 100644 index 000000000..a5ab71ba9 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java @@ -0,0 +1,144 @@ +package fi.dy.masa.itemscroller.gui; + +import java.util.Collections; +import java.util.List; +import fi.dy.masa.itemscroller.Reference; +import fi.dy.masa.itemscroller.config.Configs; +import fi.dy.masa.itemscroller.config.Hotkeys; +import fi.dy.masa.malilib.config.IConfigBase; +import fi.dy.masa.malilib.gui.GuiConfigsBase; +import fi.dy.masa.malilib.gui.button.ButtonGeneric; +import fi.dy.masa.malilib.gui.button.IButtonActionListener; +import net.minecraft.client.resources.I18n; + +public class GuiConfigs extends GuiConfigsBase +{ + private static ConfigGuiTab tab = ConfigGuiTab.HOTKEYS; + private int id; + + public GuiConfigs() + { + super(10, 50, Reference.MOD_ID, null); + + this.title = I18n.format("itemscroller.gui.title.configs"); + } + + @Override + public void initGui() + { + super.initGui(); + this.clearOptions(); + + this.id = 0; + int x = 10; + int y = 26; + + for (ConfigGuiTab tab : ConfigGuiTab.values()) + { + x += this.createButton(x, y, -1, tab) + 4; + } + } + + private int createButton(int x, int y, int width, ConfigGuiTab tab) + { + ButtonListener listener = new ButtonListener(tab, this); + boolean enabled = GuiConfigs.tab != tab; + String label = tab.getDisplayName(); + + if (width < 0) + { + width = this.mc.fontRenderer.getStringWidth(label) + 10; + } + + ButtonGeneric button = new ButtonGeneric(this.id++, x, y, width, 20, label); + button.enabled = enabled; + this.addButton(button, listener); + + return width; + } + + @Override + protected int getConfigWidth() + { + ConfigGuiTab tab = GuiConfigs.tab; + + if (tab == ConfigGuiTab.GENERIC || tab == ConfigGuiTab.TOGGLES) + { + return 100; + } + + return super.getConfigWidth(); + } + + @Override + public List getConfigs() + { + List configs; + ConfigGuiTab tab = GuiConfigs.tab; + + if (tab == ConfigGuiTab.GENERIC) + { + configs = Configs.Generic.OPTIONS; + } + else if (tab == ConfigGuiTab.TOGGLES) + { + configs = Configs.Toggles.OPTIONS; + } + else if (tab == ConfigGuiTab.HOTKEYS) + { + configs = Hotkeys.HOTKEY_LIST; + } + else + { + return Collections.emptyList(); + } + + return ConfigOptionWrapper.createFor(configs); + } + + private static class ButtonListener implements IButtonActionListener + { + private final GuiConfigs parent; + private final ConfigGuiTab tab; + + public ButtonListener(ConfigGuiTab tab, GuiConfigs parent) + { + this.tab = tab; + this.parent = parent; + } + + @Override + public void actionPerformed(ButtonGeneric control) + { + } + + @Override + public void actionPerformedWithButton(ButtonGeneric control, int mouseButton) + { + GuiConfigs.tab = this.tab; + + this.parent.reCreateListWidget(); // apply the new config width + this.parent.getListWidget().resetScrollbarPosition(); + this.parent.initGui(); + } + } + + public enum ConfigGuiTab + { + GENERIC ("itemscroller.gui.button.config_gui.generic"), + TOGGLES ("itemscroller.gui.button.config_gui.toggles"), + HOTKEYS ("itemscroller.gui.button.config_gui.hotkeys"); + + private final String translationKey; + + private ConfigGuiTab(String translationKey) + { + this.translationKey = translationKey; + } + + public String getDisplayName() + { + return I18n.format(this.translationKey); + } + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiContainer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiContainer.java index 97f35da89..0191e0bec 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiContainer.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiContainer.java @@ -10,8 +10,8 @@ @Mixin(GuiContainer.class) public interface IMixinGuiContainer { - @Invoker("getSlotAtPosition") - Slot getSlotAtPositionInvoker(int x, int y); + @Invoker("getSelectedSlot") + Slot getSlotAtPositionInvoker(double x, double y); @Invoker("handleMouseClick") void handleMouseClickInvoker(Slot slotIn, int slotId, int mouseButton, ClickType type); diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinContainer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinContainer.java index c91d4b65a..a62987ad4 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinContainer.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinContainer.java @@ -7,8 +7,8 @@ import fi.dy.masa.itemscroller.util.InventoryUtils; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.Container; +import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.inventory.InventoryCrafting; import net.minecraft.world.World; @Mixin(Container.class) @@ -20,11 +20,11 @@ public class MixinContainer public void onSlotChangedCraftingGrid( World world, EntityPlayer player, - InventoryCrafting inventoryCrafting, + IInventory craftMatrix, InventoryCraftResult inventoryCraftResult, CallbackInfo ci ) { - InventoryUtils.onSlotChangedCraftingGrid(world, player, inventoryCrafting, inventoryCraftResult); + InventoryUtils.onSlotChangedCraftingGrid(world, player, craftMatrix, inventoryCraftResult); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinEntityRenderer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java similarity index 74% rename from src/main/java/fi/dy/masa/itemscroller/mixin/MixinEntityRenderer.java rename to src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java index 97f53093f..676a9e25c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinEntityRenderer.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java @@ -6,17 +6,17 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import fi.dy.masa.itemscroller.event.RenderEventHandler; -import net.minecraft.client.renderer.EntityRenderer; +import net.minecraft.client.renderer.GameRenderer; -@Mixin(EntityRenderer.class) -public abstract class MixinEntityRenderer +@Mixin(GameRenderer.class) +public abstract class MixinGameRenderer { - @Inject(method = "updateCameraAndRender(FJ)V", at = { + @Inject(method = "updateCameraAndRender(FJZ)V", at = { @At(value = "INVOKE", shift = Shift.AFTER, target = "Lnet/minecraftforge/client/ForgeHooksClient;drawScreen(Lnet/minecraft/client/gui/GuiScreen;IIF)V"), - @At(value = "INVOKE", shift = Shift.AFTER, target = "Lnet/minecraft/client/gui/GuiScreen;drawScreen(IIF)V") + @At(value = "INVOKE", shift = Shift.AFTER, target = "Lnet/minecraft/client/gui/GuiScreen;render(IIF)V") }, require = 1, allow = 1) - private void onDrawScreenPost(float partialTicks, long nanoTime, CallbackInfo ci) + private void onDrawScreenPost(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo ci) { RenderEventHandler.instance().onDrawScreenPost(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraft.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraft.java new file mode 100644 index 000000000..8a529ed15 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraft.java @@ -0,0 +1,24 @@ +package fi.dy.masa.itemscroller.mixin; + +import javax.annotation.Nullable; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import fi.dy.masa.itemscroller.event.KeybindCallbacks; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.multiplayer.WorldClient; + +@Mixin(Minecraft.class) +public class MixinMinecraft +{ + @Inject(method = "loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/gui/GuiScreen;)V", at = @At("HEAD")) + private void onLoadWorldPre(@Nullable WorldClient worldClientIn, GuiScreen loadingScreen, CallbackInfo ci) + { + if (worldClientIn != null && worldClientIn != (((Minecraft) (Object) this).world)) + { + KeybindCallbacks.getInstance().onWorldChanged(); + } + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java index 223732d23..04888fb89 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java @@ -5,7 +5,7 @@ import java.util.Map; import java.util.Set; import javax.annotation.Nullable; -import fi.dy.masa.itemscroller.LiteModItemScroller; +import fi.dy.masa.itemscroller.ItemScroller; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.inventory.Slot; @@ -36,7 +36,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot } catch (Exception e) { - LiteModItemScroller.logger.warn("addCraftingGridDefinition(): Failed to find classes for grid definition: gui: '{}', slot: '{}', outputSlot: {}", + ItemScroller.logger.warn("addCraftingGridDefinition(): Failed to find classes for grid definition: gui: '{}', slot: '{}', outputSlot: {}", guiClassName, slotClassName, outputSlot); } diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingRecipe.java b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingRecipe.java index 86b2cc6fd..0740e11bf 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingRecipe.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingRecipe.java @@ -93,11 +93,11 @@ public void copyRecipeFrom(CraftingRecipe other) public void readFromNBT(@Nonnull NBTTagCompound nbt) { - if (nbt.hasKey("Result", Constants.NBT.TAG_COMPOUND) && nbt.hasKey("Ingredients", Constants.NBT.TAG_LIST)) + if (nbt.contains("Result", Constants.NBT.TAG_COMPOUND) && nbt.contains("Ingredients", Constants.NBT.TAG_LIST)) { - NBTTagList tagIngredients = nbt.getTagList("Ingredients", Constants.NBT.TAG_COMPOUND); - int count = tagIngredients.tagCount(); - int length = nbt.getInteger("Length"); + NBTTagList tagIngredients = nbt.getList("Ingredients", Constants.NBT.TAG_COMPOUND); + int count = tagIngredients.size(); + int length = nbt.getInt("Length"); if (length > 0) { @@ -106,16 +106,16 @@ public void readFromNBT(@Nonnull NBTTagCompound nbt) for (int i = 0; i < count; i++) { - NBTTagCompound tag = tagIngredients.getCompoundTagAt(i); - int slot = tag.getInteger("Slot"); + NBTTagCompound tag = tagIngredients.getCompound(i); + int slot = tag.getInt("Slot"); if (slot >= 0 && slot < this.recipe.length) { - this.recipe[slot] = new ItemStack(tag); + this.recipe[slot] = ItemStack.read(tag); } } - this.result = new ItemStack(nbt.getCompoundTag("Result")); + this.result = ItemStack.read(nbt.getCompound("Result")); } } @@ -125,10 +125,10 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) if (this.isValid()) { NBTTagCompound tag = new NBTTagCompound(); - this.result.writeToNBT(tag); + this.result.write(tag); - nbt.setInteger("Length", this.recipe.length); - nbt.setTag("Result", tag); + nbt.putInt("Length", this.recipe.length); + nbt.put("Result", tag); NBTTagList tagIngredients = new NBTTagList(); @@ -137,13 +137,13 @@ public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) if (InventoryUtils.isStackEmpty(this.recipe[i]) == false) { tag = new NBTTagCompound(); - tag.setInteger("Slot", i); - this.recipe[i].writeToNBT(tag); - tagIngredients.appendTag(tag); + tag.putInt("Slot", i); + this.recipe[i].write(tag); + tagIngredients.add(tag); } } - nbt.setTag("Ingredients", tagIngredients); + nbt.put("Ingredients", tagIngredients); } return nbt; diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java index 2478c2ce1..757b80e8a 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java @@ -4,7 +4,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import javax.annotation.Nonnull; -import fi.dy.masa.itemscroller.LiteModItemScroller; +import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.util.Constants; import net.minecraft.client.Minecraft; @@ -104,7 +104,7 @@ public void clearRecipe(int index) private void readFromNBT(NBTTagCompound nbt) { - if (nbt == null || nbt.hasKey("Recipes", Constants.NBT.TAG_LIST) == false) + if (nbt == null || nbt.contains("Recipes", Constants.NBT.TAG_LIST) == false) { return; } @@ -114,12 +114,12 @@ private void readFromNBT(NBTTagCompound nbt) this.recipes[i].clearRecipe(); } - NBTTagList tagList = nbt.getTagList("Recipes", Constants.NBT.TAG_COMPOUND); - int count = tagList.tagCount(); + NBTTagList tagList = nbt.getList("Recipes", Constants.NBT.TAG_COMPOUND); + int count = tagList.size(); for (int i = 0; i < count; i++) { - NBTTagCompound tag = tagList.getCompoundTagAt(i); + NBTTagCompound tag = tagList.getCompound(i); int index = tag.getByte("RecipeIndex"); @@ -141,14 +141,14 @@ private NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) if (this.recipes[i].isValid()) { NBTTagCompound tag = new NBTTagCompound(); - tag.setByte("RecipeIndex", (byte) i); + tag.putByte("RecipeIndex", (byte) i); this.recipes[i].writeToNBT(tag); - tagRecipes.appendTag(tag); + tagRecipes.add(tag); } } - nbt.setTag("Recipes", tagRecipes); - nbt.setByte("Selected", (byte) this.selected); + nbt.put("Recipes", tagRecipes); + nbt.putByte("Selected", (byte) this.selected); return nbt; } @@ -159,9 +159,11 @@ private String getFileName() if (this.global == false) { - if (Minecraft.getMinecraft().isSingleplayer()) + Minecraft mc = Minecraft.getInstance(); + + if (mc.isSingleplayer()) { - IntegratedServer server = Minecraft.getMinecraft().getIntegratedServer(); + IntegratedServer server = mc.getIntegratedServer(); if (server != null) { @@ -170,7 +172,7 @@ private String getFileName() } else { - ServerData server = Minecraft.getMinecraft().getCurrentServerData(); + ServerData server = mc.getCurrentServerData(); if (server != null) { @@ -184,7 +186,7 @@ private String getFileName() private File getSaveDir() { - return new File(Minecraft.getMinecraft().gameDir, Reference.MOD_ID); + return new File(Minecraft.getInstance().gameDir, Reference.MOD_ID); } public void readFromDisk() @@ -208,7 +210,7 @@ public void readFromDisk() } catch (Exception e) { - LiteModItemScroller.logger.warn("Failed to read recipes from file", e); + ItemScroller.logger.warn("Failed to read recipes from file", e); } } @@ -229,7 +231,7 @@ public void writeToDisk() { if (saveDir.mkdirs() == false) { - LiteModItemScroller.logger.warn("Failed to create the recipe storage directory '{}'", saveDir.getPath()); + ItemScroller.logger.warn("Failed to create the recipe storage directory '{}'", saveDir.getPath()); return; } } @@ -250,7 +252,7 @@ public void writeToDisk() } catch (Exception e) { - LiteModItemScroller.logger.warn("Failed to write recipes to file!", e); + ItemScroller.logger.warn("Failed to write recipes to file!", e); } } } diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index a8e4af554..a5f79394c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -1,36 +1,17 @@ package fi.dy.masa.itemscroller.util; -import org.lwjgl.input.Keyboard; -import org.lwjgl.input.Mouse; import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.event.KeybindCallbacks; import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.malilib.hotkeys.IKeybind; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.ScaledResolution; import net.minecraft.client.gui.inventory.GuiContainer; public class InputUtils { - public static int getMouseX() - { - Minecraft mc = Minecraft.getMinecraft(); - ScaledResolution scaledresolution = new ScaledResolution(mc); - int w = scaledresolution.getScaledWidth(); - return Mouse.getX() * w / mc.displayWidth; - } - - public static int getMouseY() - { - Minecraft mc = Minecraft.getMinecraft(); - ScaledResolution scaledresolution = new ScaledResolution(mc); - int h = scaledresolution.getScaledHeight(); - return h - Mouse.getY() * h / mc.displayHeight - 1; - } - public static boolean isRecipeViewOpen() { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); return mc.currentScreen != null && Hotkeys.KEY_RECIPE_VIEW.getKeybind().isKeybindHeld() && @@ -38,7 +19,7 @@ public static boolean isRecipeViewOpen() CraftingHandler.isCraftingGui(mc.currentScreen); } - public static boolean canShiftDropItems(GuiContainer gui, Minecraft mc) + public static boolean canShiftDropItems(GuiContainer gui, Minecraft mc, int mouseX, int mouseY) { if (InventoryUtils.isStackEmpty(mc.player.inventory.getItemStack()) == false) { @@ -46,11 +27,9 @@ public static boolean canShiftDropItems(GuiContainer gui, Minecraft mc) int top = AccessorUtils.getGuiTop(gui); int xSize = AccessorUtils.getGuiXSize(gui); int ySize = AccessorUtils.getGuiYSize(gui); - int mouseAbsX = Mouse.getEventX() * gui.width / mc.displayWidth; - int mouseAbsY = gui.height - Mouse.getEventY() * gui.height / mc.displayHeight - 1; - boolean isOutsideGui = mouseAbsX < left || mouseAbsY < top || mouseAbsX >= left + xSize || mouseAbsY >= top + ySize; + boolean isOutsideGui = mouseX < left || mouseY < top || mouseX >= left + xSize || mouseY >= top + ySize; - return isOutsideGui && AccessorUtils.getSlotAtPosition(gui, mouseAbsX - left, mouseAbsY - top) == null; + return isOutsideGui && AccessorUtils.getSlotAtPosition(gui, mouseX - left, mouseY - top) == null; } return false; @@ -145,32 +124,4 @@ public static MoveAmount getMoveAmount(MoveAction action) return MoveAmount.NONE; } - - public static boolean isKeybindHeld(int keyCode) - { - if (keyCode > 0 && keyCode < Keyboard.getKeyCount()) - { - return Keyboard.isKeyDown(keyCode); - } - else - { - keyCode += 100; - return keyCode >= 0 && keyCode < Mouse.getButtonCount() && Mouse.isButtonDown(keyCode); - } - } - - public static boolean mouseEventIsLeftClick() - { - return Mouse.getEventButton() == Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode() + 100; - } - - public static boolean mouseEventIsRightClick() - { - return Mouse.getEventButton() == Minecraft.getMinecraft().gameSettings.keyBindUseItem.getKeyCode() + 100; - } - - public static boolean mouseEventIsPickBlock() - { - return Mouse.getEventButton() == Minecraft.getMinecraft().gameSettings.keyBindPickBlock.getKeyCode() + 100; - } } diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 6716b9f18..a0206e918 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -8,7 +8,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import fi.dy.masa.itemscroller.LiteModItemScroller; +import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.recipes.CraftingHandler; @@ -21,21 +21,20 @@ import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.gui.inventory.GuiContainerCreative; import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.ClickType; import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.inventory.InventoryCrafting; import net.minecraft.inventory.Slot; import net.minecraft.inventory.SlotMerchantResult; -import net.minecraft.item.Item; +import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.registry.IRegistry; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import net.minecraft.world.World; @@ -51,13 +50,13 @@ public class InventoryUtils private static WeakReference sourceSlot = null; private static ItemStack stackInCursorLast = ItemStack.EMPTY; - public static void onSlotChangedCraftingGrid(World world, EntityPlayer player, InventoryCrafting inventoryCrafting, InventoryCraftResult inventoryCraftResult) + public static void onSlotChangedCraftingGrid(World world, EntityPlayer player, IInventory craftMatrix, InventoryCraftResult inventoryCraftResult) { if (Configs.Generic.CLIENT_CRAFTING_FIX.getBooleanValue() && - world.isRemote && player instanceof EntityPlayerSP) + world.isRemote && (world instanceof WorldClient) && player instanceof EntityPlayerSP) { ItemStack stack = ItemStack.EMPTY; - IRecipe recipe = CraftingManager.findMatchingRecipe(inventoryCrafting, world); + IRecipe recipe = ((WorldClient) world).getRecipeManager().getRecipe(craftMatrix, world); if (recipe != null && (recipe.isDynamic() || @@ -66,7 +65,7 @@ public static void onSlotChangedCraftingGrid(World world, EntityPlayer player, I ) { inventoryCraftResult.setRecipeUsed(recipe); - stack = recipe.getCraftingResult(inventoryCrafting); + stack = recipe.getCraftingResult(craftMatrix); } inventoryCraftResult.setInventorySlotContents(0, stack); @@ -77,11 +76,11 @@ public static String getStackString(ItemStack stack) { if (isStackEmpty(stack) == false) { - ResourceLocation rl = Item.REGISTRY.getNameForObject(stack.getItem()); + ResourceLocation rl = IRegistry.ITEM.getKey(stack.getItem()); - return String.format("[%s @ %d - display: %s - NBT: %s] (%s)", - rl != null ? rl.toString() : "null", stack.getMetadata(), stack.getDisplayName(), - stack.getTagCompound() != null ? stack.getTagCompound().toString() : "", + return String.format("[%s - display: %s - NBT: %s] (%s)", + rl != null ? rl.toString() : "null", stack.getDisplayName().getString(), + stack.getTag() != null ? stack.getTag().toString() : "", stack.toString()); } @@ -92,7 +91,7 @@ public static void debugPrintSlotInfo(GuiContainer gui, Slot slot) { if (slot == null) { - LiteModItemScroller.logger.info("slot was null"); + ItemScroller.logger.info("slot was null"); return; } @@ -100,7 +99,7 @@ public static void debugPrintSlotInfo(GuiContainer gui, Slot slot) Object inv = slot.inventory; String stackStr = InventoryUtils.getStackString(slot.getStack()); - LiteModItemScroller.logger.info(String.format("slot: slotNumber: %d, getSlotIndex(): %d, getHasStack(): %s, " + + ItemScroller.logger.info(String.format("slot: slotNumber: %d, getSlotIndex(): %d, getHasStack(): %s, " + "slot class: %s, inv class: %s, Container's slot list has slot: %s, stack: %s, numSlots: %d", slot.slotNumber, AccessorUtils.getSlotIndex(slot), slot.getHasStack(), slot.getClass().getName(), inv != null ? inv.getClass().getName() : "", hasSlot ? " true" : "false", stackStr, @@ -139,7 +138,7 @@ private static boolean inventoryExistsAbove(Slot slot, Container container) public static boolean canShiftPlaceItems(GuiContainer gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); ItemStack stackCursor = mc.player.inventory.getItemStack(); // The target slot needs to be an empty, valid slot, and there needs to be items in the cursor @@ -150,7 +149,7 @@ public static boolean canShiftPlaceItems(GuiContainer gui) public static boolean tryMoveItems(GuiContainer gui, RecipeStorage recipes, boolean scrollingUp) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); // We require an empty cursor if (slot == null || isStackEmpty(mc.player.inventory.getItemStack()) == false) @@ -239,11 +238,8 @@ else if (getStackSize(stack) < slot.getItemStackLimit(stack)) return false; } - public static boolean dragMoveItems(GuiContainer gui, Minecraft mc, MoveAction action, boolean isClick) + public static boolean dragMoveItems(GuiContainer gui, Minecraft mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { - int mouseX = InputUtils.getMouseX(); - int mouseY = InputUtils.getMouseY(); - if (isStackEmpty(mc.player.inventory.getItemStack()) == false) { // Updating these here is part of the fix to preventing a drag after shift + place @@ -322,7 +318,7 @@ public static boolean dragMoveItems(GuiContainer gui, Minecraft mc, MoveAction a { if (gui instanceof GuiContainerCreative) { - boolean isPlayerInv = ((GuiContainerCreative) gui).getSelectedTabIndex() == CreativeTabs.INVENTORY.getIndex(); + boolean isPlayerInv = ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex(); int slotNumber = isPlayerInv ? AccessorUtils.getSlotIndex(slot) : slot.slotNumber; slotNumberLast = slotNumber; } @@ -353,7 +349,7 @@ private static boolean dragMoveFromSlotAtPosition(GuiContainer gui, int x, int y } Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); MoveAmount amount = InputUtils.getMoveAmount(action); boolean flag = slot != null && isValidSlot(slot, gui, true) && slot.canTakeStack(mc.player); //boolean cancel = flag && (amount == MoveAmount.LEAVE_ONE || amount == MoveAmount.MOVE_ONE); @@ -420,7 +416,7 @@ private static boolean dragMoveFromSlotAtPositionCreative(GuiContainer gui, int { GuiContainerCreative guiCreative = (GuiContainerCreative) gui; Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); - boolean isPlayerInv = guiCreative.getSelectedTabIndex() == CreativeTabs.INVENTORY.getIndex(); + boolean isPlayerInv = guiCreative.getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex(); // Only allow dragging from the hotbar slots if (slot == null || (slot.getClass() != Slot.class && isPlayerInv == false)) @@ -428,7 +424,7 @@ private static boolean dragMoveFromSlotAtPositionCreative(GuiContainer gui, int return false; } - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); MoveAmount amount = InputUtils.getMoveAmount(action); boolean flag = slot != null && isValidSlot(slot, gui, true) && slot.canTakeStack(mc.player); boolean cancel = flag && (amount == MoveAmount.LEAVE_ONE || amount == MoveAmount.MOVE_ONE); @@ -532,7 +528,7 @@ public static void dropStacks(GuiContainer gui, ItemStack stackReference, Slot s public static boolean shiftDropItems(GuiContainer gui) { - ItemStack stackReference = Minecraft.getMinecraft().player.inventory.getItemStack(); + ItemStack stackReference = Minecraft.getInstance().player.inventory.getItemStack(); if (isStackEmpty(stackReference) == false && sourceSlot != null) { @@ -577,7 +573,7 @@ public static void storeSourceSlotCandidate(Slot slot, Minecraft mc) if (isStackEmpty(stackCursor) == false) { // Do a cheap copy without NBT data - stack = new ItemStack(stackCursor.getItem(), getStackSize(stackCursor), stackCursor.getMetadata()); + stack = new ItemStack(stackCursor.getItem(), getStackSize(stackCursor)); } // Store the candidate @@ -644,7 +640,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, GuiContainer { ItemStack stackOrig = slot.getStack(); Container container = gui.inventorySlots; - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); if (isStackEmpty(mc.player.inventory.getItemStack()) == false || slot.canTakeStack(mc.player) == false || (getStackSize(stackOrig) > 1 && slot.isItemValid(stackOrig) == false)) @@ -694,7 +690,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, GuiContainer private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, GuiContainer gui) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); EntityPlayer player = mc.player; ItemStack stackOrig = slot.getStack().copy(); @@ -820,7 +816,7 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, GuiContainer { Container container = gui.inventorySlots; ItemStack stackOrig = slot.getStack(); - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); if (slot.isItemValid(stackOrig) == false) { @@ -907,7 +903,7 @@ private static void tryMoveStacks(ItemStack stackReference, Slot slot, GuiContai private static void tryMoveItemsToMerchantBuySlots(GuiMerchant gui, boolean fillStacks) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); MerchantRecipeList list = gui.getMerchant().getRecipes(mc.player); int index = AccessorUtils.getSelectedMerchantRecipe(gui); @@ -940,7 +936,7 @@ private static void fillBuySlot(GuiContainer gui, int slotNum, ItemStack buyStac { Slot slot = gui.inventorySlots.getSlot(slotNum); ItemStack existingStack = slot.getStack(); - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); // If there are items not matching the merchant recipe, move them out first if (isStackEmpty(existingStack) == false && areStacksEqual(buyStack, existingStack) == false) @@ -975,7 +971,7 @@ public static void handleRecipeClick(GuiContainer gui, Minecraft mc, RecipeStora if (isRightClick) { Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); - boolean dropKeyDown = InputUtils.isKeybindHeld(mc.gameSettings.keyBindDrop.getKeyCode()); + boolean dropKeyDown = mc.gameSettings.keyBindDrop.isKeyDown(); if (outputSlot != null) { @@ -1231,7 +1227,7 @@ private static boolean tryMoveItemsToCraftingGridSlots(CraftingRecipe recipe, Sl private static void fillCraftingGrid(GuiContainer gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { Container container = gui.inventorySlots; - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); EntityPlayer player = mc.player; int slotNum = -1; int slotReturn = -1; @@ -1313,7 +1309,7 @@ private static void fillCraftingGrid(GuiContainer gui, Slot slotGridFirst, ItemS public static void rightClickCraftOneStack(GuiContainer gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); InventoryPlayer inv = mc.player.inventory; ItemStack stackCursor = inv.getItemStack(); @@ -1412,7 +1408,7 @@ public static void throwAllCraftingResultsToGround(CraftingRecipe recipe, GuiCon private static int putSingleItemIntoSlots(GuiContainer gui, List targetSlots, int startIndex) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); ItemStack stackInCursor = mc.player.inventory.getItemStack(); if (isStackEmpty(stackInCursor)) @@ -1445,7 +1441,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(GuiContainer gui, { leftClickSlot(gui, slot.slotNumber); - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); ItemStack stackCursor = mc.player.inventory.getItemStack(); if (isStackEmpty(stackCursor) == false) @@ -1463,7 +1459,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(GuiContainer gui, private static void moveOneRecipeItemIntoCraftingGrid(GuiContainer gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { Container container = gui.inventorySlots; - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); int index = 0; int slotNum = -1; int slotCount = targetSlots.size(); @@ -1509,7 +1505,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(GuiContainer gui, Slot slo private static boolean moveItemFromCursorToSlots(GuiContainer gui, List slotNumbers) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); InventoryPlayer inv = mc.player.inventory; for (int slotNum : slotNumbers) @@ -1835,7 +1831,7 @@ private void clickSlotsToMoveItems(Slot slot, GuiContainer gui, boolean matching private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, GuiContainer gui, boolean toOtherInventory) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); EntityPlayer player = mc.player; // Left click to pick up the found source stack leftClickSlot(gui, slotFrom.slotNumber); @@ -1872,7 +1868,7 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, GuiContainer gu private static boolean clickSlotsToMoveSingleItem(GuiContainer gui, int slotFrom, int slotTo) { //System.out.println("clickSlotsToMoveSingleItem(from: " + slotFrom + ", to: " + slotTo + ")"); - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); ItemStack stack = gui.inventorySlots.inventorySlots.get(slotFrom).getStack(); if (isStackEmpty(stack)) @@ -1906,7 +1902,7 @@ private static boolean clickSlotsToMoveSingleItem(GuiContainer gui, int slotFrom private static boolean clickSlotsToMoveSingleItemByShiftClick(GuiContainer gui, int slotFrom) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); Slot slot = gui.inventorySlots.inventorySlots.get(slotFrom); ItemStack stack = slot.getStack(); @@ -1951,7 +1947,7 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(GuiContainer gui, */ private static boolean clickSlotsToMoveItems(GuiContainer gui, int slotFrom, int slotTo) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); EntityPlayer player = mc.player; //System.out.println("clickSlotsToMoveItems(from: " + slotFrom + ", to: " + slotTo + ")"); @@ -2027,7 +2023,7 @@ private static boolean shiftClickSlotWithCheck(GuiContainer gui, int slotNum) public static boolean tryMoveItemsVertically(GuiContainer gui, Slot slot, boolean moveUp, MoveAmount amount) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); // We require an empty cursor if (slot == null || isStackEmpty(mc.player.inventory.getItemStack()) == false) @@ -2087,7 +2083,7 @@ private static void moveMatchingStacksToSlots(GuiContainer gui, Slot slot, boole private static Slot moveStackToSlots(GuiContainer gui, Slot slotFrom, List slotsTo, boolean leaveOne) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); InventoryPlayer inv = mc.player.inventory; Slot lastSlot = null; @@ -2134,7 +2130,7 @@ private static Slot moveStackToSlots(GuiContainer gui, Slot slotFrom, List slotsTo) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); InventoryPlayer inv = mc.player.inventory; // Pick up half of the the stack @@ -2307,12 +2303,12 @@ public static void clickSlot(GuiContainer gui, int slotNum, int mouseButton, Cli { try { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); mc.playerController.windowClick(gui.inventorySlots.windowId, slotNum, mouseButton, type, mc.player); } catch (Exception e) { - LiteModItemScroller.logger.warn("Exception while emulating a slot click: gui: '{}', slotNum: {}, mouseButton; {}, ClickType: {}", + ItemScroller.logger.warn("Exception while emulating a slot click: gui: '{}', slotNum: {}, mouseButton; {}, ClickType: {}", gui.getClass().getName(), slotNum, mouseButton, type, e); } } @@ -2326,7 +2322,7 @@ public static void clickSlot(GuiContainer gui, Slot slot, int slotNum, int mouse } catch (Exception e) { - LiteModItemScroller.logger.warn("Exception while emulating a slot click: gui: '{}', slotNum: {}, mouseButton; {}, ClickType: {}", + ItemScroller.logger.warn("Exception while emulating a slot click: gui: '{}', slotNum: {}, mouseButton; {}, ClickType: {}", gui.getClass().getName(), slotNum, mouseButton, type, e); } } @@ -2385,7 +2381,7 @@ public static void swapSlots(GuiContainer gui, int slotNum, int otherSlot) private static void dragSplitItemsIntoSlots(GuiContainer gui, List targetSlots) { - Minecraft mc = Minecraft.getMinecraft(); + Minecraft mc = Minecraft.getInstance(); ItemStack stackInCursor = mc.player.inventory.getItemStack(); if (isStackEmpty(stackInCursor)) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java b/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java index 5ed0c527a..ca76cdaca 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java @@ -31,9 +31,8 @@ public int hashCode() final int prime = 31; int result = 1; //result = prime * result + ((stack == null) ? 0 : stack.hashCode()); - result = prime * result + this.stack.getMetadata(); result = prime * result + this.stack.getItem().hashCode(); - result = prime * result + (this.stack.getTagCompound() != null ? this.stack.getTagCompound().hashCode() : 0); + result = prime * result + (this.stack.getTag() != null ? this.stack.getTag().hashCode() : 0); return result; } @@ -56,11 +55,6 @@ public boolean equals(Object obj) } else { - if (this.stack.getMetadata() != other.stack.getMetadata()) - { - return false; - } - if (this.stack.getItem() != other.stack.getItem()) { return false; diff --git a/src/main/resources/assets/itemscroller/lang/en_us.json b/src/main/resources/assets/itemscroller/lang/en_us.json new file mode 100644 index 000000000..0b9658d59 --- /dev/null +++ b/src/main/resources/assets/itemscroller/lang/en_us.json @@ -0,0 +1,6 @@ +{ + "itemscroller.gui.title.configs": "Item Scroller Configs", + "itemscroller.gui.button.config_gui.generic": "Generic", + "itemscroller.gui.button.config_gui.hotkeys": "Hotkeys", + "itemscroller.gui.button.config_gui.toggles": "Toggles" +} \ No newline at end of file diff --git a/src/main/resources/assets/itemscroller/lang/en_us.lang b/src/main/resources/assets/itemscroller/lang/en_us.lang deleted file mode 100644 index 39296368c..000000000 --- a/src/main/resources/assets/itemscroller/lang/en_us.lang +++ /dev/null @@ -1,5 +0,0 @@ -language.name=English -language.region=US -language.code=en_US - -itemscroller.hotkeys.category.hotkeys=Hotkeys diff --git a/src/main/resources/litemod.json b/src/main/resources/litemod.json deleted file mode 100644 index efe652388..000000000 --- a/src/main/resources/litemod.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "itemscroller", - "mcversion": "1.12", - "mixinConfigs": [ "mixins.itemscroller.json" ] -} \ No newline at end of file diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index b6506a5cb..c3179e56b 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -6,10 +6,11 @@ "client": [ "IMixinGuiContainer", "IMixinGuiMerchant", - "MixinEntityRenderer", "IMixinSlot", + "MixinGameRenderer", "MixinContainer", - "MixinGuiScreen" + "MixinGuiScreen", + "MixinMinecraft" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index b18c6d6cd..643ed8c78 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,7 +1,7 @@ { "pack": { - "pack_format": 3, - "description": "Item Scroller Resources" + "pack_format": 4, + "description": "Item Scroller" } } \ No newline at end of file diff --git a/src/main/resources/riftmod.json b/src/main/resources/riftmod.json new file mode 100644 index 000000000..b293b5d01 --- /dev/null +++ b/src/main/resources/riftmod.json @@ -0,0 +1,6 @@ +{ + "id": "itemscroller", + "name": "Item Scroller", + "authors": [ "masa" ], + "listeners": [ "fi.dy.masa.itemscroller.ItemScroller" ] +} \ No newline at end of file From 4582dbdd1dc0355c43e7183615a0a27d9bfd79c5 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 12 Dec 2018 23:07:15 +0200 Subject: [PATCH 002/107] Update build scripts and wrappers --- build.gradle | 6 ++++-- build.properties | 5 +++-- gradle/wrapper/gradle-wrapper.jar | Bin 53319 -> 54329 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++-- gradlew | 26 +++++++++++++++-------- gradlew.bat | 8 +------ 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/build.gradle b/build.gradle index cff6f4fc5..57ad6d7ed 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,9 @@ targetCompatibility = 1.8 repositories { mavenCentral() maven { url 'https://www.jitpack.io' } + maven { url 'https://www.dimdev.org/maven/' } maven { url 'http://repo.strezz.org/artifactory/list/Strezz-Central' } + maven { url 'https://masa.dy.fi/maven' } } ext.configFile = file "build.properties" @@ -53,8 +55,8 @@ minecraft { } dependencies { + implementation 'fi.dy.masa.malilib:malilib-rift-' + config.minecraft_version_out + ':' + config.malilib_version + ':deobf' implementation 'com.github.Chocohead:Rift:jitpack-SNAPSHOT:dev' - deobfCompile "fi.dy.masa.malilib:malilib-" + config.minecraft_version_out + ":" + config.malilib_version + ":deobf" } /* @@ -66,7 +68,7 @@ sourceSets { */ group = config.group + config.mod_id // http://maven.apache.org/guides/mini/guide-naming-conventions.html -archivesBaseName = config.mod_id + '-' + config.minecraft_version_out +archivesBaseName = config.mod_file_name + '-' + config.minecraft_version_out version = project.minecraft.mod_version /** diff --git a/build.properties b/build.properties index 97e141ca7..bc30d5928 100644 --- a/build.properties +++ b/build.properties @@ -2,11 +2,12 @@ group = fi.dy.masa mod_id = itemscroller mod_name = Item Scroller -mod_version = 0.14.2 author = masa +mod_file_name = itemscroller-rift +mod_version = 0.14.2 # Minecraft, Forge and MCP mappings versions minecraft_version_out = 1.13.2 minecraft_version = 1.13.2 mappings_version = snapshot_20181129 -malilib_version = 0.9.0 +malilib_version = 0.9.3 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index d3b83982b9b1bccad955349d702be9b884c6e049..01b8bf6b1f99cad9213fc495b33ad5bbab8efd20 100644 GIT binary patch delta 38524 zcmZ6yV{j!**shz2ZQHhO+qP}3XeF7L6Wg{|oJ>41C$?>C&U;SnQ+t2AtGcTiPygz= zyZU2Usc@5WC*zi?n+Oew6t zu~WW>@PYB#dOnNVsNa~A=@gRKHa}ow5y^&U%r)fg880#jCTK# z?dXL0(oJz?h^u=s?kTGdi8kl{ccjP=Ax(8{i&qVksDWed^##)+?kM@_L# zfIC&TgEnBsS;_KJGFpj7m(SAEGSOm+-*J$f-=32PH>X>qr-V<>UewzUDRXvaXK>r* zyaFaGWl(8xEP(9Srn0eiS?)@LOXk~_jGp?k=d?SG2jb2@^oXuR4q<+JP)(AX~Rai^3GP2~PIb+{)L zd&`3RT?7bFUS~gKWcHdJLn8i#(`9UEsRib_0x0=bGdr%7SO8zs*0YLJZj%oNdLTQ8 za<$|_HM;xkB!wy~itYhMm?_s*I+f`^BR$8OGHtabmZo*#4IDpl2aAJ|JMHX}5NJx84Zepn=W@T};OViJ1I~d{Ztfl>wPoUC~+Qw~2S7>aZ{s%z&8L$^>Kl zQM|p2Y`2j{dEkk;k3uZv<%_-KU zpD`T)NZ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d8Fe1od7s#$ons8dO2HVAsFRc zJPGLcK`jFa{*3vgo2rqBmEjwDG3f;7;Y|U3egPR7`!)gKNFq`qXqftZ45OT_%sj?H z$rDZM$JbNHkqjFe&Iu_4oiAmI%PGQ!avad@tAdQew$eoyg-sBlnpzbB`Wc(%?twwr z-E|kCjAj!!7B=SxxDk;`g6QrgsHRT=`bgPL?}4p607l^kmx0pq(Dp$dfsN@0X21SG z_FbNq2gK1E0J&!=4j1l05Qt0mS+Qj y21M!Ux0V!)rZj4#(SL}LWDc#uAvm=9o1vzmUBc|ZNbo?$q67p%(NXxq1NDDR;!`95 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 65041d7b3..af2c984ff 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Jan 05 21:33:17 EET 2017 +#Thu Mar 02 15:26:25 EET 2017 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip diff --git a/gradlew b/gradlew index 27309d923..6e5d9efaf 100644 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" \ No newline at end of file diff --git a/gradlew.bat b/gradlew.bat index 832fdb607..dee787c67 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -49,7 +49,6 @@ goto fail @rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line @@ -87,4 +81,4 @@ exit /b 1 :mainEnd if "%OS%"=="Windows_NT" endlocal -:omega +:omega \ No newline at end of file From 8507f28c07c71cf03a1ad948d3c56c4473db01aa Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 25 Apr 2019 00:04:21 +0300 Subject: [PATCH 003/107] Port to Fabric on MC 1.14.0 --- build.gradle | 174 ++-- build.properties | 17 +- gradle/wrapper/gradle-wrapper.jar | Bin 54329 -> 56177 bytes gradle/wrapper/gradle-wrapper.properties | 4 +- gradlew | 2 +- gradlew.bat | 2 +- settings.gradle | 10 + .../fi/dy/masa/itemscroller/ItemScroller.java | 17 +- .../dy/masa/itemscroller/config/Configs.java | 12 +- .../masa/itemscroller/event/InputHandler.java | 44 +- .../itemscroller/event/KeybindCallbacks.java | 54 +- .../event/RenderEventHandler.java | 171 ++-- .../dy/masa/itemscroller/gui/GuiConfigs.java | 16 +- .../mixin/IMixinContainerScreen.java | 33 + .../mixin/IMixinGuiContainer.java | 33 - .../masa/itemscroller/mixin/IMixinSlot.java | 4 +- ...erchant.java => IMixinVillagerScreen.java} | 8 +- .../itemscroller/mixin/MixinContainer.java | 30 - .../mixin/MixinCraftingTableContainer.java | 36 + .../itemscroller/mixin/MixinGameRenderer.java | 10 +- ...necraft.java => MixinMinecraftClient.java} | 15 +- .../{MixinGuiScreen.java => MixinScreen.java} | 10 +- .../itemscroller/recipes/CraftingHandler.java | 34 +- ...CraftingRecipe.java => RecipePattern.java} | 67 +- .../itemscroller/recipes/RecipeStorage.java | 60 +- .../masa/itemscroller/util/AccessorUtils.java | 44 +- .../dy/masa/itemscroller/util/InputUtils.java | 10 +- .../itemscroller/util/InventoryUtils.java | 856 +++++++++--------- .../dy/masa/itemscroller/util/ItemType.java | 2 +- src/main/resources/fabric.mod.json | 35 + src/main/resources/mcmod.info | 16 - src/main/resources/mixins.itemscroller.json | 14 +- src/main/resources/riftmod.json | 6 - 33 files changed, 925 insertions(+), 921 deletions(-) create mode 100644 settings.gradle create mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java delete mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiContainer.java rename src/main/java/fi/dy/masa/itemscroller/mixin/{IMixinGuiMerchant.java => IMixinVillagerScreen.java} (52%) delete mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinContainer.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableContainer.java rename src/main/java/fi/dy/masa/itemscroller/mixin/{MixinMinecraft.java => MixinMinecraftClient.java} (52%) rename src/main/java/fi/dy/masa/itemscroller/mixin/{MixinGuiScreen.java => MixinScreen.java} (64%) rename src/main/java/fi/dy/masa/itemscroller/recipes/{CraftingRecipe.java => RecipePattern.java} (63%) create mode 100644 src/main/resources/fabric.mod.json delete mode 100644 src/main/resources/mcmod.info delete mode 100644 src/main/resources/riftmod.json diff --git a/build.gradle b/build.gradle index 57ad6d7ed..faf601807 100644 --- a/build.gradle +++ b/build.gradle @@ -1,34 +1,17 @@ - -buildscript { - repositories { - jcenter() - maven { url 'http://files.minecraftforge.net/maven' } - maven { url 'http://repo.spongepowered.org/maven' } - maven { url 'https://www.jitpack.io' } - } - - dependencies { - classpath 'com.github.Chocohead:ForgeGradle:moderniser-SNAPSHOT' - classpath 'org.spongepowered:mixingradle:0.6-SNAPSHOT' - } +plugins { + id 'fabric-loom' version '0.2.2-SNAPSHOT' + id 'maven-publish' } -apply plugin: 'net.minecraftforge.gradle.tweaker-client' -apply plugin: 'org.spongepowered.mixin' -apply plugin: 'java' -apply plugin: 'maven-publish' - -sourceCompatibility = 1.8 -targetCompatibility = 1.8 - repositories { - mavenCentral() - maven { url 'https://www.jitpack.io' } - maven { url 'https://www.dimdev.org/maven/' } - maven { url 'http://repo.strezz.org/artifactory/list/Strezz-Central' } - maven { url 'https://masa.dy.fi/maven' } + maven { + url 'https://masa.dy.fi/maven' + } } +sourceCompatibility = JavaVersion.VERSION_1_8 +targetCompatibility = JavaVersion.VERSION_1_8 + ext.configFile = file "build.properties" configFile.withReader { @@ -37,107 +20,84 @@ configFile.withReader { project.ext.config = new ConfigSlurper().parse prop } -minecraft { - version = config.minecraft_version - mappings = config.mappings_version - runDir = 'minecraft' - makeObfSourceJar = false - tweakClass = 'org.dimdev.riftloader.launch.RiftLoaderClientTweaker' +dependencies { + minecraft "com.mojang:minecraft:" + config.minecraft_version + mappings "net.fabricmc:yarn:" + config.mappings_version + modCompile "net.fabricmc:fabric-loader:" + config.fabric_loader_version + compile "com.google.code.findbugs:jsr305:3.0.2" + + // Fabric API. This is technically optional, but you probably want it anyway. + modCompile "net.fabricmc:fabric:" + config.fabric_version + modCompile "fi.dy.masa.malilib:malilib-fabric-" + config.minecraft_version_out + ":" + config.malilib_version +} + +minecraft { ext.mod_version = config.mod_version if (mod_version.endsWith('-dev')) { mod_version = mod_version + "." + new Date().format('yyyyMMdd.HHmmss') } - - replaceIn "Reference.java" - replace "@MOD_VERSION@", mod_version } -dependencies { - implementation 'fi.dy.masa.malilib:malilib-rift-' + config.minecraft_version_out + ':' + config.malilib_version + ':deobf' - implementation 'com.github.Chocohead:Rift:jitpack-SNAPSHOT:dev' -} - -/* -sourceSets { - main { - ext.refMap = 'mixins.' + config.mod_id + '.refmap.json' - } +compileJava { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + options.encoding = 'UTF-8' } -*/ -group = config.group + config.mod_id // http://maven.apache.org/guides/mini/guide-naming-conventions.html +group = config.group + "." + config.mod_id archivesBaseName = config.mod_file_name + '-' + config.minecraft_version_out version = project.minecraft.mod_version -/** - * This section allows you to customise the generated litemod.json file - */ - /* -litemod { - json { - name = config.mod_id - displayName = config.mod_name - mcversion = config.minecraft_version - version = config.mod_version - author = config.author - - // Uncomment any of the following lines and fill in your own details as required - //requiredAPIs = [ 'someapi' ] - //tweakClass = 'name.of.tweaker.here' - dependsOn = [ 'malilib' ] - mixinConfigs = [ 'mixins.' + config.mod_id + '.json' ] - } -} -*/ - -/** - * This section allows you to customise your generated jar (litemod) file. By - * default it includes the generated litemod.json file, however if you prefer to - * include your own file from resources, simply remove the line below. - */ -jar { - // Remove the "-mc1.12" suffix from the file name - //classifier = "" - // Don't append a 'mod-' filename prefix >_> - baseName = archivesBaseName - - //from litemod.outputs - - /* - manifest.mainAttributes ( - 'Built-By': System.properties['user.name'], - 'Created-By': System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")", - 'Implementation-Title': config.mod_id, - 'Implementation-Version': project.version - ) - */ -} - -mixin { - defaultObfuscationEnv notch - add sourceSets.main, 'mixins.' + config.mod_id + '.refmap.json' -} - -//tasks.withType(Jar)*.baseName = archivesBaseName - processResources { // this will ensure that this task is redone when the versions change. + //inputs.property "mod_version", project.minecraft.mod_version + //inputs.property "minecraft_version", project.config.minecraft_version + inputs.property "mod_version", project.minecraft.mod_version - inputs.property "minecraft_version", project.config.minecraft_version - // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { - include 'mcmod.info' - - // replace version and mcversion - expand 'mod_version': project.minecraft.mod_version, 'minecraft_version': project.config.minecraft_version + include "fabric.mod.json" + expand "mod_version": project.minecraft.mod_version } - - // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' + exclude "fabric.mod.json" + } +} + +// ensure that the encoding is set to UTF-8, no matter what the system default is +// this fixes some edge cases with special characters not displaying correctly +// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html +tasks.withType(JavaCompile) { + options.encoding = "UTF-8" +} + +// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task +// if it is present. +// If you remove this task, sources will not be generated. +task sourcesJar(type: Jar, dependsOn: classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + +tasks.publish.dependsOn build +publishing { + publications { + mavenJava(MavenPublication) { + artifactId project.archivesBaseName + + // add all the jars that should be included when publishing to maven + artifact(jar) { builtBy remapJar } + artifact(sourcesJar) { builtBy remapSourcesJar } + } + } + + repositories { + maven { + url "$projectDir/../../CommonMaven" + } } } diff --git a/build.properties b/build.properties index bc30d5928..8b79d6abb 100644 --- a/build.properties +++ b/build.properties @@ -3,11 +3,16 @@ group = fi.dy.masa mod_id = itemscroller mod_name = Item Scroller author = masa -mod_file_name = itemscroller-rift + +mod_file_name = itemscroller-fabric mod_version = 0.14.2 -# Minecraft, Forge and MCP mappings versions -minecraft_version_out = 1.13.2 -minecraft_version = 1.13.2 -mappings_version = snapshot_20181129 -malilib_version = 0.9.3 +malilib_version = 0.9.5 + +# Minecraft, Fabric and mappings versions +minecraft_version_out = 1.14.0 +minecraft_version = 1.14 +mappings_version = 1.14+build.1 + +fabric_version = 0.2.7+build.127 +fabric_loader_version = 0.4.2+build.132 diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 01b8bf6b1f99cad9213fc495b33ad5bbab8efd20..29953ea141f55e3b8fc691d31b5ca8816d89fa87 100644 GIT binary patch delta 49492 zcmY(JQ*__&)3wvEv28nPY}>Z&#>S_yZQFLz*tTsaO}??(JiqlGz5la0-1l0uX6`-L z?yP_SwLv6s!S-QKNQr`hfoUZQtHI&oo#TRBKrY|F67UjRJmAQ<73evkz`&T{k_(7& zlNG)Z0D7KFk|_VMrZi2(zmLLl3!6%lcrbC6rlf_G{UW86`!P@jq;3_IEHM&{e#+u=}8YXMTswO|99-&pAD=(PV38d+=xDyEj4xe8Kj?0=|=l zu!&qt>W=2bypi}gb4Iv&@kBtG54#9{CuV|d1R|nMy-OinA(V zhV44&#C9Tnq*)yECSd>R(1tUm^)ROVj<{y7fBTE6t(3%LAi;zcGR`{8QiO7vmfK2>YBFZ)B_sT6T4zNVNn2c7#JamZOCXzrS-%P?-)Lf!*g{Bu(C=#XGc_T zKk>M)uoUB|DC9B~7S*fnC%3!!t*puyGaR{Bsf)1P+q9YDO6b*xY#k}|BoY12Hs8Zqb2WTp2Jw9W8PFOO^V zUN$^X!PZ-Tz!mVfC#}NGW?ZbsxG`K#CW|yw0=ydq6F^)YR zhXV>vMWsTh;q;<*x5e&w2;gLh$=02C^~AHc!%)mdxl#r%Lgc#%@{0V0B_AD=^{b7v z7IFS*+##2FG2EBSe_$jZS$>*dH~gGYMoCiXYaDN#xn<*5PYX1`fyZ^RhBM-i7#x90 zJr+?-w~QN7zD)Db#6}MLj6P%|&38i8RW8HOz9`{SqGLMV)p;J$9YE{{nMNZES!fC! zr@|}wKV@tk$JzI`B0jZ|v`Ar!erdGHcgYL?tC5ID>Os$uPNRh(lB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U<`DO8)aN2J9$dc3W^;zxEq^jC$+=S7;b86mL2>c2EcUQ~mMaZ|D!u5RM6Wgnokz z0tiPo6l5g}1>PJ1fN@7?5hV%X0tF!gRj}-c3UmfIZ-g1T3p_Kz1%31nmo}ZE4D=gJ zC`>3Q1PH}8gr4HUTRZgvl20%P>1RO?k^J`sfCfV&VSyE)@xi{MXfT$6rsm-IQS3MB za1c2GxPKHEX2gNV1-u23@xcF;b;9F;8OP87@mJ^*@BblY0zg5L{8uC7C=(F^Bm?_H zKtJRe*YY8v5y+eQ73c`(ueQN4AgX^j6S_Vm-+B)j3W^n+IYtg99A^T+lzFe|LjL@t5{&rI1S*W(i&WX1O>&03k5~IF5S{@71b|-{5x{qgXn<_wRv~i8t+}O!%ula0 zeq@ILNx>TvXn#?&coG2npMGk>lUQ%iWWe2uq~H~KTyXge8sJrzu2O3vrRiVRw5s)LjSO|z3Qu6=={F6uC z4f%Cd5VPTY1yV}*3p$)92E0n{eFd^ef`E9yU2|vv)c;Kz{r7b;P5G+{Hwy*)Z2=AN zDoyW|HmUUg0CTayG>d33|0GI*1s1X2kY<6m^4Y-p3+QkE$!f}hh`e$jP%^Mi5#isH zze@RdrL#F70we{CEnx#*ISpQclIy{FJ*41t2 gui = (ContainerScreen) mc.currentScreen; RecipeStorage recipes = this.callbacks.getRecipes(); // When scrolling while the recipe view is open, change the selection instead of moving items @@ -114,24 +114,24 @@ public boolean onMouseClick(int mouseX, int mouseY, int eventButton, boolean eve InventoryUtils.stopDragging(); } - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); boolean cancel = false; if (this.callbacks.functionalityEnabled() && mc != null && mc.player != null && - mc.currentScreen instanceof GuiContainer && - (mc.currentScreen instanceof GuiContainerCreative) == false && + mc.currentScreen instanceof ContainerScreen && + (mc.currentScreen instanceof CreativePlayerInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(mc.currentScreen.getClass().getName()) == false) { - GuiContainer gui = (GuiContainer) mc.currentScreen; + ContainerScreen gui = (ContainerScreen) mc.currentScreen; RecipeStorage recipes = this.callbacks.getRecipes(); Slot slot = AccessorUtils.getSlotUnderMouse(gui); - final boolean isLeftClick = mc.gameSettings.keyBindAttack.func_197984_a(eventButton); - final boolean isRightClick = mc.gameSettings.keyBindUseItem.func_197984_a(eventButton); - final boolean isPickBlock = mc.gameSettings.keyBindPickBlock.func_197984_a(eventButton); - final boolean isShiftDown = GuiScreen.isShiftKeyDown(); + final boolean isLeftClick = mc.options.keyAttack.matchesMouse(eventButton); + final boolean isRightClick = mc.options.keyUse.matchesMouse(eventButton); + final boolean isPickBlock = mc.options.keyPickItem.matchesMouse(eventButton); + final boolean isShiftDown = Screen.hasShiftDown(); if (eventButtonState && (isLeftClick || isRightClick || isPickBlock)) { @@ -151,7 +151,7 @@ else if (isPickBlock && InputUtils.isRecipeViewOpen() && InventoryUtils.isCrafti } } - InventoryUtils.checkForItemPickup(gui, mc); + InventoryUtils.checkForItemPickup(mc); if (eventButtonState && (isLeftClick || isRightClick)) { @@ -189,19 +189,19 @@ else if (Configs.Toggles.SHIFT_DROP_ITEMS.getBooleanValue() && @Override public void onMouseMove(int mouseX, int mouseY) { - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); if (this.callbacks.functionalityEnabled() && mc != null && mc.player != null && - mc.currentScreen instanceof GuiContainer && + mc.currentScreen instanceof ContainerScreen && Configs.GUI_BLACKLIST.contains(mc.currentScreen.getClass().getName()) == false) { - this.handleDragging((GuiContainer) mc.currentScreen, mc, mouseX, mouseY, false); + this.handleDragging((ContainerScreen) mc.currentScreen, mc, mouseX, mouseY, false); } } - private boolean handleDragging(GuiContainer gui, Minecraft mc, int mouseX, int mouseY, boolean isClick) + private boolean handleDragging(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) { MoveAction action = InventoryUtils.getActiveMoveAction(); diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 7845c54e2..f70d6d810 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -5,7 +5,7 @@ import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.gui.GuiConfigs; import fi.dy.masa.itemscroller.recipes.CraftingHandler; -import fi.dy.masa.itemscroller.recipes.CraftingRecipe; +import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; import fi.dy.masa.itemscroller.util.AccessorUtils; import fi.dy.masa.itemscroller.util.InputUtils; @@ -15,14 +15,14 @@ import fi.dy.masa.malilib.hotkeys.IHotkeyCallback; import fi.dy.masa.malilib.hotkeys.IKeybind; import fi.dy.masa.malilib.hotkeys.KeyAction; -import net.minecraft.client.MainWindow; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.gui.inventory.GuiContainerCreative; -import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.init.SoundEvents; -import net.minecraft.inventory.Slot; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.client.gui.Screen; +import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen; +import net.minecraft.client.gui.ingame.PlayerInventoryScreen; +import net.minecraft.client.util.Window; +import net.minecraft.container.Slot; +import net.minecraft.sound.SoundEvents; public class KeybindCallbacks implements IHotkeyCallback { @@ -74,7 +74,7 @@ public void onWorldChanged() @Override public boolean onKeyAction(KeyAction action, IKeybind key) { - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); if (key == Hotkeys.KEY_MAIN_TOGGLE.getKeybind()) { @@ -93,16 +93,16 @@ public boolean onKeyAction(KeyAction action, IKeybind key) } else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) { - mc.displayGuiScreen(new GuiConfigs()); + mc.openScreen(new GuiConfigs()); return true; } - if (this.disabled || mc == null || mc.player == null || (mc.currentScreen instanceof GuiContainer) == false) + if (this.disabled || mc == null || mc.player == null || (mc.currentScreen instanceof ContainerScreen) == false) { return false; } - GuiContainer gui = (GuiContainer) mc.currentScreen; + ContainerScreen gui = (ContainerScreen) mc.currentScreen; Slot slot = AccessorUtils.getSlotUnderMouse(gui); RecipeStorage recipes = this.getRecipes(); MoveAction moveAction = InputUtils.getDragMoveAction(key); @@ -111,9 +111,9 @@ else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) { if (moveAction != MoveAction.NONE) { - MainWindow window = mc.mainWindow; - final int mouseX = (int) (mc.mouseHelper.getMouseX() * (double) window.getScaledWidth() / (double) window.getWidth()); - final int mouseY = (int) (mc.mouseHelper.getMouseY() * (double) window.getScaledHeight() / (double) window.getHeight()); + Window window = mc.window; + final int mouseX = (int) (mc.mouse.getX() * (double) window.getScaledWidth() / (double) window.getWidth()); + final int mouseY = (int) (mc.mouse.getY() * (double) window.getScaledHeight() / (double) window.getHeight()); return InventoryUtils.dragMoveItems(gui, mc, moveAction, mouseX, mouseY, true); } else if (key == Hotkeys.KEY_MOVE_EVERYTHING.getKeybind()) @@ -125,7 +125,7 @@ else if (key == Hotkeys.KEY_DROP_ALL_MATCHING.getKeybind()) { if (Configs.Toggles.DROP_MATCHING.getBooleanValue() && Configs.GUI_BLACKLIST.contains(gui.getClass().getName()) == false && - slot.getHasStack()) + slot.hasStack()) { InventoryUtils.dropStacks(gui, slot.getStack(), slot, true); return true; @@ -134,9 +134,9 @@ else if (key == Hotkeys.KEY_DROP_ALL_MATCHING.getKeybind()) else if (key == Hotkeys.KEY_MOVE_STACK_TO_OFFHAND.getKeybind()) { // Swap the hovered stack to the Offhand - if ((gui instanceof GuiInventory) && slot != null) + if ((gui instanceof PlayerInventoryScreen) && slot != null) { - InventoryUtils.swapSlots(gui, slot.slotNumber, 45); + InventoryUtils.swapSlots(gui, slot.id, 45); return true; } } @@ -174,23 +174,23 @@ else if (key == Hotkeys.KEY_SLOT_DEBUG.getKeybind()) return false; } - public void onTick(Minecraft mc) + public void onTick(MinecraftClient mc) { if (this.disabled == false && mc != null && mc.player != null && - mc.currentScreen instanceof GuiContainer && - (mc.currentScreen instanceof GuiContainerCreative) == false && + mc.currentScreen instanceof ContainerScreen && + (mc.currentScreen instanceof CreativePlayerInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(mc.currentScreen.getClass().getName()) == false && Hotkeys.KEY_MASS_CRAFT.getKeybind().isKeybindHeld()) { - GuiScreen guiScreen = mc.currentScreen; - GuiContainer gui = (GuiContainer) guiScreen; + Screen guiScreen = mc.currentScreen; + ContainerScreen gui = (ContainerScreen) guiScreen; Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); if (outputSlot != null) { - CraftingRecipe recipe = this.getRecipes().getSelectedRecipe(); + RecipePattern recipe = this.getRecipes().getSelectedRecipe(); InventoryUtils.tryClearCursor(gui, mc); InventoryUtils.throwAllCraftingResultsToGround(recipe, gui); @@ -202,11 +202,11 @@ public void onTick(Minecraft mc) { if (Configs.Generic.CARPET_CTRL_Q_CRAFTING.getBooleanValue()) { - InventoryUtils.dropStack(gui, outputSlot.slotNumber); + InventoryUtils.dropStack(gui, outputSlot.id); } else { - InventoryUtils.dropStacksWhileHasItem(gui, outputSlot.slotNumber, recipe.getResult()); + InventoryUtils.dropStacksWhileHasItem(gui, outputSlot.id, recipe.getResult()); } InventoryUtils.tryClearCursor(gui, mc); diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 7d5b2cecf..3c3e00d0b 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -3,28 +3,29 @@ import java.util.ArrayList; import java.util.List; import javax.annotation.Nonnull; +import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.platform.GlStateManager; import fi.dy.masa.itemscroller.config.Configs; -import fi.dy.masa.itemscroller.recipes.CraftingRecipe; +import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; import fi.dy.masa.itemscroller.util.AccessorUtils; import fi.dy.masa.itemscroller.util.InputUtils; import fi.dy.masa.itemscroller.util.InventoryUtils; -import net.minecraft.client.MainWindow; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.FontRenderer; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.client.util.ITooltipFlag; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.item.TooltipContext; +import net.minecraft.client.render.BufferBuilder; +import net.minecraft.client.render.GuiLighting; +import net.minecraft.client.render.Tessellator; +import net.minecraft.client.render.VertexFormats; +import net.minecraft.client.util.Window; import net.minecraft.item.ItemStack; +import net.minecraft.text.StringTextComponent; +import net.minecraft.text.TextComponent; +import net.minecraft.text.TextFormat; import net.minecraft.util.math.Vec3d; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.TextComponentString; -import net.minecraft.util.text.TextFormatting; public class RenderEventHandler { @@ -39,11 +40,11 @@ public static RenderEventHandler instance() public void onDrawBackgroundPost() { - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); - if (mc.currentScreen instanceof GuiContainer && InputUtils.isRecipeViewOpen()) + if (mc.currentScreen instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) { - GuiContainer gui = (GuiContainer) mc.currentScreen; + ContainerScreen gui = (ContainerScreen) mc.currentScreen; RecipeStorage recipes = KeybindCallbacks.getInstance().getRecipes(); final int count = recipes.getRecipeCount(); @@ -57,21 +58,21 @@ public void onDrawBackgroundPost() public void onDrawScreenPost() { - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); - if (mc.currentScreen instanceof GuiContainer && InputUtils.isRecipeViewOpen()) + if (mc.currentScreen instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) { - GuiContainer gui = (GuiContainer) mc.currentScreen; + ContainerScreen gui = (ContainerScreen) mc.currentScreen; RecipeStorage recipes = KeybindCallbacks.getInstance().getRecipes(); - MainWindow window = mc.mainWindow; - final int mouseX = (int) (mc.mouseHelper.getMouseX() * (double) window.getScaledWidth() / (double) window.getWidth()); - final int mouseY = (int) (mc.mouseHelper.getMouseY() * (double) window.getScaledHeight() / (double) window.getHeight()); + Window window = mc.window; + final int mouseX = (int) (mc.mouse.getX() * (double) window.getScaledWidth() / (double) window.getWidth()); + final int mouseY = (int) (mc.mouse.getY() * (double) window.getScaledHeight() / (double) window.getHeight()); final int recipeId = this.getHoveredRecipeId(mouseX, mouseY, recipes, gui, mc); if (recipeId >= 0) { - CraftingRecipe recipe = recipes.getRecipe(recipeId); + RecipePattern recipe = recipes.getRecipe(recipeId); if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) { @@ -82,7 +83,7 @@ public void onDrawScreenPost() } else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) { - CraftingRecipe recipe = recipes.getSelectedRecipe(); + RecipePattern recipe = recipes.getSelectedRecipe(); this.renderRecipeItems(recipe, recipes.getRecipeCount(), gui, mc); ItemStack stack = this.getHoveredRecipeIngredient(mouseX, mouseY, recipe, recipes.getRecipeCount(), gui, mc); @@ -95,7 +96,7 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) } } - private void renderHoverTooltip(int mouseX, int mouseY, CraftingRecipe recipe, GuiContainer gui, Minecraft mc) + private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, ContainerScreen gui, MinecraftClient mc) { ItemStack stack = recipe.getResult(); @@ -105,11 +106,11 @@ private void renderHoverTooltip(int mouseX, int mouseY, CraftingRecipe recipe, G } } - public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, GuiContainer gui, Minecraft mc) + public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, ContainerScreen gui, MinecraftClient mc) { if (InputUtils.isRecipeViewOpen()) { - MainWindow window = mc.mainWindow; + Window window = mc.window; final int gap = 40; final int recipesPerColumn = 9; final int stackBaseHeight = 16; @@ -138,13 +139,13 @@ public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, Gui return -1; } - private void renderStoredRecipeStack(int recipeId, int recipeCount, ItemStack stack, GuiContainer gui, Minecraft mc, boolean selected) + private void renderStoredRecipeStack(int recipeId, int recipeCount, ItemStack stack, ContainerScreen gui, MinecraftClient mc, boolean selected) { - FontRenderer font = mc.fontRenderer; + TextRenderer font = mc.textRenderer; final String indexStr = String.valueOf(recipeId + 1); final int strWidth = font.getStringWidth(indexStr); - MainWindow window = mc.mainWindow; + Window window = mc.window; final int verticalGap = 40; final int recipesPerColumn = 9; final int stackBaseHeight = 16; @@ -164,10 +165,10 @@ private void renderStoredRecipeStack(int recipeId, int recipeCount, ItemStack st this.renderStackAt(stack, x, y, selected, scale, stackBaseHeight, mc); - font.drawString(indexStr, (int) (x - scale * strWidth), (int) (y + (entryHeight - font.FONT_HEIGHT) / 2 - 2), 0xC0C0C0); + font.draw(indexStr, (int) (x - scale * strWidth), (int) (y + (entryHeight - font.fontHeight) / 2 - 2), 0xC0C0C0); } - private void renderRecipeItems(CraftingRecipe recipe, int recipeCount, GuiContainer gui, Minecraft mc) + private void renderRecipeItems(RecipePattern recipe, int recipeCount, ContainerScreen gui, MinecraftClient mc) { RecipeLocation location = this.getRecipeLocation(recipe, recipeCount, gui, mc); @@ -184,9 +185,9 @@ private void renderRecipeItems(CraftingRecipe recipe, int recipeCount, GuiContai } } - private RecipeLocation getRecipeLocation(CraftingRecipe recipe, int recipeCount, GuiContainer gui, Minecraft mc) + private RecipeLocation getRecipeLocation(RecipePattern recipe, int recipeCount, ContainerScreen gui, MinecraftClient mc) { - MainWindow window = mc.mainWindow; + Window window = mc.window; final int verticalGap = 40; final int recipesPerColumn = 9; final int stackBaseHeight = 16; @@ -206,7 +207,7 @@ private RecipeLocation getRecipeLocation(CraftingRecipe recipe, int recipeCount, return new RecipeLocation(x, y, scale, stackBaseHeight, recipeDimensions); } - private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, CraftingRecipe recipe, int recipeCount, GuiContainer gui, Minecraft mc) + private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCount, ContainerScreen gui, MinecraftClient mc) { RecipeLocation location = this.getRecipeLocation(recipe, recipeCount, gui, mc); final float stackWidth = location.scale * location.stackBaseHeight; @@ -248,7 +249,7 @@ public RecipeLocation(float x, float y, float scale, int stackBaseHeight, int re } } - private void renderStackAt(ItemStack stack, float x, float y, boolean border, float scale, int stackBaseHeight, Minecraft mc) + private void renderStackAt(ItemStack stack, float x, float y, boolean border, float scale, int stackBaseHeight, MinecraftClient mc) { GlStateManager.pushMatrix(); GlStateManager.translatef(x, y, 0); @@ -259,16 +260,16 @@ private void renderStackAt(ItemStack stack, float x, float y, boolean border, fl if (border) { // Draw a light/white border around the stack - Gui.drawRect( 0, 0, w, 1, 0xFFFFFFFF); - Gui.drawRect( 0, 0, 1, w, 0xFFFFFFFF); - Gui.drawRect(w - 1, 0, w, w, 0xFFFFFFFF); - Gui.drawRect( 0, w - 1, w, w, 0xFFFFFFFF); + DrawableHelper.fill( 0, 0, w, 1, 0xFFFFFFFF); + DrawableHelper.fill( 0, 0, 1, w, 0xFFFFFFFF); + DrawableHelper.fill(w - 1, 0, w, w, 0xFFFFFFFF); + DrawableHelper.fill( 0, w - 1, w, w, 0xFFFFFFFF); - Gui.drawRect(1, 1, w - 1, w - 1, 0x20FFFFFF); // light background for the item + DrawableHelper.fill(1, 1, w - 1, w - 1, 0x20FFFFFF); // light background for the item } else { - Gui.drawRect(0, 0, w, w, 0x20FFFFFF); // light background for the item + DrawableHelper.fill(0, 0, w, w, 0x20FFFFFF); // light background for the item } if (InventoryUtils.isStackEmpty(stack) == false) @@ -277,14 +278,14 @@ private void renderStackAt(ItemStack stack, float x, float y, boolean border, fl stack = stack.copy(); InventoryUtils.setStackSize(stack, 1); - mc.getItemRenderer().zLevel += 100; - mc.getItemRenderer().renderItemAndEffectIntoGUI(mc.player, stack, 0, 0); - //mc.getRenderItem().renderItemOverlayIntoGUI(mc.fontRenderer, stack, 0, 0, null); - mc.getItemRenderer().zLevel -= 100; + mc.getItemRenderer().zOffset += 100; + mc.getItemRenderer().renderGuiItem(mc.player, stack, 0, 0); + //mc.getRenderItem().renderItemOverlayIntoGUI(mc.textRenderer, stack, 0, 0, null); + mc.getItemRenderer().zOffset -= 100; } GlStateManager.disableBlend(); - RenderHelper.disableStandardItemLighting(); + GuiLighting.disable(); GlStateManager.popMatrix(); } @@ -306,56 +307,56 @@ public static void enableStandardItemLighting(float scale) GlStateManager.enableLight(1); GlStateManager.enableColorMaterial(); GlStateManager.colorMaterial(1032, 5634); - GlStateManager.lightfv(16384, 4611, RenderHelper.setColorBuffer((float) LIGHT0_POS.x, (float) LIGHT0_POS.y, (float) LIGHT0_POS.z, 0.0f)); + GlStateManager.light(16384, 4611, GuiLighting.singletonBuffer((float) LIGHT0_POS.x, (float) LIGHT0_POS.y, (float) LIGHT0_POS.z, 0.0f)); float lightStrength = 0.3F * scale; - GlStateManager.lightfv(16384, 4609, RenderHelper.setColorBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); - GlStateManager.lightfv(16384, 4608, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.lightfv(16384, 4610, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.lightfv(16385, 4611, RenderHelper.setColorBuffer((float) LIGHT1_POS.x, (float) LIGHT1_POS.y, (float) LIGHT1_POS.z, 0.0f)); - GlStateManager.lightfv(16385, 4609, RenderHelper.setColorBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); - GlStateManager.lightfv(16385, 4608, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.lightfv(16385, 4610, RenderHelper.setColorBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.light(16384, 4609, GuiLighting.singletonBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); + GlStateManager.light(16384, 4608, GuiLighting.singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.light(16384, 4610, GuiLighting.singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.light(16385, 4611, GuiLighting.singletonBuffer((float) LIGHT1_POS.x, (float) LIGHT1_POS.y, (float) LIGHT1_POS.z, 0.0f)); + GlStateManager.light(16385, 4609, GuiLighting.singletonBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); + GlStateManager.light(16385, 4608, GuiLighting.singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.light(16385, 4610, GuiLighting.singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); GlStateManager.shadeModel(7424); float ambientLightStrength = 0.4F; - GlStateManager.lightModelfv(2899, RenderHelper.setColorBuffer(ambientLightStrength, ambientLightStrength, ambientLightStrength, 1.0F)); + GlStateManager.lightModel(2899, GuiLighting.singletonBuffer(ambientLightStrength, ambientLightStrength, ambientLightStrength, 1.0F)); } - private void renderStackToolTip(int x, int y, ItemStack stack, GuiContainer gui, Minecraft mc) + private void renderStackToolTip(int x, int y, ItemStack stack, ContainerScreen gui, MinecraftClient mc) { - List list = stack.getTooltip(mc.player, mc.gameSettings.advancedItemTooltips ? ITooltipFlag.TooltipFlags.ADVANCED : ITooltipFlag.TooltipFlags.NORMAL); + List list = stack.getTooltipText(mc.player, mc.options.advancedItemTooltips ? TooltipContext.Default.ADVANCED : TooltipContext.Default.NORMAL); for (int i = 0; i < list.size(); ++i) { if (i == 0) { - list.set(i, new TextComponentString(stack.getRarity().color + list.get(i).getString())); + list.set(i, new StringTextComponent(stack.getRarity().formatting + list.get(i).getString())); } else { - list.set(i, new TextComponentString(TextFormatting.GRAY + list.get(i).getString())); + list.set(i, new StringTextComponent(TextFormat.GRAY + list.get(i).getString())); } } - FontRenderer font = mc.fontRenderer; + TextRenderer font = mc.textRenderer; drawHoveringText(stack, list, x, y, gui.width, gui.height, -1, font); } - private static void drawHoveringText(@Nonnull final ItemStack stack, List components, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, FontRenderer font) + private static void drawHoveringText(@Nonnull final ItemStack stack, List components, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, TextRenderer font) { List textLines = new ArrayList<>(); if (!components.isEmpty()) { GlStateManager.disableRescaleNormal(); - RenderHelper.disableStandardItemLighting(); + GuiLighting.disable(); GlStateManager.disableLighting(); GlStateManager.disableDepthTest(); int tooltipTextWidth = 0; - for (ITextComponent entry : components) + for (TextComponent entry : components) { String text = entry.getString(); int textLineWidth = font.getStringWidth(text); @@ -404,7 +405,7 @@ private static void drawHoveringText(@Nonnull final ItemStack stack, List wrappedLine = font.listFormattedStringToWidth(textLine, tooltipTextWidth); + List wrappedLine = font.wrapStringToWidthAsList(textLine, tooltipTextWidth); if (i == 0) { @@ -471,7 +472,7 @@ else if (tooltipY + tooltipHeight + 4 > screenHeight) for (int lineNumber = 0; lineNumber < textLines.size(); ++lineNumber) { String line = textLines.get(lineNumber); - font.drawStringWithShadow(line, (float)tooltipX, (float)tooltipY, -1); + font.drawWithShadow(line, (float)tooltipX, (float)tooltipY, -1); if (lineNumber + 1 == titleLinesCount) { @@ -483,7 +484,7 @@ else if (tooltipY + tooltipHeight + 4 > screenHeight) GlStateManager.enableLighting(); GlStateManager.enableDepthTest(); - RenderHelper.enableStandardItemLighting(); + GuiLighting.enable(); GlStateManager.enableRescaleNormal(); } } @@ -491,32 +492,32 @@ else if (tooltipY + tooltipHeight + 4 > screenHeight) public static void drawGradientRect(int zLevel, int left, int top, int right, int bottom, int startColor, int endColor) { float startAlpha = (float)(startColor >> 24 & 255) / 255.0F; - float startRed = (float)(startColor >> 16 & 255) / 255.0F; + float startRed = (float)(startColor >> 16 & 255) / 255.0F; float startGreen = (float)(startColor >> 8 & 255) / 255.0F; - float startBlue = (float)(startColor & 255) / 255.0F; - float endAlpha = (float)(endColor >> 24 & 255) / 255.0F; - float endRed = (float)(endColor >> 16 & 255) / 255.0F; - float endGreen = (float)(endColor >> 8 & 255) / 255.0F; - float endBlue = (float)(endColor & 255) / 255.0F; + float startBlue = (float)(startColor & 255) / 255.0F; + float endAlpha = (float)(endColor >> 24 & 255) / 255.0F; + float endRed = (float)(endColor >> 16 & 255) / 255.0F; + float endGreen = (float)(endColor >> 8 & 255) / 255.0F; + float endBlue = (float)(endColor & 255) / 255.0F; - GlStateManager.disableTexture2D(); + GlStateManager.disableTexture(); GlStateManager.enableBlend(); GlStateManager.disableAlphaTest(); GlStateManager.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); - GlStateManager.shadeModel(7425); + GlStateManager.shadeModel(GL11.GL_SMOOTH); Tessellator tessellator = Tessellator.getInstance(); - BufferBuilder buffer = tessellator.getBuffer(); - buffer.begin(7, DefaultVertexFormats.POSITION_COLOR); - buffer.pos(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); - buffer.pos(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).endVertex(); - buffer.pos(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex(); - buffer.pos(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).endVertex(); + BufferBuilder buffer = tessellator.getBufferBuilder(); + buffer.begin(GL11.GL_QUADS, VertexFormats.POSITION_COLOR); + buffer.vertex(right, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).next(); + buffer.vertex(left, top, zLevel).color(startRed, startGreen, startBlue, startAlpha).next(); + buffer.vertex(left, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).next(); + buffer.vertex(right, bottom, zLevel).color(endRed, endGreen, endBlue, endAlpha).next(); tessellator.draw(); - GlStateManager.shadeModel(7424); + GlStateManager.shadeModel(GL11.GL_FLAT); GlStateManager.disableBlend(); GlStateManager.enableAlphaTest(); - GlStateManager.enableTexture2D(); + GlStateManager.enableTexture(); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java index a5ab71ba9..cfee25f4f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java +++ b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java @@ -9,7 +9,7 @@ import fi.dy.masa.malilib.gui.GuiConfigsBase; import fi.dy.masa.malilib.gui.button.ButtonGeneric; import fi.dy.masa.malilib.gui.button.IButtonActionListener; -import net.minecraft.client.resources.I18n; +import net.minecraft.client.resource.language.I18n; public class GuiConfigs extends GuiConfigsBase { @@ -20,13 +20,13 @@ public GuiConfigs() { super(10, 50, Reference.MOD_ID, null); - this.title = I18n.format("itemscroller.gui.title.configs"); + this.title = I18n.translate("itemscroller.gui.title.configs"); } @Override - public void initGui() + public void init() { - super.initGui(); + super.init(); this.clearOptions(); this.id = 0; @@ -47,11 +47,11 @@ private int createButton(int x, int y, int width, ConfigGuiTab tab) if (width < 0) { - width = this.mc.fontRenderer.getStringWidth(label) + 10; + width = this.textRenderer.getStringWidth(label) + 10; } ButtonGeneric button = new ButtonGeneric(this.id++, x, y, width, 20, label); - button.enabled = enabled; + button.active = enabled; this.addButton(button, listener); return width; @@ -119,7 +119,7 @@ public void actionPerformedWithButton(ButtonGeneric control, int mouseButton) this.parent.reCreateListWidget(); // apply the new config width this.parent.getListWidget().resetScrollbarPosition(); - this.parent.initGui(); + this.parent.init(); } } @@ -138,7 +138,7 @@ private ConfigGuiTab(String translationKey) public String getDisplayName() { - return I18n.format(this.translationKey); + return I18n.translate(this.translationKey); } } } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java new file mode 100644 index 000000000..2d91aae10 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java @@ -0,0 +1,33 @@ +package fi.dy.masa.itemscroller.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; +import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.container.Slot; +import net.minecraft.container.SlotActionType; + +@Mixin(ContainerScreen.class) +public interface IMixinContainerScreen +{ + @Invoker("getSlotAt") + Slot getSlotAtPositionInvoker(double x, double y); + + @Invoker("onMouseClick") + void handleMouseClickInvoker(Slot slotIn, int slotId, int mouseButton, SlotActionType type); + + @Accessor("focusedSlot") + Slot getHoveredSlot(); + + @Accessor("left") + int getGuiLeft(); + + @Accessor("top") + int getGuiTop(); + + @Accessor("containerWidth") + int getGuiSizeX(); + + @Accessor("containerHeight") + int getGuiSizeY(); +} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiContainer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiContainer.java deleted file mode 100644 index 0191e0bec..000000000 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiContainer.java +++ /dev/null @@ -1,33 +0,0 @@ -package fi.dy.masa.itemscroller.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; -import org.spongepowered.asm.mixin.gen.Invoker; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.ClickType; -import net.minecraft.inventory.Slot; - -@Mixin(GuiContainer.class) -public interface IMixinGuiContainer -{ - @Invoker("getSelectedSlot") - Slot getSlotAtPositionInvoker(double x, double y); - - @Invoker("handleMouseClick") - void handleMouseClickInvoker(Slot slotIn, int slotId, int mouseButton, ClickType type); - - @Accessor - Slot getHoveredSlot(); - - @Accessor - int getGuiLeft(); - - @Accessor - int getGuiTop(); - - @Accessor("xSize") - int getGuiSizeX(); - - @Accessor("ySize") - int getGuiSizeY(); -} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java index 55fefa0f2..dbb8da612 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java @@ -2,11 +2,11 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -import net.minecraft.inventory.Slot; +import net.minecraft.container.Slot; @Mixin(Slot.class) public interface IMixinSlot { - @Accessor + @Accessor("invSlot") int getSlotIndex(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiMerchant.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinVillagerScreen.java similarity index 52% rename from src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiMerchant.java rename to src/main/java/fi/dy/masa/itemscroller/mixin/IMixinVillagerScreen.java index 6a7d8bc2d..eb85794b4 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinGuiMerchant.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinVillagerScreen.java @@ -2,11 +2,11 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -import net.minecraft.client.gui.GuiMerchant; +import net.minecraft.client.gui.container.VillagerScreen; -@Mixin(GuiMerchant.class) -public interface IMixinGuiMerchant +@Mixin(VillagerScreen.class) +public interface IMixinVillagerScreen { - @Accessor + @Accessor("field_19161") int getSelectedMerchantRecipe(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinContainer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinContainer.java deleted file mode 100644 index a62987ad4..000000000 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinContainer.java +++ /dev/null @@ -1,30 +0,0 @@ -package fi.dy.masa.itemscroller.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import fi.dy.masa.itemscroller.util.InventoryUtils; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.world.World; - -@Mixin(Container.class) -public class MixinContainer -{ - //private static final String SCCG_SIG = "(Lnet/minecraft/world/World;Lnet/minecraft/entity/player/EntityPlayer;Lnet/minecraft/inventory/InventoryCrafting;Lnet/minecraft/inventory/InventoryCraftResult;)V"; - - @Inject(method = "slotChangedCraftingGrid", at = @At("RETURN")) - public void onSlotChangedCraftingGrid( - World world, - EntityPlayer player, - IInventory craftMatrix, - InventoryCraftResult inventoryCraftResult, - CallbackInfo ci - ) - { - InventoryUtils.onSlotChangedCraftingGrid(world, player, craftMatrix, inventoryCraftResult); - } -} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableContainer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableContainer.java new file mode 100644 index 000000000..fbd59555c --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableContainer.java @@ -0,0 +1,36 @@ +package fi.dy.masa.itemscroller.mixin; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import fi.dy.masa.itemscroller.util.InventoryUtils; +import net.minecraft.container.CraftingTableContainer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.CraftingInventory; +import net.minecraft.inventory.CraftingResultInventory; +import net.minecraft.inventory.Inventory; +import net.minecraft.world.World; + +@Mixin(CraftingTableContainer.class) +public abstract class MixinCraftingTableContainer +{ + @Shadow @Final private CraftingInventory craftingInv; + @Shadow @Final private CraftingResultInventory resultInv; + @Shadow @Final private PlayerEntity player; + + @Inject(method = "onContentChanged", at = @At("RETURN")) + private void onSlotChangedCraftingGrid(Inventory inventory, CallbackInfo ci) + { + InventoryUtils.onSlotChangedCraftingGrid(this.player, this.craftingInv, this.resultInv); + } + + @Inject(method = "updateResult", at = @At("RETURN")) + private static void onUpdateResult(int windowId, World world, PlayerEntity player, + CraftingInventory craftingInv, CraftingResultInventory resultInv, CallbackInfo ci) + { + InventoryUtils.onSlotChangedCraftingGrid(player, craftingInv, resultInv); + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java index 676a9e25c..d11d0ee33 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java @@ -6,16 +6,14 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import fi.dy.masa.itemscroller.event.RenderEventHandler; -import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.render.GameRenderer; @Mixin(GameRenderer.class) public abstract class MixinGameRenderer { - @Inject(method = "updateCameraAndRender(FJZ)V", at = { - @At(value = "INVOKE", shift = Shift.AFTER, target = "Lnet/minecraftforge/client/ForgeHooksClient;drawScreen(Lnet/minecraft/client/gui/GuiScreen;IIF)V"), - @At(value = "INVOKE", shift = Shift.AFTER, target = "Lnet/minecraft/client/gui/GuiScreen;render(IIF)V") - }, - require = 1, allow = 1) + @Inject(method = "render(FJZ)V", + at = @At(value = "INVOKE", shift = Shift.AFTER, + target = "Lnet/minecraft/client/gui/Screen;render(IIF)V")) private void onDrawScreenPost(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo ci) { RenderEventHandler.instance().onDrawScreenPost(); diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraft.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraftClient.java similarity index 52% rename from src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraft.java rename to src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraftClient.java index 8a529ed15..b06f6b43e 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraft.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMinecraftClient.java @@ -6,17 +6,16 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import fi.dy.masa.itemscroller.event.KeybindCallbacks; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.multiplayer.WorldClient; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.world.ClientWorld; -@Mixin(Minecraft.class) -public class MixinMinecraft +@Mixin(MinecraftClient.class) +public abstract class MixinMinecraftClient { - @Inject(method = "loadWorld(Lnet/minecraft/client/multiplayer/WorldClient;Lnet/minecraft/client/gui/GuiScreen;)V", at = @At("HEAD")) - private void onLoadWorldPre(@Nullable WorldClient worldClientIn, GuiScreen loadingScreen, CallbackInfo ci) + @Inject(method = "joinWorld(Lnet/minecraft/client/world/ClientWorld;)V", at = @At("HEAD")) + private void onLoadWorldPre(@Nullable ClientWorld worldClientIn, CallbackInfo ci) { - if (worldClientIn != null && worldClientIn != (((Minecraft) (Object) this).world)) + if (worldClientIn != null && worldClientIn != (((MinecraftClient) (Object) this).world)) { KeybindCallbacks.getInstance().onWorldChanged(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGuiScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java similarity index 64% rename from src/main/java/fi/dy/masa/itemscroller/mixin/MixinGuiScreen.java rename to src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java index 7d3c3f9b0..5e2f0f4e9 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGuiScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java @@ -5,13 +5,13 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import fi.dy.masa.itemscroller.event.RenderEventHandler; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.AbstractParentElement; +import net.minecraft.client.gui.Screen; -@Mixin(GuiScreen.class) -public abstract class MixinGuiScreen extends Gui +@Mixin(Screen.class) +public abstract class MixinScreen extends AbstractParentElement { - @Inject(method = "drawDefaultBackground()V", at = @At("RETURN")) + @Inject(method = "renderBackground()V", at = @At("RETURN")) protected void onDrawDefaultBackgroundPost(CallbackInfo ci) { RenderEventHandler.instance().onDrawBackgroundPost(); diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java index 04888fb89..87f7e1790 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java @@ -6,14 +6,15 @@ import java.util.Set; import javax.annotation.Nullable; import fi.dy.masa.itemscroller.ItemScroller; -import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Slot; +import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.client.gui.Screen; +import net.minecraft.container.Container; +import net.minecraft.container.Slot; public class CraftingHandler { private static final Map CRAFTING_GRID_SLOTS = new HashMap(); - private static final Set> CRAFTING_GUIS = new HashSet<>(); + private static final Set>> CRAFTING_GUIS = new HashSet<>(); public static void clearDefinitions() { @@ -26,7 +27,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot { try { - Class guiClass = (Class) Class.forName(guiClassName); + Class> guiClass = (Class>) Class.forName(guiClassName); Class slotClass = (Class) Class.forName(slotClassName); CRAFTING_GRID_SLOTS.put(new CraftingOutputSlot(guiClass, slotClass, outputSlot), range); @@ -43,9 +44,9 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot return false; } - public static boolean isCraftingGui(GuiScreen gui) + public static boolean isCraftingGui(Screen gui) { - return (gui instanceof GuiContainer) && CRAFTING_GUIS.contains(((GuiContainer) gui).getClass()); + return (gui instanceof ContainerScreen) && CRAFTING_GUIS.contains(((ContainerScreen) gui).getClass()); } /** @@ -55,17 +56,17 @@ public static boolean isCraftingGui(GuiScreen gui) * @return the SlotRange of the crafting grid, or null, if the given slot is not a crafting output slot */ @Nullable - public static SlotRange getCraftingGridSlots(GuiContainer gui, Slot slot) + public static SlotRange getCraftingGridSlots(ContainerScreen gui, Slot slot) { return CRAFTING_GRID_SLOTS.get(CraftingOutputSlot.from(gui, slot)); } @Nullable - public static Slot getFirstCraftingOutputSlotForGui(GuiContainer gui) + public static Slot getFirstCraftingOutputSlotForGui(ContainerScreen gui) { if (CRAFTING_GUIS.contains(gui.getClass())) { - for (Slot slot : gui.inventorySlots.inventorySlots) + for (Slot slot : gui.getContainer().slotList) { if (getCraftingGridSlots(gui, slot) != null) { @@ -79,23 +80,24 @@ public static Slot getFirstCraftingOutputSlotForGui(GuiContainer gui) public static class CraftingOutputSlot { - private final Class guiClass; + private final Class> guiClass; private final Class slotClass; private final int outputSlot; - private CraftingOutputSlot (Class guiClass, Class slotClass, int outputSlot) + private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) { this.guiClass = guiClass; this.slotClass = slotClass; this.outputSlot = outputSlot; } - public static CraftingOutputSlot from(GuiContainer gui, Slot slot) + @SuppressWarnings("unchecked") + public static CraftingOutputSlot from(ContainerScreen gui, Slot slot) { - return new CraftingOutputSlot(gui.getClass(), slot.getClass(), slot.slotNumber); + return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); } - public Class getGuiClass() + public Class> getGuiClass() { return this.guiClass; } @@ -110,7 +112,7 @@ public int getSlotNumber() return this.outputSlot; } - public boolean matches(GuiContainer gui, Slot slot, int outputSlot) + public boolean matches(ContainerScreen gui, Slot slot, int outputSlot) { return outputSlot == this.outputSlot && gui.getClass() == this.guiClass && slot.getClass() == this.slotClass; } diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingRecipe.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java similarity index 63% rename from src/main/java/fi/dy/masa/itemscroller/recipes/CraftingRecipe.java rename to src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java index 0740e11bf..0f5ebd28a 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingRecipe.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java @@ -4,18 +4,19 @@ import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; import fi.dy.masa.itemscroller.util.Constants; import fi.dy.masa.itemscroller.util.InventoryUtils; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.Slot; +import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.container.Container; +import net.minecraft.container.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; -public class CraftingRecipe +public class RecipePattern { private ItemStack result = InventoryUtils.EMPTY_STACK; private ItemStack[] recipe = new ItemStack[9]; - public CraftingRecipe() + public RecipePattern() { this.ensureRecipeSizeAndClearRecipe(9); } @@ -44,30 +45,30 @@ public void ensureRecipeSizeAndClearRecipe(int size) this.clearRecipe(); } - public void storeCraftingRecipe(Slot slot, GuiContainer gui, boolean clearIfEmpty) + public void storeCraftingRecipe(Slot slot, ContainerScreen gui, boolean clearIfEmpty) { SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); if (range != null) { - if (slot.getHasStack()) + if (slot.hasStack()) { if (InventoryUtils.areStacksEqual(this.getResult(), slot.getStack()) == false || - this.getRecipeLength() != range.getSlotCount()) - { - int gridSize = range.getSlotCount(); - int numSlots = gui.inventorySlots.inventorySlots.size(); - - this.ensureRecipeSizeAndClearRecipe(gridSize); + this.getRecipeLength() != range.getSlotCount()) + { + int gridSize = range.getSlotCount(); + int numSlots = gui.getContainer().slotList.size(); - for (int i = 0, s = range.getFirst(); i < gridSize && s < numSlots; i++, s++) - { - Slot slotTmp = gui.inventorySlots.getSlot(s); - this.recipe[i] = slotTmp.getHasStack() ? slotTmp.getStack().copy() : InventoryUtils.EMPTY_STACK; - } + this.ensureRecipeSizeAndClearRecipe(gridSize); - this.result = slot.getStack().copy(); + for (int i = 0, s = range.getFirst(); i < gridSize && s < numSlots; i++, s++) + { + Slot slotTmp = gui.getContainer().getSlot(s); + this.recipe[i] = slotTmp.hasStack() ? slotTmp.getStack().copy() : InventoryUtils.EMPTY_STACK; } + + this.result = slot.getStack().copy(); + } } else if (clearIfEmpty) { @@ -76,7 +77,7 @@ else if (clearIfEmpty) } } - public void copyRecipeFrom(CraftingRecipe other) + public void copyRecipeFrom(RecipePattern other) { int size = other.getRecipeLength(); ItemStack[] otherRecipe = other.getRecipeItems(); @@ -91,11 +92,11 @@ public void copyRecipeFrom(CraftingRecipe other) this.result = InventoryUtils.isStackEmpty(other.getResult()) == false ? other.getResult().copy() : InventoryUtils.EMPTY_STACK; } - public void readFromNBT(@Nonnull NBTTagCompound nbt) + public void readFromNBT(@Nonnull CompoundTag nbt) { - if (nbt.contains("Result", Constants.NBT.TAG_COMPOUND) && nbt.contains("Ingredients", Constants.NBT.TAG_LIST)) + if (nbt.containsKey("Result", Constants.NBT.TAG_COMPOUND) && nbt.containsKey("Ingredients", Constants.NBT.TAG_LIST)) { - NBTTagList tagIngredients = nbt.getList("Ingredients", Constants.NBT.TAG_COMPOUND); + ListTag tagIngredients = nbt.getList("Ingredients", Constants.NBT.TAG_COMPOUND); int count = tagIngredients.size(); int length = nbt.getInt("Length"); @@ -106,39 +107,39 @@ public void readFromNBT(@Nonnull NBTTagCompound nbt) for (int i = 0; i < count; i++) { - NBTTagCompound tag = tagIngredients.getCompound(i); + CompoundTag tag = tagIngredients.getCompoundTag(i); int slot = tag.getInt("Slot"); if (slot >= 0 && slot < this.recipe.length) { - this.recipe[slot] = ItemStack.read(tag); + this.recipe[slot] = ItemStack.fromTag(tag); } } - this.result = ItemStack.read(nbt.getCompound("Result")); + this.result = ItemStack.fromTag(nbt.getCompound("Result")); } } @Nonnull - public NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) + public CompoundTag writeToNBT(@Nonnull CompoundTag nbt) { if (this.isValid()) { - NBTTagCompound tag = new NBTTagCompound(); - this.result.write(tag); + CompoundTag tag = new CompoundTag(); + this.result.toTag(tag); nbt.putInt("Length", this.recipe.length); nbt.put("Result", tag); - NBTTagList tagIngredients = new NBTTagList(); + ListTag tagIngredients = new ListTag(); for (int i = 0; i < this.recipe.length; i++) { if (InventoryUtils.isStackEmpty(this.recipe[i]) == false) { - tag = new NBTTagCompound(); + tag = new CompoundTag(); tag.putInt("Slot", i); - this.recipe[i].write(tag); + this.recipe[i].toTag(tag); tagIngredients.add(tag); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java index 757b80e8a..416d7b7f4 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java @@ -7,18 +7,18 @@ import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.util.Constants; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.multiplayer.ServerData; -import net.minecraft.inventory.Slot; -import net.minecraft.nbt.CompressedStreamTools; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.client.options.ServerEntry; +import net.minecraft.container.Slot; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtIo; import net.minecraft.server.integrated.IntegratedServer; public class RecipeStorage { - private final CraftingRecipe[] recipes; + private final RecipePattern[] recipes; private final int recipeCount; private final boolean global; private int selected; @@ -26,7 +26,7 @@ public class RecipeStorage public RecipeStorage(int recipeCount, boolean global) { - this.recipes = new CraftingRecipe[recipeCount]; + this.recipes = new RecipePattern[recipeCount]; this.recipeCount = recipeCount; this.global = global; this.initRecipes(); @@ -36,7 +36,7 @@ private void initRecipes() { for (int i = 0; i < this.recipes.length; i++) { - this.recipes[i] = new CraftingRecipe(); + this.recipes[i] = new RecipePattern(); } } @@ -69,7 +69,7 @@ public int getRecipeCount() * If the index is invalid, then the first recipe is returned, instead of null. */ @Nonnull - public CraftingRecipe getRecipe(int index) + public RecipePattern getRecipe(int index) { if (index >= 0 && index < this.recipes.length) { @@ -80,17 +80,17 @@ public CraftingRecipe getRecipe(int index) } @Nonnull - public CraftingRecipe getSelectedRecipe() + public RecipePattern getSelectedRecipe() { return this.getRecipe(this.getSelection()); } - public void storeCraftingRecipeToCurrentSelection(Slot slot, GuiContainer gui, boolean clearIfEmpty) + public void storeCraftingRecipeToCurrentSelection(Slot slot, ContainerScreen gui, boolean clearIfEmpty) { this.storeCraftingRecipe(this.getSelection(), slot, gui, clearIfEmpty); } - public void storeCraftingRecipe(int index, Slot slot, GuiContainer gui, boolean clearIfEmpty) + public void storeCraftingRecipe(int index, Slot slot, ContainerScreen gui, boolean clearIfEmpty) { this.getRecipe(index).storeCraftingRecipe(slot, gui, clearIfEmpty); this.dirty = true; @@ -102,9 +102,9 @@ public void clearRecipe(int index) this.dirty = true; } - private void readFromNBT(NBTTagCompound nbt) + private void readFromNBT(CompoundTag nbt) { - if (nbt == null || nbt.contains("Recipes", Constants.NBT.TAG_LIST) == false) + if (nbt == null || nbt.containsKey("Recipes", Constants.NBT.TAG_LIST) == false) { return; } @@ -114,12 +114,12 @@ private void readFromNBT(NBTTagCompound nbt) this.recipes[i].clearRecipe(); } - NBTTagList tagList = nbt.getList("Recipes", Constants.NBT.TAG_COMPOUND); + ListTag tagList = nbt.getList("Recipes", Constants.NBT.TAG_COMPOUND); int count = tagList.size(); for (int i = 0; i < count; i++) { - NBTTagCompound tag = tagList.getCompound(i); + CompoundTag tag = tagList.getCompoundTag(i); int index = tag.getByte("RecipeIndex"); @@ -132,15 +132,15 @@ private void readFromNBT(NBTTagCompound nbt) this.changeSelectedRecipe(nbt.getByte("Selected")); } - private NBTTagCompound writeToNBT(@Nonnull NBTTagCompound nbt) + private CompoundTag writeToNBT(@Nonnull CompoundTag nbt) { - NBTTagList tagRecipes = new NBTTagList(); + ListTag tagRecipes = new ListTag(); for (int i = 0; i < this.recipes.length; i++) { if (this.recipes[i].isValid()) { - NBTTagCompound tag = new NBTTagCompound(); + CompoundTag tag = new CompoundTag(); tag.putByte("RecipeIndex", (byte) i); this.recipes[i].writeToNBT(tag); tagRecipes.add(tag); @@ -159,24 +159,24 @@ private String getFileName() if (this.global == false) { - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); - if (mc.isSingleplayer()) + if (mc.isIntegratedServerRunning()) { - IntegratedServer server = mc.getIntegratedServer(); + IntegratedServer server = mc.getServer(); if (server != null) { - name = "recipes_" + server.getFolderName() + ".nbt"; + name = "recipes_" + server.getLevelName() + ".nbt"; } } else { - ServerData server = mc.getCurrentServerData(); + ServerEntry server = mc.getCurrentServerEntry(); if (server != null) { - name = "recipes_" + server.serverIP.replace(':', '_') + ".nbt"; + name = "recipes_" + server.address.replace(':', '_') + ".nbt"; } } } @@ -186,7 +186,7 @@ private String getFileName() private File getSaveDir() { - return new File(Minecraft.getInstance().gameDir, Reference.MOD_ID); + return new File(MinecraftClient.getInstance().runDirectory, Reference.MOD_ID); } public void readFromDisk() @@ -202,7 +202,7 @@ public void readFromDisk() if (file.exists() && file.isFile() && file.canRead()) { FileInputStream is = new FileInputStream(file); - this.readFromNBT(CompressedStreamTools.readCompressed(is)); + this.readFromNBT(NbtIo.readCompressed(is)); is.close(); //ItemScroller.logger.info("Read recipes from file '{}'", file.getPath()); } @@ -239,7 +239,7 @@ public void writeToDisk() File fileTmp = new File(saveDir, this.getFileName() + ".tmp"); File fileReal = new File(saveDir, this.getFileName()); FileOutputStream os = new FileOutputStream(fileTmp); - CompressedStreamTools.writeCompressed(this.writeToNBT(new NBTTagCompound()), os); + NbtIo.writeCompressed(this.writeToNBT(new CompoundTag()), os); os.close(); if (fileReal.exists()) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java index c7c1f64dc..feee63f0e 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java @@ -1,53 +1,53 @@ package fi.dy.masa.itemscroller.util; -import fi.dy.masa.itemscroller.mixin.IMixinGuiContainer; -import fi.dy.masa.itemscroller.mixin.IMixinGuiMerchant; +import fi.dy.masa.itemscroller.mixin.IMixinContainerScreen; +import fi.dy.masa.itemscroller.mixin.IMixinVillagerScreen; import fi.dy.masa.itemscroller.mixin.IMixinSlot; -import net.minecraft.client.gui.GuiMerchant; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.inventory.ClickType; -import net.minecraft.inventory.Slot; +import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.client.gui.container.VillagerScreen; +import net.minecraft.container.Slot; +import net.minecraft.container.SlotActionType; public class AccessorUtils { - public static Slot getSlotUnderMouse(GuiContainer gui) + public static Slot getSlotUnderMouse(ContainerScreen gui) { - return ((IMixinGuiContainer) gui).getHoveredSlot(); + return ((IMixinContainerScreen) gui).getHoveredSlot(); } - public static Slot getSlotAtPosition(GuiContainer gui, int x, int y) + public static Slot getSlotAtPosition(ContainerScreen gui, int x, int y) { - return ((IMixinGuiContainer) gui).getSlotAtPositionInvoker(x, y); + return ((IMixinContainerScreen) gui).getSlotAtPositionInvoker(x, y); } - public static void handleMouseClick(GuiContainer gui, Slot slotIn, int slotId, int mouseButton, ClickType type) + public static void handleMouseClick(ContainerScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) { - ((IMixinGuiContainer) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); + ((IMixinContainerScreen) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); } - public static int getGuiLeft(GuiContainer gui) + public static int getGuiLeft(ContainerScreen gui) { - return ((IMixinGuiContainer) gui).getGuiLeft(); + return ((IMixinContainerScreen) gui).getGuiLeft(); } - public static int getGuiTop(GuiContainer gui) + public static int getGuiTop(ContainerScreen gui) { - return ((IMixinGuiContainer) gui).getGuiTop(); + return ((IMixinContainerScreen) gui).getGuiTop(); } - public static int getGuiXSize(GuiContainer gui) + public static int getGuiXSize(ContainerScreen gui) { - return ((IMixinGuiContainer) gui).getGuiSizeX(); + return ((IMixinContainerScreen) gui).getGuiSizeX(); } - public static int getGuiYSize(GuiContainer gui) + public static int getGuiYSize(ContainerScreen gui) { - return ((IMixinGuiContainer) gui).getGuiSizeY(); + return ((IMixinContainerScreen) gui).getGuiSizeY(); } - public static int getSelectedMerchantRecipe(GuiMerchant gui) + public static int getSelectedMerchantRecipe(VillagerScreen gui) { - return ((IMixinGuiMerchant) gui).getSelectedMerchantRecipe(); + return ((IMixinVillagerScreen) gui).getSelectedMerchantRecipe(); } public static int getSlotIndex(Slot slot) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index a5f79394c..91636f38d 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -4,14 +4,14 @@ import fi.dy.masa.itemscroller.event.KeybindCallbacks; import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.malilib.hotkeys.IKeybind; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.inventory.GuiContainer; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.ContainerScreen; public class InputUtils { public static boolean isRecipeViewOpen() { - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); return mc.currentScreen != null && Hotkeys.KEY_RECIPE_VIEW.getKeybind().isKeybindHeld() && @@ -19,9 +19,9 @@ public static boolean isRecipeViewOpen() CraftingHandler.isCraftingGui(mc.currentScreen); } - public static boolean canShiftDropItems(GuiContainer gui, Minecraft mc, int mouseX, int mouseY) + public static boolean canShiftDropItems(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY) { - if (InventoryUtils.isStackEmpty(mc.player.inventory.getItemStack()) == false) + if (InventoryUtils.isStackEmpty(mc.player.inventory.getCursorStack()) == false) { int left = AccessorUtils.getGuiLeft(gui); int top = AccessorUtils.getGuiTop(gui); diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index a0206e918..726a457a5 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -7,36 +7,39 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; -import fi.dy.masa.itemscroller.recipes.CraftingRecipe; +import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; -import net.minecraft.client.Minecraft; -import net.minecraft.client.entity.EntityPlayerSP; -import net.minecraft.client.gui.GuiMerchant; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.gui.inventory.GuiContainerCreative; -import net.minecraft.client.gui.inventory.GuiInventory; -import net.minecraft.client.multiplayer.WorldClient; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.inventory.ClickType; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.IInventory; -import net.minecraft.inventory.InventoryCraftResult; -import net.minecraft.inventory.Slot; -import net.minecraft.inventory.SlotMerchantResult; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.client.gui.container.VillagerScreen; +import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen; +import net.minecraft.client.gui.ingame.PlayerInventoryScreen; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.container.Container; +import net.minecraft.container.Slot; +import net.minecraft.container.SlotActionType; +import net.minecraft.container.TradeOutputSlot; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.CraftingInventory; +import net.minecraft.inventory.CraftingResultInventory; +import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.util.ResourceLocation; -import net.minecraft.util.registry.IRegistry; -import net.minecraft.village.MerchantRecipe; -import net.minecraft.village.MerchantRecipeList; +import net.minecraft.recipe.RecipeType; +import net.minecraft.recipe.crafting.CraftingRecipe; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; +import net.minecraft.village.TradeOffer; +import net.minecraft.village.TraderOfferList; import net.minecraft.world.World; public class InventoryUtils @@ -50,25 +53,32 @@ public class InventoryUtils private static WeakReference sourceSlot = null; private static ItemStack stackInCursorLast = ItemStack.EMPTY; - public static void onSlotChangedCraftingGrid(World world, EntityPlayer player, IInventory craftMatrix, InventoryCraftResult inventoryCraftResult) + public static void onSlotChangedCraftingGrid(PlayerEntity player, + CraftingInventory craftMatrix, CraftingResultInventory inventoryCraftResult) { + World world = player.getEntityWorld(); + if (Configs.Generic.CLIENT_CRAFTING_FIX.getBooleanValue() && - world.isRemote && (world instanceof WorldClient) && player instanceof EntityPlayerSP) + world.isClient && (world instanceof ClientWorld) && player instanceof ClientPlayerEntity) { ItemStack stack = ItemStack.EMPTY; - IRecipe recipe = ((WorldClient) world).getRecipeManager().getRecipe(craftMatrix, world); + Optional optional = ((ClientWorld) world).getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftMatrix, world); - if (recipe != null && - (recipe.isDynamic() || - world.getGameRules().getBoolean("doLimitedCrafting") == false || - ((EntityPlayerSP) player).getRecipeBook().isUnlocked(recipe)) - ) + if (optional.isPresent()) { - inventoryCraftResult.setRecipeUsed(recipe); - stack = recipe.getCraftingResult(craftMatrix); - } + CraftingRecipe recipe = optional.get(); - inventoryCraftResult.setInventorySlotContents(0, stack); + if ((recipe.isIgnoredInRecipeBook() || + world.getGameRules().getBoolean("doLimitedCrafting") == false || + ((ClientPlayerEntity) player).getRecipeBook().contains(recipe)) + ) + { + inventoryCraftResult.setLastRecipe(recipe); + stack = recipe.craft(craftMatrix); + } + + inventoryCraftResult.setInvStack(0, stack); + } } } @@ -76,7 +86,7 @@ public static String getStackString(ItemStack stack) { if (isStackEmpty(stack) == false) { - ResourceLocation rl = IRegistry.ITEM.getKey(stack.getItem()); + Identifier rl = Registry.ITEM.getId(stack.getItem()); return String.format("[%s - display: %s - NBT: %s] (%s)", rl != null ? rl.toString() : "null", stack.getDisplayName().getString(), @@ -87,7 +97,7 @@ public static String getStackString(ItemStack stack) return ""; } - public static void debugPrintSlotInfo(GuiContainer gui, Slot slot) + public static void debugPrintSlotInfo(ContainerScreen gui, Slot slot) { if (slot == null) { @@ -95,26 +105,28 @@ public static void debugPrintSlotInfo(GuiContainer gui, Slot slot) return; } - boolean hasSlot = gui.inventorySlots.inventorySlots.contains(slot); + boolean hasSlot = gui.getContainer().slotList.contains(slot); Object inv = slot.inventory; String stackStr = InventoryUtils.getStackString(slot.getStack()); ItemScroller.logger.info(String.format("slot: slotNumber: %d, getSlotIndex(): %d, getHasStack(): %s, " + "slot class: %s, inv class: %s, Container's slot list has slot: %s, stack: %s, numSlots: %d", - slot.slotNumber, AccessorUtils.getSlotIndex(slot), slot.getHasStack(), slot.getClass().getName(), + slot.id, AccessorUtils.getSlotIndex(slot), slot.hasStack(), slot.getClass().getName(), inv != null ? inv.getClass().getName() : "", hasSlot ? " true" : "false", stackStr, - gui.inventorySlots.inventorySlots.size())); + gui.getContainer().slotList.size())); } - private static boolean isValidSlot(Slot slot, GuiContainer gui, boolean requireItems) + private static boolean isValidSlot(Slot slot, ContainerScreen gui, boolean requireItems) { - return gui.inventorySlots != null && gui.inventorySlots.inventorySlots != null && - slot != null && gui.inventorySlots.inventorySlots.contains(slot) && - (requireItems == false || slot.getHasStack()) && + Container container = gui.getContainer(); + + return container != null && container.slotList != null && + slot != null && container.slotList.contains(slot) && + (requireItems == false || slot.hasStack()) && Configs.SLOT_BLACKLIST.contains(slot.getClass().getName()) == false; } - public static boolean isCraftingSlot(GuiContainer gui, Slot slot) + public static boolean isCraftingSlot(ContainerScreen gui, Slot slot) { return slot != null && CraftingHandler.getCraftingGridSlots(gui, slot) != null; } @@ -124,9 +136,9 @@ public static boolean isCraftingSlot(GuiContainer gui, Slot slot) */ private static boolean inventoryExistsAbove(Slot slot, Container container) { - for (Slot slotTmp : container.inventorySlots) + for (Slot slotTmp : container.slotList) { - if (slotTmp.yPos < slot.yPos && areSlotsInSameInventory(slot, slotTmp) == false) + if (slotTmp.yPosition < slot.yPosition && areSlotsInSameInventory(slot, slotTmp) == false) { return true; } @@ -135,30 +147,30 @@ private static boolean inventoryExistsAbove(Slot slot, Container container) return false; } - public static boolean canShiftPlaceItems(GuiContainer gui) + public static boolean canShiftPlaceItems(ContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); - Minecraft mc = Minecraft.getInstance(); - ItemStack stackCursor = mc.player.inventory.getItemStack(); + MinecraftClient mc = MinecraftClient.getInstance(); + ItemStack stackCursor = mc.player.inventory.getCursorStack(); // The target slot needs to be an empty, valid slot, and there needs to be items in the cursor return slot != null && isStackEmpty(stackCursor) == false && isValidSlot(slot, gui, false) && - slot.getHasStack() == false && slot.isItemValid(stackCursor); + slot.hasStack() == false && slot.canInsert(stackCursor); } - public static boolean tryMoveItems(GuiContainer gui, RecipeStorage recipes, boolean scrollingUp) + public static boolean tryMoveItems(ContainerScreen gui, RecipeStorage recipes, boolean scrollingUp) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); // We require an empty cursor - if (slot == null || isStackEmpty(mc.player.inventory.getItemStack()) == false) + if (slot == null || isStackEmpty(mc.player.inventory.getCursorStack()) == false) { return false; } // Villager handling only happens when scrolling over the trade output slot - boolean villagerHandling = Configs.Toggles.SCROLL_VILLAGER.getBooleanValue() && gui instanceof GuiMerchant && slot instanceof SlotMerchantResult; + boolean villagerHandling = Configs.Toggles.SCROLL_VILLAGER.getBooleanValue() && gui instanceof VillagerScreen && slot instanceof TradeOutputSlot; boolean craftingHandling = Configs.Toggles.CRAFTING_FEATURES.getBooleanValue() && isCraftingSlot(gui, slot); boolean keyActiveMoveEverything = Hotkeys.MODIFIER_MOVE_EVERYTHING.getKeybind().isKeybindHeld(); boolean keyActiveMoveMatching = Hotkeys.MODIFIER_MOVE_MATCHING.getKeybind().isKeybindHeld(); @@ -168,7 +180,7 @@ public static boolean tryMoveItems(GuiContainer gui, RecipeStorage recipes, bool if (Configs.Generic.SLOT_POSITION_AWARE_SCROLL_DIRECTION.getBooleanValue()) { - boolean above = inventoryExistsAbove(slot, gui.inventorySlots); + boolean above = inventoryExistsAbove(slot, gui.getContainer()); // so basically: (above && scrollingUp) || (above == false && scrollingUp == false) moveToOtherInventory = (above == scrollingUp); } @@ -192,7 +204,7 @@ public static boolean tryMoveItems(GuiContainer gui, RecipeStorage recipes, bool if (villagerHandling) { - return tryMoveItemsVillager((GuiMerchant) gui, slot, moveToOtherInventory, keyActiveMoveStacks); + return tryMoveItemsVillager((VillagerScreen) gui, slot, moveToOtherInventory, keyActiveMoveStacks); } if ((Configs.Toggles.SCROLL_SINGLE.getBooleanValue() == false && nonSingleMove == false) || @@ -229,7 +241,7 @@ else if (keyActiveMoveStacks) tryMoveSingleItemToOtherInventory(slot, gui); } // Scrolling items from the other inventory into this slot/inventory - else if (getStackSize(stack) < slot.getItemStackLimit(stack)) + else if (getStackSize(stack) < slot.getMaxStackAmount(stack)) { tryMoveSingleItemToThisInventory(slot, gui); } @@ -238,9 +250,9 @@ else if (getStackSize(stack) < slot.getItemStackLimit(stack)) return false; } - public static boolean dragMoveItems(GuiContainer gui, Minecraft mc, MoveAction action, int mouseX, int mouseY, boolean isClick) + public static boolean dragMoveItems(ContainerScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { - if (isStackEmpty(mc.player.inventory.getItemStack()) == false) + if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) { // Updating these here is part of the fix to preventing a drag after shift + place lastPosX = mouseX; @@ -316,15 +328,15 @@ public static boolean dragMoveItems(GuiContainer gui, Minecraft mc, MoveAction a if (slot != null) { - if (gui instanceof GuiContainerCreative) + if (gui instanceof CreativePlayerInventoryScreen) { - boolean isPlayerInv = ((GuiContainerCreative) gui).getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex(); - int slotNumber = isPlayerInv ? AccessorUtils.getSlotIndex(slot) : slot.slotNumber; + boolean isPlayerInv = ((CreativePlayerInventoryScreen) gui).method_2469() == ItemGroup.INVENTORY.getIndex(); + int slotNumber = isPlayerInv ? AccessorUtils.getSlotIndex(slot) : slot.id; slotNumberLast = slotNumber; } else { - slotNumberLast = slot.slotNumber; + slotNumberLast = slot.id; } } else @@ -341,21 +353,21 @@ public static void stopDragging() DRAGGED_SLOTS.clear(); } - private static boolean dragMoveFromSlotAtPosition(GuiContainer gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPosition(ContainerScreen gui, int x, int y, MoveAction action) { - if (gui instanceof GuiContainerCreative) + if (gui instanceof CreativePlayerInventoryScreen) { return dragMoveFromSlotAtPositionCreative(gui, x, y, action); } Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); MoveAmount amount = InputUtils.getMoveAmount(action); - boolean flag = slot != null && isValidSlot(slot, gui, true) && slot.canTakeStack(mc.player); + boolean flag = slot != null && isValidSlot(slot, gui, true) && slot.canTakeItems(mc.player); //boolean cancel = flag && (amount == MoveAmount.LEAVE_ONE || amount == MoveAmount.MOVE_ONE); - if (flag && slot.slotNumber != slotNumberLast && - (amount != MoveAmount.MOVE_ONE || DRAGGED_SLOTS.contains(slot.slotNumber) == false)) + if (flag && slot.id != slotNumberLast && + (amount != MoveAmount.MOVE_ONE || DRAGGED_SLOTS.contains(slot.id) == false)) { switch (action) { @@ -368,7 +380,7 @@ private static boolean dragMoveFromSlotAtPosition(GuiContainer gui, int x, int y break; case MOVE_TO_OTHER_STACKS: - shiftClickSlot(gui, slot.slotNumber); + shiftClickSlot(gui, slot.id); break; case MOVE_TO_OTHER_MATCHING: @@ -376,17 +388,17 @@ private static boolean dragMoveFromSlotAtPosition(GuiContainer gui, int x, int y break; case DROP_ONE: - clickSlot(gui, slot.slotNumber, 0, ClickType.THROW); + clickSlot(gui, slot.id, 0, SlotActionType.THROW); break; case DROP_LEAVE_ONE: - leftClickSlot(gui, slot.slotNumber); - rightClickSlot(gui, slot.slotNumber); + leftClickSlot(gui, slot.id); + rightClickSlot(gui, slot.id); dropItemsFromCursor(gui); break; case DROP_STACKS: - clickSlot(gui, slot.slotNumber, 1, ClickType.THROW); + clickSlot(gui, slot.id, 1, SlotActionType.THROW); break; case MOVE_DOWN_MOVE_ONE: @@ -406,17 +418,17 @@ private static boolean dragMoveFromSlotAtPosition(GuiContainer gui, int x, int y default: } - DRAGGED_SLOTS.add(slot.slotNumber); + DRAGGED_SLOTS.add(slot.id); } return true; } - private static boolean dragMoveFromSlotAtPositionCreative(GuiContainer gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPositionCreative(ContainerScreen gui, int x, int y, MoveAction action) { - GuiContainerCreative guiCreative = (GuiContainerCreative) gui; + CreativePlayerInventoryScreen guiCreative = (CreativePlayerInventoryScreen) gui; Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); - boolean isPlayerInv = guiCreative.getSelectedTabIndex() == ItemGroup.INVENTORY.getIndex(); + boolean isPlayerInv = guiCreative.method_2469() == ItemGroup.INVENTORY.getIndex(); // Only allow dragging from the hotbar slots if (slot == null || (slot.getClass() != Slot.class && isPlayerInv == false)) @@ -424,14 +436,14 @@ private static boolean dragMoveFromSlotAtPositionCreative(GuiContainer gui, int return false; } - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); MoveAmount amount = InputUtils.getMoveAmount(action); - boolean flag = slot != null && isValidSlot(slot, gui, true) && slot.canTakeStack(mc.player); + boolean flag = slot != null && isValidSlot(slot, gui, true) && slot.canTakeItems(mc.player); boolean cancel = flag && (amount == MoveAmount.LEAVE_ONE || amount == MoveAmount.MOVE_ONE); // The player inventory tab of the creative inventory uses stupid wrapped // slots that all have slotNumber = 0 on the outer instance ;_; // However in that case we can use the slotIndex which is easy enough to get. - int slotNumber = isPlayerInv ? AccessorUtils.getSlotIndex(slot) : slot.slotNumber; + int slotNumber = isPlayerInv ? AccessorUtils.getSlotIndex(slot) : slot.id; if (flag && slotNumber != slotNumberLast && DRAGGED_SLOTS.contains(slotNumber) == false) { @@ -455,8 +467,8 @@ private static boolean dragMoveFromSlotAtPositionCreative(GuiContainer gui, int rightClickSlot(guiCreative, slot, slotNumber); // Delete the rest of the stack by placing it in the first creative "source slot" - Slot slotFirst = gui.inventorySlots.inventorySlots.get(0); - leftClickSlot(guiCreative, slotFirst, slotFirst.slotNumber); + Slot slotFirst = gui.getContainer().slotList.get(0); + leftClickSlot(guiCreative, slotFirst, slotFirst.id); } cancel = true; @@ -469,17 +481,17 @@ private static boolean dragMoveFromSlotAtPositionCreative(GuiContainer gui, int break; case DROP_ONE: - clickSlot(gui, slot.slotNumber, 0, ClickType.THROW); + clickSlot(gui, slot.id, 0, SlotActionType.THROW); break; case DROP_LEAVE_ONE: - leftClickSlot(gui, slot.slotNumber); - rightClickSlot(gui, slot.slotNumber); + leftClickSlot(gui, slot.id); + rightClickSlot(gui, slot.id); dropItemsFromCursor(gui); break; case DROP_STACKS: - clickSlot(gui, slot.slotNumber, 1, ClickType.THROW); + clickSlot(gui, slot.id, 1, SlotActionType.THROW); cancel = true; break; @@ -506,29 +518,29 @@ private static boolean dragMoveFromSlotAtPositionCreative(GuiContainer gui, int return cancel; } - public static void dropStacks(GuiContainer gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) + public static void dropStacks(ContainerScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) { if (slotReference != null && isStackEmpty(stackReference) == false) { - Container container = gui.inventorySlots; + Container container = gui.getContainer(); stackReference = stackReference.copy(); - for (Slot slot : container.inventorySlots) + for (Slot slot : container.slotList) { // If this slot is in the same inventory that the items were picked up to the cursor from // and the stack is identical to the one in the cursor, then this stack will get dropped. if (areSlotsInSameInventory(slot, slotReference) == sameInventory && areStacksEqual(slot.getStack(), stackReference)) { // Drop the stack - dropStack(gui, slot.slotNumber); + dropStack(gui, slot.id); } } } } - public static boolean shiftDropItems(GuiContainer gui) + public static boolean shiftDropItems(ContainerScreen gui) { - ItemStack stackReference = Minecraft.getInstance().player.inventory.getItemStack(); + ItemStack stackReference = MinecraftClient.getInstance().player.inventory.getCursorStack(); if (isStackEmpty(stackReference) == false && sourceSlot != null) { @@ -544,13 +556,13 @@ public static boolean shiftDropItems(GuiContainer gui) return false; } - public static boolean shiftPlaceItems(Slot slot, GuiContainer gui) + public static boolean shiftPlaceItems(Slot slot, ContainerScreen gui) { // Left click to place the items from the cursor to the slot - leftClickSlot(gui, slot.slotNumber); + leftClickSlot(gui, slot.id); // Ugly fix to prevent accidentally drag-moving the stack from the slot that it was just placed into... - DRAGGED_SLOTS.add(slot.slotNumber); + DRAGGED_SLOTS.add(slot.id); tryMoveStacks(slot, gui, true, false, false); @@ -562,12 +574,12 @@ public static boolean shiftPlaceItems(Slot slot, GuiContainer gui) * The slot is then later used to determine which inventory an ItemStack was * picked up from, if the stack from the cursor is dropped while holding shift. */ - public static void storeSourceSlotCandidate(Slot slot, Minecraft mc) + public static void storeSourceSlotCandidate(Slot slot, MinecraftClient mc) { // Left or right mouse button was pressed if (slot != null) { - ItemStack stackCursor = mc.player.inventory.getItemStack(); + ItemStack stackCursor = mc.player.inventory.getCursorStack(); ItemStack stack = EMPTY_STACK; if (isStackEmpty(stackCursor) == false) @@ -587,19 +599,19 @@ public static void storeSourceSlotCandidate(Slot slot, Minecraft mc) /** * Check if the (previous) mouse event resulted in picking up a new ItemStack to the cursor */ - public static void checkForItemPickup(GuiContainer gui, Minecraft mc) + public static void checkForItemPickup(MinecraftClient mc) { - ItemStack stackCursor = mc.player.inventory.getItemStack(); + ItemStack stackCursor = mc.player.inventory.getCursorStack(); // Picked up or swapped items to the cursor, grab a reference to the slot that the items came from - // Note that we are only checking the item and metadata here! - if (isStackEmpty(stackCursor) == false && stackCursor.isItemEqual(stackInCursorLast) == false && sourceSlotCandidate != null) + // Note that we are only checking the item here! + if (isStackEmpty(stackCursor) == false && stackCursor.isEqualIgnoreTags(stackInCursorLast) == false && sourceSlotCandidate != null) { sourceSlot = new WeakReference<>(sourceSlotCandidate.get()); } } - private static boolean tryMoveItemsVillager(GuiMerchant gui, Slot slot, boolean moveToOtherInventory, boolean fullStacks) + private static boolean tryMoveItemsVillager(VillagerScreen gui, Slot slot, boolean moveToOtherInventory, boolean fullStacks) { if (fullStacks) { @@ -609,7 +621,7 @@ private static boolean tryMoveItemsVillager(GuiMerchant gui, Slot slot, boolean tryMoveItemsToMerchantBuySlots(gui, true); } // Move items from sell slot to player inventory - else if (slot.getHasStack()) + else if (slot.hasStack()) { tryMoveStacks(slot, gui, true, true, true); } @@ -627,7 +639,7 @@ else if (slot.getHasStack()) tryMoveItemsToMerchantBuySlots(gui, false); } // Scrolling items from this slot/inventory into the other inventory - else if (slot.getHasStack()) + else if (slot.hasStack()) { moveOneSetOfItemsFromSlotToPlayerInventory(gui, slot); } @@ -636,22 +648,22 @@ else if (slot.getHasStack()) return false; } - private static boolean tryMoveSingleItemToOtherInventory(Slot slot, GuiContainer gui) + private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ContainerScreen gui) { ItemStack stackOrig = slot.getStack(); - Container container = gui.inventorySlots; - Minecraft mc = Minecraft.getInstance(); + Container container = gui.getContainer(); + MinecraftClient mc = MinecraftClient.getInstance(); - if (isStackEmpty(mc.player.inventory.getItemStack()) == false || slot.canTakeStack(mc.player) == false || - (getStackSize(stackOrig) > 1 && slot.isItemValid(stackOrig) == false)) + if (isStackEmpty(mc.player.inventory.getCursorStack()) == false || slot.canTakeItems(mc.player) == false || + (getStackSize(stackOrig) > 1 && slot.canInsert(stackOrig) == false)) { return false; } // Can take all the items to the cursor at once, use a shift-click method to move one item from the slot - if (getStackSize(stackOrig) <= stackOrig.getMaxStackSize()) + if (getStackSize(stackOrig) <= stackOrig.getMaxAmount()) { - return clickSlotsToMoveSingleItemByShiftClick(gui, slot.slotNumber); + return clickSlotsToMoveSingleItemByShiftClick(gui, slot.id); } ItemStack stack = stackOrig.copy(); @@ -660,11 +672,11 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, GuiContainer ItemStack[] originalStacks = getOriginalStacks(container); // Try to move the temporary single-item stack via the shift-click handler method - slot.putStack(stack); - container.transferStackInSlot(mc.player, slot.slotNumber); + slot.setStack(stack); + container.transferSlot(mc.player, slot.id); // Successfully moved the item somewhere, now we want to check where it went - if (slot.getHasStack() == false) + if (slot.hasStack() == false) { int targetSlot = getTargetSlot(container, originalStacks); @@ -672,38 +684,38 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, GuiContainer if (targetSlot >= 0) { // Remove the dummy item from the target slot (on the client side) - container.inventorySlots.get(targetSlot).decrStackSize(1); + container.slotList.get(targetSlot).takeStack(1); // Restore the original stack to the slot under the cursor (on the client side) restoreOriginalStacks(container, originalStacks); // Do the slot clicks to actually move the items (on the server side) - return clickSlotsToMoveSingleItem(gui, slot.slotNumber, targetSlot); + return clickSlotsToMoveSingleItem(gui, slot.id, targetSlot); } } // Restore the original stack to the slot under the cursor (on the client side) - slot.putStack(stackOrig); + slot.setStack(stackOrig); return false; } - private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, GuiContainer gui) + private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, ContainerScreen gui) { - Minecraft mc = Minecraft.getInstance(); - EntityPlayer player = mc.player; + MinecraftClient mc = MinecraftClient.getInstance(); + PlayerEntity player = mc.player; ItemStack stackOrig = slot.getStack().copy(); - if (getStackSize(stackOrig) == 1 || getStackSize(stackOrig) > stackOrig.getMaxStackSize() || - slot.canTakeStack(player) == false || slot.isItemValid(stackOrig) == false) + if (getStackSize(stackOrig) == 1 || getStackSize(stackOrig) > stackOrig.getMaxAmount() || + slot.canTakeItems(player) == false || slot.canInsert(stackOrig) == false) { return true; } // Take half of the items from the original slot to the cursor - rightClickSlot(gui, slot.slotNumber); + rightClickSlot(gui, slot.id); - ItemStack stackInCursor = player.inventory.getItemStack(); + ItemStack stackInCursor = player.inventory.getCursorStack(); if (isStackEmpty(stackInCursor)) { return false; @@ -713,52 +725,52 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, GuiContai int tempSlotNum = -1; // Find some other slot where to store one of the items temporarily - for (Slot slotTmp : gui.inventorySlots.inventorySlots) + for (Slot slotTmp : gui.getContainer().slotList) { - if (slotTmp.slotNumber != slot.slotNumber && + if (slotTmp.id != slot.id && areSlotsInSameInventory(slotTmp, slot, true) && - slotTmp.isItemValid(stackInCursor) && - slotTmp.canTakeStack(player)) + slotTmp.canInsert(stackInCursor) && + slotTmp.canTakeItems(player)) { ItemStack stackInSlot = slotTmp.getStack(); if (isStackEmpty(stackInSlot) || areStacksEqual(stackInSlot, stackInCursor)) { // Try to put one item into the temporary slot - rightClickSlot(gui, slotTmp.slotNumber); + rightClickSlot(gui, slotTmp.id); - stackInCursor = player.inventory.getItemStack(); + stackInCursor = player.inventory.getCursorStack(); // Successfully stored one item if (isStackEmpty(stackInCursor) || getStackSize(stackInCursor) < stackInCursorSizeOrig) { - tempSlotNum = slotTmp.slotNumber; + tempSlotNum = slotTmp.id; break; } } } } - if (isStackEmpty(player.inventory.getItemStack()) == false) + if (isStackEmpty(player.inventory.getCursorStack()) == false) { // Return the rest of the items into the original slot - leftClickSlot(gui, slot.slotNumber); + leftClickSlot(gui, slot.id); } // Successfully stored one item in a temporary slot if (tempSlotNum != -1) { // Shift click the stack from the original slot - shiftClickSlot(gui, slot.slotNumber); + shiftClickSlot(gui, slot.id); // Take half a stack from the temporary slot rightClickSlot(gui, tempSlotNum); // Return one item into the original slot - rightClickSlot(gui, slot.slotNumber); + rightClickSlot(gui, slot.id); // Return the rest of the items to the temporary slot, if any - if (isStackEmpty(player.inventory.getItemStack()) == false) + if (isStackEmpty(player.inventory.getCursorStack()) == false) { leftClickSlot(gui, tempSlotNum); } @@ -768,34 +780,34 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, GuiContai // No temporary slot found, try to move the stack manually else { - boolean treatHotbarAsDifferent = gui.getClass() == GuiInventory.class; - List slots = getSlotNumbersOfEmptySlots(gui.inventorySlots, slot, false, treatHotbarAsDifferent, false); + boolean treatHotbarAsDifferent = gui.getClass() == PlayerInventoryScreen.class; + List slots = getSlotNumbersOfEmptySlots(gui.getContainer(), slot, false, treatHotbarAsDifferent, false); if (slots.isEmpty()) { - slots = getSlotNumbersOfMatchingStacks(gui.inventorySlots, slot, false, slot.getStack(), true, treatHotbarAsDifferent, false); + slots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, false, slot.getStack(), true, treatHotbarAsDifferent, false); } if (slots.isEmpty() == false) { // Take the stack - leftClickSlot(gui, slot.slotNumber); + leftClickSlot(gui, slot.id); // Return one item - rightClickSlot(gui, slot.slotNumber); + rightClickSlot(gui, slot.id); // Try to place the stack in the cursor to any valid empty or matching slots in a different inventory for (int slotNum : slots) { - Slot slotTmp = gui.inventorySlots.getSlot(slotNum); - stackInCursor = player.inventory.getItemStack(); + Slot slotTmp = gui.getContainer().getSlot(slotNum); + stackInCursor = player.inventory.getCursorStack(); if (isStackEmpty(stackInCursor)) { return true; } - if (slotTmp.isItemValid(stackInCursor)) + if (slotTmp.canInsert(stackInCursor)) { leftClickSlot(gui, slotNum); } @@ -804,7 +816,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, GuiContai // Items left, return them if (isStackEmpty(stackInCursor) == false) { - leftClickSlot(gui, slot.slotNumber); + leftClickSlot(gui, slot.id); } } } @@ -812,29 +824,29 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, GuiContai return false; } - private static boolean tryMoveSingleItemToThisInventory(Slot slot, GuiContainer gui) + private static boolean tryMoveSingleItemToThisInventory(Slot slot, ContainerScreen gui) { - Container container = gui.inventorySlots; + Container container = gui.getContainer(); ItemStack stackOrig = slot.getStack(); - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); - if (slot.isItemValid(stackOrig) == false) + if (slot.canInsert(stackOrig) == false) { return false; } - for (int slotNum = container.inventorySlots.size() - 1; slotNum >= 0; slotNum--) + for (int slotNum = container.slotList.size() - 1; slotNum >= 0; slotNum--) { - Slot slotTmp = container.inventorySlots.get(slotNum); + Slot slotTmp = container.slotList.get(slotNum); ItemStack stackTmp = slotTmp.getStack(); if (areSlotsInSameInventory(slotTmp, slot) == false && - isStackEmpty(stackTmp) == false && slotTmp.canTakeStack(mc.player) && - (getStackSize(stackTmp) == 1 || slotTmp.isItemValid(stackTmp))) + isStackEmpty(stackTmp) == false && slotTmp.canTakeItems(mc.player) && + (getStackSize(stackTmp) == 1 || slotTmp.canInsert(stackTmp))) { if (areStacksEqual(stackTmp, stackOrig)) { - return clickSlotsToMoveSingleItem(gui, slotTmp.slotNumber, slot.slotNumber); + return clickSlotsToMoveSingleItem(gui, slotTmp.id, slot.id); } } } @@ -842,17 +854,17 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, GuiContainer // If we weren't able to move any items from another inventory, then try to move items // within the same inventory (mostly between the hotbar and the player inventory) /* - for (Slot slotTmp : container.inventorySlots) + for (Slot slotTmp : container.slotList) { ItemStack stackTmp = slotTmp.getStack(); - if (slotTmp.slotNumber != slot.slotNumber && - isStackEmpty(stackTmp) == false && slotTmp.canTakeStack(gui.mc.player) && - (getStackSize(stackTmp) == 1 || slotTmp.isItemValid(stackTmp))) + if (slotTmp.id != slot.id && + isStackEmpty(stackTmp) == false && slotTmp.canTakeItems(gui.mc.player) && + (getStackSize(stackTmp) == 1 || slotTmp.canInsert(stackTmp))) { if (areStacksEqual(stackTmp, stackOrig)) { - return this.clickSlotsToMoveSingleItem(gui, slotTmp.slotNumber, slot.slotNumber); + return this.clickSlotsToMoveSingleItem(gui, slotTmp.id, slot.id); } } } @@ -861,25 +873,25 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, GuiContainer return false; } - public static void tryMoveStacks(Slot slot, GuiContainer gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + public static void tryMoveStacks(Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { tryMoveStacks(slot.getStack(), slot, gui, matchingOnly, toOtherInventory, firstOnly); } - private static void tryMoveStacks(ItemStack stackReference, Slot slot, GuiContainer gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + private static void tryMoveStacks(ItemStack stackReference, Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { - Container container = gui.inventorySlots; - final int maxSlot = container.inventorySlots.size() - 1; + Container container = gui.getContainer(); + final int maxSlot = container.slotList.size() - 1; for (int i = maxSlot; i >= 0; i--) { - Slot slotTmp = container.inventorySlots.get(i); + Slot slotTmp = container.slotList.get(i); - if (slotTmp.slotNumber != slot.slotNumber && - areSlotsInSameInventory(slotTmp, slot) == toOtherInventory && slotTmp.getHasStack() && + if (slotTmp.id != slot.id && + areSlotsInSameInventory(slotTmp, slot) == toOtherInventory && slotTmp.hasStack() && (matchingOnly == false || areStacksEqual(stackReference, slotTmp.getStack()))) { - boolean success = shiftClickSlotWithCheck(gui, slotTmp.slotNumber); + boolean success = shiftClickSlotWithCheck(gui, slotTmp.id); // Failed to shift-click items, try a manual method if (success == false && Configs.Toggles.SCROLL_STACKS_FALLBACK.getBooleanValue()) @@ -895,16 +907,15 @@ private static void tryMoveStacks(ItemStack stackReference, Slot slot, GuiContai } // If moving to the other inventory, then move the hovered slot's stack last - if (toOtherInventory && shiftClickSlotWithCheck(gui, slot.slotNumber) == false) + if (toOtherInventory && shiftClickSlotWithCheck(gui, slot.id) == false) { clickSlotsToMoveItemsFromSlot(slot, gui, toOtherInventory); } } - private static void tryMoveItemsToMerchantBuySlots(GuiMerchant gui, boolean fillStacks) + private static void tryMoveItemsToMerchantBuySlots(VillagerScreen gui, boolean fillStacks) { - Minecraft mc = Minecraft.getInstance(); - MerchantRecipeList list = gui.getMerchant().getRecipes(mc.player); + TraderOfferList list = gui.getContainer().getRecipes(); int index = AccessorUtils.getSelectedMerchantRecipe(gui); if (list == null || list.size() <= index) @@ -912,14 +923,15 @@ private static void tryMoveItemsToMerchantBuySlots(GuiMerchant gui, boolean fill return; } - MerchantRecipe recipe = list.get(index); + TradeOffer recipe = list.get(index); + if (recipe == null) { return; } - ItemStack buy1 = recipe.getItemToBuy(); - ItemStack buy2 = recipe.getSecondItemToBuy(); + ItemStack buy1 = recipe.getAdjustedFirstBuyItem(); + ItemStack buy2 = recipe.getSecondBuyItem(); if (isStackEmpty(buy1) == false) { @@ -932,11 +944,11 @@ private static void tryMoveItemsToMerchantBuySlots(GuiMerchant gui, boolean fill } } - private static void fillBuySlot(GuiContainer gui, int slotNum, ItemStack buyStack, boolean fillStacks) + private static void fillBuySlot(ContainerScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) { - Slot slot = gui.inventorySlots.getSlot(slotNum); + Slot slot = gui.getContainer().getSlot(slotNum); ItemStack existingStack = slot.getStack(); - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); // If there are items not matching the merchant recipe, move them out first if (isStackEmpty(existingStack) == false && areStacksEqual(buyStack, existingStack) == false) @@ -952,7 +964,7 @@ private static void fillBuySlot(GuiContainer gui, int slotNum, ItemStack buyStac } } - public static void handleRecipeClick(GuiContainer gui, Minecraft mc, RecipeStorage recipes, int hoveredRecipeId, + public static void handleRecipeClick(ContainerScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, boolean isLeftClick, boolean isRightClick, boolean isPickBlock, boolean isShiftDown) { if (isLeftClick || isRightClick) @@ -971,7 +983,7 @@ public static void handleRecipeClick(GuiContainer gui, Minecraft mc, RecipeStora if (isRightClick) { Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); - boolean dropKeyDown = mc.gameSettings.keyBindDrop.isKeyDown(); + boolean dropKeyDown = mc.options.keyDrop.isPressed(); // FIXME 1.14 if (outputSlot != null) { @@ -981,23 +993,23 @@ public static void handleRecipeClick(GuiContainer gui, Minecraft mc, RecipeStora { if (Configs.Generic.CARPET_CTRL_Q_CRAFTING.getBooleanValue()) { - InventoryUtils.dropStack(gui, outputSlot.slotNumber); + InventoryUtils.dropStack(gui, outputSlot.id); } else { - InventoryUtils.dropStacksUntilEmpty(gui, outputSlot.slotNumber); + InventoryUtils.dropStacksUntilEmpty(gui, outputSlot.id); } } else { - InventoryUtils.dropItem(gui, outputSlot.slotNumber); + InventoryUtils.dropItem(gui, outputSlot.id); } } else { if (isShiftDown) { - InventoryUtils.shiftClickSlot(gui, outputSlot.slotNumber); + InventoryUtils.shiftClickSlot(gui, outputSlot.id); } else { @@ -1013,7 +1025,7 @@ else if (isPickBlock) } } - public static void tryMoveItemsToFirstCraftingGrid(CraftingRecipe recipe, GuiContainer gui, boolean fillStacks) + public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, ContainerScreen gui, boolean fillStacks) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1023,13 +1035,13 @@ public static void tryMoveItemsToFirstCraftingGrid(CraftingRecipe recipe, GuiCon } } - public static void loadRecipeItemsToGridForOutputSlotUnderMouse(CraftingRecipe recipe, GuiContainer gui) + public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, ContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); loadRecipeItemsToGridForOutputSlot(recipe, gui, slot); } - private static void loadRecipeItemsToGridForOutputSlot(CraftingRecipe recipe, GuiContainer gui, Slot outputSlot) + private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, ContainerScreen gui, Slot outputSlot) { if (outputSlot != null && isCraftingSlot(gui, outputSlot) && isStackEmpty(recipe.getResult()) == false) { @@ -1037,17 +1049,17 @@ private static void loadRecipeItemsToGridForOutputSlot(CraftingRecipe recipe, Gu } } - private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, GuiContainer gui, + private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, ContainerScreen gui, boolean moveToOtherInventory, boolean moveStacks, boolean moveEverything) { - CraftingRecipe recipe = recipes.getSelectedRecipe(); + RecipePattern recipe = recipes.getSelectedRecipe(); ItemStack stackRecipeOutput = recipe.getResult(); // Try to craft items if (moveToOtherInventory) { // Items in the output slot - if (slot.getHasStack()) + if (slot.hasStack()) { // The output item matches the current recipe if (areStacksEqual(slot.getStack(), stackRecipeOutput)) @@ -1058,7 +1070,7 @@ private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, Gu } else if (moveStacks) { - shiftClickSlot(gui, slot.slotNumber); + shiftClickSlot(gui, slot.id); } else { @@ -1081,17 +1093,17 @@ else if (moveToOtherInventory == false && isStackEmpty(stackRecipeOutput) == fal return false; } - private static void craftAsManyItemsAsPossible(CraftingRecipe recipe, Slot slot, GuiContainer gui) + private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, ContainerScreen gui) { ItemStack result = recipe.getResult(); int failSafe = 1024; - while (failSafe > 0 && slot.getHasStack() && areStacksEqual(slot.getStack(), result)) + while (failSafe > 0 && slot.hasStack() && areStacksEqual(slot.getStack(), result)) { - shiftClickSlot(gui, slot.slotNumber); + shiftClickSlot(gui, slot.id); // Ran out of some or all ingredients for the recipe - if (slot.getHasStack() == false || areStacksEqual(slot.getStack(), result) == false) + if (slot.hasStack() == false || areStacksEqual(slot.getStack(), result) == false) { tryMoveItemsToCraftingGridSlots(recipe, slot, gui, true); } @@ -1105,7 +1117,7 @@ private static void craftAsManyItemsAsPossible(CraftingRecipe recipe, Slot slot, } } - public static void clearFirstCraftingGridOfItems(CraftingRecipe recipe, GuiContainer gui, boolean clearNonMatchingOnly) + public static void clearFirstCraftingGridOfItems(RecipePattern recipe, ContainerScreen gui, boolean clearNonMatchingOnly) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1116,7 +1128,7 @@ public static void clearFirstCraftingGridOfItems(CraftingRecipe recipe, GuiConta } } - public static void clearFirstCraftingGridOfAllItems(GuiContainer gui) + public static void clearFirstCraftingGridOfAllItems(ContainerScreen gui) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1127,24 +1139,24 @@ public static void clearFirstCraftingGridOfAllItems(GuiContainer gui) } } - private static boolean clearCraftingGridOfItems(CraftingRecipe recipe, GuiContainer gui, SlotRange range, boolean clearNonMatchingOnly) + private static boolean clearCraftingGridOfItems(RecipePattern recipe, ContainerScreen gui, SlotRange range, boolean clearNonMatchingOnly) { - final int invSlots = gui.inventorySlots.inventorySlots.size(); + final int invSlots = gui.getContainer().slotList.size(); final int rangeSlots = range.getSlotCount(); final int recipeSize = recipe.getRecipeLength(); final int slotCount = Math.min(rangeSlots, recipeSize); for (int i = 0, slotNum = range.getFirst(); i < slotCount && slotNum < invSlots; i++, slotNum++) { - Slot slotTmp = gui.inventorySlots.getSlot(slotNum); + Slot slotTmp = gui.getContainer().getSlot(slotNum); - if (slotTmp != null && slotTmp.getHasStack() && + if (slotTmp != null && slotTmp.hasStack() && (clearNonMatchingOnly == false || areStacksEqual(recipe.getRecipeItems()[i], slotTmp.getStack()) == false)) { shiftClickSlot(gui, slotNum); // Failed to clear the slot - if (slotTmp.getHasStack()) + if (slotTmp.hasStack()) { return false; } @@ -1154,22 +1166,22 @@ private static boolean clearCraftingGridOfItems(CraftingRecipe recipe, GuiContai return true; } - private static boolean clearCraftingGridOfAllItems(GuiContainer gui, SlotRange range) + private static boolean clearCraftingGridOfAllItems(ContainerScreen gui, SlotRange range) { - final int invSlots = gui.inventorySlots.inventorySlots.size(); + final int invSlots = gui.getContainer().slotList.size(); final int rangeSlots = range.getSlotCount(); boolean clearedAll = true; for (int i = 0, slotNum = range.getFirst(); i < rangeSlots && slotNum < invSlots; i++, slotNum++) { - Slot slotTmp = gui.inventorySlots.getSlot(slotNum); + Slot slotTmp = gui.getContainer().getSlot(slotNum); - if (slotTmp != null && slotTmp.getHasStack()) + if (slotTmp != null && slotTmp.hasStack()) { shiftClickSlot(gui, slotNum); // Failed to clear the slot - if (slotTmp.getHasStack()) + if (slotTmp.hasStack()) { clearedAll = false; } @@ -1179,10 +1191,10 @@ private static boolean clearCraftingGridOfAllItems(GuiContainer gui, SlotRange r return clearedAll; } - private static boolean tryMoveItemsToCraftingGridSlots(CraftingRecipe recipe, Slot slot, GuiContainer gui, boolean fillStacks) + private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slot slot, ContainerScreen gui, boolean fillStacks) { - Container container = gui.inventorySlots; - int numSlots = container.inventorySlots.size(); + Container container = gui.getContainer(); + int numSlots = container.slotList.size(); SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); // Check that the slot range is valid and that the recipe can fit into this type of crafting grid @@ -1224,11 +1236,11 @@ private static boolean tryMoveItemsToCraftingGridSlots(CraftingRecipe recipe, Sl return false; } - private static void fillCraftingGrid(GuiContainer gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void fillCraftingGrid(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { - Container container = gui.inventorySlots; - Minecraft mc = Minecraft.getInstance(); - EntityPlayer player = mc.player; + Container container = gui.getContainer(); + MinecraftClient mc = MinecraftClient.getInstance(); + PlayerEntity player = mc.player; int slotNum = -1; int slotReturn = -1; int sizeOrig = 0; @@ -1256,14 +1268,14 @@ private static void fillCraftingGrid(GuiContainer gui, Slot slotGridFirst, ItemS // Pick up the ingredient stack from the found slot leftClickSlot(gui, slotNum); - ItemStack stackCursor = player.inventory.getItemStack(); + ItemStack stackCursor = player.inventory.getCursorStack(); // Successfully picked up ingredient items if (areStacksEqual(ingredientReference, stackCursor)) { sizeOrig = getStackSize(stackCursor); dragSplitItemsIntoSlots(gui, targetSlots); - stackCursor = player.inventory.getItemStack(); + stackCursor = player.inventory.getCursorStack(); // Items left in cursor if (isStackEmpty(stackCursor) == false) @@ -1278,7 +1290,7 @@ private static void fillCraftingGrid(GuiContainer gui, Slot slotGridFirst, ItemS leftClickSlot(gui, slotReturn); // All of them didn't fit into the first slot anymore, switch into the current source slot - if (isStackEmpty(player.inventory.getItemStack()) == false) + if (isStackEmpty(player.inventory.getCursorStack()) == false) { slotReturn = slotNum; leftClickSlot(gui, slotReturn); @@ -1293,27 +1305,27 @@ private static void fillCraftingGrid(GuiContainer gui, Slot slotGridFirst, ItemS } // Somehow items were left in the cursor, break here - if (isStackEmpty(player.inventory.getItemStack()) == false) + if (isStackEmpty(player.inventory.getCursorStack()) == false) { break; } } // Return the rest of the items to the original slot - if (slotNum >= 0 && isStackEmpty(player.inventory.getItemStack()) == false) + if (slotNum >= 0 && isStackEmpty(player.inventory.getCursorStack()) == false) { leftClickSlot(gui, slotNum); } } - public static void rightClickCraftOneStack(GuiContainer gui) + public static void rightClickCraftOneStack(ContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); - Minecraft mc = Minecraft.getInstance(); - InventoryPlayer inv = mc.player.inventory; - ItemStack stackCursor = inv.getItemStack(); + MinecraftClient mc = MinecraftClient.getInstance(); + PlayerInventory inv = mc.player.inventory; + ItemStack stackCursor = inv.getCursorStack(); - if (slot == null || slot.getHasStack() == false || + if (slot == null || slot.hasStack() == false || (isStackEmpty(stackCursor) == false) && areStacksEqual(slot.getStack(), stackCursor) == false) { return; @@ -1323,12 +1335,12 @@ public static void rightClickCraftOneStack(GuiContainer gui) while (true) { - rightClickSlot(gui, slot.slotNumber); - stackCursor = inv.getItemStack(); + rightClickSlot(gui, slot.id); + stackCursor = inv.getCursorStack(); // Failed to craft items, or the stack became full, or ran out of ingredients if (isStackEmpty(stackCursor) || getStackSize(stackCursor) <= sizeLast || - getStackSize(stackCursor) >= stackCursor.getMaxStackSize() || + getStackSize(stackCursor) >= stackCursor.getMaxAmount() || areStacksEqual(slot.getStack(), stackCursor) == false) { break; @@ -1338,7 +1350,7 @@ public static void rightClickCraftOneStack(GuiContainer gui) } } - public static void craftEverythingPossibleWithCurrentRecipe(CraftingRecipe recipe, GuiContainer gui) + public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe, ContainerScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1356,7 +1368,7 @@ public static void craftEverythingPossibleWithCurrentRecipe(CraftingRecipe recip tryMoveItemsToCraftingGridSlots(recipe, slot, gui, true); - if (slot.getHasStack()) + if (slot.hasStack()) { craftAsManyItemsAsPossible(recipe, slot, gui); } @@ -1364,18 +1376,18 @@ public static void craftEverythingPossibleWithCurrentRecipe(CraftingRecipe recip } } - public static void moveAllCraftingResultsToOtherInventory(CraftingRecipe recipe, GuiContainer gui) + public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, ContainerScreen gui) { if (isStackEmpty(recipe.getResult()) == false) { Slot slot = null; ItemStack stackResult = recipe.getResult().copy(); - for (Slot slotTmp : gui.inventorySlots.inventorySlots) + for (Slot slotTmp : gui.getContainer().slotList) { // This slot is likely in the player inventory, as there is another inventory above if (areStacksEqual(slotTmp.getStack(), stackResult) && - inventoryExistsAbove(slotTmp, gui.inventorySlots)) + inventoryExistsAbove(slotTmp, gui.getContainer())) { slot = slotTmp; break; @@ -1386,7 +1398,7 @@ public static void moveAllCraftingResultsToOtherInventory(CraftingRecipe recipe, { // Get a list of slots with matching items, which are in the same inventory // as the slot that is assumed to be in the player inventory. - List slots = getSlotNumbersOfMatchingStacks(gui.inventorySlots, slot, true, stackResult, false, false, false); + List slots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, true, stackResult, false, false, false); for (int slotNum : slots) { @@ -1396,7 +1408,7 @@ public static void moveAllCraftingResultsToOtherInventory(CraftingRecipe recipe, } } - public static void throwAllCraftingResultsToGround(CraftingRecipe recipe, GuiContainer gui) + public static void throwAllCraftingResultsToGround(RecipePattern recipe, ContainerScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1406,17 +1418,17 @@ public static void throwAllCraftingResultsToGround(CraftingRecipe recipe, GuiCon } } - private static int putSingleItemIntoSlots(GuiContainer gui, List targetSlots, int startIndex) + private static int putSingleItemIntoSlots(ContainerScreen gui, List targetSlots, int startIndex) { - Minecraft mc = Minecraft.getInstance(); - ItemStack stackInCursor = mc.player.inventory.getItemStack(); + MinecraftClient mc = MinecraftClient.getInstance(); + ItemStack stackInCursor = mc.player.inventory.getCursorStack(); if (isStackEmpty(stackInCursor)) { return 0; } - int numSlots = gui.inventorySlots.inventorySlots.size(); + int numSlots = gui.getContainer().slotList.size(); int numItems = getStackSize(stackInCursor); int loops = Math.min(numItems, targetSlots.size() - startIndex); int count = 0; @@ -1437,29 +1449,29 @@ private static int putSingleItemIntoSlots(GuiContainer gui, List target return count; } - public static void moveOneSetOfItemsFromSlotToPlayerInventory(GuiContainer gui, Slot slot) + public static void moveOneSetOfItemsFromSlotToPlayerInventory(ContainerScreen gui, Slot slot) { - leftClickSlot(gui, slot.slotNumber); + leftClickSlot(gui, slot.id); - Minecraft mc = Minecraft.getInstance(); - ItemStack stackCursor = mc.player.inventory.getItemStack(); + MinecraftClient mc = MinecraftClient.getInstance(); + ItemStack stackCursor = mc.player.inventory.getCursorStack(); if (isStackEmpty(stackCursor) == false) { - List slots = getSlotNumbersOfMatchingStacks(gui.inventorySlots, slot, false, stackCursor, true, true, false); + List slots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, false, stackCursor, true, true, false); if (moveItemFromCursorToSlots(gui, slots) == false) { - slots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.inventorySlots, false); + slots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.getContainer(), false); moveItemFromCursorToSlots(gui, slots); } } } - private static void moveOneRecipeItemIntoCraftingGrid(GuiContainer gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void moveOneRecipeItemIntoCraftingGrid(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { - Container container = gui.inventorySlots; - Minecraft mc = Minecraft.getInstance(); + Container container = gui.getContainer(); + MinecraftClient mc = MinecraftClient.getInstance(); int index = 0; int slotNum = -1; int slotCount = targetSlots.size(); @@ -1478,7 +1490,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(GuiContainer gui, Slot slo leftClickSlot(gui, slotNum); // Successfully picked up ingredient items - if (areStacksEqual(ingredientReference, mc.player.inventory.getItemStack())) + if (areStacksEqual(ingredientReference, mc.player.inventory.getCursorStack())) { int filled = putSingleItemIntoSlots(gui, targetSlots, index); index += filled; @@ -1497,22 +1509,22 @@ private static void moveOneRecipeItemIntoCraftingGrid(GuiContainer gui, Slot slo } // Return the rest of the items to the original slot - if (slotNum >= 0 && isStackEmpty(mc.player.inventory.getItemStack()) == false) + if (slotNum >= 0 && isStackEmpty(mc.player.inventory.getCursorStack()) == false) { leftClickSlot(gui, slotNum); } } - private static boolean moveItemFromCursorToSlots(GuiContainer gui, List slotNumbers) + private static boolean moveItemFromCursorToSlots(ContainerScreen gui, List slotNumbers) { - Minecraft mc = Minecraft.getInstance(); - InventoryPlayer inv = mc.player.inventory; + MinecraftClient mc = MinecraftClient.getInstance(); + PlayerInventory inv = mc.player.inventory; for (int slotNum : slotNumbers) { leftClickSlot(gui, slotNum); - if (isStackEmpty(inv.getItemStack())) + if (isStackEmpty(inv.getCursorStack())) { return true; } @@ -1521,11 +1533,11 @@ private static boolean moveItemFromCursorToSlots(GuiContainer gui, List return false; } - private static void moveItemsFromInventory(GuiContainer gui, int slotTo, IInventory invSrc, ItemStack stackTemplate, boolean fillStacks) + private static void moveItemsFromInventory(ContainerScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) { - Container container = gui.inventorySlots; + Container container = gui.getContainer(); - for (Slot slot : container.inventorySlots) + for (Slot slot : container.slotList) { if (slot == null) { @@ -1536,14 +1548,14 @@ private static void moveItemsFromInventory(GuiContainer gui, int slotTo, IInvent { if (fillStacks) { - if (clickSlotsToMoveItems(gui, slot.slotNumber, slotTo) == false) + if (clickSlotsToMoveItems(gui, slot.id, slotTo) == false) { break; } } else { - clickSlotsToMoveSingleItem(gui, slot.slotNumber, slotTo); + clickSlotsToMoveSingleItem(gui, slot.id, slotTo); break; } } @@ -1555,16 +1567,16 @@ private static int getSlotNumberOfLargestMatchingStackFromDifferentInventory(Con int slotNum = -1; int largest = 0; - for (Slot slot : container.inventorySlots) + for (Slot slot : container.slotList) { - if (areSlotsInSameInventory(slot, slotReference) == false && slot.getHasStack() && + if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && areStacksEqual(stackReference, slot.getStack())) { int stackSize = getStackSize(slot.getStack()); if (stackSize > largest) { - slotNum = slot.slotNumber; + slotNum = slot.id; largest = stackSize; } } @@ -1587,16 +1599,16 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(Container int slotNum = -1; int smallest = Integer.MAX_VALUE; - for (Slot slot : container.inventorySlots) + for (Slot slot : container.slotList) { - if (areSlotsInSameInventory(slot, slotReference) == false && slot.getHasStack() && + if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && areStacksEqual(stackReference, slot.getStack())) { int stackSize = getStackSize(slot.getStack()); if (stackSize < smallest && stackSize >= idealSize) { - slotNum = slot.slotNumber; + slotNum = slot.id; smallest = stackSize; } } @@ -1607,16 +1619,16 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(Container { int largest = 0; - for (Slot slot : container.inventorySlots) + for (Slot slot : container.slotList) { - if (areSlotsInSameInventory(slot, slotReference) == false && slot.getHasStack() && + if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && areStacksEqual(stackReference, slot.getStack())) { int stackSize = getStackSize(slot.getStack()); if (stackSize > largest) { - slotNum = slot.slotNumber; + slotNum = slot.id; largest = stackSize; } } @@ -1644,24 +1656,24 @@ private static List getSlotNumbersOfMatchingStacks( ItemStack stackReference, boolean preferPartial, boolean treatHotbarAsDifferent, boolean reverse) { List slots = new ArrayList(64); - final int maxSlot = container.inventorySlots.size() - 1; + final int maxSlot = container.slotList.size() - 1; final int increment = reverse ? -1 : 1; for (int i = reverse ? maxSlot : 0; i >= 0 && i <= maxSlot; i += increment) { Slot slot = container.getSlot(i); - if (slot != null && slot.getHasStack() && + if (slot != null && slot.hasStack() && areSlotsInSameInventory(slot, slotReference, treatHotbarAsDifferent) == sameInventory && areStacksEqual(slot.getStack(), stackReference)) { - if ((getStackSize(slot.getStack()) < stackReference.getMaxStackSize()) == preferPartial) + if ((getStackSize(slot.getStack()) < stackReference.getMaxAmount()) == preferPartial) { - slots.add(0, slot.slotNumber); + slots.add(0, slot.id); } else { - slots.add(slot.slotNumber); + slots.add(slot.id); } } } @@ -1672,21 +1684,21 @@ private static List getSlotNumbersOfMatchingStacks( private static List getSlotNumbersOfMatchingStacks(Container container, ItemStack stackReference, boolean preferPartial) { List slots = new ArrayList(64); - final int maxSlot = container.inventorySlots.size() - 1; + final int maxSlot = container.slotList.size() - 1; for (int i = 0; i <= maxSlot; ++i) { Slot slot = container.getSlot(i); - if (slot != null && slot.getHasStack() && areStacksEqual(slot.getStack(), stackReference)) + if (slot != null && slot.hasStack() && areStacksEqual(slot.getStack(), stackReference)) { - if ((getStackSize(slot.getStack()) < stackReference.getMaxStackSize()) == preferPartial) + if ((getStackSize(slot.getStack()) < stackReference.getMaxAmount()) == preferPartial) { - slots.add(0, slot.slotNumber); + slots.add(0, slot.id); } else { - slots.add(slot.slotNumber); + slots.add(slot.id); } } } @@ -1698,17 +1710,17 @@ private static List getSlotNumbersOfEmptySlots( Container container, Slot slotReference, boolean sameInventory, boolean treatHotbarAsDifferent, boolean reverse) { List slots = new ArrayList(64); - final int maxSlot = container.inventorySlots.size() - 1; + final int maxSlot = container.slotList.size() - 1; final int increment = reverse ? -1 : 1; for (int i = reverse ? maxSlot : 0; i >= 0 && i <= maxSlot; i += increment) { Slot slot = container.getSlot(i); - if (slot != null && slot.getHasStack() == false && + if (slot != null && slot.hasStack() == false && areSlotsInSameInventory(slot, slotReference, treatHotbarAsDifferent) == sameInventory) { - slots.add(slot.slotNumber); + slots.add(slot.id); } } @@ -1718,16 +1730,16 @@ private static List getSlotNumbersOfEmptySlots( private static List getSlotNumbersOfEmptySlotsInPlayerInventory(Container container, boolean reverse) { List slots = new ArrayList(64); - final int maxSlot = container.inventorySlots.size() - 1; + final int maxSlot = container.slotList.size() - 1; final int increment = reverse ? -1 : 1; for (int i = reverse ? maxSlot : 0; i >= 0 && i <= maxSlot; i += increment) { Slot slot = container.getSlot(i); - if (slot != null && (slot.inventory instanceof InventoryPlayer) && slot.getHasStack() == false) + if (slot != null && (slot.inventory instanceof PlayerInventory) && slot.hasStack() == false) { - slots.add(slot.slotNumber); + slots.add(slot.id); } } @@ -1736,7 +1748,7 @@ private static List getSlotNumbersOfEmptySlotsInPlayerInventory(Contain public static boolean areStacksEqual(ItemStack stack1, ItemStack stack2) { - return ItemStack.areItemsEqual(stack1, stack2) && ItemStack.areItemStackTagsEqual(stack1, stack2); + return stack1.isEmpty() == false && stack1.isEqualIgnoreTags(stack2) && ItemStack.areTagsEqual(stack1, stack2); } private static boolean areSlotsInSameInventory(Slot slot1, Slot slot2) @@ -1748,7 +1760,7 @@ private static boolean areSlotsInSameInventory(Slot slot1, Slot slot2, boolean t { if (slot1.inventory == slot2.inventory) { - if (treatHotbarAsDifferent && slot1.inventory instanceof InventoryPlayer) + if (treatHotbarAsDifferent && slot1.inventory instanceof PlayerInventory) { int index1 = AccessorUtils.getSlotIndex(slot1); int index2 = AccessorUtils.getSlotIndex(slot2); @@ -1764,11 +1776,11 @@ private static boolean areSlotsInSameInventory(Slot slot1, Slot slot2, boolean t private static ItemStack[] getOriginalStacks(Container container) { - ItemStack[] originalStacks = new ItemStack[container.inventorySlots.size()]; + ItemStack[] originalStacks = new ItemStack[container.slotList.size()]; for (int i = 0; i < originalStacks.length; i++) { - originalStacks[i] = container.inventorySlots.get(i).getStack().copy(); + originalStacks[i] = container.slotList.get(i).getStack().copy(); } return originalStacks; @@ -1783,14 +1795,14 @@ private static void restoreOriginalStacks(Container container, ItemStack[] origi if (areStacksEqual(stackSlot, originalStacks[i]) == false || (isStackEmpty(stackSlot) == false && getStackSize(stackSlot) != getStackSize(originalStacks[i]))) { - container.putStackInSlot(i, originalStacks[i]); + container.setStackInSlot(i, originalStacks[i]); } } } private static int getTargetSlot(Container container, ItemStack[] originalStacks) { - List slots = container.inventorySlots; + List slots = container.slotList; for (int i = 0; i < originalStacks.length; i++) { @@ -1809,12 +1821,12 @@ private static int getTargetSlot(Container container, ItemStack[] originalStacks } /* - private void clickSlotsToMoveItems(Slot slot, GuiContainer gui, boolean matchingOnly, boolean toOtherInventory) + private void clickSlotsToMoveItems(Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory) { - for (Slot slotTmp : gui.inventorySlots.inventorySlots) + for (Slot slotTmp : gui.getContainer().slotList) { - if (slotTmp.slotNumber != slot.slotNumber && areSlotsInSameInventory(slotTmp, slot) == toOtherInventory && - slotTmp.getHasStack() && (matchingOnly == false || areStacksEqual(slot.getStack(), slotTmp.getStack()))) + if (slotTmp.id != slot.id && areSlotsInSameInventory(slotTmp, slot) == toOtherInventory && + slotTmp.hasStack() && (matchingOnly == false || areStacksEqual(slot.getStack(), slotTmp.getStack()))) { this.clickSlotsToMoveItemsFromSlot(slotTmp, gui, toOtherInventory); return; @@ -1829,47 +1841,47 @@ private void clickSlotsToMoveItems(Slot slot, GuiContainer gui, boolean matching } */ - private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, GuiContainer gui, boolean toOtherInventory) + private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, ContainerScreen gui, boolean toOtherInventory) { - Minecraft mc = Minecraft.getInstance(); - EntityPlayer player = mc.player; + MinecraftClient mc = MinecraftClient.getInstance(); + PlayerEntity player = mc.player; // Left click to pick up the found source stack - leftClickSlot(gui, slotFrom.slotNumber); + leftClickSlot(gui, slotFrom.id); - if (isStackEmpty(player.inventory.getItemStack())) + if (isStackEmpty(player.inventory.getCursorStack())) { return; } - for (Slot slotDst : gui.inventorySlots.inventorySlots) + for (Slot slotDst : gui.getContainer().slotList) { ItemStack stackDst = slotDst.getStack(); if (areSlotsInSameInventory(slotDst, slotFrom) != toOtherInventory && - (isStackEmpty(stackDst) || areStacksEqual(stackDst, player.inventory.getItemStack()))) + (isStackEmpty(stackDst) || areStacksEqual(stackDst, player.inventory.getCursorStack()))) { // Left click to (try and) place items to the slot - leftClickSlot(gui, slotDst.slotNumber); + leftClickSlot(gui, slotDst.id); } - if (isStackEmpty(player.inventory.getItemStack())) + if (isStackEmpty(player.inventory.getCursorStack())) { return; } } // Couldn't fit the entire stack to the target inventory, return the rest of the items - if (isStackEmpty(player.inventory.getItemStack()) == false) + if (isStackEmpty(player.inventory.getCursorStack()) == false) { - leftClickSlot(gui, slotFrom.slotNumber); + leftClickSlot(gui, slotFrom.id); } } - private static boolean clickSlotsToMoveSingleItem(GuiContainer gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveSingleItem(ContainerScreen gui, int slotFrom, int slotTo) { //System.out.println("clickSlotsToMoveSingleItem(from: " + slotFrom + ", to: " + slotTo + ")"); - Minecraft mc = Minecraft.getInstance(); - ItemStack stack = gui.inventorySlots.inventorySlots.get(slotFrom).getStack(); + MinecraftClient mc = MinecraftClient.getInstance(); + ItemStack stack = gui.getContainer().slotList.get(slotFrom).getStack(); if (isStackEmpty(stack)) { @@ -1891,7 +1903,7 @@ private static boolean clickSlotsToMoveSingleItem(GuiContainer gui, int slotFrom rightClickSlot(gui, slotTo); // If there are items left in the cursor, then return them back to the original slot - if (isStackEmpty(mc.player.inventory.getItemStack()) == false) + if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) { // Left click again on the from-slot to return the rest of the items to it leftClickSlot(gui, slotFrom); @@ -1900,10 +1912,10 @@ private static boolean clickSlotsToMoveSingleItem(GuiContainer gui, int slotFrom return true; } - private static boolean clickSlotsToMoveSingleItemByShiftClick(GuiContainer gui, int slotFrom) + private static boolean clickSlotsToMoveSingleItemByShiftClick(ContainerScreen gui, int slotFrom) { - Minecraft mc = Minecraft.getInstance(); - Slot slot = gui.inventorySlots.inventorySlots.get(slotFrom); + MinecraftClient mc = MinecraftClient.getInstance(); + Slot slot = gui.getContainer().slotList.get(slotFrom); ItemStack stack = slot.getStack(); if (isStackEmpty(stack)) @@ -1917,7 +1929,7 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(GuiContainer gui, leftClickSlot(gui, slotFrom); // Still items left in the slot, put the stack back and abort - if (slot.getHasStack()) + if (slot.hasStack()) { leftClickSlot(gui, slotFrom); return false; @@ -1932,7 +1944,7 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(GuiContainer gui, // ... and then shift-click on the slot shiftClickSlot(gui, slotFrom); - if (isStackEmpty(mc.player.inventory.getItemStack()) == false) + if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) { // ... and then return the rest of the items leftClickSlot(gui, slotFrom); @@ -1945,31 +1957,31 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(GuiContainer gui, * Try move items from slotFrom to slotTo * @return true if at least some items were moved */ - private static boolean clickSlotsToMoveItems(GuiContainer gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveItems(ContainerScreen gui, int slotFrom, int slotTo) { - Minecraft mc = Minecraft.getInstance(); - EntityPlayer player = mc.player; + MinecraftClient mc = MinecraftClient.getInstance(); + PlayerEntity player = mc.player; //System.out.println("clickSlotsToMoveItems(from: " + slotFrom + ", to: " + slotTo + ")"); // Left click to take items leftClickSlot(gui, slotFrom); // Couldn't take the items, bail out now - if (isStackEmpty(player.inventory.getItemStack())) + if (isStackEmpty(player.inventory.getCursorStack())) { return false; } boolean ret = true; - int size = getStackSize(player.inventory.getItemStack()); + int size = getStackSize(player.inventory.getCursorStack()); // Left click on the target slot to put the items to it leftClickSlot(gui, slotTo); // If there are items left in the cursor, then return them back to the original slot - if (isStackEmpty(player.inventory.getItemStack()) == false) + if (isStackEmpty(player.inventory.getCursorStack()) == false) { - ret = getStackSize(player.inventory.getItemStack()) != size; + ret = getStackSize(player.inventory.getCursorStack()) != size; // Left click again on the from-slot to return the rest of the items to it leftClickSlot(gui, slotFrom); @@ -1978,25 +1990,25 @@ private static boolean clickSlotsToMoveItems(GuiContainer gui, int slotFrom, int return ret; } - public static void dropStacksUntilEmpty(GuiContainer gui, int slotNum) + public static void dropStacksUntilEmpty(ContainerScreen gui, int slotNum) { - if (slotNum >= 0 && slotNum < gui.inventorySlots.inventorySlots.size()) + if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) { - Slot slot = gui.inventorySlots.getSlot(slotNum); + Slot slot = gui.getContainer().getSlot(slotNum); int failsafe = 64; - while (failsafe-- > 0 && slot.getHasStack()) + while (failsafe-- > 0 && slot.hasStack()) { dropStack(gui, slotNum); } } } - public static void dropStacksWhileHasItem(GuiContainer gui, int slotNum, ItemStack stackReference) + public static void dropStacksWhileHasItem(ContainerScreen gui, int slotNum, ItemStack stackReference) { - if (slotNum >= 0 && slotNum < gui.inventorySlots.inventorySlots.size()) + if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) { - Slot slot = gui.inventorySlots.getSlot(slotNum); + Slot slot = gui.getContainer().getSlot(slotNum); int failsafe = 256; while (failsafe-- > 0 && areStacksEqual(slot.getStack(), stackReference)) @@ -2006,11 +2018,11 @@ public static void dropStacksWhileHasItem(GuiContainer gui, int slotNum, ItemSta } } - private static boolean shiftClickSlotWithCheck(GuiContainer gui, int slotNum) + private static boolean shiftClickSlotWithCheck(ContainerScreen gui, int slotNum) { - Slot slot = gui.inventorySlots.getSlot(slotNum); + Slot slot = gui.getContainer().getSlot(slotNum); - if (slot == null || slot.getHasStack() == false) + if (slot == null || slot.hasStack() == false) { return false; } @@ -2018,20 +2030,20 @@ private static boolean shiftClickSlotWithCheck(GuiContainer gui, int slotNum) int sizeOrig = getStackSize(slot.getStack()); shiftClickSlot(gui, slotNum); - return slot.getHasStack() == false || getStackSize(slot.getStack()) != sizeOrig; + return slot.hasStack() == false || getStackSize(slot.getStack()) != sizeOrig; } - public static boolean tryMoveItemsVertically(GuiContainer gui, Slot slot, boolean moveUp, MoveAmount amount) + public static boolean tryMoveItemsVertically(ContainerScreen gui, Slot slot, boolean moveUp, MoveAmount amount) { - Minecraft mc = Minecraft.getInstance(); + MinecraftClient mc = MinecraftClient.getInstance(); // We require an empty cursor - if (slot == null || isStackEmpty(mc.player.inventory.getItemStack()) == false) + if (slot == null || isStackEmpty(mc.player.inventory.getCursorStack()) == false) { return false; } - List slots = getVerticallyFurthestSuitableSlotsForStackInSlot(gui.inventorySlots, slot, moveUp); + List slots = getVerticallyFurthestSuitableSlotsForStackInSlot(gui.getContainer(), slot, moveUp); if (slots.isEmpty()) { @@ -2058,61 +2070,61 @@ else if (amount == MoveAmount.ALL_MATCHING) return true; } - private static void moveMatchingStacksToSlots(GuiContainer gui, Slot slot, boolean moveUp) + private static void moveMatchingStacksToSlots(ContainerScreen gui, Slot slot, boolean moveUp) { - List matchingSlots = getSlotNumbersOfMatchingStacks(gui.inventorySlots, slot, true, slot.getStack(), true, true, false); - List targetSlots = getSlotNumbersOfEmptySlots(gui.inventorySlots, slot, false, true, false); - targetSlots.addAll(getSlotNumbersOfEmptySlots(gui.inventorySlots, slot, true, true, false)); + List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, true, slot.getStack(), true, true, false); + List targetSlots = getSlotNumbersOfEmptySlots(gui.getContainer(), slot, false, true, false); + targetSlots.addAll(getSlotNumbersOfEmptySlots(gui.getContainer(), slot, true, true, false)); targetSlots.addAll(matchingSlots); - Collections.sort(matchingSlots, new SlotVerticalSorterSlotNumbers(gui.inventorySlots, ! moveUp)); - Collections.sort(targetSlots, new SlotVerticalSorterSlotNumbers(gui.inventorySlots, moveUp)); + Collections.sort(matchingSlots, new SlotVerticalSorterSlotNumbers(gui.getContainer(), ! moveUp)); + Collections.sort(targetSlots, new SlotVerticalSorterSlotNumbers(gui.getContainer(), moveUp)); for (int i = 0; i < matchingSlots.size(); ++i) { int srcSlotNum = matchingSlots.get(i).intValue(); - Slot srcSlot = gui.inventorySlots.getSlot(srcSlotNum); + Slot srcSlot = gui.getContainer().getSlot(srcSlotNum); Slot lastSlot = moveStackToSlots(gui, srcSlot, targetSlots, false); - if (lastSlot == null || (lastSlot.slotNumber == srcSlot.slotNumber || (lastSlot.yPos > srcSlot.yPos) == moveUp)) + if (lastSlot == null || (lastSlot.id == srcSlot.id || (lastSlot.yPosition > srcSlot.yPosition) == moveUp)) { return; } } } - private static Slot moveStackToSlots(GuiContainer gui, Slot slotFrom, List slotsTo, boolean leaveOne) + private static Slot moveStackToSlots(ContainerScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) { - Minecraft mc = Minecraft.getInstance(); - InventoryPlayer inv = mc.player.inventory; + MinecraftClient mc = MinecraftClient.getInstance(); + PlayerInventory inv = mc.player.inventory; Slot lastSlot = null; // Empty slot, nothing to do - if (slotFrom.getHasStack() == false) + if (slotFrom.hasStack() == false) { return null; } // Pick up the stack - leftClickSlot(gui, slotFrom.slotNumber); + leftClickSlot(gui, slotFrom.id); if (leaveOne) { - rightClickSlot(gui, slotFrom.slotNumber); + rightClickSlot(gui, slotFrom.id); } for (int slotNum : slotsTo) { // Empty cursor, all done here - if (isStackEmpty(inv.getItemStack())) + if (isStackEmpty(inv.getCursorStack())) { break; } - Slot dstSlot = gui.inventorySlots.getSlot(slotNum); + Slot dstSlot = gui.getContainer().getSlot(slotNum); - if (dstSlot.isItemValid(inv.getItemStack()) && - (dstSlot.getHasStack() == false || areStacksEqual(dstSlot.getStack(), inv.getItemStack()))) + if (dstSlot.canInsert(inv.getCursorStack()) && + (dstSlot.hasStack() == false || areStacksEqual(dstSlot.getStack(), inv.getCursorStack()))) { leftClickSlot(gui, slotNum); lastSlot = dstSlot; @@ -2120,33 +2132,33 @@ private static Slot moveStackToSlots(GuiContainer gui, Slot slotFrom, List slotsTo) + private static void moveOneItemToFirstValidSlot(ContainerScreen gui, Slot slotFrom, List slotsTo) { - Minecraft mc = Minecraft.getInstance(); - InventoryPlayer inv = mc.player.inventory; + MinecraftClient mc = MinecraftClient.getInstance(); + PlayerInventory inv = mc.player.inventory; // Pick up half of the the stack - rightClickSlot(gui, slotFrom.slotNumber); + rightClickSlot(gui, slotFrom.id); - if (isStackEmpty(inv.getItemStack())) + if (isStackEmpty(inv.getCursorStack())) { return; } - int sizeOrig = getStackSize(inv.getItemStack()); + int sizeOrig = getStackSize(inv.getCursorStack()); for (int slotNum : slotsTo) { rightClickSlot(gui, slotNum); - ItemStack stackCursor = inv.getItemStack(); + ItemStack stackCursor = inv.getCursorStack(); if (isStackEmpty(stackCursor) || getStackSize(stackCursor) != sizeOrig) { @@ -2155,15 +2167,15 @@ private static void moveOneItemToFirstValidSlot(GuiContainer gui, Slot slotFrom, } // Return the rest of the items, if any - if (isStackEmpty(inv.getItemStack()) == false) + if (isStackEmpty(inv.getCursorStack()) == false) { - leftClickSlot(gui, slotFrom.slotNumber); + leftClickSlot(gui, slotFrom.id); } } private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Container container, final Slot slotIn, boolean above) { - if (slotIn == null || slotIn.getHasStack() == false) + if (slotIn == null || slotIn.hasStack() == false) { return Collections.emptyList(); } @@ -2171,18 +2183,18 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Co List slotNumbers = new ArrayList<>(); ItemStack stackSlot = slotIn.getStack(); - for (Slot slotTmp : container.inventorySlots) + for (Slot slotTmp : container.slotList) { - if (slotTmp.slotNumber != slotIn.slotNumber && slotTmp.yPos != slotIn.yPos) + if (slotTmp.id != slotIn.id && slotTmp.yPosition != slotIn.yPosition) { - if (above == slotTmp.yPos < slotIn.yPos) + if (above == slotTmp.yPosition < slotIn.yPosition) { ItemStack stackTmp = slotTmp.getStack(); - if ((isStackEmpty(stackTmp) && slotTmp.isItemValid(stackSlot)) || - (areStacksEqual(stackTmp, stackSlot)) && slotTmp.getItemStackLimit(stackTmp) > getStackSize(stackTmp)) + if ((isStackEmpty(stackTmp) && slotTmp.canInsert(stackSlot)) || + (areStacksEqual(stackTmp, stackSlot)) && slotTmp.getMaxStackAmount(stackTmp) > getStackSize(stackTmp)) { - slotNumbers.add(slotTmp.slotNumber); + slotNumbers.add(slotTmp.id); } } } @@ -2193,11 +2205,13 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Co return slotNumbers; } - public static void tryClearCursor(GuiContainer gui, Minecraft mc) + public static void tryClearCursor(ContainerScreen gui, MinecraftClient mc) { - if (mc.player.inventory.getCurrentItem().isEmpty() == false) + ItemStack stackCursor = mc.player.inventory.getCursorStack(); + + if (stackCursor.isEmpty() == false) { - List emptySlots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.inventorySlots, false); + List emptySlots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.getContainer(), false); if (emptySlots.isEmpty() == false) { @@ -2205,29 +2219,29 @@ public static void tryClearCursor(GuiContainer gui, Minecraft mc) } else { - List matchingSlots = getSlotNumbersOfMatchingStacks(gui.inventorySlots, mc.player.inventory.getCurrentItem(), true); + List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getContainer(), stackCursor, true); if (matchingSlots.isEmpty() == false) { for (int slotNum : matchingSlots) { - Slot slot = gui.inventorySlots.getSlot(slotNum); + Slot slot = gui.getContainer().getSlot(slotNum); ItemStack stackSlot = slot.getStack(); - ItemStack stackCursor = mc.player.inventory.getCurrentItem(); if (slot == null || areStacksEqual(stackSlot, stackCursor) == false || - stackSlot.getCount() >= stackCursor.getMaxStackSize()) + stackSlot.getAmount() >= stackCursor.getMaxAmount()) { break; } leftClickSlot(gui, slotNum); + stackCursor = mc.player.inventory.getCursorStack(); } } } } - if (mc.player.inventory.getCurrentItem().isEmpty() == false) + if (mc.player.inventory.getCursorStack().isEmpty() == false) { dropItemsFromCursor(gui); } @@ -2258,7 +2272,7 @@ public int compare(Slot slot1, Slot slot2) { if (slot1.yPos == slot2.yPos) { - return (slot1.slotNumber < slot2.slotNumber) == this.topToBottom ? -1 : 1; + return (slot1.id < slot2.id) == this.topToBottom ? -1 : 1; } return (slot1.yPos < slot2.yPos) == this.topToBottom ? -1 : 1; @@ -2283,38 +2297,38 @@ public int compare(Integer slotNum1, Integer slotNum2) Slot slot1 = this.container.getSlot(slotNum1.intValue()); Slot slot2 = this.container.getSlot(slotNum2.intValue()); - if (slot1.yPos == slot2.yPos) + if (slot1.yPosition == slot2.yPosition) { - return (slot1.slotNumber < slot2.slotNumber) == this.topToBottom ? -1 : 1; + return (slot1.id < slot2.id) == this.topToBottom ? -1 : 1; } - return (slot1.yPos < slot2.yPos) == this.topToBottom ? -1 : 1; + return (slot1.yPosition < slot2.yPosition) == this.topToBottom ? -1 : 1; } } - public static void clickSlot(GuiContainer gui, int slotNum, int mouseButton, ClickType type) + public static void clickSlot(ContainerScreen gui, int slotNum, int mouseButton, SlotActionType type) { - if (slotNum >= 0 && slotNum < gui.inventorySlots.inventorySlots.size()) + if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) { - Slot slot = gui.inventorySlots.getSlot(slotNum); + Slot slot = gui.getContainer().getSlot(slotNum); clickSlot(gui, slot, slotNum, mouseButton, type); } else { try { - Minecraft mc = Minecraft.getInstance(); - mc.playerController.windowClick(gui.inventorySlots.windowId, slotNum, mouseButton, type, mc.player); + MinecraftClient mc = MinecraftClient.getInstance(); + mc.interactionManager.method_2906(gui.getContainer().syncId, slotNum, mouseButton, type, mc.player); } catch (Exception e) { - ItemScroller.logger.warn("Exception while emulating a slot click: gui: '{}', slotNum: {}, mouseButton; {}, ClickType: {}", + ItemScroller.logger.warn("Exception while emulating a slot click: gui: '{}', slotNum: {}, mouseButton; {}, SlotActionType: {}", gui.getClass().getName(), slotNum, mouseButton, type, e); } } } - public static void clickSlot(GuiContainer gui, Slot slot, int slotNum, int mouseButton, ClickType type) + public static void clickSlot(ContainerScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) { try { @@ -2322,67 +2336,67 @@ public static void clickSlot(GuiContainer gui, Slot slot, int slotNum, int mouse } catch (Exception e) { - ItemScroller.logger.warn("Exception while emulating a slot click: gui: '{}', slotNum: {}, mouseButton; {}, ClickType: {}", + ItemScroller.logger.warn("Exception while emulating a slot click: gui: '{}', slotNum: {}, mouseButton; {}, SlotActionType: {}", gui.getClass().getName(), slotNum, mouseButton, type, e); } } - public static void leftClickSlot(GuiContainer gui, Slot slot, int slotNumber) + public static void leftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) { - clickSlot(gui, slot, slotNumber, 0, ClickType.PICKUP); + clickSlot(gui, slot, slotNumber, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(GuiContainer gui, Slot slot, int slotNumber) + public static void rightClickSlot(ContainerScreen gui, Slot slot, int slotNumber) { - clickSlot(gui, slot, slotNumber, 1, ClickType.PICKUP); + clickSlot(gui, slot, slotNumber, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(GuiContainer gui, Slot slot, int slotNumber) + public static void shiftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) { - clickSlot(gui, slot, slotNumber, 0, ClickType.QUICK_MOVE); + clickSlot(gui, slot, slotNumber, 0, SlotActionType.QUICK_MOVE); } - public static void leftClickSlot(GuiContainer gui, int slotNum) + public static void leftClickSlot(ContainerScreen gui, int slotNum) { - clickSlot(gui, slotNum, 0, ClickType.PICKUP); + clickSlot(gui, slotNum, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(GuiContainer gui, int slotNum) + public static void rightClickSlot(ContainerScreen gui, int slotNum) { - clickSlot(gui, slotNum, 1, ClickType.PICKUP); + clickSlot(gui, slotNum, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(GuiContainer gui, int slotNum) + public static void shiftClickSlot(ContainerScreen gui, int slotNum) { - clickSlot(gui, slotNum, 0, ClickType.QUICK_MOVE); + clickSlot(gui, slotNum, 0, SlotActionType.QUICK_MOVE); } - public static void dropItemsFromCursor(GuiContainer gui) + public static void dropItemsFromCursor(ContainerScreen gui) { - clickSlot(gui, -999, 0, ClickType.PICKUP); + clickSlot(gui, -999, 0, SlotActionType.PICKUP); } - public static void dropItem(GuiContainer gui, int slotNum) + public static void dropItem(ContainerScreen gui, int slotNum) { - clickSlot(gui, slotNum, 0, ClickType.THROW); + clickSlot(gui, slotNum, 0, SlotActionType.THROW); } - public static void dropStack(GuiContainer gui, int slotNum) + public static void dropStack(ContainerScreen gui, int slotNum) { - clickSlot(gui, slotNum, 1, ClickType.THROW); + clickSlot(gui, slotNum, 1, SlotActionType.THROW); } - public static void swapSlots(GuiContainer gui, int slotNum, int otherSlot) + public static void swapSlots(ContainerScreen gui, int slotNum, int otherSlot) { - clickSlot(gui, slotNum, 0, ClickType.SWAP); - clickSlot(gui, otherSlot, 0, ClickType.SWAP); - clickSlot(gui, slotNum, 0, ClickType.SWAP); + clickSlot(gui, slotNum, 0, SlotActionType.SWAP); + clickSlot(gui, otherSlot, 0, SlotActionType.SWAP); + clickSlot(gui, slotNum, 0, SlotActionType.SWAP); } - private static void dragSplitItemsIntoSlots(GuiContainer gui, List targetSlots) + private static void dragSplitItemsIntoSlots(ContainerScreen gui, List targetSlots) { - Minecraft mc = Minecraft.getInstance(); - ItemStack stackInCursor = mc.player.inventory.getItemStack(); + MinecraftClient mc = MinecraftClient.getInstance(); + ItemStack stackInCursor = mc.player.inventory.getCursorStack(); if (isStackEmpty(stackInCursor)) { @@ -2395,11 +2409,11 @@ private static void dragSplitItemsIntoSlots(GuiContainer gui, List targ return; } - int numSlots = gui.inventorySlots.inventorySlots.size(); + int numSlots = gui.getContainer().slotList.size(); int loops = targetSlots.size(); // Start the drag - clickSlot(gui, -999, 0, ClickType.QUICK_CRAFT); + clickSlot(gui, -999, 0, SlotActionType.QUICK_CRAFT); for (int i = 0; i < loops; i++) { @@ -2410,11 +2424,11 @@ private static void dragSplitItemsIntoSlots(GuiContainer gui, List targ break; } - clickSlot(gui, targetSlots.get(i), 1, ClickType.QUICK_CRAFT); + clickSlot(gui, targetSlots.get(i), 1, SlotActionType.QUICK_CRAFT); } // End the drag - clickSlot(gui, -999, 2, ClickType.QUICK_CRAFT); + clickSlot(gui, -999, 2, SlotActionType.QUICK_CRAFT); } /************************************************************** @@ -2433,11 +2447,11 @@ public static boolean isStackEmpty(ItemStack stack) public static int getStackSize(ItemStack stack) { - return stack.getCount(); + return stack.getAmount(); } public static void setStackSize(ItemStack stack, int size) { - stack.setCount(size); + stack.setAmount(size); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java b/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java index ca76cdaca..7b71745ed 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java @@ -60,7 +60,7 @@ public boolean equals(Object obj) return false; } - return ItemStack.areItemStackTagsEqual(this.stack, other.stack); + return ItemStack.areTagsEqual(this.stack, other.stack); } return true; diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json new file mode 100644 index 000000000..61a3c02c3 --- /dev/null +++ b/src/main/resources/fabric.mod.json @@ -0,0 +1,35 @@ +{ + "schemaVersion": 1, + "id": "itemscroller", + "name": "Item Scroller", + "version": "${mod_version}", + + "description": "Move items in inventory GUIs by scrolling the mouse wheel or dragging over slots", + "authors": [ + "masa" + ], + "contact": { + "homepage": "https://minecraft.curseforge.com/projects/item-scroller", + "sources": "https://github.com/maruohon/itemscroller", + "twitter": "https://twitter.com/maruohon", + "discord": "https://discordapp.com/channels/211786369951989762/453662800460644354/" + }, + + "license": "LGPLv3", + + "environment": "client", + "entrypoints": { + "main": [ + "fi.dy.masa.itemscroller.ItemScroller" + ] + }, + "mixins": [ + "mixins.itemscroller.json" + ], + + "requires": { + "fabricloader": ">=0.4.0", + "fabric": "*", + "malilib": ">=0.9.5 <0.10.0" + } +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info deleted file mode 100644 index d4143bfd3..000000000 --- a/src/main/resources/mcmod.info +++ /dev/null @@ -1,16 +0,0 @@ -[ -{ - "modid": "itemscroller", - "name": "Item Scroller", - "description": "Move items in inventory GUIs by scrolling the mouse wheel over slots with items in them", - "version": "${mod_version}", - "mcversion": "${minecraft_version}", - "url": "http://minecraft.curseforge.com/projects/item-scroller", - "updateUrl": "", - "authorList": ["masa"], - "credits": "ChickenBones (original idea, in NEI)", - "logoFile": "", - "screenshots": [], - "dependencies": [] -} -] diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index c3179e56b..79a505833 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -1,16 +1,16 @@ { "required": true, "package": "fi.dy.masa.itemscroller.mixin", - "refmap": "mixins.itemscroller.refmap.json", - "minVersion": "0.6", + "compatibilityLevel": "JAVA_8", + "minVersion": "0.7", "client": [ - "IMixinGuiContainer", - "IMixinGuiMerchant", + "IMixinContainerScreen", "IMixinSlot", + "IMixinVillagerScreen", + "MixinCraftingTableContainer", "MixinGameRenderer", - "MixinContainer", - "MixinGuiScreen", - "MixinMinecraft" + "MixinMinecraftClient", + "MixinScreen" ], "injectors": { "defaultRequire": 1 diff --git a/src/main/resources/riftmod.json b/src/main/resources/riftmod.json deleted file mode 100644 index b293b5d01..000000000 --- a/src/main/resources/riftmod.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "id": "itemscroller", - "name": "Item Scroller", - "authors": [ "masa" ], - "listeners": [ "fi.dy.masa.itemscroller.ItemScroller" ] -} \ No newline at end of file From 18d3163bd7fc1bb3ab786325bdbe277705e3d4d7 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 10 May 2019 00:11:16 +0300 Subject: [PATCH 004/107] Fix mass crafting not doing anything --- build.properties | 2 +- src/main/java/fi/dy/masa/itemscroller/ItemScroller.java | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build.properties b/build.properties index 8b79d6abb..d7dc17dfa 100644 --- a/build.properties +++ b/build.properties @@ -5,7 +5,7 @@ mod_name = Item Scroller author = masa mod_file_name = itemscroller-fabric -mod_version = 0.14.2 +mod_version = 0.14.3 malilib_version = 0.9.5 diff --git a/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java b/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java index ab002718e..1be5148f6 100644 --- a/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java +++ b/src/main/java/fi/dy/masa/itemscroller/ItemScroller.java @@ -21,6 +21,7 @@ public class ItemScroller implements ModInitializer, ClientTickCallback public void onInitialize() { InitializationHandler.getInstance().registerInitializationHandler(new InitHandler()); + ClientTickCallback.EVENT.register(this); } @Override From 987a13d01b11df1de904f83c038c53b8d479a60f Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 23 May 2019 13:45:01 +0300 Subject: [PATCH 005/107] Update to Minecraft 1.14.2-pre3 --- build.gradle | 2 +- build.properties | 14 +- .../dy/masa/itemscroller/config/Configs.java | 6 +- .../masa/itemscroller/event/InputHandler.java | 24 +-- .../itemscroller/event/KeybindCallbacks.java | 20 +-- .../event/RenderEventHandler.java | 40 ++--- ...ava => IMixinAbstractContainerScreen.java} | 6 +- ...rScreen.java => IMixinMerchantScreen.java} | 6 +- .../itemscroller/mixin/MixinGameRenderer.java | 2 +- .../masa/itemscroller/mixin/MixinScreen.java | 2 +- .../itemscroller/recipes/CraftingHandler.java | 26 +-- .../itemscroller/recipes/RecipePattern.java | 4 +- .../itemscroller/recipes/RecipeStorage.java | 6 +- .../masa/itemscroller/util/AccessorUtils.java | 40 ++--- .../dy/masa/itemscroller/util/InputUtils.java | 4 +- .../itemscroller/util/InventoryUtils.java | 156 +++++++++--------- src/main/resources/mixins.itemscroller.json | 4 +- 17 files changed, 181 insertions(+), 181 deletions(-) rename src/main/java/fi/dy/masa/itemscroller/mixin/{IMixinContainerScreen.java => IMixinAbstractContainerScreen.java} (82%) rename src/main/java/fi/dy/masa/itemscroller/mixin/{IMixinVillagerScreen.java => IMixinMerchantScreen.java} (61%) diff --git a/build.gradle b/build.gradle index faf601807..2593331c7 100644 --- a/build.gradle +++ b/build.gradle @@ -27,7 +27,7 @@ dependencies { compile "com.google.code.findbugs:jsr305:3.0.2" // Fabric API. This is technically optional, but you probably want it anyway. - modCompile "net.fabricmc:fabric:" + config.fabric_version + modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version modCompile "fi.dy.masa.malilib:malilib-fabric-" + config.minecraft_version_out + ":" + config.malilib_version } diff --git a/build.properties b/build.properties index d7dc17dfa..c70213373 100644 --- a/build.properties +++ b/build.properties @@ -5,14 +5,14 @@ mod_name = Item Scroller author = masa mod_file_name = itemscroller-fabric -mod_version = 0.14.3 +mod_version = 0.14.4 -malilib_version = 0.9.5 +malilib_version = 0.9.6 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.14.0 -minecraft_version = 1.14 -mappings_version = 1.14+build.1 +minecraft_version_out = 1.14.2-pre3 +minecraft_version = 1.14.2 Pre-Release 3 +mappings_version = 1.14.2 Pre-Release 3+build.3 -fabric_version = 0.2.7+build.127 -fabric_loader_version = 0.4.2+build.132 +fabric_version = 0.3.0-pre+build.165 +fabric_loader_version = 0.4.7+build.147 diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index 91ceb6d84..da7a2cd87 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -16,8 +16,8 @@ import fi.dy.masa.malilib.config.options.ConfigBoolean; import fi.dy.masa.malilib.util.FileUtils; import fi.dy.masa.malilib.util.JsonUtils; -import net.minecraft.client.gui.container.CraftingTableScreen; -import net.minecraft.client.gui.ingame.PlayerInventoryScreen; +import net.minecraft.client.gui.screen.ingame.CraftingTableScreen; +import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.container.CraftingResultSlot; public class Configs implements IConfigHandler @@ -105,7 +105,7 @@ public static void loadFromFile() // "net.minecraft.client.gui.inventory.GuiCrafting,net.minecraft.inventory.SlotCrafting,0,1-9", // vanilla Crafting Table CraftingHandler.addCraftingGridDefinition(CraftingTableScreen.class.getName(), CraftingResultSlot.class.getName(), 0, new SlotRange(1, 9)); //"net.minecraft.client.gui.inventory.PlayerInventoryScreen,net.minecraft.inventory.SlotCrafting,0,1-4", // vanilla player inventory crafting grid - CraftingHandler.addCraftingGridDefinition(PlayerInventoryScreen.class.getName(), CraftingResultSlot.class.getName(), 0, new SlotRange(1, 4)); + CraftingHandler.addCraftingGridDefinition(InventoryScreen.class.getName(), CraftingResultSlot.class.getName(), 0, new SlotRange(1, 4)); } public static void saveToFile() diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index 4be7ac927..0d30f52a4 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -15,9 +15,9 @@ import fi.dy.masa.malilib.hotkeys.IKeyboardInputHandler; import fi.dy.masa.malilib.hotkeys.IMouseInputHandler; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.ContainerScreen; -import net.minecraft.client.gui.Screen; -import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.container.Slot; import net.minecraft.util.math.MathHelper; @@ -82,11 +82,11 @@ public boolean onMouseScroll(int mouseX, int mouseY, double amount) amount != 0 && mc != null && mc.player != null && - mc.currentScreen instanceof ContainerScreen && - (mc.currentScreen instanceof CreativePlayerInventoryScreen) == false && + mc.currentScreen instanceof AbstractContainerScreen && + (mc.currentScreen instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(mc.currentScreen.getClass().getName()) == false) { - ContainerScreen gui = (ContainerScreen) mc.currentScreen; + AbstractContainerScreen gui = (AbstractContainerScreen) mc.currentScreen; RecipeStorage recipes = this.callbacks.getRecipes(); // When scrolling while the recipe view is open, change the selection instead of moving items @@ -120,11 +120,11 @@ public boolean onMouseClick(int mouseX, int mouseY, int eventButton, boolean eve if (this.callbacks.functionalityEnabled() && mc != null && mc.player != null && - mc.currentScreen instanceof ContainerScreen && - (mc.currentScreen instanceof CreativePlayerInventoryScreen) == false && + mc.currentScreen instanceof AbstractContainerScreen && + (mc.currentScreen instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(mc.currentScreen.getClass().getName()) == false) { - ContainerScreen gui = (ContainerScreen) mc.currentScreen; + AbstractContainerScreen gui = (AbstractContainerScreen) mc.currentScreen; RecipeStorage recipes = this.callbacks.getRecipes(); Slot slot = AccessorUtils.getSlotUnderMouse(gui); @@ -194,14 +194,14 @@ public void onMouseMove(int mouseX, int mouseY) if (this.callbacks.functionalityEnabled() && mc != null && mc.player != null && - mc.currentScreen instanceof ContainerScreen && + mc.currentScreen instanceof AbstractContainerScreen && Configs.GUI_BLACKLIST.contains(mc.currentScreen.getClass().getName()) == false) { - this.handleDragging((ContainerScreen) mc.currentScreen, mc, mouseX, mouseY, false); + this.handleDragging((AbstractContainerScreen) mc.currentScreen, mc, mouseX, mouseY, false); } } - private boolean handleDragging(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) + private boolean handleDragging(AbstractContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) { MoveAction action = InventoryUtils.getActiveMoveAction(); diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index f70d6d810..fe9412633 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -16,10 +16,10 @@ import fi.dy.masa.malilib.hotkeys.IKeybind; import fi.dy.masa.malilib.hotkeys.KeyAction; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.ContainerScreen; -import net.minecraft.client.gui.Screen; -import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen; -import net.minecraft.client.gui.ingame.PlayerInventoryScreen; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.util.Window; import net.minecraft.container.Slot; import net.minecraft.sound.SoundEvents; @@ -97,12 +97,12 @@ else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) return true; } - if (this.disabled || mc == null || mc.player == null || (mc.currentScreen instanceof ContainerScreen) == false) + if (this.disabled || mc == null || mc.player == null || (mc.currentScreen instanceof AbstractContainerScreen) == false) { return false; } - ContainerScreen gui = (ContainerScreen) mc.currentScreen; + AbstractContainerScreen gui = (AbstractContainerScreen) mc.currentScreen; Slot slot = AccessorUtils.getSlotUnderMouse(gui); RecipeStorage recipes = this.getRecipes(); MoveAction moveAction = InputUtils.getDragMoveAction(key); @@ -134,7 +134,7 @@ else if (key == Hotkeys.KEY_DROP_ALL_MATCHING.getKeybind()) else if (key == Hotkeys.KEY_MOVE_STACK_TO_OFFHAND.getKeybind()) { // Swap the hovered stack to the Offhand - if ((gui instanceof PlayerInventoryScreen) && slot != null) + if ((gui instanceof InventoryScreen) && slot != null) { InventoryUtils.swapSlots(gui, slot.id, 45); return true; @@ -179,13 +179,13 @@ public void onTick(MinecraftClient mc) if (this.disabled == false && mc != null && mc.player != null && - mc.currentScreen instanceof ContainerScreen && - (mc.currentScreen instanceof CreativePlayerInventoryScreen) == false && + mc.currentScreen instanceof AbstractContainerScreen && + (mc.currentScreen instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(mc.currentScreen.getClass().getName()) == false && Hotkeys.KEY_MASS_CRAFT.getKeybind().isKeybindHeld()) { Screen guiScreen = mc.currentScreen; - ContainerScreen gui = (ContainerScreen) guiScreen; + AbstractContainerScreen gui = (AbstractContainerScreen) guiScreen; Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); if (outputSlot != null) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 3c3e00d0b..7bf42c709 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -11,10 +11,11 @@ import fi.dy.masa.itemscroller.util.AccessorUtils; import fi.dy.masa.itemscroller.util.InputUtils; import fi.dy.masa.itemscroller.util.InventoryUtils; +import net.minecraft.ChatFormat; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.ContainerScreen; import net.minecraft.client.gui.DrawableHelper; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.item.TooltipContext; import net.minecraft.client.render.BufferBuilder; import net.minecraft.client.render.GuiLighting; @@ -22,9 +23,8 @@ import net.minecraft.client.render.VertexFormats; import net.minecraft.client.util.Window; import net.minecraft.item.ItemStack; -import net.minecraft.text.StringTextComponent; -import net.minecraft.text.TextComponent; -import net.minecraft.text.TextFormat; +import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.TextComponent; import net.minecraft.util.math.Vec3d; public class RenderEventHandler @@ -42,9 +42,9 @@ public void onDrawBackgroundPost() { MinecraftClient mc = MinecraftClient.getInstance(); - if (mc.currentScreen instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) + if (mc.currentScreen instanceof AbstractContainerScreen && InputUtils.isRecipeViewOpen()) { - ContainerScreen gui = (ContainerScreen) mc.currentScreen; + AbstractContainerScreen gui = (AbstractContainerScreen) mc.currentScreen; RecipeStorage recipes = KeybindCallbacks.getInstance().getRecipes(); final int count = recipes.getRecipeCount(); @@ -60,9 +60,9 @@ public void onDrawScreenPost() { MinecraftClient mc = MinecraftClient.getInstance(); - if (mc.currentScreen instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) + if (mc.currentScreen instanceof AbstractContainerScreen && InputUtils.isRecipeViewOpen()) { - ContainerScreen gui = (ContainerScreen) mc.currentScreen; + AbstractContainerScreen gui = (AbstractContainerScreen) mc.currentScreen; RecipeStorage recipes = KeybindCallbacks.getInstance().getRecipes(); Window window = mc.window; @@ -96,7 +96,7 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) } } - private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, ContainerScreen gui, MinecraftClient mc) + private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, AbstractContainerScreen gui, MinecraftClient mc) { ItemStack stack = recipe.getResult(); @@ -106,7 +106,7 @@ private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, Co } } - public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, ContainerScreen gui, MinecraftClient mc) + public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, AbstractContainerScreen gui, MinecraftClient mc) { if (InputUtils.isRecipeViewOpen()) { @@ -139,7 +139,7 @@ public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, Con return -1; } - private void renderStoredRecipeStack(int recipeId, int recipeCount, ItemStack stack, ContainerScreen gui, MinecraftClient mc, boolean selected) + private void renderStoredRecipeStack(int recipeId, int recipeCount, ItemStack stack, AbstractContainerScreen gui, MinecraftClient mc, boolean selected) { TextRenderer font = mc.textRenderer; final String indexStr = String.valueOf(recipeId + 1); @@ -168,7 +168,7 @@ private void renderStoredRecipeStack(int recipeId, int recipeCount, ItemStack st font.draw(indexStr, (int) (x - scale * strWidth), (int) (y + (entryHeight - font.fontHeight) / 2 - 2), 0xC0C0C0); } - private void renderRecipeItems(RecipePattern recipe, int recipeCount, ContainerScreen gui, MinecraftClient mc) + private void renderRecipeItems(RecipePattern recipe, int recipeCount, AbstractContainerScreen gui, MinecraftClient mc) { RecipeLocation location = this.getRecipeLocation(recipe, recipeCount, gui, mc); @@ -185,7 +185,7 @@ private void renderRecipeItems(RecipePattern recipe, int recipeCount, ContainerS } } - private RecipeLocation getRecipeLocation(RecipePattern recipe, int recipeCount, ContainerScreen gui, MinecraftClient mc) + private RecipeLocation getRecipeLocation(RecipePattern recipe, int recipeCount, AbstractContainerScreen gui, MinecraftClient mc) { Window window = mc.window; final int verticalGap = 40; @@ -207,7 +207,7 @@ private RecipeLocation getRecipeLocation(RecipePattern recipe, int recipeCount, return new RecipeLocation(x, y, scale, stackBaseHeight, recipeDimensions); } - private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCount, ContainerScreen gui, MinecraftClient mc) + private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCount, AbstractContainerScreen gui, MinecraftClient mc) { RecipeLocation location = this.getRecipeLocation(recipe, recipeCount, gui, mc); final float stackWidth = location.scale * location.stackBaseHeight; @@ -323,19 +323,19 @@ public static void enableStandardItemLighting(float scale) GlStateManager.lightModel(2899, GuiLighting.singletonBuffer(ambientLightStrength, ambientLightStrength, ambientLightStrength, 1.0F)); } - private void renderStackToolTip(int x, int y, ItemStack stack, ContainerScreen gui, MinecraftClient mc) + private void renderStackToolTip(int x, int y, ItemStack stack, AbstractContainerScreen gui, MinecraftClient mc) { - List list = stack.getTooltipText(mc.player, mc.options.advancedItemTooltips ? TooltipContext.Default.ADVANCED : TooltipContext.Default.NORMAL); + List list = stack.getTooltipText(mc.player, mc.options.advancedItemTooltips ? TooltipContext.Default.ADVANCED : TooltipContext.Default.NORMAL); for (int i = 0; i < list.size(); ++i) { if (i == 0) { - list.set(i, new StringTextComponent(stack.getRarity().formatting + list.get(i).getString())); + list.set(i, new TextComponent(stack.getRarity().formatting + list.get(i).getString())); } else { - list.set(i, new StringTextComponent(TextFormat.GRAY + list.get(i).getString())); + list.set(i, new TextComponent(ChatFormat.GRAY + list.get(i).getString())); } } @@ -344,7 +344,7 @@ private void renderStackToolTip(int x, int y, ItemStack stack, ContainerScreen components, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, TextRenderer font) + private static void drawHoveringText(@Nonnull final ItemStack stack, List components, int mouseX, int mouseY, int screenWidth, int screenHeight, int maxTextWidth, TextRenderer font) { List textLines = new ArrayList<>(); @@ -356,7 +356,7 @@ private static void drawHoveringText(@Nonnull final ItemStack stack, List CRAFTING_GRID_SLOTS = new HashMap(); - private static final Set>> CRAFTING_GUIS = new HashSet<>(); + private static final Set>> CRAFTING_GUIS = new HashSet<>(); public static void clearDefinitions() { @@ -27,7 +27,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot { try { - Class> guiClass = (Class>) Class.forName(guiClassName); + Class> guiClass = (Class>) Class.forName(guiClassName); Class slotClass = (Class) Class.forName(slotClassName); CRAFTING_GRID_SLOTS.put(new CraftingOutputSlot(guiClass, slotClass, outputSlot), range); @@ -46,7 +46,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot public static boolean isCraftingGui(Screen gui) { - return (gui instanceof ContainerScreen) && CRAFTING_GUIS.contains(((ContainerScreen) gui).getClass()); + return (gui instanceof AbstractContainerScreen) && CRAFTING_GUIS.contains(((AbstractContainerScreen) gui).getClass()); } /** @@ -56,13 +56,13 @@ public static boolean isCraftingGui(Screen gui) * @return the SlotRange of the crafting grid, or null, if the given slot is not a crafting output slot */ @Nullable - public static SlotRange getCraftingGridSlots(ContainerScreen gui, Slot slot) + public static SlotRange getCraftingGridSlots(AbstractContainerScreen gui, Slot slot) { return CRAFTING_GRID_SLOTS.get(CraftingOutputSlot.from(gui, slot)); } @Nullable - public static Slot getFirstCraftingOutputSlotForGui(ContainerScreen gui) + public static Slot getFirstCraftingOutputSlotForGui(AbstractContainerScreen gui) { if (CRAFTING_GUIS.contains(gui.getClass())) { @@ -80,11 +80,11 @@ public static Slot getFirstCraftingOutputSlotForGui(ContainerScreen> guiClass; + private final Class> guiClass; private final Class slotClass; private final int outputSlot; - private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) + private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) { this.guiClass = guiClass; this.slotClass = slotClass; @@ -92,12 +92,12 @@ private CraftingOutputSlot (Class> guiClass, Class< } @SuppressWarnings("unchecked") - public static CraftingOutputSlot from(ContainerScreen gui, Slot slot) + public static CraftingOutputSlot from(AbstractContainerScreen gui, Slot slot) { - return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); + return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); } - public Class> getGuiClass() + public Class> getGuiClass() { return this.guiClass; } @@ -112,7 +112,7 @@ public int getSlotNumber() return this.outputSlot; } - public boolean matches(ContainerScreen gui, Slot slot, int outputSlot) + public boolean matches(AbstractContainerScreen gui, Slot slot, int outputSlot) { return outputSlot == this.outputSlot && gui.getClass() == this.guiClass && slot.getClass() == this.slotClass; } diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java index 0f5ebd28a..85aff08d3 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java @@ -4,7 +4,7 @@ import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; import fi.dy.masa.itemscroller.util.Constants; import fi.dy.masa.itemscroller.util.InventoryUtils; -import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.container.Container; import net.minecraft.container.Slot; import net.minecraft.item.ItemStack; @@ -45,7 +45,7 @@ public void ensureRecipeSizeAndClearRecipe(int size) this.clearRecipe(); } - public void storeCraftingRecipe(Slot slot, ContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipe(Slot slot, AbstractContainerScreen gui, boolean clearIfEmpty) { SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java index 416d7b7f4..d7df84105 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java @@ -8,7 +8,7 @@ import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.util.Constants; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.options.ServerEntry; import net.minecraft.container.Slot; import net.minecraft.nbt.CompoundTag; @@ -85,12 +85,12 @@ public RecipePattern getSelectedRecipe() return this.getRecipe(this.getSelection()); } - public void storeCraftingRecipeToCurrentSelection(Slot slot, ContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipeToCurrentSelection(Slot slot, AbstractContainerScreen gui, boolean clearIfEmpty) { this.storeCraftingRecipe(this.getSelection(), slot, gui, clearIfEmpty); } - public void storeCraftingRecipe(int index, Slot slot, ContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipe(int index, Slot slot, AbstractContainerScreen gui, boolean clearIfEmpty) { this.getRecipe(index).storeCraftingRecipe(slot, gui, clearIfEmpty); this.dirty = true; diff --git a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java index feee63f0e..a9bb18715 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java @@ -1,53 +1,53 @@ package fi.dy.masa.itemscroller.util; -import fi.dy.masa.itemscroller.mixin.IMixinContainerScreen; -import fi.dy.masa.itemscroller.mixin.IMixinVillagerScreen; +import fi.dy.masa.itemscroller.mixin.IMixinAbstractContainerScreen; import fi.dy.masa.itemscroller.mixin.IMixinSlot; -import net.minecraft.client.gui.ContainerScreen; -import net.minecraft.client.gui.container.VillagerScreen; +import fi.dy.masa.itemscroller.mixin.IMixinMerchantScreen; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.MerchantScreen; import net.minecraft.container.Slot; import net.minecraft.container.SlotActionType; public class AccessorUtils { - public static Slot getSlotUnderMouse(ContainerScreen gui) + public static Slot getSlotUnderMouse(AbstractContainerScreen gui) { - return ((IMixinContainerScreen) gui).getHoveredSlot(); + return ((IMixinAbstractContainerScreen) gui).getHoveredSlot(); } - public static Slot getSlotAtPosition(ContainerScreen gui, int x, int y) + public static Slot getSlotAtPosition(AbstractContainerScreen gui, int x, int y) { - return ((IMixinContainerScreen) gui).getSlotAtPositionInvoker(x, y); + return ((IMixinAbstractContainerScreen) gui).getSlotAtPositionInvoker(x, y); } - public static void handleMouseClick(ContainerScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) + public static void handleMouseClick(AbstractContainerScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) { - ((IMixinContainerScreen) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); + ((IMixinAbstractContainerScreen) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); } - public static int getGuiLeft(ContainerScreen gui) + public static int getGuiLeft(AbstractContainerScreen gui) { - return ((IMixinContainerScreen) gui).getGuiLeft(); + return ((IMixinAbstractContainerScreen) gui).getGuiLeft(); } - public static int getGuiTop(ContainerScreen gui) + public static int getGuiTop(AbstractContainerScreen gui) { - return ((IMixinContainerScreen) gui).getGuiTop(); + return ((IMixinAbstractContainerScreen) gui).getGuiTop(); } - public static int getGuiXSize(ContainerScreen gui) + public static int getGuiXSize(AbstractContainerScreen gui) { - return ((IMixinContainerScreen) gui).getGuiSizeX(); + return ((IMixinAbstractContainerScreen) gui).getGuiSizeX(); } - public static int getGuiYSize(ContainerScreen gui) + public static int getGuiYSize(AbstractContainerScreen gui) { - return ((IMixinContainerScreen) gui).getGuiSizeY(); + return ((IMixinAbstractContainerScreen) gui).getGuiSizeY(); } - public static int getSelectedMerchantRecipe(VillagerScreen gui) + public static int getSelectedMerchantRecipe(MerchantScreen gui) { - return ((IMixinVillagerScreen) gui).getSelectedMerchantRecipe(); + return ((IMixinMerchantScreen) gui).getSelectedMerchantRecipe(); } public static int getSlotIndex(Slot slot) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index 91636f38d..b5b32e83c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -5,7 +5,7 @@ import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.malilib.hotkeys.IKeybind; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.ContainerScreen; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; public class InputUtils { @@ -19,7 +19,7 @@ public static boolean isRecipeViewOpen() CraftingHandler.isCraftingGui(mc.currentScreen); } - public static boolean canShiftDropItems(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY) + public static boolean canShiftDropItems(AbstractContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY) { if (InventoryUtils.isStackEmpty(mc.player.inventory.getCursorStack()) == false) { diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 726a457a5..a11877d6b 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -17,10 +17,10 @@ import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.ContainerScreen; -import net.minecraft.client.gui.container.VillagerScreen; -import net.minecraft.client.gui.ingame.CreativePlayerInventoryScreen; -import net.minecraft.client.gui.ingame.PlayerInventoryScreen; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.client.gui.screen.ingame.InventoryScreen; +import net.minecraft.client.gui.screen.ingame.MerchantScreen; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; import net.minecraft.container.Container; @@ -34,8 +34,8 @@ import net.minecraft.inventory.Inventory; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; +import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.RecipeType; -import net.minecraft.recipe.crafting.CraftingRecipe; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; import net.minecraft.village.TradeOffer; @@ -97,7 +97,7 @@ public static String getStackString(ItemStack stack) return ""; } - public static void debugPrintSlotInfo(ContainerScreen gui, Slot slot) + public static void debugPrintSlotInfo(AbstractContainerScreen gui, Slot slot) { if (slot == null) { @@ -116,7 +116,7 @@ public static void debugPrintSlotInfo(ContainerScreen gui, gui.getContainer().slotList.size())); } - private static boolean isValidSlot(Slot slot, ContainerScreen gui, boolean requireItems) + private static boolean isValidSlot(Slot slot, AbstractContainerScreen gui, boolean requireItems) { Container container = gui.getContainer(); @@ -126,7 +126,7 @@ private static boolean isValidSlot(Slot slot, ContainerScreen gui, Slot slot) + public static boolean isCraftingSlot(AbstractContainerScreen gui, Slot slot) { return slot != null && CraftingHandler.getCraftingGridSlots(gui, slot) != null; } @@ -147,7 +147,7 @@ private static boolean inventoryExistsAbove(Slot slot, Container container) return false; } - public static boolean canShiftPlaceItems(ContainerScreen gui) + public static boolean canShiftPlaceItems(AbstractContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -158,7 +158,7 @@ public static boolean canShiftPlaceItems(ContainerScreen gu slot.hasStack() == false && slot.canInsert(stackCursor); } - public static boolean tryMoveItems(ContainerScreen gui, RecipeStorage recipes, boolean scrollingUp) + public static boolean tryMoveItems(AbstractContainerScreen gui, RecipeStorage recipes, boolean scrollingUp) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -170,7 +170,7 @@ public static boolean tryMoveItems(ContainerScreen gui, Rec } // Villager handling only happens when scrolling over the trade output slot - boolean villagerHandling = Configs.Toggles.SCROLL_VILLAGER.getBooleanValue() && gui instanceof VillagerScreen && slot instanceof TradeOutputSlot; + boolean villagerHandling = Configs.Toggles.SCROLL_VILLAGER.getBooleanValue() && gui instanceof MerchantScreen && slot instanceof TradeOutputSlot; boolean craftingHandling = Configs.Toggles.CRAFTING_FEATURES.getBooleanValue() && isCraftingSlot(gui, slot); boolean keyActiveMoveEverything = Hotkeys.MODIFIER_MOVE_EVERYTHING.getKeybind().isKeybindHeld(); boolean keyActiveMoveMatching = Hotkeys.MODIFIER_MOVE_MATCHING.getKeybind().isKeybindHeld(); @@ -204,7 +204,7 @@ public static boolean tryMoveItems(ContainerScreen gui, Rec if (villagerHandling) { - return tryMoveItemsVillager((VillagerScreen) gui, slot, moveToOtherInventory, keyActiveMoveStacks); + return tryMoveItemsVillager((MerchantScreen) gui, slot, moveToOtherInventory, keyActiveMoveStacks); } if ((Configs.Toggles.SCROLL_SINGLE.getBooleanValue() == false && nonSingleMove == false) || @@ -250,7 +250,7 @@ else if (getStackSize(stack) < slot.getMaxStackAmount(stack)) return false; } - public static boolean dragMoveItems(ContainerScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) + public static boolean dragMoveItems(AbstractContainerScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) { @@ -328,9 +328,9 @@ public static boolean dragMoveItems(ContainerScreen gui, Mi if (slot != null) { - if (gui instanceof CreativePlayerInventoryScreen) + if (gui instanceof CreativeInventoryScreen) { - boolean isPlayerInv = ((CreativePlayerInventoryScreen) gui).method_2469() == ItemGroup.INVENTORY.getIndex(); + boolean isPlayerInv = ((CreativeInventoryScreen) gui).method_2469() == ItemGroup.INVENTORY.getIndex(); int slotNumber = isPlayerInv ? AccessorUtils.getSlotIndex(slot) : slot.id; slotNumberLast = slotNumber; } @@ -353,9 +353,9 @@ public static void stopDragging() DRAGGED_SLOTS.clear(); } - private static boolean dragMoveFromSlotAtPosition(ContainerScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPosition(AbstractContainerScreen gui, int x, int y, MoveAction action) { - if (gui instanceof CreativePlayerInventoryScreen) + if (gui instanceof CreativeInventoryScreen) { return dragMoveFromSlotAtPositionCreative(gui, x, y, action); } @@ -424,9 +424,9 @@ private static boolean dragMoveFromSlotAtPosition(ContainerScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPositionCreative(AbstractContainerScreen gui, int x, int y, MoveAction action) { - CreativePlayerInventoryScreen guiCreative = (CreativePlayerInventoryScreen) gui; + CreativeInventoryScreen guiCreative = (CreativeInventoryScreen) gui; Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); boolean isPlayerInv = guiCreative.method_2469() == ItemGroup.INVENTORY.getIndex(); @@ -518,7 +518,7 @@ private static boolean dragMoveFromSlotAtPositionCreative(ContainerScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) + public static void dropStacks(AbstractContainerScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) { if (slotReference != null && isStackEmpty(stackReference) == false) { @@ -538,7 +538,7 @@ public static void dropStacks(ContainerScreen gui, ItemStac } } - public static boolean shiftDropItems(ContainerScreen gui) + public static boolean shiftDropItems(AbstractContainerScreen gui) { ItemStack stackReference = MinecraftClient.getInstance().player.inventory.getCursorStack(); @@ -556,7 +556,7 @@ public static boolean shiftDropItems(ContainerScreen gui) return false; } - public static boolean shiftPlaceItems(Slot slot, ContainerScreen gui) + public static boolean shiftPlaceItems(Slot slot, AbstractContainerScreen gui) { // Left click to place the items from the cursor to the slot leftClickSlot(gui, slot.id); @@ -611,7 +611,7 @@ public static void checkForItemPickup(MinecraftClient mc) } } - private static boolean tryMoveItemsVillager(VillagerScreen gui, Slot slot, boolean moveToOtherInventory, boolean fullStacks) + private static boolean tryMoveItemsVillager(MerchantScreen gui, Slot slot, boolean moveToOtherInventory, boolean fullStacks) { if (fullStacks) { @@ -648,7 +648,7 @@ else if (slot.hasStack()) return false; } - private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ContainerScreen gui) + private static boolean tryMoveSingleItemToOtherInventory(Slot slot, AbstractContainerScreen gui) { ItemStack stackOrig = slot.getStack(); Container container = gui.getContainer(); @@ -700,7 +700,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ContainerScr return false; } - private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, ContainerScreen gui) + private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, AbstractContainerScreen gui) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -780,7 +780,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, Container // No temporary slot found, try to move the stack manually else { - boolean treatHotbarAsDifferent = gui.getClass() == PlayerInventoryScreen.class; + boolean treatHotbarAsDifferent = gui.getClass() == InventoryScreen.class; List slots = getSlotNumbersOfEmptySlots(gui.getContainer(), slot, false, treatHotbarAsDifferent, false); if (slots.isEmpty()) @@ -824,7 +824,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, Container return false; } - private static boolean tryMoveSingleItemToThisInventory(Slot slot, ContainerScreen gui) + private static boolean tryMoveSingleItemToThisInventory(Slot slot, AbstractContainerScreen gui) { Container container = gui.getContainer(); ItemStack stackOrig = slot.getStack(); @@ -873,12 +873,12 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, ContainerScre return false; } - public static void tryMoveStacks(Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + public static void tryMoveStacks(Slot slot, AbstractContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { tryMoveStacks(slot.getStack(), slot, gui, matchingOnly, toOtherInventory, firstOnly); } - private static void tryMoveStacks(ItemStack stackReference, Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + private static void tryMoveStacks(ItemStack stackReference, Slot slot, AbstractContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { Container container = gui.getContainer(); final int maxSlot = container.slotList.size() - 1; @@ -913,7 +913,7 @@ private static void tryMoveStacks(ItemStack stackReference, Slot slot, Container } } - private static void tryMoveItemsToMerchantBuySlots(VillagerScreen gui, boolean fillStacks) + private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, boolean fillStacks) { TraderOfferList list = gui.getContainer().getRecipes(); int index = AccessorUtils.getSelectedMerchantRecipe(gui); @@ -944,7 +944,7 @@ private static void tryMoveItemsToMerchantBuySlots(VillagerScreen gui, boolean f } } - private static void fillBuySlot(ContainerScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) + private static void fillBuySlot(AbstractContainerScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) { Slot slot = gui.getContainer().getSlot(slotNum); ItemStack existingStack = slot.getStack(); @@ -964,7 +964,7 @@ private static void fillBuySlot(ContainerScreen gui, int sl } } - public static void handleRecipeClick(ContainerScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, + public static void handleRecipeClick(AbstractContainerScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, boolean isLeftClick, boolean isRightClick, boolean isPickBlock, boolean isShiftDown) { if (isLeftClick || isRightClick) @@ -1025,7 +1025,7 @@ else if (isPickBlock) } } - public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, ContainerScreen gui, boolean fillStacks) + public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, AbstractContainerScreen gui, boolean fillStacks) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1035,13 +1035,13 @@ public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, Contain } } - public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, ContainerScreen gui) + public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, AbstractContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); loadRecipeItemsToGridForOutputSlot(recipe, gui, slot); } - private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, ContainerScreen gui, Slot outputSlot) + private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, AbstractContainerScreen gui, Slot outputSlot) { if (outputSlot != null && isCraftingSlot(gui, outputSlot) && isStackEmpty(recipe.getResult()) == false) { @@ -1049,7 +1049,7 @@ private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, Con } } - private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, ContainerScreen gui, + private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, AbstractContainerScreen gui, boolean moveToOtherInventory, boolean moveStacks, boolean moveEverything) { RecipePattern recipe = recipes.getSelectedRecipe(); @@ -1093,7 +1093,7 @@ else if (moveToOtherInventory == false && isStackEmpty(stackRecipeOutput) == fal return false; } - private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, ContainerScreen gui) + private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, AbstractContainerScreen gui) { ItemStack result = recipe.getResult(); int failSafe = 1024; @@ -1117,7 +1117,7 @@ private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, } } - public static void clearFirstCraftingGridOfItems(RecipePattern recipe, ContainerScreen gui, boolean clearNonMatchingOnly) + public static void clearFirstCraftingGridOfItems(RecipePattern recipe, AbstractContainerScreen gui, boolean clearNonMatchingOnly) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1128,7 +1128,7 @@ public static void clearFirstCraftingGridOfItems(RecipePattern recipe, Container } } - public static void clearFirstCraftingGridOfAllItems(ContainerScreen gui) + public static void clearFirstCraftingGridOfAllItems(AbstractContainerScreen gui) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1139,7 +1139,7 @@ public static void clearFirstCraftingGridOfAllItems(ContainerScreen gui, SlotRange range, boolean clearNonMatchingOnly) + private static boolean clearCraftingGridOfItems(RecipePattern recipe, AbstractContainerScreen gui, SlotRange range, boolean clearNonMatchingOnly) { final int invSlots = gui.getContainer().slotList.size(); final int rangeSlots = range.getSlotCount(); @@ -1166,7 +1166,7 @@ private static boolean clearCraftingGridOfItems(RecipePattern recipe, ContainerS return true; } - private static boolean clearCraftingGridOfAllItems(ContainerScreen gui, SlotRange range) + private static boolean clearCraftingGridOfAllItems(AbstractContainerScreen gui, SlotRange range) { final int invSlots = gui.getContainer().slotList.size(); final int rangeSlots = range.getSlotCount(); @@ -1191,7 +1191,7 @@ private static boolean clearCraftingGridOfAllItems(ContainerScreen gui, boolean fillStacks) + private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slot slot, AbstractContainerScreen gui, boolean fillStacks) { Container container = gui.getContainer(); int numSlots = container.slotList.size(); @@ -1236,7 +1236,7 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slo return false; } - private static void fillCraftingGrid(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void fillCraftingGrid(AbstractContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { Container container = gui.getContainer(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1318,7 +1318,7 @@ private static void fillCraftingGrid(ContainerScreen gui, S } } - public static void rightClickCraftOneStack(ContainerScreen gui) + public static void rightClickCraftOneStack(AbstractContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1350,7 +1350,7 @@ public static void rightClickCraftOneStack(ContainerScreen } } - public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe, ContainerScreen gui) + public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe, AbstractContainerScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1376,7 +1376,7 @@ public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe } } - public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, ContainerScreen gui) + public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, AbstractContainerScreen gui) { if (isStackEmpty(recipe.getResult()) == false) { @@ -1408,7 +1408,7 @@ public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, } } - public static void throwAllCraftingResultsToGround(RecipePattern recipe, ContainerScreen gui) + public static void throwAllCraftingResultsToGround(RecipePattern recipe, AbstractContainerScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1418,7 +1418,7 @@ public static void throwAllCraftingResultsToGround(RecipePattern recipe, Contain } } - private static int putSingleItemIntoSlots(ContainerScreen gui, List targetSlots, int startIndex) + private static int putSingleItemIntoSlots(AbstractContainerScreen gui, List targetSlots, int startIndex) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); @@ -1449,7 +1449,7 @@ private static int putSingleItemIntoSlots(ContainerScreen g return count; } - public static void moveOneSetOfItemsFromSlotToPlayerInventory(ContainerScreen gui, Slot slot) + public static void moveOneSetOfItemsFromSlotToPlayerInventory(AbstractContainerScreen gui, Slot slot) { leftClickSlot(gui, slot.id); @@ -1468,7 +1468,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void moveOneRecipeItemIntoCraftingGrid(AbstractContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { Container container = gui.getContainer(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1515,7 +1515,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(ContainerScreen gui, List slotNumbers) + private static boolean moveItemFromCursorToSlots(AbstractContainerScreen gui, List slotNumbers) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -1533,7 +1533,7 @@ private static boolean moveItemFromCursorToSlots(ContainerScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) + private static void moveItemsFromInventory(AbstractContainerScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) { Container container = gui.getContainer(); @@ -1821,7 +1821,7 @@ private static int getTargetSlot(Container container, ItemStack[] originalStacks } /* - private void clickSlotsToMoveItems(Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory) + private void clickSlotsToMoveItems(Slot slot, AbstractContainerScreen gui, boolean matchingOnly, boolean toOtherInventory) { for (Slot slotTmp : gui.getContainer().slotList) { @@ -1841,7 +1841,7 @@ private void clickSlotsToMoveItems(Slot slot, ContainerScreen gui, boolean toOtherInventory) + private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, AbstractContainerScreen gui, boolean toOtherInventory) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1877,7 +1877,7 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, ContainerScreen } } - private static boolean clickSlotsToMoveSingleItem(ContainerScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveSingleItem(AbstractContainerScreen gui, int slotFrom, int slotTo) { //System.out.println("clickSlotsToMoveSingleItem(from: " + slotFrom + ", to: " + slotTo + ")"); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1912,7 +1912,7 @@ private static boolean clickSlotsToMoveSingleItem(ContainerScreen gui, int slotFrom) + private static boolean clickSlotsToMoveSingleItemByShiftClick(AbstractContainerScreen gui, int slotFrom) { MinecraftClient mc = MinecraftClient.getInstance(); Slot slot = gui.getContainer().slotList.get(slotFrom); @@ -1957,7 +1957,7 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(ContainerScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveItems(AbstractContainerScreen gui, int slotFrom, int slotTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1990,7 +1990,7 @@ private static boolean clickSlotsToMoveItems(ContainerScreen gui, int slotNum) + public static void dropStacksUntilEmpty(AbstractContainerScreen gui, int slotNum) { if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) { @@ -2004,7 +2004,7 @@ public static void dropStacksUntilEmpty(ContainerScreen gui } } - public static void dropStacksWhileHasItem(ContainerScreen gui, int slotNum, ItemStack stackReference) + public static void dropStacksWhileHasItem(AbstractContainerScreen gui, int slotNum, ItemStack stackReference) { if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) { @@ -2018,7 +2018,7 @@ public static void dropStacksWhileHasItem(ContainerScreen g } } - private static boolean shiftClickSlotWithCheck(ContainerScreen gui, int slotNum) + private static boolean shiftClickSlotWithCheck(AbstractContainerScreen gui, int slotNum) { Slot slot = gui.getContainer().getSlot(slotNum); @@ -2033,7 +2033,7 @@ private static boolean shiftClickSlotWithCheck(ContainerScreen gui, Slot slot, boolean moveUp, MoveAmount amount) + public static boolean tryMoveItemsVertically(AbstractContainerScreen gui, Slot slot, boolean moveUp, MoveAmount amount) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -2070,7 +2070,7 @@ else if (amount == MoveAmount.ALL_MATCHING) return true; } - private static void moveMatchingStacksToSlots(ContainerScreen gui, Slot slot, boolean moveUp) + private static void moveMatchingStacksToSlots(AbstractContainerScreen gui, Slot slot, boolean moveUp) { List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, true, slot.getStack(), true, true, false); List targetSlots = getSlotNumbersOfEmptySlots(gui.getContainer(), slot, false, true, false); @@ -2093,7 +2093,7 @@ private static void moveMatchingStacksToSlots(ContainerScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) + private static Slot moveStackToSlots(AbstractContainerScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2140,7 +2140,7 @@ private static Slot moveStackToSlots(ContainerScreen gui, S return lastSlot; } - private static void moveOneItemToFirstValidSlot(ContainerScreen gui, Slot slotFrom, List slotsTo) + private static void moveOneItemToFirstValidSlot(AbstractContainerScreen gui, Slot slotFrom, List slotsTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2205,7 +2205,7 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Co return slotNumbers; } - public static void tryClearCursor(ContainerScreen gui, MinecraftClient mc) + public static void tryClearCursor(AbstractContainerScreen gui, MinecraftClient mc) { ItemStack stackCursor = mc.player.inventory.getCursorStack(); @@ -2306,7 +2306,7 @@ public int compare(Integer slotNum1, Integer slotNum2) } } - public static void clickSlot(ContainerScreen gui, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(AbstractContainerScreen gui, int slotNum, int mouseButton, SlotActionType type) { if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) { @@ -2328,7 +2328,7 @@ public static void clickSlot(ContainerScreen gui, int slotN } } - public static void clickSlot(ContainerScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(AbstractContainerScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) { try { @@ -2341,59 +2341,59 @@ public static void clickSlot(ContainerScreen gui, Slot slot } } - public static void leftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) + public static void leftClickSlot(AbstractContainerScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(ContainerScreen gui, Slot slot, int slotNumber) + public static void rightClickSlot(AbstractContainerScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) + public static void shiftClickSlot(AbstractContainerScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.QUICK_MOVE); } - public static void leftClickSlot(ContainerScreen gui, int slotNum) + public static void leftClickSlot(AbstractContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(ContainerScreen gui, int slotNum) + public static void rightClickSlot(AbstractContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(ContainerScreen gui, int slotNum) + public static void shiftClickSlot(AbstractContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.QUICK_MOVE); } - public static void dropItemsFromCursor(ContainerScreen gui) + public static void dropItemsFromCursor(AbstractContainerScreen gui) { clickSlot(gui, -999, 0, SlotActionType.PICKUP); } - public static void dropItem(ContainerScreen gui, int slotNum) + public static void dropItem(AbstractContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.THROW); } - public static void dropStack(ContainerScreen gui, int slotNum) + public static void dropStack(AbstractContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.THROW); } - public static void swapSlots(ContainerScreen gui, int slotNum, int otherSlot) + public static void swapSlots(AbstractContainerScreen gui, int slotNum, int otherSlot) { clickSlot(gui, slotNum, 0, SlotActionType.SWAP); clickSlot(gui, otherSlot, 0, SlotActionType.SWAP); clickSlot(gui, slotNum, 0, SlotActionType.SWAP); } - private static void dragSplitItemsIntoSlots(ContainerScreen gui, List targetSlots) + private static void dragSplitItemsIntoSlots(AbstractContainerScreen gui, List targetSlots) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 79a505833..c24bc5f8d 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -4,9 +4,9 @@ "compatibilityLevel": "JAVA_8", "minVersion": "0.7", "client": [ - "IMixinContainerScreen", + "IMixinAbstractContainerScreen", + "IMixinMerchantScreen", "IMixinSlot", - "IMixinVillagerScreen", "MixinCraftingTableContainer", "MixinGameRenderer", "MixinMinecraftClient", From 20ce92c56f773e87f7e4dcc5e285b5ef0fb9ae7d Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Mon, 27 May 2019 16:41:16 +0300 Subject: [PATCH 006/107] Update to Minecraft 1.14.2 (just a version bump) --- build.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index c70213373..a96665129 100644 --- a/build.properties +++ b/build.properties @@ -10,9 +10,9 @@ mod_version = 0.14.4 malilib_version = 0.9.6 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.14.2-pre3 -minecraft_version = 1.14.2 Pre-Release 3 -mappings_version = 1.14.2 Pre-Release 3+build.3 +minecraft_version_out = 1.14.2 +minecraft_version = 1.14.2 +mappings_version = 1.14.2+build.1 -fabric_version = 0.3.0-pre+build.165 -fabric_loader_version = 0.4.7+build.147 +fabric_version = 0.3.0+build.170 +fabric_loader_version = 0.4.8+build.154 From 21059b8642fa78d61484619c2cffa94948170e26 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 31 May 2019 19:54:44 +0300 Subject: [PATCH 007/107] Update some build script and metadata things --- build.gradle | 2 +- src/main/resources/fabric.mod.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index faf601807..276821cc3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.2.2-SNAPSHOT' + id 'fabric-loom' version '0.2.3-SNAPSHOT' id 'maven-publish' } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 61a3c02c3..42b7c7712 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -27,8 +27,7 @@ "mixins.itemscroller.json" ], - "requires": { - "fabricloader": ">=0.4.0", + "depends": { "fabric": "*", "malilib": ">=0.9.5 <0.10.0" } From 046e412d468ff3cb3b36a245ad6ae6891aa04f19 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sun, 9 Jun 2019 19:53:35 +0300 Subject: [PATCH 008/107] malilib version bump --- build.properties | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.properties b/build.properties index 6de9d570a..0d236a48d 100644 --- a/build.properties +++ b/build.properties @@ -7,8 +7,10 @@ author = masa mod_file_name = itemscroller-rift mod_version = 0.15.0-dev +# Required malilib version +malilib_version = 0.10.0-dev.18 + # Minecraft, Forge and MCP mappings versions minecraft_version_out = 1.13.2 minecraft_version = 1.13.2 mappings_version = snapshot_20181129 -malilib_version = 0.10.0-dev.17 From 9ca3a79c4a02e0e777e424518812fe7b78ac53d7 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 11 Jun 2019 02:14:25 +0300 Subject: [PATCH 009/107] Use wrapped GUI methods from malilib --- src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java index 2326944dc..e4a9efef3 100644 --- a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java +++ b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java @@ -22,9 +22,9 @@ public GuiConfigs() } @Override - public void init() + public void initGui() { - super.init(); + super.initGui(); this.clearOptions(); int x = 10; @@ -102,7 +102,7 @@ public void actionPerformedWithButton(ButtonBase button, int mouseButton) this.parent.reCreateListWidget(); // apply the new config width this.parent.getListWidget().resetScrollbarPosition(); - this.parent.init(); + this.parent.initGui(); } } From 11abc0cc2e3857e09e49ce905de82fc238338e25 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 13 Jun 2019 13:01:54 +0300 Subject: [PATCH 010/107] Update Loom and Gradle, so that the mod now actually builds successfully again --- build.gradle | 4 ++-- build.properties | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/resources/fabric.mod.json | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 07f24f80a..c6df28104 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.2.3-SNAPSHOT' + id 'fabric-loom' version '0.2.4-SNAPSHOT' id 'maven-publish' } @@ -27,7 +27,7 @@ dependencies { compile "com.google.code.findbugs:jsr305:3.0.2" // Fabric API. This is technically optional, but you probably want it anyway. - modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version + //modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version modCompile "fi.dy.masa.malilib:malilib-fabric-" + config.minecraft_version_out + ":" + config.malilib_version } diff --git a/build.properties b/build.properties index e00f6d251..2f19e31fc 100644 --- a/build.properties +++ b/build.properties @@ -9,7 +9,7 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.18 +malilib_version = 0.10.0-dev.19 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.14.2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6825a5bfc..349244b8e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 42b7c7712..7dc0eb088 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,7 +28,6 @@ ], "depends": { - "fabric": "*", - "malilib": ">=0.9.5 <0.10.0" + "malilib": ">=0.10.0-dev.19" } } From 90297f94e820a914bc07e9c2142cc485c26a3663 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 13 Jun 2019 13:15:06 +0300 Subject: [PATCH 011/107] Exclude the Gimp image files from the built mod --- build.gradle | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/build.gradle b/build.gradle index c6df28104..96cd1d272 100644 --- a/build.gradle +++ b/build.gradle @@ -52,6 +52,10 @@ version = project.minecraft.mod_version processResources { + // Exclude the GIMP image files + exclude '**/*.xcf' + exclude '**/xcf' + // this will ensure that this task is redone when the versions change. //inputs.property "mod_version", project.minecraft.mod_version //inputs.property "minecraft_version", project.config.minecraft_version From cf92b5bd0f5653725e74fd3eb808dd57fab0eb0b Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 26 Jun 2019 00:41:38 +0300 Subject: [PATCH 012/107] Update to Minecraft 1.14.3 and new mappings --- build.properties | 12 +++--- gradle.properties | 2 + .../itemscroller/util/InventoryUtils.java | 43 ++++++++++--------- 3 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 gradle.properties diff --git a/build.properties b/build.properties index 2f19e31fc..f8bc247b3 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.19 +malilib_version = 0.10.0-dev.20 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.14.2 -minecraft_version = 1.14.2 -mappings_version = 1.14.2+build.1 +minecraft_version_out = 1.14.3 +minecraft_version = 1.14.3 +mappings_version = 1.14.3+build.1 -fabric_version = 0.3.0+build.170 -fabric_loader_version = 0.4.8+build.154 +fabric_version = 0.3.0+build.187 +fabric_loader_version = 0.4.8+build.155 diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 000000000..5cacfe897 --- /dev/null +++ b/gradle.properties @@ -0,0 +1,2 @@ +# Done to increase the memory available to gradle. +org.gradle.jvmargs=-Xmx1G diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 982cbe315..af5999386 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -10,13 +10,6 @@ import java.util.Optional; import java.util.Set; import javax.annotation.Nullable; -import fi.dy.masa.itemscroller.ItemScroller; -import fi.dy.masa.itemscroller.config.Configs; -import fi.dy.masa.itemscroller.config.Hotkeys; -import fi.dy.masa.itemscroller.recipes.CraftingHandler; -import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; -import fi.dy.masa.itemscroller.recipes.RecipePattern; -import fi.dy.masa.itemscroller.recipes.RecipeStorage; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; @@ -41,7 +34,15 @@ import net.minecraft.util.registry.Registry; import net.minecraft.village.TradeOffer; import net.minecraft.village.TraderOfferList; +import net.minecraft.world.GameRules; import net.minecraft.world.World; +import fi.dy.masa.itemscroller.ItemScroller; +import fi.dy.masa.itemscroller.config.Configs; +import fi.dy.masa.itemscroller.config.Hotkeys; +import fi.dy.masa.itemscroller.recipes.CraftingHandler; +import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; +import fi.dy.masa.itemscroller.recipes.RecipePattern; +import fi.dy.masa.itemscroller.recipes.RecipeStorage; public class InventoryUtils { @@ -70,7 +71,7 @@ public static void onSlotChangedCraftingGrid(PlayerEntity player, CraftingRecipe recipe = optional.get(); if ((recipe.isIgnoredInRecipeBook() || - world.getGameRules().getBoolean("doLimitedCrafting") == false || + world.getGameRules().getBoolean(GameRules.DO_LIMITED_CRAFTING) == false || ((ClientPlayerEntity) player).getRecipeBook().contains(recipe)) ) { @@ -90,7 +91,7 @@ public static String getStackString(ItemStack stack) Identifier rl = Registry.ITEM.getId(stack.getItem()); return String.format("[%s - display: %s - NBT: %s] (%s)", - rl != null ? rl.toString() : "null", stack.getDisplayName().getString(), + rl != null ? rl.toString() : "null", stack.getName().getString(), stack.getTag() != null ? stack.getTag().toString() : "", stack.toString()); } @@ -606,7 +607,7 @@ public static void checkForItemPickup(MinecraftClient mc) // Picked up or swapped items to the cursor, grab a reference to the slot that the items came from // Note that we are only checking the item here! - if (isStackEmpty(stackCursor) == false && stackCursor.isEqualIgnoreTags(stackInCursorLast) == false && sourceSlotCandidate != null) + if (isStackEmpty(stackCursor) == false && stackCursor.isItemEqual(stackInCursorLast) == false && sourceSlotCandidate != null) { sourceSlot = new WeakReference<>(sourceSlotCandidate.get()); } @@ -662,7 +663,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, AbstractCont } // Can take all the items to the cursor at once, use a shift-click method to move one item from the slot - if (getStackSize(stackOrig) <= stackOrig.getMaxAmount()) + if (getStackSize(stackOrig) <= stackOrig.getMaxCount()) { return clickSlotsToMoveSingleItemByShiftClick(gui, slot.id); } @@ -707,7 +708,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, AbstractC PlayerEntity player = mc.player; ItemStack stackOrig = slot.getStack().copy(); - if (getStackSize(stackOrig) == 1 || getStackSize(stackOrig) > stackOrig.getMaxAmount() || + if (getStackSize(stackOrig) == 1 || getStackSize(stackOrig) > stackOrig.getMaxCount() || slot.canTakeItems(player) == false || slot.canInsert(stackOrig) == false) { return true; @@ -1343,7 +1344,7 @@ public static void rightClickCraftOneStack(AbstractContainerScreen= stackCursor.getMaxAmount() || + getStackSize(stackCursor) >= stackCursor.getMaxCount() || areStacksEqual(slot.getStack(), stackCursor) == false) { break; @@ -1670,7 +1671,7 @@ private static List getSlotNumbersOfMatchingStacks( areSlotsInSameInventory(slot, slotReference, treatHotbarAsDifferent) == sameInventory && areStacksEqual(slot.getStack(), stackReference)) { - if ((getStackSize(slot.getStack()) < stackReference.getMaxAmount()) == preferPartial) + if ((getStackSize(slot.getStack()) < stackReference.getMaxCount()) == preferPartial) { slots.add(0, slot.id); } @@ -1695,7 +1696,7 @@ private static List getSlotNumbersOfMatchingStacks(Container container, if (slot != null && slot.hasStack() && areStacksEqual(slot.getStack(), stackReference)) { - if ((getStackSize(slot.getStack()) < stackReference.getMaxAmount()) == preferPartial) + if ((getStackSize(slot.getStack()) < stackReference.getMaxCount()) == preferPartial) { slots.add(0, slot.id); } @@ -1751,7 +1752,7 @@ private static List getSlotNumbersOfEmptySlotsInPlayerInventory(Contain public static boolean areStacksEqual(ItemStack stack1, ItemStack stack2) { - return stack1.isEmpty() == false && stack1.isEqualIgnoreTags(stack2) && ItemStack.areTagsEqual(stack1, stack2); + return stack1.isEmpty() == false && stack1.isItemEqual(stack2) && ItemStack.areTagsEqual(stack1, stack2); } private static boolean areSlotsInSameInventory(Slot slot1, Slot slot2) @@ -2212,7 +2213,7 @@ public static void tryClearCursor(AbstractContainerScreen g { ItemStack stackCursor = mc.player.inventory.getCursorStack(); - if (stackCursor.isEmpty() == false) + if (isStackEmpty(stackCursor) == false) { List emptySlots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.getContainer(), false); @@ -2232,7 +2233,7 @@ public static void tryClearCursor(AbstractContainerScreen g ItemStack stackSlot = slot.getStack(); if (slot == null || areStacksEqual(stackSlot, stackCursor) == false || - stackSlot.getAmount() >= stackCursor.getMaxAmount()) + getStackSize(stackSlot) >= stackCursor.getMaxCount()) { break; } @@ -2244,7 +2245,7 @@ public static void tryClearCursor(AbstractContainerScreen g } } - if (mc.player.inventory.getCursorStack().isEmpty() == false) + if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) { dropItemsFromCursor(gui); } @@ -2450,11 +2451,11 @@ public static boolean isStackEmpty(ItemStack stack) public static int getStackSize(ItemStack stack) { - return stack.getAmount(); + return stack.getCount(); } public static void setStackSize(ItemStack stack, int size) { - stack.setAmount(size); + stack.setCount(size); } } From bf3b23f2e83e772051a97a595968ebd5f22ecd92 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sat, 20 Jul 2019 18:53:09 +0300 Subject: [PATCH 013/107] Update to Minecraft 1.14.4 --- build.gradle | 27 --------------------------- build.properties | 10 ++++------ src/main/resources/fabric.mod.json | 2 +- 3 files changed, 5 insertions(+), 34 deletions(-) diff --git a/build.gradle b/build.gradle index 96cd1d272..6f3feda13 100644 --- a/build.gradle +++ b/build.gradle @@ -78,30 +78,3 @@ processResources tasks.withType(JavaCompile) { options.encoding = "UTF-8" } - -// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task -// if it is present. -// If you remove this task, sources will not be generated. -task sourcesJar(type: Jar, dependsOn: classes) { - classifier = 'sources' - from sourceSets.main.allSource -} - -tasks.publish.dependsOn build -publishing { - publications { - mavenJava(MavenPublication) { - artifactId project.archivesBaseName - - // add all the jars that should be included when publishing to maven - artifact(jar) { builtBy remapJar } - artifact(sourcesJar) { builtBy remapSourcesJar } - } - } - - repositories { - maven { - url "$projectDir/../../CommonMaven" - } - } -} diff --git a/build.properties b/build.properties index f8bc247b3..6a3dec09e 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.14.3 -minecraft_version = 1.14.3 -mappings_version = 1.14.3+build.1 - -fabric_version = 0.3.0+build.187 -fabric_loader_version = 0.4.8+build.155 +minecraft_version_out = 1.14.4 +minecraft_version = 1.14.4 +mappings_version = 1.14.4+build.2 +fabric_loader_version = 0.4.8+build.157 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 7dc0eb088..58066bbf2 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -28,6 +28,6 @@ ], "depends": { - "malilib": ">=0.10.0-dev.19" + "malilib": ">=0.10.0-dev.20" } } From 207e85050634f1e7a3ab752e7ba6da189d595f91 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sat, 7 Sep 2019 23:07:08 +0300 Subject: [PATCH 014/107] Update to MC 1.15 snapshot 19w36a --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index 6a3dec09e..350a0668c 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.14.4 -minecraft_version = 1.14.4 -mappings_version = 1.14.4+build.2 -fabric_loader_version = 0.4.8+build.157 +minecraft_version_out = 1.15-snap-19w36a +minecraft_version = 19w36a +mappings_version = 19w36a+build.1 +fabric_loader_version = 0.6.1+build.165 From fced1a521a878c7a64acee188fe4fbdbdb524e80 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Mon, 9 Sep 2019 15:16:08 +0300 Subject: [PATCH 015/107] Add Mod Menu support --- build.gradle | 1 + build.properties | 2 + .../compat/modmenu/ModMenuImpl.java | 26 ++++++++ src/main/resources/fabric.mod.json | 63 +++++++++++-------- 4 files changed, 65 insertions(+), 27 deletions(-) create mode 100644 src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java diff --git a/build.gradle b/build.gradle index 6f3feda13..b93d10197 100644 --- a/build.gradle +++ b/build.gradle @@ -30,6 +30,7 @@ dependencies { //modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version modCompile "fi.dy.masa.malilib:malilib-fabric-" + config.minecraft_version_out + ":" + config.malilib_version + modCompile "io.github.prospector:modmenu:" + config.mod_menu_version } minecraft { diff --git a/build.properties b/build.properties index 6a3dec09e..93fc3139e 100644 --- a/build.properties +++ b/build.properties @@ -15,4 +15,6 @@ malilib_version = 0.10.0-dev.20 minecraft_version_out = 1.14.4 minecraft_version = 1.14.4 mappings_version = 1.14.4+build.2 + fabric_loader_version = 0.4.8+build.157 +mod_menu_version = 1.7.11+build.121 diff --git a/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java new file mode 100644 index 000000000..7f858dbfb --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java @@ -0,0 +1,26 @@ +package fi.dy.masa.itemscroller.compat.modmenu; + +import java.util.function.Function; +import net.minecraft.client.gui.screen.Screen; +import fi.dy.masa.itemscroller.Reference; +import fi.dy.masa.itemscroller.gui.GuiConfigs; +import io.github.prospector.modmenu.api.ModMenuApi; + +public class ModMenuImpl implements ModMenuApi +{ + @Override + public String getModId() + { + return Reference.MOD_ID; + } + + @Override + public Function getConfigScreenFactory() + { + return (screen) -> { + GuiConfigs gui = new GuiConfigs(); + gui.setParent(screen); + return gui; + }; + } +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 58066bbf2..960cb6a78 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,33 +1,42 @@ { - "schemaVersion": 1, - "id": "itemscroller", - "name": "Item Scroller", - "version": "${mod_version}", + "schemaVersion": 1, + "id": "itemscroller", + "name": "Item Scroller", + "version": "${mod_version}", - "description": "Move items in inventory GUIs by scrolling the mouse wheel or dragging over slots", - "authors": [ - "masa" - ], - "contact": { - "homepage": "https://minecraft.curseforge.com/projects/item-scroller", - "sources": "https://github.com/maruohon/itemscroller", - "twitter": "https://twitter.com/maruohon", - "discord": "https://discordapp.com/channels/211786369951989762/453662800460644354/" - }, + "description": "Move items in inventory GUIs by scrolling the mouse wheel or dragging over slots", + "authors": [ + "masa" + ], + "contact": { + "homepage": "https://www.curseforge.com/minecraft/mc-mods/item-scroller", + "issues": "https://github.com/maruohon/itemscroller/issues", + "sources": "https://github.com/maruohon/itemscroller", + "twitter": "https://twitter.com/maruohon", + "discord": "https://discordapp.com/channels/211786369951989762/453662800460644354/" + }, - "license": "LGPLv3", + "license": "LGPLv3", - "environment": "client", - "entrypoints": { - "main": [ - "fi.dy.masa.itemscroller.ItemScroller" - ] - }, - "mixins": [ - "mixins.itemscroller.json" - ], + "environment": "client", + "entrypoints": { + "main": [ + "fi.dy.masa.itemscroller.ItemScroller" + ], + "modmenu": [ + "fi.dy.masa.itemscroller.compat.modmenu.ModMenuImpl" + ] + }, - "depends": { - "malilib": ">=0.10.0-dev.20" - } + "mixins": [ + "mixins.itemscroller.json" + ], + + "depends": { + "malilib": ">=0.10.0-dev.20" + }, + + "custom": { + "modmenu:clientsideOnly": true + } } From bffd543e8870596897bc7da9aa08b352f86abec5 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 13 Sep 2019 20:14:25 +0300 Subject: [PATCH 016/107] Update to MC 1.15 snapshot 19w37a --- build.gradle | 2 +- build.properties | 6 +++--- .../java/fi/dy/masa/itemscroller/util/InventoryUtils.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 6f3feda13..482f10fa5 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.2.4-SNAPSHOT' + id 'fabric-loom' version '0.2.5-SNAPSHOT' id 'maven-publish' } diff --git a/build.properties b/build.properties index 350a0668c..f3d72a2d9 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-snap-19w36a -minecraft_version = 19w36a -mappings_version = 19w36a+build.1 +minecraft_version_out = 1.15-snap-19w37a +minecraft_version = 19w37a +mappings_version = 19w37a+build.9 fabric_loader_version = 0.6.1+build.165 diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index af5999386..79b77934f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -2322,7 +2322,7 @@ public static void clickSlot(AbstractContainerScreen gui, i try { MinecraftClient mc = MinecraftClient.getInstance(); - mc.interactionManager.method_2906(gui.getContainer().syncId, slotNum, mouseButton, type, mc.player); + mc.interactionManager.clickSlot(gui.getContainer().syncId, slotNum, mouseButton, type, mc.player); } catch (Exception e) { From da25e8f33a0cc6345f2df941a8b844b23fdf4b95 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 1 Oct 2019 22:37:32 +0300 Subject: [PATCH 017/107] Update to MC 1.15 snapshot 19w38b --- build.properties | 8 +-- .../event/RenderEventHandler.java | 49 ++++++++++++------- .../itemscroller/util/InventoryUtils.java | 4 +- 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/build.properties b/build.properties index f3d72a2d9..b6cb6e05d 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-snap-19w37a -minecraft_version = 19w37a -mappings_version = 19w37a+build.9 -fabric_loader_version = 0.6.1+build.165 +minecraft_version_out = 1.15-snap-19w38b +minecraft_version = 19w38b +mappings_version = 19w38b+build.12 +fabric_loader_version = 0.6.2+build.166 diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 26dd46d88..feae190c7 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -1,6 +1,14 @@ package fi.dy.masa.itemscroller.event; +import java.nio.FloatBuffer; +import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.platform.GlStateManager; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.font.TextRenderer; +import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.util.GlAllocationUtils; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.Vec3d; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; @@ -11,18 +19,13 @@ import fi.dy.masa.malilib.render.RenderUtils; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.StringUtils; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; -import net.minecraft.client.render.GuiLighting; -import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Vec3d; public class RenderEventHandler { private static final RenderEventHandler INSTANCE = new RenderEventHandler(); private static final Vec3d LIGHT0_POS = (new Vec3d( 0.2D, 1.0D, -0.7D)).normalize(); private static final Vec3d LIGHT1_POS = (new Vec3d(-0.2D, 1.0D, 0.7D)).normalize(); + private static final FloatBuffer FLOAT_BUFFER = GlAllocationUtils.allocateFloatBuffer(4); private final MinecraftClient mc = MinecraftClient.getInstance(); private int recipeListX; @@ -312,19 +315,31 @@ public static void enableStandardItemLighting(float scale) GlStateManager.enableLight(1); GlStateManager.enableColorMaterial(); GlStateManager.colorMaterial(1032, 5634); - GlStateManager.light(16384, 4611, GuiLighting.singletonBuffer((float) LIGHT0_POS.x, (float) LIGHT0_POS.y, (float) LIGHT0_POS.z, 0.0f)); float lightStrength = 0.3F * scale; - GlStateManager.light(16384, 4609, GuiLighting.singletonBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); - GlStateManager.light(16384, 4608, GuiLighting.singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.light(16384, 4610, GuiLighting.singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.light(16385, 4611, GuiLighting.singletonBuffer((float) LIGHT1_POS.x, (float) LIGHT1_POS.y, (float) LIGHT1_POS.z, 0.0f)); - GlStateManager.light(16385, 4609, GuiLighting.singletonBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); - GlStateManager.light(16385, 4608, GuiLighting.singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.light(16385, 4610, GuiLighting.singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.shadeModel(7424); - float ambientLightStrength = 0.4F; - GlStateManager.lightModel(2899, GuiLighting.singletonBuffer(ambientLightStrength, ambientLightStrength, ambientLightStrength, 1.0F)); + + GlStateManager.light(16384, 4611, singletonBuffer((float) LIGHT0_POS.x, (float) LIGHT0_POS.y, (float) LIGHT0_POS.z, 0.0f)); + GlStateManager.light(16384, 4609, singletonBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); + GlStateManager.light(16384, 4608, singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.light(16384, 4610, singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + + GlStateManager.light(16385, 4611, singletonBuffer((float) LIGHT1_POS.x, (float) LIGHT1_POS.y, (float) LIGHT1_POS.z, 0.0f)); + GlStateManager.light(16385, 4609, singletonBuffer(lightStrength, lightStrength, lightStrength, 1.0F)); + GlStateManager.light(16385, 4608, singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + GlStateManager.light(16385, 4610, singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); + + GlStateManager.shadeModel(GL11.GL_FLAT); + + GlStateManager.lightModel(2899, singletonBuffer(ambientLightStrength, ambientLightStrength, ambientLightStrength, 1.0F)); + } + + private static FloatBuffer singletonBuffer(float val1, float val2, float val3, float val4) + { + FLOAT_BUFFER.clear(); + FLOAT_BUFFER.put(val1).put(val2).put(val3).put(val4); + FLOAT_BUFFER.flip(); + + return FLOAT_BUFFER; } } diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 79b77934f..1eec3502b 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -332,7 +332,7 @@ public static boolean dragMoveItems(AbstractContainerScreen { if (gui instanceof CreativeInventoryScreen) { - boolean isPlayerInv = ((CreativeInventoryScreen) gui).method_2469() == ItemGroup.INVENTORY.getIndex(); + boolean isPlayerInv = ((CreativeInventoryScreen) gui).getSelectedTab() == ItemGroup.INVENTORY.getIndex(); int slotNumber = isPlayerInv ? AccessorUtils.getSlotIndex(slot) : slot.id; slotNumberLast = slotNumber; } @@ -430,7 +430,7 @@ private static boolean dragMoveFromSlotAtPositionCreative(AbstractContainerScree { CreativeInventoryScreen guiCreative = (CreativeInventoryScreen) gui; Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); - boolean isPlayerInv = guiCreative.method_2469() == ItemGroup.INVENTORY.getIndex(); + boolean isPlayerInv = guiCreative.getSelectedTab() == ItemGroup.INVENTORY.getIndex(); // Only allow dragging from the hotbar slots if (slot == null || (slot.getClass() != Slot.class && isPlayerInv == false)) From 612d7213ad3ce9e117f67d72cfe973db1db424af Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 2 Oct 2019 21:44:51 +0300 Subject: [PATCH 018/107] Update to MC 1.15 snapshot 19w39a --- build.properties | 6 +++--- .../java/fi/dy/masa/itemscroller/recipes/RecipePattern.java | 4 ++-- .../java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.properties b/build.properties index b6cb6e05d..a3592a2fc 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-snap-19w38b -minecraft_version = 19w38b -mappings_version = 19w38b+build.12 +minecraft_version_out = 1.15-snap-19w39a +minecraft_version = 19w39a +mappings_version = 19w39a+build.12 fabric_loader_version = 0.6.2+build.166 diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java index b833b0a4f..59670bf99 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java @@ -90,7 +90,7 @@ public void copyRecipeFrom(RecipePattern other) public void readFromNBT(@Nonnull CompoundTag nbt) { - if (nbt.containsKey("Result", Constants.NBT.TAG_COMPOUND) && nbt.containsKey("Ingredients", Constants.NBT.TAG_LIST)) + if (nbt.contains("Result", Constants.NBT.TAG_COMPOUND) && nbt.contains("Ingredients", Constants.NBT.TAG_LIST)) { ListTag tagIngredients = nbt.getList("Ingredients", Constants.NBT.TAG_COMPOUND); int count = tagIngredients.size(); @@ -103,7 +103,7 @@ public void readFromNBT(@Nonnull CompoundTag nbt) for (int i = 0; i < count; i++) { - CompoundTag tag = tagIngredients.getCompoundTag(i); + CompoundTag tag = tagIngredients.getCompound(i); int slot = tag.getInt("Slot"); if (slot >= 0 && slot < this.recipe.length) diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java index 9d9067fa2..51a1a9295 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java @@ -122,7 +122,7 @@ public void clearRecipe(int index) private void readFromNBT(CompoundTag nbt) { - if (nbt == null || nbt.containsKey("Recipes", Constants.NBT.TAG_LIST) == false) + if (nbt == null || nbt.contains("Recipes", Constants.NBT.TAG_LIST) == false) { return; } @@ -137,7 +137,7 @@ private void readFromNBT(CompoundTag nbt) for (int i = 0; i < count; i++) { - CompoundTag tag = tagList.getCompoundTag(i); + CompoundTag tag = tagList.getCompound(i); int index = tag.getByte("RecipeIndex"); From 112dfbe520c012647e25213237069fde4ab436ce Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 2 Oct 2019 22:56:10 +0300 Subject: [PATCH 019/107] Update to MC 1.15 snapshot 19w40a --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index a3592a2fc..d948acd0e 100644 --- a/build.properties +++ b/build.properties @@ -9,10 +9,10 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.20 +malilib_version = 0.10.0-dev.20+alpha.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-snap-19w39a -minecraft_version = 19w39a -mappings_version = 19w39a+build.12 +minecraft_version_out = 1.15-snap-19w40a +minecraft_version = 19w40a +mappings_version = 19w40a+build.1 fabric_loader_version = 0.6.2+build.166 From cf205eed6c526f42c7dd35562efab17cc2238c65 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 11 Oct 2019 22:58:42 +0300 Subject: [PATCH 020/107] Update to MC 1.15 snapshot 19w41a --- build.properties | 8 ++++---- .../dy/masa/itemscroller/mixin/IMixinMerchantScreen.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index d948acd0e..e58b7d8aa 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+alpha.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-snap-19w40a -minecraft_version = 19w40a -mappings_version = 19w40a+build.1 -fabric_loader_version = 0.6.2+build.166 +minecraft_version_out = 1.15-snap-19w41a +minecraft_version = 19w41a +mappings_version = 19w41a+build.3 +fabric_loader_version = 0.6.3+build.167 diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java index b60cdec9f..b722a8c4c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java @@ -7,6 +7,6 @@ @Mixin(MerchantScreen.class) public interface IMixinMerchantScreen { - @Accessor("field_19161") + @Accessor("selectedIndex") int getSelectedMerchantRecipe(); } From d33076b9ae054a15a53569dc737aad70613f1e9c Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 21 Nov 2019 22:00:33 +0200 Subject: [PATCH 021/107] Update to MC 1.15 snapshot 19w46b --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index e58b7d8aa..da52e58f3 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+alpha.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-snap-19w41a -minecraft_version = 19w41a -mappings_version = 19w41a+build.3 -fabric_loader_version = 0.6.3+build.167 +minecraft_version_out = 1.15-snap-19w46b +minecraft_version = 19w46b +mappings_version = 19w46b+build.1 +fabric_loader_version = 0.6.4+build.169 From 20508fbf88d0b29010c973273a8711abd869eca7 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 21 Nov 2019 23:50:04 +0200 Subject: [PATCH 022/107] Update to MC 1.15-pre1 --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index da52e58f3..a03d84b17 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+alpha.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-snap-19w46b -minecraft_version = 19w46b -mappings_version = 19w46b+build.1 -fabric_loader_version = 0.6.4+build.169 +minecraft_version_out = 1.15-pre1 +minecraft_version = 1.15-pre1 +mappings_version = 1.15-pre1+build.3 +fabric_loader_version = 0.7.1+build.173 From 3bd35b330353c23b1d6b0b014ef60bbaecc03f47 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 28 Nov 2019 23:02:10 +0200 Subject: [PATCH 023/107] Update to MC 1.15-pre3 --- build.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index a03d84b17..61ac24531 100644 --- a/build.properties +++ b/build.properties @@ -9,10 +9,10 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.20+alpha.1 +malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-pre1 -minecraft_version = 1.15-pre1 -mappings_version = 1.15-pre1+build.3 -fabric_loader_version = 0.7.1+build.173 +minecraft_version_out = 1.15-pre3 +minecraft_version = 1.15-pre3 +mappings_version = 1.15-pre3+build.1 +fabric_loader_version = 0.7.2+build.174 From 78645d71ee9f78052e541cdd2087db7bdd0ed39e Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 29 Nov 2019 00:46:40 +0200 Subject: [PATCH 024/107] Update to Loom 0.2.6, Yarn v2 stuff and Gradle 6.0.1 --- build.gradle | 12 ++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 482f10fa5..a29a16e94 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.2.5-SNAPSHOT' + id 'fabric-loom' version '0.2.6-SNAPSHOT' id 'maven-publish' } @@ -21,15 +21,15 @@ configFile.withReader { } dependencies { - minecraft "com.mojang:minecraft:" + config.minecraft_version - mappings "net.fabricmc:yarn:" + config.mappings_version - modCompile "net.fabricmc:fabric-loader:" + config.fabric_loader_version + minecraft "com.mojang:minecraft:${config.minecraft_version}" + mappings "net.fabricmc:yarn:${config.mappings_version}:v2" + modCompile "net.fabricmc:fabric-loader:${config.fabric_loader_version}" compile "com.google.code.findbugs:jsr305:3.0.2" + modCompile "fi.dy.masa.malilib:malilib-fabric-${config.minecraft_version_out}:${config.malilib_version}" + // Fabric API. This is technically optional, but you probably want it anyway. //modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version - - modCompile "fi.dy.masa.malilib:malilib-fabric-" + config.minecraft_version_out + ":" + config.malilib_version } minecraft { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 349244b8e..70073248c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip From 92a69cf6b1918e19fd95a1f843402dcc5c697f3c Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 5 Dec 2019 00:00:59 +0200 Subject: [PATCH 025/107] Update to MC 1.15-pre4 --- build.properties | 6 +++--- .../fi/dy/masa/itemscroller/event/RenderEventHandler.java | 2 +- .../itemscroller/mixin/IMixinAbstractContainerScreen.java | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.properties b/build.properties index 61ac24531..3c9fdf95d 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-pre3 -minecraft_version = 1.15-pre3 -mappings_version = 1.15-pre3+build.1 +minecraft_version_out = 1.15-pre4 +minecraft_version = 1.15-pre4 +mappings_version = 1.15-pre4+build.1 fabric_loader_version = 0.7.2+build.174 diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index feae190c7..52ff7d689 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -292,7 +292,7 @@ private void renderStackAt(ItemStack stack, int x, int y, boolean border) this.mc.getItemRenderer().zOffset -= 100; } - RenderUtils.disableItemLighting(); + RenderUtils.disableDiffuseLighting(); GlStateManager.disableBlend(); GlStateManager.popMatrix(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java index 5bcf3ef46..9b0e8f6dd 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java @@ -19,10 +19,10 @@ public interface IMixinAbstractContainerScreen @Accessor("focusedSlot") Slot getHoveredSlot(); - @Accessor("left") + @Accessor("x") int getGuiLeft(); - @Accessor("top") + @Accessor("y") int getGuiTop(); @Accessor("containerWidth") From 080993506812c0f0e75921ed6c84ca6070b918aa Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 11 Dec 2019 01:01:57 +0200 Subject: [PATCH 026/107] Update to MC 1.15.0 --- build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.properties b/build.properties index 3c9fdf95d..3fa0ad0f4 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15-pre4 -minecraft_version = 1.15-pre4 -mappings_version = 1.15-pre4+build.1 +minecraft_version_out = 1.15.0 +minecraft_version = 1.15 +mappings_version = 1.15+build.1 fabric_loader_version = 0.7.2+build.174 From f351a5a4eb12323781a86145da3f035ef2782d8c Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 19 Dec 2019 18:24:55 +0200 Subject: [PATCH 027/107] Update to MC 1.15.1 (just a version bump) --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index 3fa0ad0f4..18479fad2 100644 --- a/build.properties +++ b/build.properties @@ -12,7 +12,7 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15.0 -minecraft_version = 1.15 -mappings_version = 1.15+build.1 -fabric_loader_version = 0.7.2+build.174 +minecraft_version_out = 1.15.1 +minecraft_version = 1.15.1 +mappings_version = 1.15.1+build.3 +fabric_loader_version = 0.7.2+build.175 From 80431b76de74fd404f410a33e4196a4cde4233d3 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 21 Jan 2020 20:13:06 +0200 Subject: [PATCH 028/107] Update to MC 1.15.2 --- build.properties | 10 +++++----- .../mixin/MixinAbstractInventoryScreen.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.properties b/build.properties index 5fc2aeb23..d071fd5d5 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15.1 -minecraft_version = 1.15.1 -mappings_version = 1.15.1+build.3 +minecraft_version_out = 1.15.2 +minecraft_version = 1.15.2 +mappings_version = 1.15.2+build.1 -fabric_loader_version = 0.7.2+build.175 -mod_menu_version = 1.8.1+build.17 +fabric_loader_version = 0.7.5+build.178 +mod_menu_version = 1.8.3+build.19 diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java index dfbef097b..948597315 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java @@ -10,7 +10,7 @@ @Mixin(AbstractInventoryScreen.class) public abstract class MixinAbstractInventoryScreen { - @Inject(method = "drawPotionEffects", at = @At("HEAD"), cancellable = true) + @Inject(method = "drawStatusEffects", at = @At("HEAD"), cancellable = true) private void preventPotionEffectRendering(CallbackInfo ci) { if (InputUtils.isRecipeViewOpen()) From 8e36add84c06d68d1186f3889f606965147b2415 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 5 Feb 2020 23:21:44 +0200 Subject: [PATCH 029/107] Update to MC 1.16 snapshot 20w06a --- build.properties | 10 +- .../masa/itemscroller/event/InputHandler.java | 20 +- .../itemscroller/event/KeybindCallbacks.java | 22 +- .../event/RenderEventHandler.java | 22 +- ...Screen.java => IMixinContainerScreen.java} | 6 +- .../itemscroller/recipes/CraftingHandler.java | 28 +-- .../itemscroller/recipes/RecipePattern.java | 12 +- .../itemscroller/recipes/RecipeStorage.java | 14 +- .../masa/itemscroller/util/AccessorUtils.java | 36 +-- .../dy/masa/itemscroller/util/InputUtils.java | 6 +- .../itemscroller/util/InventoryUtils.java | 208 +++++++++--------- src/main/resources/fabric.mod.json | 2 +- src/main/resources/mixins.itemscroller.json | 2 +- 13 files changed, 194 insertions(+), 194 deletions(-) rename src/main/java/fi/dy/masa/itemscroller/mixin/{IMixinAbstractContainerScreen.java => IMixinContainerScreen.java} (82%) diff --git a/build.properties b/build.properties index d071fd5d5..7a40613f8 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.15.2 -minecraft_version = 1.15.2 -mappings_version = 1.15.2+build.1 +minecraft_version_out = 1.16-snap-20w06a +minecraft_version = 20w06a +mappings_version = 20w06a+build.2 -fabric_loader_version = 0.7.5+build.178 -mod_menu_version = 1.8.3+build.19 +fabric_loader_version = 0.7.8+build.184 +mod_menu_version = 1.8.5+build.23 diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index 38f0d04ac..67585b03a 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -1,6 +1,11 @@ package fi.dy.masa.itemscroller.event; import org.lwjgl.glfw.GLFW; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; +import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.container.Slot; +import net.minecraft.util.math.MathHelper; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -17,11 +22,6 @@ import fi.dy.masa.malilib.hotkeys.IMouseInputHandler; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.KeyCodes; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; -import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; -import net.minecraft.container.Slot; -import net.minecraft.util.math.MathHelper; public class InputHandler implements IKeybindProvider, IKeyboardInputHandler, IMouseInputHandler { @@ -122,11 +122,11 @@ private boolean handleInput(int keyCode, boolean keyState, double dWheel) final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); final int mouseY = fi.dy.masa.malilib.util.InputUtils.getMouseY(); - if (GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && + if (GuiUtils.getCurrentScreen() instanceof ContainerScreen && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) { - AbstractContainerScreen gui = (AbstractContainerScreen) GuiUtils.getCurrentScreen(); + ContainerScreen gui = (ContainerScreen) GuiUtils.getCurrentScreen(); RecipeStorage recipes = RecipeStorage.getInstance(); if (dWheel != 0) @@ -204,14 +204,14 @@ public void onMouseMove(int mouseX, int mouseY) if (this.callbacks.functionalityEnabled() && mc.player != null && - GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && + GuiUtils.getCurrentScreen() instanceof ContainerScreen && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) { - this.handleDragging((AbstractContainerScreen) GuiUtils.getCurrentScreen(), mc, mouseX, mouseY, false); + this.handleDragging((ContainerScreen) GuiUtils.getCurrentScreen(), mc, mouseX, mouseY, false); } } - private boolean handleDragging(AbstractContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) + private boolean handleDragging(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) { MoveAction action = InventoryUtils.getActiveMoveAction(); diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 7a957cbfc..c48a5639c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -1,5 +1,12 @@ package fi.dy.masa.itemscroller.event; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; +import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.client.gui.screen.ingame.InventoryScreen; +import net.minecraft.container.Slot; +import net.minecraft.sound.SoundEvents; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -18,13 +25,6 @@ import fi.dy.masa.malilib.hotkeys.KeyAction; import fi.dy.masa.malilib.interfaces.IClientTickHandler; import fi.dy.masa.malilib.util.GuiUtils; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; -import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; -import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.container.Slot; -import net.minecraft.sound.SoundEvents; public class KeybindCallbacks implements IHotkeyCallback, IClientTickHandler { @@ -80,12 +80,12 @@ else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) return true; } - if (this.disabled || mc == null || mc.player == null || (GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen) == false) + if (this.disabled || mc == null || mc.player == null || (GuiUtils.getCurrentScreen() instanceof ContainerScreen) == false) { return false; } - AbstractContainerScreen gui = (AbstractContainerScreen) GuiUtils.getCurrentScreen(); + ContainerScreen gui = (ContainerScreen) GuiUtils.getCurrentScreen(); Slot slot = AccessorUtils.getSlotUnderMouse(gui); RecipeStorage recipes = RecipeStorage.getInstance(); MoveAction moveAction = InputUtils.getDragMoveAction(key); @@ -170,13 +170,13 @@ public void onClientTick(MinecraftClient mc) if (this.disabled == false && mc != null && mc.player != null && - GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && + GuiUtils.getCurrentScreen() instanceof ContainerScreen && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false && Hotkeys.KEY_MASS_CRAFT.getKeybind().isKeybindHeld()) { Screen guiScreen = GuiUtils.getCurrentScreen(); - AbstractContainerScreen gui = (AbstractContainerScreen) guiScreen; + ContainerScreen gui = (ContainerScreen) guiScreen; Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); if (outputSlot != null) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 52ff7d689..8822ab08f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -5,7 +5,7 @@ import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.util.GlAllocationUtils; import net.minecraft.item.ItemStack; import net.minecraft.util.math.Vec3d; @@ -45,9 +45,9 @@ public static RenderEventHandler instance() public void onDrawBackgroundPost() { - if (GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && InputUtils.isRecipeViewOpen()) + if (GuiUtils.getCurrentScreen() instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) { - AbstractContainerScreen gui = (AbstractContainerScreen) GuiUtils.getCurrentScreen(); + ContainerScreen gui = (ContainerScreen) GuiUtils.getCurrentScreen(); RecipeStorage recipes = RecipeStorage.getInstance(); final int first = recipes.getFirstVisibleRecipeId(); final int countPerPage = recipes.getRecipeCountPerPage(); @@ -89,9 +89,9 @@ public void onDrawBackgroundPost() public void onDrawScreenPost() { - if (GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && InputUtils.isRecipeViewOpen()) + if (GuiUtils.getCurrentScreen() instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) { - AbstractContainerScreen gui = (AbstractContainerScreen) this.mc.currentScreen; + ContainerScreen gui = (ContainerScreen) this.mc.currentScreen; RecipeStorage recipes = RecipeStorage.getInstance(); final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); @@ -116,7 +116,7 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) } } - private void calculateRecipePositions(AbstractContainerScreen gui) + private void calculateRecipePositions(ContainerScreen gui) { RecipeStorage recipes = RecipeStorage.getInstance(); final int gapHorizontal = 2; @@ -147,7 +147,7 @@ private void calculateRecipePositions(AbstractContainerScreen gui) this.columnWidth = stackBaseHeight + this.numberTextWidth + this.gapColumn; } - private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, AbstractContainerScreen gui) + private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, ContainerScreen gui) { ItemStack stack = recipe.getResult(); @@ -157,7 +157,7 @@ private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, Ab } } - public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, AbstractContainerScreen gui) + public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, ContainerScreen gui) { if (InputUtils.isRecipeViewOpen()) { @@ -186,7 +186,7 @@ public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, Abs return -1; } - private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, AbstractContainerScreen gui, boolean selected) + private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, ContainerScreen gui, boolean selected) { final TextRenderer font = this.mc.textRenderer; final String indexStr = String.valueOf(recipeId + 1); @@ -208,7 +208,7 @@ private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int GlStateManager.popMatrix(); } - private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, AbstractContainerScreen gui) + private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, ContainerScreen gui) { ItemStack[] items = recipe.getRecipeItems(); final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength())); @@ -227,7 +227,7 @@ private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, Abs } } - private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCountPerPage, AbstractContainerScreen gui) + private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCountPerPage, ContainerScreen gui) { final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength())); int scaledStackDimensions = (int) (16 * this.scale); diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java similarity index 82% rename from src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java rename to src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java index 9b0e8f6dd..8f6ba6048 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java @@ -3,12 +3,12 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.container.Slot; import net.minecraft.container.SlotActionType; -@Mixin(AbstractContainerScreen.class) -public interface IMixinAbstractContainerScreen +@Mixin(ContainerScreen.class) +public interface IMixinContainerScreen { @Invoker("getSlotAt") Slot getSlotAtPositionInvoker(double x, double y); diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java index 0eec659c8..988fd774b 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java @@ -5,16 +5,16 @@ import java.util.Map; import java.util.Set; import javax.annotation.Nullable; -import fi.dy.masa.itemscroller.ItemScroller; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.container.Container; import net.minecraft.container.Slot; +import fi.dy.masa.itemscroller.ItemScroller; public class CraftingHandler { private static final Map CRAFTING_GRID_SLOTS = new HashMap(); - private static final Set>> CRAFTING_GUIS = new HashSet<>(); + private static final Set>> CRAFTING_GUIS = new HashSet<>(); public static void clearDefinitions() { @@ -27,7 +27,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot { try { - Class> guiClass = (Class>) Class.forName(guiClassName); + Class> guiClass = (Class>) Class.forName(guiClassName); Class slotClass = (Class) Class.forName(slotClassName); CRAFTING_GRID_SLOTS.put(new CraftingOutputSlot(guiClass, slotClass, outputSlot), range); @@ -46,7 +46,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot public static boolean isCraftingGui(Screen gui) { - return (gui instanceof AbstractContainerScreen) && CRAFTING_GUIS.contains(((AbstractContainerScreen) gui).getClass()); + return (gui instanceof ContainerScreen) && CRAFTING_GUIS.contains(((ContainerScreen) gui).getClass()); } /** @@ -56,17 +56,17 @@ public static boolean isCraftingGui(Screen gui) * @return the SlotRange of the crafting grid, or null, if the given slot is not a crafting output slot */ @Nullable - public static SlotRange getCraftingGridSlots(AbstractContainerScreen gui, Slot slot) + public static SlotRange getCraftingGridSlots(ContainerScreen gui, Slot slot) { return CRAFTING_GRID_SLOTS.get(CraftingOutputSlot.from(gui, slot)); } @Nullable - public static Slot getFirstCraftingOutputSlotForGui(AbstractContainerScreen gui) + public static Slot getFirstCraftingOutputSlotForGui(ContainerScreen gui) { if (CRAFTING_GUIS.contains(gui.getClass())) { - for (Slot slot : gui.getContainer().slotList) + for (Slot slot : gui.getContainer().slots) { if (getCraftingGridSlots(gui, slot) != null) { @@ -80,11 +80,11 @@ public static Slot getFirstCraftingOutputSlotForGui(AbstractContainerScreen> guiClass; + private final Class> guiClass; private final Class slotClass; private final int outputSlot; - private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) + private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) { this.guiClass = guiClass; this.slotClass = slotClass; @@ -92,12 +92,12 @@ private CraftingOutputSlot (Class> guiClass } @SuppressWarnings("unchecked") - public static CraftingOutputSlot from(AbstractContainerScreen gui, Slot slot) + public static CraftingOutputSlot from(ContainerScreen gui, Slot slot) { - return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); + return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); } - public Class> getGuiClass() + public Class> getGuiClass() { return this.guiClass; } @@ -112,7 +112,7 @@ public int getSlotNumber() return this.outputSlot; } - public boolean matches(AbstractContainerScreen gui, Slot slot, int outputSlot) + public boolean matches(ContainerScreen gui, Slot slot, int outputSlot) { return outputSlot == this.outputSlot && gui.getClass() == this.guiClass && slot.getClass() == this.slotClass; } diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java index 59670bf99..cd53ecf31 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java @@ -1,15 +1,15 @@ package fi.dy.masa.itemscroller.recipes; import javax.annotation.Nonnull; -import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; -import fi.dy.masa.itemscroller.util.Constants; -import fi.dy.masa.itemscroller.util.InventoryUtils; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.container.Container; import net.minecraft.container.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; +import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; +import fi.dy.masa.itemscroller.util.Constants; +import fi.dy.masa.itemscroller.util.InventoryUtils; public class RecipePattern { @@ -45,7 +45,7 @@ public void ensureRecipeSizeAndClearRecipe(int size) this.clearRecipe(); } - public void storeCraftingRecipe(Slot slot, AbstractContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipe(Slot slot, ContainerScreen gui, boolean clearIfEmpty) { SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); @@ -54,7 +54,7 @@ public void storeCraftingRecipe(Slot slot, AbstractContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipeToCurrentSelection(Slot slot, ContainerScreen gui, boolean clearIfEmpty) { this.storeCraftingRecipe(this.getSelection(), slot, gui, clearIfEmpty); } - public void storeCraftingRecipe(int index, Slot slot, AbstractContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipe(int index, Slot slot, ContainerScreen gui, boolean clearIfEmpty) { this.getRecipe(index).storeCraftingRecipe(slot, gui, clearIfEmpty); this.dirty = true; diff --git a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java index b3f6d6b82..7458643ea 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java @@ -1,48 +1,48 @@ package fi.dy.masa.itemscroller.util; -import fi.dy.masa.itemscroller.mixin.IMixinAbstractContainerScreen; -import fi.dy.masa.itemscroller.mixin.IMixinMerchantScreen; -import fi.dy.masa.itemscroller.mixin.IMixinSlot; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; import net.minecraft.container.Slot; import net.minecraft.container.SlotActionType; +import fi.dy.masa.itemscroller.mixin.IMixinContainerScreen; +import fi.dy.masa.itemscroller.mixin.IMixinMerchantScreen; +import fi.dy.masa.itemscroller.mixin.IMixinSlot; public class AccessorUtils { - public static Slot getSlotUnderMouse(AbstractContainerScreen gui) + public static Slot getSlotUnderMouse(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getHoveredSlot(); + return ((IMixinContainerScreen) gui).getHoveredSlot(); } - public static Slot getSlotAtPosition(AbstractContainerScreen gui, int x, int y) + public static Slot getSlotAtPosition(ContainerScreen gui, int x, int y) { - return ((IMixinAbstractContainerScreen) gui).getSlotAtPositionInvoker(x, y); + return ((IMixinContainerScreen) gui).getSlotAtPositionInvoker(x, y); } - public static void handleMouseClick(AbstractContainerScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) + public static void handleMouseClick(ContainerScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) { - ((IMixinAbstractContainerScreen) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); + ((IMixinContainerScreen) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); } - public static int getGuiLeft(AbstractContainerScreen gui) + public static int getGuiLeft(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getGuiLeft(); + return ((IMixinContainerScreen) gui).getGuiLeft(); } - public static int getGuiTop(AbstractContainerScreen gui) + public static int getGuiTop(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getGuiTop(); + return ((IMixinContainerScreen) gui).getGuiTop(); } - public static int getGuiXSize(AbstractContainerScreen gui) + public static int getGuiXSize(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getGuiSizeX(); + return ((IMixinContainerScreen) gui).getGuiSizeX(); } - public static int getGuiYSize(AbstractContainerScreen gui) + public static int getGuiYSize(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getGuiSizeY(); + return ((IMixinContainerScreen) gui).getGuiSizeY(); } public static int getSelectedMerchantRecipe(MerchantScreen gui) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index d0cbb251b..55999be5c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -1,13 +1,13 @@ package fi.dy.masa.itemscroller.util; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.event.KeybindCallbacks; import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.malilib.hotkeys.IKeybind; import fi.dy.masa.malilib.hotkeys.KeybindMulti; import fi.dy.masa.malilib.util.GuiUtils; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; public class InputUtils { @@ -19,7 +19,7 @@ public static boolean isRecipeViewOpen() CraftingHandler.isCraftingGui(GuiUtils.getCurrentScreen()); } - public static boolean canShiftDropItems(AbstractContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY) + public static boolean canShiftDropItems(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY) { if (InventoryUtils.isStackEmpty(mc.player.inventory.getCursorStack()) == false) { diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 1eec3502b..5dd44dd91 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -11,7 +11,7 @@ import java.util.Set; import javax.annotation.Nullable; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; @@ -99,7 +99,7 @@ public static String getStackString(ItemStack stack) return ""; } - public static void debugPrintSlotInfo(AbstractContainerScreen gui, Slot slot) + public static void debugPrintSlotInfo(ContainerScreen gui, Slot slot) { if (slot == null) { @@ -107,7 +107,7 @@ public static void debugPrintSlotInfo(AbstractContainerScreen", hasSlot ? " true" : "false", stackStr, - gui.getContainer().slotList.size())); + gui.getContainer().slots.size())); } - private static boolean isValidSlot(Slot slot, AbstractContainerScreen gui, boolean requireItems) + private static boolean isValidSlot(Slot slot, ContainerScreen gui, boolean requireItems) { Container container = gui.getContainer(); - return container != null && container.slotList != null && - slot != null && container.slotList.contains(slot) && + return container != null && container.slots != null && + slot != null && container.slots.contains(slot) && (requireItems == false || slot.hasStack()) && Configs.SLOT_BLACKLIST.contains(slot.getClass().getName()) == false; } - public static boolean isCraftingSlot(AbstractContainerScreen gui, @Nullable Slot slot) + public static boolean isCraftingSlot(ContainerScreen gui, @Nullable Slot slot) { return slot != null && CraftingHandler.getCraftingGridSlots(gui, slot) != null; } @@ -138,7 +138,7 @@ public static boolean isCraftingSlot(AbstractContainerScreen gui) + public static boolean canShiftPlaceItems(ContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -160,7 +160,7 @@ public static boolean canShiftPlaceItems(AbstractContainerScreen gui, RecipeStorage recipes, boolean scrollingUp) + public static boolean tryMoveItems(ContainerScreen gui, RecipeStorage recipes, boolean scrollingUp) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -252,7 +252,7 @@ else if (getStackSize(stack) < slot.getMaxStackAmount(stack)) return false; } - public static boolean dragMoveItems(AbstractContainerScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) + public static boolean dragMoveItems(ContainerScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) { @@ -355,7 +355,7 @@ public static void stopDragging() DRAGGED_SLOTS.clear(); } - private static boolean dragMoveFromSlotAtPosition(AbstractContainerScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPosition(ContainerScreen gui, int x, int y, MoveAction action) { if (gui instanceof CreativeInventoryScreen) { @@ -426,7 +426,7 @@ private static boolean dragMoveFromSlotAtPosition(AbstractContainerScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPositionCreative(ContainerScreen gui, int x, int y, MoveAction action) { CreativeInventoryScreen guiCreative = (CreativeInventoryScreen) gui; Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); @@ -469,7 +469,7 @@ private static boolean dragMoveFromSlotAtPositionCreative(AbstractContainerScree rightClickSlot(guiCreative, slot, slotNumber); // Delete the rest of the stack by placing it in the first creative "source slot" - Slot slotFirst = gui.getContainer().slotList.get(0); + Slot slotFirst = gui.getContainer().slots.get(0); leftClickSlot(guiCreative, slotFirst, slotFirst.id); } @@ -520,14 +520,14 @@ private static boolean dragMoveFromSlotAtPositionCreative(AbstractContainerScree return cancel; } - public static void dropStacks(AbstractContainerScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) + public static void dropStacks(ContainerScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) { if (slotReference != null && isStackEmpty(stackReference) == false) { Container container = gui.getContainer(); stackReference = stackReference.copy(); - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { // If this slot is in the same inventory that the items were picked up to the cursor from // and the stack is identical to the one in the cursor, then this stack will get dropped. @@ -540,7 +540,7 @@ public static void dropStacks(AbstractContainerScreen gui, } } - public static boolean shiftDropItems(AbstractContainerScreen gui) + public static boolean shiftDropItems(ContainerScreen gui) { ItemStack stackReference = MinecraftClient.getInstance().player.inventory.getCursorStack(); @@ -558,7 +558,7 @@ public static boolean shiftDropItems(AbstractContainerScreen gui) + public static boolean shiftPlaceItems(Slot slot, ContainerScreen gui) { // Left click to place the items from the cursor to the slot leftClickSlot(gui, slot.id); @@ -650,7 +650,7 @@ else if (slot.hasStack()) return false; } - private static boolean tryMoveSingleItemToOtherInventory(Slot slot, AbstractContainerScreen gui) + private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ContainerScreen gui) { ItemStack stackOrig = slot.getStack(); Container container = gui.getContainer(); @@ -686,7 +686,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, AbstractCont if (targetSlot >= 0) { // Remove the dummy item from the target slot (on the client side) - container.slotList.get(targetSlot).takeStack(1); + container.slots.get(targetSlot).takeStack(1); // Restore the original stack to the slot under the cursor (on the client side) restoreOriginalStacks(container, originalStacks); @@ -702,7 +702,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, AbstractCont return false; } - private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, AbstractContainerScreen gui) + private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, ContainerScreen gui) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -727,7 +727,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, AbstractC int tempSlotNum = -1; // Find some other slot where to store one of the items temporarily - for (Slot slotTmp : gui.getContainer().slotList) + for (Slot slotTmp : gui.getContainer().slots) { if (slotTmp.id != slot.id && areSlotsInSameInventory(slotTmp, slot, true) && @@ -826,7 +826,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, AbstractC return false; } - private static boolean tryMoveSingleItemToThisInventory(Slot slot, AbstractContainerScreen gui) + private static boolean tryMoveSingleItemToThisInventory(Slot slot, ContainerScreen gui) { Container container = gui.getContainer(); ItemStack stackOrig = slot.getStack(); @@ -837,9 +837,9 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, AbstractConta return false; } - for (int slotNum = container.slotList.size() - 1; slotNum >= 0; slotNum--) + for (int slotNum = container.slots.size() - 1; slotNum >= 0; slotNum--) { - Slot slotTmp = container.slotList.get(slotNum); + Slot slotTmp = container.slots.get(slotNum); ItemStack stackTmp = slotTmp.getStack(); if (areSlotsInSameInventory(slotTmp, slot) == false && @@ -856,7 +856,7 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, AbstractConta // If we weren't able to move any items from another inventory, then try to move items // within the same inventory (mostly between the hotbar and the player inventory) /* - for (Slot slotTmp : container.slotList) + for (Slot slotTmp : container.slots) { ItemStack stackTmp = slotTmp.getStack(); @@ -875,19 +875,19 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, AbstractConta return false; } - public static void tryMoveStacks(Slot slot, AbstractContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + public static void tryMoveStacks(Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { tryMoveStacks(slot.getStack(), slot, gui, matchingOnly, toOtherInventory, firstOnly); } - private static void tryMoveStacks(ItemStack stackReference, Slot slot, AbstractContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + private static void tryMoveStacks(ItemStack stackReference, Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { Container container = gui.getContainer(); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; for (int i = maxSlot; i >= 0; i--) { - Slot slotTmp = container.slotList.get(i); + Slot slotTmp = container.slots.get(i); if (slotTmp.id != slot.id && areSlotsInSameInventory(slotTmp, slot) == toOtherInventory && slotTmp.hasStack() && @@ -946,7 +946,7 @@ private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, boolean f } } - private static void fillBuySlot(AbstractContainerScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) + private static void fillBuySlot(ContainerScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) { Slot slot = gui.getContainer().getSlot(slotNum); ItemStack existingStack = slot.getStack(); @@ -966,7 +966,7 @@ private static void fillBuySlot(AbstractContainerScreen gui } } - public static void handleRecipeClick(AbstractContainerScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, + public static void handleRecipeClick(ContainerScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, boolean isLeftClick, boolean isRightClick, boolean isPickBlock, boolean isShiftDown) { if (isLeftClick || isRightClick) @@ -1029,7 +1029,7 @@ else if (isPickBlock) } } - public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, AbstractContainerScreen gui, boolean fillStacks) + public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, ContainerScreen gui, boolean fillStacks) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1039,13 +1039,13 @@ public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, Abstrac } } - public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, AbstractContainerScreen gui) + public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, ContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); loadRecipeItemsToGridForOutputSlot(recipe, gui, slot); } - private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, AbstractContainerScreen gui, Slot outputSlot) + private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, ContainerScreen gui, Slot outputSlot) { if (outputSlot != null && isCraftingSlot(gui, outputSlot) && isStackEmpty(recipe.getResult()) == false) { @@ -1053,7 +1053,7 @@ private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, Abs } } - private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, AbstractContainerScreen gui, + private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, ContainerScreen gui, boolean moveToOtherInventory, boolean moveStacks, boolean moveEverything) { RecipePattern recipe = recipes.getSelectedRecipe(); @@ -1097,7 +1097,7 @@ else if (moveToOtherInventory == false && isStackEmpty(stackRecipeOutput) == fal return false; } - private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, AbstractContainerScreen gui) + private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, ContainerScreen gui) { ItemStack result = recipe.getResult(); int failSafe = 1024; @@ -1121,7 +1121,7 @@ private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, } } - public static void clearFirstCraftingGridOfItems(RecipePattern recipe, AbstractContainerScreen gui, boolean clearNonMatchingOnly) + public static void clearFirstCraftingGridOfItems(RecipePattern recipe, ContainerScreen gui, boolean clearNonMatchingOnly) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1132,7 +1132,7 @@ public static void clearFirstCraftingGridOfItems(RecipePattern recipe, AbstractC } } - public static void clearFirstCraftingGridOfAllItems(AbstractContainerScreen gui) + public static void clearFirstCraftingGridOfAllItems(ContainerScreen gui) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1143,9 +1143,9 @@ public static void clearFirstCraftingGridOfAllItems(AbstractContainerScreen gui, SlotRange range, boolean clearNonMatchingOnly) + private static boolean clearCraftingGridOfItems(RecipePattern recipe, ContainerScreen gui, SlotRange range, boolean clearNonMatchingOnly) { - final int invSlots = gui.getContainer().slotList.size(); + final int invSlots = gui.getContainer().slots.size(); final int rangeSlots = range.getSlotCount(); final int recipeSize = recipe.getRecipeLength(); final int slotCount = Math.min(rangeSlots, recipeSize); @@ -1170,9 +1170,9 @@ private static boolean clearCraftingGridOfItems(RecipePattern recipe, AbstractCo return true; } - private static boolean clearCraftingGridOfAllItems(AbstractContainerScreen gui, SlotRange range) + private static boolean clearCraftingGridOfAllItems(ContainerScreen gui, SlotRange range) { - final int invSlots = gui.getContainer().slotList.size(); + final int invSlots = gui.getContainer().slots.size(); final int rangeSlots = range.getSlotCount(); boolean clearedAll = true; @@ -1195,10 +1195,10 @@ private static boolean clearCraftingGridOfAllItems(AbstractContainerScreen gui, boolean fillStacks) + private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slot slot, ContainerScreen gui, boolean fillStacks) { Container container = gui.getContainer(); - int numSlots = container.slotList.size(); + int numSlots = container.slots.size(); SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); // Check that the slot range is valid and that the recipe can fit into this type of crafting grid @@ -1240,7 +1240,7 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slo return false; } - private static void fillCraftingGrid(AbstractContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void fillCraftingGrid(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { Container container = gui.getContainer(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1322,7 +1322,7 @@ private static void fillCraftingGrid(AbstractContainerScreen gui) + public static void rightClickCraftOneStack(ContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1354,7 +1354,7 @@ public static void rightClickCraftOneStack(AbstractContainerScreen gui) + public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe, ContainerScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1380,14 +1380,14 @@ public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe } } - public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, AbstractContainerScreen gui) + public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, ContainerScreen gui) { if (isStackEmpty(recipe.getResult()) == false) { Slot slot = null; ItemStack stackResult = recipe.getResult().copy(); - for (Slot slotTmp : gui.getContainer().slotList) + for (Slot slotTmp : gui.getContainer().slots) { // This slot is likely in the player inventory, as there is another inventory above if (areStacksEqual(slotTmp.getStack(), stackResult) && @@ -1412,7 +1412,7 @@ public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, } } - public static void throwAllCraftingResultsToGround(RecipePattern recipe, AbstractContainerScreen gui) + public static void throwAllCraftingResultsToGround(RecipePattern recipe, ContainerScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1422,7 +1422,7 @@ public static void throwAllCraftingResultsToGround(RecipePattern recipe, Abstrac } } - private static int putSingleItemIntoSlots(AbstractContainerScreen gui, List targetSlots, int startIndex) + private static int putSingleItemIntoSlots(ContainerScreen gui, List targetSlots, int startIndex) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); @@ -1432,7 +1432,7 @@ private static int putSingleItemIntoSlots(AbstractContainerScreen gui, Slot slot) + public static void moveOneSetOfItemsFromSlotToPlayerInventory(ContainerScreen gui, Slot slot) { leftClickSlot(gui, slot.id); @@ -1472,7 +1472,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(AbstractContainerS } } - private static void moveOneRecipeItemIntoCraftingGrid(AbstractContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void moveOneRecipeItemIntoCraftingGrid(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { Container container = gui.getContainer(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1519,7 +1519,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(AbstractContainerScreen gui, List slotNumbers) + private static boolean moveItemFromCursorToSlots(ContainerScreen gui, List slotNumbers) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -1537,11 +1537,11 @@ private static boolean moveItemFromCursorToSlots(AbstractContainerScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) + private static void moveItemsFromInventory(ContainerScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) { Container container = gui.getContainer(); - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { if (slot == null) { @@ -1571,7 +1571,7 @@ private static int getSlotNumberOfLargestMatchingStackFromDifferentInventory(Con int slotNum = -1; int largest = 0; - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && areStacksEqual(stackReference, slot.getStack())) @@ -1603,7 +1603,7 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(Container int slotNum = -1; int smallest = Integer.MAX_VALUE; - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && areStacksEqual(stackReference, slot.getStack())) @@ -1623,7 +1623,7 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(Container { int largest = 0; - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && areStacksEqual(stackReference, slot.getStack())) @@ -1660,7 +1660,7 @@ private static List getSlotNumbersOfMatchingStacks( ItemStack stackReference, boolean preferPartial, boolean treatHotbarAsDifferent, boolean reverse) { List slots = new ArrayList(64); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; for (int i = reverse ? maxSlot : 0; i >= 0 && i <= maxSlot; i += increment) @@ -1688,7 +1688,7 @@ private static List getSlotNumbersOfMatchingStacks( private static List getSlotNumbersOfMatchingStacks(Container container, ItemStack stackReference, boolean preferPartial) { List slots = new ArrayList(64); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; for (int i = 0; i <= maxSlot; ++i) { @@ -1714,7 +1714,7 @@ private static List getSlotNumbersOfEmptySlots( Container container, Slot slotReference, boolean sameInventory, boolean treatHotbarAsDifferent, boolean reverse) { List slots = new ArrayList(64); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; for (int i = reverse ? maxSlot : 0; i >= 0 && i <= maxSlot; i += increment) @@ -1734,7 +1734,7 @@ private static List getSlotNumbersOfEmptySlots( private static List getSlotNumbersOfEmptySlotsInPlayerInventory(Container container, boolean reverse) { List slots = new ArrayList(64); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; for (int i = reverse ? maxSlot : 0; i >= 0 && i <= maxSlot; i += increment) @@ -1780,11 +1780,11 @@ private static boolean areSlotsInSameInventory(Slot slot1, Slot slot2, boolean t private static ItemStack[] getOriginalStacks(Container container) { - ItemStack[] originalStacks = new ItemStack[container.slotList.size()]; + ItemStack[] originalStacks = new ItemStack[container.slots.size()]; for (int i = 0; i < originalStacks.length; i++) { - originalStacks[i] = container.slotList.get(i).getStack().copy(); + originalStacks[i] = container.slots.get(i).getStack().copy(); } return originalStacks; @@ -1806,7 +1806,7 @@ private static void restoreOriginalStacks(Container container, ItemStack[] origi private static int getTargetSlot(Container container, ItemStack[] originalStacks) { - List slots = container.slotList; + List slots = container.slots; for (int i = 0; i < originalStacks.length; i++) { @@ -1825,9 +1825,9 @@ private static int getTargetSlot(Container container, ItemStack[] originalStacks } /* - private void clickSlotsToMoveItems(Slot slot, AbstractContainerScreen gui, boolean matchingOnly, boolean toOtherInventory) + private void clickSlotsToMoveItems(Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory) { - for (Slot slotTmp : gui.getContainer().slotList) + for (Slot slotTmp : gui.getContainer().slots) { if (slotTmp.id != slot.id && areSlotsInSameInventory(slotTmp, slot) == toOtherInventory && slotTmp.hasStack() && (matchingOnly == false || areStacksEqual(slot.getStack(), slotTmp.getStack()))) @@ -1845,7 +1845,7 @@ private void clickSlotsToMoveItems(Slot slot, AbstractContainerScreen gui, boolean toOtherInventory) + private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, ContainerScreen gui, boolean toOtherInventory) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1857,7 +1857,7 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, AbstractContain return; } - for (Slot slotDst : gui.getContainer().slotList) + for (Slot slotDst : gui.getContainer().slots) { ItemStack stackDst = slotDst.getStack(); @@ -1881,11 +1881,11 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, AbstractContain } } - private static boolean clickSlotsToMoveSingleItem(AbstractContainerScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveSingleItem(ContainerScreen gui, int slotFrom, int slotTo) { //System.out.println("clickSlotsToMoveSingleItem(from: " + slotFrom + ", to: " + slotTo + ")"); MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stack = gui.getContainer().slotList.get(slotFrom).getStack(); + ItemStack stack = gui.getContainer().slots.get(slotFrom).getStack(); if (isStackEmpty(stack)) { @@ -1916,10 +1916,10 @@ private static boolean clickSlotsToMoveSingleItem(AbstractContainerScreen gui, int slotFrom) + private static boolean clickSlotsToMoveSingleItemByShiftClick(ContainerScreen gui, int slotFrom) { MinecraftClient mc = MinecraftClient.getInstance(); - Slot slot = gui.getContainer().slotList.get(slotFrom); + Slot slot = gui.getContainer().slots.get(slotFrom); ItemStack stack = slot.getStack(); if (isStackEmpty(stack)) @@ -1961,7 +1961,7 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(AbstractContainerS * Try move items from slotFrom to slotTo * @return true if at least some items were moved */ - private static boolean clickSlotsToMoveItems(AbstractContainerScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveItems(ContainerScreen gui, int slotFrom, int slotTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1994,9 +1994,9 @@ private static boolean clickSlotsToMoveItems(AbstractContainerScreen gui, int slotNum) + public static void dropStacksUntilEmpty(ContainerScreen gui, int slotNum) { - if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) + if (slotNum >= 0 && slotNum < gui.getContainer().slots.size()) { Slot slot = gui.getContainer().getSlot(slotNum); int failsafe = 64; @@ -2008,9 +2008,9 @@ public static void dropStacksUntilEmpty(AbstractContainerScreen gui, int slotNum, ItemStack stackReference) + public static void dropStacksWhileHasItem(ContainerScreen gui, int slotNum, ItemStack stackReference) { - if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) + if (slotNum >= 0 && slotNum < gui.getContainer().slots.size()) { Slot slot = gui.getContainer().getSlot(slotNum); int failsafe = 256; @@ -2022,7 +2022,7 @@ public static void dropStacksWhileHasItem(AbstractContainerScreen gui, int slotNum) + private static boolean shiftClickSlotWithCheck(ContainerScreen gui, int slotNum) { Slot slot = gui.getContainer().getSlot(slotNum); @@ -2037,7 +2037,7 @@ private static boolean shiftClickSlotWithCheck(AbstractContainerScreen gui, Slot slot, boolean moveUp, MoveAmount amount) + public static boolean tryMoveItemsVertically(ContainerScreen gui, Slot slot, boolean moveUp, MoveAmount amount) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -2074,7 +2074,7 @@ else if (amount == MoveAmount.ALL_MATCHING) return true; } - private static void moveMatchingStacksToSlots(AbstractContainerScreen gui, Slot slot, boolean moveUp) + private static void moveMatchingStacksToSlots(ContainerScreen gui, Slot slot, boolean moveUp) { List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, true, slot.getStack(), true, true, false); List targetSlots = getSlotNumbersOfEmptySlots(gui.getContainer(), slot, false, true, false); @@ -2097,7 +2097,7 @@ private static void moveMatchingStacksToSlots(AbstractContainerScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) + private static Slot moveStackToSlots(ContainerScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2144,7 +2144,7 @@ private static Slot moveStackToSlots(AbstractContainerScreen gui, Slot slotFrom, List slotsTo) + private static void moveOneItemToFirstValidSlot(ContainerScreen gui, Slot slotFrom, List slotsTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2187,7 +2187,7 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Co List slotNumbers = new ArrayList<>(); ItemStack stackSlot = slotIn.getStack(); - for (Slot slotTmp : container.slotList) + for (Slot slotTmp : container.slots) { if (slotTmp.id != slotIn.id && slotTmp.yPosition != slotIn.yPosition) { @@ -2209,7 +2209,7 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Co return slotNumbers; } - public static void tryClearCursor(AbstractContainerScreen gui, MinecraftClient mc) + public static void tryClearCursor(ContainerScreen gui, MinecraftClient mc) { ItemStack stackCursor = mc.player.inventory.getCursorStack(); @@ -2310,9 +2310,9 @@ public int compare(Integer slotNum1, Integer slotNum2) } } - public static void clickSlot(AbstractContainerScreen gui, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(ContainerScreen gui, int slotNum, int mouseButton, SlotActionType type) { - if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) + if (slotNum >= 0 && slotNum < gui.getContainer().slots.size()) { Slot slot = gui.getContainer().getSlot(slotNum); clickSlot(gui, slot, slotNum, mouseButton, type); @@ -2332,7 +2332,7 @@ public static void clickSlot(AbstractContainerScreen gui, i } } - public static void clickSlot(AbstractContainerScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(ContainerScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) { try { @@ -2345,59 +2345,59 @@ public static void clickSlot(AbstractContainerScreen gui, S } } - public static void leftClickSlot(AbstractContainerScreen gui, Slot slot, int slotNumber) + public static void leftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(AbstractContainerScreen gui, Slot slot, int slotNumber) + public static void rightClickSlot(ContainerScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(AbstractContainerScreen gui, Slot slot, int slotNumber) + public static void shiftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.QUICK_MOVE); } - public static void leftClickSlot(AbstractContainerScreen gui, int slotNum) + public static void leftClickSlot(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(AbstractContainerScreen gui, int slotNum) + public static void rightClickSlot(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(AbstractContainerScreen gui, int slotNum) + public static void shiftClickSlot(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.QUICK_MOVE); } - public static void dropItemsFromCursor(AbstractContainerScreen gui) + public static void dropItemsFromCursor(ContainerScreen gui) { clickSlot(gui, -999, 0, SlotActionType.PICKUP); } - public static void dropItem(AbstractContainerScreen gui, int slotNum) + public static void dropItem(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.THROW); } - public static void dropStack(AbstractContainerScreen gui, int slotNum) + public static void dropStack(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.THROW); } - public static void swapSlots(AbstractContainerScreen gui, int slotNum, int otherSlot) + public static void swapSlots(ContainerScreen gui, int slotNum, int otherSlot) { clickSlot(gui, slotNum, 0, SlotActionType.SWAP); clickSlot(gui, otherSlot, 0, SlotActionType.SWAP); clickSlot(gui, slotNum, 0, SlotActionType.SWAP); } - private static void dragSplitItemsIntoSlots(AbstractContainerScreen gui, List targetSlots) + private static void dragSplitItemsIntoSlots(ContainerScreen gui, List targetSlots) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); @@ -2413,7 +2413,7 @@ private static void dragSplitItemsIntoSlots(AbstractContainerScreen=0.10.0-dev.20" + "malilib": "=0.10.0-dev.20" }, "custom": { diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 563b8597e..8bbe3183e 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -4,7 +4,7 @@ "compatibilityLevel": "JAVA_8", "minVersion": "0.7", "client": [ - "IMixinAbstractContainerScreen", + "IMixinContainerScreen", "IMixinMerchantScreen", "IMixinSlot", "MixinAbstractInventoryScreen", From e38efc98d8e8e9bd34545c23a264c3402ee8f25a Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 6 Feb 2020 19:58:38 +0200 Subject: [PATCH 030/107] Downgrade Gradle to 4.9, so it stops nuking the global cache --- build.gradle | 17 +++++++++++++++++ gradle/wrapper/gradle-wrapper.properties | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 48a3b0886..fd5816947 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,24 @@ +buildscript { + repositories { + jcenter() + maven { + name = "Fabric" + url = "https://maven.fabricmc.net/" + } + } + dependencies { + classpath 'net.fabricmc:fabric-loom:0.2.6-SNAPSHOT' + } +} + +apply plugin: "fabric-loom" + +/* plugins { id 'fabric-loom' version '0.2.6-SNAPSHOT' id 'maven-publish' } +*/ repositories { maven { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 70073248c..24635041d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip From 9c016fdd07af95b0f1474e91c32bd2bb45dad2bb Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 6 Feb 2020 19:59:21 +0200 Subject: [PATCH 031/107] Update Yarn mappings to 1.15.2+build.12 --- build.properties | 6 +- .../masa/itemscroller/event/InputHandler.java | 20 +- .../itemscroller/event/KeybindCallbacks.java | 22 +- .../event/RenderEventHandler.java | 22 +- ...Screen.java => IMixinContainerScreen.java} | 13 +- .../itemscroller/recipes/CraftingHandler.java | 28 +-- .../itemscroller/recipes/RecipePattern.java | 12 +- .../itemscroller/recipes/RecipeStorage.java | 14 +- .../masa/itemscroller/util/AccessorUtils.java | 36 +-- .../dy/masa/itemscroller/util/InputUtils.java | 6 +- .../itemscroller/util/InventoryUtils.java | 208 +++++++++--------- src/main/resources/mixins.itemscroller.json | 2 +- 12 files changed, 193 insertions(+), 196 deletions(-) rename src/main/java/fi/dy/masa/itemscroller/mixin/{IMixinAbstractContainerScreen.java => IMixinContainerScreen.java} (52%) diff --git a/build.properties b/build.properties index d071fd5d5..d6811b793 100644 --- a/build.properties +++ b/build.properties @@ -14,7 +14,7 @@ malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.15.2 minecraft_version = 1.15.2 -mappings_version = 1.15.2+build.1 +mappings_version = 1.15.2+build.12 -fabric_loader_version = 0.7.5+build.178 -mod_menu_version = 1.8.3+build.19 +fabric_loader_version = 0.7.8+build.184 +mod_menu_version = 1.8.5+build.23 diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index 38f0d04ac..67585b03a 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -1,6 +1,11 @@ package fi.dy.masa.itemscroller.event; import org.lwjgl.glfw.GLFW; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; +import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.container.Slot; +import net.minecraft.util.math.MathHelper; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -17,11 +22,6 @@ import fi.dy.masa.malilib.hotkeys.IMouseInputHandler; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.KeyCodes; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; -import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; -import net.minecraft.container.Slot; -import net.minecraft.util.math.MathHelper; public class InputHandler implements IKeybindProvider, IKeyboardInputHandler, IMouseInputHandler { @@ -122,11 +122,11 @@ private boolean handleInput(int keyCode, boolean keyState, double dWheel) final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); final int mouseY = fi.dy.masa.malilib.util.InputUtils.getMouseY(); - if (GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && + if (GuiUtils.getCurrentScreen() instanceof ContainerScreen && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) { - AbstractContainerScreen gui = (AbstractContainerScreen) GuiUtils.getCurrentScreen(); + ContainerScreen gui = (ContainerScreen) GuiUtils.getCurrentScreen(); RecipeStorage recipes = RecipeStorage.getInstance(); if (dWheel != 0) @@ -204,14 +204,14 @@ public void onMouseMove(int mouseX, int mouseY) if (this.callbacks.functionalityEnabled() && mc.player != null && - GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && + GuiUtils.getCurrentScreen() instanceof ContainerScreen && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) { - this.handleDragging((AbstractContainerScreen) GuiUtils.getCurrentScreen(), mc, mouseX, mouseY, false); + this.handleDragging((ContainerScreen) GuiUtils.getCurrentScreen(), mc, mouseX, mouseY, false); } } - private boolean handleDragging(AbstractContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) + private boolean handleDragging(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) { MoveAction action = InventoryUtils.getActiveMoveAction(); diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 7a957cbfc..c48a5639c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -1,5 +1,12 @@ package fi.dy.masa.itemscroller.event; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; +import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.client.gui.screen.ingame.InventoryScreen; +import net.minecraft.container.Slot; +import net.minecraft.sound.SoundEvents; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -18,13 +25,6 @@ import fi.dy.masa.malilib.hotkeys.KeyAction; import fi.dy.masa.malilib.interfaces.IClientTickHandler; import fi.dy.masa.malilib.util.GuiUtils; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; -import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; -import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.container.Slot; -import net.minecraft.sound.SoundEvents; public class KeybindCallbacks implements IHotkeyCallback, IClientTickHandler { @@ -80,12 +80,12 @@ else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) return true; } - if (this.disabled || mc == null || mc.player == null || (GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen) == false) + if (this.disabled || mc == null || mc.player == null || (GuiUtils.getCurrentScreen() instanceof ContainerScreen) == false) { return false; } - AbstractContainerScreen gui = (AbstractContainerScreen) GuiUtils.getCurrentScreen(); + ContainerScreen gui = (ContainerScreen) GuiUtils.getCurrentScreen(); Slot slot = AccessorUtils.getSlotUnderMouse(gui); RecipeStorage recipes = RecipeStorage.getInstance(); MoveAction moveAction = InputUtils.getDragMoveAction(key); @@ -170,13 +170,13 @@ public void onClientTick(MinecraftClient mc) if (this.disabled == false && mc != null && mc.player != null && - GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && + GuiUtils.getCurrentScreen() instanceof ContainerScreen && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false && Hotkeys.KEY_MASS_CRAFT.getKeybind().isKeybindHeld()) { Screen guiScreen = GuiUtils.getCurrentScreen(); - AbstractContainerScreen gui = (AbstractContainerScreen) guiScreen; + ContainerScreen gui = (ContainerScreen) guiScreen; Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); if (outputSlot != null) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 52ff7d689..8822ab08f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -5,7 +5,7 @@ import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.util.GlAllocationUtils; import net.minecraft.item.ItemStack; import net.minecraft.util.math.Vec3d; @@ -45,9 +45,9 @@ public static RenderEventHandler instance() public void onDrawBackgroundPost() { - if (GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && InputUtils.isRecipeViewOpen()) + if (GuiUtils.getCurrentScreen() instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) { - AbstractContainerScreen gui = (AbstractContainerScreen) GuiUtils.getCurrentScreen(); + ContainerScreen gui = (ContainerScreen) GuiUtils.getCurrentScreen(); RecipeStorage recipes = RecipeStorage.getInstance(); final int first = recipes.getFirstVisibleRecipeId(); final int countPerPage = recipes.getRecipeCountPerPage(); @@ -89,9 +89,9 @@ public void onDrawBackgroundPost() public void onDrawScreenPost() { - if (GuiUtils.getCurrentScreen() instanceof AbstractContainerScreen && InputUtils.isRecipeViewOpen()) + if (GuiUtils.getCurrentScreen() instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) { - AbstractContainerScreen gui = (AbstractContainerScreen) this.mc.currentScreen; + ContainerScreen gui = (ContainerScreen) this.mc.currentScreen; RecipeStorage recipes = RecipeStorage.getInstance(); final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); @@ -116,7 +116,7 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) } } - private void calculateRecipePositions(AbstractContainerScreen gui) + private void calculateRecipePositions(ContainerScreen gui) { RecipeStorage recipes = RecipeStorage.getInstance(); final int gapHorizontal = 2; @@ -147,7 +147,7 @@ private void calculateRecipePositions(AbstractContainerScreen gui) this.columnWidth = stackBaseHeight + this.numberTextWidth + this.gapColumn; } - private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, AbstractContainerScreen gui) + private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, ContainerScreen gui) { ItemStack stack = recipe.getResult(); @@ -157,7 +157,7 @@ private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, Ab } } - public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, AbstractContainerScreen gui) + public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, ContainerScreen gui) { if (InputUtils.isRecipeViewOpen()) { @@ -186,7 +186,7 @@ public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, Abs return -1; } - private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, AbstractContainerScreen gui, boolean selected) + private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, ContainerScreen gui, boolean selected) { final TextRenderer font = this.mc.textRenderer; final String indexStr = String.valueOf(recipeId + 1); @@ -208,7 +208,7 @@ private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int GlStateManager.popMatrix(); } - private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, AbstractContainerScreen gui) + private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, ContainerScreen gui) { ItemStack[] items = recipe.getRecipeItems(); final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength())); @@ -227,7 +227,7 @@ private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, Abs } } - private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCountPerPage, AbstractContainerScreen gui) + private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCountPerPage, ContainerScreen gui) { final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength())); int scaledStackDimensions = (int) (16 * this.scale); diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java similarity index 52% rename from src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java rename to src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java index 9b0e8f6dd..3f66aa677 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinAbstractContainerScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java @@ -3,21 +3,18 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; -import net.minecraft.container.Slot; -import net.minecraft.container.SlotActionType; -@Mixin(AbstractContainerScreen.class) -public interface IMixinAbstractContainerScreen +@Mixin(net.minecraft.client.gui.screen.ingame.ContainerScreen.class) +public interface IMixinContainerScreen { @Invoker("getSlotAt") - Slot getSlotAtPositionInvoker(double x, double y); + net.minecraft.container.Slot getSlotAtPositionInvoker(double x, double y); @Invoker("onMouseClick") - void handleMouseClickInvoker(Slot slotIn, int slotId, int mouseButton, SlotActionType type); + void handleMouseClickInvoker(net.minecraft.container.Slot slotIn, int slotId, int mouseButton, net.minecraft.container.SlotActionType type); @Accessor("focusedSlot") - Slot getHoveredSlot(); + net.minecraft.container.Slot getHoveredSlot(); @Accessor("x") int getGuiLeft(); diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java index 0eec659c8..988fd774b 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java @@ -5,16 +5,16 @@ import java.util.Map; import java.util.Set; import javax.annotation.Nullable; -import fi.dy.masa.itemscroller.ItemScroller; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.container.Container; import net.minecraft.container.Slot; +import fi.dy.masa.itemscroller.ItemScroller; public class CraftingHandler { private static final Map CRAFTING_GRID_SLOTS = new HashMap(); - private static final Set>> CRAFTING_GUIS = new HashSet<>(); + private static final Set>> CRAFTING_GUIS = new HashSet<>(); public static void clearDefinitions() { @@ -27,7 +27,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot { try { - Class> guiClass = (Class>) Class.forName(guiClassName); + Class> guiClass = (Class>) Class.forName(guiClassName); Class slotClass = (Class) Class.forName(slotClassName); CRAFTING_GRID_SLOTS.put(new CraftingOutputSlot(guiClass, slotClass, outputSlot), range); @@ -46,7 +46,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot public static boolean isCraftingGui(Screen gui) { - return (gui instanceof AbstractContainerScreen) && CRAFTING_GUIS.contains(((AbstractContainerScreen) gui).getClass()); + return (gui instanceof ContainerScreen) && CRAFTING_GUIS.contains(((ContainerScreen) gui).getClass()); } /** @@ -56,17 +56,17 @@ public static boolean isCraftingGui(Screen gui) * @return the SlotRange of the crafting grid, or null, if the given slot is not a crafting output slot */ @Nullable - public static SlotRange getCraftingGridSlots(AbstractContainerScreen gui, Slot slot) + public static SlotRange getCraftingGridSlots(ContainerScreen gui, Slot slot) { return CRAFTING_GRID_SLOTS.get(CraftingOutputSlot.from(gui, slot)); } @Nullable - public static Slot getFirstCraftingOutputSlotForGui(AbstractContainerScreen gui) + public static Slot getFirstCraftingOutputSlotForGui(ContainerScreen gui) { if (CRAFTING_GUIS.contains(gui.getClass())) { - for (Slot slot : gui.getContainer().slotList) + for (Slot slot : gui.getContainer().slots) { if (getCraftingGridSlots(gui, slot) != null) { @@ -80,11 +80,11 @@ public static Slot getFirstCraftingOutputSlotForGui(AbstractContainerScreen> guiClass; + private final Class> guiClass; private final Class slotClass; private final int outputSlot; - private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) + private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) { this.guiClass = guiClass; this.slotClass = slotClass; @@ -92,12 +92,12 @@ private CraftingOutputSlot (Class> guiClass } @SuppressWarnings("unchecked") - public static CraftingOutputSlot from(AbstractContainerScreen gui, Slot slot) + public static CraftingOutputSlot from(ContainerScreen gui, Slot slot) { - return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); + return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); } - public Class> getGuiClass() + public Class> getGuiClass() { return this.guiClass; } @@ -112,7 +112,7 @@ public int getSlotNumber() return this.outputSlot; } - public boolean matches(AbstractContainerScreen gui, Slot slot, int outputSlot) + public boolean matches(ContainerScreen gui, Slot slot, int outputSlot) { return outputSlot == this.outputSlot && gui.getClass() == this.guiClass && slot.getClass() == this.slotClass; } diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java index 59670bf99..cd53ecf31 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java @@ -1,15 +1,15 @@ package fi.dy.masa.itemscroller.recipes; import javax.annotation.Nonnull; -import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; -import fi.dy.masa.itemscroller.util.Constants; -import fi.dy.masa.itemscroller.util.InventoryUtils; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.container.Container; import net.minecraft.container.Slot; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; +import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; +import fi.dy.masa.itemscroller.util.Constants; +import fi.dy.masa.itemscroller.util.InventoryUtils; public class RecipePattern { @@ -45,7 +45,7 @@ public void ensureRecipeSizeAndClearRecipe(int size) this.clearRecipe(); } - public void storeCraftingRecipe(Slot slot, AbstractContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipe(Slot slot, ContainerScreen gui, boolean clearIfEmpty) { SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); @@ -54,7 +54,7 @@ public void storeCraftingRecipe(Slot slot, AbstractContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipeToCurrentSelection(Slot slot, ContainerScreen gui, boolean clearIfEmpty) { this.storeCraftingRecipe(this.getSelection(), slot, gui, clearIfEmpty); } - public void storeCraftingRecipe(int index, Slot slot, AbstractContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipe(int index, Slot slot, ContainerScreen gui, boolean clearIfEmpty) { this.getRecipe(index).storeCraftingRecipe(slot, gui, clearIfEmpty); this.dirty = true; diff --git a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java index b3f6d6b82..7458643ea 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java @@ -1,48 +1,48 @@ package fi.dy.masa.itemscroller.util; -import fi.dy.masa.itemscroller.mixin.IMixinAbstractContainerScreen; -import fi.dy.masa.itemscroller.mixin.IMixinMerchantScreen; -import fi.dy.masa.itemscroller.mixin.IMixinSlot; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; import net.minecraft.container.Slot; import net.minecraft.container.SlotActionType; +import fi.dy.masa.itemscroller.mixin.IMixinContainerScreen; +import fi.dy.masa.itemscroller.mixin.IMixinMerchantScreen; +import fi.dy.masa.itemscroller.mixin.IMixinSlot; public class AccessorUtils { - public static Slot getSlotUnderMouse(AbstractContainerScreen gui) + public static Slot getSlotUnderMouse(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getHoveredSlot(); + return ((IMixinContainerScreen) gui).getHoveredSlot(); } - public static Slot getSlotAtPosition(AbstractContainerScreen gui, int x, int y) + public static Slot getSlotAtPosition(ContainerScreen gui, int x, int y) { - return ((IMixinAbstractContainerScreen) gui).getSlotAtPositionInvoker(x, y); + return ((IMixinContainerScreen) gui).getSlotAtPositionInvoker(x, y); } - public static void handleMouseClick(AbstractContainerScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) + public static void handleMouseClick(ContainerScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) { - ((IMixinAbstractContainerScreen) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); + ((IMixinContainerScreen) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); } - public static int getGuiLeft(AbstractContainerScreen gui) + public static int getGuiLeft(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getGuiLeft(); + return ((IMixinContainerScreen) gui).getGuiLeft(); } - public static int getGuiTop(AbstractContainerScreen gui) + public static int getGuiTop(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getGuiTop(); + return ((IMixinContainerScreen) gui).getGuiTop(); } - public static int getGuiXSize(AbstractContainerScreen gui) + public static int getGuiXSize(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getGuiSizeX(); + return ((IMixinContainerScreen) gui).getGuiSizeX(); } - public static int getGuiYSize(AbstractContainerScreen gui) + public static int getGuiYSize(ContainerScreen gui) { - return ((IMixinAbstractContainerScreen) gui).getGuiSizeY(); + return ((IMixinContainerScreen) gui).getGuiSizeY(); } public static int getSelectedMerchantRecipe(MerchantScreen gui) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index d0cbb251b..55999be5c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -1,13 +1,13 @@ package fi.dy.masa.itemscroller.util; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.event.KeybindCallbacks; import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.malilib.hotkeys.IKeybind; import fi.dy.masa.malilib.hotkeys.KeybindMulti; import fi.dy.masa.malilib.util.GuiUtils; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; public class InputUtils { @@ -19,7 +19,7 @@ public static boolean isRecipeViewOpen() CraftingHandler.isCraftingGui(GuiUtils.getCurrentScreen()); } - public static boolean canShiftDropItems(AbstractContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY) + public static boolean canShiftDropItems(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY) { if (InventoryUtils.isStackEmpty(mc.player.inventory.getCursorStack()) == false) { diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 1eec3502b..5dd44dd91 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -11,7 +11,7 @@ import java.util.Set; import javax.annotation.Nullable; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.AbstractContainerScreen; +import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; @@ -99,7 +99,7 @@ public static String getStackString(ItemStack stack) return ""; } - public static void debugPrintSlotInfo(AbstractContainerScreen gui, Slot slot) + public static void debugPrintSlotInfo(ContainerScreen gui, Slot slot) { if (slot == null) { @@ -107,7 +107,7 @@ public static void debugPrintSlotInfo(AbstractContainerScreen", hasSlot ? " true" : "false", stackStr, - gui.getContainer().slotList.size())); + gui.getContainer().slots.size())); } - private static boolean isValidSlot(Slot slot, AbstractContainerScreen gui, boolean requireItems) + private static boolean isValidSlot(Slot slot, ContainerScreen gui, boolean requireItems) { Container container = gui.getContainer(); - return container != null && container.slotList != null && - slot != null && container.slotList.contains(slot) && + return container != null && container.slots != null && + slot != null && container.slots.contains(slot) && (requireItems == false || slot.hasStack()) && Configs.SLOT_BLACKLIST.contains(slot.getClass().getName()) == false; } - public static boolean isCraftingSlot(AbstractContainerScreen gui, @Nullable Slot slot) + public static boolean isCraftingSlot(ContainerScreen gui, @Nullable Slot slot) { return slot != null && CraftingHandler.getCraftingGridSlots(gui, slot) != null; } @@ -138,7 +138,7 @@ public static boolean isCraftingSlot(AbstractContainerScreen gui) + public static boolean canShiftPlaceItems(ContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -160,7 +160,7 @@ public static boolean canShiftPlaceItems(AbstractContainerScreen gui, RecipeStorage recipes, boolean scrollingUp) + public static boolean tryMoveItems(ContainerScreen gui, RecipeStorage recipes, boolean scrollingUp) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -252,7 +252,7 @@ else if (getStackSize(stack) < slot.getMaxStackAmount(stack)) return false; } - public static boolean dragMoveItems(AbstractContainerScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) + public static boolean dragMoveItems(ContainerScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) { @@ -355,7 +355,7 @@ public static void stopDragging() DRAGGED_SLOTS.clear(); } - private static boolean dragMoveFromSlotAtPosition(AbstractContainerScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPosition(ContainerScreen gui, int x, int y, MoveAction action) { if (gui instanceof CreativeInventoryScreen) { @@ -426,7 +426,7 @@ private static boolean dragMoveFromSlotAtPosition(AbstractContainerScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPositionCreative(ContainerScreen gui, int x, int y, MoveAction action) { CreativeInventoryScreen guiCreative = (CreativeInventoryScreen) gui; Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); @@ -469,7 +469,7 @@ private static boolean dragMoveFromSlotAtPositionCreative(AbstractContainerScree rightClickSlot(guiCreative, slot, slotNumber); // Delete the rest of the stack by placing it in the first creative "source slot" - Slot slotFirst = gui.getContainer().slotList.get(0); + Slot slotFirst = gui.getContainer().slots.get(0); leftClickSlot(guiCreative, slotFirst, slotFirst.id); } @@ -520,14 +520,14 @@ private static boolean dragMoveFromSlotAtPositionCreative(AbstractContainerScree return cancel; } - public static void dropStacks(AbstractContainerScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) + public static void dropStacks(ContainerScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) { if (slotReference != null && isStackEmpty(stackReference) == false) { Container container = gui.getContainer(); stackReference = stackReference.copy(); - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { // If this slot is in the same inventory that the items were picked up to the cursor from // and the stack is identical to the one in the cursor, then this stack will get dropped. @@ -540,7 +540,7 @@ public static void dropStacks(AbstractContainerScreen gui, } } - public static boolean shiftDropItems(AbstractContainerScreen gui) + public static boolean shiftDropItems(ContainerScreen gui) { ItemStack stackReference = MinecraftClient.getInstance().player.inventory.getCursorStack(); @@ -558,7 +558,7 @@ public static boolean shiftDropItems(AbstractContainerScreen gui) + public static boolean shiftPlaceItems(Slot slot, ContainerScreen gui) { // Left click to place the items from the cursor to the slot leftClickSlot(gui, slot.id); @@ -650,7 +650,7 @@ else if (slot.hasStack()) return false; } - private static boolean tryMoveSingleItemToOtherInventory(Slot slot, AbstractContainerScreen gui) + private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ContainerScreen gui) { ItemStack stackOrig = slot.getStack(); Container container = gui.getContainer(); @@ -686,7 +686,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, AbstractCont if (targetSlot >= 0) { // Remove the dummy item from the target slot (on the client side) - container.slotList.get(targetSlot).takeStack(1); + container.slots.get(targetSlot).takeStack(1); // Restore the original stack to the slot under the cursor (on the client side) restoreOriginalStacks(container, originalStacks); @@ -702,7 +702,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, AbstractCont return false; } - private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, AbstractContainerScreen gui) + private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, ContainerScreen gui) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -727,7 +727,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, AbstractC int tempSlotNum = -1; // Find some other slot where to store one of the items temporarily - for (Slot slotTmp : gui.getContainer().slotList) + for (Slot slotTmp : gui.getContainer().slots) { if (slotTmp.id != slot.id && areSlotsInSameInventory(slotTmp, slot, true) && @@ -826,7 +826,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, AbstractC return false; } - private static boolean tryMoveSingleItemToThisInventory(Slot slot, AbstractContainerScreen gui) + private static boolean tryMoveSingleItemToThisInventory(Slot slot, ContainerScreen gui) { Container container = gui.getContainer(); ItemStack stackOrig = slot.getStack(); @@ -837,9 +837,9 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, AbstractConta return false; } - for (int slotNum = container.slotList.size() - 1; slotNum >= 0; slotNum--) + for (int slotNum = container.slots.size() - 1; slotNum >= 0; slotNum--) { - Slot slotTmp = container.slotList.get(slotNum); + Slot slotTmp = container.slots.get(slotNum); ItemStack stackTmp = slotTmp.getStack(); if (areSlotsInSameInventory(slotTmp, slot) == false && @@ -856,7 +856,7 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, AbstractConta // If we weren't able to move any items from another inventory, then try to move items // within the same inventory (mostly between the hotbar and the player inventory) /* - for (Slot slotTmp : container.slotList) + for (Slot slotTmp : container.slots) { ItemStack stackTmp = slotTmp.getStack(); @@ -875,19 +875,19 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, AbstractConta return false; } - public static void tryMoveStacks(Slot slot, AbstractContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + public static void tryMoveStacks(Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { tryMoveStacks(slot.getStack(), slot, gui, matchingOnly, toOtherInventory, firstOnly); } - private static void tryMoveStacks(ItemStack stackReference, Slot slot, AbstractContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + private static void tryMoveStacks(ItemStack stackReference, Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { Container container = gui.getContainer(); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; for (int i = maxSlot; i >= 0; i--) { - Slot slotTmp = container.slotList.get(i); + Slot slotTmp = container.slots.get(i); if (slotTmp.id != slot.id && areSlotsInSameInventory(slotTmp, slot) == toOtherInventory && slotTmp.hasStack() && @@ -946,7 +946,7 @@ private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, boolean f } } - private static void fillBuySlot(AbstractContainerScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) + private static void fillBuySlot(ContainerScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) { Slot slot = gui.getContainer().getSlot(slotNum); ItemStack existingStack = slot.getStack(); @@ -966,7 +966,7 @@ private static void fillBuySlot(AbstractContainerScreen gui } } - public static void handleRecipeClick(AbstractContainerScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, + public static void handleRecipeClick(ContainerScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, boolean isLeftClick, boolean isRightClick, boolean isPickBlock, boolean isShiftDown) { if (isLeftClick || isRightClick) @@ -1029,7 +1029,7 @@ else if (isPickBlock) } } - public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, AbstractContainerScreen gui, boolean fillStacks) + public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, ContainerScreen gui, boolean fillStacks) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1039,13 +1039,13 @@ public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, Abstrac } } - public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, AbstractContainerScreen gui) + public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, ContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); loadRecipeItemsToGridForOutputSlot(recipe, gui, slot); } - private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, AbstractContainerScreen gui, Slot outputSlot) + private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, ContainerScreen gui, Slot outputSlot) { if (outputSlot != null && isCraftingSlot(gui, outputSlot) && isStackEmpty(recipe.getResult()) == false) { @@ -1053,7 +1053,7 @@ private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, Abs } } - private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, AbstractContainerScreen gui, + private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, ContainerScreen gui, boolean moveToOtherInventory, boolean moveStacks, boolean moveEverything) { RecipePattern recipe = recipes.getSelectedRecipe(); @@ -1097,7 +1097,7 @@ else if (moveToOtherInventory == false && isStackEmpty(stackRecipeOutput) == fal return false; } - private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, AbstractContainerScreen gui) + private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, ContainerScreen gui) { ItemStack result = recipe.getResult(); int failSafe = 1024; @@ -1121,7 +1121,7 @@ private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, } } - public static void clearFirstCraftingGridOfItems(RecipePattern recipe, AbstractContainerScreen gui, boolean clearNonMatchingOnly) + public static void clearFirstCraftingGridOfItems(RecipePattern recipe, ContainerScreen gui, boolean clearNonMatchingOnly) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1132,7 +1132,7 @@ public static void clearFirstCraftingGridOfItems(RecipePattern recipe, AbstractC } } - public static void clearFirstCraftingGridOfAllItems(AbstractContainerScreen gui) + public static void clearFirstCraftingGridOfAllItems(ContainerScreen gui) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1143,9 +1143,9 @@ public static void clearFirstCraftingGridOfAllItems(AbstractContainerScreen gui, SlotRange range, boolean clearNonMatchingOnly) + private static boolean clearCraftingGridOfItems(RecipePattern recipe, ContainerScreen gui, SlotRange range, boolean clearNonMatchingOnly) { - final int invSlots = gui.getContainer().slotList.size(); + final int invSlots = gui.getContainer().slots.size(); final int rangeSlots = range.getSlotCount(); final int recipeSize = recipe.getRecipeLength(); final int slotCount = Math.min(rangeSlots, recipeSize); @@ -1170,9 +1170,9 @@ private static boolean clearCraftingGridOfItems(RecipePattern recipe, AbstractCo return true; } - private static boolean clearCraftingGridOfAllItems(AbstractContainerScreen gui, SlotRange range) + private static boolean clearCraftingGridOfAllItems(ContainerScreen gui, SlotRange range) { - final int invSlots = gui.getContainer().slotList.size(); + final int invSlots = gui.getContainer().slots.size(); final int rangeSlots = range.getSlotCount(); boolean clearedAll = true; @@ -1195,10 +1195,10 @@ private static boolean clearCraftingGridOfAllItems(AbstractContainerScreen gui, boolean fillStacks) + private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slot slot, ContainerScreen gui, boolean fillStacks) { Container container = gui.getContainer(); - int numSlots = container.slotList.size(); + int numSlots = container.slots.size(); SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); // Check that the slot range is valid and that the recipe can fit into this type of crafting grid @@ -1240,7 +1240,7 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slo return false; } - private static void fillCraftingGrid(AbstractContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void fillCraftingGrid(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { Container container = gui.getContainer(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1322,7 +1322,7 @@ private static void fillCraftingGrid(AbstractContainerScreen gui) + public static void rightClickCraftOneStack(ContainerScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1354,7 +1354,7 @@ public static void rightClickCraftOneStack(AbstractContainerScreen gui) + public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe, ContainerScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1380,14 +1380,14 @@ public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe } } - public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, AbstractContainerScreen gui) + public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, ContainerScreen gui) { if (isStackEmpty(recipe.getResult()) == false) { Slot slot = null; ItemStack stackResult = recipe.getResult().copy(); - for (Slot slotTmp : gui.getContainer().slotList) + for (Slot slotTmp : gui.getContainer().slots) { // This slot is likely in the player inventory, as there is another inventory above if (areStacksEqual(slotTmp.getStack(), stackResult) && @@ -1412,7 +1412,7 @@ public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, } } - public static void throwAllCraftingResultsToGround(RecipePattern recipe, AbstractContainerScreen gui) + public static void throwAllCraftingResultsToGround(RecipePattern recipe, ContainerScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1422,7 +1422,7 @@ public static void throwAllCraftingResultsToGround(RecipePattern recipe, Abstrac } } - private static int putSingleItemIntoSlots(AbstractContainerScreen gui, List targetSlots, int startIndex) + private static int putSingleItemIntoSlots(ContainerScreen gui, List targetSlots, int startIndex) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); @@ -1432,7 +1432,7 @@ private static int putSingleItemIntoSlots(AbstractContainerScreen gui, Slot slot) + public static void moveOneSetOfItemsFromSlotToPlayerInventory(ContainerScreen gui, Slot slot) { leftClickSlot(gui, slot.id); @@ -1472,7 +1472,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(AbstractContainerS } } - private static void moveOneRecipeItemIntoCraftingGrid(AbstractContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void moveOneRecipeItemIntoCraftingGrid(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { Container container = gui.getContainer(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1519,7 +1519,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(AbstractContainerScreen gui, List slotNumbers) + private static boolean moveItemFromCursorToSlots(ContainerScreen gui, List slotNumbers) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -1537,11 +1537,11 @@ private static boolean moveItemFromCursorToSlots(AbstractContainerScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) + private static void moveItemsFromInventory(ContainerScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) { Container container = gui.getContainer(); - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { if (slot == null) { @@ -1571,7 +1571,7 @@ private static int getSlotNumberOfLargestMatchingStackFromDifferentInventory(Con int slotNum = -1; int largest = 0; - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && areStacksEqual(stackReference, slot.getStack())) @@ -1603,7 +1603,7 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(Container int slotNum = -1; int smallest = Integer.MAX_VALUE; - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && areStacksEqual(stackReference, slot.getStack())) @@ -1623,7 +1623,7 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(Container { int largest = 0; - for (Slot slot : container.slotList) + for (Slot slot : container.slots) { if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && areStacksEqual(stackReference, slot.getStack())) @@ -1660,7 +1660,7 @@ private static List getSlotNumbersOfMatchingStacks( ItemStack stackReference, boolean preferPartial, boolean treatHotbarAsDifferent, boolean reverse) { List slots = new ArrayList(64); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; for (int i = reverse ? maxSlot : 0; i >= 0 && i <= maxSlot; i += increment) @@ -1688,7 +1688,7 @@ private static List getSlotNumbersOfMatchingStacks( private static List getSlotNumbersOfMatchingStacks(Container container, ItemStack stackReference, boolean preferPartial) { List slots = new ArrayList(64); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; for (int i = 0; i <= maxSlot; ++i) { @@ -1714,7 +1714,7 @@ private static List getSlotNumbersOfEmptySlots( Container container, Slot slotReference, boolean sameInventory, boolean treatHotbarAsDifferent, boolean reverse) { List slots = new ArrayList(64); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; for (int i = reverse ? maxSlot : 0; i >= 0 && i <= maxSlot; i += increment) @@ -1734,7 +1734,7 @@ private static List getSlotNumbersOfEmptySlots( private static List getSlotNumbersOfEmptySlotsInPlayerInventory(Container container, boolean reverse) { List slots = new ArrayList(64); - final int maxSlot = container.slotList.size() - 1; + final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; for (int i = reverse ? maxSlot : 0; i >= 0 && i <= maxSlot; i += increment) @@ -1780,11 +1780,11 @@ private static boolean areSlotsInSameInventory(Slot slot1, Slot slot2, boolean t private static ItemStack[] getOriginalStacks(Container container) { - ItemStack[] originalStacks = new ItemStack[container.slotList.size()]; + ItemStack[] originalStacks = new ItemStack[container.slots.size()]; for (int i = 0; i < originalStacks.length; i++) { - originalStacks[i] = container.slotList.get(i).getStack().copy(); + originalStacks[i] = container.slots.get(i).getStack().copy(); } return originalStacks; @@ -1806,7 +1806,7 @@ private static void restoreOriginalStacks(Container container, ItemStack[] origi private static int getTargetSlot(Container container, ItemStack[] originalStacks) { - List slots = container.slotList; + List slots = container.slots; for (int i = 0; i < originalStacks.length; i++) { @@ -1825,9 +1825,9 @@ private static int getTargetSlot(Container container, ItemStack[] originalStacks } /* - private void clickSlotsToMoveItems(Slot slot, AbstractContainerScreen gui, boolean matchingOnly, boolean toOtherInventory) + private void clickSlotsToMoveItems(Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory) { - for (Slot slotTmp : gui.getContainer().slotList) + for (Slot slotTmp : gui.getContainer().slots) { if (slotTmp.id != slot.id && areSlotsInSameInventory(slotTmp, slot) == toOtherInventory && slotTmp.hasStack() && (matchingOnly == false || areStacksEqual(slot.getStack(), slotTmp.getStack()))) @@ -1845,7 +1845,7 @@ private void clickSlotsToMoveItems(Slot slot, AbstractContainerScreen gui, boolean toOtherInventory) + private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, ContainerScreen gui, boolean toOtherInventory) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1857,7 +1857,7 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, AbstractContain return; } - for (Slot slotDst : gui.getContainer().slotList) + for (Slot slotDst : gui.getContainer().slots) { ItemStack stackDst = slotDst.getStack(); @@ -1881,11 +1881,11 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, AbstractContain } } - private static boolean clickSlotsToMoveSingleItem(AbstractContainerScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveSingleItem(ContainerScreen gui, int slotFrom, int slotTo) { //System.out.println("clickSlotsToMoveSingleItem(from: " + slotFrom + ", to: " + slotTo + ")"); MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stack = gui.getContainer().slotList.get(slotFrom).getStack(); + ItemStack stack = gui.getContainer().slots.get(slotFrom).getStack(); if (isStackEmpty(stack)) { @@ -1916,10 +1916,10 @@ private static boolean clickSlotsToMoveSingleItem(AbstractContainerScreen gui, int slotFrom) + private static boolean clickSlotsToMoveSingleItemByShiftClick(ContainerScreen gui, int slotFrom) { MinecraftClient mc = MinecraftClient.getInstance(); - Slot slot = gui.getContainer().slotList.get(slotFrom); + Slot slot = gui.getContainer().slots.get(slotFrom); ItemStack stack = slot.getStack(); if (isStackEmpty(stack)) @@ -1961,7 +1961,7 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(AbstractContainerS * Try move items from slotFrom to slotTo * @return true if at least some items were moved */ - private static boolean clickSlotsToMoveItems(AbstractContainerScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveItems(ContainerScreen gui, int slotFrom, int slotTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1994,9 +1994,9 @@ private static boolean clickSlotsToMoveItems(AbstractContainerScreen gui, int slotNum) + public static void dropStacksUntilEmpty(ContainerScreen gui, int slotNum) { - if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) + if (slotNum >= 0 && slotNum < gui.getContainer().slots.size()) { Slot slot = gui.getContainer().getSlot(slotNum); int failsafe = 64; @@ -2008,9 +2008,9 @@ public static void dropStacksUntilEmpty(AbstractContainerScreen gui, int slotNum, ItemStack stackReference) + public static void dropStacksWhileHasItem(ContainerScreen gui, int slotNum, ItemStack stackReference) { - if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) + if (slotNum >= 0 && slotNum < gui.getContainer().slots.size()) { Slot slot = gui.getContainer().getSlot(slotNum); int failsafe = 256; @@ -2022,7 +2022,7 @@ public static void dropStacksWhileHasItem(AbstractContainerScreen gui, int slotNum) + private static boolean shiftClickSlotWithCheck(ContainerScreen gui, int slotNum) { Slot slot = gui.getContainer().getSlot(slotNum); @@ -2037,7 +2037,7 @@ private static boolean shiftClickSlotWithCheck(AbstractContainerScreen gui, Slot slot, boolean moveUp, MoveAmount amount) + public static boolean tryMoveItemsVertically(ContainerScreen gui, Slot slot, boolean moveUp, MoveAmount amount) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -2074,7 +2074,7 @@ else if (amount == MoveAmount.ALL_MATCHING) return true; } - private static void moveMatchingStacksToSlots(AbstractContainerScreen gui, Slot slot, boolean moveUp) + private static void moveMatchingStacksToSlots(ContainerScreen gui, Slot slot, boolean moveUp) { List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, true, slot.getStack(), true, true, false); List targetSlots = getSlotNumbersOfEmptySlots(gui.getContainer(), slot, false, true, false); @@ -2097,7 +2097,7 @@ private static void moveMatchingStacksToSlots(AbstractContainerScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) + private static Slot moveStackToSlots(ContainerScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2144,7 +2144,7 @@ private static Slot moveStackToSlots(AbstractContainerScreen gui, Slot slotFrom, List slotsTo) + private static void moveOneItemToFirstValidSlot(ContainerScreen gui, Slot slotFrom, List slotsTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2187,7 +2187,7 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Co List slotNumbers = new ArrayList<>(); ItemStack stackSlot = slotIn.getStack(); - for (Slot slotTmp : container.slotList) + for (Slot slotTmp : container.slots) { if (slotTmp.id != slotIn.id && slotTmp.yPosition != slotIn.yPosition) { @@ -2209,7 +2209,7 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Co return slotNumbers; } - public static void tryClearCursor(AbstractContainerScreen gui, MinecraftClient mc) + public static void tryClearCursor(ContainerScreen gui, MinecraftClient mc) { ItemStack stackCursor = mc.player.inventory.getCursorStack(); @@ -2310,9 +2310,9 @@ public int compare(Integer slotNum1, Integer slotNum2) } } - public static void clickSlot(AbstractContainerScreen gui, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(ContainerScreen gui, int slotNum, int mouseButton, SlotActionType type) { - if (slotNum >= 0 && slotNum < gui.getContainer().slotList.size()) + if (slotNum >= 0 && slotNum < gui.getContainer().slots.size()) { Slot slot = gui.getContainer().getSlot(slotNum); clickSlot(gui, slot, slotNum, mouseButton, type); @@ -2332,7 +2332,7 @@ public static void clickSlot(AbstractContainerScreen gui, i } } - public static void clickSlot(AbstractContainerScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(ContainerScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) { try { @@ -2345,59 +2345,59 @@ public static void clickSlot(AbstractContainerScreen gui, S } } - public static void leftClickSlot(AbstractContainerScreen gui, Slot slot, int slotNumber) + public static void leftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(AbstractContainerScreen gui, Slot slot, int slotNumber) + public static void rightClickSlot(ContainerScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(AbstractContainerScreen gui, Slot slot, int slotNumber) + public static void shiftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.QUICK_MOVE); } - public static void leftClickSlot(AbstractContainerScreen gui, int slotNum) + public static void leftClickSlot(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(AbstractContainerScreen gui, int slotNum) + public static void rightClickSlot(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(AbstractContainerScreen gui, int slotNum) + public static void shiftClickSlot(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.QUICK_MOVE); } - public static void dropItemsFromCursor(AbstractContainerScreen gui) + public static void dropItemsFromCursor(ContainerScreen gui) { clickSlot(gui, -999, 0, SlotActionType.PICKUP); } - public static void dropItem(AbstractContainerScreen gui, int slotNum) + public static void dropItem(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.THROW); } - public static void dropStack(AbstractContainerScreen gui, int slotNum) + public static void dropStack(ContainerScreen gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.THROW); } - public static void swapSlots(AbstractContainerScreen gui, int slotNum, int otherSlot) + public static void swapSlots(ContainerScreen gui, int slotNum, int otherSlot) { clickSlot(gui, slotNum, 0, SlotActionType.SWAP); clickSlot(gui, otherSlot, 0, SlotActionType.SWAP); clickSlot(gui, slotNum, 0, SlotActionType.SWAP); } - private static void dragSplitItemsIntoSlots(AbstractContainerScreen gui, List targetSlots) + private static void dragSplitItemsIntoSlots(ContainerScreen gui, List targetSlots) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); @@ -2413,7 +2413,7 @@ private static void dragSplitItemsIntoSlots(AbstractContainerScreen Date: Wed, 12 Feb 2020 18:26:53 +0200 Subject: [PATCH 032/107] Fix recipe view rendering issues --- .../itemscroller/event/RenderEventHandler.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 8822ab08f..ee7ee03b7 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -3,9 +3,11 @@ import java.nio.FloatBuffer; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.screen.ingame.ContainerScreen; +import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.util.GlAllocationUtils; import net.minecraft.item.ItemStack; import net.minecraft.util.math.Vec3d; @@ -98,6 +100,10 @@ public void onDrawScreenPost() final int mouseY = fi.dy.masa.malilib.util.InputUtils.getMouseY(); final int recipeId = this.getHoveredRecipeId(mouseX, mouseY, recipes, gui); + float offset = 300f; + RenderSystem.pushMatrix(); + RenderSystem.translatef(0f, 0f, offset); + if (recipeId >= 0) { RecipePattern recipe = recipes.getRecipe(recipeId); @@ -113,6 +119,8 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) InventoryOverlay.renderStackToolTip(mouseX, mouseY, stack, this.mc); } } + + RenderSystem.popMatrix(); } } @@ -140,7 +148,7 @@ private void calculateRecipePositions(ContainerScreen gui) int maxStackDimensionsHorizontal = (int) (((usableWidth - (this.columns * (this.numberTextWidth + this.gapColumn))) / (this.columns + 3 + 0.8)) * gapScaleHorizontal); int stackDimensions = (int) Math.min(maxStackDimensionsVertical, maxStackDimensionsHorizontal); - this.scale = (int) Math.ceil(((double) stackDimensions / (double) stackBaseHeight)); + this.scale = (double) stackDimensions / (double) stackBaseHeight; this.entryHeight = stackBaseHeight + gapVertical; this.recipeListX = guiLeft - (int) ((this.columns * (stackBaseHeight + this.numberTextWidth + this.gapColumn) + gapHorizontal) * this.scale); this.recipeListY = (int) (this.entryHeight * this.scale); @@ -262,7 +270,7 @@ private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePatte private void renderStackAt(ItemStack stack, int x, int y, boolean border) { GlStateManager.pushMatrix(); - GlStateManager.disableLighting(); + final int w = 16; if (border) @@ -283,7 +291,7 @@ private void renderStackAt(ItemStack stack, int x, int y, boolean border) if (InventoryUtils.isStackEmpty(stack) == false) { - enableGUIStandardItemLighting((float) this.scale); + DiffuseLighting.enableGuiDepthLighting(); stack = stack.copy(); InventoryUtils.setStackSize(stack, 1); @@ -292,8 +300,6 @@ private void renderStackAt(ItemStack stack, int x, int y, boolean border) this.mc.getItemRenderer().zOffset -= 100; } - RenderUtils.disableDiffuseLighting(); - GlStateManager.disableBlend(); GlStateManager.popMatrix(); } From b71de98c652ee64be95f7c4b0683ad503eaef124 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 12 Feb 2020 18:32:41 +0200 Subject: [PATCH 033/107] Change GlStateManager calls into RenderSystem calls --- .../event/RenderEventHandler.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index ee7ee03b7..8d7d0507c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -57,9 +57,9 @@ public void onDrawBackgroundPost() this.calculateRecipePositions(gui); - GlStateManager.pushMatrix(); - GlStateManager.translatef(this.recipeListX, this.recipeListY, 0); - GlStateManager.scaled(this.scale, this.scale, 1); + RenderSystem.pushMatrix(); + RenderSystem.translatef(this.recipeListX, this.recipeListY, 0); + RenderSystem.scaled(this.scale, this.scale, 1); String str = StringUtils.translate("itemscroller.gui.label.recipe_page", (first / countPerPage) + 1, recipes.getTotalRecipeCount() / countPerPage); this.mc.textRenderer.draw(str, 16, -12, 0xC0C0C0C0); @@ -84,8 +84,8 @@ public void onDrawBackgroundPost() this.renderRecipeItems(recipe, recipes.getRecipeCountPerPage(), gui); } - GlStateManager.popMatrix(); - GlStateManager.enableBlend(); // Fixes the crafting book icon rendering + RenderSystem.popMatrix(); + RenderSystem.enableBlend(); // Fixes the crafting book icon rendering } } @@ -207,13 +207,13 @@ private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int x = x - (int) (font.getStringWidth(indexStr) * scale) - 2; y = row * this.entryHeight + this.entryHeight / 2 - font.fontHeight / 2; - GlStateManager.pushMatrix(); - GlStateManager.translatef(x, y, 0); - GlStateManager.scaled(scale, scale, 0); + RenderSystem.pushMatrix(); + RenderSystem.translatef(x, y, 0); + RenderSystem.scaled(scale, scale, 0); font.draw(indexStr, 0, 0, 0xC0C0C0); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, ContainerScreen gui) @@ -269,7 +269,7 @@ private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePatte private void renderStackAt(ItemStack stack, int x, int y, boolean border) { - GlStateManager.pushMatrix(); + RenderSystem.pushMatrix(); final int w = 16; @@ -300,27 +300,27 @@ private void renderStackAt(ItemStack stack, int x, int y, boolean border) this.mc.getItemRenderer().zOffset -= 100; } - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } public static void enableGUIStandardItemLighting(float scale) { - GlStateManager.pushMatrix(); - GlStateManager.rotatef(-30.0F, 0.0F, 1.0F, 0.0F); - GlStateManager.rotatef(165.0F, 1.0F, 0.0F, 0.0F); + RenderSystem.pushMatrix(); + RenderSystem.rotatef(-30.0F, 0.0F, 1.0F, 0.0F); + RenderSystem.rotatef(165.0F, 1.0F, 0.0F, 0.0F); enableStandardItemLighting(scale); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } public static void enableStandardItemLighting(float scale) { - GlStateManager.enableLighting(); + RenderSystem.enableLighting(); GlStateManager.enableLight(0); GlStateManager.enableLight(1); - GlStateManager.enableColorMaterial(); - GlStateManager.colorMaterial(1032, 5634); + RenderSystem.enableColorMaterial(); + RenderSystem.colorMaterial(1032, 5634); float lightStrength = 0.3F * scale; float ambientLightStrength = 0.4F; @@ -335,7 +335,7 @@ public static void enableStandardItemLighting(float scale) GlStateManager.light(16385, 4608, singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); GlStateManager.light(16385, 4610, singletonBuffer(0.0F, 0.0F, 0.0F, 1.0F)); - GlStateManager.shadeModel(GL11.GL_FLAT); + RenderSystem.shadeModel(GL11.GL_FLAT); GlStateManager.lightModel(2899, singletonBuffer(ambientLightStrength, ambientLightStrength, ambientLightStrength, 1.0F)); } From 8f594360ac8207e6a222fc580547af3e70c1a480 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sat, 29 Feb 2020 03:54:26 +0200 Subject: [PATCH 034/107] Update to MC 1.16 snapshot 20w09a --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index 7a40613f8..603883b58 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.20+beta.1 +malilib_version = 0.10.0-dev.20+beta.2 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w06a -minecraft_version = 20w06a -mappings_version = 20w06a+build.2 +minecraft_version_out = 1.16-snap-20w09a +minecraft_version = 20w09a +mappings_version = 20w09a+build.6 fabric_loader_version = 0.7.8+build.184 mod_menu_version = 1.8.5+build.23 From f72344bd3c98a0b216eea5c94496c0a5af862cf8 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 5 Mar 2020 23:51:28 +0200 Subject: [PATCH 035/107] Update to MC 1.16 snapshot 20w10a --- build.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index 603883b58..da7786615 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.20+beta.2 +malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w09a -minecraft_version = 20w09a -mappings_version = 20w09a+build.6 +minecraft_version_out = 1.16-snap-20w10a +minecraft_version = 20w10a +mappings_version = 20w10a+build.2 -fabric_loader_version = 0.7.8+build.184 +fabric_loader_version = 0.7.8+build.186 mod_menu_version = 1.8.5+build.23 From 1d3fe5743bb1cceb70b3f99c61c64ff451997eb0 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 11 Mar 2020 23:40:07 +0200 Subject: [PATCH 036/107] Update to MC 1.16 snapshot 20w11a --- build.properties | 8 +- .../dy/masa/itemscroller/config/Configs.java | 2 +- .../masa/itemscroller/event/InputHandler.java | 14 +- .../itemscroller/event/KeybindCallbacks.java | 12 +- .../event/RenderEventHandler.java | 22 +- .../mixin/IMixinContainerScreen.java | 30 -- .../mixin/IMixinMerchantScreen.java | 3 +- .../mixin/IMixinScreenWithHandler.java | 30 ++ .../masa/itemscroller/mixin/IMixinSlot.java | 2 +- .../mixin/MixinAbstractInventoryScreen.java | 3 +- .../mixin/MixinCraftingTableContainer.java | 36 --- .../MixinCraftingTableScreenHandler.java | 35 +++ .../itemscroller/mixin/MixinGameRenderer.java | 3 +- .../itemscroller/recipes/CraftingHandler.java | 30 +- .../itemscroller/recipes/RecipePattern.java | 12 +- .../itemscroller/recipes/RecipeStorage.java | 8 +- .../masa/itemscroller/util/AccessorUtils.java | 36 +-- .../dy/masa/itemscroller/util/InputUtils.java | 4 +- .../itemscroller/util/InventoryUtils.java | 266 +++++++++--------- src/main/resources/mixins.itemscroller.json | 4 +- 20 files changed, 278 insertions(+), 282 deletions(-) delete mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java delete mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableContainer.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableScreenHandler.java diff --git a/build.properties b/build.properties index da7786615..7fb865e70 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w10a -minecraft_version = 20w10a -mappings_version = 20w10a+build.2 +minecraft_version_out = 1.16-snap-20w11a +minecraft_version = 20w11a +mappings_version = 20w11a+build.1 -fabric_loader_version = 0.7.8+build.186 +fabric_loader_version = 0.7.8+build.187 mod_menu_version = 1.8.5+build.23 diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index e5201e739..e7081001a 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -18,7 +18,7 @@ import fi.dy.masa.malilib.util.JsonUtils; import net.minecraft.client.gui.screen.ingame.CraftingTableScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.container.CraftingResultSlot; +import net.minecraft.screen.slot.CraftingResultSlot; public class Configs implements IConfigHandler { diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index 67585b03a..b3defedbc 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -2,9 +2,9 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; -import net.minecraft.container.Slot; +import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.screen.slot.Slot; import net.minecraft.util.math.MathHelper; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.config.Configs; @@ -122,11 +122,11 @@ private boolean handleInput(int keyCode, boolean keyState, double dWheel) final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); final int mouseY = fi.dy.masa.malilib.util.InputUtils.getMouseY(); - if (GuiUtils.getCurrentScreen() instanceof ContainerScreen && + if (GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) { - ContainerScreen gui = (ContainerScreen) GuiUtils.getCurrentScreen(); + ScreenWithHandler gui = (ScreenWithHandler) GuiUtils.getCurrentScreen(); RecipeStorage recipes = RecipeStorage.getInstance(); if (dWheel != 0) @@ -204,14 +204,14 @@ public void onMouseMove(int mouseX, int mouseY) if (this.callbacks.functionalityEnabled() && mc.player != null && - GuiUtils.getCurrentScreen() instanceof ContainerScreen && + GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) { - this.handleDragging((ContainerScreen) GuiUtils.getCurrentScreen(), mc, mouseX, mouseY, false); + this.handleDragging((ScreenWithHandler) GuiUtils.getCurrentScreen(), mc, mouseX, mouseY, false); } } - private boolean handleDragging(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) + private boolean handleDragging(ScreenWithHandler gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) { MoveAction action = InventoryUtils.getActiveMoveAction(); diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index c48a5639c..d0d0da192 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -2,10 +2,10 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.container.Slot; +import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.screen.slot.Slot; import net.minecraft.sound.SoundEvents; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; @@ -80,12 +80,12 @@ else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) return true; } - if (this.disabled || mc == null || mc.player == null || (GuiUtils.getCurrentScreen() instanceof ContainerScreen) == false) + if (this.disabled || mc == null || mc.player == null || (GuiUtils.getCurrentScreen() instanceof ScreenWithHandler) == false) { return false; } - ContainerScreen gui = (ContainerScreen) GuiUtils.getCurrentScreen(); + ScreenWithHandler gui = (ScreenWithHandler) GuiUtils.getCurrentScreen(); Slot slot = AccessorUtils.getSlotUnderMouse(gui); RecipeStorage recipes = RecipeStorage.getInstance(); MoveAction moveAction = InputUtils.getDragMoveAction(key); @@ -170,13 +170,13 @@ public void onClientTick(MinecraftClient mc) if (this.disabled == false && mc != null && mc.player != null && - GuiUtils.getCurrentScreen() instanceof ContainerScreen && + GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false && Hotkeys.KEY_MASS_CRAFT.getKeybind().isKeybindHeld()) { Screen guiScreen = GuiUtils.getCurrentScreen(); - ContainerScreen gui = (ContainerScreen) guiScreen; + ScreenWithHandler gui = (ScreenWithHandler) guiScreen; Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); if (outputSlot != null) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 8d7d0507c..8c94c8d63 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -6,7 +6,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; +import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.util.GlAllocationUtils; import net.minecraft.item.ItemStack; @@ -47,9 +47,9 @@ public static RenderEventHandler instance() public void onDrawBackgroundPost() { - if (GuiUtils.getCurrentScreen() instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) + if (GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && InputUtils.isRecipeViewOpen()) { - ContainerScreen gui = (ContainerScreen) GuiUtils.getCurrentScreen(); + ScreenWithHandler gui = (ScreenWithHandler) GuiUtils.getCurrentScreen(); RecipeStorage recipes = RecipeStorage.getInstance(); final int first = recipes.getFirstVisibleRecipeId(); final int countPerPage = recipes.getRecipeCountPerPage(); @@ -91,9 +91,9 @@ public void onDrawBackgroundPost() public void onDrawScreenPost() { - if (GuiUtils.getCurrentScreen() instanceof ContainerScreen && InputUtils.isRecipeViewOpen()) + if (GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && InputUtils.isRecipeViewOpen()) { - ContainerScreen gui = (ContainerScreen) this.mc.currentScreen; + ScreenWithHandler gui = (ScreenWithHandler) this.mc.currentScreen; RecipeStorage recipes = RecipeStorage.getInstance(); final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); @@ -124,7 +124,7 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) } } - private void calculateRecipePositions(ContainerScreen gui) + private void calculateRecipePositions(ScreenWithHandler gui) { RecipeStorage recipes = RecipeStorage.getInstance(); final int gapHorizontal = 2; @@ -155,7 +155,7 @@ private void calculateRecipePositions(ContainerScreen gui) this.columnWidth = stackBaseHeight + this.numberTextWidth + this.gapColumn; } - private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, ContainerScreen gui) + private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, ScreenWithHandler gui) { ItemStack stack = recipe.getResult(); @@ -165,7 +165,7 @@ private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, Co } } - public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, ContainerScreen gui) + public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, ScreenWithHandler gui) { if (InputUtils.isRecipeViewOpen()) { @@ -194,7 +194,7 @@ public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, Con return -1; } - private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, ContainerScreen gui, boolean selected) + private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, ScreenWithHandler gui, boolean selected) { final TextRenderer font = this.mc.textRenderer; final String indexStr = String.valueOf(recipeId + 1); @@ -216,7 +216,7 @@ private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int RenderSystem.popMatrix(); } - private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, ContainerScreen gui) + private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, ScreenWithHandler gui) { ItemStack[] items = recipe.getRecipeItems(); final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength())); @@ -235,7 +235,7 @@ private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, Con } } - private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCountPerPage, ContainerScreen gui) + private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCountPerPage, ScreenWithHandler gui) { final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength())); int scaledStackDimensions = (int) (16 * this.scale); diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java deleted file mode 100644 index 3f66aa677..000000000 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinContainerScreen.java +++ /dev/null @@ -1,30 +0,0 @@ -package fi.dy.masa.itemscroller.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; -import org.spongepowered.asm.mixin.gen.Invoker; - -@Mixin(net.minecraft.client.gui.screen.ingame.ContainerScreen.class) -public interface IMixinContainerScreen -{ - @Invoker("getSlotAt") - net.minecraft.container.Slot getSlotAtPositionInvoker(double x, double y); - - @Invoker("onMouseClick") - void handleMouseClickInvoker(net.minecraft.container.Slot slotIn, int slotId, int mouseButton, net.minecraft.container.SlotActionType type); - - @Accessor("focusedSlot") - net.minecraft.container.Slot getHoveredSlot(); - - @Accessor("x") - int getGuiLeft(); - - @Accessor("y") - int getGuiTop(); - - @Accessor("containerWidth") - int getGuiSizeX(); - - @Accessor("containerHeight") - int getGuiSizeY(); -} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java index b722a8c4c..cc11c9e69 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java @@ -2,9 +2,8 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -import net.minecraft.client.gui.screen.ingame.MerchantScreen; -@Mixin(MerchantScreen.class) +@Mixin(net.minecraft.client.gui.screen.ingame.MerchantScreen.class) public interface IMixinMerchantScreen { @Accessor("selectedIndex") diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java new file mode 100644 index 000000000..b4b079f7a --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java @@ -0,0 +1,30 @@ +package fi.dy.masa.itemscroller.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import org.spongepowered.asm.mixin.gen.Invoker; + +@Mixin(net.minecraft.client.gui.screen.ingame.ScreenWithHandler.class) +public interface IMixinScreenWithHandler +{ + @Invoker("getSlotAt") + net.minecraft.screen.slot.Slot getSlotAtPositionInvoker(double x, double y); + + @Invoker("onMouseClick") + void handleMouseClickInvoker(net.minecraft.screen.slot.Slot slotIn, int slotId, int mouseButton, net.minecraft.screen.slot.SlotActionType type); + + @Accessor("focusedSlot") + net.minecraft.screen.slot.Slot getHoveredSlot(); + + @Accessor("x") + int getGuiLeft(); + + @Accessor("y") + int getGuiTop(); + + @Accessor("backgroundWidth") + int getGuiSizeX(); + + @Accessor("backgroundHeight") + int getGuiSizeY(); +} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java index dbb8da612..4ceaed21f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java @@ -1,8 +1,8 @@ package fi.dy.masa.itemscroller.mixin; +import net.minecraft.screen.slot.Slot; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -import net.minecraft.container.Slot; @Mixin(Slot.class) public interface IMixinSlot diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java index 948597315..2192ee644 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java @@ -5,9 +5,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import fi.dy.masa.itemscroller.util.InputUtils; -import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen; -@Mixin(AbstractInventoryScreen.class) +@Mixin(net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen.class) public abstract class MixinAbstractInventoryScreen { @Inject(method = "drawStatusEffects", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableContainer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableContainer.java deleted file mode 100644 index fbd59555c..000000000 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableContainer.java +++ /dev/null @@ -1,36 +0,0 @@ -package fi.dy.masa.itemscroller.mixin; - -import org.spongepowered.asm.mixin.Final; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import fi.dy.masa.itemscroller.util.InventoryUtils; -import net.minecraft.container.CraftingTableContainer; -import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.inventory.CraftingInventory; -import net.minecraft.inventory.CraftingResultInventory; -import net.minecraft.inventory.Inventory; -import net.minecraft.world.World; - -@Mixin(CraftingTableContainer.class) -public abstract class MixinCraftingTableContainer -{ - @Shadow @Final private CraftingInventory craftingInv; - @Shadow @Final private CraftingResultInventory resultInv; - @Shadow @Final private PlayerEntity player; - - @Inject(method = "onContentChanged", at = @At("RETURN")) - private void onSlotChangedCraftingGrid(Inventory inventory, CallbackInfo ci) - { - InventoryUtils.onSlotChangedCraftingGrid(this.player, this.craftingInv, this.resultInv); - } - - @Inject(method = "updateResult", at = @At("RETURN")) - private static void onUpdateResult(int windowId, World world, PlayerEntity player, - CraftingInventory craftingInv, CraftingResultInventory resultInv, CallbackInfo ci) - { - InventoryUtils.onSlotChangedCraftingGrid(player, craftingInv, resultInv); - } -} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableScreenHandler.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableScreenHandler.java new file mode 100644 index 000000000..97c238b8d --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableScreenHandler.java @@ -0,0 +1,35 @@ +package fi.dy.masa.itemscroller.mixin; + +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import fi.dy.masa.itemscroller.util.InventoryUtils; + +@Mixin(net.minecraft.screen.CraftingTableScreenHandler.class) +public abstract class MixinCraftingTableScreenHandler +{ + @Shadow @Final private net.minecraft.inventory.CraftingInventory craftingInv; + @Shadow @Final private net.minecraft.inventory.CraftingResultInventory resultInv; + @Shadow @Final private net.minecraft.entity.player.PlayerEntity player; + + @Inject(method = "onContentChanged", at = @At("RETURN")) + private void onSlotChangedCraftingGrid(net.minecraft.inventory.Inventory inventory, CallbackInfo ci) + { + InventoryUtils.onSlotChangedCraftingGrid(this.player, this.craftingInv, this.resultInv); + } + + @Inject(method = "updateResult", at = @At("RETURN")) + private static void onUpdateResult( + int windowId, + net.minecraft.world.World world, + net.minecraft.entity.player.PlayerEntity player, + net.minecraft.inventory.CraftingInventory craftingInv, + net.minecraft.inventory.CraftingResultInventory resultInv, + CallbackInfo ci) + { + InventoryUtils.onSlotChangedCraftingGrid(player, craftingInv, resultInv); + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java index 39b26c327..22dfa629e 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java @@ -6,9 +6,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import fi.dy.masa.itemscroller.event.RenderEventHandler; -import net.minecraft.client.render.GameRenderer; -@Mixin(GameRenderer.class) +@Mixin(net.minecraft.client.render.GameRenderer.class) public abstract class MixinGameRenderer { @Inject(method = "render(FJZ)V", diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java index 988fd774b..57fed720c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java @@ -6,15 +6,15 @@ import java.util.Set; import javax.annotation.Nullable; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; -import net.minecraft.container.Container; -import net.minecraft.container.Slot; +import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.slot.Slot; import fi.dy.masa.itemscroller.ItemScroller; public class CraftingHandler { private static final Map CRAFTING_GRID_SLOTS = new HashMap(); - private static final Set>> CRAFTING_GUIS = new HashSet<>(); + private static final Set>> CRAFTING_GUIS = new HashSet<>(); public static void clearDefinitions() { @@ -27,7 +27,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot { try { - Class> guiClass = (Class>) Class.forName(guiClassName); + Class> guiClass = (Class>) Class.forName(guiClassName); Class slotClass = (Class) Class.forName(slotClassName); CRAFTING_GRID_SLOTS.put(new CraftingOutputSlot(guiClass, slotClass, outputSlot), range); @@ -46,7 +46,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot public static boolean isCraftingGui(Screen gui) { - return (gui instanceof ContainerScreen) && CRAFTING_GUIS.contains(((ContainerScreen) gui).getClass()); + return (gui instanceof ScreenWithHandler) && CRAFTING_GUIS.contains(((ScreenWithHandler) gui).getClass()); } /** @@ -56,17 +56,17 @@ public static boolean isCraftingGui(Screen gui) * @return the SlotRange of the crafting grid, or null, if the given slot is not a crafting output slot */ @Nullable - public static SlotRange getCraftingGridSlots(ContainerScreen gui, Slot slot) + public static SlotRange getCraftingGridSlots(ScreenWithHandler gui, Slot slot) { return CRAFTING_GRID_SLOTS.get(CraftingOutputSlot.from(gui, slot)); } @Nullable - public static Slot getFirstCraftingOutputSlotForGui(ContainerScreen gui) + public static Slot getFirstCraftingOutputSlotForGui(ScreenWithHandler gui) { if (CRAFTING_GUIS.contains(gui.getClass())) { - for (Slot slot : gui.getContainer().slots) + for (Slot slot : gui.getScreenHandler().slots) { if (getCraftingGridSlots(gui, slot) != null) { @@ -80,11 +80,11 @@ public static Slot getFirstCraftingOutputSlotForGui(ContainerScreen> guiClass; + private final Class> guiClass; private final Class slotClass; private final int outputSlot; - private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) + private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) { this.guiClass = guiClass; this.slotClass = slotClass; @@ -92,12 +92,12 @@ private CraftingOutputSlot (Class> guiClass, Class< } @SuppressWarnings("unchecked") - public static CraftingOutputSlot from(ContainerScreen gui, Slot slot) + public static CraftingOutputSlot from(ScreenWithHandler gui, Slot slot) { - return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); + return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); } - public Class> getGuiClass() + public Class> getGuiClass() { return this.guiClass; } @@ -112,7 +112,7 @@ public int getSlotNumber() return this.outputSlot; } - public boolean matches(ContainerScreen gui, Slot slot, int outputSlot) + public boolean matches(ScreenWithHandler gui, Slot slot, int outputSlot) { return outputSlot == this.outputSlot && gui.getClass() == this.guiClass && slot.getClass() == this.slotClass; } diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java index cd53ecf31..8a5310905 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java @@ -1,12 +1,12 @@ package fi.dy.masa.itemscroller.recipes; import javax.annotation.Nonnull; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; -import net.minecraft.container.Container; -import net.minecraft.container.Slot; +import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.slot.Slot; import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; import fi.dy.masa.itemscroller.util.Constants; import fi.dy.masa.itemscroller.util.InventoryUtils; @@ -45,7 +45,7 @@ public void ensureRecipeSizeAndClearRecipe(int size) this.clearRecipe(); } - public void storeCraftingRecipe(Slot slot, ContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipe(Slot slot, ScreenWithHandler gui, boolean clearIfEmpty) { SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); @@ -54,13 +54,13 @@ public void storeCraftingRecipe(Slot slot, ContainerScreen if (slot.hasStack()) { int gridSize = range.getSlotCount(); - int numSlots = gui.getContainer().slots.size(); + int numSlots = gui.getScreenHandler().slots.size(); this.ensureRecipeSizeAndClearRecipe(gridSize); for (int i = 0, s = range.getFirst(); i < gridSize && s < numSlots; i++, s++) { - Slot slotTmp = gui.getContainer().getSlot(s); + Slot slotTmp = gui.getScreenHandler().getSlot(s); this.recipe[i] = slotTmp.hasStack() ? slotTmp.getStack().copy() : InventoryUtils.EMPTY_STACK; } diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java index cede3fde8..7d38298ad 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java @@ -4,11 +4,11 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import javax.annotation.Nonnull; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; -import net.minecraft.container.Slot; +import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtIo; +import net.minecraft.screen.slot.Slot; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.config.Configs; @@ -103,12 +103,12 @@ public RecipePattern getSelectedRecipe() return this.getRecipe(this.getSelection()); } - public void storeCraftingRecipeToCurrentSelection(Slot slot, ContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipeToCurrentSelection(Slot slot, ScreenWithHandler gui, boolean clearIfEmpty) { this.storeCraftingRecipe(this.getSelection(), slot, gui, clearIfEmpty); } - public void storeCraftingRecipe(int index, Slot slot, ContainerScreen gui, boolean clearIfEmpty) + public void storeCraftingRecipe(int index, Slot slot, ScreenWithHandler gui, boolean clearIfEmpty) { this.getRecipe(index).storeCraftingRecipe(slot, gui, clearIfEmpty); this.dirty = true; diff --git a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java index 7458643ea..7f452361c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java @@ -1,48 +1,48 @@ package fi.dy.masa.itemscroller.util; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; -import net.minecraft.container.Slot; -import net.minecraft.container.SlotActionType; -import fi.dy.masa.itemscroller.mixin.IMixinContainerScreen; +import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.screen.slot.Slot; +import net.minecraft.screen.slot.SlotActionType; +import fi.dy.masa.itemscroller.mixin.IMixinScreenWithHandler; import fi.dy.masa.itemscroller.mixin.IMixinMerchantScreen; import fi.dy.masa.itemscroller.mixin.IMixinSlot; public class AccessorUtils { - public static Slot getSlotUnderMouse(ContainerScreen gui) + public static Slot getSlotUnderMouse(ScreenWithHandler gui) { - return ((IMixinContainerScreen) gui).getHoveredSlot(); + return ((IMixinScreenWithHandler) gui).getHoveredSlot(); } - public static Slot getSlotAtPosition(ContainerScreen gui, int x, int y) + public static Slot getSlotAtPosition(ScreenWithHandler gui, int x, int y) { - return ((IMixinContainerScreen) gui).getSlotAtPositionInvoker(x, y); + return ((IMixinScreenWithHandler) gui).getSlotAtPositionInvoker(x, y); } - public static void handleMouseClick(ContainerScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) + public static void handleMouseClick(ScreenWithHandler gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) { - ((IMixinContainerScreen) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); + ((IMixinScreenWithHandler) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); } - public static int getGuiLeft(ContainerScreen gui) + public static int getGuiLeft(ScreenWithHandler gui) { - return ((IMixinContainerScreen) gui).getGuiLeft(); + return ((IMixinScreenWithHandler) gui).getGuiLeft(); } - public static int getGuiTop(ContainerScreen gui) + public static int getGuiTop(ScreenWithHandler gui) { - return ((IMixinContainerScreen) gui).getGuiTop(); + return ((IMixinScreenWithHandler) gui).getGuiTop(); } - public static int getGuiXSize(ContainerScreen gui) + public static int getGuiXSize(ScreenWithHandler gui) { - return ((IMixinContainerScreen) gui).getGuiSizeX(); + return ((IMixinScreenWithHandler) gui).getGuiSizeX(); } - public static int getGuiYSize(ContainerScreen gui) + public static int getGuiYSize(ScreenWithHandler gui) { - return ((IMixinContainerScreen) gui).getGuiSizeY(); + return ((IMixinScreenWithHandler) gui).getGuiSizeY(); } public static int getSelectedMerchantRecipe(MerchantScreen gui) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index 55999be5c..e68938557 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -1,7 +1,7 @@ package fi.dy.masa.itemscroller.util; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; +import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.event.KeybindCallbacks; import fi.dy.masa.itemscroller.recipes.CraftingHandler; @@ -19,7 +19,7 @@ public static boolean isRecipeViewOpen() CraftingHandler.isCraftingGui(GuiUtils.getCurrentScreen()); } - public static boolean canShiftDropItems(ContainerScreen gui, MinecraftClient mc, int mouseX, int mouseY) + public static boolean canShiftDropItems(ScreenWithHandler gui, MinecraftClient mc, int mouseX, int mouseY) { if (InventoryUtils.isStackEmpty(mc.player.inventory.getCursorStack()) == false) { diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 5dd44dd91..3f30cf48b 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -11,16 +11,12 @@ import java.util.Set; import javax.annotation.Nullable; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.ContainerScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; +import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; -import net.minecraft.container.Container; -import net.minecraft.container.Slot; -import net.minecraft.container.SlotActionType; -import net.minecraft.container.TradeOutputSlot; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.CraftingInventory; @@ -30,6 +26,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.RecipeType; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.slot.Slot; +import net.minecraft.screen.slot.SlotActionType; +import net.minecraft.screen.slot.TradeOutputSlot; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; import net.minecraft.village.TradeOffer; @@ -99,7 +99,7 @@ public static String getStackString(ItemStack stack) return ""; } - public static void debugPrintSlotInfo(ContainerScreen gui, Slot slot) + public static void debugPrintSlotInfo(ScreenWithHandler gui, Slot slot) { if (slot == null) { @@ -107,7 +107,7 @@ public static void debugPrintSlotInfo(ContainerScreen gui, return; } - boolean hasSlot = gui.getContainer().slots.contains(slot); + boolean hasSlot = gui.getScreenHandler().slots.contains(slot); Object inv = slot.inventory; String stackStr = InventoryUtils.getStackString(slot.getStack()); @@ -115,12 +115,12 @@ public static void debugPrintSlotInfo(ContainerScreen gui, "slot class: %s, inv class: %s, Container's slot list has slot: %s, stack: %s, numSlots: %d", slot.id, AccessorUtils.getSlotIndex(slot), slot.hasStack(), slot.getClass().getName(), inv != null ? inv.getClass().getName() : "", hasSlot ? " true" : "false", stackStr, - gui.getContainer().slots.size())); + gui.getScreenHandler().slots.size())); } - private static boolean isValidSlot(Slot slot, ContainerScreen gui, boolean requireItems) + private static boolean isValidSlot(Slot slot, ScreenWithHandler gui, boolean requireItems) { - Container container = gui.getContainer(); + ScreenHandler container = gui.getScreenHandler(); return container != null && container.slots != null && slot != null && container.slots.contains(slot) && @@ -128,7 +128,7 @@ private static boolean isValidSlot(Slot slot, ContainerScreen gui, @Nullable Slot slot) + public static boolean isCraftingSlot(ScreenWithHandler gui, @Nullable Slot slot) { return slot != null && CraftingHandler.getCraftingGridSlots(gui, slot) != null; } @@ -136,7 +136,7 @@ public static boolean isCraftingSlot(ContainerScreen gui, @ /** * Checks if there are slots belonging to another inventory on screen above the given slot */ - private static boolean inventoryExistsAbove(Slot slot, Container container) + private static boolean inventoryExistsAbove(Slot slot, ScreenHandler container) { for (Slot slotTmp : container.slots) { @@ -149,7 +149,7 @@ private static boolean inventoryExistsAbove(Slot slot, Container container) return false; } - public static boolean canShiftPlaceItems(ContainerScreen gui) + public static boolean canShiftPlaceItems(ScreenWithHandler gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -160,7 +160,7 @@ public static boolean canShiftPlaceItems(ContainerScreen gu slot.hasStack() == false && slot.canInsert(stackCursor); } - public static boolean tryMoveItems(ContainerScreen gui, RecipeStorage recipes, boolean scrollingUp) + public static boolean tryMoveItems(ScreenWithHandler gui, RecipeStorage recipes, boolean scrollingUp) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -182,7 +182,7 @@ public static boolean tryMoveItems(ContainerScreen gui, Rec if (Configs.Generic.SLOT_POSITION_AWARE_SCROLL_DIRECTION.getBooleanValue()) { - boolean above = inventoryExistsAbove(slot, gui.getContainer()); + boolean above = inventoryExistsAbove(slot, gui.getScreenHandler()); // so basically: (above && scrollingUp) || (above == false && scrollingUp == false) moveToOtherInventory = (above == scrollingUp); } @@ -252,7 +252,7 @@ else if (getStackSize(stack) < slot.getMaxStackAmount(stack)) return false; } - public static boolean dragMoveItems(ContainerScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) + public static boolean dragMoveItems(ScreenWithHandler gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) { @@ -355,7 +355,7 @@ public static void stopDragging() DRAGGED_SLOTS.clear(); } - private static boolean dragMoveFromSlotAtPosition(ContainerScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPosition(ScreenWithHandler gui, int x, int y, MoveAction action) { if (gui instanceof CreativeInventoryScreen) { @@ -426,7 +426,7 @@ private static boolean dragMoveFromSlotAtPosition(ContainerScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPositionCreative(ScreenWithHandler gui, int x, int y, MoveAction action) { CreativeInventoryScreen guiCreative = (CreativeInventoryScreen) gui; Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); @@ -469,7 +469,7 @@ private static boolean dragMoveFromSlotAtPositionCreative(ContainerScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) + public static void dropStacks(ScreenWithHandler gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) { if (slotReference != null && isStackEmpty(stackReference) == false) { - Container container = gui.getContainer(); + ScreenHandler container = gui.getScreenHandler(); stackReference = stackReference.copy(); for (Slot slot : container.slots) @@ -540,7 +540,7 @@ public static void dropStacks(ContainerScreen gui, ItemStac } } - public static boolean shiftDropItems(ContainerScreen gui) + public static boolean shiftDropItems(ScreenWithHandler gui) { ItemStack stackReference = MinecraftClient.getInstance().player.inventory.getCursorStack(); @@ -558,7 +558,7 @@ public static boolean shiftDropItems(ContainerScreen gui) return false; } - public static boolean shiftPlaceItems(Slot slot, ContainerScreen gui) + public static boolean shiftPlaceItems(Slot slot, ScreenWithHandler gui) { // Left click to place the items from the cursor to the slot leftClickSlot(gui, slot.id); @@ -650,10 +650,10 @@ else if (slot.hasStack()) return false; } - private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ContainerScreen gui) + private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ScreenWithHandler gui) { ItemStack stackOrig = slot.getStack(); - Container container = gui.getContainer(); + ScreenHandler container = gui.getScreenHandler(); MinecraftClient mc = MinecraftClient.getInstance(); if (isStackEmpty(mc.player.inventory.getCursorStack()) == false || slot.canTakeItems(mc.player) == false || @@ -702,7 +702,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ContainerScr return false; } - private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, ContainerScreen gui) + private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, ScreenWithHandler gui) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -727,7 +727,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, Container int tempSlotNum = -1; // Find some other slot where to store one of the items temporarily - for (Slot slotTmp : gui.getContainer().slots) + for (Slot slotTmp : gui.getScreenHandler().slots) { if (slotTmp.id != slot.id && areSlotsInSameInventory(slotTmp, slot, true) && @@ -783,11 +783,11 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, Container else { boolean treatHotbarAsDifferent = gui.getClass() == InventoryScreen.class; - List slots = getSlotNumbersOfEmptySlots(gui.getContainer(), slot, false, treatHotbarAsDifferent, false); + List slots = getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, false, treatHotbarAsDifferent, false); if (slots.isEmpty()) { - slots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, false, slot.getStack(), true, treatHotbarAsDifferent, false); + slots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, false, slot.getStack(), true, treatHotbarAsDifferent, false); } if (slots.isEmpty() == false) @@ -801,7 +801,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, Container // Try to place the stack in the cursor to any valid empty or matching slots in a different inventory for (int slotNum : slots) { - Slot slotTmp = gui.getContainer().getSlot(slotNum); + Slot slotTmp = gui.getScreenHandler().getSlot(slotNum); stackInCursor = player.inventory.getCursorStack(); if (isStackEmpty(stackInCursor)) @@ -826,9 +826,9 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, Container return false; } - private static boolean tryMoveSingleItemToThisInventory(Slot slot, ContainerScreen gui) + private static boolean tryMoveSingleItemToThisInventory(Slot slot, ScreenWithHandler gui) { - Container container = gui.getContainer(); + ScreenHandler container = gui.getScreenHandler(); ItemStack stackOrig = slot.getStack(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -875,14 +875,14 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, ContainerScre return false; } - public static void tryMoveStacks(Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + public static void tryMoveStacks(Slot slot, ScreenWithHandler gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { tryMoveStacks(slot.getStack(), slot, gui, matchingOnly, toOtherInventory, firstOnly); } - private static void tryMoveStacks(ItemStack stackReference, Slot slot, ContainerScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + private static void tryMoveStacks(ItemStack stackReference, Slot slot, ScreenWithHandler gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { - Container container = gui.getContainer(); + ScreenHandler container = gui.getScreenHandler(); final int maxSlot = container.slots.size() - 1; for (int i = maxSlot; i >= 0; i--) @@ -917,7 +917,7 @@ private static void tryMoveStacks(ItemStack stackReference, Slot slot, Container private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, boolean fillStacks) { - TraderOfferList list = gui.getContainer().getRecipes(); + TraderOfferList list = gui.getScreenHandler().getRecipes(); int index = AccessorUtils.getSelectedMerchantRecipe(gui); if (list == null || list.size() <= index) @@ -946,9 +946,9 @@ private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, boolean f } } - private static void fillBuySlot(ContainerScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) + private static void fillBuySlot(ScreenWithHandler gui, int slotNum, ItemStack buyStack, boolean fillStacks) { - Slot slot = gui.getContainer().getSlot(slotNum); + Slot slot = gui.getScreenHandler().getSlot(slotNum); ItemStack existingStack = slot.getStack(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -966,7 +966,7 @@ private static void fillBuySlot(ContainerScreen gui, int sl } } - public static void handleRecipeClick(ContainerScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, + public static void handleRecipeClick(ScreenWithHandler gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, boolean isLeftClick, boolean isRightClick, boolean isPickBlock, boolean isShiftDown) { if (isLeftClick || isRightClick) @@ -1029,7 +1029,7 @@ else if (isPickBlock) } } - public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, ContainerScreen gui, boolean fillStacks) + public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, ScreenWithHandler gui, boolean fillStacks) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1039,13 +1039,13 @@ public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, Contain } } - public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, ContainerScreen gui) + public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, ScreenWithHandler gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); loadRecipeItemsToGridForOutputSlot(recipe, gui, slot); } - private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, ContainerScreen gui, Slot outputSlot) + private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, ScreenWithHandler gui, Slot outputSlot) { if (outputSlot != null && isCraftingSlot(gui, outputSlot) && isStackEmpty(recipe.getResult()) == false) { @@ -1053,7 +1053,7 @@ private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, Con } } - private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, ContainerScreen gui, + private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, ScreenWithHandler gui, boolean moveToOtherInventory, boolean moveStacks, boolean moveEverything) { RecipePattern recipe = recipes.getSelectedRecipe(); @@ -1097,7 +1097,7 @@ else if (moveToOtherInventory == false && isStackEmpty(stackRecipeOutput) == fal return false; } - private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, ContainerScreen gui) + private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, ScreenWithHandler gui) { ItemStack result = recipe.getResult(); int failSafe = 1024; @@ -1121,7 +1121,7 @@ private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, } } - public static void clearFirstCraftingGridOfItems(RecipePattern recipe, ContainerScreen gui, boolean clearNonMatchingOnly) + public static void clearFirstCraftingGridOfItems(RecipePattern recipe, ScreenWithHandler gui, boolean clearNonMatchingOnly) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1132,7 +1132,7 @@ public static void clearFirstCraftingGridOfItems(RecipePattern recipe, Container } } - public static void clearFirstCraftingGridOfAllItems(ContainerScreen gui) + public static void clearFirstCraftingGridOfAllItems(ScreenWithHandler gui) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1143,16 +1143,16 @@ public static void clearFirstCraftingGridOfAllItems(ContainerScreen gui, SlotRange range, boolean clearNonMatchingOnly) + private static boolean clearCraftingGridOfItems(RecipePattern recipe, ScreenWithHandler gui, SlotRange range, boolean clearNonMatchingOnly) { - final int invSlots = gui.getContainer().slots.size(); + final int invSlots = gui.getScreenHandler().slots.size(); final int rangeSlots = range.getSlotCount(); final int recipeSize = recipe.getRecipeLength(); final int slotCount = Math.min(rangeSlots, recipeSize); for (int i = 0, slotNum = range.getFirst(); i < slotCount && slotNum < invSlots; i++, slotNum++) { - Slot slotTmp = gui.getContainer().getSlot(slotNum); + Slot slotTmp = gui.getScreenHandler().getSlot(slotNum); if (slotTmp != null && slotTmp.hasStack() && (clearNonMatchingOnly == false || areStacksEqual(recipe.getRecipeItems()[i], slotTmp.getStack()) == false)) @@ -1170,15 +1170,15 @@ private static boolean clearCraftingGridOfItems(RecipePattern recipe, ContainerS return true; } - private static boolean clearCraftingGridOfAllItems(ContainerScreen gui, SlotRange range) + private static boolean clearCraftingGridOfAllItems(ScreenWithHandler gui, SlotRange range) { - final int invSlots = gui.getContainer().slots.size(); + final int invSlots = gui.getScreenHandler().slots.size(); final int rangeSlots = range.getSlotCount(); boolean clearedAll = true; for (int i = 0, slotNum = range.getFirst(); i < rangeSlots && slotNum < invSlots; i++, slotNum++) { - Slot slotTmp = gui.getContainer().getSlot(slotNum); + Slot slotTmp = gui.getScreenHandler().getSlot(slotNum); if (slotTmp != null && slotTmp.hasStack()) { @@ -1195,9 +1195,9 @@ private static boolean clearCraftingGridOfAllItems(ContainerScreen gui, boolean fillStacks) + private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slot slot, ScreenWithHandler gui, boolean fillStacks) { - Container container = gui.getContainer(); + ScreenHandler container = gui.getScreenHandler(); int numSlots = container.slots.size(); SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); @@ -1240,9 +1240,9 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slo return false; } - private static void fillCraftingGrid(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void fillCraftingGrid(ScreenWithHandler gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { - Container container = gui.getContainer(); + ScreenHandler container = gui.getScreenHandler(); MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; int slotNum = -1; @@ -1322,7 +1322,7 @@ private static void fillCraftingGrid(ContainerScreen gui, S } } - public static void rightClickCraftOneStack(ContainerScreen gui) + public static void rightClickCraftOneStack(ScreenWithHandler gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1354,7 +1354,7 @@ public static void rightClickCraftOneStack(ContainerScreen } } - public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe, ContainerScreen gui) + public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe, ScreenWithHandler gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1380,18 +1380,18 @@ public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe } } - public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, ContainerScreen gui) + public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, ScreenWithHandler gui) { if (isStackEmpty(recipe.getResult()) == false) { Slot slot = null; ItemStack stackResult = recipe.getResult().copy(); - for (Slot slotTmp : gui.getContainer().slots) + for (Slot slotTmp : gui.getScreenHandler().slots) { // This slot is likely in the player inventory, as there is another inventory above if (areStacksEqual(slotTmp.getStack(), stackResult) && - inventoryExistsAbove(slotTmp, gui.getContainer())) + inventoryExistsAbove(slotTmp, gui.getScreenHandler())) { slot = slotTmp; break; @@ -1402,7 +1402,7 @@ public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, { // Get a list of slots with matching items, which are in the same inventory // as the slot that is assumed to be in the player inventory. - List slots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, true, stackResult, false, false, false); + List slots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, true, stackResult, false, false, false); for (int slotNum : slots) { @@ -1412,7 +1412,7 @@ public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, } } - public static void throwAllCraftingResultsToGround(RecipePattern recipe, ContainerScreen gui) + public static void throwAllCraftingResultsToGround(RecipePattern recipe, ScreenWithHandler gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1422,7 +1422,7 @@ public static void throwAllCraftingResultsToGround(RecipePattern recipe, Contain } } - private static int putSingleItemIntoSlots(ContainerScreen gui, List targetSlots, int startIndex) + private static int putSingleItemIntoSlots(ScreenWithHandler gui, List targetSlots, int startIndex) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); @@ -1432,7 +1432,7 @@ private static int putSingleItemIntoSlots(ContainerScreen g return 0; } - int numSlots = gui.getContainer().slots.size(); + int numSlots = gui.getScreenHandler().slots.size(); int numItems = getStackSize(stackInCursor); int loops = Math.min(numItems, targetSlots.size() - startIndex); int count = 0; @@ -1453,7 +1453,7 @@ private static int putSingleItemIntoSlots(ContainerScreen g return count; } - public static void moveOneSetOfItemsFromSlotToPlayerInventory(ContainerScreen gui, Slot slot) + public static void moveOneSetOfItemsFromSlotToPlayerInventory(ScreenWithHandler gui, Slot slot) { leftClickSlot(gui, slot.id); @@ -1462,19 +1462,19 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(ContainerScreen slots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, false, stackCursor, true, true, false); + List slots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, false, stackCursor, true, true, false); if (moveItemFromCursorToSlots(gui, slots) == false) { - slots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.getContainer(), false); + slots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.getScreenHandler(), false); moveItemFromCursorToSlots(gui, slots); } } } - private static void moveOneRecipeItemIntoCraftingGrid(ContainerScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void moveOneRecipeItemIntoCraftingGrid(ScreenWithHandler gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { - Container container = gui.getContainer(); + ScreenHandler container = gui.getScreenHandler(); MinecraftClient mc = MinecraftClient.getInstance(); int index = 0; int slotNum = -1; @@ -1519,7 +1519,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(ContainerScreen gui, List slotNumbers) + private static boolean moveItemFromCursorToSlots(ScreenWithHandler gui, List slotNumbers) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -1537,9 +1537,9 @@ private static boolean moveItemFromCursorToSlots(ContainerScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) + private static void moveItemsFromInventory(ScreenWithHandler gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) { - Container container = gui.getContainer(); + ScreenHandler container = gui.getScreenHandler(); for (Slot slot : container.slots) { @@ -1566,7 +1566,7 @@ private static void moveItemsFromInventory(ContainerScreen } } - private static int getSlotNumberOfLargestMatchingStackFromDifferentInventory(Container container, Slot slotReference, ItemStack stackReference) + private static int getSlotNumberOfLargestMatchingStackFromDifferentInventory(ScreenHandler container, Slot slotReference, ItemStack stackReference) { int slotNum = -1; int largest = 0; @@ -1598,7 +1598,7 @@ private static int getSlotNumberOfLargestMatchingStackFromDifferentInventory(Con * @param stackReference * @return */ - private static int getSlotNumberOfSmallestStackFromDifferentInventory(Container container, Slot slotReference, ItemStack stackReference, int idealSize) + private static int getSlotNumberOfSmallestStackFromDifferentInventory(ScreenHandler container, Slot slotReference, ItemStack stackReference, int idealSize) { int slotNum = -1; int smallest = Integer.MAX_VALUE; @@ -1656,7 +1656,7 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(Container * @return */ private static List getSlotNumbersOfMatchingStacks( - Container container, Slot slotReference, boolean sameInventory, + ScreenHandler container, Slot slotReference, boolean sameInventory, ItemStack stackReference, boolean preferPartial, boolean treatHotbarAsDifferent, boolean reverse) { List slots = new ArrayList(64); @@ -1685,7 +1685,7 @@ private static List getSlotNumbersOfMatchingStacks( return slots; } - private static List getSlotNumbersOfMatchingStacks(Container container, ItemStack stackReference, boolean preferPartial) + private static List getSlotNumbersOfMatchingStacks(ScreenHandler container, ItemStack stackReference, boolean preferPartial) { List slots = new ArrayList(64); final int maxSlot = container.slots.size() - 1; @@ -1711,7 +1711,7 @@ private static List getSlotNumbersOfMatchingStacks(Container container, } private static List getSlotNumbersOfEmptySlots( - Container container, Slot slotReference, boolean sameInventory, boolean treatHotbarAsDifferent, boolean reverse) + ScreenHandler container, Slot slotReference, boolean sameInventory, boolean treatHotbarAsDifferent, boolean reverse) { List slots = new ArrayList(64); final int maxSlot = container.slots.size() - 1; @@ -1731,7 +1731,7 @@ private static List getSlotNumbersOfEmptySlots( return slots; } - private static List getSlotNumbersOfEmptySlotsInPlayerInventory(Container container, boolean reverse) + private static List getSlotNumbersOfEmptySlotsInPlayerInventory(ScreenHandler container, boolean reverse) { List slots = new ArrayList(64); final int maxSlot = container.slots.size() - 1; @@ -1778,7 +1778,7 @@ private static boolean areSlotsInSameInventory(Slot slot1, Slot slot2, boolean t return false; } - private static ItemStack[] getOriginalStacks(Container container) + private static ItemStack[] getOriginalStacks(ScreenHandler container) { ItemStack[] originalStacks = new ItemStack[container.slots.size()]; @@ -1790,7 +1790,7 @@ private static ItemStack[] getOriginalStacks(Container container) return originalStacks; } - private static void restoreOriginalStacks(Container container, ItemStack[] originalStacks) + private static void restoreOriginalStacks(ScreenHandler container, ItemStack[] originalStacks) { for (int i = 0; i < originalStacks.length; i++) { @@ -1804,7 +1804,7 @@ private static void restoreOriginalStacks(Container container, ItemStack[] origi } } - private static int getTargetSlot(Container container, ItemStack[] originalStacks) + private static int getTargetSlot(ScreenHandler container, ItemStack[] originalStacks) { List slots = container.slots; @@ -1845,7 +1845,7 @@ private void clickSlotsToMoveItems(Slot slot, ContainerScreen gui, boolean toOtherInventory) + private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, ScreenWithHandler gui, boolean toOtherInventory) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1857,7 +1857,7 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, ContainerScreen return; } - for (Slot slotDst : gui.getContainer().slots) + for (Slot slotDst : gui.getScreenHandler().slots) { ItemStack stackDst = slotDst.getStack(); @@ -1881,11 +1881,11 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, ContainerScreen } } - private static boolean clickSlotsToMoveSingleItem(ContainerScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveSingleItem(ScreenWithHandler gui, int slotFrom, int slotTo) { //System.out.println("clickSlotsToMoveSingleItem(from: " + slotFrom + ", to: " + slotTo + ")"); MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stack = gui.getContainer().slots.get(slotFrom).getStack(); + ItemStack stack = gui.getScreenHandler().slots.get(slotFrom).getStack(); if (isStackEmpty(stack)) { @@ -1916,10 +1916,10 @@ private static boolean clickSlotsToMoveSingleItem(ContainerScreen gui, int slotFrom) + private static boolean clickSlotsToMoveSingleItemByShiftClick(ScreenWithHandler gui, int slotFrom) { MinecraftClient mc = MinecraftClient.getInstance(); - Slot slot = gui.getContainer().slots.get(slotFrom); + Slot slot = gui.getScreenHandler().slots.get(slotFrom); ItemStack stack = slot.getStack(); if (isStackEmpty(stack)) @@ -1961,7 +1961,7 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(ContainerScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveItems(ScreenWithHandler gui, int slotFrom, int slotTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1994,11 +1994,11 @@ private static boolean clickSlotsToMoveItems(ContainerScreen gui, int slotNum) + public static void dropStacksUntilEmpty(ScreenWithHandler gui, int slotNum) { - if (slotNum >= 0 && slotNum < gui.getContainer().slots.size()) + if (slotNum >= 0 && slotNum < gui.getScreenHandler().slots.size()) { - Slot slot = gui.getContainer().getSlot(slotNum); + Slot slot = gui.getScreenHandler().getSlot(slotNum); int failsafe = 64; while (failsafe-- > 0 && slot.hasStack()) @@ -2008,11 +2008,11 @@ public static void dropStacksUntilEmpty(ContainerScreen gui } } - public static void dropStacksWhileHasItem(ContainerScreen gui, int slotNum, ItemStack stackReference) + public static void dropStacksWhileHasItem(ScreenWithHandler gui, int slotNum, ItemStack stackReference) { - if (slotNum >= 0 && slotNum < gui.getContainer().slots.size()) + if (slotNum >= 0 && slotNum < gui.getScreenHandler().slots.size()) { - Slot slot = gui.getContainer().getSlot(slotNum); + Slot slot = gui.getScreenHandler().getSlot(slotNum); int failsafe = 256; while (failsafe-- > 0 && areStacksEqual(slot.getStack(), stackReference)) @@ -2022,9 +2022,9 @@ public static void dropStacksWhileHasItem(ContainerScreen g } } - private static boolean shiftClickSlotWithCheck(ContainerScreen gui, int slotNum) + private static boolean shiftClickSlotWithCheck(ScreenWithHandler gui, int slotNum) { - Slot slot = gui.getContainer().getSlot(slotNum); + Slot slot = gui.getScreenHandler().getSlot(slotNum); if (slot == null || slot.hasStack() == false) { @@ -2037,7 +2037,7 @@ private static boolean shiftClickSlotWithCheck(ContainerScreen gui, Slot slot, boolean moveUp, MoveAmount amount) + public static boolean tryMoveItemsVertically(ScreenWithHandler gui, Slot slot, boolean moveUp, MoveAmount amount) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -2047,7 +2047,7 @@ public static boolean tryMoveItemsVertically(ContainerScreen slots = getVerticallyFurthestSuitableSlotsForStackInSlot(gui.getContainer(), slot, moveUp); + List slots = getVerticallyFurthestSuitableSlotsForStackInSlot(gui.getScreenHandler(), slot, moveUp); if (slots.isEmpty()) { @@ -2074,20 +2074,20 @@ else if (amount == MoveAmount.ALL_MATCHING) return true; } - private static void moveMatchingStacksToSlots(ContainerScreen gui, Slot slot, boolean moveUp) + private static void moveMatchingStacksToSlots(ScreenWithHandler gui, Slot slot, boolean moveUp) { - List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getContainer(), slot, true, slot.getStack(), true, true, false); - List targetSlots = getSlotNumbersOfEmptySlots(gui.getContainer(), slot, false, true, false); - targetSlots.addAll(getSlotNumbersOfEmptySlots(gui.getContainer(), slot, true, true, false)); + List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, true, slot.getStack(), true, true, false); + List targetSlots = getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, false, true, false); + targetSlots.addAll(getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, true, true, false)); targetSlots.addAll(matchingSlots); - Collections.sort(matchingSlots, new SlotVerticalSorterSlotNumbers(gui.getContainer(), ! moveUp)); - Collections.sort(targetSlots, new SlotVerticalSorterSlotNumbers(gui.getContainer(), moveUp)); + Collections.sort(matchingSlots, new SlotVerticalSorterSlotNumbers(gui.getScreenHandler(), ! moveUp)); + Collections.sort(targetSlots, new SlotVerticalSorterSlotNumbers(gui.getScreenHandler(), moveUp)); for (int i = 0; i < matchingSlots.size(); ++i) { int srcSlotNum = matchingSlots.get(i).intValue(); - Slot srcSlot = gui.getContainer().getSlot(srcSlotNum); + Slot srcSlot = gui.getScreenHandler().getSlot(srcSlotNum); Slot lastSlot = moveStackToSlots(gui, srcSlot, targetSlots, false); if (lastSlot == null || (lastSlot.id == srcSlot.id || (lastSlot.yPosition > srcSlot.yPosition) == moveUp)) @@ -2097,7 +2097,7 @@ private static void moveMatchingStacksToSlots(ContainerScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) + private static Slot moveStackToSlots(ScreenWithHandler gui, Slot slotFrom, List slotsTo, boolean leaveOne) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2125,7 +2125,7 @@ private static Slot moveStackToSlots(ContainerScreen gui, S break; } - Slot dstSlot = gui.getContainer().getSlot(slotNum); + Slot dstSlot = gui.getScreenHandler().getSlot(slotNum); if (dstSlot.canInsert(inv.getCursorStack()) && (dstSlot.hasStack() == false || areStacksEqual(dstSlot.getStack(), inv.getCursorStack()))) @@ -2144,7 +2144,7 @@ private static Slot moveStackToSlots(ContainerScreen gui, S return lastSlot; } - private static void moveOneItemToFirstValidSlot(ContainerScreen gui, Slot slotFrom, List slotsTo) + private static void moveOneItemToFirstValidSlot(ScreenWithHandler gui, Slot slotFrom, List slotsTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2177,7 +2177,7 @@ private static void moveOneItemToFirstValidSlot(ContainerScreen getVerticallyFurthestSuitableSlotsForStackInSlot(Container container, final Slot slotIn, boolean above) + private static List getVerticallyFurthestSuitableSlotsForStackInSlot(ScreenHandler container, final Slot slotIn, boolean above) { if (slotIn == null || slotIn.hasStack() == false) { @@ -2209,13 +2209,13 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Co return slotNumbers; } - public static void tryClearCursor(ContainerScreen gui, MinecraftClient mc) + public static void tryClearCursor(ScreenWithHandler gui, MinecraftClient mc) { ItemStack stackCursor = mc.player.inventory.getCursorStack(); if (isStackEmpty(stackCursor) == false) { - List emptySlots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.getContainer(), false); + List emptySlots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.getScreenHandler(), false); if (emptySlots.isEmpty() == false) { @@ -2223,13 +2223,13 @@ public static void tryClearCursor(ContainerScreen gui, Mine } else { - List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getContainer(), stackCursor, true); + List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), stackCursor, true); if (matchingSlots.isEmpty() == false) { for (int slotNum : matchingSlots) { - Slot slot = gui.getContainer().getSlot(slotNum); + Slot slot = gui.getScreenHandler().getSlot(slotNum); ItemStack stackSlot = slot.getStack(); if (slot == null || areStacksEqual(stackSlot, stackCursor) == false || @@ -2286,10 +2286,10 @@ public int compare(Slot slot1, Slot slot2) private static class SlotVerticalSorterSlotNumbers implements Comparator { - private final Container container; + private final ScreenHandler container; private final boolean topToBottom; - public SlotVerticalSorterSlotNumbers(Container container, boolean topToBottom) + public SlotVerticalSorterSlotNumbers(ScreenHandler container, boolean topToBottom) { this.container = container; this.topToBottom = topToBottom; @@ -2310,11 +2310,11 @@ public int compare(Integer slotNum1, Integer slotNum2) } } - public static void clickSlot(ContainerScreen gui, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(ScreenWithHandler gui, int slotNum, int mouseButton, SlotActionType type) { - if (slotNum >= 0 && slotNum < gui.getContainer().slots.size()) + if (slotNum >= 0 && slotNum < gui.getScreenHandler().slots.size()) { - Slot slot = gui.getContainer().getSlot(slotNum); + Slot slot = gui.getScreenHandler().getSlot(slotNum); clickSlot(gui, slot, slotNum, mouseButton, type); } else @@ -2322,7 +2322,7 @@ public static void clickSlot(ContainerScreen gui, int slotN try { MinecraftClient mc = MinecraftClient.getInstance(); - mc.interactionManager.clickSlot(gui.getContainer().syncId, slotNum, mouseButton, type, mc.player); + mc.interactionManager.clickSlot(gui.getScreenHandler().syncId, slotNum, mouseButton, type, mc.player); } catch (Exception e) { @@ -2332,7 +2332,7 @@ public static void clickSlot(ContainerScreen gui, int slotN } } - public static void clickSlot(ContainerScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(ScreenWithHandler gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) { try { @@ -2345,59 +2345,59 @@ public static void clickSlot(ContainerScreen gui, Slot slot } } - public static void leftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) + public static void leftClickSlot(ScreenWithHandler gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(ContainerScreen gui, Slot slot, int slotNumber) + public static void rightClickSlot(ScreenWithHandler gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(ContainerScreen gui, Slot slot, int slotNumber) + public static void shiftClickSlot(ScreenWithHandler gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.QUICK_MOVE); } - public static void leftClickSlot(ContainerScreen gui, int slotNum) + public static void leftClickSlot(ScreenWithHandler gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(ContainerScreen gui, int slotNum) + public static void rightClickSlot(ScreenWithHandler gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(ContainerScreen gui, int slotNum) + public static void shiftClickSlot(ScreenWithHandler gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.QUICK_MOVE); } - public static void dropItemsFromCursor(ContainerScreen gui) + public static void dropItemsFromCursor(ScreenWithHandler gui) { clickSlot(gui, -999, 0, SlotActionType.PICKUP); } - public static void dropItem(ContainerScreen gui, int slotNum) + public static void dropItem(ScreenWithHandler gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.THROW); } - public static void dropStack(ContainerScreen gui, int slotNum) + public static void dropStack(ScreenWithHandler gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.THROW); } - public static void swapSlots(ContainerScreen gui, int slotNum, int otherSlot) + public static void swapSlots(ScreenWithHandler gui, int slotNum, int otherSlot) { clickSlot(gui, slotNum, 0, SlotActionType.SWAP); clickSlot(gui, otherSlot, 0, SlotActionType.SWAP); clickSlot(gui, slotNum, 0, SlotActionType.SWAP); } - private static void dragSplitItemsIntoSlots(ContainerScreen gui, List targetSlots) + private static void dragSplitItemsIntoSlots(ScreenWithHandler gui, List targetSlots) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); @@ -2413,7 +2413,7 @@ private static void dragSplitItemsIntoSlots(ContainerScreen return; } - int numSlots = gui.getContainer().slots.size(); + int numSlots = gui.getScreenHandler().slots.size(); int loops = targetSlots.size(); // Start the drag diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 8bbe3183e..39924db85 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -4,11 +4,11 @@ "compatibilityLevel": "JAVA_8", "minVersion": "0.7", "client": [ - "IMixinContainerScreen", "IMixinMerchantScreen", + "IMixinScreenWithHandler", "IMixinSlot", "MixinAbstractInventoryScreen", - "MixinCraftingTableContainer", + "MixinCraftingTableScreenHandler", "MixinGameRenderer", "MixinScreen" ], From a5c9640039fefae988af46b182e409360c8a0cf1 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 19 Mar 2020 20:09:51 +0200 Subject: [PATCH 037/107] Update to MC 1.16 snapshot 20w12a --- build.properties | 10 +- .../dy/masa/itemscroller/config/Configs.java | 4 +- .../masa/itemscroller/event/InputHandler.java | 12 +- .../itemscroller/event/KeybindCallbacks.java | 10 +- .../event/RenderEventHandler.java | 22 +-- .../mixin/IMixinScreenWithHandler.java | 2 +- .../masa/itemscroller/mixin/IMixinSlot.java | 5 +- ...r.java => MixinCraftingScreenHandler.java} | 10 +- .../itemscroller/recipes/CraftingHandler.java | 24 +-- .../itemscroller/recipes/RecipePattern.java | 4 +- .../itemscroller/recipes/RecipeStorage.java | 6 +- .../masa/itemscroller/util/AccessorUtils.java | 16 +- .../dy/masa/itemscroller/util/InputUtils.java | 4 +- .../itemscroller/util/InventoryUtils.java | 140 +++++++++--------- src/main/resources/mixins.itemscroller.json | 2 +- 15 files changed, 135 insertions(+), 136 deletions(-) rename src/main/java/fi/dy/masa/itemscroller/mixin/{MixinCraftingTableScreenHandler.java => MixinCraftingScreenHandler.java} (87%) diff --git a/build.properties b/build.properties index 7fb865e70..13930569d 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w11a -minecraft_version = 20w11a -mappings_version = 20w11a+build.1 +minecraft_version_out = 1.16-snap-20w12a +minecraft_version = 20w12a +mappings_version = 20w12a+build.14 -fabric_loader_version = 0.7.8+build.187 -mod_menu_version = 1.8.5+build.23 +fabric_loader_version = 0.7.8+build.188 +mod_menu_version = 1.11.0+build.2 diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index e7081001a..7681dc50c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -16,7 +16,7 @@ import fi.dy.masa.malilib.config.options.ConfigBoolean; import fi.dy.masa.malilib.util.FileUtils; import fi.dy.masa.malilib.util.JsonUtils; -import net.minecraft.client.gui.screen.ingame.CraftingTableScreen; +import net.minecraft.client.gui.screen.ingame.CraftingScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.screen.slot.CraftingResultSlot; @@ -107,7 +107,7 @@ public static void loadFromFile() CraftingHandler.clearDefinitions(); // "net.minecraft.client.gui.inventory.GuiCrafting,net.minecraft.inventory.SlotCrafting,0,1-9", // vanilla Crafting Table - CraftingHandler.addCraftingGridDefinition(CraftingTableScreen.class.getName(), CraftingResultSlot.class.getName(), 0, new SlotRange(1, 9)); + CraftingHandler.addCraftingGridDefinition(CraftingScreen.class.getName(), CraftingResultSlot.class.getName(), 0, new SlotRange(1, 9)); //"net.minecraft.client.gui.inventory.PlayerInventoryScreen,net.minecraft.inventory.SlotCrafting,0,1-4", // vanilla player inventory crafting grid CraftingHandler.addCraftingGridDefinition(InventoryScreen.class.getName(), CraftingResultSlot.class.getName(), 0, new SlotRange(1, 4)); } diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index b3defedbc..4e492683a 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -3,7 +3,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; -import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.screen.slot.Slot; import net.minecraft.util.math.MathHelper; import fi.dy.masa.itemscroller.Reference; @@ -122,11 +122,11 @@ private boolean handleInput(int keyCode, boolean keyState, double dWheel) final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); final int mouseY = fi.dy.masa.malilib.util.InputUtils.getMouseY(); - if (GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && + if (GuiUtils.getCurrentScreen() instanceof HandledScreen && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) { - ScreenWithHandler gui = (ScreenWithHandler) GuiUtils.getCurrentScreen(); + HandledScreen gui = (HandledScreen) GuiUtils.getCurrentScreen(); RecipeStorage recipes = RecipeStorage.getInstance(); if (dWheel != 0) @@ -204,14 +204,14 @@ public void onMouseMove(int mouseX, int mouseY) if (this.callbacks.functionalityEnabled() && mc.player != null && - GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && + GuiUtils.getCurrentScreen() instanceof HandledScreen && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) { - this.handleDragging((ScreenWithHandler) GuiUtils.getCurrentScreen(), mc, mouseX, mouseY, false); + this.handleDragging((HandledScreen) GuiUtils.getCurrentScreen(), mc, mouseX, mouseY, false); } } - private boolean handleDragging(ScreenWithHandler gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) + private boolean handleDragging(HandledScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) { MoveAction action = InventoryUtils.getActiveMoveAction(); diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index d0d0da192..136c21276 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -3,8 +3,8 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; import net.minecraft.screen.slot.Slot; import net.minecraft.sound.SoundEvents; import fi.dy.masa.itemscroller.ItemScroller; @@ -80,12 +80,12 @@ else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) return true; } - if (this.disabled || mc == null || mc.player == null || (GuiUtils.getCurrentScreen() instanceof ScreenWithHandler) == false) + if (this.disabled || mc == null || mc.player == null || (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false) { return false; } - ScreenWithHandler gui = (ScreenWithHandler) GuiUtils.getCurrentScreen(); + HandledScreen gui = (HandledScreen) GuiUtils.getCurrentScreen(); Slot slot = AccessorUtils.getSlotUnderMouse(gui); RecipeStorage recipes = RecipeStorage.getInstance(); MoveAction moveAction = InputUtils.getDragMoveAction(key); @@ -170,13 +170,13 @@ public void onClientTick(MinecraftClient mc) if (this.disabled == false && mc != null && mc.player != null && - GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && + GuiUtils.getCurrentScreen() instanceof HandledScreen && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false && Hotkeys.KEY_MASS_CRAFT.getKeybind().isKeybindHeld()) { Screen guiScreen = GuiUtils.getCurrentScreen(); - ScreenWithHandler gui = (ScreenWithHandler) guiScreen; + HandledScreen gui = (HandledScreen) guiScreen; Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); if (outputSlot != null) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 8c94c8d63..ac111ddd0 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -6,7 +6,7 @@ import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; -import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.util.GlAllocationUtils; import net.minecraft.item.ItemStack; @@ -47,9 +47,9 @@ public static RenderEventHandler instance() public void onDrawBackgroundPost() { - if (GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && InputUtils.isRecipeViewOpen()) + if (GuiUtils.getCurrentScreen() instanceof HandledScreen && InputUtils.isRecipeViewOpen()) { - ScreenWithHandler gui = (ScreenWithHandler) GuiUtils.getCurrentScreen(); + HandledScreen gui = (HandledScreen) GuiUtils.getCurrentScreen(); RecipeStorage recipes = RecipeStorage.getInstance(); final int first = recipes.getFirstVisibleRecipeId(); final int countPerPage = recipes.getRecipeCountPerPage(); @@ -91,9 +91,9 @@ public void onDrawBackgroundPost() public void onDrawScreenPost() { - if (GuiUtils.getCurrentScreen() instanceof ScreenWithHandler && InputUtils.isRecipeViewOpen()) + if (GuiUtils.getCurrentScreen() instanceof HandledScreen && InputUtils.isRecipeViewOpen()) { - ScreenWithHandler gui = (ScreenWithHandler) this.mc.currentScreen; + HandledScreen gui = (HandledScreen) this.mc.currentScreen; RecipeStorage recipes = RecipeStorage.getInstance(); final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); @@ -124,7 +124,7 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) } } - private void calculateRecipePositions(ScreenWithHandler gui) + private void calculateRecipePositions(HandledScreen gui) { RecipeStorage recipes = RecipeStorage.getInstance(); final int gapHorizontal = 2; @@ -155,7 +155,7 @@ private void calculateRecipePositions(ScreenWithHandler gui) this.columnWidth = stackBaseHeight + this.numberTextWidth + this.gapColumn; } - private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, ScreenWithHandler gui) + private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, HandledScreen gui) { ItemStack stack = recipe.getResult(); @@ -165,7 +165,7 @@ private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, Sc } } - public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, ScreenWithHandler gui) + public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, HandledScreen gui) { if (InputUtils.isRecipeViewOpen()) { @@ -194,7 +194,7 @@ public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, Scr return -1; } - private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, ScreenWithHandler gui, boolean selected) + private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, HandledScreen gui, boolean selected) { final TextRenderer font = this.mc.textRenderer; final String indexStr = String.valueOf(recipeId + 1); @@ -216,7 +216,7 @@ private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int RenderSystem.popMatrix(); } - private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, ScreenWithHandler gui) + private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, HandledScreen gui) { ItemStack[] items = recipe.getRecipeItems(); final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength())); @@ -235,7 +235,7 @@ private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, Scr } } - private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCountPerPage, ScreenWithHandler gui) + private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePattern recipe, int recipeCountPerPage, HandledScreen gui) { final int recipeDimensions = (int) Math.ceil(Math.sqrt(recipe.getRecipeLength())); int scaledStackDimensions = (int) (16 * this.scale); diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java index b4b079f7a..e963a407c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java @@ -4,7 +4,7 @@ import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; -@Mixin(net.minecraft.client.gui.screen.ingame.ScreenWithHandler.class) +@Mixin(net.minecraft.client.gui.screen.ingame.HandledScreen.class) public interface IMixinScreenWithHandler { @Invoker("getSlotAt") diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java index 4ceaed21f..d425e6be9 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java @@ -1,12 +1,11 @@ package fi.dy.masa.itemscroller.mixin; -import net.minecraft.screen.slot.Slot; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -@Mixin(Slot.class) +@Mixin(net.minecraft.screen.slot.Slot.class) public interface IMixinSlot { - @Accessor("invSlot") + @Accessor("index") int getSlotIndex(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableScreenHandler.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingScreenHandler.java similarity index 87% rename from src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableScreenHandler.java rename to src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingScreenHandler.java index 97c238b8d..fef3cb178 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingTableScreenHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingScreenHandler.java @@ -8,17 +8,17 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import fi.dy.masa.itemscroller.util.InventoryUtils; -@Mixin(net.minecraft.screen.CraftingTableScreenHandler.class) -public abstract class MixinCraftingTableScreenHandler +@Mixin(net.minecraft.screen.CraftingScreenHandler.class) +public abstract class MixinCraftingScreenHandler { - @Shadow @Final private net.minecraft.inventory.CraftingInventory craftingInv; - @Shadow @Final private net.minecraft.inventory.CraftingResultInventory resultInv; + @Shadow @Final private net.minecraft.inventory.CraftingInventory input; + @Shadow @Final private net.minecraft.inventory.CraftingResultInventory result; @Shadow @Final private net.minecraft.entity.player.PlayerEntity player; @Inject(method = "onContentChanged", at = @At("RETURN")) private void onSlotChangedCraftingGrid(net.minecraft.inventory.Inventory inventory, CallbackInfo ci) { - InventoryUtils.onSlotChangedCraftingGrid(this.player, this.craftingInv, this.resultInv); + InventoryUtils.onSlotChangedCraftingGrid(this.player, this.input, this.result); } @Inject(method = "updateResult", at = @At("RETURN")) diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java index 57fed720c..bb077b216 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/CraftingHandler.java @@ -6,7 +6,7 @@ import java.util.Set; import javax.annotation.Nullable; import net.minecraft.client.gui.screen.Screen; -import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.slot.Slot; import fi.dy.masa.itemscroller.ItemScroller; @@ -14,7 +14,7 @@ public class CraftingHandler { private static final Map CRAFTING_GRID_SLOTS = new HashMap(); - private static final Set>> CRAFTING_GUIS = new HashSet<>(); + private static final Set>> CRAFTING_GUIS = new HashSet<>(); public static void clearDefinitions() { @@ -27,7 +27,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot { try { - Class> guiClass = (Class>) Class.forName(guiClassName); + Class> guiClass = (Class>) Class.forName(guiClassName); Class slotClass = (Class) Class.forName(slotClassName); CRAFTING_GRID_SLOTS.put(new CraftingOutputSlot(guiClass, slotClass, outputSlot), range); @@ -46,7 +46,7 @@ public static boolean addCraftingGridDefinition(String guiClassName, String slot public static boolean isCraftingGui(Screen gui) { - return (gui instanceof ScreenWithHandler) && CRAFTING_GUIS.contains(((ScreenWithHandler) gui).getClass()); + return (gui instanceof HandledScreen) && CRAFTING_GUIS.contains(((HandledScreen) gui).getClass()); } /** @@ -56,13 +56,13 @@ public static boolean isCraftingGui(Screen gui) * @return the SlotRange of the crafting grid, or null, if the given slot is not a crafting output slot */ @Nullable - public static SlotRange getCraftingGridSlots(ScreenWithHandler gui, Slot slot) + public static SlotRange getCraftingGridSlots(HandledScreen gui, Slot slot) { return CRAFTING_GRID_SLOTS.get(CraftingOutputSlot.from(gui, slot)); } @Nullable - public static Slot getFirstCraftingOutputSlotForGui(ScreenWithHandler gui) + public static Slot getFirstCraftingOutputSlotForGui(HandledScreen gui) { if (CRAFTING_GUIS.contains(gui.getClass())) { @@ -80,11 +80,11 @@ public static Slot getFirstCraftingOutputSlotForGui(ScreenWithHandler> guiClass; + private final Class> guiClass; private final Class slotClass; private final int outputSlot; - private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) + private CraftingOutputSlot (Class> guiClass, Class slotClass, int outputSlot) { this.guiClass = guiClass; this.slotClass = slotClass; @@ -92,12 +92,12 @@ private CraftingOutputSlot (Class> guiClass, Clas } @SuppressWarnings("unchecked") - public static CraftingOutputSlot from(ScreenWithHandler gui, Slot slot) + public static CraftingOutputSlot from(HandledScreen gui, Slot slot) { - return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); + return new CraftingOutputSlot((Class>) gui.getClass(), slot.getClass(), slot.id); } - public Class> getGuiClass() + public Class> getGuiClass() { return this.guiClass; } @@ -112,7 +112,7 @@ public int getSlotNumber() return this.outputSlot; } - public boolean matches(ScreenWithHandler gui, Slot slot, int outputSlot) + public boolean matches(HandledScreen gui, Slot slot, int outputSlot) { return outputSlot == this.outputSlot && gui.getClass() == this.guiClass && slot.getClass() == this.slotClass; } diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java index 8a5310905..383c75ad6 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java @@ -1,7 +1,7 @@ package fi.dy.masa.itemscroller.recipes; import javax.annotation.Nonnull; -import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; @@ -45,7 +45,7 @@ public void ensureRecipeSizeAndClearRecipe(int size) this.clearRecipe(); } - public void storeCraftingRecipe(Slot slot, ScreenWithHandler gui, boolean clearIfEmpty) + public void storeCraftingRecipe(Slot slot, HandledScreen gui, boolean clearIfEmpty) { SlotRange range = CraftingHandler.getCraftingGridSlots(gui, slot); diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java index 7d38298ad..9e07df679 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java @@ -4,7 +4,7 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import javax.annotation.Nonnull; -import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtIo; @@ -103,12 +103,12 @@ public RecipePattern getSelectedRecipe() return this.getRecipe(this.getSelection()); } - public void storeCraftingRecipeToCurrentSelection(Slot slot, ScreenWithHandler gui, boolean clearIfEmpty) + public void storeCraftingRecipeToCurrentSelection(Slot slot, HandledScreen gui, boolean clearIfEmpty) { this.storeCraftingRecipe(this.getSelection(), slot, gui, clearIfEmpty); } - public void storeCraftingRecipe(int index, Slot slot, ScreenWithHandler gui, boolean clearIfEmpty) + public void storeCraftingRecipe(int index, Slot slot, HandledScreen gui, boolean clearIfEmpty) { this.getRecipe(index).storeCraftingRecipe(slot, gui, clearIfEmpty); this.dirty = true; diff --git a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java index 7f452361c..79cb24c73 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java @@ -1,7 +1,7 @@ package fi.dy.masa.itemscroller.util; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; -import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.SlotActionType; import fi.dy.masa.itemscroller.mixin.IMixinScreenWithHandler; @@ -10,37 +10,37 @@ public class AccessorUtils { - public static Slot getSlotUnderMouse(ScreenWithHandler gui) + public static Slot getSlotUnderMouse(HandledScreen gui) { return ((IMixinScreenWithHandler) gui).getHoveredSlot(); } - public static Slot getSlotAtPosition(ScreenWithHandler gui, int x, int y) + public static Slot getSlotAtPosition(HandledScreen gui, int x, int y) { return ((IMixinScreenWithHandler) gui).getSlotAtPositionInvoker(x, y); } - public static void handleMouseClick(ScreenWithHandler gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) + public static void handleMouseClick(HandledScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) { ((IMixinScreenWithHandler) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); } - public static int getGuiLeft(ScreenWithHandler gui) + public static int getGuiLeft(HandledScreen gui) { return ((IMixinScreenWithHandler) gui).getGuiLeft(); } - public static int getGuiTop(ScreenWithHandler gui) + public static int getGuiTop(HandledScreen gui) { return ((IMixinScreenWithHandler) gui).getGuiTop(); } - public static int getGuiXSize(ScreenWithHandler gui) + public static int getGuiXSize(HandledScreen gui) { return ((IMixinScreenWithHandler) gui).getGuiSizeX(); } - public static int getGuiYSize(ScreenWithHandler gui) + public static int getGuiYSize(HandledScreen gui) { return ((IMixinScreenWithHandler) gui).getGuiSizeY(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index e68938557..a98f09efc 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -1,7 +1,7 @@ package fi.dy.masa.itemscroller.util; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.event.KeybindCallbacks; import fi.dy.masa.itemscroller.recipes.CraftingHandler; @@ -19,7 +19,7 @@ public static boolean isRecipeViewOpen() CraftingHandler.isCraftingGui(GuiUtils.getCurrentScreen()); } - public static boolean canShiftDropItems(ScreenWithHandler gui, MinecraftClient mc, int mouseX, int mouseY) + public static boolean canShiftDropItems(HandledScreen gui, MinecraftClient mc, int mouseX, int mouseY) { if (InventoryUtils.isStackEmpty(mc.player.inventory.getCursorStack()) == false) { diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 3f30cf48b..10b28f854 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -12,9 +12,9 @@ import javax.annotation.Nullable; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; -import net.minecraft.client.gui.screen.ingame.ScreenWithHandler; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.player.PlayerEntity; @@ -99,7 +99,7 @@ public static String getStackString(ItemStack stack) return ""; } - public static void debugPrintSlotInfo(ScreenWithHandler gui, Slot slot) + public static void debugPrintSlotInfo(HandledScreen gui, Slot slot) { if (slot == null) { @@ -118,7 +118,7 @@ public static void debugPrintSlotInfo(ScreenWithHandler gui.getScreenHandler().slots.size())); } - private static boolean isValidSlot(Slot slot, ScreenWithHandler gui, boolean requireItems) + private static boolean isValidSlot(Slot slot, HandledScreen gui, boolean requireItems) { ScreenHandler container = gui.getScreenHandler(); @@ -128,7 +128,7 @@ private static boolean isValidSlot(Slot slot, ScreenWithHandler gui, @Nullable Slot slot) + public static boolean isCraftingSlot(HandledScreen gui, @Nullable Slot slot) { return slot != null && CraftingHandler.getCraftingGridSlots(gui, slot) != null; } @@ -140,7 +140,7 @@ private static boolean inventoryExistsAbove(Slot slot, ScreenHandler container) { for (Slot slotTmp : container.slots) { - if (slotTmp.yPosition < slot.yPosition && areSlotsInSameInventory(slot, slotTmp) == false) + if (slotTmp.y < slot.y && areSlotsInSameInventory(slot, slotTmp) == false) { return true; } @@ -149,7 +149,7 @@ private static boolean inventoryExistsAbove(Slot slot, ScreenHandler container) return false; } - public static boolean canShiftPlaceItems(ScreenWithHandler gui) + public static boolean canShiftPlaceItems(HandledScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -160,7 +160,7 @@ public static boolean canShiftPlaceItems(ScreenWithHandler gui, RecipeStorage recipes, boolean scrollingUp) + public static boolean tryMoveItems(HandledScreen gui, RecipeStorage recipes, boolean scrollingUp) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -252,7 +252,7 @@ else if (getStackSize(stack) < slot.getMaxStackAmount(stack)) return false; } - public static boolean dragMoveItems(ScreenWithHandler gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) + public static boolean dragMoveItems(HandledScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) { @@ -355,7 +355,7 @@ public static void stopDragging() DRAGGED_SLOTS.clear(); } - private static boolean dragMoveFromSlotAtPosition(ScreenWithHandler gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPosition(HandledScreen gui, int x, int y, MoveAction action) { if (gui instanceof CreativeInventoryScreen) { @@ -426,7 +426,7 @@ private static boolean dragMoveFromSlotAtPosition(ScreenWithHandler gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPositionCreative(HandledScreen gui, int x, int y, MoveAction action) { CreativeInventoryScreen guiCreative = (CreativeInventoryScreen) gui; Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); @@ -520,7 +520,7 @@ private static boolean dragMoveFromSlotAtPositionCreative(ScreenWithHandler gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) + public static void dropStacks(HandledScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) { if (slotReference != null && isStackEmpty(stackReference) == false) { @@ -540,7 +540,7 @@ public static void dropStacks(ScreenWithHandler gui, It } } - public static boolean shiftDropItems(ScreenWithHandler gui) + public static boolean shiftDropItems(HandledScreen gui) { ItemStack stackReference = MinecraftClient.getInstance().player.inventory.getCursorStack(); @@ -558,7 +558,7 @@ public static boolean shiftDropItems(ScreenWithHandler return false; } - public static boolean shiftPlaceItems(Slot slot, ScreenWithHandler gui) + public static boolean shiftPlaceItems(Slot slot, HandledScreen gui) { // Left click to place the items from the cursor to the slot leftClickSlot(gui, slot.id); @@ -650,7 +650,7 @@ else if (slot.hasStack()) return false; } - private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ScreenWithHandler gui) + private static boolean tryMoveSingleItemToOtherInventory(Slot slot, HandledScreen gui) { ItemStack stackOrig = slot.getStack(); ScreenHandler container = gui.getScreenHandler(); @@ -702,7 +702,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ScreenWithHa return false; } - private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, ScreenWithHandler gui) + private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledScreen gui) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -826,7 +826,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, ScreenWit return false; } - private static boolean tryMoveSingleItemToThisInventory(Slot slot, ScreenWithHandler gui) + private static boolean tryMoveSingleItemToThisInventory(Slot slot, HandledScreen gui) { ScreenHandler container = gui.getScreenHandler(); ItemStack stackOrig = slot.getStack(); @@ -875,12 +875,12 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, ScreenWithHan return false; } - public static void tryMoveStacks(Slot slot, ScreenWithHandler gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + public static void tryMoveStacks(Slot slot, HandledScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { tryMoveStacks(slot.getStack(), slot, gui, matchingOnly, toOtherInventory, firstOnly); } - private static void tryMoveStacks(ItemStack stackReference, Slot slot, ScreenWithHandler gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + private static void tryMoveStacks(ItemStack stackReference, Slot slot, HandledScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) { ScreenHandler container = gui.getScreenHandler(); final int maxSlot = container.slots.size() - 1; @@ -946,7 +946,7 @@ private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, boolean f } } - private static void fillBuySlot(ScreenWithHandler gui, int slotNum, ItemStack buyStack, boolean fillStacks) + private static void fillBuySlot(HandledScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) { Slot slot = gui.getScreenHandler().getSlot(slotNum); ItemStack existingStack = slot.getStack(); @@ -966,7 +966,7 @@ private static void fillBuySlot(ScreenWithHandler gui, } } - public static void handleRecipeClick(ScreenWithHandler gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, + public static void handleRecipeClick(HandledScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, boolean isLeftClick, boolean isRightClick, boolean isPickBlock, boolean isShiftDown) { if (isLeftClick || isRightClick) @@ -1029,7 +1029,7 @@ else if (isPickBlock) } } - public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, ScreenWithHandler gui, boolean fillStacks) + public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, HandledScreen gui, boolean fillStacks) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1039,13 +1039,13 @@ public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, ScreenW } } - public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, ScreenWithHandler gui) + public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, HandledScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); loadRecipeItemsToGridForOutputSlot(recipe, gui, slot); } - private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, ScreenWithHandler gui, Slot outputSlot) + private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, HandledScreen gui, Slot outputSlot) { if (outputSlot != null && isCraftingSlot(gui, outputSlot) && isStackEmpty(recipe.getResult()) == false) { @@ -1053,7 +1053,7 @@ private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, Scr } } - private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, ScreenWithHandler gui, + private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, HandledScreen gui, boolean moveToOtherInventory, boolean moveStacks, boolean moveEverything) { RecipePattern recipe = recipes.getSelectedRecipe(); @@ -1097,7 +1097,7 @@ else if (moveToOtherInventory == false && isStackEmpty(stackRecipeOutput) == fal return false; } - private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, ScreenWithHandler gui) + private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, HandledScreen gui) { ItemStack result = recipe.getResult(); int failSafe = 1024; @@ -1121,7 +1121,7 @@ private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, } } - public static void clearFirstCraftingGridOfItems(RecipePattern recipe, ScreenWithHandler gui, boolean clearNonMatchingOnly) + public static void clearFirstCraftingGridOfItems(RecipePattern recipe, HandledScreen gui, boolean clearNonMatchingOnly) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1132,7 +1132,7 @@ public static void clearFirstCraftingGridOfItems(RecipePattern recipe, ScreenWit } } - public static void clearFirstCraftingGridOfAllItems(ScreenWithHandler gui) + public static void clearFirstCraftingGridOfAllItems(HandledScreen gui) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1143,7 +1143,7 @@ public static void clearFirstCraftingGridOfAllItems(ScreenWithHandler gui, SlotRange range, boolean clearNonMatchingOnly) + private static boolean clearCraftingGridOfItems(RecipePattern recipe, HandledScreen gui, SlotRange range, boolean clearNonMatchingOnly) { final int invSlots = gui.getScreenHandler().slots.size(); final int rangeSlots = range.getSlotCount(); @@ -1170,7 +1170,7 @@ private static boolean clearCraftingGridOfItems(RecipePattern recipe, ScreenWith return true; } - private static boolean clearCraftingGridOfAllItems(ScreenWithHandler gui, SlotRange range) + private static boolean clearCraftingGridOfAllItems(HandledScreen gui, SlotRange range) { final int invSlots = gui.getScreenHandler().slots.size(); final int rangeSlots = range.getSlotCount(); @@ -1195,7 +1195,7 @@ private static boolean clearCraftingGridOfAllItems(ScreenWithHandler gui, boolean fillStacks) + private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slot slot, HandledScreen gui, boolean fillStacks) { ScreenHandler container = gui.getScreenHandler(); int numSlots = container.slots.size(); @@ -1240,7 +1240,7 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slo return false; } - private static void fillCraftingGrid(ScreenWithHandler gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void fillCraftingGrid(HandledScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { ScreenHandler container = gui.getScreenHandler(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1322,7 +1322,7 @@ private static void fillCraftingGrid(ScreenWithHandler } } - public static void rightClickCraftOneStack(ScreenWithHandler gui) + public static void rightClickCraftOneStack(HandledScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1354,7 +1354,7 @@ public static void rightClickCraftOneStack(ScreenWithHandler gui) + public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe, HandledScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1380,7 +1380,7 @@ public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe } } - public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, ScreenWithHandler gui) + public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, HandledScreen gui) { if (isStackEmpty(recipe.getResult()) == false) { @@ -1412,7 +1412,7 @@ public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, } } - public static void throwAllCraftingResultsToGround(RecipePattern recipe, ScreenWithHandler gui) + public static void throwAllCraftingResultsToGround(RecipePattern recipe, HandledScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1422,7 +1422,7 @@ public static void throwAllCraftingResultsToGround(RecipePattern recipe, ScreenW } } - private static int putSingleItemIntoSlots(ScreenWithHandler gui, List targetSlots, int startIndex) + private static int putSingleItemIntoSlots(HandledScreen gui, List targetSlots, int startIndex) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); @@ -1453,7 +1453,7 @@ private static int putSingleItemIntoSlots(ScreenWithHandler gui, Slot slot) + public static void moveOneSetOfItemsFromSlotToPlayerInventory(HandledScreen gui, Slot slot) { leftClickSlot(gui, slot.id); @@ -1472,7 +1472,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(ScreenWithHandler< } } - private static void moveOneRecipeItemIntoCraftingGrid(ScreenWithHandler gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void moveOneRecipeItemIntoCraftingGrid(HandledScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { ScreenHandler container = gui.getScreenHandler(); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1519,7 +1519,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(ScreenWithHandler gui, List slotNumbers) + private static boolean moveItemFromCursorToSlots(HandledScreen gui, List slotNumbers) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -1537,7 +1537,7 @@ private static boolean moveItemFromCursorToSlots(ScreenWithHandler gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) + private static void moveItemsFromInventory(HandledScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) { ScreenHandler container = gui.getScreenHandler(); @@ -1845,7 +1845,7 @@ private void clickSlotsToMoveItems(Slot slot, ContainerScreen gui, boolean toOtherInventory) + private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, HandledScreen gui, boolean toOtherInventory) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1881,7 +1881,7 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, ScreenWithHandl } } - private static boolean clickSlotsToMoveSingleItem(ScreenWithHandler gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveSingleItem(HandledScreen gui, int slotFrom, int slotTo) { //System.out.println("clickSlotsToMoveSingleItem(from: " + slotFrom + ", to: " + slotTo + ")"); MinecraftClient mc = MinecraftClient.getInstance(); @@ -1916,7 +1916,7 @@ private static boolean clickSlotsToMoveSingleItem(ScreenWithHandler gui, int slotFrom) + private static boolean clickSlotsToMoveSingleItemByShiftClick(HandledScreen gui, int slotFrom) { MinecraftClient mc = MinecraftClient.getInstance(); Slot slot = gui.getScreenHandler().slots.get(slotFrom); @@ -1961,7 +1961,7 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(ScreenWithHandler< * Try move items from slotFrom to slotTo * @return true if at least some items were moved */ - private static boolean clickSlotsToMoveItems(ScreenWithHandler gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveItems(HandledScreen gui, int slotFrom, int slotTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -1994,7 +1994,7 @@ private static boolean clickSlotsToMoveItems(ScreenWithHandler gui, int slotNum) + public static void dropStacksUntilEmpty(HandledScreen gui, int slotNum) { if (slotNum >= 0 && slotNum < gui.getScreenHandler().slots.size()) { @@ -2008,7 +2008,7 @@ public static void dropStacksUntilEmpty(ScreenWithHandler gui, int slotNum, ItemStack stackReference) + public static void dropStacksWhileHasItem(HandledScreen gui, int slotNum, ItemStack stackReference) { if (slotNum >= 0 && slotNum < gui.getScreenHandler().slots.size()) { @@ -2022,7 +2022,7 @@ public static void dropStacksWhileHasItem(ScreenWithHandler gui, int slotNum) + private static boolean shiftClickSlotWithCheck(HandledScreen gui, int slotNum) { Slot slot = gui.getScreenHandler().getSlot(slotNum); @@ -2037,7 +2037,7 @@ private static boolean shiftClickSlotWithCheck(ScreenWithHandler gui, Slot slot, boolean moveUp, MoveAmount amount) + public static boolean tryMoveItemsVertically(HandledScreen gui, Slot slot, boolean moveUp, MoveAmount amount) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -2074,7 +2074,7 @@ else if (amount == MoveAmount.ALL_MATCHING) return true; } - private static void moveMatchingStacksToSlots(ScreenWithHandler gui, Slot slot, boolean moveUp) + private static void moveMatchingStacksToSlots(HandledScreen gui, Slot slot, boolean moveUp) { List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, true, slot.getStack(), true, true, false); List targetSlots = getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, false, true, false); @@ -2090,14 +2090,14 @@ private static void moveMatchingStacksToSlots(ScreenWithHandler srcSlot.yPosition) == moveUp)) + if (lastSlot == null || (lastSlot.id == srcSlot.id || (lastSlot.y > srcSlot.y) == moveUp)) { return; } } } - private static Slot moveStackToSlots(ScreenWithHandler gui, Slot slotFrom, List slotsTo, boolean leaveOne) + private static Slot moveStackToSlots(HandledScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2144,7 +2144,7 @@ private static Slot moveStackToSlots(ScreenWithHandler return lastSlot; } - private static void moveOneItemToFirstValidSlot(ScreenWithHandler gui, Slot slotFrom, List slotsTo) + private static void moveOneItemToFirstValidSlot(HandledScreen gui, Slot slotFrom, List slotsTo) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerInventory inv = mc.player.inventory; @@ -2189,9 +2189,9 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Sc for (Slot slotTmp : container.slots) { - if (slotTmp.id != slotIn.id && slotTmp.yPosition != slotIn.yPosition) + if (slotTmp.id != slotIn.id && slotTmp.y != slotIn.y) { - if (above == slotTmp.yPosition < slotIn.yPosition) + if (above == slotTmp.y < slotIn.y) { ItemStack stackTmp = slotTmp.getStack(); @@ -2209,7 +2209,7 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Sc return slotNumbers; } - public static void tryClearCursor(ScreenWithHandler gui, MinecraftClient mc) + public static void tryClearCursor(HandledScreen gui, MinecraftClient mc) { ItemStack stackCursor = mc.player.inventory.getCursorStack(); @@ -2301,16 +2301,16 @@ public int compare(Integer slotNum1, Integer slotNum2) Slot slot1 = this.container.getSlot(slotNum1.intValue()); Slot slot2 = this.container.getSlot(slotNum2.intValue()); - if (slot1.yPosition == slot2.yPosition) + if (slot1.y == slot2.y) { return (slot1.id < slot2.id) == this.topToBottom ? -1 : 1; } - return (slot1.yPosition < slot2.yPosition) == this.topToBottom ? -1 : 1; + return (slot1.y < slot2.y) == this.topToBottom ? -1 : 1; } } - public static void clickSlot(ScreenWithHandler gui, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(HandledScreen gui, int slotNum, int mouseButton, SlotActionType type) { if (slotNum >= 0 && slotNum < gui.getScreenHandler().slots.size()) { @@ -2332,7 +2332,7 @@ public static void clickSlot(ScreenWithHandler gui, int } } - public static void clickSlot(ScreenWithHandler gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(HandledScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) { try { @@ -2345,59 +2345,59 @@ public static void clickSlot(ScreenWithHandler gui, Slo } } - public static void leftClickSlot(ScreenWithHandler gui, Slot slot, int slotNumber) + public static void leftClickSlot(HandledScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(ScreenWithHandler gui, Slot slot, int slotNumber) + public static void rightClickSlot(HandledScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(ScreenWithHandler gui, Slot slot, int slotNumber) + public static void shiftClickSlot(HandledScreen gui, Slot slot, int slotNumber) { clickSlot(gui, slot, slotNumber, 0, SlotActionType.QUICK_MOVE); } - public static void leftClickSlot(ScreenWithHandler gui, int slotNum) + public static void leftClickSlot(HandledScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.PICKUP); } - public static void rightClickSlot(ScreenWithHandler gui, int slotNum) + public static void rightClickSlot(HandledScreen gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.PICKUP); } - public static void shiftClickSlot(ScreenWithHandler gui, int slotNum) + public static void shiftClickSlot(HandledScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.QUICK_MOVE); } - public static void dropItemsFromCursor(ScreenWithHandler gui) + public static void dropItemsFromCursor(HandledScreen gui) { clickSlot(gui, -999, 0, SlotActionType.PICKUP); } - public static void dropItem(ScreenWithHandler gui, int slotNum) + public static void dropItem(HandledScreen gui, int slotNum) { clickSlot(gui, slotNum, 0, SlotActionType.THROW); } - public static void dropStack(ScreenWithHandler gui, int slotNum) + public static void dropStack(HandledScreen gui, int slotNum) { clickSlot(gui, slotNum, 1, SlotActionType.THROW); } - public static void swapSlots(ScreenWithHandler gui, int slotNum, int otherSlot) + public static void swapSlots(HandledScreen gui, int slotNum, int otherSlot) { clickSlot(gui, slotNum, 0, SlotActionType.SWAP); clickSlot(gui, otherSlot, 0, SlotActionType.SWAP); clickSlot(gui, slotNum, 0, SlotActionType.SWAP); } - private static void dragSplitItemsIntoSlots(ScreenWithHandler gui, List targetSlots) + private static void dragSplitItemsIntoSlots(HandledScreen gui, List targetSlots) { MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stackInCursor = mc.player.inventory.getCursorStack(); diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 39924db85..98aecaf28 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -8,7 +8,7 @@ "IMixinScreenWithHandler", "IMixinSlot", "MixinAbstractInventoryScreen", - "MixinCraftingTableScreenHandler", + "MixinCraftingScreenHandler", "MixinGameRenderer", "MixinScreen" ], From 4aa39d2f8da91deda92abdb97fbacf138b20add5 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 26 Mar 2020 03:31:08 +0200 Subject: [PATCH 038/107] Update to MC 1.16 snapshot 20w13a --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index 13930569d..bd2105f28 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w12a -minecraft_version = 20w12a -mappings_version = 20w12a+build.14 +minecraft_version_out = 1.16-snap-20w13a +minecraft_version = 20w13a +mappings_version = 20w13a+build.5 -fabric_loader_version = 0.7.8+build.188 +fabric_loader_version = 0.7.8+build.189 mod_menu_version = 1.11.0+build.2 From fdd1bf517ceb18ac61d26f5915dc2b5f7a8a6db7 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 3 Apr 2020 00:17:30 +0300 Subject: [PATCH 039/107] Update to MC 1.16 snapshot 20w14a --- build.properties | 10 +++++----- .../fi/dy/masa/itemscroller/util/InventoryUtils.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.properties b/build.properties index bd2105f28..d1427c025 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w13a -minecraft_version = 20w13a -mappings_version = 20w13a+build.5 +minecraft_version_out = 1.16-snap-20w14a +minecraft_version = 20w14a +mappings_version = 20w14a+build.1 -fabric_loader_version = 0.7.8+build.189 -mod_menu_version = 1.11.0+build.2 +fabric_loader_version = 0.7.9+build.190 +mod_menu_version = 1.11.1+build.3 diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 10b28f854..b4c70b17d 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -79,7 +79,7 @@ public static void onSlotChangedCraftingGrid(PlayerEntity player, stack = recipe.craft(craftMatrix); } - inventoryCraftResult.setInvStack(0, stack); + inventoryCraftResult.setStack(0, stack); } } } From 21f130bc4876bf6f7e4c473f290b9f5d6b223fb2 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 8 Apr 2020 18:57:53 +0300 Subject: [PATCH 040/107] Update to MC 1.16 snapshot 20w15a --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index d1427c025..c868257c5 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w14a -minecraft_version = 20w14a -mappings_version = 20w14a+build.1 +minecraft_version_out = 1.16-snap-20w15a +minecraft_version = 20w15a +mappings_version = 20w15a+build.1 -fabric_loader_version = 0.7.9+build.190 +fabric_loader_version = 0.8.2+build.194 mod_menu_version = 1.11.1+build.3 From 2d494d5ef26c62af486426e568f44bc53235c578 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 16 Apr 2020 00:07:05 +0300 Subject: [PATCH 041/107] Update to MC 1.16 snapshot 20w16a --- build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.properties b/build.properties index c868257c5..de7e7a4ca 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w15a -minecraft_version = 20w15a -mappings_version = 20w15a+build.1 +minecraft_version_out = 1.16-snap-20w16a +minecraft_version = 20w16a +mappings_version = 20w16a+build.1 fabric_loader_version = 0.8.2+build.194 mod_menu_version = 1.11.1+build.3 From 5e0b1f9c96244a6544834bfe4d5b9d50b6520f65 Mon Sep 17 00:00:00 2001 From: Arnevdl29 Date: Sat, 25 Apr 2020 02:01:24 +0200 Subject: [PATCH 042/107] Update to MC 1.16 snapshot 20w17a --- build.properties | 10 ++++----- .../event/RenderEventHandler.java | 22 ++++++++++--------- .../itemscroller/mixin/MixinGameRenderer.java | 8 ++++--- .../masa/itemscroller/mixin/MixinScreen.java | 6 ++--- src/main/resources/fabric.mod.json | 2 +- 5 files changed, 26 insertions(+), 22 deletions(-) diff --git a/build.properties b/build.properties index d1427c025..b0a7dbe4d 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.20+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w14a -minecraft_version = 20w14a -mappings_version = 20w14a+build.1 +minecraft_version_out = 1.16-snap-20w17a +minecraft_version = 20w17a +mappings_version = 20w17a+build.1 -fabric_loader_version = 0.7.9+build.190 -mod_menu_version = 1.11.1+build.3 +fabric_loader_version = 0.8.2+build.194 +mod_menu_version = 1.11.2+build.6 diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index ac111ddd0..955bb849d 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -9,6 +9,7 @@ import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.util.GlAllocationUtils; +import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; import net.minecraft.util.math.Vec3d; import fi.dy.masa.itemscroller.config.Configs; @@ -45,7 +46,7 @@ public static RenderEventHandler instance() return INSTANCE; } - public void onDrawBackgroundPost() + public void onDrawBackgroundPost(MatrixStack matrixStack) { if (GuiUtils.getCurrentScreen() instanceof HandledScreen && InputUtils.isRecipeViewOpen()) { @@ -62,7 +63,7 @@ public void onDrawBackgroundPost() RenderSystem.scaled(this.scale, this.scale, 1); String str = StringUtils.translate("itemscroller.gui.label.recipe_page", (first / countPerPage) + 1, recipes.getTotalRecipeCount() / countPerPage); - this.mc.textRenderer.draw(str, 16, -12, 0xC0C0C0C0); + this.mc.textRenderer.draw(matrixStack, str, 16, -12, 0xC0C0C0C0); for (int i = 0, recipeId = first; recipeId <= lastOnPage; ++i, ++recipeId) { @@ -71,7 +72,7 @@ public void onDrawBackgroundPost() int row = i % this.recipesPerColumn; int column = i / this.recipesPerColumn; - this.renderStoredRecipeStack(stack, recipeId, row, column, gui, selected); + this.renderStoredRecipeStack(stack, recipeId, row, column, gui, selected, matrixStack); } if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) @@ -89,7 +90,7 @@ public void onDrawBackgroundPost() } } - public void onDrawScreenPost() + public void onDrawScreenPost(MatrixStack matrixStack) { if (GuiUtils.getCurrentScreen() instanceof HandledScreen && InputUtils.isRecipeViewOpen()) { @@ -107,7 +108,7 @@ public void onDrawScreenPost() if (recipeId >= 0) { RecipePattern recipe = recipes.getRecipe(recipeId); - this.renderHoverTooltip(mouseX, mouseY, recipe, gui); + this.renderHoverTooltip(mouseX, mouseY, recipe, gui, matrixStack); } else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) { @@ -116,7 +117,7 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) if (InventoryUtils.isStackEmpty(stack) == false) { - InventoryOverlay.renderStackToolTip(mouseX, mouseY, stack, this.mc); + InventoryOverlay.renderStackToolTip(mouseX, mouseY, stack, this.mc, matrixStack); } } @@ -155,13 +156,13 @@ private void calculateRecipePositions(HandledScreen gui) this.columnWidth = stackBaseHeight + this.numberTextWidth + this.gapColumn; } - private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, HandledScreen gui) + private void renderHoverTooltip(int mouseX, int mouseY, RecipePattern recipe, HandledScreen gui, MatrixStack matrixStack) { ItemStack stack = recipe.getResult(); if (InventoryUtils.isStackEmpty(stack) == false) { - InventoryOverlay.renderStackToolTip(mouseX, mouseY, stack, this.mc); + InventoryOverlay.renderStackToolTip(mouseX, mouseY, stack, this.mc, matrixStack); } } @@ -194,7 +195,8 @@ public int getHoveredRecipeId(int mouseX, int mouseY, RecipeStorage recipes, Han return -1; } - private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, HandledScreen gui, boolean selected) + private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int column, HandledScreen gui, + boolean selected, MatrixStack matrixStack) { final TextRenderer font = this.mc.textRenderer; final String indexStr = String.valueOf(recipeId + 1); @@ -211,7 +213,7 @@ private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int RenderSystem.translatef(x, y, 0); RenderSystem.scaled(scale, scale, 0); - font.draw(indexStr, 0, 0, 0xC0C0C0); + font.draw(matrixStack, indexStr, 0, 0, 0xC0C0C0); RenderSystem.popMatrix(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java index 22dfa629e..313e3b734 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java @@ -5,6 +5,7 @@ import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import fi.dy.masa.itemscroller.event.RenderEventHandler; @Mixin(net.minecraft.client.render.GameRenderer.class) @@ -12,9 +13,10 @@ public abstract class MixinGameRenderer { @Inject(method = "render(FJZ)V", at = @At(value = "INVOKE", shift = Shift.AFTER, - target = "Lnet/minecraft/client/gui/screen/Screen;render(IIF)V")) - private void onDrawScreenPost(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo ci) + target = "Lnet/minecraft/client/gui/screen/Screen;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V"), + locals = LocalCapture.CAPTURE_FAILSOFT) + private void onDrawScreenPost(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo ci, int i, int j, net.minecraft.client.util.math.MatrixStack matrixStack) { - RenderEventHandler.instance().onDrawScreenPost(); + RenderEventHandler.instance().onDrawScreenPost(matrixStack); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java index fd71dc977..344cb7a66 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java @@ -11,9 +11,9 @@ @Mixin(Screen.class) public abstract class MixinScreen extends AbstractParentElement { - @Inject(method = "renderBackground()V", at = @At("RETURN")) - protected void onDrawDefaultBackgroundPost(CallbackInfo ci) + @Inject(method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;)V", at = @At("RETURN")) + protected void onDrawDefaultBackgroundPost(net.minecraft.client.util.math.MatrixStack matrixStack, CallbackInfo ci) { - RenderEventHandler.instance().onDrawBackgroundPost(); + RenderEventHandler.instance().onDrawBackgroundPost(matrixStack); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 8f94d00f3..960cb6a78 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "malilib": "=0.10.0-dev.20" + "malilib": ">=0.10.0-dev.20" }, "custom": { From 5cfd7fbbf3aff89f04b11316f15640e27904c31a Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sun, 26 Apr 2020 00:01:44 +0300 Subject: [PATCH 043/107] Small clean-up --- build.properties | 2 +- .../fi/dy/masa/itemscroller/event/RenderEventHandler.java | 7 ++++--- .../fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java | 8 +++----- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/build.properties b/build.properties index 11a3b6ef6..95b10adc2 100644 --- a/build.properties +++ b/build.properties @@ -9,7 +9,7 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.20+beta.1 +malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.16-snap-20w17a diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 955bb849d..5cbaa926f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -29,6 +29,7 @@ public class RenderEventHandler private static final Vec3d LIGHT0_POS = (new Vec3d( 0.2D, 1.0D, -0.7D)).normalize(); private static final Vec3d LIGHT1_POS = (new Vec3d(-0.2D, 1.0D, 0.7D)).normalize(); private static final FloatBuffer FLOAT_BUFFER = GlAllocationUtils.allocateFloatBuffer(4); + private static final MatrixStack FRESH_MATRIX_STACK = new MatrixStack(); private final MinecraftClient mc = MinecraftClient.getInstance(); private int recipeListX; @@ -90,7 +91,7 @@ public void onDrawBackgroundPost(MatrixStack matrixStack) } } - public void onDrawScreenPost(MatrixStack matrixStack) + public void onDrawScreenPost() { if (GuiUtils.getCurrentScreen() instanceof HandledScreen && InputUtils.isRecipeViewOpen()) { @@ -108,7 +109,7 @@ public void onDrawScreenPost(MatrixStack matrixStack) if (recipeId >= 0) { RecipePattern recipe = recipes.getRecipe(recipeId); - this.renderHoverTooltip(mouseX, mouseY, recipe, gui, matrixStack); + this.renderHoverTooltip(mouseX, mouseY, recipe, gui, FRESH_MATRIX_STACK); } else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) { @@ -117,7 +118,7 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) if (InventoryUtils.isStackEmpty(stack) == false) { - InventoryOverlay.renderStackToolTip(mouseX, mouseY, stack, this.mc, matrixStack); + InventoryOverlay.renderStackToolTip(mouseX, mouseY, stack, this.mc, FRESH_MATRIX_STACK); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java index 313e3b734..e8a0c823c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java @@ -5,7 +5,6 @@ import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.LocalCapture; import fi.dy.masa.itemscroller.event.RenderEventHandler; @Mixin(net.minecraft.client.render.GameRenderer.class) @@ -13,10 +12,9 @@ public abstract class MixinGameRenderer { @Inject(method = "render(FJZ)V", at = @At(value = "INVOKE", shift = Shift.AFTER, - target = "Lnet/minecraft/client/gui/screen/Screen;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V"), - locals = LocalCapture.CAPTURE_FAILSOFT) - private void onDrawScreenPost(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo ci, int i, int j, net.minecraft.client.util.math.MatrixStack matrixStack) + target = "Lnet/minecraft/client/gui/screen/Screen;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V")) + private void onDrawScreenPost(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo ci) { - RenderEventHandler.instance().onDrawScreenPost(matrixStack); + RenderEventHandler.instance().onDrawScreenPost(); } } From 171e3eade6a14534c50237c375e5d9c528c364c6 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 30 Apr 2020 00:30:46 +0300 Subject: [PATCH 044/107] Update to MC 1.16 snapshot 20w18a --- build.gradle | 2 +- build.properties | 6 +++--- .../fi/dy/masa/itemscroller/event/RenderEventHandler.java | 2 +- src/main/resources/fabric.mod.json | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index fd5816947..cedda45bd 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } } dependencies { - classpath 'net.fabricmc:fabric-loom:0.2.6-SNAPSHOT' + classpath 'net.fabricmc:fabric-loom:0.2.7-SNAPSHOT' } } diff --git a/build.properties b/build.properties index 95b10adc2..91415f4f1 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w17a -minecraft_version = 20w17a -mappings_version = 20w17a+build.4 +minecraft_version_out = 1.16-snap-20w18a +minecraft_version = 20w18a +mappings_version = 20w18a+build.2 fabric_loader_version = 0.8.2+build.194 mod_menu_version = 1.11.2+build.6 diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 5cbaa926f..b2d63ea12 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -207,7 +207,7 @@ private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int this.renderStackAt(stack, x, y, selected); double scale = 0.75; - x = x - (int) (font.getStringWidth(indexStr) * scale) - 2; + x = x - (int) (font.getWidth(indexStr) * scale) - 2; y = row * this.entryHeight + this.entryHeight / 2 - font.fontHeight / 2; RenderSystem.pushMatrix(); diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 960cb6a78..f6b3614c6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "malilib": ">=0.10.0-dev.20" + "malilib": ">=0.10.0-dev.21" }, "custom": { From 1ec32ca42e78044fbc4b99a62ac49d0e2b7a6ac6 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 7 May 2020 00:01:01 +0300 Subject: [PATCH 045/107] Update to MC 1.16 snapshot 20w19a --- build.properties | 8 ++++---- .../fi/dy/masa/itemscroller/event/RenderEventHandler.java | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index 91415f4f1..6c40ac990 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w18a -minecraft_version = 20w18a -mappings_version = 20w18a+build.2 +minecraft_version_out = 1.16-snap-20w19a +minecraft_version = 20w19a +mappings_version = 20w19a+build.1 fabric_loader_version = 0.8.2+build.194 -mod_menu_version = 1.11.2+build.6 +mod_menu_version = 1.11.4+build.9 diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index b2d63ea12..b0209fcac 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -299,7 +299,7 @@ private void renderStackAt(ItemStack stack, int x, int y, boolean border) stack = stack.copy(); InventoryUtils.setStackSize(stack, 1); this.mc.getItemRenderer().zOffset += 100; - this.mc.getItemRenderer().renderGuiItem(this.mc.player, stack, x, y); + this.mc.getItemRenderer().renderGuiItem(stack, x, y); this.mc.getItemRenderer().zOffset -= 100; } From d65e0c148737a898b333934df09165bbe0731f9f Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 15 May 2020 19:41:00 +0300 Subject: [PATCH 046/107] Update to MC 1.16 snapshot 20w20b --- build.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index 6c40ac990..dc8940660 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w19a -minecraft_version = 20w19a -mappings_version = 20w19a+build.1 +minecraft_version_out = 1.16-snap-20w20b +minecraft_version = 20w20b +mappings_version = 20w20b+build.7 -fabric_loader_version = 0.8.2+build.194 -mod_menu_version = 1.11.4+build.9 +fabric_loader_version = 0.8.3+build.196 +mod_menu_version = 1.11.5+build.10 From 815bbf9d2e14be78e6a011a50477f397babd5ebd Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 22 May 2020 00:56:08 +0300 Subject: [PATCH 047/107] Update to MC 1.16 snapshot 20w21a --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index dc8940660..9f486bd02 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w20b -minecraft_version = 20w20b -mappings_version = 20w20b+build.7 +minecraft_version_out = 1.16-snap-20w21a +minecraft_version = 20w21a +mappings_version = 20w21a+build.7 -fabric_loader_version = 0.8.3+build.196 +fabric_loader_version = 0.8.4+build.198 mod_menu_version = 1.11.5+build.10 From df93b2c0b9a8929dd7eefe519685f59215f86d75 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 29 May 2020 22:16:06 +0300 Subject: [PATCH 048/107] Update to MC 1.16 snapshot 20w22a --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index 9f486bd02..190fcd95b 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w21a -minecraft_version = 20w21a -mappings_version = 20w21a+build.7 +minecraft_version_out = 1.16-snap-20w22a +minecraft_version = 20w22a +mappings_version = 20w22a+build.1 fabric_loader_version = 0.8.4+build.198 -mod_menu_version = 1.11.5+build.10 +mod_menu_version = 1.11.7+build.12 From 8ecfc4ec7219da752d29ab4e1d6d2f4fe35f1f19 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 12 May 2020 17:46:53 +0300 Subject: [PATCH 049/107] Drop all returned items from crafting to allow for continued mass crafting --- .../itemscroller/event/KeybindCallbacks.java | 3 +- .../itemscroller/util/InventoryUtils.java | 44 ++++++++++++++++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 136c21276..8fc715497 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -200,8 +200,9 @@ public void onClientTick(MinecraftClient mc) InventoryUtils.dropStacksWhileHasItem(gui, outputSlot.id, recipe.getResult()); } - InventoryUtils.tryClearCursor(gui, mc); + //InventoryUtils.tryClearCursor(gui, mc); InventoryUtils.throwAllCraftingResultsToGround(recipe, gui); + InventoryUtils.throwAllNonRecipeItemsToGround(recipe, gui); InventoryUtils.tryMoveItemsToFirstCraftingGrid(recipe, gui, true); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index b4c70b17d..3f6baac7f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -540,6 +540,24 @@ public static void dropStacks(HandledScreen gui, ItemSt } } + public static void dropAllMatchingStacks(HandledScreen gui, ItemStack stackReference) + { + if (isStackEmpty(stackReference) == false) + { + ScreenHandler container = gui.getScreenHandler(); + stackReference = stackReference.copy(); + + for (Slot slot : container.slots) + { + if (areStacksEqual(slot.getStack(), stackReference)) + { + // Drop the stack + dropStack(gui, slot.id); + } + } + } + } + public static boolean shiftDropItems(HandledScreen gui) { ItemStack stackReference = MinecraftClient.getInstance().player.inventory.getCursorStack(); @@ -1162,7 +1180,7 @@ private static boolean clearCraftingGridOfItems(RecipePattern recipe, HandledScr // Failed to clear the slot if (slotTmp.hasStack()) { - return false; + dropStack(gui, slotNum); } } } @@ -1422,6 +1440,30 @@ public static void throwAllCraftingResultsToGround(RecipePattern recipe, Handled } } + public static void throwAllNonRecipeItemsToGround(RecipePattern recipe, HandledScreen gui) + { + Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); + + if (outputSlot != null && isStackEmpty(recipe.getResult()) == false) + { + SlotRange range = CraftingHandler.getCraftingGridSlots(gui, outputSlot); + ItemStack[] recipeItems = recipe.getRecipeItems(); + final int invSlots = gui.getScreenHandler().slots.size(); + final int rangeSlots = Math.min(range.getSlotCount(), recipeItems.length); + + for (int i = 0, slotNum = range.getFirst(); i < rangeSlots && slotNum < invSlots; i++, slotNum++) + { + Slot slotTmp = gui.getScreenHandler().getSlot(slotNum); + ItemStack stack = slotTmp.getStack(); + + if (stack.isEmpty() == false && areStacksEqual(stack, recipeItems[i]) == false) + { + dropAllMatchingStacks(gui, stack); + } + } + } + } + private static int putSingleItemIntoSlots(HandledScreen gui, List targetSlots, int startIndex) { MinecraftClient mc = MinecraftClient.getInstance(); From b13f585b69f0aaefa9bf1821f16111ef3c781e96 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 14 May 2020 00:44:30 +0300 Subject: [PATCH 050/107] Implement click packet rate limiting, by buffering the actual click packets --- .../dy/masa/itemscroller/config/Configs.java | 11 ++-- .../masa/itemscroller/event/InputHandler.java | 27 +++++++++- .../itemscroller/event/KeybindCallbacks.java | 39 ++++++++++++-- .../itemscroller/event/WorldLoadListener.java | 11 +++- .../MixinClientPlayerInteractionManager.java | 39 ++++++++++++++ .../itemscroller/util/ClickPacketBuffer.java | 54 +++++++++++++++++++ src/main/resources/mixins.itemscroller.json | 3 +- 7 files changed, 172 insertions(+), 12 deletions(-) create mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index 7681dc50c..cf2d5ae8a 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -7,6 +7,9 @@ import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; +import net.minecraft.client.gui.screen.ingame.CraftingScreen; +import net.minecraft.client.gui.screen.ingame.InventoryScreen; +import net.minecraft.screen.slot.CraftingResultSlot; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; @@ -14,11 +17,9 @@ import fi.dy.masa.malilib.config.IConfigHandler; import fi.dy.masa.malilib.config.IConfigValue; import fi.dy.masa.malilib.config.options.ConfigBoolean; +import fi.dy.masa.malilib.config.options.ConfigInteger; import fi.dy.masa.malilib.util.FileUtils; import fi.dy.masa.malilib.util.JsonUtils; -import net.minecraft.client.gui.screen.ingame.CraftingScreen; -import net.minecraft.client.gui.screen.ingame.InventoryScreen; -import net.minecraft.screen.slot.CraftingResultSlot; public class Configs implements IConfigHandler { @@ -29,8 +30,10 @@ public static class Generic 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."); + public static final ConfigInteger PACKET_RATE_LIMIT = new ConfigInteger("packetRateLimit", 4, 1, 1024, "The limit of sent emulated slot click packets per game tick,\nif 'rateLimitClickPackets' is enabled"); public static final ConfigBoolean SCROLL_CRAFT_STORE_RECIPES_TO_FILE = new ConfigBoolean("craftingRecipesSaveToFile", true, "If enabled, then the crafting features recipes are saved to a file\ninside minecraft/itemscroller/recipes_worldorservername.nbt.\nThis makes the recipes persistent across game restarts."); public static final ConfigBoolean SCROLL_CRAFT_RECIPE_FILE_GLOBAL = new ConfigBoolean("craftingRecipesSaveFileIsGlobal", false, "If true, then the recipe file is global, instead\n of being saved per-world or server"); + public static final ConfigBoolean RATE_LIMIT_CLICK_PACKETS = new ConfigBoolean("rateLimitClickPackets", false, "This is meant for compatibility with Spigot servers and similar,\nwhich apply rate limits to packets from the client.\nThis queues up the emulated slot click packets and sends\nthem rate limited over time. The limit per game tick can be set in 'packetRateLimit´."); public static final ConfigBoolean REVERSE_SCROLL_DIRECTION_SINGLE = new ConfigBoolean("reverseScrollDirectionSingle", false, "Reverse the scrolling direction for single item mode."); public static final ConfigBoolean REVERSE_SCROLL_DIRECTION_STACKS = new ConfigBoolean("reverseScrollDirectionStacks", false, "Reverse the scrolling direction for full stacks mode."); public static final ConfigBoolean SLOT_POSITION_AWARE_SCROLL_DIRECTION = new ConfigBoolean("useSlotPositionAwareScrollDirection", false, "When enabled, the item movement direction depends\non the slots' y-position on screen. Might be derpy with more\ncomplex inventories, use with caution!"); @@ -40,6 +43,8 @@ public static class Generic CARPET_CTRL_Q_CRAFTING, CLIENT_CRAFTING_FIX, CRAFTING_RENDER_RECIPE_ITEMS, + PACKET_RATE_LIMIT, + RATE_LIMIT_CLICK_PACKETS, SCROLL_CRAFT_STORE_RECIPES_TO_FILE, SCROLL_CRAFT_RECIPE_FILE_GLOBAL, REVERSE_SCROLL_DIRECTION_SINGLE, diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index 4e492683a..bf899c919 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -11,6 +11,7 @@ import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.recipes.RecipeStorage; import fi.dy.masa.itemscroller.util.AccessorUtils; +import fi.dy.masa.itemscroller.util.ClickPacketBuffer; import fi.dy.masa.itemscroller.util.InputUtils; import fi.dy.masa.itemscroller.util.InventoryUtils; import fi.dy.masa.itemscroller.util.MoveAction; @@ -102,6 +103,20 @@ public boolean onMouseClick(int mouseX, int mouseY, int eventButton, boolean eve } private boolean handleInput(int keyCode, boolean keyState, double dWheel) + { + if (Configs.Generic.RATE_LIMIT_CLICK_PACKETS.getBooleanValue()) + { + ClickPacketBuffer.setShouldBufferClickPackets(true); + } + + boolean cancel = this.handleInputImpl(keyCode, keyState, dWheel); + + ClickPacketBuffer.setShouldBufferClickPackets(false); + + return cancel; + } + + private boolean handleInputImpl(int keyCode, boolean keyState, double dWheel) { MoveAction action = InventoryUtils.getActiveMoveAction(); @@ -213,17 +228,25 @@ public void onMouseMove(int mouseX, int mouseY) private boolean handleDragging(HandledScreen gui, MinecraftClient mc, int mouseX, int mouseY, boolean isClick) { + boolean cancel = false; MoveAction action = InventoryUtils.getActiveMoveAction(); + if (Configs.Generic.RATE_LIMIT_CLICK_PACKETS.getBooleanValue()) + { + ClickPacketBuffer.setShouldBufferClickPackets(true); + } + if (InputUtils.isActionKeyActive(action)) { - return InventoryUtils.dragMoveItems(gui, mc, action, mouseX, mouseY, false); + cancel = InventoryUtils.dragMoveItems(gui, mc, action, mouseX, mouseY, false); } else if (action != MoveAction.NONE) { InventoryUtils.stopDragging(); } - return false; + ClickPacketBuffer.setShouldBufferClickPackets(false); + + return cancel; } } diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 8fc715497..7c06c323b 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -15,6 +15,7 @@ import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; import fi.dy.masa.itemscroller.util.AccessorUtils; +import fi.dy.masa.itemscroller.util.ClickPacketBuffer; import fi.dy.masa.itemscroller.util.InputUtils; import fi.dy.masa.itemscroller.util.InventoryUtils; import fi.dy.masa.itemscroller.util.MoveAction; @@ -56,6 +57,20 @@ public boolean functionalityEnabled() @Override public boolean onKeyAction(KeyAction action, IKeybind key) + { + if (Configs.Generic.RATE_LIMIT_CLICK_PACKETS.getBooleanValue()) + { + ClickPacketBuffer.setShouldBufferClickPackets(true); + } + + boolean cancel = this.onKeyActionImpl(action, key); + + ClickPacketBuffer.setShouldBufferClickPackets(false); + + return cancel; + } + + private boolean onKeyActionImpl(KeyAction action, IKeybind key) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -167,10 +182,19 @@ else if (key == Hotkeys.KEY_SLOT_DEBUG.getKeybind()) @Override public void onClientTick(MinecraftClient mc) { - if (this.disabled == false && - mc != null && - mc.player != null && - GuiUtils.getCurrentScreen() instanceof HandledScreen && + if (this.disabled || mc.player == null) + { + return; + } + + ClickPacketBuffer.sendBufferedPackets(Configs.Generic.PACKET_RATE_LIMIT.getIntegerValue()); + + if (ClickPacketBuffer.shouldCancelWindowClicks()) + { + return; + } + + if (GuiUtils.getCurrentScreen() instanceof HandledScreen && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false && Hotkeys.KEY_MASS_CRAFT.getKeybind().isKeybindHeld()) @@ -181,6 +205,11 @@ public void onClientTick(MinecraftClient mc) if (outputSlot != null) { + if (Configs.Generic.RATE_LIMIT_CLICK_PACKETS.getBooleanValue()) + { + ClickPacketBuffer.setShouldBufferClickPackets(true); + } + RecipePattern recipe = RecipeStorage.getInstance().getSelectedRecipe(); InventoryUtils.tryClearCursor(gui, mc); @@ -205,6 +234,8 @@ public void onClientTick(MinecraftClient mc) InventoryUtils.throwAllNonRecipeItemsToGround(recipe, gui); InventoryUtils.tryMoveItemsToFirstCraftingGrid(recipe, gui, true); } + + ClickPacketBuffer.setShouldBufferClickPackets(false); } } } diff --git a/src/main/java/fi/dy/masa/itemscroller/event/WorldLoadListener.java b/src/main/java/fi/dy/masa/itemscroller/event/WorldLoadListener.java index 8db7f1254..3b8d5a59b 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/WorldLoadListener.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/WorldLoadListener.java @@ -1,11 +1,12 @@ package fi.dy.masa.itemscroller.event; import javax.annotation.Nullable; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.world.ClientWorld; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.recipes.RecipeStorage; +import fi.dy.masa.itemscroller.util.ClickPacketBuffer; import fi.dy.masa.malilib.interfaces.IWorldLoadListener; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.world.ClientWorld; public class WorldLoadListener implements IWorldLoadListener { @@ -27,6 +28,12 @@ public void onWorldLoadPost(@Nullable ClientWorld worldBefore, @Nullable ClientW { this.readStoredData(); } + + // Logging out + if (worldAfter == null) + { + ClickPacketBuffer.reset(); + } } private void writeData() diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java new file mode 100644 index 000000000..2cd90b395 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java @@ -0,0 +1,39 @@ +package fi.dy.masa.itemscroller.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import net.minecraft.client.network.ClientPlayNetworkHandler; +import net.minecraft.client.network.ClientPlayerInteractionManager; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import fi.dy.masa.itemscroller.util.ClickPacketBuffer; + +@Mixin(ClientPlayerInteractionManager.class) +public class MixinClientPlayerInteractionManager +{ + @Inject(method = "clickSlot", at = @At("HEAD"), cancellable = true) + private void cancelWindowClicksWhileReplayingBufferedPackets(CallbackInfoReturnable cir) + { + if (ClickPacketBuffer.shouldCancelWindowClicks()) + { + // The return value isn't actually used for anything on the client side + cir.setReturnValue(ItemStack.EMPTY); + } + } + + @Redirect(method = "clickSlot", at = @At(value = "INVOKE", + target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V")) + private void bufferClickPacketsAndCancel(ClientPlayNetworkHandler netHandler, Packet packet) + { + if (ClickPacketBuffer.shouldBufferClickPackets()) + { + ClickPacketBuffer.bufferPacket(packet); + return; + } + + netHandler.sendPacket(packet); + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java b/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java new file mode 100644 index 000000000..da5038935 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java @@ -0,0 +1,54 @@ +package fi.dy.masa.itemscroller.util; + +import java.util.ArrayList; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.network.ClientPlayerEntity; +import net.minecraft.network.Packet; + +public class ClickPacketBuffer +{ + private static final ArrayList> BUFFER = new ArrayList<>(); + private static boolean shouldBufferPackets; + + public static void reset() + { + shouldBufferPackets = false; + BUFFER.clear(); + } + + public static boolean shouldBufferClickPackets() + { + return shouldBufferPackets; + } + + public static boolean shouldCancelWindowClicks() + { + // Don't cancel the clicks on the client if we have some Item Scroller actions in progress + return shouldBufferPackets == false && BUFFER.isEmpty() == false; + } + + public static void setShouldBufferClickPackets(boolean shouldBuffer) + { + shouldBufferPackets = shouldBuffer; + } + + public static void bufferPacket(Packet packet) + { + BUFFER.add(packet); + } + + public static void sendBufferedPackets(int maxCount) + { + ClientPlayerEntity player = MinecraftClient.getInstance().player; + + if (player != null && BUFFER.isEmpty() == false) + { + maxCount = Math.min(maxCount, BUFFER.size()); + + for (int i = 0; i < maxCount; ++i) + { + player.networkHandler.sendPacket(BUFFER.remove(0)); + } + } + } +} diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 98aecaf28..96c2fc6b6 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -8,6 +8,7 @@ "IMixinScreenWithHandler", "IMixinSlot", "MixinAbstractInventoryScreen", + "MixinClientPlayerInteractionManager", "MixinCraftingScreenHandler", "MixinGameRenderer", "MixinScreen" @@ -15,4 +16,4 @@ "injectors": { "defaultRequire": 1 } -} \ No newline at end of file +} From 4398dea178b6b28f84571d8837d150b804db3b39 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 14 May 2020 01:22:05 +0300 Subject: [PATCH 051/107] Show the number of buffered click packets --- .../itemscroller/event/RenderEventHandler.java | 18 ++++++++++++++++-- .../itemscroller/mixin/MixinGameRenderer.java | 6 +++++- .../itemscroller/util/ClickPacketBuffer.java | 5 +++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index b0209fcac..3834d19fe 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -16,6 +16,7 @@ import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; import fi.dy.masa.itemscroller.util.AccessorUtils; +import fi.dy.masa.itemscroller.util.ClickPacketBuffer; import fi.dy.masa.itemscroller.util.InputUtils; import fi.dy.masa.itemscroller.util.InventoryUtils; import fi.dy.masa.malilib.render.InventoryOverlay; @@ -91,11 +92,24 @@ public void onDrawBackgroundPost(MatrixStack matrixStack) } } - public void onDrawScreenPost() + public void onDrawScreenPost(MinecraftClient mc) { - if (GuiUtils.getCurrentScreen() instanceof HandledScreen && InputUtils.isRecipeViewOpen()) + if (GuiUtils.getCurrentScreen() instanceof HandledScreen) { HandledScreen gui = (HandledScreen) this.mc.currentScreen; + + int bufferedCount = ClickPacketBuffer.getBufferedActionsCount(); + + if (bufferedCount > 0) + { + mc.textRenderer.draw(FRESH_MATRIX_STACK, "Buffered slot clicks: " + bufferedCount, 10, 10, 0xFFD0D0D0); + } + + if (InputUtils.isRecipeViewOpen() == false) + { + return; + } + RecipeStorage recipes = RecipeStorage.getInstance(); final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java index e8a0c823c..c539cf250 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java @@ -1,6 +1,8 @@ package fi.dy.masa.itemscroller.mixin; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; @@ -10,11 +12,13 @@ @Mixin(net.minecraft.client.render.GameRenderer.class) public abstract class MixinGameRenderer { + @Shadow @Final private net.minecraft.client.MinecraftClient client; + @Inject(method = "render(FJZ)V", at = @At(value = "INVOKE", shift = Shift.AFTER, target = "Lnet/minecraft/client/gui/screen/Screen;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V")) private void onDrawScreenPost(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo ci) { - RenderEventHandler.instance().onDrawScreenPost(); + RenderEventHandler.instance().onDrawScreenPost(this.client); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java b/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java index da5038935..3fa989159 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java @@ -16,6 +16,11 @@ public static void reset() BUFFER.clear(); } + public static int getBufferedActionsCount() + { + return BUFFER.size(); + } + public static boolean shouldBufferClickPackets() { return shouldBufferPackets; From 16c41cd6edb7843fed6c075e9b64516414e67bdc Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Mon, 8 Jun 2020 22:36:33 +0300 Subject: [PATCH 052/107] Update to MC 1.16-pre2 --- build.properties | 10 +++++----- .../dy/masa/itemscroller/event/RenderEventHandler.java | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.properties b/build.properties index 190fcd95b..696e59a44 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-snap-20w22a -minecraft_version = 20w22a -mappings_version = 20w22a+build.1 +minecraft_version_out = 1.16-pre2 +minecraft_version = 1.16-pre2 +mappings_version = 1.16-pre2+build.26 -fabric_loader_version = 0.8.4+build.198 -mod_menu_version = 1.11.7+build.12 +fabric_loader_version = 0.8.7+build.201 +mod_menu_version = 1.11.8+build.13 diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index b0209fcac..832efdd45 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -299,7 +299,7 @@ private void renderStackAt(ItemStack stack, int x, int y, boolean border) stack = stack.copy(); InventoryUtils.setStackSize(stack, 1); this.mc.getItemRenderer().zOffset += 100; - this.mc.getItemRenderer().renderGuiItem(stack, x, y); + this.mc.getItemRenderer().renderInGui(stack, x, y); this.mc.getItemRenderer().zOffset -= 100; } From dd151fffba500d42a8c86a9e5e77b6e53f4ff941 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 10 Jun 2020 22:04:32 +0300 Subject: [PATCH 053/107] Update to MC 1.16-pre3 --- build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.properties b/build.properties index 696e59a44..43adfbf6a 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-pre2 -minecraft_version = 1.16-pre2 -mappings_version = 1.16-pre2+build.26 +minecraft_version_out = 1.16-pre3 +minecraft_version = 1.16-pre3 +mappings_version = 1.16-pre3+build.1 fabric_loader_version = 0.8.7+build.201 mod_menu_version = 1.11.8+build.13 From 38059b3f91fbf8059370064dad1cbdaee801d6ec Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 24 Jun 2020 02:38:49 +0300 Subject: [PATCH 054/107] Update to MC 1.16.0 --- build.gradle | 2 +- build.properties | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index cedda45bd..acaf81a62 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } } dependencies { - classpath 'net.fabricmc:fabric-loom:0.2.7-SNAPSHOT' + classpath 'net.fabricmc:fabric-loom:0.4-SNAPSHOT' } } diff --git a/build.properties b/build.properties index 43adfbf6a..f9b3022dd 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16-pre3 -minecraft_version = 1.16-pre3 -mappings_version = 1.16-pre3+build.1 +minecraft_version_out = 1.16.0 +minecraft_version = 1.16 +mappings_version = 1.16+build.1 -fabric_loader_version = 0.8.7+build.201 -mod_menu_version = 1.11.8+build.13 +fabric_loader_version = 0.8.8+build.202 +mod_menu_version = 1.12.2+build.16 From 53773bce58d0fe447486667f79061afb64e36bc7 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 30 Jun 2020 02:30:32 +0300 Subject: [PATCH 055/107] Update to MC 1.16.1 (just a version bump) --- build.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index f9b3022dd..67415b56d 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.21+beta.1 +malilib_version = 0.10.0-dev.21+arne.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16.0 -minecraft_version = 1.16 -mappings_version = 1.16+build.1 +minecraft_version_out = 1.16.1 +minecraft_version = 1.16.1 +mappings_version = 1.16.1+build.18 fabric_loader_version = 0.8.8+build.202 -mod_menu_version = 1.12.2+build.16 +mod_menu_version = 1.12.2+build.17 From 3914c22fd1a01bc751d637d5fe1e8bc315c51e8d Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 12 Aug 2020 02:48:11 +0300 Subject: [PATCH 056/107] Update to MC 1.16.2 --- build.properties | 10 +++++----- .../itemscroller/compat/modmenu/ModMenuImpl.java | 12 ++---------- .../fi/dy/masa/itemscroller/util/InventoryUtils.java | 4 ++-- src/main/resources/fabric.mod.json | 4 ---- 4 files changed, 9 insertions(+), 21 deletions(-) diff --git a/build.properties b/build.properties index 67415b56d..7512d3429 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+arne.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16.1 -minecraft_version = 1.16.1 -mappings_version = 1.16.1+build.18 +minecraft_version_out = 1.16.2 +minecraft_version = 1.16.2 +mappings_version = 1.16.2+build.1 -fabric_loader_version = 0.8.8+build.202 -mod_menu_version = 1.12.2+build.17 +fabric_loader_version = 0.9.1+build.205 +mod_menu_version = 1.14.6+build.31 diff --git a/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java index 7f858dbfb..de58e4030 100644 --- a/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java +++ b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java @@ -1,21 +1,13 @@ package fi.dy.masa.itemscroller.compat.modmenu; -import java.util.function.Function; -import net.minecraft.client.gui.screen.Screen; -import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.gui.GuiConfigs; +import io.github.prospector.modmenu.api.ConfigScreenFactory; import io.github.prospector.modmenu.api.ModMenuApi; public class ModMenuImpl implements ModMenuApi { @Override - public String getModId() - { - return Reference.MOD_ID; - } - - @Override - public Function getConfigScreenFactory() + public ConfigScreenFactory getModConfigScreenFactory() { return (screen) -> { GuiConfigs gui = new GuiConfigs(); diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index b4c70b17d..001b76b5c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -243,7 +243,7 @@ else if (keyActiveMoveStacks) tryMoveSingleItemToOtherInventory(slot, gui); } // Scrolling items from the other inventory into this slot/inventory - else if (getStackSize(stack) < slot.getMaxStackAmount(stack)) + else if (getStackSize(stack) < slot.getMaxItemCount(stack)) { tryMoveSingleItemToThisInventory(slot, gui); } @@ -2196,7 +2196,7 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Sc ItemStack stackTmp = slotTmp.getStack(); if ((isStackEmpty(stackTmp) && slotTmp.canInsert(stackSlot)) || - (areStacksEqual(stackTmp, stackSlot)) && slotTmp.getMaxStackAmount(stackTmp) > getStackSize(stackTmp)) + (areStacksEqual(stackTmp, stackSlot)) && slotTmp.getMaxItemCount(stackTmp) > getStackSize(stackTmp)) { slotNumbers.add(slotTmp.id); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f6b3614c6..d045c0a49 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,9 +34,5 @@ "depends": { "malilib": ">=0.10.0-dev.21" - }, - - "custom": { - "modmenu:clientsideOnly": true } } From a10fc6d81eebe0405024ce273b896b0f4f290497 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Mon, 24 Aug 2020 20:53:49 +0300 Subject: [PATCH 057/107] Fix a crash with the main toggle key while not in a world --- .../fi/dy/masa/itemscroller/event/KeybindCallbacks.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 136c21276..e96bbb4fa 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -59,6 +59,11 @@ public boolean onKeyAction(KeyAction action, IKeybind key) { MinecraftClient mc = MinecraftClient.getInstance(); + if (mc.player == null || mc.world == null) + { + return false; + } + if (key == Hotkeys.KEY_MAIN_TOGGLE.getKeybind()) { this.disabled = ! this.disabled; @@ -80,7 +85,7 @@ else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) return true; } - if (this.disabled || mc == null || mc.player == null || (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false) + if (this.disabled || (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false) { return false; } From 10f7f7ac0882bfa02cb3a9796bd82637217cd689 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sat, 12 Sep 2020 22:17:13 +0300 Subject: [PATCH 058/107] Update to MC 1.16.3 (just a version bump) --- build.gradle | 6 +++--- build.properties | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index acaf81a62..8dfc2b597 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { } } dependencies { - classpath 'net.fabricmc:fabric-loom:0.4-SNAPSHOT' + classpath 'net.fabricmc:fabric-loom:0.5-SNAPSHOT' } } @@ -41,14 +41,14 @@ dependencies { minecraft "com.mojang:minecraft:${config.minecraft_version}" mappings "net.fabricmc:yarn:${config.mappings_version}:v2" modCompile "net.fabricmc:fabric-loader:${config.fabric_loader_version}" - compile "com.google.code.findbugs:jsr305:3.0.2" + compile "com.google.code.findbugs:jsr305:3+" modCompile "fi.dy.masa.malilib:malilib-fabric-${config.minecraft_version_out}:${config.malilib_version}" // Fabric API. This is technically optional, but you probably want it anyway. //modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version - modCompile "io.github.prospector:modmenu:" + config.mod_menu_version + modCompileOnly "io.github.prospector:modmenu:" + config.mod_menu_version } minecraft { diff --git a/build.properties b/build.properties index 7512d3429..8979e850a 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+arne.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16.2 -minecraft_version = 1.16.2 -mappings_version = 1.16.2+build.1 +minecraft_version_out = 1.16.3 +minecraft_version = 1.16.3 +mappings_version = 1.16.3+build.5 -fabric_loader_version = 0.9.1+build.205 +fabric_loader_version = 0.9.3+build.207 mod_menu_version = 1.14.6+build.31 From c0e34463111c6df19e9ada5a0e1e8c0462077f40 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 3 Nov 2020 18:27:11 +0200 Subject: [PATCH 059/107] Update to MC 1.16.4 (version bump plus one mapping change) --- build.properties | 8 ++++---- .../java/fi/dy/masa/itemscroller/util/InventoryUtils.java | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/build.properties b/build.properties index 8979e850a..1c199e177 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+arne.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16.3 -minecraft_version = 1.16.3 -mappings_version = 1.16.3+build.5 +minecraft_version_out = 1.16.4 +minecraft_version = 1.16.4 +mappings_version = 1.16.4+build.1 -fabric_loader_version = 0.9.3+build.207 +fabric_loader_version = 0.10.6+build.214 mod_menu_version = 1.14.6+build.31 diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 001b76b5c..e9808b91e 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -33,7 +33,7 @@ import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; import net.minecraft.village.TradeOffer; -import net.minecraft.village.TraderOfferList; +import net.minecraft.village.TradeOfferList; import net.minecraft.world.GameRules; import net.minecraft.world.World; import fi.dy.masa.itemscroller.ItemScroller; @@ -64,7 +64,7 @@ public static void onSlotChangedCraftingGrid(PlayerEntity player, world.isClient && (world instanceof ClientWorld) && player instanceof ClientPlayerEntity) { ItemStack stack = ItemStack.EMPTY; - Optional optional = ((ClientWorld) world).getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftMatrix, world); + Optional optional = world.getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftMatrix, world); if (optional.isPresent()) { @@ -917,7 +917,7 @@ private static void tryMoveStacks(ItemStack stackReference, Slot slot, HandledSc private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, boolean fillStacks) { - TraderOfferList list = gui.getScreenHandler().getRecipes(); + TradeOfferList list = gui.getScreenHandler().getRecipes(); int index = AccessorUtils.getSelectedMerchantRecipe(gui); if (list == null || list.size() <= index) From e28b50fa7732f12c04989c32384ac6ba9aa448b3 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 6 Nov 2020 00:07:10 +0200 Subject: [PATCH 060/107] Update to MC 1.17 snapshot 20w45a --- build.properties | 8 +- .../compat/modmenu/ModMenuImpl.java | 3 + .../dy/masa/itemscroller/util/InputUtils.java | 2 +- .../itemscroller/util/InventoryUtils.java | 82 +++++++++---------- 4 files changed, 49 insertions(+), 46 deletions(-) diff --git a/build.properties b/build.properties index 1c199e177..66737f107 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.21+arne.1 +malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.16.4 -minecraft_version = 1.16.4 -mappings_version = 1.16.4+build.1 +minecraft_version_out = 1.17-snap-20w45a +minecraft_version = 20w45a +mappings_version = 20w45a+build.7 fabric_loader_version = 0.10.6+build.214 mod_menu_version = 1.14.6+build.31 diff --git a/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java index de58e4030..386961532 100644 --- a/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java +++ b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java @@ -1,5 +1,7 @@ package fi.dy.masa.itemscroller.compat.modmenu; +public class ModMenuImpl{}/* + import fi.dy.masa.itemscroller.gui.GuiConfigs; import io.github.prospector.modmenu.api.ConfigScreenFactory; import io.github.prospector.modmenu.api.ModMenuApi; @@ -16,3 +18,4 @@ public ConfigScreenFactory getModConfigScreenFactory() }; } } +*/ diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index a98f09efc..3dcdf24a1 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -21,7 +21,7 @@ public static boolean isRecipeViewOpen() public static boolean canShiftDropItems(HandledScreen gui, MinecraftClient mc, int mouseX, int mouseY) { - if (InventoryUtils.isStackEmpty(mc.player.inventory.getCursorStack()) == false) + if (InventoryUtils.isStackEmpty(mc.player.method_31548().getCursorStack()) == false) { int left = AccessorUtils.getGuiLeft(gui); int top = AccessorUtils.getGuiTop(gui); diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index e9808b91e..ce5efff98 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -153,7 +153,7 @@ public static boolean canShiftPlaceItems(HandledScreen { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stackCursor = mc.player.inventory.getCursorStack(); + ItemStack stackCursor = mc.player.method_31548().getCursorStack(); // The target slot needs to be an empty, valid slot, and there needs to be items in the cursor return slot != null && isStackEmpty(stackCursor) == false && isValidSlot(slot, gui, false) && @@ -166,7 +166,7 @@ public static boolean tryMoveItems(HandledScreen gui, R MinecraftClient mc = MinecraftClient.getInstance(); // We require an empty cursor - if (slot == null || isStackEmpty(mc.player.inventory.getCursorStack()) == false) + if (slot == null || isStackEmpty(mc.player.method_31548().getCursorStack()) == false) { return false; } @@ -254,7 +254,7 @@ else if (getStackSize(stack) < slot.getMaxItemCount(stack)) public static boolean dragMoveItems(HandledScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { - if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) + if (isStackEmpty(mc.player.method_31548().getCursorStack()) == false) { // Updating these here is part of the fix to preventing a drag after shift + place lastPosX = mouseX; @@ -542,7 +542,7 @@ public static void dropStacks(HandledScreen gui, ItemSt public static boolean shiftDropItems(HandledScreen gui) { - ItemStack stackReference = MinecraftClient.getInstance().player.inventory.getCursorStack(); + ItemStack stackReference = MinecraftClient.getInstance().player.method_31548().getCursorStack(); if (isStackEmpty(stackReference) == false && sourceSlot != null) { @@ -581,7 +581,7 @@ public static void storeSourceSlotCandidate(Slot slot, MinecraftClient mc) // Left or right mouse button was pressed if (slot != null) { - ItemStack stackCursor = mc.player.inventory.getCursorStack(); + ItemStack stackCursor = mc.player.method_31548().getCursorStack(); ItemStack stack = EMPTY_STACK; if (isStackEmpty(stackCursor) == false) @@ -603,7 +603,7 @@ public static void storeSourceSlotCandidate(Slot slot, MinecraftClient mc) */ public static void checkForItemPickup(MinecraftClient mc) { - ItemStack stackCursor = mc.player.inventory.getCursorStack(); + ItemStack stackCursor = mc.player.method_31548().getCursorStack(); // Picked up or swapped items to the cursor, grab a reference to the slot that the items came from // Note that we are only checking the item here! @@ -656,7 +656,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, HandledScree ScreenHandler container = gui.getScreenHandler(); MinecraftClient mc = MinecraftClient.getInstance(); - if (isStackEmpty(mc.player.inventory.getCursorStack()) == false || slot.canTakeItems(mc.player) == false || + if (isStackEmpty(mc.player.method_31548().getCursorStack()) == false || slot.canTakeItems(mc.player) == false || (getStackSize(stackOrig) > 1 && slot.canInsert(stackOrig) == false)) { return false; @@ -717,7 +717,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc // Take half of the items from the original slot to the cursor rightClickSlot(gui, slot.id); - ItemStack stackInCursor = player.inventory.getCursorStack(); + ItemStack stackInCursor = player.method_31548().getCursorStack(); if (isStackEmpty(stackInCursor)) { return false; @@ -741,7 +741,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc // Try to put one item into the temporary slot rightClickSlot(gui, slotTmp.id); - stackInCursor = player.inventory.getCursorStack(); + stackInCursor = player.method_31548().getCursorStack(); // Successfully stored one item if (isStackEmpty(stackInCursor) || getStackSize(stackInCursor) < stackInCursorSizeOrig) @@ -753,7 +753,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc } } - if (isStackEmpty(player.inventory.getCursorStack()) == false) + if (isStackEmpty(player.method_31548().getCursorStack()) == false) { // Return the rest of the items into the original slot leftClickSlot(gui, slot.id); @@ -772,7 +772,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc rightClickSlot(gui, slot.id); // Return the rest of the items to the temporary slot, if any - if (isStackEmpty(player.inventory.getCursorStack()) == false) + if (isStackEmpty(player.method_31548().getCursorStack()) == false) { leftClickSlot(gui, tempSlotNum); } @@ -802,7 +802,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc for (int slotNum : slots) { Slot slotTmp = gui.getScreenHandler().getSlot(slotNum); - stackInCursor = player.inventory.getCursorStack(); + stackInCursor = player.method_31548().getCursorStack(); if (isStackEmpty(stackInCursor)) { @@ -962,7 +962,7 @@ private static void fillBuySlot(HandledScreen gui, int if (isStackEmpty(existingStack) || areStacksEqual(buyStack, existingStack)) { - moveItemsFromInventory(gui, slotNum, mc.player.inventory, buyStack, fillStacks); + moveItemsFromInventory(gui, slotNum, mc.player.method_31548(), buyStack, fillStacks); } } @@ -1272,14 +1272,14 @@ private static void fillCraftingGrid(HandledScreen gui, // Pick up the ingredient stack from the found slot leftClickSlot(gui, slotNum); - ItemStack stackCursor = player.inventory.getCursorStack(); + ItemStack stackCursor = player.method_31548().getCursorStack(); // Successfully picked up ingredient items if (areStacksEqual(ingredientReference, stackCursor)) { sizeOrig = getStackSize(stackCursor); dragSplitItemsIntoSlots(gui, targetSlots); - stackCursor = player.inventory.getCursorStack(); + stackCursor = player.method_31548().getCursorStack(); // Items left in cursor if (isStackEmpty(stackCursor) == false) @@ -1294,7 +1294,7 @@ private static void fillCraftingGrid(HandledScreen gui, leftClickSlot(gui, slotReturn); // All of them didn't fit into the first slot anymore, switch into the current source slot - if (isStackEmpty(player.inventory.getCursorStack()) == false) + if (isStackEmpty(player.method_31548().getCursorStack()) == false) { slotReturn = slotNum; leftClickSlot(gui, slotReturn); @@ -1309,14 +1309,14 @@ private static void fillCraftingGrid(HandledScreen gui, } // Somehow items were left in the cursor, break here - if (isStackEmpty(player.inventory.getCursorStack()) == false) + if (isStackEmpty(player.method_31548().getCursorStack()) == false) { break; } } // Return the rest of the items to the original slot - if (slotNum >= 0 && isStackEmpty(player.inventory.getCursorStack()) == false) + if (slotNum >= 0 && isStackEmpty(player.method_31548().getCursorStack()) == false) { leftClickSlot(gui, slotNum); } @@ -1326,7 +1326,7 @@ public static void rightClickCraftOneStack(HandledScreen gui, List targetSlots, int startIndex) { MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stackInCursor = mc.player.inventory.getCursorStack(); + ItemStack stackInCursor = mc.player.method_31548().getCursorStack(); if (isStackEmpty(stackInCursor)) { @@ -1458,7 +1458,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(HandledScreen= 0 && isStackEmpty(mc.player.inventory.getCursorStack()) == false) + if (slotNum >= 0 && isStackEmpty(mc.player.method_31548().getCursorStack()) == false) { leftClickSlot(gui, slotNum); } @@ -1522,7 +1522,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(HandledScreen gui, List slotNumbers) { MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.inventory; + PlayerInventory inv = mc.player.method_31548(); for (int slotNum : slotNumbers) { @@ -1852,7 +1852,7 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, HandledScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) { MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.inventory; + PlayerInventory inv = mc.player.method_31548(); Slot lastSlot = null; // Empty slot, nothing to do @@ -2147,7 +2147,7 @@ private static Slot moveStackToSlots(HandledScreen gui, private static void moveOneItemToFirstValidSlot(HandledScreen gui, Slot slotFrom, List slotsTo) { MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.inventory; + PlayerInventory inv = mc.player.method_31548(); // Pick up half of the the stack rightClickSlot(gui, slotFrom.id); @@ -2211,7 +2211,7 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Sc public static void tryClearCursor(HandledScreen gui, MinecraftClient mc) { - ItemStack stackCursor = mc.player.inventory.getCursorStack(); + ItemStack stackCursor = mc.player.method_31548().getCursorStack(); if (isStackEmpty(stackCursor) == false) { @@ -2239,13 +2239,13 @@ public static void tryClearCursor(HandledScreen gui, Mi } leftClickSlot(gui, slotNum); - stackCursor = mc.player.inventory.getCursorStack(); + stackCursor = mc.player.method_31548().getCursorStack(); } } } } - if (isStackEmpty(mc.player.inventory.getCursorStack()) == false) + if (isStackEmpty(mc.player.method_31548().getCursorStack()) == false) { dropItemsFromCursor(gui); } @@ -2400,7 +2400,7 @@ public static void swapSlots(HandledScreen gui, int slo private static void dragSplitItemsIntoSlots(HandledScreen gui, List targetSlots) { MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stackInCursor = mc.player.inventory.getCursorStack(); + ItemStack stackInCursor = mc.player.method_31548().getCursorStack(); if (isStackEmpty(stackInCursor)) { From 2b52d13f9a2e5ed4bcf8fbdcbae544d824f79dc2 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 10 Nov 2020 15:13:20 +0200 Subject: [PATCH 061/107] Restore Mod Menu support, update mappings --- build.properties | 6 +- .../compat/modmenu/ModMenuImpl.java | 3 - .../dy/masa/itemscroller/util/InputUtils.java | 2 +- .../itemscroller/util/InventoryUtils.java | 82 +++++++++---------- 4 files changed, 45 insertions(+), 48 deletions(-) diff --git a/build.properties b/build.properties index 66737f107..f5ac7fe56 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.21+beta.1 +malilib_version = 0.10.0-dev.21+beta.2 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.17-snap-20w45a minecraft_version = 20w45a -mappings_version = 20w45a+build.7 +mappings_version = 20w45a+build.31 fabric_loader_version = 0.10.6+build.214 -mod_menu_version = 1.14.6+build.31 +mod_menu_version = 1.15.0+build.1 diff --git a/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java index 386961532..de58e4030 100644 --- a/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java +++ b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java @@ -1,7 +1,5 @@ package fi.dy.masa.itemscroller.compat.modmenu; -public class ModMenuImpl{}/* - import fi.dy.masa.itemscroller.gui.GuiConfigs; import io.github.prospector.modmenu.api.ConfigScreenFactory; import io.github.prospector.modmenu.api.ModMenuApi; @@ -18,4 +16,3 @@ public ConfigScreenFactory getModConfigScreenFactory() }; } } -*/ diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index 3dcdf24a1..d6085d702 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -21,7 +21,7 @@ public static boolean isRecipeViewOpen() public static boolean canShiftDropItems(HandledScreen gui, MinecraftClient mc, int mouseX, int mouseY) { - if (InventoryUtils.isStackEmpty(mc.player.method_31548().getCursorStack()) == false) + if (InventoryUtils.isStackEmpty(mc.player.getInventory().getCursorStack()) == false) { int left = AccessorUtils.getGuiLeft(gui); int top = AccessorUtils.getGuiTop(gui); diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index ce5efff98..08b969728 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -153,7 +153,7 @@ public static boolean canShiftPlaceItems(HandledScreen { Slot slot = AccessorUtils.getSlotUnderMouse(gui); MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stackCursor = mc.player.method_31548().getCursorStack(); + ItemStack stackCursor = mc.player.getInventory().getCursorStack(); // The target slot needs to be an empty, valid slot, and there needs to be items in the cursor return slot != null && isStackEmpty(stackCursor) == false && isValidSlot(slot, gui, false) && @@ -166,7 +166,7 @@ public static boolean tryMoveItems(HandledScreen gui, R MinecraftClient mc = MinecraftClient.getInstance(); // We require an empty cursor - if (slot == null || isStackEmpty(mc.player.method_31548().getCursorStack()) == false) + if (slot == null || isStackEmpty(mc.player.getInventory().getCursorStack()) == false) { return false; } @@ -254,7 +254,7 @@ else if (getStackSize(stack) < slot.getMaxItemCount(stack)) public static boolean dragMoveItems(HandledScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { - if (isStackEmpty(mc.player.method_31548().getCursorStack()) == false) + if (isStackEmpty(mc.player.getInventory().getCursorStack()) == false) { // Updating these here is part of the fix to preventing a drag after shift + place lastPosX = mouseX; @@ -542,7 +542,7 @@ public static void dropStacks(HandledScreen gui, ItemSt public static boolean shiftDropItems(HandledScreen gui) { - ItemStack stackReference = MinecraftClient.getInstance().player.method_31548().getCursorStack(); + ItemStack stackReference = MinecraftClient.getInstance().player.getInventory().getCursorStack(); if (isStackEmpty(stackReference) == false && sourceSlot != null) { @@ -581,7 +581,7 @@ public static void storeSourceSlotCandidate(Slot slot, MinecraftClient mc) // Left or right mouse button was pressed if (slot != null) { - ItemStack stackCursor = mc.player.method_31548().getCursorStack(); + ItemStack stackCursor = mc.player.getInventory().getCursorStack(); ItemStack stack = EMPTY_STACK; if (isStackEmpty(stackCursor) == false) @@ -603,7 +603,7 @@ public static void storeSourceSlotCandidate(Slot slot, MinecraftClient mc) */ public static void checkForItemPickup(MinecraftClient mc) { - ItemStack stackCursor = mc.player.method_31548().getCursorStack(); + ItemStack stackCursor = mc.player.getInventory().getCursorStack(); // Picked up or swapped items to the cursor, grab a reference to the slot that the items came from // Note that we are only checking the item here! @@ -656,7 +656,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, HandledScree ScreenHandler container = gui.getScreenHandler(); MinecraftClient mc = MinecraftClient.getInstance(); - if (isStackEmpty(mc.player.method_31548().getCursorStack()) == false || slot.canTakeItems(mc.player) == false || + if (isStackEmpty(mc.player.getInventory().getCursorStack()) == false || slot.canTakeItems(mc.player) == false || (getStackSize(stackOrig) > 1 && slot.canInsert(stackOrig) == false)) { return false; @@ -717,7 +717,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc // Take half of the items from the original slot to the cursor rightClickSlot(gui, slot.id); - ItemStack stackInCursor = player.method_31548().getCursorStack(); + ItemStack stackInCursor = player.getInventory().getCursorStack(); if (isStackEmpty(stackInCursor)) { return false; @@ -741,7 +741,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc // Try to put one item into the temporary slot rightClickSlot(gui, slotTmp.id); - stackInCursor = player.method_31548().getCursorStack(); + stackInCursor = player.getInventory().getCursorStack(); // Successfully stored one item if (isStackEmpty(stackInCursor) || getStackSize(stackInCursor) < stackInCursorSizeOrig) @@ -753,7 +753,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc } } - if (isStackEmpty(player.method_31548().getCursorStack()) == false) + if (isStackEmpty(player.getInventory().getCursorStack()) == false) { // Return the rest of the items into the original slot leftClickSlot(gui, slot.id); @@ -772,7 +772,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc rightClickSlot(gui, slot.id); // Return the rest of the items to the temporary slot, if any - if (isStackEmpty(player.method_31548().getCursorStack()) == false) + if (isStackEmpty(player.getInventory().getCursorStack()) == false) { leftClickSlot(gui, tempSlotNum); } @@ -802,7 +802,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc for (int slotNum : slots) { Slot slotTmp = gui.getScreenHandler().getSlot(slotNum); - stackInCursor = player.method_31548().getCursorStack(); + stackInCursor = player.getInventory().getCursorStack(); if (isStackEmpty(stackInCursor)) { @@ -962,7 +962,7 @@ private static void fillBuySlot(HandledScreen gui, int if (isStackEmpty(existingStack) || areStacksEqual(buyStack, existingStack)) { - moveItemsFromInventory(gui, slotNum, mc.player.method_31548(), buyStack, fillStacks); + moveItemsFromInventory(gui, slotNum, mc.player.getInventory(), buyStack, fillStacks); } } @@ -1272,14 +1272,14 @@ private static void fillCraftingGrid(HandledScreen gui, // Pick up the ingredient stack from the found slot leftClickSlot(gui, slotNum); - ItemStack stackCursor = player.method_31548().getCursorStack(); + ItemStack stackCursor = player.getInventory().getCursorStack(); // Successfully picked up ingredient items if (areStacksEqual(ingredientReference, stackCursor)) { sizeOrig = getStackSize(stackCursor); dragSplitItemsIntoSlots(gui, targetSlots); - stackCursor = player.method_31548().getCursorStack(); + stackCursor = player.getInventory().getCursorStack(); // Items left in cursor if (isStackEmpty(stackCursor) == false) @@ -1294,7 +1294,7 @@ private static void fillCraftingGrid(HandledScreen gui, leftClickSlot(gui, slotReturn); // All of them didn't fit into the first slot anymore, switch into the current source slot - if (isStackEmpty(player.method_31548().getCursorStack()) == false) + if (isStackEmpty(player.getInventory().getCursorStack()) == false) { slotReturn = slotNum; leftClickSlot(gui, slotReturn); @@ -1309,14 +1309,14 @@ private static void fillCraftingGrid(HandledScreen gui, } // Somehow items were left in the cursor, break here - if (isStackEmpty(player.method_31548().getCursorStack()) == false) + if (isStackEmpty(player.getInventory().getCursorStack()) == false) { break; } } // Return the rest of the items to the original slot - if (slotNum >= 0 && isStackEmpty(player.method_31548().getCursorStack()) == false) + if (slotNum >= 0 && isStackEmpty(player.getInventory().getCursorStack()) == false) { leftClickSlot(gui, slotNum); } @@ -1326,7 +1326,7 @@ public static void rightClickCraftOneStack(HandledScreen gui, List targetSlots, int startIndex) { MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stackInCursor = mc.player.method_31548().getCursorStack(); + ItemStack stackInCursor = mc.player.getInventory().getCursorStack(); if (isStackEmpty(stackInCursor)) { @@ -1458,7 +1458,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(HandledScreen= 0 && isStackEmpty(mc.player.method_31548().getCursorStack()) == false) + if (slotNum >= 0 && isStackEmpty(mc.player.getInventory().getCursorStack()) == false) { leftClickSlot(gui, slotNum); } @@ -1522,7 +1522,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(HandledScreen gui, List slotNumbers) { MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.method_31548(); + PlayerInventory inv = mc.player.getInventory(); for (int slotNum : slotNumbers) { @@ -1852,7 +1852,7 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, HandledScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) { MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.method_31548(); + PlayerInventory inv = mc.player.getInventory(); Slot lastSlot = null; // Empty slot, nothing to do @@ -2147,7 +2147,7 @@ private static Slot moveStackToSlots(HandledScreen gui, private static void moveOneItemToFirstValidSlot(HandledScreen gui, Slot slotFrom, List slotsTo) { MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.method_31548(); + PlayerInventory inv = mc.player.getInventory(); // Pick up half of the the stack rightClickSlot(gui, slotFrom.id); @@ -2211,7 +2211,7 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Sc public static void tryClearCursor(HandledScreen gui, MinecraftClient mc) { - ItemStack stackCursor = mc.player.method_31548().getCursorStack(); + ItemStack stackCursor = mc.player.getInventory().getCursorStack(); if (isStackEmpty(stackCursor) == false) { @@ -2239,13 +2239,13 @@ public static void tryClearCursor(HandledScreen gui, Mi } leftClickSlot(gui, slotNum); - stackCursor = mc.player.method_31548().getCursorStack(); + stackCursor = mc.player.getInventory().getCursorStack(); } } } } - if (isStackEmpty(mc.player.method_31548().getCursorStack()) == false) + if (isStackEmpty(mc.player.getInventory().getCursorStack()) == false) { dropItemsFromCursor(gui); } @@ -2400,7 +2400,7 @@ public static void swapSlots(HandledScreen gui, int slo private static void dragSplitItemsIntoSlots(HandledScreen gui, List targetSlots) { MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stackInCursor = mc.player.method_31548().getCursorStack(); + ItemStack stackInCursor = mc.player.getInventory().getCursorStack(); if (isStackEmpty(stackInCursor)) { From ad144d07fe4013d1f59551dcdaf2290c5979a640 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 25 Nov 2020 22:54:23 +0200 Subject: [PATCH 062/107] Update to MC 1.17 snapshot 20w48a --- build.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index f5ac7fe56..ab40ddda2 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.21+beta.2 +malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17-snap-20w45a -minecraft_version = 20w45a -mappings_version = 20w45a+build.31 +minecraft_version_out = 1.17-snap-20w48a +minecraft_version = 20w48a +mappings_version = 20w48a+build.1 -fabric_loader_version = 0.10.6+build.214 +fabric_loader_version = 0.10.8 mod_menu_version = 1.15.0+build.1 From 194f5547242cbfacedf014be0fb94c0014c0531a Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sun, 6 Dec 2020 21:58:52 +0200 Subject: [PATCH 063/107] Update to MC 1.17 snapshot 20w49a (version bump) --- build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.properties b/build.properties index ab40ddda2..f04b4c5d1 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17-snap-20w48a -minecraft_version = 20w48a -mappings_version = 20w48a+build.1 +minecraft_version_out = 1.17-snap-20w49a +minecraft_version = 20w49a +mappings_version = 20w49a+build.5 fabric_loader_version = 0.10.8 mod_menu_version = 1.15.0+build.1 From 4176777022cc1a1968f885ed2fd3e10626ff0180 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 18 Dec 2020 03:07:50 +0200 Subject: [PATCH 064/107] Update to MC 1.17 snapshot 20w51a (version bump) --- build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.properties b/build.properties index f04b4c5d1..a5d705c09 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17-snap-20w49a -minecraft_version = 20w49a -mappings_version = 20w49a+build.5 +minecraft_version_out = 1.17-snap-20w51a +minecraft_version = 20w51a +mappings_version = 20w51a+build.5 fabric_loader_version = 0.10.8 mod_menu_version = 1.15.0+build.1 From 322adafa9380162b4a98f979a7094b4e248607be Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 5 Jan 2021 17:47:07 +0200 Subject: [PATCH 065/107] Implement the villager trading features back --- .../dy/masa/itemscroller/config/Configs.java | 8 +- .../masa/itemscroller/event/InputHandler.java | 16 ++ .../itemscroller/event/KeybindCallbacks.java | 4 + .../itemscroller/event/WorldLoadListener.java | 3 + .../itemscroller/gui/ItemScrollerIcons.java | 89 ++++++++ .../mixin/IMixinMerchantScreen.java | 3 +- .../mixin/MixinMerchantScreen.java | 169 +++++++++++++++ .../mixin/MixinMerchantScreenHandler.java | 54 +++++ .../itemscroller/util/InventoryUtils.java | 79 +++++++ .../villager/IMerchantScreenHandler.java | 8 + .../itemscroller/villager/VillagerData.java | 97 +++++++++ .../villager/VillagerDataStorage.java | 192 ++++++++++++++++++ .../itemscroller/villager/VillagerUtils.java | 112 ++++++++++ src/main/resources/mixins.itemscroller.json | 2 + 14 files changed, 831 insertions(+), 5 deletions(-) create mode 100644 src/main/java/fi/dy/masa/itemscroller/gui/ItemScrollerIcons.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreenHandler.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/villager/IMerchantScreenHandler.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index cf2d5ae8a..1ad13a0cd 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -37,7 +37,7 @@ public static class Generic public static final ConfigBoolean REVERSE_SCROLL_DIRECTION_SINGLE = new ConfigBoolean("reverseScrollDirectionSingle", false, "Reverse the scrolling direction for single item mode."); public static final ConfigBoolean REVERSE_SCROLL_DIRECTION_STACKS = new ConfigBoolean("reverseScrollDirectionStacks", false, "Reverse the scrolling direction for full stacks mode."); public static final ConfigBoolean SLOT_POSITION_AWARE_SCROLL_DIRECTION = new ConfigBoolean("useSlotPositionAwareScrollDirection", false, "When enabled, the item movement direction depends\non the slots' y-position on screen. Might be derpy with more\ncomplex inventories, use with caution!"); - 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 ConfigBoolean VILLAGER_TRADE_LIST_REMEMBER_SCROLL = new ConfigBoolean("villagerTradeListRememberScrollPosition", true, "Remember and restore the last scroll position in the\ntrade list when re-opening the GUI"); public static final ImmutableList OPTIONS = ImmutableList.of( CARPET_CTRL_Q_CRAFTING, @@ -50,7 +50,7 @@ public static class Generic REVERSE_SCROLL_DIRECTION_SINGLE, REVERSE_SCROLL_DIRECTION_STACKS, SLOT_POSITION_AWARE_SCROLL_DIRECTION, - VILLAGER_TRADE_LIST_REMEMBER_PAGE + VILLAGER_TRADE_LIST_REMEMBER_SCROLL ); } @@ -67,7 +67,7 @@ public static class Toggles public static final ConfigBoolean SCROLL_VILLAGER = new ConfigBoolean("enableScrollingVillager", true, "Enables special handling for the Villager GUIs.\n(Normally you can't shift click items in them.)\nHold shift and scroll up/down over the trade output slot."); public static final ConfigBoolean SHIFT_DROP_ITEMS = new ConfigBoolean("enableShiftDropItems", true, "Enables dropping all matching items at once by holding\nshift while clicking to drop a stack"); public static final ConfigBoolean SHIFT_PLACE_ITEMS = new ConfigBoolean("enableShiftPlaceItems", true, "Enables moving all matching stacks at once by holding\nshift while placing items to an empty slot"); - public static final ConfigBoolean VILLAGER_TRADE_LIST = new ConfigBoolean("enableVillagerTradeList", true, "Render a 1.14-style trade list in villager GUIs"); + public static final ConfigBoolean VILLAGER_TRADE_FEATURES = new ConfigBoolean("enableVillagerTradeFeatures", true, "Enable trade favoriting and quick trade features for villagers.\nNote: The Shift + scrolling over the output slot is a separate feature\nand not affected by this option.\nThis option enables middle clicking to mark favorite trades,\nand right clicking on the trade list to fully trade that one trade."); public static final ImmutableList OPTIONS = ImmutableList.of( CRAFTING_FEATURES, @@ -81,7 +81,7 @@ public static class Toggles SCROLL_VILLAGER, SHIFT_DROP_ITEMS, SHIFT_PLACE_ITEMS, - VILLAGER_TRADE_LIST + VILLAGER_TRADE_FEATURES ); } diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index bf899c919..b43c3127f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -4,7 +4,10 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.entity.passive.VillagerEntity; import net.minecraft.screen.slot.Slot; +import net.minecraft.util.hit.EntityHitResult; +import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.MathHelper; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.config.Configs; @@ -15,6 +18,7 @@ import fi.dy.masa.itemscroller.util.InputUtils; import fi.dy.masa.itemscroller.util.InventoryUtils; import fi.dy.masa.itemscroller.util.MoveAction; +import fi.dy.masa.itemscroller.villager.VillagerDataStorage; import fi.dy.masa.malilib.gui.GuiBase; import fi.dy.masa.malilib.hotkeys.IHotkey; import fi.dy.masa.malilib.hotkeys.IKeybindManager; @@ -137,6 +141,18 @@ private boolean handleInputImpl(int keyCode, boolean keyState, double dWheel) final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); final int mouseY = fi.dy.masa.malilib.util.InputUtils.getMouseY(); + if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue()) + { + VillagerDataStorage storage = VillagerDataStorage.getInstance(); + + if (GuiUtils.getCurrentScreen() == null && mc.crosshairTarget != null && + mc.crosshairTarget.getType() == HitResult.Type.ENTITY && + ((EntityHitResult) mc.crosshairTarget).getEntity() instanceof VillagerEntity) + { + storage.setLastInteractedUUID(((EntityHitResult) mc.crosshairTarget).getEntity().getUuid()); + } + } + if (GuiUtils.getCurrentScreen() instanceof HandledScreen && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index cf4651538..07d4ab3bb 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -167,6 +167,10 @@ else if (key == Hotkeys.KEY_STORE_RECIPE.getKeybind()) return true; } } + else if (key == Hotkeys.KEY_VILLAGER_TRADE_FAVORITES.getKeybind()) + { + return InventoryUtils.villagerTradeEverythingPossibleWithAllFavoritedTrades(); + } else if (key == Hotkeys.KEY_SLOT_DEBUG.getKeybind()) { if (slot != null) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/WorldLoadListener.java b/src/main/java/fi/dy/masa/itemscroller/event/WorldLoadListener.java index 3b8d5a59b..67adf9cae 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/WorldLoadListener.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/WorldLoadListener.java @@ -6,6 +6,7 @@ import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.recipes.RecipeStorage; import fi.dy.masa.itemscroller.util.ClickPacketBuffer; +import fi.dy.masa.itemscroller.villager.VillagerDataStorage; import fi.dy.masa.malilib.interfaces.IWorldLoadListener; public class WorldLoadListener implements IWorldLoadListener @@ -17,6 +18,7 @@ public void onWorldLoadPre(@Nullable ClientWorld worldBefore, @Nullable ClientWo if (worldBefore != null && worldAfter == null) { this.writeData(); + VillagerDataStorage.getInstance().writeToDisk(); } } @@ -27,6 +29,7 @@ public void onWorldLoadPost(@Nullable ClientWorld worldBefore, @Nullable ClientW if (worldBefore == null && worldAfter != null) { this.readStoredData(); + VillagerDataStorage.getInstance().readFromDisk(); } // Logging out diff --git a/src/main/java/fi/dy/masa/itemscroller/gui/ItemScrollerIcons.java b/src/main/java/fi/dy/masa/itemscroller/gui/ItemScrollerIcons.java new file mode 100644 index 000000000..6cd528b10 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/gui/ItemScrollerIcons.java @@ -0,0 +1,89 @@ +package fi.dy.masa.itemscroller.gui; + +import net.minecraft.util.Identifier; +import fi.dy.masa.itemscroller.Reference; +import fi.dy.masa.malilib.gui.interfaces.IGuiIcon; +import fi.dy.masa.malilib.render.RenderUtils; + +public enum ItemScrollerIcons implements IGuiIcon +{ + TRADE_ARROW_AVAILABLE (112, 0, 10, 9), + TRADE_ARROW_LOCKED (112, 9, 10, 9), + SCROLL_BAR_6 (106, 0, 6, 167), + STAR_5 (112, 18, 5, 5); + + public static final Identifier TEXTURE = new Identifier(Reference.MOD_ID, "textures/gui/gui_widgets.png"); + + private final int u; + private final int v; + private final int w; + private final int h; + private final int hoverOffU; + private final int hoverOffV; + + ItemScrollerIcons(int u, int v, int w, int h) + { + this(u, v, w, h, w, 0); + } + + ItemScrollerIcons(int u, int v, int w, int h, int hoverOffU, int hoverOffV) + { + this.u = u; + this.v = v; + this.w = w; + this.h = h; + this.hoverOffU = hoverOffU; + this.hoverOffV = hoverOffV; + } + + @Override + public int getWidth() + { + return this.w; + } + + @Override + public int getHeight() + { + return this.h; + } + + @Override + public int getU() + { + return this.u; + } + + @Override + public int getV() + { + return this.v; + } + + @Override + public void renderAt(int x, int y, float zLevel, boolean enabled, boolean selected) + { + int u = this.u; + int v = this.v; + + if (enabled) + { + u += this.hoverOffU; + v += this.hoverOffV; + } + + if (selected) + { + u += this.hoverOffU; + v += this.hoverOffV; + } + + RenderUtils.drawTexturedRect(x, y, u, v, this.w, this.h, zLevel); + } + + @Override + public Identifier getTexture() + { + return TEXTURE; + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java index cc11c9e69..b722a8c4c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java @@ -2,8 +2,9 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; +import net.minecraft.client.gui.screen.ingame.MerchantScreen; -@Mixin(net.minecraft.client.gui.screen.ingame.MerchantScreen.class) +@Mixin(MerchantScreen.class) public interface IMixinMerchantScreen { @Accessor("selectedIndex") diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java new file mode 100644 index 000000000..b279db38f --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java @@ -0,0 +1,169 @@ +package fi.dy.masa.itemscroller.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import net.minecraft.client.gui.screen.ingame.HandledScreen; +import net.minecraft.client.gui.screen.ingame.MerchantScreen; +import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.screen.MerchantScreenHandler; +import net.minecraft.text.Text; +import fi.dy.masa.itemscroller.config.Configs; +import fi.dy.masa.itemscroller.gui.ItemScrollerIcons; +import fi.dy.masa.itemscroller.util.InventoryUtils; +import fi.dy.masa.itemscroller.villager.IMerchantScreenHandler; +import fi.dy.masa.itemscroller.villager.VillagerData; +import fi.dy.masa.itemscroller.villager.VillagerDataStorage; +import fi.dy.masa.itemscroller.villager.VillagerUtils; +import fi.dy.masa.malilib.render.RenderUtils; + +@Mixin(MerchantScreen.class) +public abstract class MixinMerchantScreen extends HandledScreen +{ + @Shadow private int selectedIndex; + @Shadow private int indexStartOffset; + + private int indexStartOffsetLast = -1; + + private MixinMerchantScreen(MerchantScreenHandler handler, PlayerInventory inventory, Text title) + { + super(handler, inventory, title); + } + + @Inject(method = "init", at = @At("RETURN")) + private void initTradeListWidget(CallbackInfo ci) + { + if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue() && + Configs.Generic.VILLAGER_TRADE_LIST_REMEMBER_SCROLL.getBooleanValue()) + { + VillagerData data = VillagerDataStorage.getInstance().getDataForLastInteractionTarget(); + + if (data != null) + { + this.indexStartOffset = data.getTradeListPosition(); + } + } + } + + @Inject(method = "mouseScrolled", at = @At("RETURN")) + private void onMouseScrollPost(double mouseX, double mouseY, double amount, CallbackInfoReturnable cir) + { + if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue() && + Configs.Generic.VILLAGER_TRADE_LIST_REMEMBER_SCROLL.getBooleanValue() && + this.indexStartOffsetLast != this.indexStartOffset) + { + VillagerDataStorage.getInstance().setTradeListPosition(this.indexStartOffset); + this.indexStartOffsetLast = this.indexStartOffset; + } + } + + @Inject(method = "mouseDragged", at = @At("RETURN")) + private void onMouseDragPost(double mouseX, double mouseY, int button, double deltaX, double deltaY, CallbackInfoReturnable cir) + { + if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue() && + Configs.Generic.VILLAGER_TRADE_LIST_REMEMBER_SCROLL.getBooleanValue() && + this.indexStartOffsetLast != this.indexStartOffset) + { + VillagerDataStorage.getInstance().setTradeListPosition(this.indexStartOffset); + this.indexStartOffsetLast = this.indexStartOffset; + } + } + + @Inject(method = "mouseClicked", at = @At("RETURN"), cancellable = true) + private void onMouseClicked(double mouseX, double mouseY, int button, CallbackInfoReturnable cir) + { + if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue()) + { + int visibleIndex = this.getHoveredTradeButtonIndex(mouseX, mouseY); + int realIndex = VillagerUtils.getRealTradeIndexFor(visibleIndex, this.handler); + + if (realIndex >= 0) + { + // right click, trade everything with this trade + if (button == 1) + { + InventoryUtils.villagerTradeEverythingPossibleWithTrade(visibleIndex); + cir.setReturnValue(true); + } + // Middle click, toggle trade favorite + else if (button == 2) + { + VillagerDataStorage.getInstance().toggleFavorite(realIndex); + + // Rebuild the custom list based on the new favorites + this.handler.setOffers(((IMerchantScreenHandler) this.handler).getOriginalList()); + + cir.setReturnValue(true); + } + } + } + } + + @Inject(method = "syncRecipeIndex", at = @At("HEAD"), cancellable = true) + private void fixRecipeIndex(CallbackInfo ci) + { + if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue() && + this.getScreenHandler() instanceof IMerchantScreenHandler) + { + if (VillagerUtils.switchToTradeByVisibleIndex(this.selectedIndex)) + { + ci.cancel(); + } + } + } + + @Inject(method = "render", at = @At(value = "INVOKE", + target = "Lcom/mojang/blaze3d/systems/RenderSystem;popMatrix()V")) + private void renderFavoriteMarker(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) + { + if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue()) + { + VillagerData data = VillagerDataStorage.getInstance().getDataForLastInteractionTarget(); + + if (data != null) + { + int numFavorites = data.getFavorites().size(); + + if (this.indexStartOffset < numFavorites) + { + int screenX = (this.width - this.backgroundWidth) / 2; + int screenY = (this.height - this.backgroundHeight) / 2; + int buttonsStartX = screenX + 5; + int buttonsStartY = screenY + 16 + 2; + int x = buttonsStartX + 89 - 8; + int y = buttonsStartY + 2; + float z = this.getZOffset() + 300; + + for (int i = 0; i < (numFavorites - this.indexStartOffset); ++i) + { + RenderUtils.bindTexture(ItemScrollerIcons.STAR_5.getTexture()); + ItemScrollerIcons.STAR_5.renderAt(x, y, z, false, false); + y += 20; + } + } + } + } + } + + private int getHoveredTradeButtonIndex(double mouseX, double mouseY) + { + int screenX = (this.width - this.backgroundWidth) / 2; + int screenY = (this.height - this.backgroundHeight) / 2; + int buttonsStartX = screenX + 5; + int buttonsStartY = screenY + 16 + 2; + int buttonWidth = 89; + int buttonHeight = 20; + + if (mouseX >= buttonsStartX && mouseX <= buttonsStartX + buttonWidth && + mouseY >= buttonsStartY && mouseY <= buttonsStartY + 7 * buttonHeight) + { + return this.indexStartOffset + (((int) mouseY - buttonsStartY) / buttonHeight); + } + + return -1; + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreenHandler.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreenHandler.java new file mode 100644 index 000000000..1033bb1a9 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreenHandler.java @@ -0,0 +1,54 @@ +package fi.dy.masa.itemscroller.mixin; + +import org.jetbrains.annotations.Nullable; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; +import net.minecraft.screen.MerchantScreenHandler; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.ScreenHandlerType; +import net.minecraft.village.Merchant; +import net.minecraft.village.TradeOfferList; +import fi.dy.masa.itemscroller.config.Configs; +import fi.dy.masa.itemscroller.villager.IMerchantScreenHandler; +import fi.dy.masa.itemscroller.villager.VillagerUtils; + +@Mixin(MerchantScreenHandler.class) +public abstract class MixinMerchantScreenHandler extends ScreenHandler implements IMerchantScreenHandler +{ + @Shadow @Final private Merchant merchant; + @Nullable private TradeOfferList customList; + + protected MixinMerchantScreenHandler(@Nullable ScreenHandlerType type, int syncId) + { + super(type, syncId); + } + + @Inject(method = "getRecipes", at = @At("HEAD"), cancellable = true) + private void replaceTradeList(CallbackInfoReturnable cir) + { + if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue() && this.customList != null) + { + cir.setReturnValue(this.customList); + } + } + + @Inject(method = "setOffers", at = @At("HEAD")) + private void onTradeListSet(TradeOfferList offers, CallbackInfo ci) + { + if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue()) + { + this.customList = VillagerUtils.buildCustomTradeList(offers); + } + } + + @Override + public TradeOfferList getOriginalList() + { + return this.merchant.getOffers(); + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index ed4bdca16..f6a0962c8 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -43,6 +43,10 @@ import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; +import fi.dy.masa.itemscroller.villager.VillagerData; +import fi.dy.masa.itemscroller.villager.VillagerDataStorage; +import fi.dy.masa.itemscroller.villager.VillagerUtils; +import fi.dy.masa.malilib.util.GuiUtils; public class InventoryUtils { @@ -668,6 +672,81 @@ else if (slot.hasStack()) return false; } + public static void villagerClearTradeInputSlots() + { + if (GuiUtils.getCurrentScreen() instanceof MerchantScreen) + { + MerchantScreen merchantGui = (MerchantScreen) GuiUtils.getCurrentScreen(); + Slot slot = merchantGui.getScreenHandler().getSlot(0); + + if (slot.hasStack()) + { + shiftClickSlot(merchantGui, slot.id); + } + + slot = merchantGui.getScreenHandler().getSlot(1); + + if (slot.hasStack()) + { + shiftClickSlot(merchantGui, slot.id); + } + } + } + + public static void villagerTradeEverythingPossibleWithTrade(int visibleIndex) + { + if (GuiUtils.getCurrentScreen() instanceof MerchantScreen) + { + MerchantScreen merchantGui = (MerchantScreen) GuiUtils.getCurrentScreen(); + Slot slot = merchantGui.getScreenHandler().getSlot(2); + + while (true) + { + VillagerUtils.switchToTradeByVisibleIndex(visibleIndex); + //tryMoveItemsToMerchantBuySlots(merchantGui, true); + + // Not a valid recipe + if (slot.hasStack() == false) + { + break; + } + + shiftClickSlot(merchantGui, slot.id); + + // No room in player inventory + if (slot.hasStack()) + { + break; + } + } + + villagerClearTradeInputSlots(); + } + } + + public static boolean villagerTradeEverythingPossibleWithAllFavoritedTrades() + { + if (GuiUtils.getCurrentScreen() instanceof MerchantScreen) + { + VillagerData data = VillagerDataStorage.getInstance().getDataForLastInteractionTarget(); + + if (data != null && data.getFavorites().isEmpty() == false) + { + for (int index = 0; index < data.getFavorites().size(); ++index) + { + VillagerUtils.switchToTradeByVisibleIndex(index); + villagerTradeEverythingPossibleWithTrade(index); + } + } + + villagerClearTradeInputSlots(); + + return true; + } + + return false; + } + private static boolean tryMoveSingleItemToOtherInventory(Slot slot, HandledScreen gui) { ItemStack stackOrig = slot.getStack(); diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/IMerchantScreenHandler.java b/src/main/java/fi/dy/masa/itemscroller/villager/IMerchantScreenHandler.java new file mode 100644 index 000000000..fb09b3934 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/villager/IMerchantScreenHandler.java @@ -0,0 +1,8 @@ +package fi.dy.masa.itemscroller.villager; + +import net.minecraft.village.TradeOfferList; + +public interface IMerchantScreenHandler +{ + TradeOfferList getOriginalList(); +} diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java new file mode 100644 index 000000000..8e51e581a --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java @@ -0,0 +1,97 @@ +package fi.dy.masa.itemscroller.villager; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import javax.annotation.Nullable; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.IntTag; +import net.minecraft.nbt.ListTag; +import fi.dy.masa.itemscroller.util.Constants; + +public class VillagerData +{ + private final UUID uuid; + private List favorites = new ArrayList<>(); + private int tradeListPosition; + + VillagerData(UUID uuid) + { + this.uuid = uuid; + } + + public UUID getUUID() + { + return this.uuid; + } + + public int getTradeListPosition() + { + return this.tradeListPosition; + } + + void setTradeListPosition(int position) + { + this.tradeListPosition = position; + } + + void toggleFavorite(int tradeIndex) + { + if (this.favorites.contains(tradeIndex)) + { + this.favorites.remove(Integer.valueOf(tradeIndex)); + } + else + { + this.favorites.add(tradeIndex); + } + } + + public List getFavorites() + { + return this.favorites; + } + + public CompoundTag toNBT() + { + CompoundTag tag = new CompoundTag(); + + tag.putLong("UUIDM", this.uuid.getMostSignificantBits()); + tag.putLong("UUIDL", this.uuid.getLeastSignificantBits()); + tag.putInt("ListPosition", this.tradeListPosition); + + ListTag tagList = new ListTag(); + + for (Integer val : this.favorites) + { + tagList.add(IntTag.of(val)); + } + + tag.put("Favorites", tagList); + + return tag; + } + + @Nullable + public static VillagerData fromNBT(CompoundTag tag) + { + if (tag.contains("UUIDM", Constants.NBT.TAG_LONG) && tag.contains("UUIDL", Constants.NBT.TAG_LONG)) + { + VillagerData data = new VillagerData(new UUID(tag.getLong("UUIDM"), tag.getLong("UUIDL"))); + ListTag tagList = tag.getList("Favorites", Constants.NBT.TAG_INT); + final int count = tagList.size(); + + data.favorites.clear(); + data.tradeListPosition = tag.getInt("ListPosition"); + + for (int i = 0; i < count; ++i) + { + data.favorites.add(tagList.getInt(i)); + } + + return data; + } + + return null; + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java new file mode 100644 index 000000000..2f170736b --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java @@ -0,0 +1,192 @@ +package fi.dy.masa.itemscroller.villager; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtIo; +import fi.dy.masa.itemscroller.ItemScroller; +import fi.dy.masa.itemscroller.Reference; +import fi.dy.masa.itemscroller.util.Constants; +import fi.dy.masa.malilib.util.FileUtils; +import fi.dy.masa.malilib.util.StringUtils; + +public class VillagerDataStorage +{ + private static final VillagerDataStorage INSTANCE = new VillagerDataStorage(); + + private final Map data = new HashMap<>(); + private UUID lastInteractedUUID; + private boolean dirty; + + public static VillagerDataStorage getInstance() + { + return INSTANCE; + } + + public void setLastInteractedUUID(UUID uuid) + { + this.lastInteractedUUID = uuid; + } + + @Nullable + public VillagerData getDataForLastInteractionTarget() + { + return this.getDataFor(this.lastInteractedUUID, true); + } + + public VillagerData getDataFor(@Nullable UUID uuid, boolean create) + { + VillagerData data = uuid != null ? this.data.get(uuid) : null; + + if (data == null && uuid != null && create) + { + this.setLastInteractedUUID(uuid); + data = new VillagerData(uuid); + this.data.put(uuid, data); + this.dirty = true; + } + + return data; + } + + public void setTradeListPosition(int position) + { + VillagerData data = this.getDataFor(this.lastInteractedUUID, true); + + if (data != null) + { + data.setTradeListPosition(position); + this.dirty = true; + } + } + + public void toggleFavorite(int tradeIndex) + { + VillagerData data = this.getDataFor(this.lastInteractedUUID, true); + + if (data != null) + { + data.toggleFavorite(tradeIndex); + this.dirty = true; + } + } + + private void readFromNBT(CompoundTag nbt) + { + if (nbt == null || nbt.contains("VillagerData", Constants.NBT.TAG_LIST) == false) + { + return; + } + + ListTag tagList = nbt.getList("VillagerData", Constants.NBT.TAG_COMPOUND); + final int count = tagList.size(); + + for (int i = 0; i < count; i++) + { + CompoundTag tag = tagList.getCompound(i); + VillagerData data = VillagerData.fromNBT(tag); + + if (data != null) + { + this.data.put(data.getUUID(), data); + } + } + } + + private CompoundTag writeToNBT(@Nonnull CompoundTag nbt) + { + ListTag tagList = new ListTag(); + + for (VillagerData data : this.data.values()) + { + tagList.add(data.toNBT()); + } + + nbt.put("VillagerData", tagList); + + this.dirty = false; + + return nbt; + } + + private String getFileName() + { + String worldName = StringUtils.getWorldOrServerName(); + + if (worldName != null) + { + return "villager_data_" + worldName + ".nbt"; + } + + return "villager_data.nbt"; + } + + private File getSaveDir() + { + return new File(FileUtils.getMinecraftDirectory(), Reference.MOD_ID); + } + + public void readFromDisk() + { + this.data.clear(); + + try + { + File saveDir = this.getSaveDir(); + File file = new File(saveDir, this.getFileName()); + + if (file.exists() && file.isFile() && file.canRead()) + { + FileInputStream is = new FileInputStream(file); + this.readFromNBT(NbtIo.readCompressed(is)); + is.close(); + } + } + catch (Exception e) + { + ItemScroller.logger.warn("Failed to read villager data from file", e); + } + } + + public void writeToDisk() + { + if (this.dirty) + { + try + { + File saveDir = this.getSaveDir(); + + if (saveDir.exists() == false && saveDir.mkdirs() == false) + { + ItemScroller.logger.warn("Failed to create the data storage directory '{}'", saveDir.getPath()); + return; + } + + File fileTmp = new File(saveDir, this.getFileName() + ".tmp"); + File fileReal = new File(saveDir, this.getFileName()); + FileOutputStream os = new FileOutputStream(fileTmp); + NbtIo.writeCompressed(this.writeToNBT(new CompoundTag()), os); + os.close(); + + if (fileReal.exists()) + { + fileReal.delete(); + } + + fileTmp.renameTo(fileReal); + this.dirty = false; + } + catch (Exception e) + { + ItemScroller.logger.warn("Failed to write villager data to file!", e); + } + } + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java new file mode 100644 index 000000000..2ad14ed01 --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java @@ -0,0 +1,112 @@ +package fi.dy.masa.itemscroller.villager; + +import java.util.List; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.gui.screen.ingame.MerchantScreen; +import net.minecraft.network.packet.c2s.play.SelectMerchantTradeC2SPacket; +import net.minecraft.screen.MerchantScreenHandler; +import net.minecraft.village.TradeOffer; +import net.minecraft.village.TradeOfferList; +import fi.dy.masa.malilib.util.GuiUtils; + +public class VillagerUtils +{ + public static boolean switchToTradeByVisibleIndex(int visibleIndex) + { + Screen screen = GuiUtils.getCurrentScreen(); + + if (screen instanceof MerchantScreen) + { + MerchantScreen merchantScreen = (MerchantScreen) screen; + MerchantScreenHandler handler = merchantScreen.getScreenHandler(); + + int realIndex = getRealTradeIndexFor(visibleIndex, handler); + + if (realIndex >= 0) + { + // Use the real (server-side) index + handler.setRecipeIndex(realIndex); + + // Use the "visible index", since this will access the custom list + handler.switchTo(visibleIndex); + + // Use the real (server-side) index + MinecraftClient.getInstance().getNetworkHandler().sendPacket(new SelectMerchantTradeC2SPacket(realIndex)); + + return true; + } + } + + return false; + } + + public static int getRealTradeIndexFor(int visibleIndex, MerchantScreenHandler handler) + { + if (handler instanceof IMerchantScreenHandler) + { + TradeOfferList originalList = ((IMerchantScreenHandler) handler).getOriginalList(); + TradeOfferList customList = handler.getRecipes(); + + if (originalList != null && customList != null && + visibleIndex >= 0 && visibleIndex < customList.size()) + { + TradeOffer trade = customList.get(visibleIndex); + + if (trade != null) + { + int realIndex = originalList.indexOf(trade); + + if (realIndex >= 0 && realIndex < originalList.size()) + { + return realIndex; + } + } + } + } + + return -1; + } + + public static TradeOfferList buildCustomTradeList(TradeOfferList originalList) + { + VillagerData data = VillagerDataStorage.getInstance().getDataForLastInteractionTarget(); + + if (data != null) + { + TradeOfferList list = new TradeOfferList(); + List favorites = data.getFavorites(); + int originalListSize = originalList.size(); + + // Some favorites defined + if (favorites.isEmpty() == false) + { + // First pick all the favorited recipes, in the order they are in the favorites list + for (int index : favorites) + { + if (index >= 0 && index < originalListSize) + { + list.add(originalList.get(index)); + } + } + + // Then add the rest of the recipes in their original order + for (int i = 0; i < originalListSize; ++i) + { + if (favorites.contains(i) == false) + { + list.add(originalList.get(i)); + } + } + } + else + { + list.addAll(originalList); + } + + return list; + } + + return originalList; + } +} diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 96c2fc6b6..9496b29b1 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -11,6 +11,8 @@ "MixinClientPlayerInteractionManager", "MixinCraftingScreenHandler", "MixinGameRenderer", + "MixinMerchantScreen", + "MixinMerchantScreenHandler", "MixinScreen" ], "injectors": { From d0db9912df58a43e1eb6535f4310b0623b025043 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 8 Jan 2021 02:30:32 +0200 Subject: [PATCH 066/107] Villager Trading: Add global favorites functionality --- .../dy/masa/itemscroller/config/Configs.java | 2 + .../dy/masa/itemscroller/config/Hotkeys.java | 2 + .../itemscroller/gui/ItemScrollerIcons.java | 3 +- .../mixin/MixinMerchantScreen.java | 37 ++++-- .../itemscroller/util/InventoryUtils.java | 19 +-- .../itemscroller/villager/FavoriteData.java | 15 +++ .../masa/itemscroller/villager/TradeType.java | 109 ++++++++++++++++++ .../itemscroller/villager/VillagerData.java | 2 +- .../villager/VillagerDataStorage.java | 77 ++++++++++++- .../itemscroller/villager/VillagerUtils.java | 81 +++++++++---- .../itemscroller/textures/gui/gui_widgets.png | Bin 1314 -> 1362 bytes .../itemscroller/textures/xcf/gui_widgets.xcf | Bin 65011 -> 65084 bytes 12 files changed, 304 insertions(+), 43 deletions(-) create mode 100644 src/main/java/fi/dy/masa/itemscroller/villager/FavoriteData.java create mode 100644 src/main/java/fi/dy/masa/itemscroller/villager/TradeType.java diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index 1ad13a0cd..59b492efe 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -37,6 +37,7 @@ public static class Generic public static final ConfigBoolean REVERSE_SCROLL_DIRECTION_SINGLE = new ConfigBoolean("reverseScrollDirectionSingle", false, "Reverse the scrolling direction for single item mode."); public static final ConfigBoolean REVERSE_SCROLL_DIRECTION_STACKS = new ConfigBoolean("reverseScrollDirectionStacks", false, "Reverse the scrolling direction for full stacks mode."); public static final ConfigBoolean SLOT_POSITION_AWARE_SCROLL_DIRECTION = new ConfigBoolean("useSlotPositionAwareScrollDirection", false, "When enabled, the item movement direction depends\non the slots' y-position on screen. Might be derpy with more\ncomplex inventories, use with caution!"); + public static final ConfigBoolean VILLAGER_TRADE_USE_GLOBAL_FAVORITES = new ConfigBoolean("villagerTradeUseGlobalFavorites", true, "Whether or not global (per-item-type) villager trade\nfavorites should be used."); public static final ConfigBoolean VILLAGER_TRADE_LIST_REMEMBER_SCROLL = new ConfigBoolean("villagerTradeListRememberScrollPosition", true, "Remember and restore the last scroll position in the\ntrade list when re-opening the GUI"); public static final ImmutableList OPTIONS = ImmutableList.of( @@ -50,6 +51,7 @@ public static class Generic REVERSE_SCROLL_DIRECTION_SINGLE, REVERSE_SCROLL_DIRECTION_STACKS, SLOT_POSITION_AWARE_SCROLL_DIRECTION, + VILLAGER_TRADE_USE_GLOBAL_FAVORITES, VILLAGER_TRADE_LIST_REMEMBER_SCROLL ); } diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java b/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java index b6105df48..753b10cb0 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java @@ -49,6 +49,7 @@ public class Hotkeys public static final ConfigHotkey MODIFIER_MOVE_EVERYTHING = new ConfigHotkey("modifierMoveEverything", "LEFT_ALT,LEFT_SHIFT", GUI_NO_ORDER, "Modifier key to move ALL items to the other\ninventory when scrolling over a stack"); public static final ConfigHotkey MODIFIER_MOVE_MATCHING = new ConfigHotkey("modifierMoveMatching", "LEFT_ALT", GUI_NO_ORDER, "Modifier key to move all matching items to the other\ninventory when scrolling over a stack"); public static final ConfigHotkey MODIFIER_MOVE_STACK = new ConfigHotkey("modifierMoveStack", "LEFT_SHIFT", GUI_NO_ORDER, "Modifier key to move the entire stack to the other\ninventory when scrolling over it"); + public static final ConfigHotkey MODIFIER_TOGGLE_VILLAGER_GLOBAL_FAVORITE = new ConfigHotkey("modifierToggleVillagerGlobalFavorite", "LEFT_SHIFT", GUI_RELAXED, "Modifier key to hold while middle clicking a trade,\nto toggle the global favorite state for that trade.\nGlobal favorites are used for villagers that don't have any specific favorites set."); public static final List HOTKEY_LIST = ImmutableList.of( KEY_OPEN_CONFIG_GUI, @@ -56,6 +57,7 @@ public class Hotkeys MODIFIER_MOVE_EVERYTHING, MODIFIER_MOVE_MATCHING, MODIFIER_MOVE_STACK, + MODIFIER_TOGGLE_VILLAGER_GLOBAL_FAVORITE, KEY_MOVE_EVERYTHING, diff --git a/src/main/java/fi/dy/masa/itemscroller/gui/ItemScrollerIcons.java b/src/main/java/fi/dy/masa/itemscroller/gui/ItemScrollerIcons.java index 6cd528b10..2abf639d6 100644 --- a/src/main/java/fi/dy/masa/itemscroller/gui/ItemScrollerIcons.java +++ b/src/main/java/fi/dy/masa/itemscroller/gui/ItemScrollerIcons.java @@ -10,7 +10,8 @@ public enum ItemScrollerIcons implements IGuiIcon TRADE_ARROW_AVAILABLE (112, 0, 10, 9), TRADE_ARROW_LOCKED (112, 9, 10, 9), SCROLL_BAR_6 (106, 0, 6, 167), - STAR_5 (112, 18, 5, 5); + STAR_5_YELLOW (112, 18, 5, 5), + STAR_5_PURPLE (117, 18, 5, 5); public static final Identifier TEXTURE = new Identifier(Reference.MOD_ID, "textures/gui/gui_widgets.png"); diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java index b279db38f..b53748451 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java @@ -1,5 +1,6 @@ package fi.dy.masa.itemscroller.mixin; +import javax.annotation.Nullable; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -12,13 +13,17 @@ import net.minecraft.entity.player.PlayerInventory; import net.minecraft.screen.MerchantScreenHandler; import net.minecraft.text.Text; +import net.minecraft.village.TradeOffer; import fi.dy.masa.itemscroller.config.Configs; +import fi.dy.masa.itemscroller.config.Hotkeys; import fi.dy.masa.itemscroller.gui.ItemScrollerIcons; import fi.dy.masa.itemscroller.util.InventoryUtils; +import fi.dy.masa.itemscroller.villager.FavoriteData; import fi.dy.masa.itemscroller.villager.IMerchantScreenHandler; import fi.dy.masa.itemscroller.villager.VillagerData; import fi.dy.masa.itemscroller.villager.VillagerDataStorage; import fi.dy.masa.itemscroller.villager.VillagerUtils; +import fi.dy.masa.malilib.gui.interfaces.IGuiIcon; import fi.dy.masa.malilib.render.RenderUtils; @Mixin(MerchantScreen.class) @@ -27,6 +32,7 @@ public abstract class MixinMerchantScreen extends HandledScreen favorites = VillagerDataStorage.getInstance().getFavoritesForCurrentVillager(handler).favorites; - if (data != null && data.getFavorites().isEmpty() == false) + for (int index = 0; index < favorites.size(); ++index) { - for (int index = 0; index < data.getFavorites().size(); ++index) - { - VillagerUtils.switchToTradeByVisibleIndex(index); - villagerTradeEverythingPossibleWithTrade(index); - } + VillagerUtils.switchToTradeByVisibleIndex(index); + villagerTradeEverythingPossibleWithTrade(index); } villagerClearTradeInputSlots(); diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/FavoriteData.java b/src/main/java/fi/dy/masa/itemscroller/villager/FavoriteData.java new file mode 100644 index 000000000..d122f144d --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/villager/FavoriteData.java @@ -0,0 +1,15 @@ +package fi.dy.masa.itemscroller.villager; + +import java.util.List; + +public class FavoriteData +{ + public final List favorites; + public final boolean isGlobal; + + public FavoriteData(List favorites, boolean isGlobal) + { + this.favorites = favorites; + this.isGlobal = isGlobal; + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/TradeType.java b/src/main/java/fi/dy/masa/itemscroller/villager/TradeType.java new file mode 100644 index 000000000..ac018be2a --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/villager/TradeType.java @@ -0,0 +1,109 @@ +package fi.dy.masa.itemscroller.villager; + +import javax.annotation.Nullable; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.Items; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.Registry; +import net.minecraft.village.TradeOffer; + +public class TradeType +{ + public final Item buyItem1; + public final Item buyItem2; + public final Item sellItem; + + public TradeType(Item buyItem1, Item buyItem2, Item sellItem) + { + this.buyItem1 = buyItem1; + this.buyItem2 = buyItem2; + this.sellItem = sellItem; + } + + public boolean matchesTrade(TradeOffer trade) + { + ItemStack stackBuyItem1 = trade.getOriginalFirstBuyItem(); + ItemStack stackBuyItem2 = trade.getSecondBuyItem(); + ItemStack stackSellItem = trade.getSellItem(); + Item buyItem1 = stackBuyItem1.getItem(); + Item buyItem2 = stackBuyItem2.getItem(); + Item sellItem = stackSellItem.getItem(); + + return this.buyItem1 == buyItem1 && this.buyItem2 == buyItem2 && this.sellItem == sellItem; + } + + public CompoundTag toTag() + { + CompoundTag tag = new CompoundTag(); + + tag.putString("Buy1", Registry.ITEM.getId(this.buyItem1).toString()); + tag.putString("Buy2", Registry.ITEM.getId(this.buyItem2).toString()); + tag.putString("Sell", Registry.ITEM.getId(this.sellItem).toString()); + + return tag; + } + + @Nullable + public static TradeType fromTag(CompoundTag tag) + { + Item buy1 = getItemForName(tag.getString("Buy1")); + Item buy2 = getItemForName(tag.getString("Buy2")); + Item sell = getItemForName(tag.getString("Sell")); + + if (buy1 != Items.AIR || buy2 != Items.AIR || sell != Items.AIR) + { + return new TradeType(buy1, buy2, sell); + } + + return null; + } + + public static Item getItemForName(String name) + { + try + { + Identifier id = new Identifier(name); + return Registry.ITEM.get(id); + } + catch (Exception e) + { + return Items.AIR; + } + } + + @Override + public boolean equals(Object o) + { + if (this == o) { return true; } + if (o == null || getClass() != o.getClass()) { return false; } + + TradeType tradeType = (TradeType) o; + + if (!buyItem1.equals(tradeType.buyItem1)) { return false; } + if (!buyItem2.equals(tradeType.buyItem2)) { return false; } + return sellItem.equals(tradeType.sellItem); + } + + @Override + public int hashCode() + { + int result = buyItem1.hashCode(); + result = 31 * result + buyItem2.hashCode(); + result = 31 * result + sellItem.hashCode(); + return result; + } + + public static TradeType of(TradeOffer trade) + { + ItemStack stackBuyItem1 = trade.getOriginalFirstBuyItem(); + ItemStack stackBuyItem2 = trade.getSecondBuyItem(); + ItemStack stackSellItem = trade.getSellItem(); + Item buyItem1 = stackBuyItem1.getItem(); + Item buyItem2 = stackBuyItem2.getItem(); + Item sellItem = stackSellItem.getItem(); + + return new TradeType(buyItem1, buyItem2, sellItem); + } +} diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java index 8e51e581a..d80b3c4fa 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java @@ -47,7 +47,7 @@ void toggleFavorite(int tradeIndex) } } - public List getFavorites() + List getFavorites() { return this.favorites; } diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java index 2f170736b..124a0a8f8 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java @@ -3,7 +3,10 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; +import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import java.util.UUID; import javax.annotation.Nonnull; @@ -11,8 +14,12 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.NbtIo; +import net.minecraft.screen.MerchantScreenHandler; +import net.minecraft.village.TradeOffer; +import net.minecraft.village.TradeOfferList; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.Reference; +import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.util.Constants; import fi.dy.masa.malilib.util.FileUtils; import fi.dy.masa.malilib.util.StringUtils; @@ -22,6 +29,7 @@ public class VillagerDataStorage private static final VillagerDataStorage INSTANCE = new VillagerDataStorage(); private final Map data = new HashMap<>(); + private final List globalFavorites = new ArrayList<>(); private UUID lastInteractedUUID; private boolean dirty; @@ -78,6 +86,45 @@ public void toggleFavorite(int tradeIndex) } } + public void toggleGlobalFavorite(TradeOffer trade) + { + TradeType type = TradeType.of(trade); + + if (this.globalFavorites.contains(type)) + { + this.globalFavorites.remove(type); + } + else + { + this.globalFavorites.add(type); + } + + this.dirty = true; + } + + public FavoriteData getFavoritesForCurrentVillager(MerchantScreenHandler handler) + { + return this.getFavoritesForCurrentVillager(((IMerchantScreenHandler) handler).getOriginalList()); + } + + public FavoriteData getFavoritesForCurrentVillager(TradeOfferList originalTrades) + { + VillagerData data = this.getDataFor(this.lastInteractedUUID, false); + List favorites = data != null ? data.getFavorites() : null; + + if (favorites != null && favorites.isEmpty() == false) + { + return new FavoriteData(favorites, false); + } + + if (Configs.Generic.VILLAGER_TRADE_USE_GLOBAL_FAVORITES.getBooleanValue() && this.lastInteractedUUID != null) + { + return new FavoriteData(VillagerUtils.getGlobalFavoritesFor(originalTrades, this.globalFavorites), true); + } + + return new FavoriteData(Collections.emptyList(), favorites == null); + } + private void readFromNBT(CompoundTag nbt) { if (nbt == null || nbt.contains("VillagerData", Constants.NBT.TAG_LIST) == false) @@ -86,7 +133,7 @@ private void readFromNBT(CompoundTag nbt) } ListTag tagList = nbt.getList("VillagerData", Constants.NBT.TAG_COMPOUND); - final int count = tagList.size(); + int count = tagList.size(); for (int i = 0; i < count; i++) { @@ -98,18 +145,39 @@ private void readFromNBT(CompoundTag nbt) this.data.put(data.getUUID(), data); } } + + tagList = nbt.getList("GlobalFavorites", Constants.NBT.TAG_COMPOUND); + count = tagList.size(); + + for (int i = 0; i < count; i++) + { + CompoundTag tag = tagList.getCompound(i); + TradeType type = TradeType.fromTag(tag); + + if (type != null) + { + this.globalFavorites.add(type); + } + } } private CompoundTag writeToNBT(@Nonnull CompoundTag nbt) { - ListTag tagList = new ListTag(); + ListTag favoriteListData = new ListTag(); + ListTag globalFavoriteData = new ListTag(); for (VillagerData data : this.data.values()) { - tagList.add(data.toNBT()); + favoriteListData.add(data.toNBT()); + } + + for (TradeType type : this.globalFavorites) + { + globalFavoriteData.add(type.toTag()); } - nbt.put("VillagerData", tagList); + nbt.put("VillagerData", favoriteListData); + nbt.put("GlobalFavorites", globalFavoriteData); this.dirty = false; @@ -136,6 +204,7 @@ private File getSaveDir() public void readFromDisk() { this.data.clear(); + this.globalFavorites.clear(); try { diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java index 2ad14ed01..c6c83cbd1 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java @@ -1,6 +1,10 @@ package fi.dy.masa.itemscroller.villager; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; @@ -70,43 +74,78 @@ public static int getRealTradeIndexFor(int visibleIndex, MerchantScreenHandler h public static TradeOfferList buildCustomTradeList(TradeOfferList originalList) { - VillagerData data = VillagerDataStorage.getInstance().getDataForLastInteractionTarget(); + FavoriteData data = VillagerDataStorage.getInstance().getFavoritesForCurrentVillager(originalList); + List favorites = data.favorites; - if (data != null) + //System.out.printf("build - fav: %s (%s), or: %d\n", favorites, data.isGlobal, originalList.size()); + + // Some favorites defined + if (favorites.isEmpty() == false) { TradeOfferList list = new TradeOfferList(); - List favorites = data.getFavorites(); int originalListSize = originalList.size(); - // Some favorites defined - if (favorites.isEmpty() == false) + // First pick all the favorited recipes, in the order they are in the favorites list + for (int index : favorites) { - // First pick all the favorited recipes, in the order they are in the favorites list - for (int index : favorites) + if (index >= 0 && index < originalListSize) { - if (index >= 0 && index < originalListSize) - { - list.add(originalList.get(index)); - } + list.add(originalList.get(index)); } + } - // Then add the rest of the recipes in their original order - for (int i = 0; i < originalListSize; ++i) + // Then add the rest of the recipes in their original order + for (int i = 0; i < originalListSize; ++i) + { + if (favorites.contains(i) == false) { - if (favorites.contains(i) == false) - { - list.add(originalList.get(i)); - } + list.add(originalList.get(i)); } } - else - { - list.addAll(originalList); - } return list; } return originalList; } + + public static List getGlobalFavoritesFor(TradeOfferList originalTrades, Collection globalFavorites) + { + List favorites = new ArrayList<>(); + Map trades = new HashMap<>(); + final int size = originalTrades.size(); + + // Build a map from the trade types to the indices in the current villager's trade list + for (int i = 0; i < size; ++i) + { + TradeOffer trade = originalTrades.get(i); + trades.put(TradeType.of(trade), i); + } + + // Pick the trade list indices that are in the global favorites, in the order that they were global favorited + for (TradeType type : globalFavorites) + { + Integer index = trades.get(type); + + if (index != null) + { + favorites.add(index); + } + } + + /* This is a version that is not sorted based on the order of the global favorites + for (int i = 0; i < size; ++i) + { + TradeType type = TradeType.of(originalTrades.get(i)); + + if (globalFavorites.contains(type)) + { + favorites.add(i); + } + } + */ + //System.out.printf("getGlobalFavoritesFor - list: %s - or: %d | global: %s\n", favorites, originalTrades.size(), globalFavorites); + + return favorites; + } } diff --git a/src/main/resources/assets/itemscroller/textures/gui/gui_widgets.png b/src/main/resources/assets/itemscroller/textures/gui/gui_widgets.png index b522c0ae96b9f9599050603a8995f5f557e1edbe..33c8662bac2519915cbe27c67a7167af42ee6c79 100644 GIT binary patch delta 786 zcmV+t1MU2x3epOYIDZ8MNkl-D17>pkmdl>ko`z*AQlW<$H(j);g(r!&!zD*?t9fZ=a$0Vn|`E&yiRXaPKj z0>B2)paQ6G1P={&{fck+u>s6!0T_NJIs>3NX8?vD1u!QCaQG?8h=`qwNGACV6hK1? zU_EW!4SRJCaDVtI%JsBm(NF+QE`XhjNDkw+Tu)nZ7`J6a#Fx)mtf#FwzrJ<##|F@( z0;q2U^%MVU=yeh9QwBrS8){^*KPw)0F5kwY7_W3{6ibpTZ!RE z0W`b->YKpmdxjqcFb4$y3SiC)lidR!lf(lUlb{1Ulb{0&lT`yJlkfuslXC)6ll=k> z1Aqchlg-IDZ7xNkl1>6a_ zg@U_Wz@=Uz6UeFuP;k|jY8yPkbYVxvG>Ly8G|oH^h-k9<@cZUB@5JbQ+9^7_ts)|P zt?}19CnqOG%#r8$+~32j&5ex@@#EWV6otQ;bvGW5pZq+TOn(->H_!7TP1D4xvCIdX z|9u&aMll+VUi4liz_SJL+*OA4(ChUgBBI~#ziN{!0hShk&0pUFPy)QV09bFc1@ICI z00%&g3ZQxr%-h`6E56N-1E8S=VDs~;836T}0oeQ~fQA&na6gKOh@Y=aDP9FZhOn3p#bV!07uu64CB7&wzpy!_eDg+*Dq;w+govUckk+t1E5X? zP(28$6aRA4S2zE`c^;9b77n)nbt!;FPXZ3k^SHXZf4cd@2Z3+^)P4pqoBd@8M0g^A zTY%cm0Lsl>4*be1fAw|%6hMs&pt||XfnW7@p!#$GmVXw&@$s=$`H!+JTl#6gMX$|H z`yb2T?^6MI@hw1>WmaZ|E-x<^uJK?nSo&X?vrhpc9v%bUOtyId0y6+J08ju50Nz>vJMC5^NfLRU$JyDL6#{)6{Ax z0Gc=hNFt)$X~o6Gg%vRaph*Y7uiM{=Wmtcwr>DhaGO-W<0001!<^)t2&;)+~Iivk= T8@YKV00000NkvXXu0mjfBL-54 diff --git a/src/main/resources/assets/itemscroller/textures/xcf/gui_widgets.xcf b/src/main/resources/assets/itemscroller/textures/xcf/gui_widgets.xcf index 4a11ad733983f3c30de85744a9d562ba014c4139..13442e4e092d65c0f49fb1f073197b4c2db82a6f 100644 GIT binary patch delta 723 zcmZvaPe>F|9LK+Jwk7b8OiX_W3IZW$ad(n1!8SqbtcT_l(jjls!R#2M5_DLC%>^%Q zw5)<&ayJI*B6yp_>>*kbq>`So!V;_+ChVxYukWlo#J0`wc|3mKFW>Kb%*O}MOUB4! z`^juYjQ&ziBH>tGUgkZZ2orVXXwJTsm!8a{SS})lonw>qlqZYjDreFE+1j$~%jtg2 z-k$3d_nMl_x>*SrK~L4ny3)U;J2epA*X ze1SqxRI?(w&<`RgY!?3BNY|n3h0R^gnm78#*Otbzb*)F^^_d)2bts_(G-aYw#aahp z3bY-2Q`3v{_R5<(oll3+cm!7;oB(p;{H#|=Z$oO#eJ%F^cu#$Gf=rW_fMWrl*2osw z2iCa%>XI+yCplnF2f5&9i8FE3&O_bwPa5|Zdn(u6{qV50$Unpe|DbvoFy668C?dNK=I&d+jvFdA=X0$Hf*!6|7>Hcp)>P)%zGc-H{Z;>*T36-)Z51T zMOS&?qA;%ml|bGTkH^ej;MrxTYvTC1nI&LmnLg1bP`FLQG)Yf@QiZ-zohgUtB-!%L zL`_`%sl9C0%LJ}+1Dr)edxjTeToovn(>SUE9jJYyajrA8a7pHJTf$kHy6=oWDsIU7augY)L{x2Hm{;Mrlrp}0Kaa)$nb2~N6*p{#wcB`^wfmi%adxZaH z$E6<{$rMc8fEGH1gzj!lOfC3bkaEUL51iT3QTe9e3OT!A2-!0~Y{>Ndk;L7DXdZ%N z1P6e{Q~X( Date: Mon, 11 Jan 2021 20:49:42 +0200 Subject: [PATCH 067/107] Villager Trading: Minor clean-up --- .../mixin/MixinMerchantScreen.java | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java index b53748451..bb3ace026 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java @@ -146,27 +146,24 @@ private void renderFavoriteMarker(MatrixStack matrices, int mouseX, int mouseY, this.favoriteData = favoriteData; } - if (favoriteData.favorites.isEmpty() == false) - { - int numFavorites = favoriteData.favorites.size(); + int numFavorites = favoriteData.favorites.size(); - if (this.indexStartOffset < numFavorites) + if (numFavorites > 0 && this.indexStartOffset < numFavorites) + { + int screenX = (this.width - this.backgroundWidth) / 2; + int screenY = (this.height - this.backgroundHeight) / 2; + int buttonsStartX = screenX + 5; + int buttonsStartY = screenY + 16 + 2; + int x = buttonsStartX + 89 - 8; + int y = buttonsStartY + 2; + float z = this.getZOffset() + 300; + IGuiIcon icon = favoriteData.isGlobal ? ItemScrollerIcons.STAR_5_PURPLE : ItemScrollerIcons.STAR_5_YELLOW; + + for (int i = 0; i < (numFavorites - this.indexStartOffset); ++i) { - int screenX = (this.width - this.backgroundWidth) / 2; - int screenY = (this.height - this.backgroundHeight) / 2; - int buttonsStartX = screenX + 5; - int buttonsStartY = screenY + 16 + 2; - int x = buttonsStartX + 89 - 8; - int y = buttonsStartY + 2; - float z = this.getZOffset() + 300; - IGuiIcon icon = favoriteData.isGlobal ? ItemScrollerIcons.STAR_5_PURPLE : ItemScrollerIcons.STAR_5_YELLOW; - - for (int i = 0; i < (numFavorites - this.indexStartOffset); ++i) - { - RenderUtils.bindTexture(icon.getTexture()); - icon.renderAt(x, y, z, false, false); - y += 20; - } + RenderUtils.bindTexture(icon.getTexture()); + icon.renderAt(x, y, z, false, false); + y += 20; } } } From 961ab4179d80dc762e7d987b8670ebadea0c4e3d Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Mon, 11 Jan 2021 20:50:03 +0200 Subject: [PATCH 068/107] Villager Trading: Fix Wandering Traders not working properly --- src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index b43c3127f..0ddc10491 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -4,7 +4,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.entity.passive.VillagerEntity; +import net.minecraft.entity.passive.MerchantEntity; import net.minecraft.screen.slot.Slot; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.util.hit.HitResult; @@ -147,7 +147,7 @@ private boolean handleInputImpl(int keyCode, boolean keyState, double dWheel) if (GuiUtils.getCurrentScreen() == null && mc.crosshairTarget != null && mc.crosshairTarget.getType() == HitResult.Type.ENTITY && - ((EntityHitResult) mc.crosshairTarget).getEntity() instanceof VillagerEntity) + ((EntityHitResult) mc.crosshairTarget).getEntity() instanceof MerchantEntity) { storage.setLastInteractedUUID(((EntityHitResult) mc.crosshairTarget).getEntity().getUuid()); } From 5a5ae38c06b8feb6a9ca0a22e7f79e3d0b3648bb Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 4 Feb 2021 18:29:22 +0200 Subject: [PATCH 069/107] Update to MC 1.17 snapshot 21w05a (version bump) --- build.properties | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index a5d705c09..840f697f7 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17-snap-20w51a -minecraft_version = 20w51a -mappings_version = 20w51a+build.5 +minecraft_version_out = 1.17-snap-21w05a +minecraft_version = 21w05a +mappings_version = 21w05a+build.2 -fabric_loader_version = 0.10.8 +fabric_loader_version = 0.11.1 mod_menu_version = 1.15.0+build.1 From 6d16b6304f7b0f246ec17273b800fb47a4901127 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sun, 7 Mar 2021 00:07:40 +0200 Subject: [PATCH 070/107] Update to MC 1.17 snapshot 21w08b --- build.properties | 10 +++++----- .../fi/dy/masa/itemscroller/recipes/RecipePattern.java | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/build.properties b/build.properties index 840f697f7..638434e2b 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17-snap-21w05a -minecraft_version = 21w05a -mappings_version = 21w05a+build.2 +minecraft_version_out = 1.17-snap-21w08b +minecraft_version = 21w08b +mappings_version = 21w08b+build.20 -fabric_loader_version = 0.11.1 -mod_menu_version = 1.15.0+build.1 +fabric_loader_version = 0.11.2 +mod_menu_version = 2.0.0-beta.1+build.2 diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java index 383c75ad6..0b3c9d9f1 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java @@ -108,11 +108,11 @@ public void readFromNBT(@Nonnull CompoundTag nbt) if (slot >= 0 && slot < this.recipe.length) { - this.recipe[slot] = ItemStack.fromTag(tag); + this.recipe[slot] = ItemStack.fromNbt(tag); } } - this.result = ItemStack.fromTag(nbt.getCompound("Result")); + this.result = ItemStack.fromNbt(nbt.getCompound("Result")); } } @@ -122,7 +122,7 @@ public CompoundTag writeToNBT(@Nonnull CompoundTag nbt) if (this.isValid()) { CompoundTag tag = new CompoundTag(); - this.result.toTag(tag); + this.result.writeNbt(tag); nbt.putInt("Length", this.recipe.length); nbt.put("Result", tag); @@ -135,7 +135,7 @@ public CompoundTag writeToNBT(@Nonnull CompoundTag nbt) { tag = new CompoundTag(); tag.putInt("Slot", i); - this.recipe[i].toTag(tag); + this.recipe[i].writeNbt(tag); tagIngredients.add(tag); } } From 18214cc0188ca4520b57d5191db305f6e0c20ebb Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sun, 7 Mar 2021 20:42:04 +0200 Subject: [PATCH 071/107] The GUI blacklist check was missing from the hotkey handling --- .../java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 07d4ab3bb..b1d76c9f7 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -100,7 +100,9 @@ else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) return true; } - if (this.disabled || (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false) + if (this.disabled || + (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false || + Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName())) { return false; } From 441ee61cf0b3ecb808f9bc559ad24b3d520fc261 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sun, 4 Apr 2021 18:26:56 +0300 Subject: [PATCH 072/107] Update to MC 1.17 snapshot 21w13a --- build.properties | 8 +- .../masa/itemscroller/event/InputHandler.java | 4 +- .../event/RenderEventHandler.java | 60 +++----- .../mixin/IMixinScreenWithHandler.java | 4 +- .../mixin/MixinCraftingScreenHandler.java | 15 +- .../itemscroller/recipes/RecipePattern.java | 25 ++-- .../itemscroller/recipes/RecipeStorage.java | 23 ++- .../dy/masa/itemscroller/util/InputUtils.java | 2 +- .../itemscroller/util/InventoryUtils.java | 140 +++++++----------- 9 files changed, 118 insertions(+), 163 deletions(-) diff --git a/build.properties b/build.properties index 638434e2b..6ba2f24a8 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.21+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17-snap-21w08b -minecraft_version = 21w08b -mappings_version = 21w08b+build.20 +minecraft_version_out = 1.17-snap-21w13a +minecraft_version = 21w13a +mappings_version = 21w13a+build.43 -fabric_loader_version = 0.11.2 +fabric_loader_version = 0.11.3 mod_menu_version = 2.0.0-beta.1+build.2 diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index 4e492683a..3bdd6d1bf 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -165,11 +165,11 @@ else if (isPickBlock && InputUtils.isRecipeViewOpen() && InventoryUtils.isCrafti } } - InventoryUtils.checkForItemPickup(mc); + InventoryUtils.checkForItemPickup(gui); if (keyState && (isAttack || isUse)) { - InventoryUtils.storeSourceSlotCandidate(slot, mc); + InventoryUtils.storeSourceSlotCandidate(slot, gui); } if (Configs.Toggles.RIGHT_CLICK_CRAFT_STACK.getBooleanValue() && diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 832efdd45..b425a496d 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -1,17 +1,12 @@ package fi.dy.masa.itemscroller.event; -import java.nio.FloatBuffer; -import org.lwjgl.opengl.GL11; -import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; import net.minecraft.client.font.TextRenderer; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.render.DiffuseLighting; -import net.minecraft.client.util.GlAllocationUtils; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; -import net.minecraft.util.math.Vec3d; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; @@ -26,9 +21,6 @@ public class RenderEventHandler { private static final RenderEventHandler INSTANCE = new RenderEventHandler(); - private static final Vec3d LIGHT0_POS = (new Vec3d( 0.2D, 1.0D, -0.7D)).normalize(); - private static final Vec3d LIGHT1_POS = (new Vec3d(-0.2D, 1.0D, 0.7D)).normalize(); - private static final FloatBuffer FLOAT_BUFFER = GlAllocationUtils.allocateFloatBuffer(4); private static final MatrixStack FRESH_MATRIX_STACK = new MatrixStack(); private final MinecraftClient mc = MinecraftClient.getInstance(); @@ -59,9 +51,11 @@ public void onDrawBackgroundPost(MatrixStack matrixStack) this.calculateRecipePositions(gui); - RenderSystem.pushMatrix(); - RenderSystem.translatef(this.recipeListX, this.recipeListY, 0); - RenderSystem.scaled(this.scale, this.scale, 1); + matrixStack = RenderSystem.getModelViewStack(); + matrixStack.push(); + matrixStack.translate(this.recipeListX, this.recipeListY, 0); + matrixStack.scale((float) this.scale, (float) this.scale, 1); + RenderSystem.applyModelViewMatrix(); String str = StringUtils.translate("itemscroller.gui.label.recipe_page", (first / countPerPage) + 1, recipes.getTotalRecipeCount() / countPerPage); this.mc.textRenderer.draw(matrixStack, str, 16, -12, 0xC0C0C0C0); @@ -86,7 +80,8 @@ public void onDrawBackgroundPost(MatrixStack matrixStack) this.renderRecipeItems(recipe, recipes.getRecipeCountPerPage(), gui); } - RenderSystem.popMatrix(); + matrixStack.pop(); + RenderSystem.applyModelViewMatrix(); RenderSystem.enableBlend(); // Fixes the crafting book icon rendering } } @@ -103,8 +98,9 @@ public void onDrawScreenPost() final int recipeId = this.getHoveredRecipeId(mouseX, mouseY, recipes, gui); float offset = 300f; - RenderSystem.pushMatrix(); - RenderSystem.translatef(0f, 0f, offset); + MatrixStack matrixStack = RenderSystem.getModelViewStack(); + matrixStack.push(); + matrixStack.translate(0, 0, offset); if (recipeId >= 0) { @@ -122,7 +118,8 @@ else if (Configs.Generic.CRAFTING_RENDER_RECIPE_ITEMS.getBooleanValue()) } } - RenderSystem.popMatrix(); + matrixStack.pop(); + RenderSystem.applyModelViewMatrix(); } } @@ -206,17 +203,18 @@ private void renderStoredRecipeStack(ItemStack stack, int recipeId, int row, int int y = row * this.entryHeight; this.renderStackAt(stack, x, y, selected); - double scale = 0.75; + float scale = 0.75F; x = x - (int) (font.getWidth(indexStr) * scale) - 2; y = row * this.entryHeight + this.entryHeight / 2 - font.fontHeight / 2; - RenderSystem.pushMatrix(); - RenderSystem.translatef(x, y, 0); - RenderSystem.scaled(scale, scale, 0); + matrixStack = FRESH_MATRIX_STACK; + matrixStack.push(); + matrixStack.translate(x, y, 0); + matrixStack.scale(scale, scale, 1); - font.draw(matrixStack, indexStr, 0, 0, 0xC0C0C0); + font.draw(matrixStack, indexStr, 0, 0, 0xFFC0C0C0); - RenderSystem.popMatrix(); + matrixStack.pop(); } private void renderRecipeItems(RecipePattern recipe, int recipeCountPerPage, HandledScreen gui) @@ -272,26 +270,16 @@ private ItemStack getHoveredRecipeIngredient(int mouseX, int mouseY, RecipePatte private void renderStackAt(ItemStack stack, int x, int y, boolean border) { - RenderSystem.pushMatrix(); - final int w = 16; if (border) { // Draw a light/white border around the stack - RenderUtils.drawRect(x - 1, y - 1, w + 1, 1 , 0xFFFFFFFF); - RenderUtils.drawRect(x - 1, y , 1 , w + 1, 0xFFFFFFFF); - RenderUtils.drawRect(x + w, y - 1, 1 , w + 1, 0xFFFFFFFF); - RenderUtils.drawRect(x , y + w, w + 1, 1 , 0xFFFFFFFF); - - RenderUtils.drawRect(x, y, w, w, 0x20FFFFFF); // light background for the item - - } - else - { - RenderUtils.drawRect(x, y, w, w, 0x20FFFFFF); // light background for the item + RenderUtils.drawOutline(x - 1, y - 1, w + 2, w + 2, 0xFFFFFFFF); } + RenderUtils.drawRect(x, y, w, w, 0x20FFFFFF); // light background for the item + if (InventoryUtils.isStackEmpty(stack) == false) { DiffuseLighting.enableGuiDepthLighting(); @@ -302,10 +290,9 @@ private void renderStackAt(ItemStack stack, int x, int y, boolean border) this.mc.getItemRenderer().renderInGui(stack, x, y); this.mc.getItemRenderer().zOffset -= 100; } - - RenderSystem.popMatrix(); } + /* public static void enableGUIStandardItemLighting(float scale) { RenderSystem.pushMatrix(); @@ -351,4 +338,5 @@ private static FloatBuffer singletonBuffer(float val1, float val2, float val3, f return FLOAT_BUFFER; } + */ } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java index e963a407c..374b7c8d3 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java @@ -16,10 +16,10 @@ public interface IMixinScreenWithHandler @Accessor("focusedSlot") net.minecraft.screen.slot.Slot getHoveredSlot(); - @Accessor("x") + @Accessor("field_2776") // x int getGuiLeft(); - @Accessor("y") + @Accessor("field_2800") // y int getGuiTop(); @Accessor("backgroundWidth") diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingScreenHandler.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingScreenHandler.java index fef3cb178..8c274605b 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingScreenHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinCraftingScreenHandler.java @@ -6,6 +6,11 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.CraftingInventory; +import net.minecraft.inventory.CraftingResultInventory; +import net.minecraft.screen.ScreenHandler; +import net.minecraft.world.World; import fi.dy.masa.itemscroller.util.InventoryUtils; @Mixin(net.minecraft.screen.CraftingScreenHandler.class) @@ -23,11 +28,11 @@ private void onSlotChangedCraftingGrid(net.minecraft.inventory.Inventory invento @Inject(method = "updateResult", at = @At("RETURN")) private static void onUpdateResult( - int windowId, - net.minecraft.world.World world, - net.minecraft.entity.player.PlayerEntity player, - net.minecraft.inventory.CraftingInventory craftingInv, - net.minecraft.inventory.CraftingResultInventory resultInv, + ScreenHandler screenHandler, + World world, + PlayerEntity player, + CraftingInventory craftingInv, + CraftingResultInventory resultInv, CallbackInfo ci) { InventoryUtils.onSlotChangedCraftingGrid(player, craftingInv, resultInv); diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java index 0b3c9d9f1..66c0b3bd2 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipePattern.java @@ -1,10 +1,11 @@ package fi.dy.masa.itemscroller.recipes; +import java.util.Arrays; import javax.annotation.Nonnull; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtList; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.slot.Slot; import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; @@ -31,11 +32,7 @@ public void ensureRecipeSize(int size) public void clearRecipe() { - for (int i = 0; i < this.recipe.length; i++) - { - this.recipe[i] = InventoryUtils.EMPTY_STACK; - } - + Arrays.fill(this.recipe, InventoryUtils.EMPTY_STACK); this.result = InventoryUtils.EMPTY_STACK; } @@ -88,11 +85,11 @@ public void copyRecipeFrom(RecipePattern other) this.result = InventoryUtils.isStackEmpty(other.getResult()) == false ? other.getResult().copy() : InventoryUtils.EMPTY_STACK; } - public void readFromNBT(@Nonnull CompoundTag nbt) + public void readFromNBT(@Nonnull NbtCompound nbt) { if (nbt.contains("Result", Constants.NBT.TAG_COMPOUND) && nbt.contains("Ingredients", Constants.NBT.TAG_LIST)) { - ListTag tagIngredients = nbt.getList("Ingredients", Constants.NBT.TAG_COMPOUND); + NbtList tagIngredients = nbt.getList("Ingredients", Constants.NBT.TAG_COMPOUND); int count = tagIngredients.size(); int length = nbt.getInt("Length"); @@ -103,7 +100,7 @@ public void readFromNBT(@Nonnull CompoundTag nbt) for (int i = 0; i < count; i++) { - CompoundTag tag = tagIngredients.getCompound(i); + NbtCompound tag = tagIngredients.getCompound(i); int slot = tag.getInt("Slot"); if (slot >= 0 && slot < this.recipe.length) @@ -117,23 +114,23 @@ public void readFromNBT(@Nonnull CompoundTag nbt) } @Nonnull - public CompoundTag writeToNBT(@Nonnull CompoundTag nbt) + public NbtCompound writeToNBT(@Nonnull NbtCompound nbt) { if (this.isValid()) { - CompoundTag tag = new CompoundTag(); + NbtCompound tag = new NbtCompound(); this.result.writeNbt(tag); nbt.putInt("Length", this.recipe.length); nbt.put("Result", tag); - ListTag tagIngredients = new ListTag(); + NbtList tagIngredients = new NbtList(); for (int i = 0; i < this.recipe.length; i++) { if (InventoryUtils.isStackEmpty(this.recipe[i]) == false) { - tag = new CompoundTag(); + tag = new NbtCompound(); tag.putInt("Slot", i); this.recipe[i].writeNbt(tag); tagIngredients.add(tag); diff --git a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java index 9e07df679..c50f7e45f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/recipes/RecipeStorage.java @@ -5,9 +5,9 @@ import java.io.FileOutputStream; import javax.annotation.Nonnull; import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtIo; +import net.minecraft.nbt.NbtList; import net.minecraft.screen.slot.Slot; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.Reference; @@ -120,7 +120,7 @@ public void clearRecipe(int index) this.dirty = true; } - private void readFromNBT(CompoundTag nbt) + private void readFromNBT(NbtCompound nbt) { if (nbt == null || nbt.contains("Recipes", Constants.NBT.TAG_LIST) == false) { @@ -132,12 +132,12 @@ private void readFromNBT(CompoundTag nbt) this.recipes[i].clearRecipe(); } - ListTag tagList = nbt.getList("Recipes", Constants.NBT.TAG_COMPOUND); + NbtList tagList = nbt.getList("Recipes", Constants.NBT.TAG_COMPOUND); int count = tagList.size(); for (int i = 0; i < count; i++) { - CompoundTag tag = tagList.getCompound(i); + NbtCompound tag = tagList.getCompound(i); int index = tag.getByte("RecipeIndex"); @@ -150,15 +150,15 @@ private void readFromNBT(CompoundTag nbt) this.changeSelectedRecipe(nbt.getByte("Selected")); } - private CompoundTag writeToNBT(@Nonnull CompoundTag nbt) + private NbtCompound writeToNBT(@Nonnull NbtCompound nbt) { - ListTag tagRecipes = new ListTag(); + NbtList tagRecipes = new NbtList(); for (int i = 0; i < this.recipes.length; i++) { if (this.recipes[i].isValid()) { - CompoundTag tag = new CompoundTag(); + NbtCompound tag = new NbtCompound(); tag.putByte("RecipeIndex", (byte) i); this.recipes[i].writeToNBT(tag); tagRecipes.add(tag); @@ -224,11 +224,6 @@ public void writeToDisk() { File saveDir = this.getSaveDir(); - if (saveDir == null) - { - return; - } - if (saveDir.exists() == false) { if (saveDir.mkdirs() == false) @@ -241,7 +236,7 @@ public void writeToDisk() File fileTmp = new File(saveDir, this.getFileName() + ".tmp"); File fileReal = new File(saveDir, this.getFileName()); FileOutputStream os = new FileOutputStream(fileTmp); - NbtIo.writeCompressed(this.writeToNBT(new CompoundTag()), os); + NbtIo.writeCompressed(this.writeToNBT(new NbtCompound()), os); os.close(); if (fileReal.exists()) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index d6085d702..4f11c8e06 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -21,7 +21,7 @@ public static boolean isRecipeViewOpen() public static boolean canShiftDropItems(HandledScreen gui, MinecraftClient mc, int mouseX, int mouseY) { - if (InventoryUtils.isStackEmpty(mc.player.getInventory().getCursorStack()) == false) + if (InventoryUtils.isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { int left = AccessorUtils.getGuiLeft(gui); int top = AccessorUtils.getGuiTop(gui); diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 08b969728..649b5d8fa 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -152,8 +152,7 @@ private static boolean inventoryExistsAbove(Slot slot, ScreenHandler container) public static boolean canShiftPlaceItems(HandledScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); - MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stackCursor = mc.player.getInventory().getCursorStack(); + ItemStack stackCursor = gui.getScreenHandler().getCursorStack(); // The target slot needs to be an empty, valid slot, and there needs to be items in the cursor return slot != null && isStackEmpty(stackCursor) == false && isValidSlot(slot, gui, false) && @@ -163,10 +162,9 @@ public static boolean canShiftPlaceItems(HandledScreen public static boolean tryMoveItems(HandledScreen gui, RecipeStorage recipes, boolean scrollingUp) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); - MinecraftClient mc = MinecraftClient.getInstance(); // We require an empty cursor - if (slot == null || isStackEmpty(mc.player.getInventory().getCursorStack()) == false) + if (slot == null || isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { return false; } @@ -254,7 +252,7 @@ else if (getStackSize(stack) < slot.getMaxItemCount(stack)) public static boolean dragMoveItems(HandledScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) { - if (isStackEmpty(mc.player.getInventory().getCursorStack()) == false) + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { // Updating these here is part of the fix to preventing a drag after shift + place lastPosX = mouseX; @@ -542,7 +540,7 @@ public static void dropStacks(HandledScreen gui, ItemSt public static boolean shiftDropItems(HandledScreen gui) { - ItemStack stackReference = MinecraftClient.getInstance().player.getInventory().getCursorStack(); + ItemStack stackReference = gui.getScreenHandler().getCursorStack(); if (isStackEmpty(stackReference) == false && sourceSlot != null) { @@ -576,12 +574,12 @@ public static boolean shiftPlaceItems(Slot slot, HandledScreen gui) { // Left or right mouse button was pressed if (slot != null) { - ItemStack stackCursor = mc.player.getInventory().getCursorStack(); + ItemStack stackCursor = gui.getScreenHandler().getCursorStack(); ItemStack stack = EMPTY_STACK; if (isStackEmpty(stackCursor) == false) @@ -601,9 +599,9 @@ public static void storeSourceSlotCandidate(Slot slot, MinecraftClient mc) /** * Check if the (previous) mouse event resulted in picking up a new ItemStack to the cursor */ - public static void checkForItemPickup(MinecraftClient mc) + public static void checkForItemPickup(HandledScreen gui) { - ItemStack stackCursor = mc.player.getInventory().getCursorStack(); + ItemStack stackCursor = gui.getScreenHandler().getCursorStack(); // Picked up or swapped items to the cursor, grab a reference to the slot that the items came from // Note that we are only checking the item here! @@ -656,7 +654,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, HandledScree ScreenHandler container = gui.getScreenHandler(); MinecraftClient mc = MinecraftClient.getInstance(); - if (isStackEmpty(mc.player.getInventory().getCursorStack()) == false || slot.canTakeItems(mc.player) == false || + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false || slot.canTakeItems(mc.player) == false || (getStackSize(stackOrig) > 1 && slot.canInsert(stackOrig) == false)) { return false; @@ -717,7 +715,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc // Take half of the items from the original slot to the cursor rightClickSlot(gui, slot.id); - ItemStack stackInCursor = player.getInventory().getCursorStack(); + ItemStack stackInCursor = gui.getScreenHandler().getCursorStack(); if (isStackEmpty(stackInCursor)) { return false; @@ -741,7 +739,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc // Try to put one item into the temporary slot rightClickSlot(gui, slotTmp.id); - stackInCursor = player.getInventory().getCursorStack(); + stackInCursor = gui.getScreenHandler().getCursorStack(); // Successfully stored one item if (isStackEmpty(stackInCursor) || getStackSize(stackInCursor) < stackInCursorSizeOrig) @@ -753,7 +751,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc } } - if (isStackEmpty(player.getInventory().getCursorStack()) == false) + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { // Return the rest of the items into the original slot leftClickSlot(gui, slot.id); @@ -772,7 +770,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc rightClickSlot(gui, slot.id); // Return the rest of the items to the temporary slot, if any - if (isStackEmpty(player.getInventory().getCursorStack()) == false) + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { leftClickSlot(gui, tempSlotNum); } @@ -802,7 +800,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc for (int slotNum : slots) { Slot slotTmp = gui.getScreenHandler().getSlot(slotNum); - stackInCursor = player.getInventory().getCursorStack(); + stackInCursor = gui.getScreenHandler().getCursorStack(); if (isStackEmpty(stackInCursor)) { @@ -1243,11 +1241,9 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slo private static void fillCraftingGrid(HandledScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { ScreenHandler container = gui.getScreenHandler(); - MinecraftClient mc = MinecraftClient.getInstance(); - PlayerEntity player = mc.player; - int slotNum = -1; + int slotNum; int slotReturn = -1; - int sizeOrig = 0; + int sizeOrig; if (isStackEmpty(ingredientReference)) { @@ -1272,14 +1268,14 @@ private static void fillCraftingGrid(HandledScreen gui, // Pick up the ingredient stack from the found slot leftClickSlot(gui, slotNum); - ItemStack stackCursor = player.getInventory().getCursorStack(); + ItemStack stackCursor = gui.getScreenHandler().getCursorStack(); // Successfully picked up ingredient items if (areStacksEqual(ingredientReference, stackCursor)) { sizeOrig = getStackSize(stackCursor); dragSplitItemsIntoSlots(gui, targetSlots); - stackCursor = player.getInventory().getCursorStack(); + stackCursor = gui.getScreenHandler().getCursorStack(); // Items left in cursor if (isStackEmpty(stackCursor) == false) @@ -1294,7 +1290,7 @@ private static void fillCraftingGrid(HandledScreen gui, leftClickSlot(gui, slotReturn); // All of them didn't fit into the first slot anymore, switch into the current source slot - if (isStackEmpty(player.getInventory().getCursorStack()) == false) + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { slotReturn = slotNum; leftClickSlot(gui, slotReturn); @@ -1309,14 +1305,14 @@ private static void fillCraftingGrid(HandledScreen gui, } // Somehow items were left in the cursor, break here - if (isStackEmpty(player.getInventory().getCursorStack()) == false) + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { break; } } // Return the rest of the items to the original slot - if (slotNum >= 0 && isStackEmpty(player.getInventory().getCursorStack()) == false) + if (slotNum >= 0 && isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { leftClickSlot(gui, slotNum); } @@ -1325,9 +1321,7 @@ private static void fillCraftingGrid(HandledScreen gui, public static void rightClickCraftOneStack(HandledScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); - MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.getInventory(); - ItemStack stackCursor = inv.getCursorStack(); + ItemStack stackCursor = gui.getScreenHandler().getCursorStack(); if (slot == null || slot.hasStack() == false || (isStackEmpty(stackCursor) == false) && areStacksEqual(slot.getStack(), stackCursor) == false) @@ -1340,7 +1334,7 @@ public static void rightClickCraftOneStack(HandledScreen gui, List targetSlots, int startIndex) { - MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stackInCursor = mc.player.getInventory().getCursorStack(); + ItemStack stackInCursor = gui.getScreenHandler().getCursorStack(); if (isStackEmpty(stackInCursor)) { @@ -1457,8 +1450,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(HandledScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) { ScreenHandler container = gui.getScreenHandler(); - MinecraftClient mc = MinecraftClient.getInstance(); int index = 0; int slotNum = -1; int slotCount = targetSlots.size(); @@ -1494,7 +1485,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(HandledScreen= 0 && isStackEmpty(mc.player.getInventory().getCursorStack()) == false) + if (slotNum >= 0 && isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { leftClickSlot(gui, slotNum); } @@ -1521,14 +1512,11 @@ private static void moveOneRecipeItemIntoCraftingGrid(HandledScreen gui, List slotNumbers) { - MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.getInventory(); - for (int slotNum : slotNumbers) { leftClickSlot(gui, slotNum); - if (isStackEmpty(inv.getCursorStack())) + if (isStackEmpty(gui.getScreenHandler().getCursorStack())) { return true; } @@ -1593,10 +1581,6 @@ private static int getSlotNumberOfLargestMatchingStackFromDifferentInventory(Scr * Returns the slot number of the slot that has the smallest stackSize that is still equal to or larger * than idealSize. The slot must also NOT be in the same inventory as slotReference. * If an adequately large stack is not found, then the largest one is selected. - * @param container - * @param slotReference - * @param stackReference - * @return */ private static int getSlotNumberOfSmallestStackFromDifferentInventory(ScreenHandler container, Slot slotReference, ItemStack stackReference, int idealSize) { @@ -1659,7 +1643,7 @@ private static List getSlotNumbersOfMatchingStacks( ScreenHandler container, Slot slotReference, boolean sameInventory, ItemStack stackReference, boolean preferPartial, boolean treatHotbarAsDifferent, boolean reverse) { - List slots = new ArrayList(64); + List slots = new ArrayList<>(64); final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; @@ -1687,7 +1671,7 @@ private static List getSlotNumbersOfMatchingStacks( private static List getSlotNumbersOfMatchingStacks(ScreenHandler container, ItemStack stackReference, boolean preferPartial) { - List slots = new ArrayList(64); + List slots = new ArrayList<>(64); final int maxSlot = container.slots.size() - 1; for (int i = 0; i <= maxSlot; ++i) @@ -1713,7 +1697,7 @@ private static List getSlotNumbersOfMatchingStacks(ScreenHandler contai private static List getSlotNumbersOfEmptySlots( ScreenHandler container, Slot slotReference, boolean sameInventory, boolean treatHotbarAsDifferent, boolean reverse) { - List slots = new ArrayList(64); + List slots = new ArrayList<>(64); final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; @@ -1733,7 +1717,7 @@ private static List getSlotNumbersOfEmptySlots( private static List getSlotNumbersOfEmptySlotsInPlayerInventory(ScreenHandler container, boolean reverse) { - List slots = new ArrayList(64); + List slots = new ArrayList<>(64); final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; @@ -1847,12 +1831,10 @@ private void clickSlotsToMoveItems(Slot slot, ContainerScreen gui, boolean toOtherInventory) { - MinecraftClient mc = MinecraftClient.getInstance(); - PlayerEntity player = mc.player; // Left click to pick up the found source stack leftClickSlot(gui, slotFrom.id); - if (isStackEmpty(player.getInventory().getCursorStack())) + if (isStackEmpty(gui.getScreenHandler().getCursorStack())) { return; } @@ -1862,20 +1844,20 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, HandledScreen gui, int slotFrom, int slotTo) { //System.out.println("clickSlotsToMoveSingleItem(from: " + slotFrom + ", to: " + slotTo + ")"); - MinecraftClient mc = MinecraftClient.getInstance(); ItemStack stack = gui.getScreenHandler().slots.get(slotFrom).getStack(); if (isStackEmpty(stack)) @@ -1907,7 +1888,7 @@ private static boolean clickSlotsToMoveSingleItem(HandledScreen gui, int slotFrom) { - MinecraftClient mc = MinecraftClient.getInstance(); Slot slot = gui.getScreenHandler().slots.get(slotFrom); ItemStack stack = slot.getStack(); @@ -1948,7 +1928,7 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(HandledScreen gui, int slotFrom, int slotTo) { - MinecraftClient mc = MinecraftClient.getInstance(); - PlayerEntity player = mc.player; //System.out.println("clickSlotsToMoveItems(from: " + slotFrom + ", to: " + slotTo + ")"); // Left click to take items leftClickSlot(gui, slotFrom); // Couldn't take the items, bail out now - if (isStackEmpty(player.getInventory().getCursorStack())) + if (isStackEmpty(gui.getScreenHandler().getCursorStack())) { return false; } boolean ret = true; - int size = getStackSize(player.getInventory().getCursorStack()); + int size = getStackSize(gui.getScreenHandler().getCursorStack()); // Left click on the target slot to put the items to it leftClickSlot(gui, slotTo); // If there are items left in the cursor, then return them back to the original slot - if (isStackEmpty(player.getInventory().getCursorStack()) == false) + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { - ret = getStackSize(player.getInventory().getCursorStack()) != size; + ret = getStackSize(gui.getScreenHandler().getCursorStack()) != size; // Left click again on the from-slot to return the rest of the items to it leftClickSlot(gui, slotFrom); @@ -2039,10 +2017,8 @@ private static boolean shiftClickSlotWithCheck(HandledScreen gui, Slot slot, boolean moveUp, MoveAmount amount) { - MinecraftClient mc = MinecraftClient.getInstance(); - // We require an empty cursor - if (slot == null || isStackEmpty(mc.player.getInventory().getCursorStack()) == false) + if (slot == null || isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { return false; } @@ -2099,8 +2075,6 @@ private static void moveMatchingStacksToSlots(HandledScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) { - MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.getInventory(); Slot lastSlot = null; // Empty slot, nothing to do @@ -2120,15 +2094,15 @@ private static Slot moveStackToSlots(HandledScreen gui, for (int slotNum : slotsTo) { // Empty cursor, all done here - if (isStackEmpty(inv.getCursorStack())) + if (isStackEmpty(gui.getScreenHandler().getCursorStack())) { break; } Slot dstSlot = gui.getScreenHandler().getSlot(slotNum); - if (dstSlot.canInsert(inv.getCursorStack()) && - (dstSlot.hasStack() == false || areStacksEqual(dstSlot.getStack(), inv.getCursorStack()))) + if (dstSlot.canInsert(gui.getScreenHandler().getCursorStack()) && + (dstSlot.hasStack() == false || areStacksEqual(dstSlot.getStack(), gui.getScreenHandler().getCursorStack()))) { leftClickSlot(gui, slotNum); lastSlot = dstSlot; @@ -2136,7 +2110,7 @@ private static Slot moveStackToSlots(HandledScreen gui, } // Return the rest of the items, if any - if (isStackEmpty(inv.getCursorStack()) == false) + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { leftClickSlot(gui, slotFrom.id); } @@ -2146,23 +2120,20 @@ private static Slot moveStackToSlots(HandledScreen gui, private static void moveOneItemToFirstValidSlot(HandledScreen gui, Slot slotFrom, List slotsTo) { - MinecraftClient mc = MinecraftClient.getInstance(); - PlayerInventory inv = mc.player.getInventory(); - // Pick up half of the the stack rightClickSlot(gui, slotFrom.id); - if (isStackEmpty(inv.getCursorStack())) + if (isStackEmpty(gui.getScreenHandler().getCursorStack())) { return; } - int sizeOrig = getStackSize(inv.getCursorStack()); + int sizeOrig = getStackSize(gui.getScreenHandler().getCursorStack()); for (int slotNum : slotsTo) { rightClickSlot(gui, slotNum); - ItemStack stackCursor = inv.getCursorStack(); + ItemStack stackCursor = gui.getScreenHandler().getCursorStack(); if (isStackEmpty(stackCursor) || getStackSize(stackCursor) != sizeOrig) { @@ -2171,7 +2142,7 @@ private static void moveOneItemToFirstValidSlot(HandledScreen getVerticallyFurthestSuitableSlotsForStackInSlot(Sc public static void tryClearCursor(HandledScreen gui, MinecraftClient mc) { - ItemStack stackCursor = mc.player.getInventory().getCursorStack(); + ItemStack stackCursor = gui.getScreenHandler().getCursorStack(); if (isStackEmpty(stackCursor) == false) { @@ -2239,13 +2210,13 @@ public static void tryClearCursor(HandledScreen gui, Mi } leftClickSlot(gui, slotNum); - stackCursor = mc.player.getInventory().getCursorStack(); + stackCursor = gui.getScreenHandler().getCursorStack(); } } } } - if (isStackEmpty(mc.player.getInventory().getCursorStack()) == false) + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { dropItemsFromCursor(gui); } @@ -2399,8 +2370,7 @@ public static void swapSlots(HandledScreen gui, int slo private static void dragSplitItemsIntoSlots(HandledScreen gui, List targetSlots) { - MinecraftClient mc = MinecraftClient.getInstance(); - ItemStack stackInCursor = mc.player.getInventory().getCursorStack(); + ItemStack stackInCursor = gui.getScreenHandler().getCursorStack(); if (isStackEmpty(stackInCursor)) { From 52e1924377656f93f8ea695e76baf536323bacf3 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 1 Jun 2021 19:37:53 +0300 Subject: [PATCH 073/107] Bump malilib version dependency --- build.properties | 2 +- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index 6ba2f24a8..d5d6db928 100644 --- a/build.properties +++ b/build.properties @@ -9,7 +9,7 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.21+beta.1 +malilib_version = 0.10.0-dev.22+beta.1 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.17-snap-21w13a diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d045c0a49..f8f2cf1f8 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,6 +33,6 @@ ], "depends": { - "malilib": ">=0.10.0-dev.21" + "malilib": ">=0.10.0-dev.22" } } From e130e4a6966485571e0bfe0d7e69cf8003189537 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 2 Jun 2021 00:53:23 +0300 Subject: [PATCH 074/107] Update Mod Menu to the new package and maven --- build.gradle | 7 +++---- build.properties | 2 +- .../dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java | 4 ++-- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build.gradle b/build.gradle index 8dfc2b597..1849dde08 100644 --- a/build.gradle +++ b/build.gradle @@ -21,9 +21,8 @@ plugins { */ repositories { - maven { - url 'https://masa.dy.fi/maven' - } + maven { url 'https://masa.dy.fi/maven' } + maven { url 'https://maven.terraformersmc.com/releases/' } } sourceCompatibility = JavaVersion.VERSION_1_8 @@ -48,7 +47,7 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. //modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version - modCompileOnly "io.github.prospector:modmenu:" + config.mod_menu_version + modCompileOnly "com.terraformersmc:modmenu:${config.mod_menu_version}" } minecraft { diff --git a/build.properties b/build.properties index d5d6db928..bb12d7c92 100644 --- a/build.properties +++ b/build.properties @@ -17,4 +17,4 @@ minecraft_version = 21w13a mappings_version = 21w13a+build.43 fabric_loader_version = 0.11.3 -mod_menu_version = 2.0.0-beta.1+build.2 +mod_menu_version = 2.0.0-beta.4 diff --git a/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java index de58e4030..855d80ba7 100644 --- a/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java +++ b/src/main/java/fi/dy/masa/itemscroller/compat/modmenu/ModMenuImpl.java @@ -1,8 +1,8 @@ package fi.dy.masa.itemscroller.compat.modmenu; +import com.terraformersmc.modmenu.api.ConfigScreenFactory; +import com.terraformersmc.modmenu.api.ModMenuApi; import fi.dy.masa.itemscroller.gui.GuiConfigs; -import io.github.prospector.modmenu.api.ConfigScreenFactory; -import io.github.prospector.modmenu.api.ModMenuApi; public class ModMenuImpl implements ModMenuApi { From cbd8347ec081528459925618ce87ba20f1a67c48 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 1 Jun 2021 23:38:50 +0300 Subject: [PATCH 075/107] Update to MC 1.17 snapshot 21w18a (version bump) --- build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.properties b/build.properties index bb12d7c92..0927f4518 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.22+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17-snap-21w13a -minecraft_version = 21w13a -mappings_version = 21w13a+build.43 +minecraft_version_out = 1.17-snap-21w18a +minecraft_version = 21w18a +mappings_version = 21w18a+build.10 fabric_loader_version = 0.11.3 mod_menu_version = 2.0.0-beta.4 From 10aa09a3e02235789d3adbdeaee45fae263a8b38 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 3 Jun 2021 03:33:24 +0300 Subject: [PATCH 076/107] Update to MC 1.17-pre4 --- build.gradle | 63 ++++++------------- build.properties | 8 +-- gradle/wrapper/gradle-wrapper.properties | 2 +- gradlew | 0 .../mixin/IMixinScreenWithHandler.java | 4 +- src/main/resources/mixins.itemscroller.json | 2 +- 6 files changed, 26 insertions(+), 53 deletions(-) mode change 100644 => 100755 gradlew diff --git a/build.gradle b/build.gradle index 1849dde08..6b26c5e46 100644 --- a/build.gradle +++ b/build.gradle @@ -1,33 +1,15 @@ -buildscript { - repositories { - jcenter() - maven { - name = "Fabric" - url = "https://maven.fabricmc.net/" - } - } - dependencies { - classpath 'net.fabricmc:fabric-loom:0.5-SNAPSHOT' - } -} - -apply plugin: "fabric-loom" - -/* plugins { - id 'fabric-loom' version '0.2.6-SNAPSHOT' - id 'maven-publish' + id 'fabric-loom' version '0.8-SNAPSHOT' } -*/ + +sourceCompatibility = JavaVersion.VERSION_16 +targetCompatibility = JavaVersion.VERSION_16 repositories { maven { url 'https://masa.dy.fi/maven' } maven { url 'https://maven.terraformersmc.com/releases/' } } -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 - ext.configFile = file "build.properties" configFile.withReader { @@ -39,10 +21,10 @@ configFile.withReader { dependencies { minecraft "com.mojang:minecraft:${config.minecraft_version}" mappings "net.fabricmc:yarn:${config.mappings_version}:v2" - modCompile "net.fabricmc:fabric-loader:${config.fabric_loader_version}" - compile "com.google.code.findbugs:jsr305:3+" + modImplementation "net.fabricmc:fabric-loader:${config.fabric_loader_version}" + implementation "com.google.code.findbugs:jsr305:3+" - modCompile "fi.dy.masa.malilib:malilib-fabric-${config.minecraft_version_out}:${config.malilib_version}" + modImplementation "fi.dy.masa.malilib:malilib-fabric-${config.minecraft_version_out}:${config.malilib_version}" // Fabric API. This is technically optional, but you probably want it anyway. //modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version @@ -58,41 +40,32 @@ minecraft { } } -compileJava { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - options.encoding = 'UTF-8' -} - group = config.group + "." + config.mod_id archivesBaseName = config.mod_file_name + '-' + config.minecraft_version_out version = project.minecraft.mod_version -processResources -{ +processResources { // Exclude the GIMP image files exclude '**/*.xcf' exclude '**/xcf' // this will ensure that this task is redone when the versions change. - //inputs.property "mod_version", project.minecraft.mod_version //inputs.property "minecraft_version", project.config.minecraft_version inputs.property "mod_version", project.minecraft.mod_version - from(sourceSets.main.resources.srcDirs) { - include "fabric.mod.json" + filesMatching("fabric.mod.json") { expand "mod_version": project.minecraft.mod_version } - - from(sourceSets.main.resources.srcDirs) { - exclude "fabric.mod.json" - } } -// ensure that the encoding is set to UTF-8, no matter what the system default is -// this fixes some edge cases with special characters not displaying correctly -// see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html -tasks.withType(JavaCompile) { - options.encoding = "UTF-8" +tasks.withType(JavaCompile).configureEach { + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // Minecraft 1.17 (21w19a) upwards uses Java 16. + it.options.release = 16 } diff --git a/build.properties b/build.properties index 0927f4518..6fd60eb7c 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.22+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17-snap-21w18a -minecraft_version = 21w18a -mappings_version = 21w18a+build.10 +minecraft_version_out = 1.17-pre4 +minecraft_version = 1.17-pre4 +mappings_version = 1.17-pre4+build.1 fabric_loader_version = 0.11.3 -mod_menu_version = 2.0.0-beta.4 +mod_menu_version = 2.0.0-beta.7 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 24635041d..0fa7a672f 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip diff --git a/gradlew b/gradlew old mode 100644 new mode 100755 diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java index 374b7c8d3..e963a407c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java @@ -16,10 +16,10 @@ public interface IMixinScreenWithHandler @Accessor("focusedSlot") net.minecraft.screen.slot.Slot getHoveredSlot(); - @Accessor("field_2776") // x + @Accessor("x") int getGuiLeft(); - @Accessor("field_2800") // y + @Accessor("y") int getGuiTop(); @Accessor("backgroundWidth") diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 98aecaf28..70848ef2d 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -1,7 +1,7 @@ { "required": true, "package": "fi.dy.masa.itemscroller.mixin", - "compatibilityLevel": "JAVA_8", + "compatibilityLevel": "JAVA_16", "minVersion": "0.7", "client": [ "IMixinMerchantScreen", From 854cb8de5f7a51ff7ed859de0bb77fb0c5c05dfa Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 3 Jun 2021 14:06:58 +0300 Subject: [PATCH 077/107] Update the merged temp features to 1.17 --- .../MixinClientPlayerInteractionManager.java | 6 +++--- .../mixin/MixinMerchantScreen.java | 4 ++-- .../masa/itemscroller/villager/TradeType.java | 8 ++++---- .../itemscroller/villager/VillagerData.java | 20 +++++++++---------- .../villager/VillagerDataStorage.java | 20 +++++++++---------- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java index 2cd90b395..39e1d160f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java @@ -4,6 +4,7 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayerInteractionManager; @@ -15,12 +16,11 @@ public class MixinClientPlayerInteractionManager { @Inject(method = "clickSlot", at = @At("HEAD"), cancellable = true) - private void cancelWindowClicksWhileReplayingBufferedPackets(CallbackInfoReturnable cir) + private void cancelWindowClicksWhileReplayingBufferedPackets(CallbackInfo ci) { if (ClickPacketBuffer.shouldCancelWindowClicks()) { - // The return value isn't actually used for anything on the client side - cir.setReturnValue(ItemStack.EMPTY); + ci.cancel(); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java index bb3ace026..94e629ed9 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java @@ -132,8 +132,8 @@ private void fixRecipeIndex(CallbackInfo ci) } } - @Inject(method = "render", at = @At(value = "INVOKE", - target = "Lcom/mojang/blaze3d/systems/RenderSystem;popMatrix()V")) + @Inject(method = "render", at = @At(value = "FIELD", + target = "Lnet/minecraft/client/gui/screen/ingame/MerchantScreen;offers:[Lnet/minecraft/client/gui/screen/ingame/MerchantScreen$WidgetButtonPage;")) private void renderFavoriteMarker(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue()) diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/TradeType.java b/src/main/java/fi/dy/masa/itemscroller/villager/TradeType.java index ac018be2a..c5938a034 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/TradeType.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/TradeType.java @@ -4,7 +4,7 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.NbtCompound; import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; import net.minecraft.village.TradeOffer; @@ -34,9 +34,9 @@ public boolean matchesTrade(TradeOffer trade) return this.buyItem1 == buyItem1 && this.buyItem2 == buyItem2 && this.sellItem == sellItem; } - public CompoundTag toTag() + public NbtCompound toTag() { - CompoundTag tag = new CompoundTag(); + NbtCompound tag = new NbtCompound(); tag.putString("Buy1", Registry.ITEM.getId(this.buyItem1).toString()); tag.putString("Buy2", Registry.ITEM.getId(this.buyItem2).toString()); @@ -46,7 +46,7 @@ public CompoundTag toTag() } @Nullable - public static TradeType fromTag(CompoundTag tag) + public static TradeType fromTag(NbtCompound tag) { Item buy1 = getItemForName(tag.getString("Buy1")); Item buy2 = getItemForName(tag.getString("Buy2")); diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java index d80b3c4fa..d8d36d950 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java @@ -4,15 +4,15 @@ import java.util.List; import java.util.UUID; import javax.annotation.Nullable; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.IntTag; -import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtInt; +import net.minecraft.nbt.NbtList; import fi.dy.masa.itemscroller.util.Constants; public class VillagerData { private final UUID uuid; - private List favorites = new ArrayList<>(); + private final List favorites = new ArrayList<>(); private int tradeListPosition; VillagerData(UUID uuid) @@ -52,19 +52,19 @@ List getFavorites() return this.favorites; } - public CompoundTag toNBT() + public NbtCompound toNBT() { - CompoundTag tag = new CompoundTag(); + NbtCompound tag = new NbtCompound(); tag.putLong("UUIDM", this.uuid.getMostSignificantBits()); tag.putLong("UUIDL", this.uuid.getLeastSignificantBits()); tag.putInt("ListPosition", this.tradeListPosition); - ListTag tagList = new ListTag(); + NbtList tagList = new NbtList(); for (Integer val : this.favorites) { - tagList.add(IntTag.of(val)); + tagList.add(NbtInt.of(val)); } tag.put("Favorites", tagList); @@ -73,12 +73,12 @@ public CompoundTag toNBT() } @Nullable - public static VillagerData fromNBT(CompoundTag tag) + public static VillagerData fromNBT(NbtCompound tag) { if (tag.contains("UUIDM", Constants.NBT.TAG_LONG) && tag.contains("UUIDL", Constants.NBT.TAG_LONG)) { VillagerData data = new VillagerData(new UUID(tag.getLong("UUIDM"), tag.getLong("UUIDL"))); - ListTag tagList = tag.getList("Favorites", Constants.NBT.TAG_INT); + NbtList tagList = tag.getList("Favorites", Constants.NBT.TAG_INT); final int count = tagList.size(); data.favorites.clear(); diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java index 124a0a8f8..b8a24ffc5 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java @@ -11,9 +11,9 @@ import java.util.UUID; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; +import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtIo; +import net.minecraft.nbt.NbtList; import net.minecraft.screen.MerchantScreenHandler; import net.minecraft.village.TradeOffer; import net.minecraft.village.TradeOfferList; @@ -125,19 +125,19 @@ public FavoriteData getFavoritesForCurrentVillager(TradeOfferList originalTrades return new FavoriteData(Collections.emptyList(), favorites == null); } - private void readFromNBT(CompoundTag nbt) + private void readFromNBT(NbtCompound nbt) { if (nbt == null || nbt.contains("VillagerData", Constants.NBT.TAG_LIST) == false) { return; } - ListTag tagList = nbt.getList("VillagerData", Constants.NBT.TAG_COMPOUND); + NbtList tagList = nbt.getList("VillagerData", Constants.NBT.TAG_COMPOUND); int count = tagList.size(); for (int i = 0; i < count; i++) { - CompoundTag tag = tagList.getCompound(i); + NbtCompound tag = tagList.getCompound(i); VillagerData data = VillagerData.fromNBT(tag); if (data != null) @@ -151,7 +151,7 @@ private void readFromNBT(CompoundTag nbt) for (int i = 0; i < count; i++) { - CompoundTag tag = tagList.getCompound(i); + NbtCompound tag = tagList.getCompound(i); TradeType type = TradeType.fromTag(tag); if (type != null) @@ -161,10 +161,10 @@ private void readFromNBT(CompoundTag nbt) } } - private CompoundTag writeToNBT(@Nonnull CompoundTag nbt) + private NbtCompound writeToNBT(@Nonnull NbtCompound nbt) { - ListTag favoriteListData = new ListTag(); - ListTag globalFavoriteData = new ListTag(); + NbtList favoriteListData = new NbtList(); + NbtList globalFavoriteData = new NbtList(); for (VillagerData data : this.data.values()) { @@ -241,7 +241,7 @@ public void writeToDisk() File fileTmp = new File(saveDir, this.getFileName() + ".tmp"); File fileReal = new File(saveDir, this.getFileName()); FileOutputStream os = new FileOutputStream(fileTmp); - NbtIo.writeCompressed(this.writeToNBT(new CompoundTag()), os); + NbtIo.writeCompressed(this.writeToNBT(new NbtCompound()), os); os.close(); if (fileReal.exists()) From a409c0ce05b1d1d258a60aea87c476de8bb7a1a8 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 8 Jun 2021 21:14:28 +0300 Subject: [PATCH 078/107] Update to MC 1.17.0 (version bump) --- build.properties | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build.properties b/build.properties index 6fd60eb7c..53558297d 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.15.0-dev malilib_version = 0.10.0-dev.22+beta.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17-pre4 -minecraft_version = 1.17-pre4 -mappings_version = 1.17-pre4+build.1 +minecraft_version_out = 1.17.0 +minecraft_version = 1.17 +mappings_version = 1.17+build.1 fabric_loader_version = 0.11.3 mod_menu_version = 2.0.0-beta.7 From de76b2ceb54f2c06544ec0c762456889e2cd0c36 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 6 Jul 2021 23:06:12 +0300 Subject: [PATCH 079/107] Auto-organize all imports --- .../itemscroller/mixin/MixinClientPlayerInteractionManager.java | 2 -- src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java | 2 +- src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java index 39e1d160f..621f2337f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java @@ -5,10 +5,8 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayerInteractionManager; -import net.minecraft.item.ItemStack; import net.minecraft.network.Packet; import fi.dy.masa.itemscroller.util.ClickPacketBuffer; diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java index 344cb7a66..09341a434 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java @@ -4,9 +4,9 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import fi.dy.masa.itemscroller.event.RenderEventHandler; import net.minecraft.client.gui.AbstractParentElement; import net.minecraft.client.gui.screen.Screen; +import fi.dy.masa.itemscroller.event.RenderEventHandler; @Mixin(Screen.class) public abstract class MixinScreen extends AbstractParentElement diff --git a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java index 79cb24c73..8b2bb5c33 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java @@ -4,8 +4,8 @@ import net.minecraft.client.gui.screen.ingame.MerchantScreen; import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.SlotActionType; -import fi.dy.masa.itemscroller.mixin.IMixinScreenWithHandler; import fi.dy.masa.itemscroller.mixin.IMixinMerchantScreen; +import fi.dy.masa.itemscroller.mixin.IMixinScreenWithHandler; import fi.dy.masa.itemscroller.mixin.IMixinSlot; public class AccessorUtils From 6d413b850c4cc92630c039320425f8989211089d Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 6 Jul 2021 23:10:07 +0300 Subject: [PATCH 080/107] Update to MC 1.17.1 --- build.gradle | 3 ++- build.properties | 12 ++++++------ .../fi/dy/masa/itemscroller/util/InventoryUtils.java | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/build.gradle b/build.gradle index 6b26c5e46..0429443e3 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,8 @@ targetCompatibility = JavaVersion.VERSION_16 repositories { maven { url 'https://masa.dy.fi/maven' } - maven { url 'https://maven.terraformersmc.com/releases/' } + //maven { url 'https://maven.terraformersmc.com/releases/' } + maven { url 'https://maven.quiltmc.org/repository/release/' } } ext.configFile = file "build.properties" diff --git a/build.properties b/build.properties index 53558297d..5b7a7b548 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.22+beta.1 +malilib_version = 0.10.0-dev.23 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17.0 -minecraft_version = 1.17 -mappings_version = 1.17+build.1 +minecraft_version_out = 1.17.1 +minecraft_version = 1.17.1 +mappings_version = 1.17.1+build.1 -fabric_loader_version = 0.11.3 -mod_menu_version = 2.0.0-beta.7 +fabric_loader_version = 0.11.6 +mod_menu_version = v2.0.2+1.17.2035ad2 diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 2eb2cec8a..462ba5020 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -1905,7 +1905,7 @@ private static void restoreOriginalStacks(ScreenHandler container, ItemStack[] o if (areStacksEqual(stackSlot, originalStacks[i]) == false || (isStackEmpty(stackSlot) == false && getStackSize(stackSlot) != getStackSize(originalStacks[i]))) { - container.setStackInSlot(i, originalStacks[i]); + container.getSlot(i).setStack(originalStacks[i]); } } } From 959796136586b98115b5f0c6921e2f858732b5c3 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 9 Sep 2021 19:51:13 +0300 Subject: [PATCH 081/107] Update Yarn mappings and Gradle --- build.properties | 4 ++-- gradle/wrapper/gradle-wrapper.properties | 2 +- .../itemscroller/util/InventoryUtils.java | 17 ++++++++------- .../dy/masa/itemscroller/util/ItemType.java | 21 ++++++------------- 4 files changed, 18 insertions(+), 26 deletions(-) diff --git a/build.properties b/build.properties index 5b7a7b548..cce6dadc3 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.23 +malilib_version = 0.10.0-dev.24 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.17.1 minecraft_version = 1.17.1 -mappings_version = 1.17.1+build.1 +mappings_version = 1.17.1+build.39 fabric_loader_version = 0.11.6 mod_menu_version = v2.0.2+1.17.2035ad2 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0fa7a672f..4ea7fd8f4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 462ba5020..8d63dafcc 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -97,7 +97,7 @@ public static String getStackString(ItemStack stack) return String.format("[%s - display: %s - NBT: %s] (%s)", rl != null ? rl.toString() : "null", stack.getName().getString(), - stack.getTag() != null ? stack.getTag().toString() : "", + stack.getNbt() != null ? stack.getNbt().toString() : "", stack.toString()); } @@ -673,9 +673,8 @@ else if (slot.hasStack()) public static void villagerClearTradeInputSlots() { - if (GuiUtils.getCurrentScreen() instanceof MerchantScreen) + if (GuiUtils.getCurrentScreen() instanceof MerchantScreen merchantGui) { - MerchantScreen merchantGui = (MerchantScreen) GuiUtils.getCurrentScreen(); Slot slot = merchantGui.getScreenHandler().getSlot(0); if (slot.hasStack()) @@ -694,10 +693,11 @@ public static void villagerClearTradeInputSlots() public static void villagerTradeEverythingPossibleWithTrade(int visibleIndex) { - if (GuiUtils.getCurrentScreen() instanceof MerchantScreen) + if (GuiUtils.getCurrentScreen() instanceof MerchantScreen merchantGui) { - MerchantScreen merchantGui = (MerchantScreen) GuiUtils.getCurrentScreen(); - Slot slot = merchantGui.getScreenHandler().getSlot(2); + MerchantScreenHandler handler = merchantGui.getScreenHandler(); + Slot slot = handler.getSlot(2); + ItemStack sellItem = handler.getRecipes().get(visibleIndex).getSellItem().copy(); while (true) { @@ -705,7 +705,8 @@ public static void villagerTradeEverythingPossibleWithTrade(int visibleIndex) //tryMoveItemsToMerchantBuySlots(merchantGui, true); // Not a valid recipe - if (slot.hasStack() == false) + //if (slot.hasStack() == false) + if (areStacksEqual(sellItem, slot.getStack()) == false) { break; } @@ -1858,7 +1859,7 @@ private static List getSlotNumbersOfEmptySlotsInPlayerInventory(ScreenH public static boolean areStacksEqual(ItemStack stack1, ItemStack stack2) { - return stack1.isEmpty() == false && stack1.isItemEqual(stack2) && ItemStack.areTagsEqual(stack1, stack2); + return stack1.isEmpty() == false && stack1.isItemEqual(stack2) && ItemStack.areNbtEqual(stack1, stack2); } private static boolean areSlotsInSameInventory(Slot slot1, Slot slot2) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java b/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java index 7b71745ed..c7b3a32d1 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/ItemType.java @@ -32,7 +32,7 @@ public int hashCode() int result = 1; //result = prime * result + ((stack == null) ? 0 : stack.hashCode()); result = prime * result + this.stack.getItem().hashCode(); - result = prime * result + (this.stack.getTag() != null ? this.stack.getTag().hashCode() : 0); + result = prime * result + (this.stack.getNbt() != null ? this.stack.getNbt().hashCode() : 0); return result; } @@ -43,15 +43,14 @@ public boolean equals(Object obj) return true; if (obj == null) return false; - if (getClass() != obj.getClass()) + if (this.getClass() != obj.getClass()) return false; ItemType other = (ItemType) obj; if (InventoryUtils.isStackEmpty(this.stack) || InventoryUtils.isStackEmpty(other.stack)) { - if (InventoryUtils.isStackEmpty(this.stack) != InventoryUtils.isStackEmpty(other.stack)) - return false; + return InventoryUtils.isStackEmpty(this.stack) == InventoryUtils.isStackEmpty(other.stack); } else { @@ -60,10 +59,8 @@ public boolean equals(Object obj) return false; } - return ItemStack.areTagsEqual(this.stack, other.stack); + return ItemStack.areNbtEqual(this.stack, other.stack); } - - return true; } /** @@ -73,7 +70,7 @@ public boolean equals(Object obj) */ public static Map> getSlotsPerItem(ItemStack[] stacks) { - Map> mapSlots = new HashMap>(); + Map> mapSlots = new HashMap<>(); for (int i = 0; i < stacks.length; i++) { @@ -82,13 +79,7 @@ public static Map> getSlotsPerItem(ItemStack[] stacks) if (InventoryUtils.isStackEmpty(stack) == false) { ItemType item = new ItemType(stack); - List slots = mapSlots.get(item); - - if (slots == null) - { - slots = new ArrayList(); - mapSlots.put(item, slots); - } + List slots = mapSlots.computeIfAbsent(item, k -> new ArrayList<>()); slots.add(i); } From bf1b35b3972f27e0e984fcf1582c8c3e1d07f89c Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 22 Oct 2021 01:04:23 +0300 Subject: [PATCH 082/107] Build script clean-up, update mappings, set a MC version dependency --- COPYING.txt | 674 -------------------- COPYING.LESSER.txt => LICENSE.txt | 0 README.md | 15 +- build.gradle | 72 +-- build.properties | 8 +- gradle.properties | 2 - gradle/wrapper/gradle-wrapper.properties | 2 +- settings.gradle | 15 +- src/main/resources/fabric.mod.json | 63 +- src/main/resources/mixins.itemscroller.json | 38 +- update.json | 125 ---- 11 files changed, 109 insertions(+), 905 deletions(-) delete mode 100644 COPYING.txt rename COPYING.LESSER.txt => LICENSE.txt (100%) delete mode 100644 gradle.properties delete mode 100644 update.json diff --git a/COPYING.txt b/COPYING.txt deleted file mode 100644 index 94a9ed024..000000000 --- a/COPYING.txt +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/COPYING.LESSER.txt b/LICENSE.txt similarity index 100% rename from COPYING.LESSER.txt rename to LICENSE.txt diff --git a/README.md b/README.md index 27b51b7ff..2dd1fcb0a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,15 @@ Item Scroller ============== -Item Scroller is a tiny mod for Minecraft 1.8.9+, which adds the functionality of moving items in inventory GUIs -by scrolling the mouse wheel over slots with items in them. -This is basically what NEI does/did (and Mouse Tweaks also seems to do), but separated into this tiny mod, -and probably implemented in a different manner. -For more information and the downloads (compiled builds), see http://minecraft.curseforge.com/projects/item-scroller +Item Scroller is a Minecraft mod that adds various convenience features for moving items +inside inventory GUIs. Examples are scrolling the mouse wheel over slots with items in them +or Shift/Ctrl + click + dragging over slots to move items from them in various ways etc. + +Item scrolling is basically what the old NEI mod did and Mouse Tweaks also does. +This mod has some different drag features compared to Mouse Tweaks, and also some special +villager trading related helper features as well as crafting helper features. + +For more information and downloads of the already compiled builds, +see https://www.curseforge.com/minecraft/mc-mods/item-scroller Compiling ========= diff --git a/build.gradle b/build.gradle index 0429443e3..c1fb5cce6 100644 --- a/build.gradle +++ b/build.gradle @@ -1,44 +1,44 @@ plugins { - id 'fabric-loom' version '0.8-SNAPSHOT' + id 'fabric-loom' version '0.9-SNAPSHOT' } sourceCompatibility = JavaVersion.VERSION_16 targetCompatibility = JavaVersion.VERSION_16 repositories { - maven { url 'https://masa.dy.fi/maven' } - //maven { url 'https://maven.terraformersmc.com/releases/' } - maven { url 'https://maven.quiltmc.org/repository/release/' } + maven { url 'https://masa.dy.fi/maven' } + maven { url 'https://maven.terraformersmc.com/releases/' } + // maven { url 'https://maven.quiltmc.org/repository/release/' } } ext.configFile = file "build.properties" configFile.withReader { - def prop = new Properties() - prop.load(it) - project.ext.config = new ConfigSlurper().parse prop + def prop = new Properties() + prop.load(it) + project.ext.config = new ConfigSlurper().parse prop } dependencies { - minecraft "com.mojang:minecraft:${config.minecraft_version}" - mappings "net.fabricmc:yarn:${config.mappings_version}:v2" - modImplementation "net.fabricmc:fabric-loader:${config.fabric_loader_version}" - implementation "com.google.code.findbugs:jsr305:3+" + minecraft "com.mojang:minecraft:${config.minecraft_version}" + mappings "net.fabricmc:yarn:${config.mappings_version}:v2" + modImplementation "net.fabricmc:fabric-loader:${config.fabric_loader_version}" + implementation "com.google.code.findbugs:jsr305:3.0.2" - modImplementation "fi.dy.masa.malilib:malilib-fabric-${config.minecraft_version_out}:${config.malilib_version}" + modImplementation "fi.dy.masa.malilib:malilib-fabric-${config.minecraft_version_out}:${config.malilib_version}" - // Fabric API. This is technically optional, but you probably want it anyway. - //modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version + // Fabric API. This is technically optional, but you probably want it anyway. + //modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version - modCompileOnly "com.terraformersmc:modmenu:${config.mod_menu_version}" + modCompileOnly "com.terraformersmc:modmenu:${config.mod_menu_version}" } minecraft { - ext.mod_version = config.mod_version + ext.mod_version = config.mod_version - if (mod_version.endsWith('-dev')) { - mod_version = mod_version + "." + new Date().format('yyyyMMdd.HHmmss') - } + if (mod_version.endsWith('-dev')) { + mod_version = mod_version + "." + new Date().format('yyyyMMdd.HHmmss') + } } group = config.group + "." + config.mod_id @@ -46,27 +46,27 @@ archivesBaseName = config.mod_file_name + '-' + config.minecraft_version_out version = project.minecraft.mod_version processResources { - // Exclude the GIMP image files - exclude '**/*.xcf' - exclude '**/xcf' + // Exclude the GIMP image files + exclude '**/*.xcf' + exclude '**/xcf' - // this will ensure that this task is redone when the versions change. - //inputs.property "minecraft_version", project.config.minecraft_version + // this will ensure that this task is redone when the versions change. + //inputs.property "minecraft_version", project.config.minecraft_version - inputs.property "mod_version", project.minecraft.mod_version + inputs.property "mod_version", project.minecraft.mod_version - filesMatching("fabric.mod.json") { - expand "mod_version": project.minecraft.mod_version - } + filesMatching("fabric.mod.json") { + expand "mod_version": project.minecraft.mod_version + } } tasks.withType(JavaCompile).configureEach { - // ensure that the encoding is set to UTF-8, no matter what the system default is - // this fixes some edge cases with special characters not displaying correctly - // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html - // If Javadoc is generated, this must be specified in that task too. - it.options.encoding = "UTF-8" - - // Minecraft 1.17 (21w19a) upwards uses Java 16. - it.options.release = 16 + // ensure that the encoding is set to UTF-8, no matter what the system default is + // this fixes some edge cases with special characters not displaying correctly + // see http://yodaconditions.net/blog/fix-for-java-file-encoding-problems-with-gradle.html + // If Javadoc is generated, this must be specified in that task too. + it.options.encoding = "UTF-8" + + // Minecraft 1.17 (21w19a) upwards uses Java 16. + it.options.release = 16 } diff --git a/build.properties b/build.properties index cce6dadc3..8110baf2b 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0-dev # Required malilib version -malilib_version = 0.10.0-dev.24 +malilib_version = 0.10.0-dev.25 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.17.1 minecraft_version = 1.17.1 -mappings_version = 1.17.1+build.39 +mappings_version = 1.17.1+build.61 -fabric_loader_version = 0.11.6 -mod_menu_version = v2.0.2+1.17.2035ad2 +fabric_loader_version = 0.12.2 +mod_menu_version = 2.0.14 diff --git a/gradle.properties b/gradle.properties deleted file mode 100644 index 5cacfe897..000000000 --- a/gradle.properties +++ /dev/null @@ -1,2 +0,0 @@ -# Done to increase the memory available to gradle. -org.gradle.jvmargs=-Xmx1G diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 4ea7fd8f4..16dc4084e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Aug 22 17:36:22 EDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip diff --git a/settings.gradle b/settings.gradle index 5b60df3d2..027b233da 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,10 +1,9 @@ pluginManagement { - repositories { - jcenter() - maven { - name = 'Fabric' - url = 'https://maven.fabricmc.net/' - } - gradlePluginPortal() - } + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + gradlePluginPortal() + } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f8f2cf1f8..782a2b921 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,38 +1,39 @@ { - "schemaVersion": 1, - "id": "itemscroller", - "name": "Item Scroller", - "version": "${mod_version}", + "schemaVersion": 1, + "id": "itemscroller", + "name": "Item Scroller", + "version": "${mod_version}", - "description": "Move items in inventory GUIs by scrolling the mouse wheel or dragging over slots", - "authors": [ - "masa" - ], - "contact": { - "homepage": "https://www.curseforge.com/minecraft/mc-mods/item-scroller", - "issues": "https://github.com/maruohon/itemscroller/issues", - "sources": "https://github.com/maruohon/itemscroller", - "twitter": "https://twitter.com/maruohon", - "discord": "https://discordapp.com/channels/211786369951989762/453662800460644354/" - }, + "description": "Move items in inventory GUIs by scrolling the mouse wheel or dragging over slots", + "authors": [ + "masa" + ], + "contact": { + "homepage": "https://www.curseforge.com/minecraft/mc-mods/item-scroller", + "issues": "https://github.com/maruohon/itemscroller/issues", + "sources": "https://github.com/maruohon/itemscroller", + "twitter": "https://twitter.com/maruohon", + "discord": "https://discordapp.com/channels/211786369951989762/453662800460644354/" + }, - "license": "LGPLv3", + "license": "LGPLv3", - "environment": "client", - "entrypoints": { - "main": [ - "fi.dy.masa.itemscroller.ItemScroller" - ], - "modmenu": [ - "fi.dy.masa.itemscroller.compat.modmenu.ModMenuImpl" - ] - }, + "environment": "client", + "entrypoints": { + "main": [ + "fi.dy.masa.itemscroller.ItemScroller" + ], + "modmenu": [ + "fi.dy.masa.itemscroller.compat.modmenu.ModMenuImpl" + ] + }, - "mixins": [ - "mixins.itemscroller.json" - ], + "mixins": [ + "mixins.itemscroller.json" + ], - "depends": { - "malilib": ">=0.10.0-dev.22" - } + "depends": { + "minecraft": "1.17.1", + "malilib": ">=0.10.0-dev.22 <0.11" + } } diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 1eae0cf65..03b8c32ea 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -1,21 +1,21 @@ { - "required": true, - "package": "fi.dy.masa.itemscroller.mixin", - "compatibilityLevel": "JAVA_16", - "minVersion": "0.7", - "client": [ - "IMixinMerchantScreen", - "IMixinScreenWithHandler", - "IMixinSlot", - "MixinAbstractInventoryScreen", - "MixinClientPlayerInteractionManager", - "MixinCraftingScreenHandler", - "MixinGameRenderer", - "MixinMerchantScreen", - "MixinMerchantScreenHandler", - "MixinScreen" - ], - "injectors": { - "defaultRequire": 1 - } + "required": true, + "package": "fi.dy.masa.itemscroller.mixin", + "compatibilityLevel": "JAVA_16", + "minVersion": "0.8", + "client": [ + "IMixinMerchantScreen", + "IMixinScreenWithHandler", + "IMixinSlot", + "MixinAbstractInventoryScreen", + "MixinClientPlayerInteractionManager", + "MixinCraftingScreenHandler", + "MixinGameRenderer", + "MixinMerchantScreen", + "MixinMerchantScreenHandler", + "MixinScreen" + ], + "injectors": { + "defaultRequire": 1 + } } diff --git a/update.json b/update.json deleted file mode 100644 index cf10a8f91..000000000 --- a/update.json +++ /dev/null @@ -1,125 +0,0 @@ -{ - "homepage": "http://minecraft.curseforge.com/projects/item-scroller", - "promos": { - "1.12-latest": "0.11.0", - "1.12-recommended": "0.11.0", - "1.11.2-latest": "0.11.0", - "1.11.2-recommended": "0.11.0", - "1.11-latest": "0.11.0", - "1.11-recommended": "0.11.0", - "1.10.2-latest": "0.11.0", - "1.10.2-recommended": "0.11.0", - "1.10-latest": "0.10.3", - "1.10-recommended": "0.10.3", - "1.9.4-latest": "0.10.3", - "1.9.4-recommended": "0.10.3", - "1.9-latest": "0.10.3", - "1.9-recommended": "0.10.3", - "1.8.9-latest": "0.5.1", - "1.8.9-recommended": "0.5.1" - }, - "1.12": { - "0.11.0": "Update to Minecraft 1.12" - }, - "1.11.2": { - "0.11.0": "Added a crafting scrolling mode with recipe memory\nAdded right click crafting one stack\nConfig category re-organizing\nInternal refactoring", - "0.10.3": "Fix a NPE crash in some weird cases or GUIs", - "0.10.2": "Fix a possible crash in some GUIs with the toggle-disable keybind\nFix Ctrl + Shift + drop key not using a copy of the reference stack", - "0.10.1": "Fix not using the empty ItemStack for the pickup detection initialization - fixes a NPE", - "0.10.0": "Add GUI and Slot blacklists.\nAdd Ctrl+Alt+Shift + I to print debug info.\nBlacklisted AE2 terminal slots and TiCo Crafting Station side inventory slots by default.", - "0.9.1": "Fix a conflict with JEI recipe hiding, again (it broke again in 0.9.0 I believe)\nUse the new-ish Forge-added getters in GuiContainer instead of reflection", - "0.9.0": "A bunch of bug fixes and slight improvements\nAdded Ctrl + Shift + Drop dropping all matching stacks\nAdded a key bind to toggle Item Scroller on/off", - "0.8.1": "Update to Minecraft 1.11.2" - }, - "1.11": { - "0.11.0": "Added a crafting scrolling mode with recipe memory\nAdded right click crafting one stack\nConfig category re-organizing\nInternal refactoring", - "0.10.3": "Fix a NPE crash in some weird cases or GUIs", - "0.10.2": "Fix a possible crash in some GUIs with the toggle-disable keybind\nFix Ctrl + Shift + drop key not using a copy of the reference stack", - "0.10.1": "Fix not using the empty ItemStack for the pickup detection initialization - fixes a NPE", - "0.10.0": "Add GUI and Slot blacklists.\nAdd Ctrl+Alt+Shift + I to print debug info.\nBlacklisted AE2 terminal slots and TiCo Crafting Station side inventory slots by default.", - "0.9.1": "Fix a conflict with JEI recipe hiding, again (it broke again in 0.9.0 I believe)\nUse the new-ish Forge-added getters in GuiContainer instead of reflection", - "0.9.0": "A bunch of bug fixes and slight improvements\nAdded Ctrl + Shift + Drop dropping all matching stacks\nAdded a key bind to toggle Item Scroller on/off", - "0.8.0": "Add better checks for drag handler, to only cancel the event when necessary (fixes a compat. issue)\nAdd a fallback handler for shift/ctrl + scrolling", - "0.7.2": "Update to Minecraft 1.11" - }, - "1.10.2": { - "0.11.0": "Added a crafting scrolling mode with recipe memory\nAdded right click crafting one stack\nConfig category re-organizing\nInternal refactoring", - "0.10.3": "Fix a NPE crash in some weird cases or GUIs", - "0.10.2": "Fix a possible crash in some GUIs with the toggle-disable keybind\nFix Ctrl + Shift + drop key not using a copy of the reference stack", - "0.10.0": "Add GUI and Slot blacklists.\nAdd Ctrl+Alt+Shift + I to print debug info.\nBlacklisted AE2 terminal slots and TiCo Crafting Station side inventory slots by default.", - "0.9.1": "Fix a conflict with JEI recipe hiding, again (it broke again in 0.9.0 I believe)", - "0.9.0": "A bunch of bug fixes and slight improvements\nAdded Ctrl + Shift + Drop dropping all matching stacks\nAdded a key bind to toggle Item Scroller on/off", - "0.8.0": "Add better checks for drag handler, to only cancel the event when necessary (fixes a compat. issue)\nAdd a fallback handler for shift/ctrl + scrolling", - "0.7.1": "Ignore the creative inventory, fix a possible crash", - "0.7.0": "Change single item scrolling code, fixes some incompatibilities (like a crash with Chisel)\nAdd an option for slot position aware scroll direction (\"natural scroll direction\")", - "0.6.1": "Fix drag moving being broken in some inventories that use wrapped slots, for example Tinkers' Construct\nChange the code of the \"move everything except the last item\" drag mode to not need an empty slot in the source inventory", - "0.6.0": "Add shift + placing and shift + dropping to move/drop all matching items", - "0.5.2": "Don't cancel the input event when it doesn't need to be canceled, fixes a conflict with JEI item hiding", - "0.5.1": "Update to Minecraft 1.10.2" - }, - "1.10": { - "0.10.3": "Fix a NPE crash in some weird cases or GUIs", - "0.10.2": "Fix a possible crash in some GUIs with the toggle-disable keybind\nFix Ctrl + Shift + drop key not using a copy of the reference stack", - "0.10.0": "Add GUI and Slot blacklists.\nAdd Ctrl+Alt+Shift + I to print debug info.\nBlacklisted AE2 terminal slots and TiCo Crafting Station side inventory slots by default.", - "0.9.1": "Fix a conflict with JEI recipe hiding, again (it broke again in 0.9.0 I believe)", - "0.9.0": "A bunch of bug fixes and slight improvements\nAdded Ctrl + Shift + Drop dropping all matching stacks\nAdded a key bind to toggle Item Scroller on/off", - "0.8.0": "Add better checks for drag handler, to only cancel the event when necessary (fixes a compat. issue)\nAdd a fallback handler for shift/ctrl + scrolling", - "0.7.1": "Ignore the creative inventory, fix a possible crash", - "0.7.0": "Change single item scrolling code, fixes some incompatibilities (like a crash with Chisel)\nAdd an option for slot position aware scroll direction (\"natural scroll direction\")", - "0.6.1": "Fix drag moving being broken in some inventories that use wrapped slots, for example Tinkers' Construct\nChange the code of the \"move everything except the last item\" drag mode to not need an empty slot in the source inventory", - "0.6.0": "Add shift + placing and shift + dropping to move/drop all matching items", - "0.5.2": "Don't cancel the input event when it doesn't need to be canceled, fixes a conflict with JEI item hiding", - "0.5.1": "Update to Minecraft 1.10" - }, - "1.9.4": { - "0.10.3": "Fix a NPE crash in some weird cases or GUIs", - "0.10.2": "Fix a possible crash in some GUIs with the toggle-disable keybind\nFix Ctrl + Shift + drop key not using a copy of the reference stack", - "0.10.0": "Add GUI and Slot blacklists.\nAdd Ctrl+Alt+Shift + I to print debug info.\nBlacklisted AE2 terminal slots and TiCo Crafting Station side inventory slots by default.", - "0.9.1": "Fix a conflict with JEI recipe hiding, again (it broke again in 0.9.0 I believe)", - "0.9.0": "A bunch of bug fixes and slight improvements\nAdded Ctrl + Shift + Drop dropping all matching stacks\nAdded a key bind to toggle Item Scroller on/off", - "0.8.0": "Add better checks for drag handler, to only cancel the event when necessary (fixes a compat. issue)\nAdd a fallback handler for shift/ctrl + scrolling", - "0.7.1": "Ignore the creative inventory, fix a possible crash", - "0.7.0": "Change single item scrolling code, fixes some incompatibilities (like a crash with Chisel)\nAdd an option for slot position aware scroll direction (\"natural scroll direction\")", - "0.6.1": "Fix drag moving being broken in some inventories that use wrapped slots, for example Tinkers' Construct\nChange the code of the \"move everything except the last item\" drag mode to not need an empty slot in the source inventory", - "0.6.0": "Add shift + placing and shift + dropping to move/drop all matching items", - "0.5.2": "Don't cancel the input event when it doesn't need to be canceled, fixes a conflict with JEI item hiding", - "0.5.1": "Prevent the normal shift + click action (= moving the entire stack) when clicking in a \"partial drag mode\"", - "0.5.0": "Ported the 0.5.0 version from Minecraft 1.9 to 1.9.4" - }, - "1.9": { - "0.10.3": "Fix a NPE crash in some weird cases or GUIs", - "0.10.2": "Fix a possible crash in some GUIs with the toggle-disable keybind\nFix Ctrl + Shift + drop key not using a copy of the reference stack", - "0.10.0": "Add GUI and Slot blacklists.\nAdd Ctrl+Alt+Shift + I to print debug info.\nBlacklisted AE2 terminal slots and TiCo Crafting Station side inventory slots by default.", - "0.9.1": "Fix a conflict with JEI recipe hiding, again (it broke again in 0.9.0 I believe)", - "0.9.0": "A bunch of bug fixes and slight improvements\nAdded Ctrl + Shift + Drop dropping all matching stacks\nAdded a key bind to toggle Item Scroller on/off", - "0.8.0": "Add better checks for drag handler, to only cancel the event when necessary (fixes a compat. issue)\nAdd a fallback handler for shift/ctrl + scrolling", - "0.7.1": "Ignore the creative inventory, fix a possible crash", - "0.7.0": "Change single item scrolling code, fixes some incompatibilities (like a crash with Chisel)\nAdd an option for slot position aware scroll direction (\"natural scroll direction\")", - "0.6.1": "Fix drag moving being broken in some inventories that use wrapped slots, for example Tinkers' Construct\nChange the code of the \"move everything except the last item\" drag mode to not need an empty slot in the source inventory", - "0.6.0": "Add shift + placing and shift + dropping to move/drop all matching items", - "0.5.2": "Don't cancel the input event when it doesn't need to be canceled, fixes a conflict with JEI item hiding", - "0.5.1": "Prevent the normal shift + click action (= moving the entire stack) when clicking in a \"partial drag mode\"", - "0.5.0": "Fix a bug where shift + clicking would move two stacks because of the drag feature (only noticeable if the target slot can hold more than one regular stack's worth of items)\nAdd Ctrl + click dragging to move only one item from all the dragged-over slots\nAdd separate configs options for all the different dragging modes\nRenamed the old dragging config option - thus generating a new config is recommended", - "0.4.3": "Add right click dragging\nFix left mouse button's state getting stuck if the inventory is closed while holding the button", - "0.4.2": "Fix some derps when trying to scroll to/from output-only slots, like Furnace output or crafting output", - "0.4.1": "Fix a minor glitch when scrolling the last item to the hovered stack in some inventories\nAdd Forge update checker support", - "0.4.0": "Add config options to enable/disable the new modes\nAdd hold shift + drag to move items (like Mouse Tweaks) - the movement is interpolated: can handle fast cursor movement\nAdd special handling for Villagers: hover over the output slot, hold shift and scroll down to fill the recipe inputs (then scroll up to move the output items as usual). So basically hold shift and scroll down/up repeatedly to trade fast & easy.", - "0.3.0": "Add new modifier: Ctrl + scroll to move all matching items\nAdd new modifier: Ctrl + Shift + scroll to move everything", - "0.2.3": "Don't try to do things on fake slots. Fixes a cross-mod interaction issue/crash.", - "0.2.2": "Update for Forge 1805+", - "0.2.1": "Ported the 0.2.1 version from Minecraft 1.8.9 to 1.9" - }, - "1.8.9": { - "0.5.1": "Prevent the normal shift + click action (= moving the entire stack) when clicking in a \"partial drag mode\"", - "0.5.0": "Fix a bug where shift + clicking would move two stacks because of the drag feature (only noticeable if the target slot can hold more than one regular stack's worth of items)\nAdd Ctrl + click dragging to move only one item from all the dragged-over slots\nAdd separate configs options for all the different dragging modes\nRenamed the old dragging config option - thus generating a new config is recommended", - "0.4.3": "Add right click dragging\nFix left mouse button's state getting stuck if the inventory is closed while holding the button", - "0.4.2": "Fix some derps when trying to scroll to/from output-only slots, like Furnace output or crafting output", - "0.4.1": "Fix a minor glitch when scrolling the last item to the hovered stack in some inventories\nAdd Forge update checker support", - "0.4.0": "Add config options to enable/disable the new modes\nAdd hold shift + drag to move items (like Mouse Tweaks) - the movement is interpolated: can handle fast cursor movement\nAdd special handling for Villagers: hover over the output slot, hold shift and scroll down to fill the recipe inputs (then scroll up to move the output items as usual). So basically hold shift and scroll down/up repeatedly to trade fast & easy.", - "0.3.0": "Add new modifier: Ctrl + scroll to move all matching items\nAdd new modifier: Ctrl + Shift + scroll to move everything", - "0.2.3": "Don't try to do things on fake slots. Fixes a cross-mod interaction issue/crash.", - "0.2.1": "Add (better) support for scrolling items to/from the player's hotbar\nAdd config options to individually disable the single item and full stacks modes", - "0.2.0": "Add configs for reversing the scrolling direction/behavior\nAdd in-game config GUI support\nAdd support for moving full stacks by holding shift\nAdd support for inventory slots that are or extend SlotItemHandler", - "0.1.0": "Initial release" - } -} From 1ebf6f272684abd9697344c59375343569ed423e Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 22 Oct 2021 13:13:37 +0300 Subject: [PATCH 083/107] Add mod icon (by SuperDragonite2172) --- src/main/resources/assets/itemscroller/icon.png | Bin 0 -> 305 bytes src/main/resources/fabric.mod.json | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 src/main/resources/assets/itemscroller/icon.png diff --git a/src/main/resources/assets/itemscroller/icon.png b/src/main/resources/assets/itemscroller/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1ee02a2ea4406d88bba4851f27d96ad686b3ce8d GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnF3?v&v(vJfv#^NA%Cx&(BWL^R}(g8jpuK)l4 ze|LD+%>`*Kb?up1S^Z(wX_kgc3MN2#k$=nEfYcFB7srr_xZFz{g_;$37%t?Ti~PgD zR_E~k7xUYDs#ebYr6o%L9Dlx<*Qrr)c3SyP2F?k2jPdJ|ggZ8;#eNs)SQq+oKGQ|T zRT>_0Tm>Dq3x2*b-1+VEqMuerZ#$GYEOw9#+rj7%e2|Nw)HUzd`r`txx)MD@!g##B zc558*EE1gS9@CfD8+Fh|Ry29ujO~}0?^hY7<-eK4QFvwb`-B{aBb(dJkL{5C@>BH# z?>W;7##7k>g&sAG?(aLiA4r@Eowo7dU+X^%H9rowJ$1PB9OxegPgg&ebxsLQ03F?Z AO#lD@ literal 0 HcmV?d00001 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 782a2b921..63b13ef93 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -17,7 +17,7 @@ }, "license": "LGPLv3", - + "icon": "assets/itemscroller/icon.png", "environment": "client", "entrypoints": { "main": [ From ec9b7f62683b562c62769a0792bf54b68501d9ab Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 30 Nov 2021 20:02:30 +0200 Subject: [PATCH 084/107] Client crafting fix: Don't set an empty stack, possible fix to GH #69 --- .../masa/itemscroller/util/InventoryUtils.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 8d63dafcc..b11a5a167 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -77,14 +77,16 @@ public static void onSlotChangedCraftingGrid(PlayerEntity player, if ((recipe.isIgnoredInRecipeBook() || world.getGameRules().getBoolean(GameRules.DO_LIMITED_CRAFTING) == false || - ((ClientPlayerEntity) player).getRecipeBook().contains(recipe)) - ) - { - inventoryCraftResult.setLastRecipe(recipe); - stack = recipe.craft(craftMatrix); - } - - inventoryCraftResult.setStack(0, stack); + ((ClientPlayerEntity) player).getRecipeBook().contains(recipe))) + { + inventoryCraftResult.setLastRecipe(recipe); + stack = recipe.craft(craftMatrix); + } + + if (stack.isEmpty() == false) + { + inventoryCraftResult.setStack(0, stack); + } } } } From 9556e2b8fcfd2144eb8ed716598eac1ce3334128 Mon Sep 17 00:00:00 2001 From: Arnevdl29 Date: Wed, 24 Nov 2021 22:25:23 +0100 Subject: [PATCH 085/107] Update to MC 1.18 --- build.gradle | 10 +++++----- build.properties | 14 +++++++------- gradle/wrapper/gradle-wrapper.properties | 2 +- .../mixin/IMixinMerchantScreen.java | 2 +- .../mixin/IMixinScreenWithHandler.java | 15 ++++++++------- .../dy/masa/itemscroller/mixin/IMixinSlot.java | 5 +++-- .../mixin/MixinAbstractInventoryScreen.java | 3 ++- .../mixin/MixinMerchantScreen.java | 5 ++--- .../masa/itemscroller/util/AccessorUtils.java | 18 +++++++++--------- src/main/resources/fabric.mod.json | 4 ++-- src/main/resources/pack.mcmeta | 10 +++++----- 11 files changed, 45 insertions(+), 43 deletions(-) diff --git a/build.gradle b/build.gradle index c1fb5cce6..32b708fd1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,9 @@ plugins { - id 'fabric-loom' version '0.9-SNAPSHOT' + id 'fabric-loom' version '0.10-SNAPSHOT' } -sourceCompatibility = JavaVersion.VERSION_16 -targetCompatibility = JavaVersion.VERSION_16 +sourceCompatibility = JavaVersion.VERSION_17 +targetCompatibility = JavaVersion.VERSION_17 repositories { maven { url 'https://masa.dy.fi/maven' } @@ -67,6 +67,6 @@ tasks.withType(JavaCompile).configureEach { // If Javadoc is generated, this must be specified in that task too. it.options.encoding = "UTF-8" - // Minecraft 1.17 (21w19a) upwards uses Java 16. - it.options.release = 16 + // Minecraft 1.18 (1.18-pre2) upwards uses Java 17. + it.options.release = 17 } diff --git a/build.properties b/build.properties index 8110baf2b..23081e9bb 100644 --- a/build.properties +++ b/build.properties @@ -6,15 +6,15 @@ author = masa mod_file_name = itemscroller-fabric # Current mod version -mod_version = 0.15.0-dev +mod_version = 0.15.0 # Required malilib version -malilib_version = 0.10.0-dev.25 +malilib_version = 0.10.0-dev.26 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.17.1 -minecraft_version = 1.17.1 -mappings_version = 1.17.1+build.61 +minecraft_version_out = 1.18.0 +minecraft_version = 1.18 +mappings_version = 1.18+build.1 -fabric_loader_version = 0.12.2 -mod_menu_version = 2.0.14 +fabric_loader_version = 0.12.8 +mod_menu_version = 3.0.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 16dc4084e..88789396d 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Aug 22 17:36:22 EDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java index b722a8c4c..b6b6233c7 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinMerchantScreen.java @@ -8,5 +8,5 @@ public interface IMixinMerchantScreen { @Accessor("selectedIndex") - int getSelectedMerchantRecipe(); + int itemscroller_getSelectedMerchantRecipe(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java index e963a407c..3517f3145 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinScreenWithHandler.java @@ -3,28 +3,29 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; import org.spongepowered.asm.mixin.gen.Invoker; +import net.minecraft.screen.slot.Slot; @Mixin(net.minecraft.client.gui.screen.ingame.HandledScreen.class) public interface IMixinScreenWithHandler { @Invoker("getSlotAt") - net.minecraft.screen.slot.Slot getSlotAtPositionInvoker(double x, double y); + Slot itemscroller_getSlotAtPositionInvoker(double x, double y); @Invoker("onMouseClick") - void handleMouseClickInvoker(net.minecraft.screen.slot.Slot slotIn, int slotId, int mouseButton, net.minecraft.screen.slot.SlotActionType type); + void itemscroller_handleMouseClickInvoker(Slot slotIn, int slotId, int mouseButton, net.minecraft.screen.slot.SlotActionType type); @Accessor("focusedSlot") - net.minecraft.screen.slot.Slot getHoveredSlot(); + Slot itemscroller_getHoveredSlot(); @Accessor("x") - int getGuiLeft(); + int itemscroller_getGuiLeft(); @Accessor("y") - int getGuiTop(); + int itemscroller_getGuiTop(); @Accessor("backgroundWidth") - int getGuiSizeX(); + int itemscroller_getBackgroundWidth(); @Accessor("backgroundHeight") - int getGuiSizeY(); + int itemscroller_getBackgroundHeight(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java index d425e6be9..c6f6180ee 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinSlot.java @@ -2,10 +2,11 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; +import net.minecraft.screen.slot.Slot; -@Mixin(net.minecraft.screen.slot.Slot.class) +@Mixin(Slot.class) public interface IMixinSlot { @Accessor("index") - int getSlotIndex(); + int itemscroller_getSlotIndex(); } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java index 2192ee644..3cca64d2f 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinAbstractInventoryScreen.java @@ -4,9 +4,10 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; +import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen; import fi.dy.masa.itemscroller.util.InputUtils; -@Mixin(net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen.class) +@Mixin(AbstractInventoryScreen.class) public abstract class MixinAbstractInventoryScreen { @Inject(method = "drawStatusEffects", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java index 94e629ed9..f9517abdb 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java @@ -29,10 +29,9 @@ @Mixin(MerchantScreen.class) public abstract class MixinMerchantScreen extends HandledScreen { - @Shadow private int selectedIndex; - @Shadow private int indexStartOffset; - @Nullable private FavoriteData favoriteData; + @Shadow private int selectedIndex; + @Shadow int indexStartOffset; private int indexStartOffsetLast = -1; private MixinMerchantScreen(MerchantScreenHandler handler, PlayerInventory inventory, Text title) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java index 8b2bb5c33..6929bbda3 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java @@ -12,46 +12,46 @@ public class AccessorUtils { public static Slot getSlotUnderMouse(HandledScreen gui) { - return ((IMixinScreenWithHandler) gui).getHoveredSlot(); + return ((IMixinScreenWithHandler) gui).itemscroller_getHoveredSlot(); } public static Slot getSlotAtPosition(HandledScreen gui, int x, int y) { - return ((IMixinScreenWithHandler) gui).getSlotAtPositionInvoker(x, y); + return ((IMixinScreenWithHandler) gui).itemscroller_getSlotAtPositionInvoker(x, y); } public static void handleMouseClick(HandledScreen gui, Slot slotIn, int slotId, int mouseButton, SlotActionType type) { - ((IMixinScreenWithHandler) gui).handleMouseClickInvoker(slotIn, slotId, mouseButton, type); + ((IMixinScreenWithHandler) gui).itemscroller_handleMouseClickInvoker(slotIn, slotId, mouseButton, type); } public static int getGuiLeft(HandledScreen gui) { - return ((IMixinScreenWithHandler) gui).getGuiLeft(); + return ((IMixinScreenWithHandler) gui).itemscroller_getGuiLeft(); } public static int getGuiTop(HandledScreen gui) { - return ((IMixinScreenWithHandler) gui).getGuiTop(); + return ((IMixinScreenWithHandler) gui).itemscroller_getGuiTop(); } public static int getGuiXSize(HandledScreen gui) { - return ((IMixinScreenWithHandler) gui).getGuiSizeX(); + return ((IMixinScreenWithHandler) gui).itemscroller_getBackgroundWidth(); } public static int getGuiYSize(HandledScreen gui) { - return ((IMixinScreenWithHandler) gui).getGuiSizeY(); + return ((IMixinScreenWithHandler) gui).itemscroller_getBackgroundHeight(); } public static int getSelectedMerchantRecipe(MerchantScreen gui) { - return ((IMixinMerchantScreen) gui).getSelectedMerchantRecipe(); + return ((IMixinMerchantScreen) gui).itemscroller_getSelectedMerchantRecipe(); } public static int getSlotIndex(Slot slot) { - return ((IMixinSlot) slot).getSlotIndex(); + return ((IMixinSlot) slot).itemscroller_getSlotIndex(); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 63b13ef93..434be67d6 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": "1.17.1", - "malilib": ">=0.10.0-dev.22 <0.11" + "minecraft": "1.18.x", + "malilib": ">=0.10.0-dev.26 <0.11" } } diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 643ed8c78..ebbe97a47 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,7 +1,7 @@ { - "pack": - { - "pack_format": 4, - "description": "Item Scroller" - } + "pack": + { + "pack_format": 8, + "description": "Item Scroller" + } } \ No newline at end of file From 671c6f861391aa5528b917066813359a65dd69e7 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 1 Dec 2021 20:13:18 +0200 Subject: [PATCH 086/107] Packet Buffering: Use a Queue, clear on screen close - Use an ArrayDeque instead on an ArrayList - Clear the queue and thus abort playing back the buffered packets when the GUI is closed --- .../itemscroller/util/ClickPacketBuffer.java | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java b/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java index 3fa989159..a329bc8ae 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java @@ -1,18 +1,20 @@ package fi.dy.masa.itemscroller.util; -import java.util.ArrayList; +import java.util.ArrayDeque; +import java.util.Queue; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.network.Packet; public class ClickPacketBuffer { - private static final ArrayList> BUFFER = new ArrayList<>(); + private static final Queue> BUFFER = new ArrayDeque<>(2048); private static boolean shouldBufferPackets; + private static boolean hasBufferedPackets; public static void reset() { shouldBufferPackets = false; + hasBufferedPackets = false; BUFFER.clear(); } @@ -39,20 +41,30 @@ public static void setShouldBufferClickPackets(boolean shouldBuffer) public static void bufferPacket(Packet packet) { - BUFFER.add(packet); + BUFFER.offer(packet); + hasBufferedPackets = true; } public static void sendBufferedPackets(int maxCount) { - ClientPlayerEntity player = MinecraftClient.getInstance().player; + MinecraftClient mc = MinecraftClient.getInstance(); - if (player != null && BUFFER.isEmpty() == false) + if (hasBufferedPackets) { - maxCount = Math.min(maxCount, BUFFER.size()); - - for (int i = 0; i < maxCount; ++i) + if (mc.currentScreen == null) + { + reset(); + } + else if (mc.player != null) { - player.networkHandler.sendPacket(BUFFER.remove(0)); + maxCount = Math.min(maxCount, BUFFER.size()); + + for (int i = 0; i < maxCount; ++i) + { + mc.player.networkHandler.sendPacket(BUFFER.poll()); + } + + hasBufferedPackets = BUFFER.isEmpty() == false; } } } From 0984fe73b098ef21ca15cee3a4fa0eba6477566b Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Wed, 1 Dec 2021 20:47:22 +0200 Subject: [PATCH 087/107] Fix 'enableScrollingStacksFallback' not being obeyed for the last stack --- .../java/fi/dy/masa/itemscroller/util/InventoryUtils.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index b11a5a167..ca8c9fe96 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -1008,7 +1008,9 @@ private static void tryMoveStacks(ItemStack stackReference, Slot slot, HandledSc } // If moving to the other inventory, then move the hovered slot's stack last - if (toOtherInventory && shiftClickSlotWithCheck(gui, slot.id) == false) + if (toOtherInventory && + shiftClickSlotWithCheck(gui, slot.id) == false && + Configs.Toggles.SCROLL_STACKS_FALLBACK.getBooleanValue()) { clickSlotsToMoveItemsFromSlot(slot, gui, toOtherInventory); } From a05c5566d7298e9a06ac2fb724cba0ac77f1b09e Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Mon, 3 Jan 2022 23:26:36 +0200 Subject: [PATCH 088/107] Small clean-up and improvements - Add a persistent config for the mod main toggle option - Remove the default key from the main toggle hotkey, and rename the hotkey - Re-order some of the hotkeys for better grouping - Internally rename some config options --- .../dy/masa/itemscroller/config/Configs.java | 2 + .../dy/masa/itemscroller/config/Hotkeys.java | 94 +++++++++---------- .../masa/itemscroller/event/InputHandler.java | 33 ++++--- .../itemscroller/event/KeybindCallbacks.java | 55 ++++------- .../dy/masa/itemscroller/util/InputUtils.java | 2 +- .../assets/itemscroller/lang/en_us.json | 6 +- 6 files changed, 92 insertions(+), 100 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index 59b492efe..31c2b52f8 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -30,6 +30,7 @@ public static class Generic 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."); + public static final ConfigBoolean MOD_MAIN_TOGGLE = new ConfigBoolean("modMainToggle", true, "Can disable all the functionality of the entire mod"); public static final ConfigInteger PACKET_RATE_LIMIT = new ConfigInteger("packetRateLimit", 4, 1, 1024, "The limit of sent emulated slot click packets per game tick,\nif 'rateLimitClickPackets' is enabled"); public static final ConfigBoolean SCROLL_CRAFT_STORE_RECIPES_TO_FILE = new ConfigBoolean("craftingRecipesSaveToFile", true, "If enabled, then the crafting features recipes are saved to a file\ninside minecraft/itemscroller/recipes_worldorservername.nbt.\nThis makes the recipes persistent across game restarts."); public static final ConfigBoolean SCROLL_CRAFT_RECIPE_FILE_GLOBAL = new ConfigBoolean("craftingRecipesSaveFileIsGlobal", false, "If true, then the recipe file is global, instead\n of being saved per-world or server"); @@ -44,6 +45,7 @@ public static class Generic CARPET_CTRL_Q_CRAFTING, CLIENT_CRAFTING_FIX, CRAFTING_RENDER_RECIPE_ITEMS, + MOD_MAIN_TOGGLE, PACKET_RATE_LIMIT, RATE_LIMIT_CLICK_PACKETS, SCROLL_CRAFT_STORE_RECIPES_TO_FILE, diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java b/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java index 753b10cb0..37b7a2680 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Hotkeys.java @@ -12,55 +12,63 @@ public class Hotkeys private static final KeybindSettings GUI_RELAXED_CANCEL = KeybindSettings.create(KeybindSettings.Context.GUI, KeyAction.PRESS, true, false, false, true); private static final KeybindSettings GUI_NO_ORDER = KeybindSettings.create(KeybindSettings.Context.GUI, KeyAction.PRESS, false, false, false, true); - public static final ConfigHotkey KEY_OPEN_CONFIG_GUI = new ConfigHotkey("openConfigGui", "I,C", "Open the in-game config GUI"); - - public static final ConfigHotkey KEY_CRAFT_EVERYTHING = new ConfigHotkey("craftEverything", "LEFT_CONTROL,C", GUI_NO_ORDER, "Craft everything possible once with the currently selected recipe"); - 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_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"); - public static final ConfigHotkey KEY_SLOT_DEBUG = new ConfigHotkey("slotDebug", "LEFT_CONTROL,LEFT_ALT,LEFT_SHIFT,I", GUI_NO_ORDER, "Print debug info for the hovered slot or GUI"); - public static final ConfigHotkey KEY_STORE_RECIPE = new ConfigHotkey("storeRecipe", "BUTTON_3", GUI_RELAXED_CANCEL, "Store a recipe while hovering over a crafting output item"); - public static final ConfigHotkey KEY_THROW_CRAFT_RESULTS = new ConfigHotkey("throwCraftResults", "LEFT_CONTROL,T", GUI_NO_ORDER, "Throw all of the currently selected recipe's\noutput items to the ground from the player inventory"); - public static final ConfigHotkey KEY_VILLAGER_TRADE_FAVORITES = new ConfigHotkey("villagerTradeFavorites", "", KeybindSettings.GUI, "Trade everything possible with all the favorited trades\nof the current villager"); - - public static final ConfigHotkey KEY_DRAG_LEAVE_ONE = new ConfigHotkey("keyDragMoveLeaveOne", "LEFT_SHIFT,BUTTON_2", GUI_NO_ORDER, "Key to move all but the last item from\nall the stacks dragged over"); - public static final ConfigHotkey KEY_DRAG_MATCHING = new ConfigHotkey("keyDragMoveMatching", "LEFT_ALT,BUTTON_1", GUI_NO_ORDER, "Key to move all matching items dragged over"); - public static final ConfigHotkey KEY_DRAG_MOVE_ONE = new ConfigHotkey("keyDragMoveOne", "LEFT_CONTROL,BUTTON_1", GUI_NO_ORDER, "Key to move one item from each stack dragged over"); - public static final ConfigHotkey KEY_DRAG_FULL_STACKS = new ConfigHotkey("keyDragMoveStacks", "LEFT_SHIFT,BUTTON_1", GUI_NO_ORDER, "Key to move the entire stacks dragged over"); - - public static final ConfigHotkey KEY_DRAG_DROP_LEAVE_ONE = new ConfigHotkey("keyDragDropLeaveOne", "LEFT_SHIFT,Q,BUTTON_2", GUI_NO_ORDER, "Key to drop all but the last item from each stack dragged over"); - public static final ConfigHotkey KEY_DRAG_DROP_SINGLE = new ConfigHotkey("keyDragDropSingle", "Q,BUTTON_1", GUI_NO_ORDER, "Key to drop one item from each stack dragged over"); - public static final ConfigHotkey KEY_DRAG_DROP_STACKS = new ConfigHotkey("keyDragDropStacks", "LEFT_SHIFT,Q,BUTTON_1", GUI_NO_ORDER, "Key to drop the entire stacks dragged over"); - - public static final ConfigHotkey KEY_MOVE_EVERYTHING = new ConfigHotkey("keyMoveEverything", "LEFT_ALT,LEFT_SHIFT,BUTTON_1", GUI_NO_ORDER, "Key to move ALL items to the other\ninventory when clicking a stack"); - - public static final ConfigHotkey KEY_WS_MOVE_DOWN_LEAVE_ONE = new ConfigHotkey("wsMoveDownLeaveOne", "S,BUTTON_2", GUI_NO_ORDER, "The key to move all but the last item from each stack\n\"down\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_DOWN_MATCHING = new ConfigHotkey("wsMoveDownMatching", "LEFT_ALT,S,BUTTON_1", GUI_NO_ORDER, "The key to move all matching items \"down\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_DOWN_SINGLE = new ConfigHotkey("wsMoveDownSingle", "S,BUTTON_1", GUI_NO_ORDER, "The key to move single items \"down\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_DOWN_STACKS = new ConfigHotkey("wsMoveDownStacks", "LEFT_SHIFT,S,BUTTON_1", GUI_NO_ORDER, "The key to move stacks \"down\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_UP_LEAVE_ONE = new ConfigHotkey("wsMoveUpLeaveOne", "W,BUTTON_2", GUI_NO_ORDER, "The key to move all but the last item from each stack\n\"up\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_UP_MATCHING = new ConfigHotkey("wsMoveUpMatching", "LEFT_ALT,W,BUTTON_1", GUI_NO_ORDER, "The key to move all matching items \"up\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_UP_SINGLE = new ConfigHotkey("wsMoveUpSingle", "W,BUTTON_1", GUI_NO_ORDER, "The key to move single items \"up\" in the inventory"); - public static final ConfigHotkey KEY_WS_MOVE_UP_STACKS = new ConfigHotkey("wsMoveUpStacks", "LEFT_SHIFT,W,BUTTON_1", GUI_NO_ORDER, "The key to move stacks \"up\" in the inventory"); + public static final ConfigHotkey OPEN_CONFIG_GUI = new ConfigHotkey("openConfigGui", "I,C", "Open the in-game config GUI"); + + public static final ConfigHotkey CRAFT_EVERYTHING = new ConfigHotkey("craftEverything", "LEFT_CONTROL,C", GUI_NO_ORDER, "Craft everything possible once with the currently selected recipe"); + public static final ConfigHotkey 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 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 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 RECIPE_VIEW = new ConfigHotkey("recipeView", "A", GUI_RELAXED, "Show the Item Scroller recipe GUI"); + public static final ConfigHotkey SLOT_DEBUG = new ConfigHotkey("slotDebug", "LEFT_CONTROL,LEFT_ALT,LEFT_SHIFT,I", GUI_NO_ORDER, "Print debug info for the hovered slot or GUI"); + public static final ConfigHotkey STORE_RECIPE = new ConfigHotkey("storeRecipe", "BUTTON_3", GUI_RELAXED_CANCEL, "Store a recipe while hovering over a crafting output item"); + public static final ConfigHotkey THROW_CRAFT_RESULTS = new ConfigHotkey("throwCraftResults", "LEFT_CONTROL,T", GUI_NO_ORDER, "Throw all of the currently selected recipe's\noutput items to the ground from the player inventory"); + public static final ConfigHotkey TOGGLE_MOD_ON_OFF = new ConfigHotkey("toggleModOnOff", "", KeybindSettings.GUI, "Toggle all mod functionality ON/OFF"); + public static final ConfigHotkey VILLAGER_TRADE_FAVORITES = new ConfigHotkey("villagerTradeFavorites","", KeybindSettings.GUI, "Trade everything possible with all the favorited trades\nof the current villager"); + + public static final ConfigHotkey KEY_DRAG_DROP_LEAVE_ONE = new ConfigHotkey("keyDragDropLeaveOne", "LEFT_SHIFT,Q,BUTTON_2", GUI_NO_ORDER, "Key to drop all but the last item from each stack dragged over"); + public static final ConfigHotkey KEY_DRAG_DROP_SINGLE = new ConfigHotkey("keyDragDropSingle", "Q,BUTTON_1", GUI_NO_ORDER, "Key to drop one item from each stack dragged over"); + public static final ConfigHotkey KEY_DRAG_DROP_STACKS = new ConfigHotkey("keyDragDropStacks", "LEFT_SHIFT,Q,BUTTON_1", GUI_NO_ORDER, "Key to drop the entire stacks dragged over"); + + public static final ConfigHotkey KEY_DRAG_LEAVE_ONE = new ConfigHotkey("keyDragMoveLeaveOne", "LEFT_SHIFT,BUTTON_2", GUI_NO_ORDER, "Key to move all but the last item from\nall the stacks dragged over"); + public static final ConfigHotkey KEY_DRAG_MATCHING = new ConfigHotkey("keyDragMoveMatching", "LEFT_ALT,BUTTON_1", GUI_NO_ORDER, "Key to move all matching items dragged over"); + public static final ConfigHotkey KEY_DRAG_MOVE_ONE = new ConfigHotkey("keyDragMoveOne", "LEFT_CONTROL,BUTTON_1", GUI_NO_ORDER, "Key to move one item from each stack dragged over"); + public static final ConfigHotkey KEY_DRAG_FULL_STACKS = new ConfigHotkey("keyDragMoveStacks", "LEFT_SHIFT,BUTTON_1", GUI_NO_ORDER, "Key to move the entire stacks dragged over"); + + public static final ConfigHotkey KEY_MOVE_EVERYTHING = new ConfigHotkey("keyMoveEverything", "LEFT_ALT,LEFT_SHIFT,BUTTON_1", GUI_NO_ORDER, "Key to move ALL items to the other\ninventory when clicking a stack"); + + public static final ConfigHotkey KEY_WS_MOVE_DOWN_LEAVE_ONE = new ConfigHotkey("wsMoveDownLeaveOne", "S,BUTTON_2", GUI_NO_ORDER, "The key to move all but the last item from each stack\n\"down\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_DOWN_MATCHING = new ConfigHotkey("wsMoveDownMatching", "LEFT_ALT,S,BUTTON_1", GUI_NO_ORDER, "The key to move all matching items \"down\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_DOWN_SINGLE = new ConfigHotkey("wsMoveDownSingle", "S,BUTTON_1", GUI_NO_ORDER, "The key to move single items \"down\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_DOWN_STACKS = new ConfigHotkey("wsMoveDownStacks", "LEFT_SHIFT,S,BUTTON_1", GUI_NO_ORDER, "The key to move stacks \"down\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_UP_LEAVE_ONE = new ConfigHotkey("wsMoveUpLeaveOne", "W,BUTTON_2", GUI_NO_ORDER, "The key to move all but the last item from each stack\n\"up\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_UP_MATCHING = new ConfigHotkey("wsMoveUpMatching", "LEFT_ALT,W,BUTTON_1", GUI_NO_ORDER, "The key to move all matching items \"up\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_UP_SINGLE = new ConfigHotkey("wsMoveUpSingle", "W,BUTTON_1", GUI_NO_ORDER, "The key to move single items \"up\" in the inventory"); + public static final ConfigHotkey KEY_WS_MOVE_UP_STACKS = new ConfigHotkey("wsMoveUpStacks", "LEFT_SHIFT,W,BUTTON_1", GUI_NO_ORDER, "The key to move stacks \"up\" in the inventory"); public static final ConfigHotkey MODIFIER_MOVE_EVERYTHING = new ConfigHotkey("modifierMoveEverything", "LEFT_ALT,LEFT_SHIFT", GUI_NO_ORDER, "Modifier key to move ALL items to the other\ninventory when scrolling over a stack"); public static final ConfigHotkey MODIFIER_MOVE_MATCHING = new ConfigHotkey("modifierMoveMatching", "LEFT_ALT", GUI_NO_ORDER, "Modifier key to move all matching items to the other\ninventory when scrolling over a stack"); public static final ConfigHotkey MODIFIER_MOVE_STACK = new ConfigHotkey("modifierMoveStack", "LEFT_SHIFT", GUI_NO_ORDER, "Modifier key to move the entire stack to the other\ninventory when scrolling over it"); - public static final ConfigHotkey MODIFIER_TOGGLE_VILLAGER_GLOBAL_FAVORITE = new ConfigHotkey("modifierToggleVillagerGlobalFavorite", "LEFT_SHIFT", GUI_RELAXED, "Modifier key to hold while middle clicking a trade,\nto toggle the global favorite state for that trade.\nGlobal favorites are used for villagers that don't have any specific favorites set."); + public static final ConfigHotkey MODIFIER_TOGGLE_VILLAGER_GLOBAL_FAVORITE = new ConfigHotkey("modifierToggleVillagerGlobalFavorite", "LEFT_SHIFT", GUI_RELAXED, "Modifier key to hold while middle clicking a trade,\nto toggle the global favorite state for that trade.\nGlobal favorites are used for villagers that don't\nhave any \"local\"/villager-specific favorites set."); public static final List HOTKEY_LIST = ImmutableList.of( - KEY_OPEN_CONFIG_GUI, + OPEN_CONFIG_GUI, + TOGGLE_MOD_ON_OFF, + + CRAFT_EVERYTHING, + DROP_ALL_MATCHING, + MASS_CRAFT, + MOVE_CRAFT_RESULTS, + RECIPE_VIEW, + SLOT_DEBUG, + STORE_RECIPE, + THROW_CRAFT_RESULTS, + VILLAGER_TRADE_FAVORITES, MODIFIER_MOVE_EVERYTHING, MODIFIER_MOVE_MATCHING, MODIFIER_MOVE_STACK, MODIFIER_TOGGLE_VILLAGER_GLOBAL_FAVORITE, - KEY_MOVE_EVERYTHING, - KEY_DRAG_FULL_STACKS, KEY_DRAG_LEAVE_ONE, KEY_DRAG_MATCHING, @@ -70,17 +78,7 @@ public class Hotkeys KEY_DRAG_DROP_SINGLE, KEY_DRAG_DROP_STACKS, - KEY_CRAFT_EVERYTHING, - KEY_DROP_ALL_MATCHING, - KEY_MAIN_TOGGLE, - KEY_MASS_CRAFT, - KEY_MOVE_CRAFT_RESULTS, - KEY_MOVE_STACK_TO_OFFHAND, - KEY_RECIPE_VIEW, - KEY_SLOT_DEBUG, - KEY_STORE_RECIPE, - KEY_THROW_CRAFT_RESULTS, - KEY_VILLAGER_TRADE_FAVORITES, + KEY_MOVE_EVERYTHING, KEY_WS_MOVE_DOWN_LEAVE_ONE, KEY_WS_MOVE_DOWN_MATCHING, diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index f998792a1..cee94cbc8 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -2,6 +2,7 @@ import org.lwjgl.glfw.GLFW; import net.minecraft.client.MinecraftClient; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.entity.passive.MerchantEntity; @@ -108,19 +109,27 @@ public boolean onMouseClick(int mouseX, int mouseY, int eventButton, boolean eve private boolean handleInput(int keyCode, boolean keyState, double dWheel) { - if (Configs.Generic.RATE_LIMIT_CLICK_PACKETS.getBooleanValue()) + MinecraftClient mc = MinecraftClient.getInstance(); + + if (mc.player == null) + { + return false; + } + + if (Configs.Generic.RATE_LIMIT_CLICK_PACKETS.getBooleanValue() && + this.callbacks.functionalityEnabled()) { ClickPacketBuffer.setShouldBufferClickPackets(true); } - boolean cancel = this.handleInputImpl(keyCode, keyState, dWheel); + boolean cancel = this.handleInputImpl(keyCode, keyState, dWheel, mc); ClickPacketBuffer.setShouldBufferClickPackets(false); return cancel; } - private boolean handleInputImpl(int keyCode, boolean keyState, double dWheel) + private boolean handleInputImpl(int keyCode, boolean keyState, double dWheel, MinecraftClient mc) { MoveAction action = InventoryUtils.getActiveMoveAction(); @@ -129,7 +138,6 @@ private boolean handleInputImpl(int keyCode, boolean keyState, double dWheel) InventoryUtils.stopDragging(); } - MinecraftClient mc = MinecraftClient.getInstance(); boolean cancel = false; if (this.callbacks.functionalityEnabled() && mc.player != null) @@ -140,12 +148,13 @@ private boolean handleInputImpl(int keyCode, boolean keyState, double dWheel) final boolean isAttackUseOrPick = isAttack || isUse || isPickBlock; final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); final int mouseY = fi.dy.masa.malilib.util.InputUtils.getMouseY(); + Screen screen = GuiUtils.getCurrentScreen(); if (Configs.Toggles.VILLAGER_TRADE_FEATURES.getBooleanValue()) { VillagerDataStorage storage = VillagerDataStorage.getInstance(); - if (GuiUtils.getCurrentScreen() == null && mc.crosshairTarget != null && + if (screen == null && mc.crosshairTarget != null && mc.crosshairTarget.getType() == HitResult.Type.ENTITY && ((EntityHitResult) mc.crosshairTarget).getEntity() instanceof MerchantEntity) { @@ -153,11 +162,11 @@ private boolean handleInputImpl(int keyCode, boolean keyState, double dWheel) } } - if (GuiUtils.getCurrentScreen() instanceof HandledScreen && - (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && - Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) + if (screen instanceof HandledScreen && + (screen instanceof CreativeInventoryScreen) == false && + Configs.GUI_BLACKLIST.contains(screen.getClass().getName()) == false) { - HandledScreen gui = (HandledScreen) GuiUtils.getCurrentScreen(); + HandledScreen gui = (HandledScreen) screen; RecipeStorage recipes = RecipeStorage.getInstance(); if (dWheel != 0) @@ -235,10 +244,10 @@ public void onMouseMove(int mouseX, int mouseY) if (this.callbacks.functionalityEnabled() && mc.player != null && - GuiUtils.getCurrentScreen() instanceof HandledScreen && - Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false) + GuiUtils.getCurrentScreen() instanceof HandledScreen screen && + Configs.GUI_BLACKLIST.contains(screen.getClass().getName()) == false) { - this.handleDragging((HandledScreen) GuiUtils.getCurrentScreen(), mc, mouseX, mouseY, false); + this.handleDragging(screen, mc, mouseX, mouseY, false); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index b1d76c9f7..168f2c88c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -4,9 +4,7 @@ import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen; -import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.screen.slot.Slot; -import net.minecraft.sound.SoundEvents; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -21,18 +19,18 @@ import fi.dy.masa.itemscroller.util.MoveAction; import fi.dy.masa.malilib.config.options.ConfigHotkey; import fi.dy.masa.malilib.gui.GuiBase; +import fi.dy.masa.malilib.gui.Message; import fi.dy.masa.malilib.hotkeys.IHotkeyCallback; import fi.dy.masa.malilib.hotkeys.IKeybind; 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.util.InfoUtils; public class KeybindCallbacks implements IHotkeyCallback, IClientTickHandler { private static final KeybindCallbacks INSTANCE = new KeybindCallbacks(); - private boolean disabled; - public static KeybindCallbacks getInstance() { return INSTANCE; @@ -52,7 +50,7 @@ public void setCallbacks() public boolean functionalityEnabled() { - return this.disabled == false; + return Configs.Generic.MOD_MAIN_TOGGLE.getBooleanValue(); } @Override @@ -79,28 +77,20 @@ private boolean onKeyActionImpl(KeyAction action, IKeybind key) return false; } - if (key == Hotkeys.KEY_MAIN_TOGGLE.getKeybind()) + if (key == Hotkeys.TOGGLE_MOD_ON_OFF.getKeybind()) { - this.disabled = ! this.disabled; - - if (this.disabled) - { - mc.player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_BASS, 0.8f, 0.8f); - } - else - { - mc.player.playSound(SoundEvents.BLOCK_NOTE_BLOCK_PLING, 0.5f, 1.0f); - } - + Configs.Generic.MOD_MAIN_TOGGLE.toggleBooleanValue(); + String msg = this.functionalityEnabled() ? "itemscroller.message.toggled_mod_on" : "itemscroller.message.toggled_mod_off"; + InfoUtils.showGuiOrInGameMessage(Message.MessageType.INFO, msg); return true; } - else if (key == Hotkeys.KEY_OPEN_CONFIG_GUI.getKeybind()) + else if (key == Hotkeys.OPEN_CONFIG_GUI.getKeybind()) { GuiBase.openGui(new GuiConfigs()); return true; } - if (this.disabled || + if (this.functionalityEnabled() == false || (GuiUtils.getCurrentScreen() instanceof HandledScreen) == false || Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName())) { @@ -125,7 +115,7 @@ else if (key == Hotkeys.KEY_MOVE_EVERYTHING.getKeybind()) InventoryUtils.tryMoveStacks(slot, gui, false, true, false); return true; } - else if (key == Hotkeys.KEY_DROP_ALL_MATCHING.getKeybind()) + else if (key == Hotkeys.DROP_ALL_MATCHING.getKeybind()) { if (Configs.Toggles.DROP_MATCHING.getBooleanValue() && Configs.GUI_BLACKLIST.contains(gui.getClass().getName()) == false && @@ -135,33 +125,24 @@ else if (key == Hotkeys.KEY_DROP_ALL_MATCHING.getKeybind()) return true; } } - else if (key == Hotkeys.KEY_MOVE_STACK_TO_OFFHAND.getKeybind()) - { - // Swap the hovered stack to the Offhand - if ((gui instanceof InventoryScreen) && slot != null) - { - InventoryUtils.swapSlots(gui, slot.id, 45); - return true; - } - } } - if (key == Hotkeys.KEY_CRAFT_EVERYTHING.getKeybind()) + if (key == Hotkeys.CRAFT_EVERYTHING.getKeybind()) { InventoryUtils.craftEverythingPossibleWithCurrentRecipe(recipes.getSelectedRecipe(), gui); return true; } - else if (key == Hotkeys.KEY_THROW_CRAFT_RESULTS.getKeybind()) + else if (key == Hotkeys.THROW_CRAFT_RESULTS.getKeybind()) { InventoryUtils.throwAllCraftingResultsToGround(recipes.getSelectedRecipe(), gui); return true; } - else if (key == Hotkeys.KEY_MOVE_CRAFT_RESULTS.getKeybind()) + else if (key == Hotkeys.MOVE_CRAFT_RESULTS.getKeybind()) { InventoryUtils.moveAllCraftingResultsToOtherInventory(recipes.getSelectedRecipe(), gui); return true; } - else if (key == Hotkeys.KEY_STORE_RECIPE.getKeybind()) + else if (key == Hotkeys.STORE_RECIPE.getKeybind()) { if (InputUtils.isRecipeViewOpen() && InventoryUtils.isCraftingSlot(gui, slot)) { @@ -169,11 +150,11 @@ else if (key == Hotkeys.KEY_STORE_RECIPE.getKeybind()) return true; } } - else if (key == Hotkeys.KEY_VILLAGER_TRADE_FAVORITES.getKeybind()) + else if (key == Hotkeys.VILLAGER_TRADE_FAVORITES.getKeybind()) { return InventoryUtils.villagerTradeEverythingPossibleWithAllFavoritedTrades(); } - else if (key == Hotkeys.KEY_SLOT_DEBUG.getKeybind()) + else if (key == Hotkeys.SLOT_DEBUG.getKeybind()) { if (slot != null) { @@ -193,7 +174,7 @@ else if (key == Hotkeys.KEY_SLOT_DEBUG.getKeybind()) @Override public void onClientTick(MinecraftClient mc) { - if (this.disabled || mc.player == null) + if (this.functionalityEnabled() == false || mc.player == null) { return; } @@ -208,7 +189,7 @@ public void onClientTick(MinecraftClient mc) if (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.MASS_CRAFT.getKeybind().isKeybindHeld()) { Screen guiScreen = GuiUtils.getCurrentScreen(); HandledScreen gui = (HandledScreen) guiScreen; diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index 4f11c8e06..1b183575d 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -14,7 +14,7 @@ public class InputUtils public static boolean isRecipeViewOpen() { return GuiUtils.getCurrentScreen() != null && - Hotkeys.KEY_RECIPE_VIEW.getKeybind().isKeybindHeld() && + Hotkeys.RECIPE_VIEW.getKeybind().isKeybindHeld() && KeybindCallbacks.getInstance().functionalityEnabled() && CraftingHandler.isCraftingGui(GuiUtils.getCurrentScreen()); } diff --git a/src/main/resources/assets/itemscroller/lang/en_us.json b/src/main/resources/assets/itemscroller/lang/en_us.json index 0d1ef0745..7247a1551 100644 --- a/src/main/resources/assets/itemscroller/lang/en_us.json +++ b/src/main/resources/assets/itemscroller/lang/en_us.json @@ -1,5 +1,4 @@ { - "itemscroller.gui.button.config_gui.generic": "Generic", "itemscroller.gui.button.config_gui.hotkeys": "Hotkeys", "itemscroller.gui.button.config_gui.toggles": "Toggles", @@ -8,5 +7,8 @@ "itemscroller.gui.label.trades": "Trades", "itemscroller.gui.label.trade_uses": "Trade uses: %d / %d", - "itemscroller.gui.title.configs": "Item Scroller Configs" + "itemscroller.gui.title.configs": "Item Scroller Configs", + + "itemscroller.message.toggled_mod_off": "Toggled all Item Scroller functionality §cOFF", + "itemscroller.message.toggled_mod_on": "Toggled all Item Scroller functionality §aON" } \ No newline at end of file From 062f478ac283ee05a658da242df27ecf0151f19c Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Mon, 10 Jan 2022 04:05:08 +0200 Subject: [PATCH 089/107] Update to MC 1.18.1 (just version bumps) --- build.properties | 12 ++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/resources/fabric.mod.json | 2 +- src/main/resources/pack.mcmeta | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/build.properties b/build.properties index 23081e9bb..59d560ae5 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.15.0 # Required malilib version -malilib_version = 0.10.0-dev.26 +malilib_version = 0.11.1 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.18.0 -minecraft_version = 1.18 -mappings_version = 1.18+build.1 +minecraft_version_out = 1.18.1 +minecraft_version = 1.18.1 +mappings_version = 1.18.1+build.18 -fabric_loader_version = 0.12.8 -mod_menu_version = 3.0.0 +fabric_loader_version = 0.12.12 +mod_menu_version = 3.0.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 88789396d..f6eeba20a 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Aug 22 17:36:22 EDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 434be67d6..9de99e080 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,6 +34,6 @@ "depends": { "minecraft": "1.18.x", - "malilib": ">=0.10.0-dev.26 <0.11" + "malilib": ">=0.11.0 <0.12" } } diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index ebbe97a47..543c9f254 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,5 @@ { - "pack": - { + "pack": { "pack_format": 8, "description": "Item Scroller" } From af53bdfa4f8951c05b3e605fa8eae202fd676452 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 1 Mar 2022 16:49:55 +0200 Subject: [PATCH 090/107] Change the default config screen tab to be Generic --- .../java/fi/dy/masa/itemscroller/gui/GuiConfigs.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java index e4a9efef3..8cdafadb0 100644 --- a/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java +++ b/src/main/java/fi/dy/masa/itemscroller/gui/GuiConfigs.java @@ -2,6 +2,7 @@ import java.util.Collections; import java.util.List; +import com.google.common.collect.ImmutableList; import fi.dy.masa.itemscroller.Reference; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -14,7 +15,7 @@ public class GuiConfigs extends GuiConfigsBase { - private static ConfigGuiTab tab = ConfigGuiTab.HOTKEYS; + private static ConfigGuiTab tab = ConfigGuiTab.GENERIC; public GuiConfigs() { @@ -30,7 +31,7 @@ public void initGui() int x = 10; int y = 26; - for (ConfigGuiTab tab : ConfigGuiTab.values()) + for (ConfigGuiTab tab : ConfigGuiTab.VALUES) { x += this.createButton(x, y, -1, tab); } @@ -114,7 +115,9 @@ public enum ConfigGuiTab private final String translationKey; - private ConfigGuiTab(String translationKey) + public static final ImmutableList VALUES = ImmutableList.copyOf(values()); + + ConfigGuiTab(String translationKey) { this.translationKey = translationKey; } From 1ab23589eb9b65f1204cbe1f801ec28f50ae2882 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Tue, 1 Mar 2022 16:50:50 +0200 Subject: [PATCH 091/107] Fix a crash in the villager trade screen due to an OOB index Still no idea how that index happens in the first place sometimes... --- .../mixin/MixinMerchantScreen.java | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java index f9517abdb..b6ec02ea9 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java @@ -34,6 +34,8 @@ public abstract class MixinMerchantScreen extends HandledScreen Date: Thu, 3 Mar 2022 16:22:21 +0200 Subject: [PATCH 092/107] Fix a bunch of warnings, and some code style clean-up --- .../masa/itemscroller/event/InputHandler.java | 2 +- .../itemscroller/event/KeybindCallbacks.java | 4 +- .../masa/itemscroller/util/AccessorUtils.java | 3 + .../itemscroller/util/InventoryUtils.java | 284 +++++++++++++----- 4 files changed, 211 insertions(+), 82 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java index cee94cbc8..66620dd42 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/InputHandler.java @@ -263,7 +263,7 @@ private boolean handleDragging(HandledScreen gui, MinecraftClient mc, int mou if (InputUtils.isActionKeyActive(action)) { - cancel = InventoryUtils.dragMoveItems(gui, mc, action, mouseX, mouseY, false); + cancel = InventoryUtils.dragMoveItems(gui, action, mouseX, mouseY, false); } else if (action != MoveAction.NONE) { diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 168f2c88c..820ffcedb 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -108,7 +108,7 @@ else if (key == Hotkeys.OPEN_CONFIG_GUI.getKeybind()) { final int mouseX = fi.dy.masa.malilib.util.InputUtils.getMouseX(); final int mouseY = fi.dy.masa.malilib.util.InputUtils.getMouseY(); - return InventoryUtils.dragMoveItems(gui, mc, moveAction, mouseX, mouseY, true); + return InventoryUtils.dragMoveItems(gui, moveAction, mouseX, mouseY, true); } else if (key == Hotkeys.KEY_MOVE_EVERYTHING.getKeybind()) { @@ -204,7 +204,7 @@ public void onClientTick(MinecraftClient mc) RecipePattern recipe = RecipeStorage.getInstance().getSelectedRecipe(); - InventoryUtils.tryClearCursor(gui, mc); + InventoryUtils.tryClearCursor(gui); InventoryUtils.throwAllCraftingResultsToGround(recipe, gui); InventoryUtils.tryMoveItemsToFirstCraftingGrid(recipe, gui, true); diff --git a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java index 6929bbda3..45185423e 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/AccessorUtils.java @@ -1,5 +1,6 @@ package fi.dy.masa.itemscroller.util; +import javax.annotation.Nullable; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.client.gui.screen.ingame.MerchantScreen; import net.minecraft.screen.slot.Slot; @@ -10,11 +11,13 @@ public class AccessorUtils { + @Nullable public static Slot getSlotUnderMouse(HandledScreen gui) { return ((IMixinScreenWithHandler) gui).itemscroller_getHoveredSlot(); } + @Nullable public static Slot getSlotAtPosition(HandledScreen gui, int x, int y) { return ((IMixinScreenWithHandler) gui).itemscroller_getSlotAtPositionInvoker(x, y); diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index ca8c9fe96..a1313c3f9 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -7,6 +7,7 @@ import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Optional; import java.util.Set; import javax.annotation.Nullable; @@ -55,13 +56,14 @@ public class InventoryUtils private static int lastPosX; private static int lastPosY; private static int slotNumberLast; - private static final Set DRAGGED_SLOTS = new HashSet(); + private static final Set DRAGGED_SLOTS = new HashSet<>(); private static WeakReference sourceSlotCandidate = null; private static WeakReference sourceSlot = null; private static ItemStack stackInCursorLast = ItemStack.EMPTY; public static void onSlotChangedCraftingGrid(PlayerEntity player, - CraftingInventory craftMatrix, CraftingResultInventory inventoryCraftResult) + CraftingInventory craftMatrix, + CraftingResultInventory inventoryCraftResult) { World world = player.getEntityWorld(); @@ -96,11 +98,11 @@ public static String getStackString(ItemStack stack) if (isStackEmpty(stack) == false) { Identifier rl = Registry.ITEM.getId(stack.getItem()); + String idStr = rl != null ? rl.toString() : "null"; + String displayName = stack.getName().getString(); + String nbtStr = stack.getNbt() != null ? stack.getNbt().toString() : ""; - return String.format("[%s - display: %s - NBT: %s] (%s)", - rl != null ? rl.toString() : "null", stack.getName().getString(), - stack.getNbt() != null ? stack.getNbt().toString() : "", - stack.toString()); + return String.format("[%s - display: %s - NBT: %s] (%s)", idStr, displayName, nbtStr, stack); } return ""; @@ -166,7 +168,9 @@ public static boolean canShiftPlaceItems(HandledScreen slot.hasStack() == false && slot.canInsert(stackCursor); } - public static boolean tryMoveItems(HandledScreen gui, RecipeStorage recipes, boolean scrollingUp) + public static boolean tryMoveItems(HandledScreen gui, + RecipeStorage recipes, + boolean scrollingUp) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); @@ -199,7 +203,7 @@ public static boolean tryMoveItems(HandledScreen gui, R } // Check that the slot is valid, (don't require items in case of the villager output slot or a crafting slot) - if (isValidSlot(slot, gui, villagerHandling || craftingHandling ? false : true) == false) + if (isValidSlot(slot, gui, villagerHandling == false && craftingHandling == false) == false) { return false; } @@ -257,7 +261,9 @@ else if (getStackSize(stack) < slot.getMaxItemCount(stack)) return false; } - public static boolean dragMoveItems(HandledScreen gui, MinecraftClient mc, MoveAction action, int mouseX, int mouseY, boolean isClick) + public static boolean dragMoveItems(HandledScreen gui, + MoveAction action, + int mouseX, int mouseY, boolean isClick) { if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) { @@ -360,7 +366,8 @@ public static void stopDragging() DRAGGED_SLOTS.clear(); } - private static boolean dragMoveFromSlotAtPosition(HandledScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPosition(HandledScreen gui, + int x, int y, MoveAction action) { if (gui instanceof CreativeInventoryScreen) { @@ -431,7 +438,8 @@ private static boolean dragMoveFromSlotAtPosition(HandledScreen gui, int x, int y, MoveAction action) + private static boolean dragMoveFromSlotAtPositionCreative(HandledScreen gui, + int x, int y, MoveAction action) { CreativeInventoryScreen guiCreative = (CreativeInventoryScreen) gui; Slot slot = AccessorUtils.getSlotAtPosition(gui, x, y); @@ -525,7 +533,10 @@ private static boolean dragMoveFromSlotAtPositionCreative(HandledScreen gui, ItemStack stackReference, Slot slotReference, boolean sameInventory) + public static void dropStacks(HandledScreen gui, + ItemStack stackReference, + Slot slotReference, + boolean sameInventory) { if (slotReference != null && isStackEmpty(stackReference) == false) { @@ -545,7 +556,8 @@ public static void dropStacks(HandledScreen gui, ItemSt } } - public static void dropAllMatchingStacks(HandledScreen gui, ItemStack stackReference) + public static void dropAllMatchingStacks(HandledScreen gui, + ItemStack stackReference) { if (isStackEmpty(stackReference) == false) { @@ -636,7 +648,10 @@ public static void checkForItemPickup(HandledScreen gui) } } - private static boolean tryMoveItemsVillager(MerchantScreen gui, Slot slot, boolean moveToOtherInventory, boolean fullStacks) + private static boolean tryMoveItemsVillager(MerchantScreen gui, + Slot slot, + boolean moveToOtherInventory, + boolean fullStacks) { if (fullStacks) { @@ -749,7 +764,8 @@ public static boolean villagerTradeEverythingPossibleWithAllFavoritedTrades() return false; } - private static boolean tryMoveSingleItemToOtherInventory(Slot slot, HandledScreen gui) + private static boolean tryMoveSingleItemToOtherInventory(Slot slot, + HandledScreen gui) { ItemStack stackOrig = slot.getStack(); ScreenHandler container = gui.getScreenHandler(); @@ -801,7 +817,8 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, HandledScree return false; } - private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledScreen gui) + private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, + HandledScreen gui) { MinecraftClient mc = MinecraftClient.getInstance(); PlayerEntity player = mc.player; @@ -925,7 +942,8 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, HandledSc return false; } - private static boolean tryMoveSingleItemToThisInventory(Slot slot, HandledScreen gui) + private static boolean tryMoveSingleItemToThisInventory(Slot slot, + HandledScreen gui) { ScreenHandler container = gui.getScreenHandler(); ItemStack stackOrig = slot.getStack(); @@ -974,12 +992,21 @@ private static boolean tryMoveSingleItemToThisInventory(Slot slot, HandledScreen return false; } - public static void tryMoveStacks(Slot slot, HandledScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + public static void tryMoveStacks(Slot slot, + HandledScreen gui, + boolean matchingOnly, + boolean toOtherInventory, + boolean firstOnly) { tryMoveStacks(slot.getStack(), slot, gui, matchingOnly, toOtherInventory, firstOnly); } - private static void tryMoveStacks(ItemStack stackReference, Slot slot, HandledScreen gui, boolean matchingOnly, boolean toOtherInventory, boolean firstOnly) + private static void tryMoveStacks(ItemStack stackReference, + Slot slot, + HandledScreen gui, + boolean matchingOnly, + boolean toOtherInventory, + boolean firstOnly) { ScreenHandler container = gui.getScreenHandler(); final int maxSlot = container.slots.size() - 1; @@ -1016,7 +1043,8 @@ private static void tryMoveStacks(ItemStack stackReference, Slot slot, HandledSc } } - private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, boolean fillStacks) + private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, + boolean fillStacks) { TradeOfferList list = gui.getScreenHandler().getRecipes(); int index = AccessorUtils.getSelectedMerchantRecipe(gui); @@ -1047,7 +1075,10 @@ private static void tryMoveItemsToMerchantBuySlots(MerchantScreen gui, boolean f } } - private static void fillBuySlot(HandledScreen gui, int slotNum, ItemStack buyStack, boolean fillStacks) + private static void fillBuySlot(HandledScreen gui, + int slotNum, + ItemStack buyStack, + boolean fillStacks) { Slot slot = gui.getScreenHandler().getSlot(slotNum); ItemStack existingStack = slot.getStack(); @@ -1067,8 +1098,14 @@ private static void fillBuySlot(HandledScreen gui, int } } - public static void handleRecipeClick(HandledScreen gui, MinecraftClient mc, RecipeStorage recipes, int hoveredRecipeId, - boolean isLeftClick, boolean isRightClick, boolean isPickBlock, boolean isShiftDown) + public static void handleRecipeClick(HandledScreen gui, + MinecraftClient mc, + RecipeStorage recipes, + int hoveredRecipeId, + boolean isLeftClick, + boolean isRightClick, + boolean isPickBlock, + boolean isShiftDown) { if (isLeftClick || isRightClick) { @@ -1130,7 +1167,9 @@ else if (isPickBlock) } } - public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, HandledScreen gui, boolean fillStacks) + public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, + HandledScreen gui, + boolean fillStacks) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1140,22 +1179,29 @@ public static void tryMoveItemsToFirstCraftingGrid(RecipePattern recipe, Handled } } - public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, HandledScreen gui) + public static void loadRecipeItemsToGridForOutputSlotUnderMouse(RecipePattern recipe, + HandledScreen gui) { Slot slot = AccessorUtils.getSlotUnderMouse(gui); loadRecipeItemsToGridForOutputSlot(recipe, gui, slot); } - private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, HandledScreen gui, Slot outputSlot) + private static void loadRecipeItemsToGridForOutputSlot(RecipePattern recipe, + HandledScreen gui, + Slot outputSlot) { - if (outputSlot != null && isCraftingSlot(gui, outputSlot) && isStackEmpty(recipe.getResult()) == false) + if (isCraftingSlot(gui, outputSlot) && isStackEmpty(recipe.getResult()) == false) { tryMoveItemsToCraftingGridSlots(recipe, outputSlot, gui, false); } } - private static boolean tryMoveItemsCrafting(RecipeStorage recipes, Slot slot, HandledScreen gui, - boolean moveToOtherInventory, boolean moveStacks, boolean moveEverything) + private static boolean tryMoveItemsCrafting(RecipeStorage recipes, + Slot slot, + HandledScreen gui, + boolean moveToOtherInventory, + boolean moveStacks, + boolean moveEverything) { RecipePattern recipe = recipes.getSelectedRecipe(); ItemStack stackRecipeOutput = recipe.getResult(); @@ -1198,7 +1244,9 @@ else if (moveToOtherInventory == false && isStackEmpty(stackRecipeOutput) == fal return false; } - private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, HandledScreen gui) + private static void craftAsManyItemsAsPossible(RecipePattern recipe, + Slot slot, + HandledScreen gui) { ItemStack result = recipe.getResult(); int failSafe = 1024; @@ -1222,7 +1270,9 @@ private static void craftAsManyItemsAsPossible(RecipePattern recipe, Slot slot, } } - public static void clearFirstCraftingGridOfItems(RecipePattern recipe, HandledScreen gui, boolean clearNonMatchingOnly) + public static void clearFirstCraftingGridOfItems(RecipePattern recipe, + HandledScreen gui, + boolean clearNonMatchingOnly) { Slot craftingOutputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1244,7 +1294,10 @@ public static void clearFirstCraftingGridOfAllItems(HandledScreen gui, SlotRange range, boolean clearNonMatchingOnly) + private static boolean clearCraftingGridOfItems(RecipePattern recipe, + HandledScreen gui, + SlotRange range, + boolean clearNonMatchingOnly) { final int invSlots = gui.getScreenHandler().slots.size(); final int rangeSlots = range.getSlotCount(); @@ -1296,7 +1349,10 @@ private static boolean clearCraftingGridOfAllItems(HandledScreen gui, boolean fillStacks) + private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, + Slot slot, + HandledScreen gui, + boolean fillStacks) { ScreenHandler container = gui.getScreenHandler(); int numSlots = container.slots.size(); @@ -1319,7 +1375,7 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slo { ItemStack ingredientReference = entry.getKey().getStack(); List recipeSlots = entry.getValue(); - List targetSlots = new ArrayList(); + List targetSlots = new ArrayList<>(); // Get the actual target slot numbers based on the grid's start and the relative positions inside the grid for (int s : recipeSlots) @@ -1341,7 +1397,10 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, Slo return false; } - private static void fillCraftingGrid(HandledScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void fillCraftingGrid(HandledScreen gui, + Slot slotGridFirst, + ItemStack ingredientReference, + List targetSlots) { ScreenHandler container = gui.getScreenHandler(); int slotNum; @@ -1451,7 +1510,8 @@ public static void rightClickCraftOneStack(HandledScreen gui) + public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe, + HandledScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1477,7 +1537,8 @@ public static void craftEverythingPossibleWithCurrentRecipe(RecipePattern recipe } } - public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, HandledScreen gui) + public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, + HandledScreen gui) { if (isStackEmpty(recipe.getResult()) == false) { @@ -1509,7 +1570,8 @@ public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, } } - public static void throwAllCraftingResultsToGround(RecipePattern recipe, HandledScreen gui) + public static void throwAllCraftingResultsToGround(RecipePattern recipe, + HandledScreen gui) { Slot slot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1519,7 +1581,8 @@ public static void throwAllCraftingResultsToGround(RecipePattern recipe, Handled } } - public static void throwAllNonRecipeItemsToGround(RecipePattern recipe, HandledScreen gui) + public static void throwAllNonRecipeItemsToGround(RecipePattern recipe, + HandledScreen gui) { Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); @@ -1543,7 +1606,9 @@ public static void throwAllNonRecipeItemsToGround(RecipePattern recipe, HandledS } } - private static int putSingleItemIntoSlots(HandledScreen gui, List targetSlots, int startIndex) + private static int putSingleItemIntoSlots(HandledScreen gui, + List targetSlots, + int startIndex) { ItemStack stackInCursor = gui.getScreenHandler().getCursorStack(); @@ -1573,7 +1638,8 @@ private static int putSingleItemIntoSlots(HandledScreen return count; } - public static void moveOneSetOfItemsFromSlotToPlayerInventory(HandledScreen gui, Slot slot) + public static void moveOneSetOfItemsFromSlotToPlayerInventory(HandledScreen gui, + Slot slot) { leftClickSlot(gui, slot.id); @@ -1591,7 +1657,10 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(HandledScreen gui, Slot slotGridFirst, ItemStack ingredientReference, List targetSlots) + private static void moveOneRecipeItemIntoCraftingGrid(HandledScreen gui, + Slot slotGridFirst, + ItemStack ingredientReference, + List targetSlots) { ScreenHandler container = gui.getScreenHandler(); int index = 0; @@ -1637,7 +1706,8 @@ private static void moveOneRecipeItemIntoCraftingGrid(HandledScreen gui, List slotNumbers) + private static boolean moveItemFromCursorToSlots(HandledScreen gui, + List slotNumbers) { for (int slotNum : slotNumbers) { @@ -1652,7 +1722,11 @@ private static boolean moveItemFromCursorToSlots(HandledScreen gui, int slotTo, Inventory invSrc, ItemStack stackTemplate, boolean fillStacks) + private static void moveItemsFromInventory(HandledScreen gui, + int slotTo, + Inventory invSrc, + ItemStack stackTemplate, + boolean fillStacks) { ScreenHandler container = gui.getScreenHandler(); @@ -1681,7 +1755,9 @@ private static void moveItemsFromInventory(HandledScreen getSlotNumbersOfMatchingStacks( - ScreenHandler container, Slot slotReference, boolean sameInventory, - ItemStack stackReference, boolean preferPartial, boolean treatHotbarAsDifferent, boolean reverse) + @SuppressWarnings("SameParameterValue") + private static List getSlotNumbersOfMatchingStacks(ScreenHandler container, + Slot slotReference, + boolean sameInventory, + ItemStack stackReference, + boolean preferPartial, + boolean treatHotbarAsDifferent, + boolean reverse) { List slots = new ArrayList<>(64); final int maxSlot = container.slots.size() - 1; @@ -1796,7 +1880,10 @@ private static List getSlotNumbersOfMatchingStacks( return slots; } - private static List getSlotNumbersOfMatchingStacks(ScreenHandler container, ItemStack stackReference, boolean preferPartial) + @SuppressWarnings("SameParameterValue") + private static List getSlotNumbersOfMatchingStacks(ScreenHandler container, + ItemStack stackReference, + boolean preferPartial) { List slots = new ArrayList<>(64); final int maxSlot = container.slots.size() - 1; @@ -1821,8 +1908,12 @@ private static List getSlotNumbersOfMatchingStacks(ScreenHandler contai return slots; } - private static List getSlotNumbersOfEmptySlots( - ScreenHandler container, Slot slotReference, boolean sameInventory, boolean treatHotbarAsDifferent, boolean reverse) + @SuppressWarnings("SameParameterValue") + private static List getSlotNumbersOfEmptySlots(ScreenHandler container, + Slot slotReference, + boolean sameInventory, + boolean treatHotbarAsDifferent, + boolean reverse) { List slots = new ArrayList<>(64); final int maxSlot = container.slots.size() - 1; @@ -1842,7 +1933,9 @@ private static List getSlotNumbersOfEmptySlots( return slots; } - private static List getSlotNumbersOfEmptySlotsInPlayerInventory(ScreenHandler container, boolean reverse) + @SuppressWarnings("SameParameterValue") + private static List getSlotNumbersOfEmptySlotsInPlayerInventory(ScreenHandler container, + boolean reverse) { List slots = new ArrayList<>(64); final int maxSlot = container.slots.size() - 1; @@ -1956,7 +2049,9 @@ private void clickSlotsToMoveItems(Slot slot, ContainerScreen gui, boolean toOtherInventory) + private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, + HandledScreen gui, + boolean toOtherInventory) { // Left click to pick up the found source stack leftClickSlot(gui, slotFrom.id); @@ -1990,7 +2085,9 @@ private static void clickSlotsToMoveItemsFromSlot(Slot slotFrom, HandledScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveSingleItem(HandledScreen gui, + int slotFrom, + int slotTo) { //System.out.println("clickSlotsToMoveSingleItem(from: " + slotFrom + ", to: " + slotTo + ")"); ItemStack stack = gui.getScreenHandler().slots.get(slotFrom).getStack(); @@ -2024,7 +2121,8 @@ private static boolean clickSlotsToMoveSingleItem(HandledScreen gui, int slotFrom) + private static boolean clickSlotsToMoveSingleItemByShiftClick(HandledScreen gui, + int slotFrom) { Slot slot = gui.getScreenHandler().slots.get(slotFrom); ItemStack stack = slot.getStack(); @@ -2068,7 +2166,9 @@ private static boolean clickSlotsToMoveSingleItemByShiftClick(HandledScreen gui, int slotFrom, int slotTo) + private static boolean clickSlotsToMoveItems(HandledScreen gui, + int slotFrom, + int slotTo) { //System.out.println("clickSlotsToMoveItems(from: " + slotFrom + ", to: " + slotTo + ")"); @@ -2099,7 +2199,8 @@ private static boolean clickSlotsToMoveItems(HandledScreen gui, int slotNum) + public static void dropStacksUntilEmpty(HandledScreen gui, + int slotNum) { if (slotNum >= 0 && slotNum < gui.getScreenHandler().slots.size()) { @@ -2113,7 +2214,9 @@ public static void dropStacksUntilEmpty(HandledScreen g } } - public static void dropStacksWhileHasItem(HandledScreen gui, int slotNum, ItemStack stackReference) + public static void dropStacksWhileHasItem(HandledScreen gui, + int slotNum, + ItemStack stackReference) { if (slotNum >= 0 && slotNum < gui.getScreenHandler().slots.size()) { @@ -2127,7 +2230,8 @@ public static void dropStacksWhileHasItem(HandledScreen } } - private static boolean shiftClickSlotWithCheck(HandledScreen gui, int slotNum) + private static boolean shiftClickSlotWithCheck(HandledScreen gui, + int slotNum) { Slot slot = gui.getScreenHandler().getSlot(slotNum); @@ -2142,7 +2246,10 @@ private static boolean shiftClickSlotWithCheck(HandledScreen gui, Slot slot, boolean moveUp, MoveAmount amount) + public static boolean tryMoveItemsVertically(HandledScreen gui, + Slot slot, + boolean moveUp, + MoveAmount amount) { // We require an empty cursor if (slot == null || isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) @@ -2177,19 +2284,21 @@ else if (amount == MoveAmount.ALL_MATCHING) return true; } - private static void moveMatchingStacksToSlots(HandledScreen gui, Slot slot, boolean moveUp) + private static void moveMatchingStacksToSlots(HandledScreen gui, + Slot slot, + boolean moveUp) { List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, true, slot.getStack(), true, true, false); List targetSlots = getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, false, true, false); targetSlots.addAll(getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, true, true, false)); targetSlots.addAll(matchingSlots); - Collections.sort(matchingSlots, new SlotVerticalSorterSlotNumbers(gui.getScreenHandler(), ! moveUp)); - Collections.sort(targetSlots, new SlotVerticalSorterSlotNumbers(gui.getScreenHandler(), moveUp)); + matchingSlots.sort(new SlotVerticalSorterSlotNumbers(gui.getScreenHandler(), !moveUp)); + targetSlots.sort(new SlotVerticalSorterSlotNumbers(gui.getScreenHandler(), moveUp)); - for (int i = 0; i < matchingSlots.size(); ++i) + for (Integer matchingSlot : matchingSlots) { - int srcSlotNum = matchingSlots.get(i).intValue(); + int srcSlotNum = matchingSlot.intValue(); Slot srcSlot = gui.getScreenHandler().getSlot(srcSlotNum); Slot lastSlot = moveStackToSlots(gui, srcSlot, targetSlots, false); @@ -2200,7 +2309,10 @@ private static void moveMatchingStacksToSlots(HandledScreen gui, Slot slotFrom, List slotsTo, boolean leaveOne) + private static Slot moveStackToSlots(HandledScreen gui, + Slot slotFrom, + List slotsTo, + boolean leaveOne) { Slot lastSlot = null; @@ -2245,7 +2357,9 @@ private static Slot moveStackToSlots(HandledScreen gui, return lastSlot; } - private static void moveOneItemToFirstValidSlot(HandledScreen gui, Slot slotFrom, List slotsTo) + private static void moveOneItemToFirstValidSlot(HandledScreen gui, + Slot slotFrom, + List slotsTo) { // Pick up half of the the stack rightClickSlot(gui, slotFrom.id); @@ -2275,7 +2389,9 @@ private static void moveOneItemToFirstValidSlot(HandledScreen getVerticallyFurthestSuitableSlotsForStackInSlot(ScreenHandler container, final Slot slotIn, boolean above) + private static List getVerticallyFurthestSuitableSlotsForStackInSlot(ScreenHandler container, + Slot slotIn, + boolean above) { if (slotIn == null || slotIn.hasStack() == false) { @@ -2302,12 +2418,12 @@ private static List getVerticallyFurthestSuitableSlotsForStackInSlot(Sc } } - Collections.sort(slotNumbers, new SlotVerticalSorterSlotNumbers(container, above)); + slotNumbers.sort(new SlotVerticalSorterSlotNumbers(container, above)); return slotNumbers; } - public static void tryClearCursor(HandledScreen gui, MinecraftClient mc) + public static void tryClearCursor(HandledScreen gui) { ItemStack stackCursor = gui.getScreenHandler().getCursorStack(); @@ -2396,6 +2512,11 @@ public SlotVerticalSorterSlotNumbers(ScreenHandler container, boolean topToBotto @Override public int compare(Integer slotNum1, Integer slotNum2) { + if (Objects.equals(slotNum1, slotNum2)) + { + return 0; + } + Slot slot1 = this.container.getSlot(slotNum1.intValue()); Slot slot2 = this.container.getSlot(slotNum2.intValue()); @@ -2408,7 +2529,10 @@ public int compare(Integer slotNum1, Integer slotNum2) } } - public static void clickSlot(HandledScreen gui, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(HandledScreen gui, + int slotNum, + int mouseButton, + SlotActionType type) { if (slotNum >= 0 && slotNum < gui.getScreenHandler().slots.size()) { @@ -2430,7 +2554,11 @@ public static void clickSlot(HandledScreen gui, int slo } } - public static void clickSlot(HandledScreen gui, Slot slot, int slotNum, int mouseButton, SlotActionType type) + public static void clickSlot(HandledScreen gui, + Slot slot, + int slotNum, + int mouseButton, + SlotActionType type) { try { @@ -2495,7 +2623,8 @@ public static void swapSlots(HandledScreen gui, int slo clickSlot(gui, slotNum, 0, SlotActionType.SWAP); } - private static void dragSplitItemsIntoSlots(HandledScreen gui, List targetSlots) + private static void dragSplitItemsIntoSlots(HandledScreen gui, + List targetSlots) { ItemStack stackInCursor = gui.getScreenHandler().getCursorStack(); @@ -2511,21 +2640,18 @@ private static void dragSplitItemsIntoSlots(HandledScreen= numSlots) { break; } - clickSlot(gui, targetSlots.get(i), 1, SlotActionType.QUICK_CRAFT); + clickSlot(gui, slotNum, 1, SlotActionType.QUICK_CRAFT); } // End the drag From 2998432c54a56f1d29e27cc74c4729de43e73a73 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 3 Mar 2022 19:23:19 +0200 Subject: [PATCH 093/107] Change things from boxed List to IntArrayList --- .../itemscroller/util/InventoryUtils.java | 145 ++++++++---------- .../dy/masa/itemscroller/util/ItemType.java | 9 +- .../itemscroller/villager/FavoriteData.java | 6 +- .../itemscroller/villager/VillagerData.java | 9 +- .../villager/VillagerDataStorage.java | 6 +- .../itemscroller/villager/VillagerUtils.java | 11 +- 6 files changed, 85 insertions(+), 101 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index a1313c3f9..7ddabec24 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -1,9 +1,6 @@ package fi.dy.masa.itemscroller.util; import java.lang.ref.WeakReference; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -49,6 +46,8 @@ import fi.dy.masa.itemscroller.villager.VillagerDataStorage; import fi.dy.masa.itemscroller.villager.VillagerUtils; import fi.dy.masa.malilib.util.GuiUtils; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntComparator; public class InventoryUtils { @@ -547,7 +546,8 @@ public static void dropStacks(HandledScreen gui, { // If this slot is in the same inventory that the items were picked up to the cursor from // and the stack is identical to the one in the cursor, then this stack will get dropped. - if (areSlotsInSameInventory(slot, slotReference) == sameInventory && areStacksEqual(slot.getStack(), stackReference)) + if (areSlotsInSameInventory(slot, slotReference) == sameInventory && + areStacksEqual(slot.getStack(), stackReference)) { // Drop the stack dropStack(gui, slot.id); @@ -748,7 +748,7 @@ public static boolean villagerTradeEverythingPossibleWithAllFavoritedTrades() if (screen instanceof MerchantScreen) { MerchantScreenHandler handler = ((MerchantScreen) screen).getScreenHandler(); - List favorites = VillagerDataStorage.getInstance().getFavoritesForCurrentVillager(handler).favorites; + IntArrayList favorites = VillagerDataStorage.getInstance().getFavoritesForCurrentVillager(handler).favorites; for (int index = 0; index < favorites.size(); ++index) { @@ -899,7 +899,7 @@ private static boolean tryMoveAllButOneItemToOtherInventory(Slot slot, else { boolean treatHotbarAsDifferent = gui.getClass() == InventoryScreen.class; - List slots = getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, false, treatHotbarAsDifferent, false); + IntArrayList slots = getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, false, treatHotbarAsDifferent, false); if (slots.isEmpty()) { @@ -1369,13 +1369,13 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, // This slot is used to check that we get items from a DIFFERENT inventory than where this slot is in Slot slotGridFirst = container.getSlot(range.getFirst()); - Map> ingredientSlots = ItemType.getSlotsPerItem(recipe.getRecipeItems()); + Map ingredientSlots = ItemType.getSlotsPerItem(recipe.getRecipeItems()); - for (Map.Entry> entry : ingredientSlots.entrySet()) + for (Map.Entry entry : ingredientSlots.entrySet()) { ItemStack ingredientReference = entry.getKey().getStack(); - List recipeSlots = entry.getValue(); - List targetSlots = new ArrayList<>(); + IntArrayList recipeSlots = entry.getValue(); + IntArrayList targetSlots = new IntArrayList(); // Get the actual target slot numbers based on the grid's start and the relative positions inside the grid for (int s : recipeSlots) @@ -1400,7 +1400,7 @@ private static boolean tryMoveItemsToCraftingGridSlots(RecipePattern recipe, private static void fillCraftingGrid(HandledScreen gui, Slot slotGridFirst, ItemStack ingredientReference, - List targetSlots) + IntArrayList targetSlots) { ScreenHandler container = gui.getScreenHandler(); int slotNum; @@ -1560,7 +1560,7 @@ public static void moveAllCraftingResultsToOtherInventory(RecipePattern recipe, { // Get a list of slots with matching items, which are in the same inventory // as the slot that is assumed to be in the player inventory. - List slots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, true, stackResult, false, false, false); + IntArrayList slots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, true, stackResult, false, false, false); for (int slotNum : slots) { @@ -1607,7 +1607,7 @@ public static void throwAllNonRecipeItemsToGround(RecipePattern recipe, } private static int putSingleItemIntoSlots(HandledScreen gui, - List targetSlots, + IntArrayList targetSlots, int startIndex) { ItemStack stackInCursor = gui.getScreenHandler().getCursorStack(); @@ -1624,7 +1624,7 @@ private static int putSingleItemIntoSlots(HandledScreen for (int i = 0; i < loops; i++) { - int slotNum = targetSlots.get(startIndex + i); + int slotNum = targetSlots.getInt(startIndex + i); if (slotNum >= numSlots) { @@ -1647,7 +1647,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(HandledScreen slots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, false, stackCursor, true, true, false); + IntArrayList slots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, false, stackCursor, true, true, false); if (moveItemFromCursorToSlots(gui, slots) == false) { @@ -1660,7 +1660,7 @@ public static void moveOneSetOfItemsFromSlotToPlayerInventory(HandledScreen gui, Slot slotGridFirst, ItemStack ingredientReference, - List targetSlots) + IntArrayList targetSlots) { ScreenHandler container = gui.getScreenHandler(); int index = 0; @@ -1707,7 +1707,7 @@ private static void moveOneRecipeItemIntoCraftingGrid(HandledScreen gui, - List slotNumbers) + IntArrayList slotNumbers) { for (int slotNum : slotNumbers) { @@ -1790,8 +1790,10 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(ScreenHand ItemStack stackReference, int idealSize) { - int slotNum = -1; + int slotNumSmallest = -1; + int slotNumLargest = -1; int smallest = Integer.MAX_VALUE; + int largest = 0; for (Slot slot : container.slots) { @@ -1802,34 +1804,19 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(ScreenHand if (stackSize < smallest && stackSize >= idealSize) { - slotNum = slot.id; + slotNumSmallest = slot.id; smallest = stackSize; } - } - } - - // Didn't find an adequately sized stack, now try to find at least some items... - if (slotNum == -1) - { - int largest = 0; - for (Slot slot : container.slots) - { - if (areSlotsInSameInventory(slot, slotReference) == false && slot.hasStack() && - areStacksEqual(stackReference, slot.getStack())) + if (stackSize > largest) { - int stackSize = getStackSize(slot.getStack()); - - if (stackSize > largest) - { - slotNum = slot.id; - largest = stackSize; - } + slotNumLargest = slot.id; + largest = stackSize; } } } - return slotNum; + return slotNumSmallest != -1 ? slotNumSmallest : slotNumLargest; } /** @@ -1846,15 +1833,15 @@ private static int getSlotNumberOfSmallestStackFromDifferentInventory(ScreenHand * @return */ @SuppressWarnings("SameParameterValue") - private static List getSlotNumbersOfMatchingStacks(ScreenHandler container, - Slot slotReference, - boolean sameInventory, - ItemStack stackReference, - boolean preferPartial, - boolean treatHotbarAsDifferent, - boolean reverse) - { - List slots = new ArrayList<>(64); + private static IntArrayList getSlotNumbersOfMatchingStacks(ScreenHandler container, + Slot slotReference, + boolean sameInventory, + ItemStack stackReference, + boolean preferPartial, + boolean treatHotbarAsDifferent, + boolean reverse) + { + IntArrayList slots = new IntArrayList(64); final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; @@ -1881,11 +1868,11 @@ private static List getSlotNumbersOfMatchingStacks(ScreenHandler contai } @SuppressWarnings("SameParameterValue") - private static List getSlotNumbersOfMatchingStacks(ScreenHandler container, - ItemStack stackReference, - boolean preferPartial) + private static IntArrayList getSlotNumbersOfMatchingStacks(ScreenHandler container, + ItemStack stackReference, + boolean preferPartial) { - List slots = new ArrayList<>(64); + IntArrayList slots = new IntArrayList(64); final int maxSlot = container.slots.size() - 1; for (int i = 0; i <= maxSlot; ++i) @@ -1909,13 +1896,13 @@ private static List getSlotNumbersOfMatchingStacks(ScreenHandler contai } @SuppressWarnings("SameParameterValue") - private static List getSlotNumbersOfEmptySlots(ScreenHandler container, - Slot slotReference, - boolean sameInventory, - boolean treatHotbarAsDifferent, - boolean reverse) + private static IntArrayList getSlotNumbersOfEmptySlots(ScreenHandler container, + Slot slotReference, + boolean sameInventory, + boolean treatHotbarAsDifferent, + boolean reverse) { - List slots = new ArrayList<>(64); + IntArrayList slots = new IntArrayList(64); final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; @@ -1934,10 +1921,10 @@ private static List getSlotNumbersOfEmptySlots(ScreenHandler container, } @SuppressWarnings("SameParameterValue") - private static List getSlotNumbersOfEmptySlotsInPlayerInventory(ScreenHandler container, - boolean reverse) + private static IntArrayList getSlotNumbersOfEmptySlotsInPlayerInventory(ScreenHandler container, + boolean reverse) { - List slots = new ArrayList<>(64); + IntArrayList slots = new IntArrayList(64); final int maxSlot = container.slots.size() - 1; final int increment = reverse ? -1 : 1; @@ -2257,7 +2244,7 @@ public static boolean tryMoveItemsVertically(HandledScreen slots = getVerticallyFurthestSuitableSlotsForStackInSlot(gui.getScreenHandler(), slot, moveUp); + IntArrayList slots = getVerticallyFurthestSuitableSlotsForStackInSlot(gui.getScreenHandler(), slot, moveUp); if (slots.isEmpty()) { @@ -2288,17 +2275,17 @@ private static void moveMatchingStacksToSlots(HandledScreen matchingSlots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, true, slot.getStack(), true, true, false); - List targetSlots = getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, false, true, false); + IntArrayList matchingSlots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), slot, true, slot.getStack(), true, true, false); + IntArrayList targetSlots = getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, false, true, false); targetSlots.addAll(getSlotNumbersOfEmptySlots(gui.getScreenHandler(), slot, true, true, false)); targetSlots.addAll(matchingSlots); matchingSlots.sort(new SlotVerticalSorterSlotNumbers(gui.getScreenHandler(), !moveUp)); targetSlots.sort(new SlotVerticalSorterSlotNumbers(gui.getScreenHandler(), moveUp)); - for (Integer matchingSlot : matchingSlots) + for (int matchingSlot : matchingSlots) { - int srcSlotNum = matchingSlot.intValue(); + int srcSlotNum = matchingSlot; Slot srcSlot = gui.getScreenHandler().getSlot(srcSlotNum); Slot lastSlot = moveStackToSlots(gui, srcSlot, targetSlots, false); @@ -2311,7 +2298,7 @@ private static void moveMatchingStacksToSlots(HandledScreen gui, Slot slotFrom, - List slotsTo, + IntArrayList slotsTo, boolean leaveOne) { Slot lastSlot = null; @@ -2359,7 +2346,7 @@ private static Slot moveStackToSlots(HandledScreen gui, private static void moveOneItemToFirstValidSlot(HandledScreen gui, Slot slotFrom, - List slotsTo) + IntArrayList slotsTo) { // Pick up half of the the stack rightClickSlot(gui, slotFrom.id); @@ -2389,16 +2376,16 @@ private static void moveOneItemToFirstValidSlot(HandledScreen getVerticallyFurthestSuitableSlotsForStackInSlot(ScreenHandler container, + private static IntArrayList getVerticallyFurthestSuitableSlotsForStackInSlot(ScreenHandler container, Slot slotIn, boolean above) { if (slotIn == null || slotIn.hasStack() == false) { - return Collections.emptyList(); + return IntArrayList.of(); } - List slotNumbers = new ArrayList<>(); + IntArrayList slotNumbers = new IntArrayList(); ItemStack stackSlot = slotIn.getStack(); for (Slot slotTmp : container.slots) @@ -2429,15 +2416,15 @@ public static void tryClearCursor(HandledScreen gui) if (isStackEmpty(stackCursor) == false) { - List emptySlots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.getScreenHandler(), false); + IntArrayList emptySlots = getSlotNumbersOfEmptySlotsInPlayerInventory(gui.getScreenHandler(), false); if (emptySlots.isEmpty() == false) { - leftClickSlot(gui, emptySlots.get(0)); + leftClickSlot(gui, emptySlots.getInt(0)); } else { - List matchingSlots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), stackCursor, true); + IntArrayList matchingSlots = getSlotNumbersOfMatchingStacks(gui.getScreenHandler(), stackCursor, true); if (matchingSlots.isEmpty() == false) { @@ -2498,7 +2485,7 @@ public int compare(Slot slot1, Slot slot2) } */ - private static class SlotVerticalSorterSlotNumbers implements Comparator + private static class SlotVerticalSorterSlotNumbers implements IntComparator { private final ScreenHandler container; private final boolean topToBottom; @@ -2510,15 +2497,15 @@ public SlotVerticalSorterSlotNumbers(ScreenHandler container, boolean topToBotto } @Override - public int compare(Integer slotNum1, Integer slotNum2) + public int compare(int slotNum1, int slotNum2) { if (Objects.equals(slotNum1, slotNum2)) { return 0; } - Slot slot1 = this.container.getSlot(slotNum1.intValue()); - Slot slot2 = this.container.getSlot(slotNum2.intValue()); + Slot slot1 = this.container.getSlot(slotNum1); + Slot slot2 = this.container.getSlot(slotNum2); if (slot1.y == slot2.y) { @@ -2624,7 +2611,7 @@ public static void swapSlots(HandledScreen gui, int slo } private static void dragSplitItemsIntoSlots(HandledScreen gui, - List targetSlots) + IntArrayList targetSlots) { ItemStack stackInCursor = gui.getScreenHandler().getCursorStack(); @@ -2635,7 +2622,7 @@ private static void dragSplitItemsIntoSlots(HandledScreen> getSlotsPerItem(ItemStack[] stacks) + public static Map getSlotsPerItem(ItemStack[] stacks) { - Map> mapSlots = new HashMap<>(); + Map mapSlots = new HashMap<>(); for (int i = 0; i < stacks.length; i++) { @@ -79,7 +78,7 @@ public static Map> getSlotsPerItem(ItemStack[] stacks) if (InventoryUtils.isStackEmpty(stack) == false) { ItemType item = new ItemType(stack); - List slots = mapSlots.computeIfAbsent(item, k -> new ArrayList<>()); + IntArrayList slots = mapSlots.computeIfAbsent(item, k -> new IntArrayList()); slots.add(i); } diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/FavoriteData.java b/src/main/java/fi/dy/masa/itemscroller/villager/FavoriteData.java index d122f144d..49f3510a1 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/FavoriteData.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/FavoriteData.java @@ -1,13 +1,13 @@ package fi.dy.masa.itemscroller.villager; -import java.util.List; +import it.unimi.dsi.fastutil.ints.IntArrayList; public class FavoriteData { - public final List favorites; + public final IntArrayList favorites; public final boolean isGlobal; - public FavoriteData(List favorites, boolean isGlobal) + public FavoriteData(IntArrayList favorites, boolean isGlobal) { this.favorites = favorites; this.isGlobal = isGlobal; diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java index d8d36d950..093624d62 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerData.java @@ -1,18 +1,17 @@ package fi.dy.masa.itemscroller.villager; -import java.util.ArrayList; -import java.util.List; import java.util.UUID; import javax.annotation.Nullable; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtInt; import net.minecraft.nbt.NbtList; import fi.dy.masa.itemscroller.util.Constants; +import it.unimi.dsi.fastutil.ints.IntArrayList; public class VillagerData { private final UUID uuid; - private final List favorites = new ArrayList<>(); + private final IntArrayList favorites = new IntArrayList(); private int tradeListPosition; VillagerData(UUID uuid) @@ -39,7 +38,7 @@ void toggleFavorite(int tradeIndex) { if (this.favorites.contains(tradeIndex)) { - this.favorites.remove(Integer.valueOf(tradeIndex)); + this.favorites.rem(tradeIndex); } else { @@ -47,7 +46,7 @@ void toggleFavorite(int tradeIndex) } } - List getFavorites() + IntArrayList getFavorites() { return this.favorites; } diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java index b8a24ffc5..f190c02cc 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerDataStorage.java @@ -4,7 +4,6 @@ import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -23,6 +22,7 @@ import fi.dy.masa.itemscroller.util.Constants; import fi.dy.masa.malilib.util.FileUtils; import fi.dy.masa.malilib.util.StringUtils; +import it.unimi.dsi.fastutil.ints.IntArrayList; public class VillagerDataStorage { @@ -110,7 +110,7 @@ public FavoriteData getFavoritesForCurrentVillager(MerchantScreenHandler handler public FavoriteData getFavoritesForCurrentVillager(TradeOfferList originalTrades) { VillagerData data = this.getDataFor(this.lastInteractedUUID, false); - List favorites = data != null ? data.getFavorites() : null; + IntArrayList favorites = data != null ? data.getFavorites() : null; if (favorites != null && favorites.isEmpty() == false) { @@ -122,7 +122,7 @@ public FavoriteData getFavoritesForCurrentVillager(TradeOfferList originalTrades return new FavoriteData(VillagerUtils.getGlobalFavoritesFor(originalTrades, this.globalFavorites), true); } - return new FavoriteData(Collections.emptyList(), favorites == null); + return new FavoriteData(IntArrayList.of(), favorites == null); } private void readFromNBT(NbtCompound nbt) diff --git a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java index c6c83cbd1..9015610f1 100644 --- a/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/villager/VillagerUtils.java @@ -1,9 +1,7 @@ package fi.dy.masa.itemscroller.villager; -import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; @@ -13,6 +11,7 @@ import net.minecraft.village.TradeOffer; import net.minecraft.village.TradeOfferList; import fi.dy.masa.malilib.util.GuiUtils; +import it.unimi.dsi.fastutil.ints.IntArrayList; public class VillagerUtils { @@ -75,7 +74,7 @@ public static int getRealTradeIndexFor(int visibleIndex, MerchantScreenHandler h public static TradeOfferList buildCustomTradeList(TradeOfferList originalList) { FavoriteData data = VillagerDataStorage.getInstance().getFavoritesForCurrentVillager(originalList); - List favorites = data.favorites; + IntArrayList favorites = data.favorites; //System.out.printf("build - fav: %s (%s), or: %d\n", favorites, data.isGlobal, originalList.size()); @@ -109,9 +108,9 @@ public static TradeOfferList buildCustomTradeList(TradeOfferList originalList) return originalList; } - public static List getGlobalFavoritesFor(TradeOfferList originalTrades, Collection globalFavorites) + public static IntArrayList getGlobalFavoritesFor(TradeOfferList originalTrades, Collection globalFavorites) { - List favorites = new ArrayList<>(); + IntArrayList favorites = new IntArrayList(); Map trades = new HashMap<>(); final int size = originalTrades.size(); @@ -129,7 +128,7 @@ public static List getGlobalFavoritesFor(TradeOfferList originalTrades, if (index != null) { - favorites.add(index); + favorites.add(index.intValue()); } } From 94c07f5660917f572485d32165cae6fb4ba0c5c5 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 3 Mar 2022 19:44:05 +0200 Subject: [PATCH 094/107] Add new massCraft options, and a new massCraft variant --- .../dy/masa/itemscroller/config/Configs.java | 8 + .../itemscroller/event/KeybindCallbacks.java | 70 +++++--- .../mixin/IMixinCraftingResultSlot.java | 13 ++ .../itemscroller/util/InventoryUtils.java | 154 ++++++++++++++++-- src/main/resources/mixins.itemscroller.json | 1 + 5 files changed, 212 insertions(+), 34 deletions(-) create mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/IMixinCraftingResultSlot.java diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index 31c2b52f8..6dc1ae0ec 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -31,12 +31,16 @@ public static class Generic 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."); public static final ConfigBoolean MOD_MAIN_TOGGLE = new ConfigBoolean("modMainToggle", true, "Can disable all the functionality of the entire mod"); + public static final ConfigInteger MASS_CRAFT_INTERVAL = new ConfigInteger("massCraftInterval", 2, 1, 60, "The interval in game ticks the massCraft operation is repeated at"); + public static final ConfigInteger MASS_CRAFT_ITERATIONS = new ConfigInteger("massCraftIterations", 36, 1, 256, "How many massCraft iterations/attempts to do per execution.\nWith unstackable items or a full inventory and \"small recipe\"\nthis will need to be larger, as a shift + click craft to the inventory\nmight only craft 1 or 2 items per operation."); + public static final ConfigBoolean MASS_CRAFT_SWAPS = new ConfigBoolean("massCraftSwaps", true, "Uses a newer method of filling the crafting grid,\nusing only swap slot packets"); public static final ConfigInteger PACKET_RATE_LIMIT = new ConfigInteger("packetRateLimit", 4, 1, 1024, "The limit of sent emulated slot click packets per game tick,\nif 'rateLimitClickPackets' is enabled"); public static final ConfigBoolean SCROLL_CRAFT_STORE_RECIPES_TO_FILE = new ConfigBoolean("craftingRecipesSaveToFile", true, "If enabled, then the crafting features recipes are saved to a file\ninside minecraft/itemscroller/recipes_worldorservername.nbt.\nThis makes the recipes persistent across game restarts."); public static final ConfigBoolean SCROLL_CRAFT_RECIPE_FILE_GLOBAL = new ConfigBoolean("craftingRecipesSaveFileIsGlobal", false, "If true, then the recipe file is global, instead\n of being saved per-world or server"); public static final ConfigBoolean RATE_LIMIT_CLICK_PACKETS = new ConfigBoolean("rateLimitClickPackets", false, "This is meant for compatibility with Spigot servers and similar,\nwhich apply rate limits to packets from the client.\nThis queues up the emulated slot click packets and sends\nthem rate limited over time. The limit per game tick can be set in 'packetRateLimit´."); public static final ConfigBoolean REVERSE_SCROLL_DIRECTION_SINGLE = new ConfigBoolean("reverseScrollDirectionSingle", false, "Reverse the scrolling direction for single item mode."); public static final ConfigBoolean REVERSE_SCROLL_DIRECTION_STACKS = new ConfigBoolean("reverseScrollDirectionStacks", false, "Reverse the scrolling direction for full stacks mode."); + public static final ConfigBoolean USE_RECIPE_CACHING = new ConfigBoolean("useRecipeCaching", true, "Enables caching the last used recipe in the crafting\nrecipe output item fetching code. This can help a lot\nwith lowering CPU usage when mass crafting stuff."); public static final ConfigBoolean SLOT_POSITION_AWARE_SCROLL_DIRECTION = new ConfigBoolean("useSlotPositionAwareScrollDirection", false, "When enabled, the item movement direction depends\non the slots' y-position on screen. Might be derpy with more\ncomplex inventories, use with caution!"); public static final ConfigBoolean VILLAGER_TRADE_USE_GLOBAL_FAVORITES = new ConfigBoolean("villagerTradeUseGlobalFavorites", true, "Whether or not global (per-item-type) villager trade\nfavorites should be used."); public static final ConfigBoolean VILLAGER_TRADE_LIST_REMEMBER_SCROLL = new ConfigBoolean("villagerTradeListRememberScrollPosition", true, "Remember and restore the last scroll position in the\ntrade list when re-opening the GUI"); @@ -45,6 +49,9 @@ public static class Generic CARPET_CTRL_Q_CRAFTING, CLIENT_CRAFTING_FIX, CRAFTING_RENDER_RECIPE_ITEMS, + MASS_CRAFT_INTERVAL, + MASS_CRAFT_ITERATIONS, + MASS_CRAFT_SWAPS, MOD_MAIN_TOGGLE, PACKET_RATE_LIMIT, RATE_LIMIT_CLICK_PACKETS, @@ -53,6 +60,7 @@ public static class Generic REVERSE_SCROLL_DIRECTION_SINGLE, REVERSE_SCROLL_DIRECTION_STACKS, SLOT_POSITION_AWARE_SCROLL_DIRECTION, + USE_RECIPE_CACHING, VILLAGER_TRADE_USE_GLOBAL_FAVORITES, VILLAGER_TRADE_LIST_REMEMBER_SCROLL ); diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 820ffcedb..14121230c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -1,7 +1,6 @@ package fi.dy.masa.itemscroller.event; import net.minecraft.client.MinecraftClient; -import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.screen.slot.Slot; @@ -31,6 +30,8 @@ public class KeybindCallbacks implements IHotkeyCallback, IClientTickHandler { private static final KeybindCallbacks INSTANCE = new KeybindCallbacks(); + protected int massCraftTicker; + public static KeybindCallbacks getInstance() { return INSTANCE; @@ -186,13 +187,16 @@ public void onClientTick(MinecraftClient mc) return; } - if (GuiUtils.getCurrentScreen() instanceof HandledScreen && + if (GuiUtils.getCurrentScreen() instanceof HandledScreen gui && (GuiUtils.getCurrentScreen() instanceof CreativeInventoryScreen) == false && Configs.GUI_BLACKLIST.contains(GuiUtils.getCurrentScreen().getClass().getName()) == false && Hotkeys.MASS_CRAFT.getKeybind().isKeybindHeld()) { - Screen guiScreen = GuiUtils.getCurrentScreen(); - HandledScreen gui = (HandledScreen) guiScreen; + if (++this.massCraftTicker < Configs.Generic.MASS_CRAFT_INTERVAL.getIntegerValue()) + { + return; + } + Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); if (outputSlot != null) @@ -203,32 +207,58 @@ public void onClientTick(MinecraftClient mc) } RecipePattern recipe = RecipeStorage.getInstance().getSelectedRecipe(); + int limit = Configs.Generic.MASS_CRAFT_ITERATIONS.getIntegerValue(); - InventoryUtils.tryClearCursor(gui); - InventoryUtils.throwAllCraftingResultsToGround(recipe, gui); - InventoryUtils.tryMoveItemsToFirstCraftingGrid(recipe, gui, true); - - int failsafe = 0; - - while (++failsafe < 40 && InventoryUtils.areStacksEqual(outputSlot.getStack(), recipe.getResult())) + if (Configs.Generic.MASS_CRAFT_SWAPS.getBooleanValue()) { - if (Configs.Generic.CARPET_CTRL_Q_CRAFTING.getBooleanValue()) + for (int i = 0; i < limit; ++i) { - InventoryUtils.dropStack(gui, outputSlot.id); + InventoryUtils.tryClearCursor(gui); + InventoryUtils.throwAllCraftingResultsToGround(recipe, gui); + InventoryUtils.setCraftingGridContentsUsingSwaps(gui, mc.player.getInventory(), recipe, outputSlot); + + if (InventoryUtils.areStacksEqual(outputSlot.getStack(), recipe.getResult()) == false) + { + break; + } + + InventoryUtils.shiftClickSlot(gui, outputSlot.id); } - else + } + else + { + int failsafe = 0; + + while (++failsafe < limit) { - InventoryUtils.dropStacksWhileHasItem(gui, outputSlot.id, recipe.getResult()); - } + InventoryUtils.tryClearCursor(gui); + InventoryUtils.setInhibitCraftingOutputUpdate(true); + InventoryUtils.throwAllCraftingResultsToGround(recipe, gui); + InventoryUtils.throwAllNonRecipeItemsToGround(recipe, gui); + InventoryUtils.tryMoveItemsToFirstCraftingGrid(recipe, gui, true); + InventoryUtils.setInhibitCraftingOutputUpdate(true); + InventoryUtils.updateCraftingOutputSlot(outputSlot); - //InventoryUtils.tryClearCursor(gui, mc); - InventoryUtils.throwAllCraftingResultsToGround(recipe, gui); - InventoryUtils.throwAllNonRecipeItemsToGround(recipe, gui); - InventoryUtils.tryMoveItemsToFirstCraftingGrid(recipe, gui, true); + if (InventoryUtils.areStacksEqual(outputSlot.getStack(), recipe.getResult()) == false) + { + break; + } + + if (Configs.Generic.CARPET_CTRL_Q_CRAFTING.getBooleanValue()) + { + InventoryUtils.dropStack(gui, outputSlot.id); + } + else + { + InventoryUtils.dropStacksWhileHasItem(gui, outputSlot.id, recipe.getResult()); + } + } } ClickPacketBuffer.setShouldBufferClickPackets(false); } + + this.massCraftTicker = 0; } } } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinCraftingResultSlot.java b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinCraftingResultSlot.java new file mode 100644 index 000000000..9d28b2fad --- /dev/null +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/IMixinCraftingResultSlot.java @@ -0,0 +1,13 @@ +package fi.dy.masa.itemscroller.mixin; + +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.gen.Accessor; +import net.minecraft.inventory.CraftingInventory; +import net.minecraft.screen.slot.CraftingResultSlot; + +@Mixin(CraftingResultSlot.class) +public interface IMixinCraftingResultSlot +{ + @Accessor("input") + CraftingInventory itemscroller_getCraftingInventory(); +} diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 7ddabec24..31e48deed 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -27,6 +27,7 @@ import net.minecraft.recipe.RecipeType; import net.minecraft.screen.MerchantScreenHandler; import net.minecraft.screen.ScreenHandler; +import net.minecraft.screen.slot.CraftingResultSlot; import net.minecraft.screen.slot.Slot; import net.minecraft.screen.slot.SlotActionType; import net.minecraft.screen.slot.TradeOutputSlot; @@ -39,6 +40,7 @@ import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; +import fi.dy.masa.itemscroller.mixin.IMixinCraftingResultSlot; import fi.dy.masa.itemscroller.recipes.CraftingHandler; import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; import fi.dy.masa.itemscroller.recipes.RecipePattern; @@ -51,31 +53,71 @@ public class InventoryUtils { - private static MoveAction activeMoveAction = MoveAction.NONE; - private static int lastPosX; - private static int lastPosY; - private static int slotNumberLast; private static final Set DRAGGED_SLOTS = new HashSet<>(); + private static WeakReference sourceSlotCandidate = null; private static WeakReference sourceSlot = null; private static ItemStack stackInCursorLast = ItemStack.EMPTY; + @Nullable protected static CraftingRecipe lastRecipe; + private static MoveAction activeMoveAction = MoveAction.NONE; + private static int lastPosX; + private static int lastPosY; + private static int slotNumberLast; + private static boolean inhibitCraftResultUpdate; + + public static void setInhibitCraftingOutputUpdate(boolean inhibitUpdate) + { + inhibitCraftResultUpdate = inhibitUpdate; + } public static void onSlotChangedCraftingGrid(PlayerEntity player, CraftingInventory craftMatrix, CraftingResultInventory inventoryCraftResult) + { + if (inhibitCraftResultUpdate) + { + return; + } + + if (Configs.Generic.CLIENT_CRAFTING_FIX.getBooleanValue()) + { + updateCraftingOutputSlot(player, craftMatrix, inventoryCraftResult, true); + } + } + + public static void updateCraftingOutputSlot(Slot outputSlot) + { + PlayerEntity player = MinecraftClient.getInstance().player; + + if (player != null && + outputSlot instanceof CraftingResultSlot resultSlot && + resultSlot.inventory instanceof CraftingResultInventory resultInv) + { + CraftingInventory craftingInv = ((IMixinCraftingResultSlot) outputSlot).itemscroller_getCraftingInventory(); + updateCraftingOutputSlot(player, craftingInv, resultInv, true); + } + } + + public static void updateCraftingOutputSlot(PlayerEntity player, + CraftingInventory craftMatrix, + CraftingResultInventory inventoryCraftResult, + boolean setEmptyStack) { World world = player.getEntityWorld(); - if (Configs.Generic.CLIENT_CRAFTING_FIX.getBooleanValue() && - world.isClient && (world instanceof ClientWorld) && player instanceof ClientPlayerEntity) + if ((world instanceof ClientWorld) && player instanceof ClientPlayerEntity) { ItemStack stack = ItemStack.EMPTY; - Optional optional = world.getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftMatrix, world); + CraftingRecipe recipe = Configs.Generic.USE_RECIPE_CACHING.getBooleanValue() ? lastRecipe : null; - if (optional.isPresent()) + if (recipe == null || recipe.matches(craftMatrix, world) == false) { - CraftingRecipe recipe = optional.get(); + Optional optional = world.getRecipeManager().getFirstMatch(RecipeType.CRAFTING, craftMatrix, world); + recipe = optional.isPresent() ? optional.get() : null; + } + if (recipe != null) + { if ((recipe.isIgnoredInRecipeBook() || world.getGameRules().getBoolean(GameRules.DO_LIMITED_CRAFTING) == false || ((ClientPlayerEntity) player).getRecipeBook().contains(recipe))) @@ -84,11 +126,14 @@ public static void onSlotChangedCraftingGrid(PlayerEntity player, stack = recipe.craft(craftMatrix); } - if (stack.isEmpty() == false) + if (setEmptyStack || stack.isEmpty() == false) { inventoryCraftResult.setStack(0, stack); } + } + + lastRecipe = recipe; } } @@ -1606,6 +1651,70 @@ public static void throwAllNonRecipeItemsToGround(RecipePattern recipe, } } + public static void setCraftingGridContentsUsingSwaps(HandledScreen gui, + PlayerInventory inv, + RecipePattern recipe, + Slot outputSlot) + { + SlotRange range = CraftingHandler.getCraftingGridSlots(gui, outputSlot); + + if (range != null && isStackEmpty(recipe.getResult()) == false) + { + ItemStack[] recipeItems = recipe.getRecipeItems(); + final int invSlots = gui.getScreenHandler().slots.size(); + final int rangeSlots = Math.min(range.getSlotCount(), recipeItems.length); + IntArrayList toRemove = new IntArrayList(); + boolean movedSomething = false; + + setInhibitCraftingOutputUpdate(true); + + for (int i = 0, slotNum = range.getFirst(); i < rangeSlots && slotNum < invSlots; i++, slotNum++) + { + Slot slotTmp = gui.getScreenHandler().getSlot(slotNum); + ItemStack recipeStack = recipeItems[i]; + ItemStack slotStack = slotTmp.getStack(); + boolean recipeHasItem = isStackEmpty(recipeStack) == false; + + if (areStacksEqual(recipeStack, slotStack) == false) + { + if (recipeHasItem == false) + { + toRemove.add(slotNum); + } + else + { + int index = getPlayerInventoryIndexWithItem(recipeStack, inv); + + if (index >= 0) + { + clickSlot(gui, slotNum, index, SlotActionType.SWAP); + movedSomething = true; + } + } + } + } + + movedSomething |= (toRemove.isEmpty() == false); + + for (int slotNum : toRemove) + { + shiftClickSlot(gui, slotNum); + + if (isStackEmpty(gui.getScreenHandler().getSlot(slotNum).getStack()) == false) + { + dropStack(gui, slotNum); + } + } + + setInhibitCraftingOutputUpdate(false); + + if (movedSomething) + { + updateCraftingOutputSlot(outputSlot); + } + } + } + private static int putSingleItemIntoSlots(HandledScreen gui, IntArrayList targetSlots, int startIndex) @@ -1895,6 +2004,23 @@ private static IntArrayList getSlotNumbersOfMatchingStacks(ScreenHandler contain return slots; } + public static int getPlayerInventoryIndexWithItem(ItemStack stackReference, PlayerInventory inv) + { + final int size = inv.main.size(); + + for (int index = 0; index < size; ++index) + { + ItemStack stack = inv.main.get(index); + + if (areStacksEqual(stack, stackReference)) + { + return index; + } + } + + return -1; + } + @SuppressWarnings("SameParameterValue") private static IntArrayList getSlotNumbersOfEmptySlots(ScreenHandler container, Slot slotReference, @@ -2444,11 +2570,11 @@ public static void tryClearCursor(HandledScreen gui) } } } - } - if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) - { - dropItemsFromCursor(gui); + if (isStackEmpty(gui.getScreenHandler().getCursorStack()) == false) + { + dropItemsFromCursor(gui); + } } } diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 03b8c32ea..2132d10d1 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -4,6 +4,7 @@ "compatibilityLevel": "JAVA_16", "minVersion": "0.8", "client": [ + "IMixinCraftingResultSlot", "IMixinMerchantScreen", "IMixinScreenWithHandler", "IMixinSlot", From 596b518fa0e7f4c24cfb2d5679c2d57620ce7d20 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 3 Mar 2022 20:33:08 +0200 Subject: [PATCH 095/107] Bump version to 0.16.0 --- build.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index 59d560ae5..35bdcb352 100644 --- a/build.properties +++ b/build.properties @@ -6,10 +6,10 @@ author = masa mod_file_name = itemscroller-fabric # Current mod version -mod_version = 0.15.0 +mod_version = 0.16.0 # Required malilib version -malilib_version = 0.11.1 +malilib_version = 0.11.8 # Minecraft, Fabric and mappings versions minecraft_version_out = 1.18.1 From 8a8fd120a60b62316a01076a603e2c88e30d3e69 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 3 Mar 2022 23:28:42 +0200 Subject: [PATCH 096/107] Update to MC 1.18.2 --- build.gradle | 20 ++++++++----------- build.properties | 12 +++++------ .../dy/masa/itemscroller/util/InputUtils.java | 6 +++--- .../itemscroller/util/InventoryUtils.java | 2 +- src/main/resources/fabric.mod.json | 4 ++-- src/main/resources/mixins.itemscroller.json | 2 +- src/main/resources/pack.mcmeta | 2 +- 7 files changed, 22 insertions(+), 26 deletions(-) diff --git a/build.gradle b/build.gradle index 32b708fd1..d7582b489 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.10-SNAPSHOT' + id 'fabric-loom' version '0.11-SNAPSHOT' } sourceCompatibility = JavaVersion.VERSION_17 @@ -33,17 +33,13 @@ dependencies { modCompileOnly "com.terraformersmc:modmenu:${config.mod_menu_version}" } -minecraft { - ext.mod_version = config.mod_version - - if (mod_version.endsWith('-dev')) { - mod_version = mod_version + "." + new Date().format('yyyyMMdd.HHmmss') - } -} - group = config.group + "." + config.mod_id archivesBaseName = config.mod_file_name + '-' + config.minecraft_version_out -version = project.minecraft.mod_version +version = config.mod_version + +if (version.endsWith('-dev')) { + version += "." + new Date().format('yyyyMMdd.HHmmss') +} processResources { // Exclude the GIMP image files @@ -53,10 +49,10 @@ processResources { // this will ensure that this task is redone when the versions change. //inputs.property "minecraft_version", project.config.minecraft_version - inputs.property "mod_version", project.minecraft.mod_version + inputs.property "mod_version", config.mod_version filesMatching("fabric.mod.json") { - expand "mod_version": project.minecraft.mod_version + expand "mod_version": config.mod_version } } diff --git a/build.properties b/build.properties index 35bdcb352..ec6881fa6 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.16.0 # Required malilib version -malilib_version = 0.11.8 +malilib_version = 0.12.0 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.18.1 -minecraft_version = 1.18.1 -mappings_version = 1.18.1+build.18 +minecraft_version_out = 1.18.2 +minecraft_version = 1.18.2 +mappings_version = 1.18.2+build.1 -fabric_loader_version = 0.12.12 -mod_menu_version = 3.0.1 +fabric_loader_version = 0.13.3 +mod_menu_version = 3.1.0 diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java index 1b183575d..c955513c4 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InputUtils.java @@ -127,16 +127,16 @@ public static MoveAmount getMoveAmount(MoveAction action) public static boolean isAttack(int keyCode) { - return keyCode == KeybindMulti.getKeyCode(MinecraftClient.getInstance().options.keyAttack); + return keyCode == KeybindMulti.getKeyCode(MinecraftClient.getInstance().options.attackKey); } public static boolean isUse(int keyCode) { - return keyCode == KeybindMulti.getKeyCode(MinecraftClient.getInstance().options.keyUse); + return keyCode == KeybindMulti.getKeyCode(MinecraftClient.getInstance().options.useKey); } public static boolean isPickBlock(int keyCode) { - return keyCode == KeybindMulti.getKeyCode(MinecraftClient.getInstance().options.keyPickItem); + return keyCode == KeybindMulti.getKeyCode(MinecraftClient.getInstance().options.pickItemKey); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 31e48deed..4215c46b2 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -1170,7 +1170,7 @@ public static void handleRecipeClick(HandledScreen gui, if (isRightClick) { Slot outputSlot = CraftingHandler.getFirstCraftingOutputSlotForGui(gui); - boolean dropKeyDown = mc.options.keyDrop.isPressed(); // FIXME 1.14 + boolean dropKeyDown = mc.options.dropKey.isPressed(); // FIXME 1.14 if (outputSlot != null) { diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9de99e080..a0c5b91ca 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": "1.18.x", - "malilib": ">=0.11.0 <0.12" + "minecraft": "1.18.2", + "malilib": "0.12.x" } } diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index 2132d10d1..aae82aa2b 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -1,7 +1,7 @@ { "required": true, "package": "fi.dy.masa.itemscroller.mixin", - "compatibilityLevel": "JAVA_16", + "compatibilityLevel": "JAVA_17", "minVersion": "0.8", "client": [ "IMixinCraftingResultSlot", diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta index 543c9f254..d2da2492d 100644 --- a/src/main/resources/pack.mcmeta +++ b/src/main/resources/pack.mcmeta @@ -1,6 +1,6 @@ { "pack": { - "pack_format": 8, + "pack_format": 9, "description": "Item Scroller" } } \ No newline at end of file From 66d29ef870d3e0571c28f639ed8994486f351f41 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sun, 17 Jul 2022 16:21:11 +0300 Subject: [PATCH 097/107] (Mass) Crafting fixes and a new config option for output update suppression --- .../dy/masa/itemscroller/config/Configs.java | 10 ++++---- .../itemscroller/event/KeybindCallbacks.java | 24 +++++++++++-------- .../itemscroller/util/InventoryUtils.java | 8 +++---- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java index 6dc1ae0ec..3962385ff 100644 --- a/src/main/java/fi/dy/masa/itemscroller/config/Configs.java +++ b/src/main/java/fi/dy/masa/itemscroller/config/Configs.java @@ -10,9 +10,6 @@ import net.minecraft.client.gui.screen.ingame.CraftingScreen; import net.minecraft.client.gui.screen.ingame.InventoryScreen; import net.minecraft.screen.slot.CraftingResultSlot; -import fi.dy.masa.itemscroller.Reference; -import fi.dy.masa.itemscroller.recipes.CraftingHandler; -import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; import fi.dy.masa.malilib.config.ConfigUtils; import fi.dy.masa.malilib.config.IConfigHandler; import fi.dy.masa.malilib.config.IConfigValue; @@ -20,6 +17,9 @@ import fi.dy.masa.malilib.config.options.ConfigInteger; import fi.dy.masa.malilib.util.FileUtils; import fi.dy.masa.malilib.util.JsonUtils; +import fi.dy.masa.itemscroller.Reference; +import fi.dy.masa.itemscroller.recipes.CraftingHandler; +import fi.dy.masa.itemscroller.recipes.CraftingHandler.SlotRange; public class Configs implements IConfigHandler { @@ -31,9 +31,10 @@ public static class Generic 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."); public static final ConfigBoolean MOD_MAIN_TOGGLE = new ConfigBoolean("modMainToggle", true, "Can disable all the functionality of the entire mod"); + public static final ConfigBoolean MASS_CRAFT_INHIBIT_MID_UPDATES = new ConfigBoolean("massCraftInhibitMidUpdates", true, "Prevent recipe output slot updates in the middle of moving items\nto the crafting grid. This should reduce CPU usage\nbecause of not constantly querying the recipe after every grid change."); public static final ConfigInteger MASS_CRAFT_INTERVAL = new ConfigInteger("massCraftInterval", 2, 1, 60, "The interval in game ticks the massCraft operation is repeated at"); public static final ConfigInteger MASS_CRAFT_ITERATIONS = new ConfigInteger("massCraftIterations", 36, 1, 256, "How many massCraft iterations/attempts to do per execution.\nWith unstackable items or a full inventory and \"small recipe\"\nthis will need to be larger, as a shift + click craft to the inventory\nmight only craft 1 or 2 items per operation."); - public static final ConfigBoolean MASS_CRAFT_SWAPS = new ConfigBoolean("massCraftSwaps", true, "Uses a newer method of filling the crafting grid,\nusing only swap slot packets"); + public static final ConfigBoolean MASS_CRAFT_SWAPS = new ConfigBoolean("massCraftSwapsOnly", false, "Uses a newer method of filling the crafting grid,\nusing only swap slot packets.\n\nNote: Due to only using slot swap packets,\nno partial crafts are possible! And also no\nstack splitting will happen, at all."); public static final ConfigInteger PACKET_RATE_LIMIT = new ConfigInteger("packetRateLimit", 4, 1, 1024, "The limit of sent emulated slot click packets per game tick,\nif 'rateLimitClickPackets' is enabled"); public static final ConfigBoolean SCROLL_CRAFT_STORE_RECIPES_TO_FILE = new ConfigBoolean("craftingRecipesSaveToFile", true, "If enabled, then the crafting features recipes are saved to a file\ninside minecraft/itemscroller/recipes_worldorservername.nbt.\nThis makes the recipes persistent across game restarts."); public static final ConfigBoolean SCROLL_CRAFT_RECIPE_FILE_GLOBAL = new ConfigBoolean("craftingRecipesSaveFileIsGlobal", false, "If true, then the recipe file is global, instead\n of being saved per-world or server"); @@ -49,6 +50,7 @@ public static class Generic CARPET_CTRL_Q_CRAFTING, CLIENT_CRAFTING_FIX, CRAFTING_RENDER_RECIPE_ITEMS, + MASS_CRAFT_INHIBIT_MID_UPDATES, MASS_CRAFT_INTERVAL, MASS_CRAFT_ITERATIONS, MASS_CRAFT_SWAPS, diff --git a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java index 14121230c..11074b42c 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/KeybindCallbacks.java @@ -4,6 +4,15 @@ import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.client.gui.screen.ingame.HandledScreen; import net.minecraft.screen.slot.Slot; +import fi.dy.masa.malilib.config.options.ConfigHotkey; +import fi.dy.masa.malilib.gui.GuiBase; +import fi.dy.masa.malilib.gui.Message; +import fi.dy.masa.malilib.hotkeys.IHotkeyCallback; +import fi.dy.masa.malilib.hotkeys.IKeybind; +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.util.InfoUtils; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -16,15 +25,6 @@ import fi.dy.masa.itemscroller.util.InputUtils; import fi.dy.masa.itemscroller.util.InventoryUtils; import fi.dy.masa.itemscroller.util.MoveAction; -import fi.dy.masa.malilib.config.options.ConfigHotkey; -import fi.dy.masa.malilib.gui.GuiBase; -import fi.dy.masa.malilib.gui.Message; -import fi.dy.masa.malilib.hotkeys.IHotkeyCallback; -import fi.dy.masa.malilib.hotkeys.IKeybind; -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.util.InfoUtils; public class KeybindCallbacks implements IHotkeyCallback, IClientTickHandler { @@ -214,8 +214,12 @@ public void onClientTick(MinecraftClient mc) for (int i = 0; i < limit; ++i) { InventoryUtils.tryClearCursor(gui); + InventoryUtils.setInhibitCraftingOutputUpdate(true); InventoryUtils.throwAllCraftingResultsToGround(recipe, gui); + InventoryUtils.throwAllNonRecipeItemsToGround(recipe, gui); InventoryUtils.setCraftingGridContentsUsingSwaps(gui, mc.player.getInventory(), recipe, outputSlot); + InventoryUtils.setInhibitCraftingOutputUpdate(false); + InventoryUtils.updateCraftingOutputSlot(outputSlot); if (InventoryUtils.areStacksEqual(outputSlot.getStack(), recipe.getResult()) == false) { @@ -236,7 +240,7 @@ public void onClientTick(MinecraftClient mc) InventoryUtils.throwAllCraftingResultsToGround(recipe, gui); InventoryUtils.throwAllNonRecipeItemsToGround(recipe, gui); InventoryUtils.tryMoveItemsToFirstCraftingGrid(recipe, gui, true); - InventoryUtils.setInhibitCraftingOutputUpdate(true); + InventoryUtils.setInhibitCraftingOutputUpdate(false); InventoryUtils.updateCraftingOutputSlot(outputSlot); if (InventoryUtils.areStacksEqual(outputSlot.getStack(), recipe.getResult()) == false) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 4215c46b2..1d8c8b1b2 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -8,6 +8,8 @@ import java.util.Optional; import java.util.Set; import javax.annotation.Nullable; +import it.unimi.dsi.fastutil.ints.IntArrayList; +import it.unimi.dsi.fastutil.ints.IntComparator; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; @@ -37,6 +39,7 @@ import net.minecraft.village.TradeOfferList; import net.minecraft.world.GameRules; import net.minecraft.world.World; +import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -47,9 +50,6 @@ import fi.dy.masa.itemscroller.recipes.RecipeStorage; import fi.dy.masa.itemscroller.villager.VillagerDataStorage; import fi.dy.masa.itemscroller.villager.VillagerUtils; -import fi.dy.masa.malilib.util.GuiUtils; -import it.unimi.dsi.fastutil.ints.IntArrayList; -import it.unimi.dsi.fastutil.ints.IntComparator; public class InventoryUtils { @@ -74,7 +74,7 @@ public static void onSlotChangedCraftingGrid(PlayerEntity player, CraftingInventory craftMatrix, CraftingResultInventory inventoryCraftResult) { - if (inhibitCraftResultUpdate) + if (inhibitCraftResultUpdate && Configs.Generic.MASS_CRAFT_INHIBIT_MID_UPDATES.getBooleanValue()) { return; } From 0bfb82da2c9b0801d4a94eac6743d8c1df2a345e Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sun, 17 Jul 2022 16:22:38 +0300 Subject: [PATCH 098/107] Bump version to 0.16.1 --- build.properties | 2 +- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.properties b/build.properties index ec6881fa6..d6e1052a4 100644 --- a/build.properties +++ b/build.properties @@ -6,7 +6,7 @@ author = masa mod_file_name = itemscroller-fabric # Current mod version -mod_version = 0.16.0 +mod_version = 0.16.1 # Required malilib version malilib_version = 0.12.0 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index a0c5b91ca..8758ea33a 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,6 +34,6 @@ "depends": { "minecraft": "1.18.2", - "malilib": "0.12.x" + "malilib": ">=0.12" } } From 7187a2e89b07c1a79fc24a7ce01dd675b533c231 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 22 Apr 2022 23:10:33 +0300 Subject: [PATCH 099/107] Preliminary update to 1.19 snapshot 22w16b (just version bumps) --- build.properties | 10 +++++----- src/main/resources/fabric.mod.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.properties b/build.properties index d6e1052a4..cf004e028 100644 --- a/build.properties +++ b/build.properties @@ -9,12 +9,12 @@ mod_file_name = itemscroller-fabric mod_version = 0.16.1 # Required malilib version -malilib_version = 0.12.0 +malilib_version = 0.13.0 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.18.2 -minecraft_version = 1.18.2 -mappings_version = 1.18.2+build.1 +minecraft_version_out = 1.19-snap-22w16b +minecraft_version = 22w16b +mappings_version = 22w16b+build.5 fabric_loader_version = 0.13.3 -mod_menu_version = 3.1.0 +mod_menu_version = 4.0.0-beta.4 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 8758ea33a..62e69b043 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": "1.18.2", + "minecraft": "1.19.x", "malilib": ">=0.12" } } From 237547b5b69a03d84ab97b67defa3510ed200b9e Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Fri, 8 Jul 2022 21:04:25 +0300 Subject: [PATCH 100/107] Update to MC 1.19 (not properly/at all tested yet) --- build.gradle | 2 +- build.properties | 12 ++++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- src/main/resources/fabric.mod.json | 2 +- src/main/resources/pack.mcmeta | 6 ------ 5 files changed, 9 insertions(+), 15 deletions(-) delete mode 100644 src/main/resources/pack.mcmeta diff --git a/build.gradle b/build.gradle index d7582b489..9a9c817c9 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.11-SNAPSHOT' + id 'fabric-loom' version '0.12-SNAPSHOT' } sourceCompatibility = JavaVersion.VERSION_17 diff --git a/build.properties b/build.properties index cf004e028..e1e7ecb3d 100644 --- a/build.properties +++ b/build.properties @@ -6,15 +6,15 @@ author = masa mod_file_name = itemscroller-fabric # Current mod version -mod_version = 0.16.1 +mod_version = 0.17.0 # Required malilib version malilib_version = 0.13.0 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.19-snap-22w16b -minecraft_version = 22w16b -mappings_version = 22w16b+build.5 +minecraft_version_out = 1.19.0 +minecraft_version = 1.19 +mappings_version = 1.19+build.4 -fabric_loader_version = 0.13.3 -mod_menu_version = 4.0.0-beta.4 +fabric_loader_version = 0.14.8 +mod_menu_version = 4.0.0 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f6eeba20a..28a9aa66c 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Aug 22 17:36:22 EDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 62e69b043..3b1e1350b 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -34,6 +34,6 @@ "depends": { "minecraft": "1.19.x", - "malilib": ">=0.12" + "malilib": ">=0.13" } } diff --git a/src/main/resources/pack.mcmeta b/src/main/resources/pack.mcmeta deleted file mode 100644 index d2da2492d..000000000 --- a/src/main/resources/pack.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "pack": { - "pack_format": 9, - "description": "Item Scroller" - } -} \ No newline at end of file From 362cdbd5f817bea2810502834cec0eae29f177e4 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 28 Jul 2022 22:07:53 +0300 Subject: [PATCH 101/107] Update to MC 1.19.1 (just version bumps) --- build.properties | 8 ++++---- src/main/resources/fabric.mod.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build.properties b/build.properties index e1e7ecb3d..4df2968c4 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.17.0 malilib_version = 0.13.0 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.19.0 -minecraft_version = 1.19 -mappings_version = 1.19+build.4 +minecraft_version_out = 1.19.1 +minecraft_version = 1.19.1 +mappings_version = 1.19.1+build.1 fabric_loader_version = 0.14.8 -mod_menu_version = 4.0.0 +mod_menu_version = 4.0.5 diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 3b1e1350b..28d201cac 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": "1.19.x", - "malilib": ">=0.13" + "minecraft": ">=1.19 <1.20", + "malilib": "0.13.x" } } From fe5043053dfabe93042d7504b527894b3ebcbb89 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 28 Jul 2022 22:45:13 +0300 Subject: [PATCH 102/107] Change the Mixin that renders the recipe view, for hopefully better mod compat --- .../event/RenderEventHandler.java | 14 ++++++++------ .../masa/itemscroller/mixin/MixinScreen.java | 19 ------------------- src/main/resources/mixins.itemscroller.json | 3 +-- 3 files changed, 9 insertions(+), 27 deletions(-) delete mode 100644 src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index a823a9356..6b7d6486d 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -7,6 +7,10 @@ import net.minecraft.client.render.DiffuseLighting; import net.minecraft.client.util.math.MatrixStack; import net.minecraft.item.ItemStack; +import fi.dy.masa.malilib.render.InventoryOverlay; +import fi.dy.masa.malilib.render.RenderUtils; +import fi.dy.masa.malilib.util.GuiUtils; +import fi.dy.masa.malilib.util.StringUtils; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.recipes.RecipePattern; import fi.dy.masa.itemscroller.recipes.RecipeStorage; @@ -14,10 +18,6 @@ import fi.dy.masa.itemscroller.util.ClickPacketBuffer; import fi.dy.masa.itemscroller.util.InputUtils; import fi.dy.masa.itemscroller.util.InventoryUtils; -import fi.dy.masa.malilib.render.InventoryOverlay; -import fi.dy.masa.malilib.render.RenderUtils; -import fi.dy.masa.malilib.util.GuiUtils; -import fi.dy.masa.malilib.util.StringUtils; public class RenderEventHandler { @@ -40,7 +40,7 @@ public static RenderEventHandler instance() return INSTANCE; } - public void onDrawBackgroundPost(MatrixStack matrixStack) + public void renderRecipeView() { if (GuiUtils.getCurrentScreen() instanceof HandledScreen && InputUtils.isRecipeViewOpen()) { @@ -52,7 +52,7 @@ public void onDrawBackgroundPost(MatrixStack matrixStack) this.calculateRecipePositions(gui); - matrixStack = RenderSystem.getModelViewStack(); + MatrixStack matrixStack = RenderSystem.getModelViewStack(); matrixStack.push(); matrixStack.translate(this.recipeListX, this.recipeListY, 0); matrixStack.scale((float) this.scale, (float) this.scale, 1); @@ -89,6 +89,8 @@ public void onDrawBackgroundPost(MatrixStack matrixStack) public void onDrawScreenPost(MinecraftClient mc) { + this.renderRecipeView(); + if (GuiUtils.getCurrentScreen() instanceof HandledScreen) { HandledScreen gui = (HandledScreen) this.mc.currentScreen; diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java deleted file mode 100644 index 09341a434..000000000 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinScreen.java +++ /dev/null @@ -1,19 +0,0 @@ -package fi.dy.masa.itemscroller.mixin; - -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.client.gui.AbstractParentElement; -import net.minecraft.client.gui.screen.Screen; -import fi.dy.masa.itemscroller.event.RenderEventHandler; - -@Mixin(Screen.class) -public abstract class MixinScreen extends AbstractParentElement -{ - @Inject(method = "renderBackground(Lnet/minecraft/client/util/math/MatrixStack;)V", at = @At("RETURN")) - protected void onDrawDefaultBackgroundPost(net.minecraft.client.util.math.MatrixStack matrixStack, CallbackInfo ci) - { - RenderEventHandler.instance().onDrawBackgroundPost(matrixStack); - } -} diff --git a/src/main/resources/mixins.itemscroller.json b/src/main/resources/mixins.itemscroller.json index aae82aa2b..8c1fe548f 100644 --- a/src/main/resources/mixins.itemscroller.json +++ b/src/main/resources/mixins.itemscroller.json @@ -13,8 +13,7 @@ "MixinCraftingScreenHandler", "MixinGameRenderer", "MixinMerchantScreen", - "MixinMerchantScreenHandler", - "MixinScreen" + "MixinMerchantScreenHandler" ], "injectors": { "defaultRequire": 1 From 1e1a58c8edcde26cd9f62366d036c1257f58e95b Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 28 Jul 2022 22:46:36 +0300 Subject: [PATCH 103/107] Bump version to 0.17.1 --- build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.properties b/build.properties index 4df2968c4..41167368a 100644 --- a/build.properties +++ b/build.properties @@ -6,7 +6,7 @@ author = masa mod_file_name = itemscroller-fabric # Current mod version -mod_version = 0.17.0 +mod_version = 0.17.1 # Required malilib version malilib_version = 0.13.0 From 898d3340c378c39b67b5506022a2639c86c421ed Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sun, 7 Aug 2022 16:37:34 +0300 Subject: [PATCH 104/107] Update to MC 1.19.2 (just version bumps) --- build.properties | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.properties b/build.properties index 41167368a..28e5fc18a 100644 --- a/build.properties +++ b/build.properties @@ -12,9 +12,9 @@ mod_version = 0.17.1 malilib_version = 0.13.0 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.19.1 -minecraft_version = 1.19.1 -mappings_version = 1.19.1+build.1 +minecraft_version_out = 1.19.2 +minecraft_version = 1.19.2 +mappings_version = 1.19.2+build.1 -fabric_loader_version = 0.14.8 -mod_menu_version = 4.0.5 +fabric_loader_version = 0.14.9 +mod_menu_version = 4.0.6 From f88cc488fc8abcefa28b670fb35c6af805f4e872 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 8 Dec 2022 22:51:31 +0200 Subject: [PATCH 105/107] Switch from using `build.properties` to `gradle.properties` --- build.gradle | 32 ++++++++++----------------- build.properties => gradle.properties | 5 ++++- 2 files changed, 16 insertions(+), 21 deletions(-) rename build.properties => gradle.properties (82%) diff --git a/build.gradle b/build.gradle index 9a9c817c9..3ba888eaf 100644 --- a/build.gradle +++ b/build.gradle @@ -11,31 +11,23 @@ repositories { // maven { url 'https://maven.quiltmc.org/repository/release/' } } -ext.configFile = file "build.properties" - -configFile.withReader { - def prop = new Properties() - prop.load(it) - project.ext.config = new ConfigSlurper().parse prop -} - dependencies { - minecraft "com.mojang:minecraft:${config.minecraft_version}" - mappings "net.fabricmc:yarn:${config.mappings_version}:v2" - modImplementation "net.fabricmc:fabric-loader:${config.fabric_loader_version}" + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.mappings_version}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_version}" implementation "com.google.code.findbugs:jsr305:3.0.2" - modImplementation "fi.dy.masa.malilib:malilib-fabric-${config.minecraft_version_out}:${config.malilib_version}" + modImplementation "fi.dy.masa.malilib:malilib-fabric-${project.minecraft_version_out}:${project.malilib_version}" // Fabric API. This is technically optional, but you probably want it anyway. - //modCompile "net.fabricmc.fabric-api:fabric-api:" + config.fabric_version + //modCompile "net.fabricmc.fabric-api:fabric-api:" + project.fabric_version - modCompileOnly "com.terraformersmc:modmenu:${config.mod_menu_version}" + modCompileOnly "com.terraformersmc:modmenu:${project.mod_menu_version}" } -group = config.group + "." + config.mod_id -archivesBaseName = config.mod_file_name + '-' + config.minecraft_version_out -version = config.mod_version +group = project.group + "." + project.mod_id +archivesBaseName = project.mod_file_name + '-' + project.minecraft_version_out +version = project.mod_version if (version.endsWith('-dev')) { version += "." + new Date().format('yyyyMMdd.HHmmss') @@ -47,12 +39,12 @@ processResources { exclude '**/xcf' // this will ensure that this task is redone when the versions change. - //inputs.property "minecraft_version", project.config.minecraft_version + //inputs.property "minecraft_version", project.project.minecraft_version - inputs.property "mod_version", config.mod_version + inputs.property "mod_version", project.mod_version filesMatching("fabric.mod.json") { - expand "mod_version": config.mod_version + expand "mod_version": project.mod_version } } diff --git a/build.properties b/gradle.properties similarity index 82% rename from build.properties rename to gradle.properties index 28e5fc18a..dc6657227 100644 --- a/build.properties +++ b/gradle.properties @@ -1,4 +1,7 @@ -# Thu Jan 14 08:33:00 EET 2016 +org.gradle.jvmargs = -Xmx3G +org.gradle.daemon = false +org.gradle.cache.cleanup = false + group = fi.dy.masa mod_id = itemscroller mod_name = Item Scroller From 8d57c7ef2ca887b07d3c75d27158d1846f217ec9 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Thu, 8 Dec 2022 22:59:47 +0200 Subject: [PATCH 106/107] Update to MC 1.19.3 --- build.gradle | 2 +- gradle.properties | 14 +++++------ gradle/wrapper/gradle-wrapper.properties | 2 +- .../itemscroller/mixin/MixinGameRenderer.java | 2 +- .../itemscroller/util/InventoryUtils.java | 15 ++++++------ .../masa/itemscroller/villager/TradeType.java | 23 +++++++++++++++---- src/main/resources/fabric.mod.json | 4 ++-- 7 files changed, 38 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index 3ba888eaf..9a1895823 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '0.12-SNAPSHOT' + id 'fabric-loom' version '1.0-SNAPSHOT' } sourceCompatibility = JavaVersion.VERSION_17 diff --git a/gradle.properties b/gradle.properties index dc6657227..61ded7b1a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,15 +9,15 @@ author = masa mod_file_name = itemscroller-fabric # Current mod version -mod_version = 0.17.1 +mod_version = 0.18.0 # Required malilib version -malilib_version = 0.13.0 +malilib_version = 0.14.0 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.19.2 -minecraft_version = 1.19.2 -mappings_version = 1.19.2+build.1 +minecraft_version_out = 1.19.3 +minecraft_version = 1.19.3 +mappings_version = 1.19.3+build.2 -fabric_loader_version = 0.14.9 -mod_menu_version = 4.0.6 +fabric_loader_version = 0.14.11 +mod_menu_version = 5.0.1 diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 28a9aa66c..b5e74cfbf 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Mon Aug 22 17:36:22 EDT 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java index c539cf250..323f66eb2 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinGameRenderer.java @@ -16,7 +16,7 @@ public abstract class MixinGameRenderer @Inject(method = "render(FJZ)V", at = @At(value = "INVOKE", shift = Shift.AFTER, - target = "Lnet/minecraft/client/gui/screen/Screen;render(Lnet/minecraft/client/util/math/MatrixStack;IIF)V")) + target = "Lnet/minecraft/client/gui/screen/Screen;renderWithTooltip(Lnet/minecraft/client/util/math/MatrixStack;IIF)V")) private void onDrawScreenPost(float partialTicks, long nanoTime, boolean renderWorldIn, CallbackInfo ci) { RenderEventHandler.instance().onDrawScreenPost(this.client); diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 1d8c8b1b2..97d9c56c9 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -10,6 +10,7 @@ import javax.annotation.Nullable; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntComparator; + import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; @@ -23,10 +24,10 @@ import net.minecraft.inventory.CraftingInventory; import net.minecraft.inventory.CraftingResultInventory; import net.minecraft.inventory.Inventory; -import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.recipe.CraftingRecipe; import net.minecraft.recipe.RecipeType; +import net.minecraft.registry.Registries; import net.minecraft.screen.MerchantScreenHandler; import net.minecraft.screen.ScreenHandler; import net.minecraft.screen.slot.CraftingResultSlot; @@ -34,12 +35,11 @@ import net.minecraft.screen.slot.SlotActionType; import net.minecraft.screen.slot.TradeOutputSlot; import net.minecraft.util.Identifier; -import net.minecraft.util.registry.Registry; import net.minecraft.village.TradeOffer; import net.minecraft.village.TradeOfferList; import net.minecraft.world.GameRules; import net.minecraft.world.World; -import fi.dy.masa.malilib.util.GuiUtils; + import fi.dy.masa.itemscroller.ItemScroller; import fi.dy.masa.itemscroller.config.Configs; import fi.dy.masa.itemscroller.config.Hotkeys; @@ -50,6 +50,7 @@ import fi.dy.masa.itemscroller.recipes.RecipeStorage; import fi.dy.masa.itemscroller.villager.VillagerDataStorage; import fi.dy.masa.itemscroller.villager.VillagerUtils; +import fi.dy.masa.malilib.util.GuiUtils; public class InventoryUtils { @@ -141,7 +142,7 @@ public static String getStackString(ItemStack stack) { if (isStackEmpty(stack) == false) { - Identifier rl = Registry.ITEM.getId(stack.getItem()); + Identifier rl = Registries.ITEM.getId(stack.getItem()); String idStr = rl != null ? rl.toString() : "null"; String displayName = stack.getName().getString(); String nbtStr = stack.getNbt() != null ? stack.getNbt().toString() : ""; @@ -387,7 +388,7 @@ public static boolean dragMoveItems(HandledScreen gui, { if (gui instanceof CreativeInventoryScreen) { - boolean isPlayerInv = ((CreativeInventoryScreen) gui).getSelectedTab() == ItemGroup.INVENTORY.getIndex(); + boolean isPlayerInv = ((CreativeInventoryScreen) gui).isInventoryTabSelected(); // TODO 1.19.3+ int slotNumber = isPlayerInv ? AccessorUtils.getSlotIndex(slot) : slot.id; slotNumberLast = slotNumber; } @@ -487,7 +488,7 @@ private static boolean dragMoveFromSlotAtPositionCreative(HandledScreen=1.19 <1.20", - "malilib": "0.13.x" + "minecraft": "1.19.3", + "malilib": "0.14.x" } } From f1d4b9e50cc4220ad338331d887056040fdc6472 Mon Sep 17 00:00:00 2001 From: Matti Ruohonen Date: Sat, 18 Mar 2023 19:58:43 +0200 Subject: [PATCH 107/107] Update to MC 1.19.4 (by tomalbrc) --- build.gradle | 2 +- gradle.properties | 14 +++++++------- .../itemscroller/event/RenderEventHandler.java | 7 ++++--- .../mixin/MixinClientPlayerInteractionManager.java | 4 ++-- .../itemscroller/mixin/MixinMerchantScreen.java | 2 +- .../masa/itemscroller/util/ClickPacketBuffer.java | 2 +- .../dy/masa/itemscroller/util/InventoryUtils.java | 8 ++++---- src/main/resources/fabric.mod.json | 4 ++-- 8 files changed, 22 insertions(+), 21 deletions(-) diff --git a/build.gradle b/build.gradle index 9a1895823..1102c784f 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.0-SNAPSHOT' + id 'fabric-loom' version '1.1-SNAPSHOT' } sourceCompatibility = JavaVersion.VERSION_17 diff --git a/gradle.properties b/gradle.properties index 61ded7b1a..4f24bdb63 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,15 +9,15 @@ author = masa mod_file_name = itemscroller-fabric # Current mod version -mod_version = 0.18.0 +mod_version = 0.19.2 # Required malilib version -malilib_version = 0.14.0 +malilib_version = 0.15.2 # Minecraft, Fabric and mappings versions -minecraft_version_out = 1.19.3 -minecraft_version = 1.19.3 -mappings_version = 1.19.3+build.2 +minecraft_version_out = 1.19.4 +minecraft_version = 1.19.4 +mappings_version = 1.19.4+build.1 -fabric_loader_version = 0.14.11 -mod_menu_version = 5.0.1 +fabric_loader_version = 0.14.17 +mod_menu_version = 6.1.0-rc.4 \ No newline at end of file diff --git a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java index 6b7d6486d..c80512abe 100644 --- a/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java +++ b/src/main/java/fi/dy/masa/itemscroller/event/RenderEventHandler.java @@ -302,9 +302,10 @@ private void renderStackAt(ItemStack stack, int x, int y, boolean border) stack = stack.copy(); InventoryUtils.setStackSize(stack, 1); - this.mc.getItemRenderer().zOffset += 100; - this.mc.getItemRenderer().renderInGui(stack, x, y); - this.mc.getItemRenderer().zOffset -= 100; + + MatrixStack matrixStack = new MatrixStack(); + matrixStack.translate(0, 0, 100.f); + this.mc.getItemRenderer().renderInGui(matrixStack, stack, x, y); } } diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java index 621f2337f..a807c8a5e 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinClientPlayerInteractionManager.java @@ -7,7 +7,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayerInteractionManager; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; import fi.dy.masa.itemscroller.util.ClickPacketBuffer; @Mixin(ClientPlayerInteractionManager.class) @@ -23,7 +23,7 @@ private void cancelWindowClicksWhileReplayingBufferedPackets(CallbackInfo ci) } @Redirect(method = "clickSlot", at = @At(value = "INVOKE", - target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/Packet;)V")) + target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V")) private void bufferClickPacketsAndCancel(ClientPlayNetworkHandler netHandler, Packet packet) { if (ClickPacketBuffer.shouldBufferClickPackets()) diff --git a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java index b6ec02ea9..dd79fe4cd 100644 --- a/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java +++ b/src/main/java/fi/dy/masa/itemscroller/mixin/MixinMerchantScreen.java @@ -160,7 +160,7 @@ private void renderFavoriteMarker(MatrixStack matrices, int mouseX, int mouseY, int buttonsStartY = screenY + 16 + 2; int x = buttonsStartX + 89 - 8; int y = buttonsStartY + 2; - float z = this.getZOffset() + 300; + float z = 300; IGuiIcon icon = favoriteData.isGlobal ? ItemScrollerIcons.STAR_5_PURPLE : ItemScrollerIcons.STAR_5_YELLOW; for (int i = 0; i < (numFavorites - this.indexStartOffset); ++i) diff --git a/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java b/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java index a329bc8ae..fa05b38b9 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/ClickPacketBuffer.java @@ -3,7 +3,7 @@ import java.util.ArrayDeque; import java.util.Queue; import net.minecraft.client.MinecraftClient; -import net.minecraft.network.Packet; +import net.minecraft.network.packet.Packet; public class ClickPacketBuffer { diff --git a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java index 97d9c56c9..6863deffa 100644 --- a/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/itemscroller/util/InventoryUtils.java @@ -124,7 +124,7 @@ public static void updateCraftingOutputSlot(PlayerEntity player, ((ClientPlayerEntity) player).getRecipeBook().contains(recipe))) { inventoryCraftResult.setLastRecipe(recipe); - stack = recipe.craft(craftMatrix); + stack = recipe.craft(craftMatrix, MinecraftClient.getInstance().getNetworkHandler().getRegistryManager()); } if (setEmptyStack || stack.isEmpty() == false) @@ -835,7 +835,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, ItemStack[] originalStacks = getOriginalStacks(container); // Try to move the temporary single-item stack via the shift-click handler method - slot.setStack(stack); + slot.setStackNoCallbacks(stack); container.quickMove(mc.player, slot.id); // Successfully moved the item somewhere, now we want to check where it went @@ -858,7 +858,7 @@ private static boolean tryMoveSingleItemToOtherInventory(Slot slot, } // Restore the original stack to the slot under the cursor (on the client side) - slot.setStack(stackOrig); + slot.setStackNoCallbacks(stackOrig); return false; } @@ -2117,7 +2117,7 @@ private static void restoreOriginalStacks(ScreenHandler container, ItemStack[] o if (areStacksEqual(stackSlot, originalStacks[i]) == false || (isStackEmpty(stackSlot) == false && getStackSize(stackSlot) != getStackSize(originalStacks[i]))) { - container.getSlot(i).setStack(originalStacks[i]); + container.getSlot(i).setStackNoCallbacks(originalStacks[i]); } } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d6c740a37..96c0ea95f 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -33,7 +33,7 @@ ], "depends": { - "minecraft": "1.19.3", - "malilib": "0.14.x" + "minecraft": "1.19.4", + "malilib": "0.15.x" } }