Skip to content

Commit 4e887d2

Browse files
committed
Update to mc1.21.3
1 parent d4c1a33 commit 4e887d2

File tree

12 files changed

+58
-90
lines changed

12 files changed

+58
-90
lines changed

common/src/main/java/dev/terminalmc/clientsort/client/ClientSort.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,9 @@ public static void afterConfigSaved(Config config) {
9696

9797
public static void updateItemTags(Config.Options options) {
9898
options.typeMatchItemCache.clear();
99-
BuiltInRegistries.ITEM.getTags().forEach((pair) -> {
100-
if (options.typeMatchTags.contains(pair.getFirst().location().getPath())) {
101-
pair.getSecond().forEach((itemHolder) ->
102-
options.typeMatchItemCache.add(itemHolder.value()));
99+
BuiltInRegistries.ITEM.getTags().forEach((named) -> {
100+
if (options.typeMatchTags.contains(named.key().location().getPath())) {
101+
named.forEach((itemHolder) -> options.typeMatchItemCache.add(itemHolder.value()));
103102
}
104103
});
105104
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@ public enum ExtraSlotScope {
109109
val != null && Arrays.stream(ExtraSlotScope.values()).toList().contains(val)
110110
? val : extraSlotScopeDefault;
111111

112-
113-
public static final boolean bundlesUseLeftClickDefault = false;
114-
public boolean bundlesUseLeftClick = bundlesUseLeftClickDefault;
112+
public static final boolean bundlesUseRightClickDefault = false;
113+
public boolean bundlesUseRightClick = bundlesUseRightClickDefault;
115114

116115
// Matching options
117116

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ else if (val > Config.Options.AUTO_OP_DELAY_MAX)
178178
.build());
179179

180180
general.addEntry(eb.startBooleanToggle(
181-
localized("option", "bundlesUseLeftClick"),
182-
options.bundlesUseLeftClick
181+
localized("option", "bundlesUseRightClick"),
182+
options.bundlesUseRightClick
183183
)
184-
.setTooltip(localized("option", "bundlesUseLeftClick.tooltip"))
185-
.setDefaultValue(Config.Options.bundlesUseLeftClickDefault)
184+
.setTooltip(localized("option", "bundlesUseRightClick.tooltip"))
185+
.setDefaultValue(Config.Options.bundlesUseRightClickDefault)
186186
.setSaveConsumer(val -> {
187-
options.bundlesUseLeftClick = val;
187+
options.bundlesUseRightClick = val;
188188
if (val)
189189
CreativeSearchOrder.tryRefreshStackPositionMap();
190190
})

common/src/main/java/dev/terminalmc/clientsort/client/gui/screen/edit/EditorScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,10 +520,10 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
520520
* higher render layer, while still keeping the underlay detail discernible.
521521
*/
522522
@Override
523-
protected void renderBlurredBackground(float partialTick) {
523+
protected void renderBlurredBackground() {
524524
int original = Minecraft.getInstance().options.menuBackgroundBlurriness().get();
525525
Minecraft.getInstance().options.menuBackgroundBlurriness().set(1);
526-
super.renderBlurredBackground(partialTick);
526+
super.renderBlurredBackground();
527527
Minecraft.getInstance().options.menuBackgroundBlurriness().set(original);
528528
}
529529

common/src/main/java/dev/terminalmc/clientsort/client/gui/screen/edit/SelectorScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
110110
}
111111

112112
@Override
113-
protected void renderBlurredBackground(float partialTick) {
113+
protected void renderBlurredBackground() {
114114
// Heavy blur, we want the widgets to really stand out
115115
int original = Minecraft.getInstance().options.menuBackgroundBlurriness().get();
116116
Minecraft.getInstance().options.menuBackgroundBlurriness().set(6);
117-
super.renderBlurredBackground(partialTick);
117+
super.renderBlurredBackground();
118118
Minecraft.getInstance().options.menuBackgroundBlurriness().set(original);
119119
}
120120

common/src/main/java/dev/terminalmc/clientsort/client/gui/widget/TriggerButton.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import net.minecraft.client.gui.navigation.FocusNavigationEvent;
3636
import net.minecraft.client.gui.screens.Screen;
3737
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
38+
import net.minecraft.client.renderer.RenderType;
3839
import net.minecraft.network.chat.CommonComponents;
3940
import net.minecraft.network.chat.Component;
4041
import net.minecraft.resources.ResourceLocation;
@@ -173,7 +174,7 @@ public void renderWidget(
173174

174175
// Draw texture
175176
ResourceLocation texture = sprites.get(isActive(), isHoveredOrFocused());
176-
graphics.blitSprite(texture, getX(), getY(), 0, width, height);
177+
graphics.blitSprite(RenderType::guiTextured, texture, getX(), getY(), width, height);
177178

178179
// Draw policy state indicator
179180
if (!operationAllowed) {

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

Lines changed: 13 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import dev.terminalmc.clientsort.util.inject.ISlot;
2222
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
2323
import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen;
24-
import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen;
2524
import net.minecraft.world.Container;
2625
import net.minecraft.world.entity.player.Inventory;
2726
import net.minecraft.world.inventory.Slot;
@@ -78,29 +77,26 @@ public static boolean isExtraSlot(Slot slot) {
7877
* @return the scope of the slot, or {@link Scope#INVALID} if the slot is not accessible.
7978
*/
8079
public Scope getScope(Slot slot) {
81-
//noinspection ConstantValue
82-
if (slot.container == null)
83-
return Scope.INVALID;
84-
if (slot.container instanceof ContainerSingleItem)
85-
return Scope.INVALID;
8680
if (slot.isFake())
8781
return Scope.INVALID;
82+
return switch (slot.container) {
83+
//noinspection DataFlowIssue
84+
case null -> Scope.INVALID;
85+
case ContainerSingleItem ignored -> Scope.INVALID;
8886

89-
// Screen with only player inventory
90-
if (screen instanceof EffectRenderingInventoryScreen) {
9187
// Player inventory
92-
if (slot.container instanceof Inventory) {
88+
case Inventory ignored -> {
9389
boolean mergeWithHotbar = false;
9490

9591
// Extra inventory slots e.g. offhand
9692
if (isExtraSlot(slot)) {
9793
switch (options().extraSlotScope) {
9894
case HOTBAR -> mergeWithHotbar = true;
9995
case EXTRA -> {
100-
return Scope.PLAYER_INV_EXTRA;
96+
yield Scope.PLAYER_INV_EXTRA;
10197
}
10298
case NONE -> {
103-
return Scope.INVALID;
99+
yield Scope.INVALID;
104100
}
105101
}
106102
}
@@ -109,47 +105,20 @@ public Scope getScope(Slot slot) {
109105
if (mergeWithHotbar || isHotbarSlot(slot)) {
110106
switch (options().hotbarScope) {
111107
case HOTBAR -> {
112-
return Scope.PLAYER_INV_HOTBAR;
108+
yield Scope.PLAYER_INV_HOTBAR;
113109
}
114110
case NONE -> {
115-
return Scope.INVALID;
111+
yield Scope.INVALID;
116112
}
117113
}
118114
}
119115

120-
return Scope.PLAYER_INV;
116+
yield Scope.PLAYER_INV;
121117
}
122118

123-
// Out of inventory e.g. 2x2 crafting grid
124-
else {
125-
return Scope.PLAYER_OTHER;
126-
}
127-
}
128-
129-
// Screen with container, and probably player inventory attached
130-
else {
131-
// Player inventory
132-
if (slot.container instanceof Inventory) {
133-
// Hotbar
134-
if (isHotbarSlot(slot)) {
135-
switch (options().hotbarScope) {
136-
case HOTBAR -> {
137-
return Scope.PLAYER_INV_HOTBAR;
138-
}
139-
case NONE -> {
140-
return Scope.INVALID;
141-
}
142-
}
143-
}
144-
145-
return Scope.PLAYER_INV;
146-
}
147-
148-
// Container
149-
else {
150-
return Scope.CONTAINER_INV;
151-
}
152-
}
119+
// Not player inventory
120+
default -> Scope.CONTAINER_INV;
121+
};
153122
}
154123

155124
/**

common/src/main/java/dev/terminalmc/clientsort/client/inventory/operator/client/ClientSurvivalOperator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@
2525
import dev.terminalmc.clientsort.mixin.client.accessor.AbstractContainerScreenAccessor;
2626
import dev.terminalmc.clientsort.util.inject.ISlot;
2727
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
28+
import net.minecraft.tags.ItemTags;
2829
import net.minecraft.world.inventory.ClickType;
2930
import net.minecraft.world.inventory.Slot;
3031
import net.minecraft.world.item.ItemStack;
31-
import net.minecraft.world.item.Items;
3232

3333
import java.util.ArrayDeque;
3434
import java.util.BitSet;
@@ -284,11 +284,11 @@ protected void sort(int[] sortedIds, boolean playSound) {
284284

285285
// Modify standard click if required for bundles
286286
int mouseButton = 0;
287-
boolean clickOnBundleWithItem = originScopeStacks[dstId].is(Items.BUNDLE)
287+
boolean clickOnBundleWithItem = originScopeStacks[dstId].is(ItemTags.BUNDLES)
288288
&& !(carriedStack.isEmpty());
289-
boolean clickOnItemWithBundle = carriedStack.is(Items.BUNDLE)
289+
boolean clickOnItemWithBundle = carriedStack.is(ItemTags.BUNDLES)
290290
&& !(originScopeStacks[dstId].isEmpty());
291-
if (options().bundlesUseLeftClick
291+
if (!options().bundlesUseRightClick
292292
&& (clickOnBundleWithItem || clickOnItemWithBundle)) {
293293
mouseButton = 1;
294294
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
"option.clientsort.autoOpDelayContainer.tooltip": "The delay, in ticks, after which to perform automatic operations on a container when it is opened.",
8181
"option.clientsort.hotbarScope": "Hotbar Scope",
8282
"option.clientsort.extraSlotScope": "Extra Slot Scope",
83-
"option.clientsort.bundlesUseLeftClick": "Bundles use Left Click",
84-
"option.clientsort.bundlesUseLeftClick.tooltip": "In 1.21.2+, bundles use left-click to load, which can interfere with inventory actions. If playing on a 1.21.2+ server, enable this option.",
83+
"option.clientsort.bundlesUseRightClick": "Bundles use Right Click",
84+
"option.clientsort.bundlesUseRightClick.tooltip": "In 1.21.1 and earlier versions, bundles use right-click to load, which can interfere with inventory actions. If playing on a 1.21.1 or earlier server, enable this option.",
8585
"option.clientsort.showDebugInfo": "Show Debug Info",
8686
"option.clientsort.showDebugInfo.tooltip": "Whether to show debug info on the GUI and enable debug logging. Value will reset when you restart the game.",
8787

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@
8080
"option.clientsort.autoOpDelayContainer.tooltip": "Задержка в тиках перед выполнением автоматических операций с контейнером после его открытия.",
8181
"option.clientsort.hotbarScope": "Область панели быстрого доступа",
8282
"option.clientsort.extraSlotScope": "Область дополнительных слотов",
83-
"option.clientsort.bundlesUseLeftClick": "Пакеты используют ЛКМ",
84-
"option.clientsort.bundlesUseLeftClick.tooltip": "С версии 1.21.2+ для загрузки пакетов используется ЛКМ, что может мешать сортировке. Если вы играете на сервере 1.21.2+, включите эту опцию.",
83+
"option.clientsort.bundlesUseRightClick": "Пакеты используют ПКМ",
84+
"option.clientsort.bundlesUseRightClick.tooltip": "До версии 1.21.2 для загрузки пакетов использовалась ПКМ, что нарушало сортировку. Если вы играете на сервере 1.21.1 или более ранней версии, включите эту опцию.",
8585
"option.clientsort.showDebugInfo": "Показать отладочную информацию",
8686
"option.clientsort.showDebugInfo.tooltip": "Показывать отладочную информацию в интерфейсе и включать логирование. Значение сбрасывается при перезапуске игры.",
8787

0 commit comments

Comments
 (0)