Skip to content

Commit dcbb97b

Browse files
committed
Update to mc1.21.3
1 parent 8653999 commit dcbb97b

File tree

12 files changed

+81
-91
lines changed

12 files changed

+81
-91
lines changed

common/build.gradle

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@ plugins {
33
id("net.neoforged.moddev")
44
}
55

6+
// Vanilla depends on ASM 9.3, MDG makes that a 'strict' version constraint,
7+
// but Mixin and MixinExtras needs newer ASM so we override that here.
8+
configurations.configureEach {
9+
resolutionStrategy.eachDependency { details ->
10+
if (details.requested.group == "org.ow2.asm") {
11+
details.useVersion(asm_version)
12+
details.because("Mixin requires new ASM")
13+
}
14+
}
15+
}
16+
617
dependencies {
18+
compileOnly "org.ow2.asm:asm:${asm_version}"
19+
compileOnly "org.ow2.asm:asm-analysis:${asm_version}"
20+
compileOnly "org.ow2.asm:asm-commons:${asm_version}"
21+
compileOnly "org.ow2.asm:asm-tree:${asm_version}"
22+
compileOnly "org.ow2.asm:asm-util:${asm_version}"
23+
724
compileOnly("org.spongepowered:mixin:${mixin_version}")
825
// compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}"))
926

common/src/main/java/dev/terminalmc/clientsort/config/Config.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ public enum ExtraSlotScope {
8181
NONE
8282
}
8383

84-
public static final boolean lmbBundleDefault = false;
85-
public boolean lmbBundle = lmbBundleDefault;
84+
public static final boolean rmbBundleDefault = false;
85+
public boolean rmbBundle = rmbBundleDefault;
8686

8787
// Sort mode options
8888

common/src/main/java/dev/terminalmc/clientsort/gui/screen/ClothScreenProvider.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ else if (val > Config.Options.interactionRateMax) return Optional.of(
116116
.setSaveConsumer(val -> options.extraSlotScope = val)
117117
.build());
118118

119-
general.addEntry(eb.startBooleanToggle(localized("option", "lmbBundle"),
120-
options.lmbBundle)
121-
.setTooltip(localized("option", "lmbBundle.tooltip"))
122-
.setDefaultValue(Config.Options.lmbBundleDefault)
119+
general.addEntry(eb.startBooleanToggle(localized("option", "rmbBundle"),
120+
options.rmbBundle)
121+
.setTooltip(localized("option", "rmbBundle.tooltip"))
122+
.setDefaultValue(Config.Options.rmbBundleDefault)
123123
.setSaveConsumer(val -> {
124-
options.lmbBundle = val;
124+
options.rmbBundle = val;
125125
if (val) CreativeSearchOrder.tryRefreshStackPositionMap();
126126
})
127127
.build());

common/src/main/java/dev/terminalmc/clientsort/inventory/ContainerScreenHelper.java

Lines changed: 26 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import dev.terminalmc.clientsort.util.inject.ISlot;
2323
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
2424
import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen;
25-
import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen;
2625
import net.minecraft.world.entity.player.Inventory;
2726
import net.minecraft.world.inventory.ClickType;
2827
import net.minecraft.world.inventory.Slot;
@@ -101,69 +100,41 @@ public Scope getScope(Slot slot) {
101100
return Scope.INVALID;
102101
}
103102

104-
// Player inventory only screen
105-
if (screen instanceof EffectRenderingInventoryScreen) {
106-
// Player inventory
107-
if (slot.container instanceof Inventory) {
108-
boolean mergeWithHotbar = false;
109-
110-
// Extra inventory slots e.g. offhand
111-
if (isExtraSlot(slot)) {
112-
switch (options().extraSlotScope) {
113-
case HOTBAR -> mergeWithHotbar = true;
114-
case EXTRA -> {
115-
return Scope.PLAYER_INV_EXTRA;
116-
}
117-
case NONE -> {
118-
return Scope.INVALID;
119-
}
103+
// Player inventory
104+
if (slot.container instanceof Inventory) {
105+
boolean mergeWithHotbar = false;
106+
107+
// Extra inventory slots e.g. offhand
108+
if (isExtraSlot(slot)) {
109+
switch (options().extraSlotScope) {
110+
case HOTBAR -> mergeWithHotbar = true;
111+
case EXTRA -> {
112+
return Scope.PLAYER_INV_EXTRA;
120113
}
121-
}
122-
123-
// Hotbar
124-
if (mergeWithHotbar || isHotbarSlot(slot)) {
125-
switch (options().hotbarScope) {
126-
case HOTBAR -> {
127-
return Scope.PLAYER_INV_HOTBAR;
128-
}
129-
case NONE -> {
130-
return Scope.INVALID;
131-
}
114+
case NONE -> {
115+
return Scope.INVALID;
132116
}
133117
}
134-
135-
return Scope.PLAYER_INV;
136118
}
137119

138-
// Out of inventory e.g. 2x2 crafting grid
139-
else {
140-
return Scope.PLAYER_OTHER;
141-
}
142-
}
143-
144-
// Container screen, probably with player inventory attached
145-
else {
146-
// Player inventory
147-
if (slot.container instanceof Inventory) {
148-
// Hotbar
149-
if (isHotbarSlot(slot)) {
150-
switch (options().hotbarScope) {
151-
case HOTBAR -> {
152-
return Scope.PLAYER_INV_HOTBAR;
153-
}
154-
case NONE -> {
155-
return Scope.INVALID;
156-
}
120+
// Hotbar
121+
if (mergeWithHotbar || isHotbarSlot(slot)) {
122+
switch (options().hotbarScope) {
123+
case HOTBAR -> {
124+
return Scope.PLAYER_INV_HOTBAR;
125+
}
126+
case NONE -> {
127+
return Scope.INVALID;
157128
}
158129
}
159-
160-
return Scope.PLAYER_INV;
161130
}
162131

163-
// Container
164-
else {
165-
return Scope.CONTAINER_INV;
166-
}
132+
return Scope.PLAYER_INV;
133+
}
134+
135+
// Not player inventory
136+
else {
137+
return Scope.CONTAINER_INV;
167138
}
168139
}
169140

common/src/main/java/dev/terminalmc/clientsort/inventory/sort/InventorySorter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ protected void sortOnClient(int[] sortedIds, boolean playSound) {
347347
// Swap the current stack with the target stack, using right
348348
// click if required for bundles
349349
if (
350-
options().lmbBundle && (
350+
!options().rmbBundle && (
351351
// Clicking on bundle with item,
352352
(backingStacks[id] instanceof BundleItem
353353
&& !(carriedItem instanceof AirItem))

common/src/main/java/dev/terminalmc/clientsort/mixin/MixinClientPacketListener.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import net.minecraft.client.multiplayer.ClientPacketListener;
2323
import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
2424
import net.minecraft.network.protocol.game.ClientboundLoginPacket;
25-
import net.minecraft.network.protocol.game.ClientboundSetCarriedItemPacket;
25+
import net.minecraft.network.protocol.game.ClientboundSetCursorItemPacket;
2626
import org.spongepowered.asm.mixin.Mixin;
2727
import org.spongepowered.asm.mixin.injection.At;
2828
import org.spongepowered.asm.mixin.injection.Inject;
@@ -42,8 +42,8 @@ private void onLogin(ClientboundLoginPacket packet, CallbackInfo ci) {
4242
ClientSort.setInteractionManagerTickRate(options());
4343
}
4444

45-
@Inject(method = "handleSetCarriedItem", at = @At("HEAD"))
46-
public void onHeldItemChangeBegin(ClientboundSetCarriedItemPacket packet, CallbackInfo ci) {
45+
@Inject(method = "handleSetCursorItem", at = @At("HEAD"))
46+
public void onHeldItemChangeBegin(ClientboundSetCursorItemPacket packet, CallbackInfo ci) {
4747
InteractionManager.triggerSend(InteractionManager.TriggerType.HELD_ITEM_CHANGE);
4848
}
4949

common/src/main/resources/assets/clientsort/lang/en_us.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"option.clientsort.optimizedCreativeSorting.tooltip": "Whether to improve performance of creative-order sorting by storing the order in memory",
1818
"option.clientsort.hotbarScope": "Hotbar Scope",
1919
"option.clientsort.extraSlotScope": "Extra Slot Scope",
20-
"option.clientsort.lmbBundle": "Bundles use Left Click",
21-
"option.clientsort.lmbBundle.tooltip": "In 1.21.2+, bundles use left-click to load, which breaks sorting. If playing on a 1.21.2+ server, enable this option.",
20+
"option.clientsort.rmbBundle": "Bundles use Right Click",
21+
"option.clientsort.rmbBundle.tooltip": "Before 1.21.2, bundles used right-click to load, which breaks sorting. If playing on a 1.21.1 or earlier server, enable this option.",
2222

2323
"option.clientsort.sorting": "Sorting",
2424
"option.clientsort.sortOrder": "Sort Order",

common/src/main/resources/assets/clientsort/lang/ru_ru.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"option.clientsort.optimizedCreativeSorting.tooltip": "Стоит ли улучшать производительность сортировки в творческой сортировке, сохраняя порядок в памяти",
1818
"option.clientsort.hotbarScope": "Режим панели быстрого доступа",
1919
"option.clientsort.extraSlotScope": "Режим дополнительных слотов",
20-
"option.clientsort.lmbBundle": "Пакеты используют ЛКМ",
21-
"option.clientsort.lmbBundle.tooltip": "С версии 1.21.2+ для загрузки пакетов используется ЛКМ, что нарушает сортировку. Если вы играете на сервере 1.21.2+, включите эту опцию.",
20+
"option.clientsort.rmbBundle": "Пакеты используют ПКМ",
21+
"option.clientsort.rmbBundle.tooltip": "До версии 1.21.2 для загрузки пакетов использовалась ПКМ, что нарушало сортировку. Если вы играете на сервере 1.21.1 или более ранней версии, включите эту опцию.",
2222

2323
"option.clientsort.sorting": "Сортировка",
2424
"option.clientsort.sortOrder": "Режим сортировки",

common/src/main/resources/assets/clientsort/lang/uk_ua.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"option.clientsort.optimizedCreativeSorting.tooltip": "Whether to improve performance of creative-order sorting by storing the order in memory",
1818
"option.clientsort.hotbarScope": "Режим панелі швидкого доступу",
1919
"option.clientsort.extraSlotScope": "Extra Slot Scope",
20-
"option.clientsort.lmbBundle": "Bundles use Left Click",
21-
"option.clientsort.lmbBundle.tooltip": "In 1.21.2+, bundles use left-click to load, which breaks sorting. If playing on a 1.21.2+ server, enable this option.",
20+
"option.clientsort.rmbBundle": "Bundles use Right Click",
21+
"option.clientsort.rmbBundle.tooltip": "Before 1.21.2, bundles used right-click to load, which breaks sorting. If playing on a 1.21.1 or earlier server, enable this option.",
2222

2323
"option.clientsort.sorting": "Сортування",
2424
"option.clientsort.sortOrder": "Режим сортування",

common/src/main/resources/assets/clientsort/lang/zh_cn.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"option.clientsort.optimizedCreativeSorting.tooltip": "Whether to improve performance of creative-order sorting by storing the order in memory",
1818
"option.clientsort.hotbarScope": "快捷栏模式",
1919
"option.clientsort.extraSlotScope": "Extra Slot Scope",
20-
"option.clientsort.lmbBundle": "Bundles use Right Click",
21-
"option.clientsort.lmbBundle.tooltip": "In 1.21.2+, bundles use right-click to load and unload, which breaks sorting. If playing on a 1.21.2+ server, enable this option.",
20+
"option.clientsort.rmbBundle": "Bundles use Right Click",
21+
"option.clientsort.rmbBundle.tooltip": "Before 1.21.2, bundles used right-click to load, which breaks sorting. If playing on a 1.21.1 or earlier server, enable this option.",
2222

2323
"option.clientsort.sorting": "整理",
2424
"option.clientsort.sortOrder": "整理模式",

0 commit comments

Comments
 (0)