feat: implement 1.21 compatibility, use new APIs

This commit is contained in:
Erica Marigold 2024-06-23 13:55:25 +05:30
parent 5d5d1b66d6
commit 1ffb313426
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1
2 changed files with 5 additions and 3 deletions

View file

@ -11,7 +11,7 @@ import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder;
public class ConfigHandler {
private boolean isLoaded = false;
public static final ConfigClassHandler<ConfigModel> HANDLER = ConfigClassHandler.createBuilder(ConfigModel.class)
.id(new Identifier("elytralock", "config"))
.id(Identifier.of("elytralock", "config"))
.serializer(config -> GsonConfigSerializerBuilder.create(config)
.setPath(ElytraLock.LOADER.getConfigDir().resolve("elytra-lock.json"))
.setJson5(true)

View file

@ -4,6 +4,7 @@ import xyz.devcomp.elytralock.ElytraLock;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.RenderTickCounter;
import net.minecraft.client.util.Window;
import net.minecraft.util.Identifier;
@ -11,9 +12,10 @@ public class HudRenderHandler implements HudRenderCallback {
public static final int WIDTH = 16;
public static final int HEIGHT = 16;
public void onHudRender(DrawContext context, float delta) {
@Override
public void onHudRender(DrawContext context, RenderTickCounter tickCounter) {
// FIXME: Perhaps don't check whether the elytra is locked on every frame
Identifier icon = new Identifier("elytra-lock",
Identifier icon = Identifier.of("elytra-lock",
"textures/gui/" + (ElytraLock.isLocked() ? "locked" : "unlocked") + ".png");
Window window = ElytraLock.client.getWindow();