Skip to content

Commit 8d8a3fe

Browse files
committed
Update to mc1.21.3
1 parent 47c143b commit 8d8a3fe

File tree

11 files changed

+56
-88
lines changed

11 files changed

+56
-88
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
@@ -98,10 +98,9 @@ public static void afterConfigSaved(Config config) {
9898

9999
public static void updateItemTags(Config.Options options) {
100100
options.typeMatchItemCache.clear();
101-
BuiltInRegistries.ITEM.getTags().forEach((pair) -> {
102-
if (options.typeMatchTags.contains(pair.getFirst().location().getPath())) {
103-
pair.getSecond().forEach((itemHolder) ->
104-
options.typeMatchItemCache.add(itemHolder.value()));
101+
BuiltInRegistries.ITEM.getTags().forEach((named) -> {
102+
if (options.typeMatchTags.contains(named.key().location().getPath())) {
103+
named.forEach((itemHolder) -> options.typeMatchItemCache.add(itemHolder.value()));
105104
}
106105
});
107106
}

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
@@ -99,9 +99,8 @@ public enum ExtraSlotScope {
9999
val != null && Arrays.stream(ExtraSlotScope.values()).toList().contains(val)
100100
? val : extraSlotScopeDefault;
101101

102-
103-
public static final boolean bundlesUseLeftClickDefault = false;
104-
public boolean bundlesUseLeftClick = bundlesUseLeftClickDefault;
102+
public static final boolean bundlesUseRightClickDefault = false;
103+
public boolean bundlesUseRightClick = bundlesUseRightClickDefault;
105104

106105
// Matching options
107106

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
@@ -144,13 +144,13 @@ else if (val > Config.Options.INTERACTION_INTERVAL_MAX)
144144
.build());
145145

146146
general.addEntry(eb.startBooleanToggle(
147-
localized("option", "bundlesUseLeftClick"),
148-
options.bundlesUseLeftClick
147+
localized("option", "bundlesUseRightClick"),
148+
options.bundlesUseRightClick
149149
)
150-
.setTooltip(localized("option", "bundlesUseLeftClick.tooltip"))
151-
.setDefaultValue(Config.Options.bundlesUseLeftClickDefault)
150+
.setTooltip(localized("option", "bundlesUseRightClick.tooltip"))
151+
.setDefaultValue(Config.Options.bundlesUseRightClickDefault)
152152
.setSaveConsumer(val -> {
153-
options.bundlesUseLeftClick = val;
153+
options.bundlesUseRightClick = val;
154154
if (val)
155155
CreativeSearchOrder.tryRefreshStackPositionMap();
156156
})

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
@@ -448,10 +448,10 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
448448
* higher render layer, while still keeping the underlay detail discernible.
449449
*/
450450
@Override
451-
protected void renderBlurredBackground(float partialTick) {
451+
protected void renderBlurredBackground() {
452452
int original = Minecraft.getInstance().options.menuBackgroundBlurriness().get();
453453
Minecraft.getInstance().options.menuBackgroundBlurriness().set(1);
454-
super.renderBlurredBackground(partialTick);
454+
super.renderBlurredBackground();
455455
Minecraft.getInstance().options.menuBackgroundBlurriness().set(original);
456456
}
457457

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
@@ -108,11 +108,11 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
108108
}
109109

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

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
@@ -34,6 +34,7 @@
3434
import net.minecraft.client.gui.navigation.FocusNavigationEvent;
3535
import net.minecraft.client.gui.screens.Screen;
3636
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
37+
import net.minecraft.client.renderer.RenderType;
3738
import net.minecraft.network.chat.CommonComponents;
3839
import net.minecraft.network.chat.Component;
3940
import net.minecraft.resources.ResourceLocation;
@@ -172,7 +173,7 @@ public void renderWidget(
172173

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

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

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
@@ -23,10 +23,10 @@
2323
import dev.terminalmc.clientsort.client.network.InteractionManager;
2424
import dev.terminalmc.clientsort.client.util.SoundManager;
2525
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
26+
import net.minecraft.tags.ItemTags;
2627
import net.minecraft.world.inventory.ClickType;
2728
import net.minecraft.world.inventory.Slot;
2829
import net.minecraft.world.item.ItemStack;
29-
import net.minecraft.world.item.Items;
3030

3131
import java.util.ArrayDeque;
3232
import java.util.BitSet;
@@ -290,11 +290,11 @@ protected void sort(int[] sortedIds, boolean playSound) {
290290

291291
// Modify standard click if required for bundles
292292
int mouseButton = 0;
293-
boolean clickOnBundleWithItem = originScopeStacks[dstId].is(Items.BUNDLE)
293+
boolean clickOnBundleWithItem = originScopeStacks[dstId].is(ItemTags.BUNDLES)
294294
&& !(carriedStack.isEmpty());
295-
boolean clickOnItemWithBundle = carriedStack.is(Items.BUNDLE)
295+
boolean clickOnItemWithBundle = carriedStack.is(ItemTags.BUNDLES)
296296
&& !(originScopeStacks[dstId].isEmpty());
297-
if (options().bundlesUseLeftClick
297+
if (!options().bundlesUseRightClick
298298
&& (clickOnBundleWithItem || clickOnItemWithBundle)) {
299299
mouseButton = 1;
300300
}

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

Lines changed: 14 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import dev.terminalmc.clientsort.util.inject.ISlot;
2525
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
2626
import net.minecraft.client.gui.screens.inventory.CreativeModeInventoryScreen;
27-
import net.minecraft.client.gui.screens.inventory.EffectRenderingInventoryScreen;
2827
import net.minecraft.world.entity.player.Inventory;
2928
import net.minecraft.world.inventory.ClickType;
3029
import net.minecraft.world.inventory.Slot;
@@ -123,27 +122,24 @@ public boolean isExtraSlot(Slot slot) {
123122
* @return the scope of the slot, or {@link Scope#INVALID} if the slot is not accessible.
124123
*/
125124
public Scope getScope(Slot slot) {
126-
//noinspection ConstantValue
127-
if (slot.container == null)
128-
return Scope.INVALID;
129-
if (slot.container instanceof ContainerSingleItem)
130-
return Scope.INVALID;
131-
132-
// Screen with only player inventory
133-
if (screen instanceof EffectRenderingInventoryScreen) {
125+
return switch (slot.container) {
126+
//noinspection DataFlowIssue
127+
case null -> Scope.INVALID;
128+
case ContainerSingleItem ignored -> Scope.INVALID;
129+
134130
// Player inventory
135-
if (slot.container instanceof Inventory) {
131+
case Inventory ignored -> {
136132
boolean mergeWithHotbar = false;
137133

138134
// Extra inventory slots e.g. offhand
139135
if (isExtraSlot(slot)) {
140136
switch (options().extraSlotScope) {
141137
case HOTBAR -> mergeWithHotbar = true;
142138
case EXTRA -> {
143-
return Scope.PLAYER_INV_EXTRA;
139+
yield Scope.PLAYER_INV_EXTRA;
144140
}
145141
case NONE -> {
146-
return Scope.INVALID;
142+
yield Scope.INVALID;
147143
}
148144
}
149145
}
@@ -152,47 +148,20 @@ public Scope getScope(Slot slot) {
152148
if (mergeWithHotbar || isHotbarSlot(slot)) {
153149
switch (options().hotbarScope) {
154150
case HOTBAR -> {
155-
return Scope.PLAYER_INV_HOTBAR;
156-
}
157-
case NONE -> {
158-
return Scope.INVALID;
159-
}
160-
}
161-
}
162-
163-
return Scope.PLAYER_INV;
164-
}
165-
166-
// Out of inventory e.g. 2x2 crafting grid
167-
else {
168-
return Scope.PLAYER_OTHER;
169-
}
170-
}
171-
172-
// Screen with container, and probably player inventory attached
173-
else {
174-
// Player inventory
175-
if (slot.container instanceof Inventory) {
176-
// Hotbar
177-
if (isHotbarSlot(slot)) {
178-
switch (options().hotbarScope) {
179-
case HOTBAR -> {
180-
return Scope.PLAYER_INV_HOTBAR;
151+
yield Scope.PLAYER_INV_HOTBAR;
181152
}
182153
case NONE -> {
183-
return Scope.INVALID;
154+
yield Scope.INVALID;
184155
}
185156
}
186157
}
187158

188-
return Scope.PLAYER_INV;
159+
yield Scope.PLAYER_INV;
189160
}
190161

191-
// Container
192-
else {
193-
return Scope.CONTAINER_INV;
194-
}
195-
}
162+
// Not player inventory
163+
default -> Scope.CONTAINER_INV;
164+
};
196165
}
197166

198167
/**

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
"option.clientsort.optimizeCreativeSorting.tooltip": "Whether to improve performance of creative-order sorting by storing the order in memory.",
6666
"option.clientsort.hotbarScope": "Hotbar Scope",
6767
"option.clientsort.extraSlotScope": "Extra Slot Scope",
68-
"option.clientsort.bundlesUseLeftClick": "Bundles use Left Click",
69-
"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.",
68+
"option.clientsort.bundlesUseRightClick": "Bundles use Right Click",
69+
"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.",
7070
"option.clientsort.showDebugInfo": "Show Debug Info",
7171
"option.clientsort.showDebugInfo.tooltip": "Whether to show debug info on the GUI and enable debug logging. Value will reset when you restart the game.",
7272

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
"option.clientsort.optimizeCreativeSorting.tooltip": "Повышать производительность сортировки в творческом режиме за счёт сохранения порядка в памяти",
6666
"option.clientsort.hotbarScope": "Область панели быстрого доступа",
6767
"option.clientsort.extraSlotScope": "Область дополнительных слотов",
68-
"option.clientsort.bundlesUseLeftClick": "Пакеты используют ЛКМ",
69-
"option.clientsort.bundlesUseLeftClick.tooltip": "С версии 1.21.2+ для загрузки пакетов используется ЛКМ, что может мешать сортировке. Если вы играете на сервере 1.21.2+, включите эту опцию.",
68+
"option.clientsort.bundlesUseRightClick": "Пакеты используют ПКМ",
69+
"option.clientsort.bundlesUseRightClick.tooltip": "До версии 1.21.2 для загрузки пакетов использовалась ПКМ, что нарушало сортировку. Если вы играете на сервере 1.21.1 или более ранней версии, включите эту опцию.",
7070
"option.clientsort.showDebugInfo": "Показать отладочную информацию",
7171
"option.clientsort.showDebugInfo.tooltip": "Показывать отладочную информацию в интерфейсе и включать логирование. Значение сбрасывается при перезапуске игры.",
7272

0 commit comments

Comments
 (0)