Skip to content

Commit 93b1e7e

Browse files
committed
Update to mc1.21.3
1 parent c48e9b3 commit 93b1e7e

File tree

14 files changed

+74
-102
lines changed

14 files changed

+74
-102
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ public enum ExtraSlotScope {
8787
NONE
8888
}
8989

90-
public static final boolean bundlesUseLeftClickDefault = false;
91-
public boolean bundlesUseLeftClick = bundlesUseLeftClickDefault;
90+
public static final boolean bundlesUseRightClickDefault = false;
91+
public boolean bundlesUseRightClick = bundlesUseRightClickDefault;
9292

9393
// Sort order options
9494

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
@@ -121,13 +121,13 @@ else if (val > Config.Options.INTERACTION_INTERVAL_MAX)
121121
.build());
122122

123123
general.addEntry(eb.startBooleanToggle(
124-
localized("option", "bundlesUseLeftClick"),
125-
options.bundlesUseLeftClick
124+
localized("option", "bundlesUseRightClick"),
125+
options.bundlesUseRightClick
126126
)
127-
.setTooltip(localized("option", "bundlesUseLeftClick.tooltip"))
128-
.setDefaultValue(Config.Options.bundlesUseLeftClickDefault)
127+
.setTooltip(localized("option", "bundlesUseRightClick.tooltip"))
128+
.setDefaultValue(Config.Options.bundlesUseRightClickDefault)
129129
.setSaveConsumer(val -> {
130-
options.bundlesUseLeftClick = val;
130+
options.bundlesUseRightClick = val;
131131
if (val)
132132
CreativeSearchOrder.tryRefreshStackPositionMap();
133133
})

common/src/main/java/dev/terminalmc/clientsort/client/gui/screen/edit/GroupSelectorScreen.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/screen/edit/PositionEditScreen.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,10 +380,10 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
380380
* higher render layer, while still keeping the underlay detail discernible.
381381
*/
382382
@Override
383-
protected void renderBlurredBackground(float partialTick) {
383+
protected void renderBlurredBackground() {
384384
int original = Minecraft.getInstance().options.menuBackgroundBlurriness().get();
385385
Minecraft.getInstance().options.menuBackgroundBlurriness().set(1);
386-
super.renderBlurredBackground(partialTick);
386+
super.renderBlurredBackground();
387387
Minecraft.getInstance().options.menuBackgroundBlurriness().set(original);
388388
}
389389

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import net.minecraft.client.gui.components.WidgetSprites;
3232
import net.minecraft.client.gui.navigation.FocusNavigationEvent;
3333
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
34+
import net.minecraft.client.renderer.RenderType;
3435
import net.minecraft.network.chat.CommonComponents;
3536
import net.minecraft.resources.ResourceLocation;
3637
import net.minecraft.world.Container;
@@ -149,7 +150,7 @@ public void renderWidget(
149150
setY(newY);
150151

151152
ResourceLocation texture = sprites.get(isActive(), isHoveredOrFocused());
152-
graphics.blitSprite(texture, getX(), getY(), 0, width, height);
153+
graphics.blitSprite(RenderType::guiTextured, texture, getX(), getY(), width, height);
153154
}
154155

155156
@Override

common/src/main/java/dev/terminalmc/clientsort/client/inventory/control/client/ClientSurvivalController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ protected void sort(int[] sortedIds, boolean playSound) {
272272
&& !(carriedStack.isEmpty());
273273
boolean clickOnItemWithBundle = carriedStack.is(Items.BUNDLE)
274274
&& !(originScopeStacks[dstId].isEmpty());
275-
if (options().bundlesUseLeftClick
275+
if (options().bundlesUseRightClick
276276
&& (clickOnBundleWithItem || clickOnItemWithBundle)) {
277277
mouseButton = 1;
278278
}

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

Lines changed: 25 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import dev.terminalmc.clientsort.mixin.client.accessor.AbstractContainerScreenAccessor;
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;
@@ -122,69 +121,41 @@ public boolean isExtraSlot(Slot slot) {
122121
* @return the scope of the slot, or {@link Scope#INVALID} if the slot is not accessible.
123122
*/
124123
public Scope getScope(Slot slot) {
125-
// Screen with only player inventory
126-
if (screen instanceof EffectRenderingInventoryScreen) {
127-
// Player inventory
128-
if (slot.container instanceof Inventory) {
129-
boolean mergeWithHotbar = false;
130-
131-
// Extra inventory slots e.g. offhand
132-
if (isExtraSlot(slot)) {
133-
switch (options().extraSlotScope) {
134-
case HOTBAR -> mergeWithHotbar = true;
135-
case EXTRA -> {
136-
return Scope.PLAYER_INV_EXTRA;
137-
}
138-
case NONE -> {
139-
return Scope.INVALID;
140-
}
124+
// Player inventory
125+
if (slot.container instanceof Inventory) {
126+
boolean mergeWithHotbar = false;
127+
128+
// Extra inventory slots e.g. offhand
129+
if (isExtraSlot(slot)) {
130+
switch (options().extraSlotScope) {
131+
case HOTBAR -> mergeWithHotbar = true;
132+
case EXTRA -> {
133+
return Scope.PLAYER_INV_EXTRA;
134+
}
135+
case NONE -> {
136+
return Scope.INVALID;
141137
}
142138
}
139+
}
143140

144-
// Hotbar
145-
if (mergeWithHotbar || isHotbarSlot(slot)) {
146-
switch (options().hotbarScope) {
147-
case HOTBAR -> {
148-
return Scope.PLAYER_INV_HOTBAR;
149-
}
150-
case NONE -> {
151-
return Scope.INVALID;
152-
}
141+
// Hotbar
142+
if (mergeWithHotbar || isHotbarSlot(slot)) {
143+
switch (options().hotbarScope) {
144+
case HOTBAR -> {
145+
return Scope.PLAYER_INV_HOTBAR;
146+
}
147+
case NONE -> {
148+
return Scope.INVALID;
153149
}
154150
}
155-
156-
return Scope.PLAYER_INV;
157151
}
158152

159-
// Out of inventory e.g. 2x2 crafting grid
160-
else {
161-
return Scope.PLAYER_OTHER;
162-
}
153+
return Scope.PLAYER_INV;
163154
}
164155

165-
// Screen with container, and probably player inventory attached
156+
// Not player inventory
166157
else {
167-
// Player inventory
168-
if (slot.container instanceof Inventory) {
169-
// Hotbar
170-
if (isHotbarSlot(slot)) {
171-
switch (options().hotbarScope) {
172-
case HOTBAR -> {
173-
return Scope.PLAYER_INV_HOTBAR;
174-
}
175-
case NONE -> {
176-
return Scope.INVALID;
177-
}
178-
}
179-
}
180-
181-
return Scope.PLAYER_INV;
182-
}
183-
184-
// Container
185-
else {
186-
return Scope.CONTAINER_INV;
187-
}
158+
return Scope.CONTAINER_INV;
188159
}
189160
}
190161

common/src/main/java/dev/terminalmc/clientsort/mixin/client/ClientPacketListenerMixin.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;
@@ -43,10 +43,10 @@ private void beforeLogin(ClientboundLoginPacket packet, CallbackInfo ci) {
4343
}
4444

4545
@Inject(
46-
method = "handleSetCarriedItem",
46+
method = "handleSetCursorItem",
4747
at = @At("HEAD")
4848
)
49-
public void beforeHeldItemChange(ClientboundSetCarriedItemPacket packet, CallbackInfo ci) {
49+
public void beforeHeldItemChange(ClientboundSetCursorItemPacket packet, CallbackInfo ci) {
5050
InteractionManager.triggerSend(InteractionManager.TriggerType.HELD_ITEM_CHANGE);
5151
}
5252

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"option.clientsort.optimizeCreativeSorting.tooltip": "Whether to improve performance of creative-order sorting by storing the order in memory.",
5555
"option.clientsort.hotbarScope": "Hotbar Scope",
5656
"option.clientsort.extraSlotScope": "Extra Slot Scope",
57-
"option.clientsort.bundlesUseLeftClick": "Bundles use Left Click",
58-
"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.",
57+
"option.clientsort.bundlesUseRightClick": "Bundles use Right Click",
58+
"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.",
5959
"option.clientsort.showDebugInfo": "Show Debug Info",
6060
"option.clientsort.showDebugInfo.tooltip": "Whether to show debug info on the GUI and enable debug logging. Value will reset when you restart the game.",
6161

@@ -129,4 +129,4 @@
129129
"error.clientsort.buttonLayout.pattern": "Data does not match required pattern: %s",
130130
"error.clientsort.buttonLayout.classNotFound": "Could not find a class matching name: %s",
131131
"error.clientsort.buttonLayout.parseOffset": "Could not parse an offset from data: (%s,%s)"
132-
}
132+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
"option.clientsort.optimizeCreativeSorting.tooltip": "Повышать производительность сортировки в творческом режиме за счёт сохранения порядка в памяти",
5555
"option.clientsort.hotbarScope": "Область панели быстрого доступа",
5656
"option.clientsort.extraSlotScope": "Область дополнительных слотов",
57-
"option.clientsort.bundlesUseLeftClick": "Пакеты используют ЛКМ",
58-
"option.clientsort.bundlesUseLeftClick.tooltip": "С версии 1.21.2+ для загрузки пакетов используется ЛКМ, что может мешать сортировке. Если вы играете на сервере 1.21.2+, включите эту опцию.",
57+
"option.clientsort.bundlesUseRightClick": "Пакеты используют ПКМ",
58+
"option.clientsort.bundlesUseRightClick.tooltip": "До версии 1.21.2 для загрузки пакетов использовалась ПКМ, что нарушало сортировку. Если вы играете на сервере 1.21.1 или более ранней версии, включите эту опцию.",
5959
"option.clientsort.showDebugInfo": "Показать отладочную информацию",
6060
"option.clientsort.showDebugInfo.tooltip": "Показывать отладочную информацию в интерфейсе и включать логирование. Значение сбрасывается при перезапуске игры.",
6161

0 commit comments

Comments
 (0)