Skip to content

Commit c92e5a2

Browse files
committed
Update to mc1.21.8
1 parent a8d0017 commit c92e5a2

File tree

13 files changed

+194
-77
lines changed

13 files changed

+194
-77
lines changed

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Note: this version includes networking changes, servers and clients must be upgr
9292
- Added a workaround for a crash when attempting to operate on containerless modded slots
9393
- Increased warning display time to 5 seconds
9494
- Added automatic update information to server class policy config
95+
- Re-enabled support for ItemLocks on 1.21.6+
9596

9697
## 2.0.0-beta.15
9798

@@ -103,6 +104,7 @@ Note: this beta version includes networking changes, servers and clients must be
103104
## 2.0.0-beta.14
104105

105106
- Added support for configuring specific items to always be sorted to the start or end
107+
- Fixed a launch crash on NeoForge on 1.21.7+
106108

107109
## 2.0.0-beta.13
108110

@@ -113,6 +115,7 @@ Note: this beta version includes networking changes, servers and clients must be
113115
## 2.0.0-beta.12
114116

115117
- Fixed button status not saving when changed via editor screen
118+
- Added compatibility with Blur+ mod on 1.21.6+
116119

117120
## 2.0.0-beta.11
118121

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

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import dev.terminalmc.clientsort.client.config.*;
2323
import dev.terminalmc.clientsort.client.gui.widget.TriggerButton;
2424
import dev.terminalmc.clientsort.mixin.client.accessor.AbstractContainerScreenAccessor;
25+
import dev.terminalmc.clientsort.mixin.client.accessor.GuiGraphicsAccessor;
26+
import dev.terminalmc.clientsort.mixin.client.accessor.GuiRenderStateAccessor;
2527
import dev.terminalmc.clientsort.util.inject.ISlot;
2628
import net.minecraft.ChatFormatting;
2729
import net.minecraft.client.Minecraft;
@@ -60,8 +62,7 @@ public abstract class EditorScreen extends Screen {
6062
public final Set<Integer> ignoredSlots = new TreeSet<>();
6163

6264
/**
63-
* An element of {@link EditorScreen#buttons} which 'represents' the whole set of
64-
* buttons.
65+
* An element of {@link EditorScreen#buttons} which 'represents' the whole set of buttons.
6566
* <p>
6667
* This can be any element, and the specific choice is only relevant when repositioning via
6768
* mouse drag.
@@ -70,8 +71,8 @@ public abstract class EditorScreen extends Screen {
7071

7172
/**
7273
* The class name of either {@link EditorScreen#rep}'s {@link TriggerButton#container}, or
73-
* {@link EditorScreen#underlay}'s {@link AbstractContainerScreen#getMenu} if the former
74-
* is {@code null}.
74+
* {@link EditorScreen#underlay}'s {@link AbstractContainerScreen#getMenu} if the former is
75+
* {@code null}.
7576
* <p>
7677
* This value represents the lowest-level key on which a {@link ClassPolicy} can be created, and
7778
* may differ from {@link EditorScreen#rep}'s {@link TriggerButton#activePolicyKey}.
@@ -446,7 +447,15 @@ lowestPolicyKey, new ClassPolicy(
446447
*/
447448
@Override
448449
public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
450+
underlay.renderBackground(graphics, mouseX, mouseY, partialTick);
449451
underlay.render(graphics, mouseX, mouseY, partialTick);
452+
453+
// Workaround for other mods adding blur when rendering the underlay
454+
((GuiRenderStateAccessor) ((GuiGraphicsAccessor) graphics).clientsort$getGuiRenderState())
455+
.clientsort$setFirstStratumAfterBlur(Integer.MAX_VALUE);
456+
graphics.nextStratum();
457+
renderBlurredBackground(graphics);
458+
450459
super.render(graphics, mouseX, mouseY, partialTick);
451460

452461
// Render disabled-slot indicators
@@ -513,17 +522,34 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
513522
}
514523
}
515524

