Skip to content

Commit

Permalink
shift-clicking hotfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuzss committed Nov 28, 2021
1 parent fcbe5cc commit 485c014
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!");
}

Expand All @@ -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
Expand Down

0 comments on commit 485c014

Please sign in to comment.