Skip to content

Commit bcce17f

Browse files
RektrothMrKinau
andauthored
1.21.11 (#518)
* fix MC-197260 causing armorstands to render dark * Port to 1.21.11 * Modify return value instead of overwriting book screen methods * WrapOperation instead of Redirect for creating telemetry checkbox * Better telemetry screen * Fix squid renderer * Remove build.gradle.kts changes --------- Co-authored-by: David Luedtke <david@ldtke.de>
1 parent f6e7580 commit bcce17f

36 files changed

Lines changed: 144 additions & 264 deletions

build.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
2-
id("dev.isxander.modstitch.base") version "0.6.2-unstable"
2+
id("dev.isxander.modstitch.base") version "0.7.1-unstable"
3+
id("fabric-loom") version "1.13-SNAPSHOT" apply false
34
id("me.modmuss50.mod-publish-plugin") version "0.8.4"
45
`maven-publish`
56
id("org.ajoberstar.grgit") version "5.3.2"
@@ -8,11 +9,11 @@ plugins {
89
val debugifyVersion = "1.1"
910

1011
modstitch {
11-
minecraftVersion = "1.21.10"
12+
minecraftVersion = "1.21.11"
1213
modLoaderVersion = "0.18.0"
1314

1415
parchment {
15-
mappingsVersion = "2025.10.12"
16+
mappingsVersion = "2025.12.20"
1617
}
1718

1819
metadata {

gradle.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ curseforgeId=596224
99
githubProject=isXander/Debugify
1010

1111
# Libraries
12-
fabricApiVersion=0.138.3+1.21.10
13-
yaclVersion=3.8.0+1.21.9-fabric
14-
modMenuVersion=16.0.0-rc.1
12+
fabricApiVersion=0.139.4+1.21.11
13+
yaclVersion=3.8.1+1.21.11-fabric
14+
modMenuVersion=17.0.0-alpha.1

gradle/wrapper/gradle-wrapper.jar

-14.8 KB
Binary file not shown.
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists

src/client/java/dev/isxander/debugify/client/gui/NoYACLScreen.java

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import net.fabricmc.loader.api.FabricLoader;
44
import net.minecraft.ChatFormatting;
5+
import net.minecraft.client.gui.ActiveTextCollector;
56
import net.minecraft.client.gui.GuiGraphics;
67
import net.minecraft.client.gui.components.Button;
78
import net.minecraft.client.gui.screens.Screen;
@@ -15,6 +16,7 @@
1516

1617
import java.net.URI;
1718
import java.util.List;
19+
import org.jspecify.annotations.Nullable;
1820

1921
public class NoYACLScreen extends Screen {
2022
private final Screen parent;
@@ -38,12 +40,12 @@ public NoYACLScreen(Screen parent) {
3840

3941
@Override
4042
protected void init() {
41-
this.wrappedText = font.split(unwrappedText, width - 50);
43+
this.wrappedText = this.font.split(unwrappedText, width - 50);
4244
this.addRenderableWidget(
4345
Button.builder(CommonComponents.GUI_BACK, button -> minecraft.setScreen(parent))
4446
.pos(
4547
(this.width - 150) / 2,
46-
Mth.clamp(90 + wrappedText.size() * 9 + 12, this.height / 6 + 96, this.height - 24)
48+
Mth.clamp(90 + this.wrappedText.size() * 9 + 12, this.height / 6 + 96, this.height - 24)
4749
)
4850
.size(150, 20)
4951
.build()
@@ -54,35 +56,44 @@ protected void init() {
5456
public void render(GuiGraphics graphics, int mouseX, int mouseY, float delta) {
5557
super.render(graphics, mouseX, mouseY, delta);
5658

57-
graphics.drawCenteredString(font, title, width / 2, 70, -1);
59+
graphics.drawCenteredString(this.font, title, this.width / 2, 70, -1);
5860
int y = 90;
5961
for (FormattedCharSequence line : wrappedText) {
60-
graphics.drawCenteredString(font, line, width / 2, y, -1);
61-
y += font.lineHeight;
62+
graphics.drawCenteredString(this.font, line, this.width / 2, y, -1);
63+
y += this.font.lineHeight;
6264
}
6365
}
6466

65-
6667
@Override
6768
public boolean mouseClicked(MouseButtonEvent mouseButtonEvent, boolean bl) {
6869
if (super.mouseClicked(mouseButtonEvent, bl)) {
6970
return true;
7071
}
7172

72-
Style style = getStyle((int) mouseButtonEvent.x(), (int) mouseButtonEvent.y());
73-
return handleComponentClicked(style);
73+
Style style = this.getStyle((int) mouseButtonEvent.x(), (int) mouseButtonEvent.y());
74+
return this.handleClickEvent(style.getClickEvent());
7475
}
7576

7677
protected Style getStyle(int mouseX, int mouseY) {
7778
int y = mouseY - 90;
78-
int line = y / font.lineHeight;
79+
int line = y / this.font.lineHeight;
80+
81+
if (y < 0 || y > y + this.wrappedText.size() * this.font.lineHeight) return null;
82+
if (line < 0 || line >= this.wrappedText.size()) return null;
7983

80-
if (y < 0 || y > y + wrappedText.size() * font.lineHeight) return null;
81-
if (line < 0 || line >= wrappedText.size()) return null;
84+
FormattedCharSequence text = this.wrappedText.get(line);
85+
int x = mouseX - (this.width / 2 - this.font.width(text) / 2);
8286

83-
FormattedCharSequence text = wrappedText.get(line);
84-
int x = mouseX - (width / 2 - font.width(text) / 2);
87+
ActiveTextCollector.ClickableStyleFinder clickableStyleFinder = new ActiveTextCollector.ClickableStyleFinder(this.font, mouseX, mouseY);
88+
return clickableStyleFinder.result();
89+
}
90+
91+
protected boolean handleClickEvent(@Nullable ClickEvent clickEvent) {
92+
if (clickEvent == null) {
93+
return false;
94+
}
8595

86-
return font.getSplitter().componentStyleAtWidth(wrappedText.get(line), x);
96+
defaultHandleGameClickEvent(clickEvent, this.minecraft, this);
97+
return true;
8798
}
8899
}
Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,37 @@
11
package dev.isxander.debugify.client.helpers.mc237493;
22

3+
import com.mojang.serialization.Codec;
34
import java.util.Arrays;
45
import java.util.Comparator;
6+
import java.util.function.IntFunction;
57

68
import net.minecraft.network.chat.Component;
9+
import net.minecraft.util.ByIdMap;
710
import net.minecraft.util.Mth;
8-
import net.minecraft.util.OptionEnum;
11+
import net.minecraft.util.StringRepresentable;
912

10-
public enum DebugifyTelemetry implements OptionEnum {
13+
public enum DebugifyTelemetry {
1114
OFF(0, "options.telemetry.state.none", "debugify.mc_237493.tooltip.off"),
1215
MINIMAL(1, "options.telemetry.state.minimal", "debugify.mc_237493.tooltip.minimal"),
1316
ALL(2, "options.telemetry.state.all", "debugify.mc_237493.tooltip.all");
1417

15-
private static final DebugifyTelemetry[] VALUES = Arrays.stream(values())
16-
.sorted(Comparator.comparingInt(DebugifyTelemetry::getId))
17-
.toArray(DebugifyTelemetry[]::new);
18-
18+
private static final IntFunction<DebugifyTelemetry> BY_ID = ByIdMap.continuous(value -> value.id, values(), ByIdMap.OutOfBoundsStrategy.WRAP);
19+
public static final Codec<DebugifyTelemetry> LEGACY_CODEC = Codec.INT.xmap(BY_ID::apply, value -> value.id);
1920
private final int id;
20-
private final String translationKey;
21-
private final String tooltipTranslationKey;
21+
private final Component caption;
22+
private final Component tooltip;
2223

23-
DebugifyTelemetry(int id, String translationKey, String tooltipTranslationKey) {
24+
DebugifyTelemetry(int id, final String key, final String translationKey) {
2425
this.id = id;
25-
this.translationKey = translationKey;
26-
this.tooltipTranslationKey = tooltipTranslationKey;
27-
}
28-
29-
@Override
30-
public int getId() {
31-
return this.id;
32-
}
33-
34-
@Override
35-
public String getKey() {
36-
return this.translationKey;
37-
}
38-
39-
public String getTooltipKey() {
40-
return this.tooltipTranslationKey;
26+
this.caption = Component.translatable(key);
27+
this.tooltip = Component.translatable(translationKey);
4128
}
4229

43-
public Component getTooltipText() {
44-
return Component.translatable(getTooltipKey(), getCaption());
30+
public Component caption() {
31+
return this.caption;
4532
}
4633

47-
public static DebugifyTelemetry byId(int id) {
48-
return VALUES[Mth.positiveModulo(id, VALUES.length)];
34+
public Component tooltip() {
35+
return this.tooltip;
4936
}
5037
}

src/client/java/dev/isxander/debugify/client/mixins/basic/mc115092/SquidRendererMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import dev.isxander.debugify.fixes.FixCategory;
77
import net.minecraft.client.renderer.entity.SquidRenderer;
88
import net.minecraft.client.renderer.entity.state.SquidRenderState;
9-
import net.minecraft.world.entity.animal.Squid;
9+
import net.minecraft.world.entity.animal.squid.Squid;
1010
import org.spongepowered.asm.mixin.Mixin;
1111
import org.spongepowered.asm.mixin.Unique;
1212
import org.spongepowered.asm.mixin.injection.At;
@@ -19,7 +19,7 @@ public class SquidRendererMixin<T extends Squid> {
1919
@Unique
2020
T squidEntity;
2121

22-
@Inject(method = "extractRenderState(Lnet/minecraft/world/entity/animal/Squid;Lnet/minecraft/client/renderer/entity/state/SquidRenderState;F)V", at = @At("TAIL"))
22+
@Inject(method = "extractRenderState(Lnet/minecraft/world/entity/animal/squid/Squid;Lnet/minecraft/client/renderer/entity/state/SquidRenderState;F)V", at = @At("TAIL"))
2323
private void getSquidEntity(T squid, SquidRenderState squidRenderState, float f, CallbackInfo ci) {
2424
squidEntity = squid;
2525
}

src/client/java/dev/isxander/debugify/client/mixins/basic/mc122477/EditBoxMixin.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
import dev.isxander.debugify.fixes.FixCategory;
55
import dev.isxander.debugify.client.helpers.mc122477.KeyboardPollCounter;
66
import dev.isxander.debugify.fixes.OS;
7-
import net.minecraft.Util;
87
import net.minecraft.client.gui.Font;
98
import net.minecraft.client.gui.components.EditBox;
109
import net.minecraft.client.input.CharacterEvent;
1110
import net.minecraft.network.chat.Component;
11+
import net.minecraft.util.Util;
1212
import org.spongepowered.asm.mixin.Mixin;
1313
import org.spongepowered.asm.mixin.injection.At;
1414
import org.spongepowered.asm.mixin.injection.Inject;

src/client/java/dev/isxander/debugify/client/mixins/basic/mc197260/ArmorStandRendererMixin.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package dev.isxander.debugify.client.mixins.basic.mc197260;
22

3-
import com.mojang.datafixers.util.Pair;
43
import dev.isxander.debugify.fixes.BugFix;
54
import dev.isxander.debugify.fixes.FixCategory;
65
import net.minecraft.client.Minecraft;
@@ -9,9 +8,7 @@
98
import net.minecraft.client.renderer.entity.state.ArmorStandRenderState;
109
import org.spongepowered.asm.mixin.Mixin;
1110

12-
import java.util.Comparator;
13-
import java.util.stream.IntStream;
14-
import net.minecraft.client.model.ArmorStandArmorModel;
11+
import net.minecraft.client.model.object.armorstand.ArmorStandArmorModel;
1512
import net.minecraft.client.renderer.LightTexture;
1613
import net.minecraft.client.renderer.entity.ArmorStandRenderer;
1714
import net.minecraft.core.BlockPos;
@@ -39,13 +36,14 @@ protected ArmorStandRendererMixin(EntityRendererProvider.Context context) {
3936
BlockPos mainPos = BlockPos.containing(livingEntity.x, livingEntity.y, livingEntity.z);
4037
ClientLevel level = Minecraft.getInstance().level;
4138

42-
livingEntity.lightCoords = IntStream.of(-1, 0, 2, 3)
43-
.mapToObj(operand -> {
44-
BlockPos pos = mainPos.offset(0, operand, 0);
45-
return Pair.of(level.getBrightness(LightLayer.BLOCK, pos), pos);
46-
})
47-
.max(Comparator.comparingInt(Pair::getFirst))
48-
.map(p -> LightTexture.pack(p.getFirst(), level.getBrightness(LightLayer.SKY, p.getSecond())))
49-
.orElse(livingEntity.lightCoords);
39+
int maxSkyLight = 0;
40+
int maxBlockLight = 0;
41+
for (int offset : new int[] { -1, 0, 2, 3 }) {
42+
BlockPos pos = mainPos.offset(0, offset, 0);
43+
maxSkyLight = Math.max(maxSkyLight, level.getBrightness(LightLayer.SKY, pos));
44+
maxBlockLight = Math.max(maxBlockLight, level.getBrightness(LightLayer.BLOCK, pos));
45+
}
46+
47+
livingEntity.lightCoords = LightTexture.pack(maxBlockLight, maxSkyLight);
5048
}
5149
}

src/client/java/dev/isxander/debugify/client/mixins/basic/mc22882/AbstractContainerScreenMixin.java

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)