525+
/**
526+
* Removes the call to {@link Screen#renderBlurredBackground}, since we add a call in
527+
* {@link EditorScreen#render} and the method can only be called once.
528+
*/
529+
@Override
530+
public void renderBackground(
531+
@NotNull GuiGraphics graphics,
532+
int mouseX,
533+
int mouseY,
534+
float partialTick
535+
) {
536+
if (Minecraft.getInstance().level == null) {
537+
renderPanorama(graphics, partialTick);
538+
}
539+
renderMenuBackground(graphics);
540+
}
541+
516542
/**
517543
* Modifies the background blur to be constant irrespective of the configured value.
518544
* <p>
519545
* Minimal blur is used to prevent the editable widgets disappearing under underlay items on a
520546
* higher render layer, while still keeping the underlay detail discernible.
521547
*/
522548
@Override
523-
protected void renderBlurredBackground() {
549+
protected void renderBlurredBackground(@NotNull GuiGraphics graphics) {
524550
int original = Minecraft.getInstance().options.menuBackgroundBlurriness().get();
525551
Minecraft.getInstance().options.menuBackgroundBlurriness().set(1);
526-
super.renderBlurredBackground();
552+
super.renderBlurredBackground(graphics);
527553
Minecraft.getInstance().options.menuBackgroundBlurriness().set(original);
528554
}
529555

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

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import dev.terminalmc.clientsort.client.config.Config;
2020
import dev.terminalmc.clientsort.client.gui.TriggerButtonManager;
2121
import dev.terminalmc.clientsort.client.gui.widget.TriggerButton;
22+
import dev.terminalmc.clientsort.mixin.client.accessor.GuiGraphicsAccessor;
23+
import dev.terminalmc.clientsort.mixin.client.accessor.GuiRenderStateAccessor;
2224
import net.minecraft.ChatFormatting;
2325
import net.minecraft.client.Minecraft;
2426
import net.minecraft.client.gui.GuiGraphics;
@@ -99,7 +101,15 @@ private void rebuildGui() {
99101

100102
@Override
101103
public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
104+
underlay.renderBackground(graphics, mouseX, mouseY, partialTick);
102105
underlay.render(graphics, mouseX, mouseY, partialTick);
106+
107+
// Workaround for other mods adding blur when rendering the underlay
108+
((GuiRenderStateAccessor) ((GuiGraphicsAccessor) graphics).clientsort$getGuiRenderState())
109+
.clientsort$setFirstStratumAfterBlur(Integer.MAX_VALUE);
110+
graphics.nextStratum();
111+
renderBlurredBackground(graphics);
112+
103113
super.render(graphics, mouseX, mouseY, partialTick);
104114

105115
if (options().showButtons) {
@@ -109,12 +119,29 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
109119
}
110120
}
111121

122+
/**
123+
* Removes the call to {@link Screen#renderBlurredBackground}, since we add a call in
124+
* {@link SelectorScreen#render} and the method can only be called once.
125+
*/
126+
@Override
127+
public void renderBackground(
128+
@NotNull GuiGraphics graphics,
129+
int mouseX,
130+
int mouseY,
131+
float partialTick
132+
) {
133+
if (Minecraft.getInstance().level == null) {
134+
renderPanorama(graphics, partialTick);
135+
}
136+
renderMenuBackground(graphics);
137+
}
138+
112139
@Override
113-
protected void renderBlurredBackground() {
140+
protected void renderBlurredBackground(@NotNull GuiGraphics graphics) {
114141
// Heavy blur, we want the widgets to really stand out
115142
int original = Minecraft.getInstance().options.menuBackgroundBlurriness().get();
116143
Minecraft.getInstance().options.menuBackgroundBlurriness().set(6);
117-
super.renderBlurredBackground();
144+
super.renderBlurredBackground(graphics);
118145
Minecraft.getInstance().options.menuBackgroundBlurriness().set(original);
119146
}
120147

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import dev.terminalmc.clientsort.client.gui.screen.edit.EditorScreen;
2626
import dev.terminalmc.clientsort.client.gui.screen.edit.PlayerEditorScreen;
2727
import dev.terminalmc.clientsort.mixin.client.accessor.AbstractContainerScreenAccessor;
28+
import dev.terminalmc.clientsort.mixin.client.accessor.AbstractWidgetAccessor;
2829
import net.minecraft.ChatFormatting;
2930
import net.minecraft.client.Minecraft;
3031
import net.minecraft.client.gui.ComponentPath;
@@ -35,7 +36,7 @@
3536
import net.minecraft.client.gui.navigation.FocusNavigationEvent;
3637
import net.minecraft.client.gui.screens.Screen;
3738
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
38-
import net.minecraft.client.renderer.RenderType;
39+
import net.minecraft.client.renderer.RenderPipelines;
3940
import net.minecraft.network.chat.CommonComponents;
4041
import net.minecraft.network.chat.Component;
4142
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(RenderType::guiTextured, texture, getX(), getY(), width, height);
177+
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, texture, getX(), getY(), width, height);
177178

178179
// Draw policy state indicator
179180
if (!operationAllowed) {
@@ -182,7 +183,8 @@ public void renderWidget(
182183

183184
// Refresh tooltip
184185
if (isMouseOver(mouseX, mouseY)) {
185-
if (Minecraft.getInstance().screen instanceof EditorScreen && getTooltip() == null) {
186+
if (Minecraft.getInstance().screen instanceof EditorScreen
187+
&& ((AbstractWidgetAccessor) this).clientsort$getTooltip().get() == null) {
186188
Component visibilityStatus = localized(
187189
"editor", active ? "enabled" : "disabled")
188190
.withStyle(active

common/src/main/java/dev/terminalmc/clientsort/mixin/client/AbstractContainerScreenMixin.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,9 @@ private void afterRender(
276276
return;
277277

278278
if (ClientSort.overlayMessage != null) {
279-
graphics.pose().pushPose();
280-
graphics.pose().translate(0.0F, 0.0F, 1000F);
279+
graphics.pose().pushMatrix();
281280
ClientSort.overlayMessage.renderWidget(graphics, mouseX, mouseY, partialTick);
282-
graphics.pose().popPose();
281+
graphics.pose().popMatrix();
283282
}
284283

285284
if (!debug())
@@ -289,9 +288,8 @@ private void afterRender(
289288
ContainerScreenHelper.of((AbstractContainerScreen<?>) (Object) this);
290289

291290
float scale = 0.7F;
292-
graphics.pose().pushPose();
293-
graphics.pose().translate(0.0F, 0.0F, 1000F);
294-
graphics.pose().scale(scale, scale, 0.0F);
291+
graphics.pose().pushMatrix();
292+
graphics.pose().scale(scale, scale);
295293

296294
for (Slot slot : menu.slots) {
297295
int slotId = ((ISlot) slot).clientsort$getIndexInMenu();
@@ -346,6 +344,6 @@ private void afterRender(
346344
);
347345
}
348346

349-
graphics.pose().popPose();
347+
graphics.pose().popMatrix();
350348
}
351349
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2025 TerminalMC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package dev.terminalmc.clientsort.mixin.client.accessor;
18+
19+
import net.minecraft.client.gui.components.AbstractWidget;
20+
import net.minecraft.client.gui.components.WidgetTooltipHolder;
21+
import org.spongepowered.asm.mixin.Mixin;
22+
import org.spongepowered.asm.mixin.gen.Accessor;
23+
24+
@Mixin(AbstractWidget.class)
25+
public interface AbstractWidgetAccessor {
26+
27+
@Accessor("tooltip")
28+
WidgetTooltipHolder clientsort$getTooltip();
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2025 TerminalMC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package dev.terminalmc.clientsort.mixin.client.accessor;
18+
19+
import net.minecraft.client.gui.GuiGraphics;
20+
import net.minecraft.client.gui.render.state.GuiRenderState;
21+
import org.spongepowered.asm.mixin.Mixin;
22+
import org.spongepowered.asm.mixin.gen.Accessor;
23+
24+
@Mixin(GuiGraphics.class)
25+
public interface GuiGraphicsAccessor {
26+
27+
@Accessor("guiRenderState")
28+
GuiRenderState clientsort$getGuiRenderState();
29+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright 2025 TerminalMC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package dev.terminalmc.clientsort.mixin.client.accessor;
18+
19+
import net.minecraft.client.gui.render.state.GuiRenderState;
20+
import org.spongepowered.asm.mixin.Mixin;
21+
import org.spongepowered.asm.mixin.gen.Accessor;
22+
23+
@Mixin(GuiRenderState.class)
24+
public interface GuiRenderStateAccessor {
25+
26+
@Accessor("firstStratumAfterBlur")
27+
void clientsort$setFirstStratumAfterBlur(int firstStratumAfterBlur);
28+
}

common/src/main/resources/clientsort.mixins.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
"client.MinecraftMixin",
1717
"client.ScreenMixin",
1818
"client.accessor.AbstractContainerScreenAccessor",
19+
"client.accessor.AbstractWidgetAccessor",
1920
"client.accessor.CreativeModeTabsAccessor",
21+
"client.accessor.GuiGraphicsAccessor",
22+
"client.accessor.GuiRenderStateAccessor",
2023
"client.accessor.KeyMappingAccessor",
2124
"client.accessor.ScreenAccessor",
2225
"client.compat.emi.ReloadWorkerMixin",

0 commit comments

Comments
 (0)