Skip to content

Commit 9bcfbd1

Browse files
committed
Update to mc1.21.3
1 parent 5916fc4 commit 9bcfbd1

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
@@ -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
@@ -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;
@@ -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: 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
@@ -63,8 +63,8 @@
6363
"option.clientsort.optimizeCreativeSorting.tooltip": "Whether to improve performance of creative-order sorting by storing the order in memory.",
6464
"option.clientsort.hotbarScope": "Hotbar Scope",
6565
"option.clientsort.extraSlotScope": "Extra Slot Scope",
66-
"option.clientsort.bundlesUseLeftClick": "Bundles use Left Click",
67-
"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.",
66+
"option.clientsort.bundlesUseRightClick": "Bundles use Right Click",
67+
"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.",
6868
"option.clientsort.showDebugInfo": "Show Debug Info",
6969
"option.clientsort.showDebugInfo.tooltip": "Whether to show debug info on the GUI and enable debug logging. Value will reset when you restart the game.",
7070

0 commit comments

Comments
 (0)