diff --git a/changelog.md b/changelog.md index ee15130..7d6c5ba 100644 --- a/changelog.md +++ b/changelog.md @@ -1 +1 @@ -- Add Simplified Chinese translation (SnowCutieOwO) +- Fix a bug breaking middle-click drag in creative mode diff --git a/common/src/main/java/dev/terminalmc/clientsort/mixin/MixinAbstractContainerScreen.java b/common/src/main/java/dev/terminalmc/clientsort/mixin/MixinAbstractContainerScreen.java index 55f424b..fd5aecd 100644 --- a/common/src/main/java/dev/terminalmc/clientsort/mixin/MixinAbstractContainerScreen.java +++ b/common/src/main/java/dev/terminalmc/clientsort/mixin/MixinAbstractContainerScreen.java @@ -36,6 +36,7 @@ import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.ClickType; import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; import org.lwjgl.glfw.GLFW; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -63,6 +64,9 @@ protected MixinAbstractContainerScreen(Component textComponent_1) { @Shadow protected Slot hoveredSlot; + @Shadow + private ItemStack draggingItem; + @Inject( method = "mouseClicked", at = @At(value = "HEAD"), @@ -135,10 +139,13 @@ public boolean mouseWheelie_triggerSort() { @Unique private boolean clientSort$specialOperation(int button) { Options options = this.minecraft.options; - if (this.hoveredSlot.hasItem() && - ((options.keyPickItem.matchesMouse(button) - && this.minecraft.gameMode.hasInfiniteItems()) - || options.keyDrop.matchesMouse(button))) { + if (((options.keyPickItem.matchesMouse(button) + && this.minecraft.gameMode.hasInfiniteItems() + && (this.hoveredSlot.hasItem() + || !this.draggingItem.isEmpty() + || !this.menu.getCarried().isEmpty()))) + || (options.keyDrop.matchesMouse(button) + && this.hoveredSlot.hasItem())) { return true; } else if (options.keySwapOffhand.matchesMouse(button)) { @@ -158,10 +165,13 @@ else if (options.keySwapOffhand.matchesMouse(button)) { @Unique private boolean clientSort$specialOperation(int keyCode, int scanCode) { Options options = this.minecraft.options; - if (this.hoveredSlot.hasItem() && - ((options.keyPickItem.matches(keyCode, scanCode) - && this.minecraft.gameMode.hasInfiniteItems()) - || options.keyDrop.matches(keyCode, scanCode))) { + if (((options.keyPickItem.matches(keyCode, scanCode) + && this.minecraft.gameMode.hasInfiniteItems() + && (this.hoveredSlot.hasItem() + || !this.draggingItem.isEmpty() + || !this.menu.getCarried().isEmpty()))) + || (options.keyDrop.matches(keyCode, scanCode) + && this.hoveredSlot.hasItem())) { return true; } else if (options.keySwapOffhand.matches(keyCode, scanCode)) { diff --git a/gradle.properties b/gradle.properties index 8803392..928ccad 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ # Neo/Forge version ranges: https://maven.apache.org/enforcer/enforcer-rules/versionRanges.html # Project -mod_version=0.8.0 +mod_version=0.9.0 mod_group=dev.terminalmc mod_id=clientsort mod_name=ClientSort @@ -65,12 +65,12 @@ curseforge_id=1049891 release_type=beta # Fabric release_mod_loaders_fabric=fabric,quilt -release_game_versions_fabric=1.21 +release_game_versions_fabric=1.21,1.21.1 release_required_dep_ids_fabric_mr=P7dR8mSH,mOgUt4GM,9s6osm5g release_required_dep_ids_fabric_cf=fabric-api,modmenu,cloth-config # NeoForge release_mod_loaders_neoforge=neoforge -release_game_versions_neoforge=1.21 +release_game_versions_neoforge=1.21,1.21.1 release_required_dep_ids_neoforge_mr=9s6osm5g release_required_dep_ids_neoforge_cf=cloth-config