Skip to content

Commit d953619

Browse files
committed
Update to mc1.21.8
1 parent 3dc2565 commit d953619

File tree

13 files changed

+193
-77
lines changed

13 files changed

+193
-77
lines changed

changelog.md

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

137138
## 2.0.0-beta.15
138139

@@ -144,6 +145,7 @@ Note: this beta version includes networking changes, servers and clients must be
144145
## 2.0.0-beta.14
145146

146147
- Added support for configuring specific items to always be sorted to the start or end
148+
- Fixed a launch crash on NeoForge on 1.21.7+
147149

148150
## 2.0.0-beta.13
149151

@@ -154,6 +156,7 @@ Note: this beta version includes networking changes, servers and clients must be
154156
## 2.0.0-beta.12
155157

156158
- Fixed button status not saving when changed via editor screen
159+
- Added compatibility with Blur+ mod on 1.21.6+
157160

158161
## 2.0.0-beta.11
159162

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;
@@ -62,8 +64,7 @@ public abstract class EditorScreen extends Screen {
6264
public final Set<Integer> ignoredSlots = new TreeSet<>();
6365

6466
/**
65-
* An element of {@link EditorScreen#buttons} which 'represents' the whole set of
66-
* buttons.
67+
* An element of {@link EditorScreen#buttons} which 'represents' the whole set of buttons.
6768
* <p>
6869
* This can be any element, and the specific choice is only relevant when repositioning via
6970
* mouse drag.
@@ -72,8 +73,8 @@ public abstract class EditorScreen extends Screen {
7273

7374
/**
7475
* The class name of either {@link EditorScreen#rep}'s {@link TriggerButton#container}, or
75-
* {@link EditorScreen#underlay}'s {@link AbstractContainerScreen#getMenu} if the former
76-
* is {@code null}.
76+
* {@link EditorScreen#underlay}'s {@link AbstractContainerScreen#getMenu} if the former is
77+
* {@code null}.
7778
* <p>
7879
* This value represents the lowest-level key on which a {@link ClassPolicy} can be created, and
7980
* may differ from {@link EditorScreen#rep}'s {@link TriggerButton#activePolicyKey}.
@@ -568,7 +569,15 @@ private void rebuildGui() {
568569
*/
569570
@Override
570571
public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float partialTick) {
572+
underlay.renderBackground(graphics, mouseX, mouseY, partialTick);
571573
underlay.render(graphics, mouseX, mouseY, partialTick);
574+
575+
// Workaround for other mods adding blur when rendering the underlay
576+
((GuiRenderStateAccessor) ((GuiGraphicsAccessor) graphics).clientsort$getGuiRenderState())
577+
.clientsort$setFirstStratumAfterBlur(Integer.MAX_VALUE);
578+
graphics.nextStratum();
579+
renderBlurredBackground(graphics);
580+
572581
super.render(graphics, mouseX, mouseY, partialTick);
573582

574583
// Render disabled-slot indicators
@@ -635,17 +644,34 @@ public void render(@NotNull GuiGraphics graphics, int mouseX, int mouseY, float
635644
}
636645
}
637646

647+
/**
648+
* Removes the call to {@link Screen#renderBlurredBackground}, since we add a call in
649+
* {@link EditorScreen#render} and the method can only be called once.
650+
*/
651+
@Override
652+
public void renderBackground(
653+
@NotNull GuiGraphics graphics,
654+
int mouseX,
655+
int mouseY,
656+
float partialTick
657+
) {
658+
if (Minecraft.getInstance().level == null) {
659+
renderPanorama(graphics, partialTick);
660+
}
661+
renderMenuBackground(graphics);
662+
}
663+
638664
/**
639665
* Modifies the background blur to be constant irrespective of the configured value.
640666
* <p>
641667
* Minimal blur is used to prevent the editable widgets disappearing under underlay items on a
642668
* higher render layer, while still keeping the underlay detail discernible.
643669
*/
644670
@Override
645-
protected void renderBlurredBackground() {
671+
protected void renderBlurredBackground(@NotNull GuiGraphics graphics) {
646672
int original = Minecraft.getInstance().options.menuBackgroundBlurriness().get();
647673
Minecraft.getInstance().options.menuBackgroundBlurriness().set(1);
648-
super.renderBlurredBackground();
674+
super.renderBlurredBackground(graphics);
649675
Minecraft.getInstance().options.menuBackgroundBlurriness().set(original);
650676
}
651677

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: 4 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;
@@ -177,7 +178,7 @@ public void renderWidget(
177178

178179
// Draw texture
179180
ResourceLocation texture = sprites.get(isActive(), isHoveredOrFocused());
180-
graphics.blitSprite(RenderType::guiTextured, texture, getX(), getY(), width, height);
181+
graphics.blitSprite(RenderPipelines.GUI_TEXTURED, texture, getX(), getY(), width, height);
181182

182183
// Draw policy state indicator
183184
if (!operationAllowed) {
@@ -186,7 +187,7 @@ public void renderWidget(
186187

187188
// Refresh tooltip
188189
if (isMouseOver(mouseX, mouseY)) {
189-
if (getTooltip() == null) {
190+
if (((AbstractWidgetAccessor) this).clientsort$getTooltip().get() == null) {
190191
if (Minecraft.getInstance().screen instanceof EditorScreen) {
191192
Component visibilityStatus = localized(
192193
"editor", active ? "enabled" : "disabled")

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
@@ -277,10 +277,9 @@ private void afterRender(
277277
return;
278278

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

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

292291
float scale = 0.7F;
293-
graphics.pose().pushPose();
294-
graphics.pose().translate(0.0F, 0.0F, 1000F);
295-
graphics.pose().scale(scale, scale, 0.0F);
292+
graphics.pose().pushMatrix();
293+
graphics.pose().scale(scale, scale);
296294

297295
for (Slot slot : menu.slots) {
298296
int slotId = ((ISlot) slot).clientsort$getIndexInMenu();
@@ -352,6 +350,6 @@ private void afterRender(
352350
);
353351
}
354352

355-
graphics.pose().popPose();
353+
graphics.pose().popMatrix();
356354
}
357355
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2026 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 2026 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 2026 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
@@ -17,7 +17,10 @@
1717
"client.MinecraftMixin",
1818
"client.ScreenMixin",
1919
"client.accessor.AbstractContainerScreenAccessor",
20+
"client.accessor.AbstractWidgetAccessor",
2021
"client.accessor.CreativeModeTabsAccessor",
22+
"client.accessor.GuiGraphicsAccessor",
23+
"client.accessor.GuiRenderStateAccessor",
2124
"client.accessor.KeyMappingAccessor",
2225
"client.accessor.ScreenAccessor",
2326
"client.compat.emi.ReloadWorkerMixin",

0 commit comments

Comments
 (0)