From ce9f56dddec1e7bf248bc8628c7bf1fdd05a439d Mon Sep 17 00:00:00 2001 From: glisco Date: Wed, 1 Jun 2022 16:27:52 +0200 Subject: [PATCH] initial port to 1.19 --- build.gradle | 5 +++-- gradle.properties | 18 +++++++++--------- settings.gradle | 4 ---- .../IsometricRendersClient.java | 7 +++++-- .../render/IsometricRenderHelper.java | 2 +- .../util/IsoRenderCommand.java | 17 +++++++++-------- .../isometricrenders/util/Translate.java | 14 +++++++------- 7 files changed, 34 insertions(+), 33 deletions(-) diff --git a/build.gradle b/build.gradle index 70c650c..cbdca54 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,8 @@ +//file:noinspection GradlePackageVersionRange plugins { - id 'fabric-loom' version '0.10-SNAPSHOT' + id 'fabric-loom' version '0.12-SNAPSHOT' id 'maven-publish' - id 'io.github.juuxel.loom-quiltflower-mini' version '1.2.1' + id 'io.github.juuxel.loom-quiltflower' version '1.7.1' } version = "${project.mod_version}+${project.minecraft_base_version}" diff --git a/gradle.properties b/gradle.properties index 126ec3a..dc4be14 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,24 +1,24 @@ # Done to increase the memory available to gradle. org.gradle.jvmargs=-Xmx1G # Fabric Properties -# check these on https://modmuss50.me/fabric.html -minecraft_base_version=1.18 -minecraft_version=1.18.2 -yarn_mappings=1.18.2+build.2 -loader_version=0.13.3 +# check these on https://fabricmc.net/develop +minecraft_base_version=1.19 +minecraft_version=1.19-pre3 +yarn_mappings=1.19-pre3+build.4 +loader_version=0.14.6 # Mod Properties mod_version=0.2.13 maven_group=com.glisco archives_base_name=isometric-renders # Dependencies # check this on https://modmuss50.me/fabric.html -fabric_version=0.48.0+1.18.2 +fabric_version=0.53.4+1.19 # https://maven.wispforest.io/io/wispforest/worldmesher/ -worldmesher_version=0.2.6+1.18 +worldmesher_version=0.2.7+1.19 # https://maven.wispforest.io/io/wispforest/exo/ -exo_version=0.1.4+1.18 +exo_version=0.1.4+1.19 # https://maven.wispforest.io/io/wispforest/owo-lib/ -owo_version=0.5.4+1.18 +owo_version=0.7.3-pre9+1.19 diff --git a/settings.gradle b/settings.gradle index 64446d0..5b60df3 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,9 +6,5 @@ pluginManagement { url = 'https://maven.fabricmc.net/' } gradlePluginPortal() - maven { - name = 'Cotton' - url = 'https://server.bbkr.space/artifactory/libs-release/' - } } } diff --git a/src/main/java/com/glisco/isometricrenders/IsometricRendersClient.java b/src/main/java/com/glisco/isometricrenders/IsometricRendersClient.java index 3ee19b2..b19dfa9 100644 --- a/src/main/java/com/glisco/isometricrenders/IsometricRendersClient.java +++ b/src/main/java/com/glisco/isometricrenders/IsometricRendersClient.java @@ -7,13 +7,15 @@ import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; -import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager; +import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawableHelper; import net.minecraft.client.option.KeyBinding; +import net.minecraft.command.CommandRegistryAccess; +import net.minecraft.util.registry.DynamicRegistryManager; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.lwjgl.glfw.GLFW; @@ -28,8 +30,9 @@ public class IsometricRendersClient implements ClientModInitializer { @Override public void onInitializeClient() { + final var registryAccess = new CommandRegistryAccess(DynamicRegistryManager.BUILTIN.get()); + IsoRenderCommand.register(ClientCommandManager.DISPATCHER, registryAccess); - IsoRenderCommand.register(ClientCommandManager.DISPATCHER); ImageExporter.init(); HudRenderCallback.EVENT.register((matrixStack, tickDelta) -> { diff --git a/src/main/java/com/glisco/isometricrenders/render/IsometricRenderHelper.java b/src/main/java/com/glisco/isometricrenders/render/IsometricRenderHelper.java index eed6f6a..4f17c6d 100644 --- a/src/main/java/com/glisco/isometricrenders/render/IsometricRenderHelper.java +++ b/src/main/java/com/glisco/isometricrenders/render/IsometricRenderHelper.java @@ -9,7 +9,7 @@ import com.glisco.isometricrenders.screen.ItemAtlasRenderScreen; import com.glisco.isometricrenders.util.RuntimeConfig; import com.mojang.blaze3d.systems.RenderSystem; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.block.BlockState; import net.minecraft.block.entity.BlockEntity; import net.minecraft.client.MinecraftClient; diff --git a/src/main/java/com/glisco/isometricrenders/util/IsoRenderCommand.java b/src/main/java/com/glisco/isometricrenders/util/IsoRenderCommand.java index 31ab991..d7cf9ea 100644 --- a/src/main/java/com/glisco/isometricrenders/util/IsoRenderCommand.java +++ b/src/main/java/com/glisco/isometricrenders/util/IsoRenderCommand.java @@ -14,11 +14,12 @@ import com.mojang.brigadier.builder.RequiredArgumentBuilder; import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.suggestion.SuggestionProvider; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.block.BlockState; import net.minecraft.block.BlockWithEntity; import net.minecraft.block.entity.BlockEntity; import net.minecraft.client.MinecraftClient; +import net.minecraft.command.CommandRegistryAccess; import net.minecraft.command.CommandSource; import net.minecraft.command.argument.*; import net.minecraft.entity.Entity; @@ -27,7 +28,7 @@ import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; -import net.minecraft.text.TranslatableText; +import net.minecraft.text.Text; import net.minecraft.util.Identifier; import net.minecraft.util.Util; import net.minecraft.util.hit.BlockHitResult; @@ -42,8 +43,8 @@ import java.util.function.Function; import static com.glisco.isometricrenders.util.Translate.msg; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.argument; -import static net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.literal; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.argument; +import static net.fabricmc.fabric.api.client.command.v2.ClientCommandManager.literal; public class IsoRenderCommand { @@ -58,7 +59,7 @@ public class IsoRenderCommand { static { CLIENT_SUMMONABLE_ENTITIES = (context, builder) -> CommandSource.suggestFromIdentifier(Registry.ENTITY_TYPE.stream().filter(EntityType::isSummonable), - builder, EntityType::getId, entityType -> new TranslatableText(Util.createTranslationKey("entity", EntityType.getId(entityType))) + builder, EntityType::getId, entityType -> Text.translatable(Util.createTranslationKey("entity", EntityType.getId(entityType))) ); ITEM_GROUPS = (context, builder) -> @@ -80,14 +81,14 @@ private static void cacheNamespaces() { }); } - public static void register(CommandDispatcher dispatcher) { - dispatcher.register(literal("isorender").then(literal("block").executes(context -> executeBlockTarget(context.getSource())).then(argument("block", BlockStateArgumentType.blockState()).executes(context -> { + public static void register(CommandDispatcher dispatcher, CommandRegistryAccess access) { + dispatcher.register(literal("isorender").then(literal("block").executes(context -> executeBlockTarget(context.getSource())).then(argument("block", BlockStateArgumentType.blockState(access)).executes(context -> { final BlockStateArgument blockStateArgument = context.getArgument("block", BlockStateArgument.class); final BlockState blockState = blockStateArgument.getBlockState(); return executeBlockState(context.getSource(), blockState, ((BlockStateArgumentAccessor) blockStateArgument).getData()); }))).then(literal("item").executes(context -> { return executeItem(context.getSource(), context.getSource().getPlayer().getMainHandStack().copy()); - }).then(argument("item", ItemStackArgumentType.itemStack()).executes(context -> { + }).then(argument("item", ItemStackArgumentType.itemStack(access)).executes(context -> { final ItemStack stack = ItemStackArgumentType.getItemStackArgument(context, "item").createStack(1, false); return executeItem(context.getSource(), stack); }))).then(literal("entity").executes(context -> { diff --git a/src/main/java/com/glisco/isometricrenders/util/Translate.java b/src/main/java/com/glisco/isometricrenders/util/Translate.java index 7c2b739..b424643 100644 --- a/src/main/java/com/glisco/isometricrenders/util/Translate.java +++ b/src/main/java/com/glisco/isometricrenders/util/Translate.java @@ -1,26 +1,26 @@ package com.glisco.isometricrenders.util; import com.mojang.brigadier.context.CommandContext; -import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource; +import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.minecraft.client.MinecraftClient; import net.minecraft.text.MutableText; -import net.minecraft.text.TranslatableText; +import net.minecraft.text.Text; import net.minecraft.util.Formatting; public class Translate { private static final String MESSAGE_PREFIX = "message.isometric-renders.prefix"; - public static TranslatableText make(String key, Object... args) { - return new TranslatableText("message.isometric-renders." + key, args); + public static MutableText make(String key, Object... args) { + return Text.translatable("message.isometric-renders." + key, args); } - public static TranslatableText gui(String key, Object... args) { - return new TranslatableText("gui.isometric-renders." + key, args); + public static MutableText gui(String key, Object... args) { + return Text.translatable("gui.isometric-renders." + key, args); } public static MutableText msg(String key, Object... args) { - return new TranslatableText(MESSAGE_PREFIX).append(make(key, args).formatted(Formatting.GRAY)); + return Text.translatable(MESSAGE_PREFIX).append(make(key, args).formatted(Formatting.GRAY)); } public static void commandFeedback(CommandContext context, String key, Object... args) {