Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ loader_version=0.18.6
loom_version=1.16-SNAPSHOT

# Mod Properties
mod_version=1.1.6+26.1
mod_version=1.1.7+26.1
maven_group=borknbeans.lightweightinventorysorting
archives_base_name=lightweight-inventory-sorting

# Dependencies
fabric_version=0.145.4+26.1.1
modmenu_version=18.0.0-alpha.8
fabric_version=0.155.3+26.1.2
modmenu_version=18.0.1
cloth_version=26.1.154
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.ContainerScreen;
import net.minecraft.client.input.KeyEvent;
import net.minecraft.client.input.MouseButtonEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.ChestMenu;
Expand Down Expand Up @@ -49,15 +48,4 @@ public boolean keyPressed(KeyEvent event) {
}
return super.keyPressed(event);
}

@Override
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
if (LightweightInventorySortingClient.sortKeyBind.matchesMouse(event)) {
if (this.sortButton != null) {
Sorter.sortContainerClientside(Minecraft.getInstance(), sortButton.getSortStartIndex(), sortButton.getSortEndIndex());
}
return true;
}
return super.mouseClicked(event, doubleClick);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen;
import net.minecraft.client.input.KeyEvent;
import net.minecraft.client.input.MouseButtonEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
Expand All @@ -18,6 +17,7 @@
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;

@Mixin(CreativeModeInventoryScreen.class)
public abstract class CreativeModeInventoryScreenMixin extends AbstractContainerScreen<AbstractContainerMenu> {
Expand Down Expand Up @@ -66,28 +66,14 @@ private void updateSortButton() {
}
}

@Override
public boolean keyPressed(KeyEvent event) {
// Only allow sorting when on inventory tab
@Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true)
private void onKeyPressed(KeyEvent event, CallbackInfoReturnable<Boolean> cir) {
if (isInventoryTab() && LightweightInventorySortingClient.sortKeyBind.matches(event)) {
if (sortButton != null) {
Sorter.sortContainerClientside(Minecraft.getInstance(), sortButton.getSortStartIndex(), sortButton.getSortEndIndex());
}
return true;
cir.setReturnValue(true);
}
return super.keyPressed(event);
}

@Override
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
// Only allow sorting when on inventory tab
if (isInventoryTab() && LightweightInventorySortingClient.sortKeyBind.matchesMouse(event)) {
if (sortButton != null) {
Sorter.sortContainerClientside(Minecraft.getInstance(), sortButton.getSortStartIndex(), sortButton.getSortEndIndex());
}
return true;
}
return super.mouseClicked(event, doubleClick);
}

@Unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.HorseInventoryScreen;
import net.minecraft.client.input.KeyEvent;
import net.minecraft.client.input.MouseButtonEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.HorseInventoryMenu;
Expand Down Expand Up @@ -47,15 +46,4 @@ public boolean keyPressed(KeyEvent event) {
}
return super.keyPressed(event);
}

@Override
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
if (LightweightInventorySortingClient.sortKeyBind.matchesMouse(event)) {
if (sortButton != null) {
Sorter.sortContainerClientside(Minecraft.getInstance(), sortButton.getSortStartIndex(), sortButton.getSortEndIndex());
}
return true;
}
return super.mouseClicked(event, doubleClick);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.InventoryScreen;
import net.minecraft.client.input.KeyEvent;
import net.minecraft.client.input.MouseButtonEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.InventoryMenu;
Expand Down Expand Up @@ -45,7 +44,6 @@ private void onRecipeBookToggle(CallbackInfo ci) {
}
}


@Override
public boolean keyPressed(KeyEvent event) {
if (LightweightInventorySortingClient.sortKeyBind.matches(event)) {
Expand All @@ -57,17 +55,6 @@ public boolean keyPressed(KeyEvent event) {
return super.keyPressed(event);
}

@Override
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
if (LightweightInventorySortingClient.sortKeyBind.matchesMouse(event)) {
if (sortButton != null) {
Sorter.sortContainerClientside(Minecraft.getInstance(), sortButton.getSortStartIndex(), sortButton.getSortEndIndex());
}
return true;
}
return super.mouseClicked(event, doubleClick);
}

private void setButtonCoordinates() {
sortButton.setX(this.leftPos + this.imageWidth - 20 + Config.xOffsetInventory);
sortButton.setY(this.height / 2 - 15 + Config.yOffsetInventory);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.gui.screens.inventory.ShulkerBoxScreen;
import net.minecraft.client.input.KeyEvent;
import net.minecraft.client.input.MouseButtonEvent;
import net.minecraft.network.chat.Component;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.ShulkerBoxMenu;
Expand Down Expand Up @@ -36,7 +35,6 @@ protected void init() {
this.addRenderableWidget(sortButton);
}


@Override
public boolean keyPressed(KeyEvent event) {
if (LightweightInventorySortingClient.sortKeyBind.matches(event)) {
Expand All @@ -47,15 +45,4 @@ public boolean keyPressed(KeyEvent event) {
}
return super.keyPressed(event);
}

@Override
public boolean mouseClicked(MouseButtonEvent event, boolean doubleClick) {
if (LightweightInventorySortingClient.sortKeyBind.matchesMouse(event)) {
if (sortButton != null) {
Sorter.sortContainerClientside(Minecraft.getInstance(), sortButton.getSortStartIndex(), sortButton.getSortEndIndex());
}
return true;
}
return super.mouseClicked(event, doubleClick);
}
}
6 changes: 4 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"Alex9303",
"demorogabrtz",
"RuyaSavascisi",
"LarsMans64"
"LarsMans64",
"gabrtzweb",
"kuroneko007"
],
"contact": {
"sources": "https://github.com/borknbeans/LightweightInventorySorting/tree/main"
Expand Down Expand Up @@ -48,4 +50,4 @@
"modmenu": "*",
"cloth-config": "*"
}
}
}