From 485c0142ca7a1bdf46d13ec8dd21656bc57d09ae Mon Sep 17 00:00:00 2001 From: Fuzss <28218241+Fuzss@users.noreply.github.com> Date: Sun, 28 Nov 2021 19:23:44 +0100 Subject: [PATCH] shift-clicking hotfix --- CHANGELOG.md | 4 ++++ gradle.properties | 2 +- .../world/inventory/CraftingContainerWrapper.java | 13 ++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99a4af0..744be16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog]. +## [v2.0.0b2-1.17.1] - 2021-11-28 +### Fixed +- Fixed an issue where shift-clicking multiple crafting results wouldn't work properly + ## [v2.0.0b1-1.17.1] - 2021-11-23 - Ported to Minecraft 1.17 ### Issues diff --git a/gradle.properties b/gradle.properties index 404819f..def60ee 100755 --- a/gradle.properties +++ b/gradle.properties @@ -22,7 +22,7 @@ packFormat=7 # attributes modId=visualworkbench modName=Visual Workbench -modVersion=2.0.0b1 +modVersion=2.0.0b2 modAuthor=Fuzs modDescription=Items stay inside of crafting tables and are also rendered on top. It's really fancy! modPageUrl=https://www.curseforge.com/minecraft/mc-mods/visual-workbench diff --git a/src/main/java/fuzs/visualworkbench/world/inventory/CraftingContainerWrapper.java b/src/main/java/fuzs/visualworkbench/world/inventory/CraftingContainerWrapper.java index 4e51250..f79d35f 100644 --- a/src/main/java/fuzs/visualworkbench/world/inventory/CraftingContainerWrapper.java +++ b/src/main/java/fuzs/visualworkbench/world/inventory/CraftingContainerWrapper.java @@ -9,10 +9,12 @@ public class CraftingContainerWrapper extends CraftingContainer { private final Container inventory; + private final AbstractContainerMenu menu; public CraftingContainerWrapper(Container inventory, AbstractContainerMenu eventHandler, int width, int height) { super(eventHandler, width, height); this.inventory = inventory; + this.menu = eventHandler; if (width * height != this.getContainerSize()) throw new IllegalArgumentException("Wrong crafting inventory dimensions!"); } @@ -38,16 +40,17 @@ public ItemStack removeItemNoUpdate(int index) { @Override public ItemStack removeItem(int index, int count) { - // usually crafting inventory calls slotsChanged on the menu here, we don't need that as we use a container listener instead of the method - // this is needed to be able to respond to changes made by other players - return this.inventory.removeItem(index, count); + ItemStack itemstack = this.inventory.removeItem(index, count); + if (!itemstack.isEmpty()) { + this.menu.slotsChanged(this); + } + return itemstack; } @Override public void setItem(int index, ItemStack stack) { - // usually crafting inventory calls slotsChanged on the menu here, we don't need that as we use a container listener instead of the method - // this is needed to be able to respond to changes made by other players this.inventory.setItem(index, stack); + this.menu.slotsChanged(this); } @Override