Skip to content

Commit d39d063

Browse files
committed
port to 26.1
1 parent 70390d9 commit d39d063

File tree

66 files changed

+456
-1267
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+456
-1267
lines changed

buildSrc/src/main/kotlin/dev/isxander/controlify/project.gradle.kts

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins {
1313

1414
modstitch.apply {
1515
minecraftVersion = mcVersion
16+
javaVersion = 25
1617

1718
parchment {
1819
propMap("parchment.version") { mappingsVersion = it }
@@ -51,7 +52,6 @@ modstitch.apply {
5152

5253
moddevgradle {
5354
propMap("deps.neoForge") { neoForgeVersion = it }
54-
propMap("deps.forge") { forgeVersion = it }
5555

5656
defaultRuns()
5757
}
@@ -64,6 +64,9 @@ repositories {
6464
strictMaven("https://maven.quiltmc.org/repository/release") {
6565
includeGroupAndSubgroups("org.quiltmc")
6666
}
67+
strictMaven("https://maven.nucleoid.xyz/releases") {
68+
includeGroupAndSubgroups("eu.pb4")
69+
}
6770
maven("https://maven.isxander.dev/releases")
6871
}
6972

@@ -114,59 +117,11 @@ stonecutter.apply {
114117
put("simple_voice_chat", isPropDefined("deps.simpleVoiceChat"))
115118
put("reeses_sodium_options", isPropDefined("deps.reesesSodiumOptions"))
116119
put("fancy_menu", isPropDefined("deps.fancyMenu"))
117-
118-
put("unobf", modstitch.isUnobfuscated)
119-
put("intermediary_lambdas", modstitch.isUnobfuscated.map { !it && !modstitch.isModDevGradle })
120120
}
121121

122122
dependencies {
123123
put("fapi", prop("deps.fabricApi") ?: "0.0.0")
124124
}
125-
126-
replacements {
127-
fun ReplacementContainer.replaceClass(direction: Boolean, from: String, to: String) {
128-
val fromPackage = from.substringBeforeLast('.')
129-
val toPackage = to.substringBeforeLast('.')
130-
131-
if (fromPackage != toPackage) {
132-
string(direction) {
133-
replace(from, to)
134-
}
135-
}
136-
137-
val fromName = from.substringAfterLast('.')
138-
val toName = to.substringAfterLast('.')
139-
if (fromName != toName) {
140-
regex(direction) {
141-
replace(
142-
"(?<![a-zA-Z0-9\$_])$fromName(?![a-zA-Z0-9\$_])" to toName,
143-
"(?<![a-zA-Z0-9\$_])$toName(?![a-zA-Z0-9\$_])" to fromName
144-
)
145-
}
146-
}
147-
}
148-
149-
replaceClass(
150-
current.parsed >= "1.21.11",
151-
"net.minecraft.Util",
152-
"net.minecraft.util.Util"
153-
)
154-
replaceClass(
155-
current.parsed >= "1.21.11",
156-
"net.minecraft.resources.ResourceLocation",
157-
"net.minecraft.resources.Identifier"
158-
)
159-
replaceClass(
160-
current.parsed >= "26.1",
161-
"net.fabricmc.fabric.impl.client.keybinding.KeyBindingRegistryImpl",
162-
"net.fabricmc.fabric.impl.client.keymapping.KeyMappingRegistryImpl"
163-
)
164-
replaceClass(
165-
current.parsed >= "26.1",
166-
"net.fabricmc.fabric.api.networking.v1.PacketByteBufs",
167-
"net.fabricmc.fabric.api.networking.v1.FriendlyByteBufs"
168-
)
169-
}
170125
}
171126

172127
tasks.named<ProcessResources>("generateModMetadata") {

docs/developers/screen-operation-api.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public class MyAmazingScreenProcessor extends ScreenProcessor<MyAmazingScreen> {
7676
}
7777

7878
@Override
79-
protected void render(Controller<?, ?> controller, GuiGraphics graphics, float tickDelta, Optional<VirtualMouseHandler> vmouse) {
79+
protected void render(Controller<?, ?> controller, GuiGraphicsExtractor graphics, float tickDelta, Optional<VirtualMouseHandler> vmouse) {
8080
// called after the screen has rendered.
8181
}
8282

modstitch.ct

Lines changed: 0 additions & 4 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package dev.isxander.controlify.api.bind;
22

3-
import net.minecraft.client.gui.GuiGraphics;
3+
import net.minecraft.client.gui.GuiGraphicsExtractor;
44

55
@FunctionalInterface
66
public interface RadialIcon {
77
RadialIcon EMPTY = (graphics, x, y, tickDelta) -> {};
88

9-
void draw(GuiGraphics graphics, int x, int y, float tickDelta);
9+
void draw(GuiGraphicsExtractor graphics, int x, int y, float tickDelta);
1010
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package dev.isxander.controlify.api.guide;
22

3-
import net.minecraft.client.gui.GuiGraphics;
3+
import net.minecraft.client.gui.GuiGraphicsExtractor;
44
import net.minecraft.client.gui.components.Renderable;
55

66
public interface RenderableGuideDomain<T extends FactCtx> extends GuideDomainRegistry<T> {
7-
void render(GuiGraphics graphics, boolean bottomAligned, boolean textContrast);
7+
void render(GuiGraphicsExtractor graphics, boolean bottomAligned, boolean textContrast);
88

99
Renderable renderable(boolean bottomAligned, boolean textContrast);
1010
}

src/main/java/dev/isxander/controlify/bindings/RadialIcons.java

Lines changed: 25 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
package dev.isxander.controlify.bindings;
22

33
import dev.isxander.controlify.api.bind.RadialIcon;
4-
import dev.isxander.controlify.utils.render.Blit;
54
import dev.isxander.controlify.utils.CUtil;
6-
import dev.isxander.controlify.utils.render.CGuiPose;
75
import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap;
86
import net.minecraft.client.Minecraft;
97
import net.minecraft.client.gui.Gui;
10-
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
8+
import net.minecraft.client.renderer.RenderPipelines;
119
import net.minecraft.core.Holder;
1210
import net.minecraft.core.registries.BuiltInRegistries;
1311
import net.minecraft.resources.ResourceKey;
@@ -60,43 +58,34 @@ private static void addItems(Map<Identifier, RadialIcon> map) {
6058
ResourceKey<Item> key = entry.getKey();
6159
ItemStack stack = entry.getValue().getDefaultInstance();
6260

63-
map.put(key./*? if >=1.21.11 {*/identifier/*?} else {*//*location*//*?}*/().withPrefix("item/"), (graphics, x, y, tickDelta) -> {
64-
graphics.renderItem(stack, x, y);
61+
map.put(key.identifier().withPrefix("item/"), (graphics, x, y, a) -> {
62+
graphics.item(stack, x, y);
6563
});
6664
});
6765
}
6866

6967
private static void addPotionEffects(Map<Identifier, RadialIcon> map) {
70-
//? if <1.21.6
71-
/*var mobEffectTextureManager = minecraft.getMobEffectTextures();*/
72-
7368
BuiltInRegistries.MOB_EFFECT.entrySet().forEach(entry -> {
7469
ResourceKey<MobEffect> key = entry.getKey();
7570

7671
Holder<MobEffect> effect = BuiltInRegistries.MOB_EFFECT.wrapAsHolder(entry.getValue());
7772

78-
boolean render = true;
79-
//? if >=1.21.6 {
8073
Identifier sprite = Gui.getMobEffectSprite(effect);
81-
//?} else {
82-
/*TextureAtlasSprite sprite = mobEffectTextureManager.get(effect);
83-
84-
if (sprite == null || sprite.atlasLocation() == null) {
85-
render = false;
86-
}
87-
*///?}
8874

89-
if (render) {
90-
map.put(key./*? if >=1.21.11 {*/identifier/*?} else {*//*location*//*?}*/().withPrefix("effect/"), (graphics, x, y, tickDelta) -> {
91-
var pose = CGuiPose.ofPush(graphics);
92-
pose.translate(x, y);
93-
pose.scale(0.88f, 0.88f);
75+
map.put(key.identifier().withPrefix("effect/"), (graphics, x, y, a) -> {
76+
var pose = graphics.pose().pushMatrix();
77+
pose.translate(x, y);
78+
pose.scale(0.88f, 0.88f);
9479

95-
Blit.sprite(graphics, sprite, 0, 0, 18, 18 /*? if <1.21.6 >>*//*,-1*/ );
80+
graphics.blitSprite(
81+
RenderPipelines.GUI_TEXTURED,
82+
sprite,
83+
0, 0,
84+
18, 18
85+
);
9686

97-
pose.pop();
98-
});
99-
}
87+
pose.popMatrix();
88+
});
10089
});
10190
}
10291

@@ -106,11 +95,18 @@ private static Map<Identifier, RadialIcon> registerIcons() {
10695

10796
map.put(EMPTY, (graphics, x, y, tickDelta) -> {});
10897
map.put(modLoaderIcon, (graphics, x, y, tickDelta) -> {
109-
var pose = CGuiPose.ofPush(graphics);
98+
var pose = graphics.pose().pushMatrix();
11099
pose.translate(x, y);
111100
pose.scale(0.5f, 0.5f);
112-
Blit.tex(graphics, modLoaderIcon, 0, 0, 0, 0, 32, 32, 32, 32);
113-
pose.pop();
101+
graphics.blit(
102+
RenderPipelines.GUI_TEXTURED,
103+
modLoaderIcon,
104+
0, 0,
105+
0, 0,
106+
32, 32,
107+
32, 32
108+
);
109+
pose.popMatrix();
114110
});
115111
addItems(map);
116112
addPotionEffects(map);

src/main/java/dev/isxander/controlify/compatibility/ControlifyCompat.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ public class ControlifyCompat {
1919

2020
public static void init() {
2121
//? if simple_voice_chat {
22-
/*try {
22+
try {
2323
wrapCompatCall(
2424
SIMPLE_VOICE_CHAT,
2525
dev.isxander.controlify.compatibility.simplevoicechat.SimpleVoiceChatCompat::init
2626
);
2727
} catch (NoClassDefFoundError e) {
2828
disabledMods.add(SIMPLE_VOICE_CHAT);
2929
}
30-
*///?}
30+
//?}
3131

3232
//? if fancy_menu {
3333
/*try {

src/main/java/dev/isxander/controlify/compatibility/simplevoicechat/SimpleVoiceChatCompat.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//? if simple_voice_chat {
2-
/*package dev.isxander.controlify.compatibility.simplevoicechat;
2+
package dev.isxander.controlify.compatibility.simplevoicechat;
33

44
import de.maxhenkel.voicechat.voice.client.ClientManager;
55
import de.maxhenkel.voicechat.voice.client.KeyEvents;
@@ -8,8 +8,8 @@
88
import dev.isxander.controlify.api.bind.InputBindingSupplier;
99
import dev.isxander.controlify.compatibility.simplevoicechat.mixins.KeyEventsAccessor;
1010
import dev.isxander.controlify.controller.ControllerEntity;
11-
import dev.isxander.controlify.utils.render.Blit;
1211
import net.minecraft.client.Minecraft;
12+
import net.minecraft.client.renderer.RenderPipelines;
1313
import net.minecraft.network.chat.CommonComponents;
1414
import net.minecraft.network.chat.Component;
1515
import net.minecraft.resources.Identifier;
@@ -105,8 +105,8 @@ private static void checkConnected() {
105105

106106
private static Identifier registerIcon16x(Identifier location) {
107107
ControlifyBindApi.get().registerRadialIcon(location, ((graphics, x, y, tickDelta) ->
108-
Blit.tex(graphics, location, x, y, 0f, 0f, 16, 16, 16, 16)));
108+
graphics.blit(RenderPipelines.GUI_TEXTURED, location, x, y, 0, 0, 16, 16, 16, 16)));
109109
return location;
110110
}
111111
}
112-
*///?}
112+
//?}

src/main/java/dev/isxander/controlify/compatibility/simplevoicechat/mixins/KeyEventsAccessor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//? if simple_voice_chat {
2-
/*package dev.isxander.controlify.compatibility.simplevoicechat.mixins;
2+
package dev.isxander.controlify.compatibility.simplevoicechat.mixins;
33

44
import de.maxhenkel.voicechat.voice.client.KeyEvents;
55
import org.spongepowered.asm.mixin.Mixin;
@@ -10,4 +10,4 @@ public interface KeyEventsAccessor {
1010
@Invoker
1111
boolean invokeCheckConnected();
1212
}
13-
*///?}
13+
//?}

src/main/java/dev/isxander/controlify/compatibility/simplevoicechat/mixins/PTTKeyHandlerMixin.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//? if simple_voice_chat {
2-
/*package dev.isxander.controlify.compatibility.simplevoicechat.mixins;
2+
package dev.isxander.controlify.compatibility.simplevoicechat.mixins;
33

44
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
55
import de.maxhenkel.voicechat.voice.client.PTTKeyHandler;
@@ -40,4 +40,4 @@ private boolean isControllerWhisperDown(boolean keyDown) {
4040
return keyDown || SimpleVoiceChatCompat.isWhisperDown();
4141
}
4242
}
43-
*///?}
43+
//?}

0 commit comments

Comments
 (0)