Skip to content

Commit 83b1027

Browse files
committed
Update to mc1.21.3
1 parent 2eee46b commit 83b1027

File tree

12 files changed

+70
-100
lines changed

12 files changed

+70
-100
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
@@ -87,10 +87,9 @@ public static void afterConfigSaved(Config config) {
8787

8888
public static void updateItemTags(Config.Options options) {
8989
options.typeMatchItemCache.clear();
90-
BuiltInRegistries.ITEM.getTags().forEach((pair) -> {
91-
if (options.typeMatchTags.contains(pair.getFirst().location().getPath())) {
92-
pair.getSecond().forEach((itemHolder) ->
93-
options.typeMatchItemCache.add(itemHolder.value()));
90+
BuiltInRegistries.ITEM.getTags().forEach((named) -> {
91+
if (options.typeMatchTags.contains(named.key().location().getPath())) {
92+
named.forEach((itemHolder) -> options.typeMatchItemCache.add(itemHolder.value()));
9493
}
9594
});
9695
}

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

99-
100-
public static final boolean bundlesUseLeftClickDefault = false;
101-
public boolean bundlesUseLeftClick = bundlesUseLeftClickDefault;
99+
public static final boolean bundlesUseRightClickDefault = false;
100+
public boolean bundlesUseRightClick = bundlesUseRightClickDefault;
102101

103102
public static final boolean alwaysMatchByTypeDefault = false;
104103
public boolean alwaysMatchByType = alwaysMatchByTypeDefault;

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
@@ -135,13 +135,13 @@ else if (val > Config.Options.INTERACTION_INTERVAL_MAX)
135135
.build());
136136

137137
general.addEntry(eb.startBooleanToggle(
138-
localized("option", "bundlesUseLeftClick"),
139-
options.bundlesUseLeftClick
138+
localized("option", "bundlesUseRightClick"),
139+
options.bundlesUseRightClick
140140
)
141-
.setTooltip(localized("option", "bundlesUseLeftClick.tooltip"))
142-
.setDefaultValue(Config.Options.bundlesUseLeftClickDefault)
141+
.setTooltip(localized("option", "bundlesUseRightClick.tooltip"))
142+
.setDefaultValue(Config.Options.bundlesUseRightClickDefault)
143143
.setSaveConsumer(val -> {
144-
options.bundlesUseLeftClick = val;
144+
options.bundlesUseRightClick = val;
145145
if (val)
146146
CreativeSearchOrder.tryRefreshStackPositionMap();
147147
})

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
@@ -441,10 +441,10 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
441441
* higher render layer, while still keeping the underlay detail discernible.
442442
*/
443443
@Override
444-
protected void renderBlurredBackground(float partialTick) {
444+
protected void renderBlurredBackground() {
445445
int original = Minecraft.getInstance().options.menuBackgroundBlurriness().get();
446446
Minecraft.getInstance().options.menuBackgroundBlurriness().set(1);
447-
super.renderBlurredBackground(partialTick);
447+
super.renderBlurredBackground();
448448
Minecraft.getInstance().options.menuBackgroundBlurriness().set(original);
449449
}
450450

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;
@@ -169,7 +170,7 @@ public void renderWidget(
169170

170171
// Draw texture
171172
ResourceLocation texture = sprites.get(isActive(), isHoveredOrFocused());
172-
graphics.blitSprite(texture, getX(), getY(), 0, width, height);
173+
graphics.blitSprite(RenderType::guiTextured, texture, getX(), getY(), width, height);
173174

174175
// Draw policy state indicator
175176
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: 25 additions & 54 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;
@@ -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;
@@ -59,10 +59,10 @@ private void afterLogin(ClientboundLoginPacket packet, CallbackInfo ci) {
5959
}
6060

6161
@Inject(
62-
method = "handleSetCarriedItem",
62+
method = "handleSetCursorItem",
6363
at = @At("HEAD")
6464
)
65-
public void beforeHeldItemChange(ClientboundSetCarriedItemPacket packet, CallbackInfo ci) {
65+
public void beforeHeldItemChange(ClientboundSetCursorItemPacket packet, CallbackInfo ci) {
6666
InteractionManager.triggerSend(InteractionManager.TriggerType.HELD_ITEM_CHANGE);
6767
}
6868

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

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

0 commit comments

Comments
 (0)