From 24b5c1a90fad361277e259eb058fbfd98744b6b4 Mon Sep 17 00:00:00 2001 From: Pyrofab Date: Sat, 15 Jun 2024 14:05:11 +0200 Subject: [PATCH] Update to 1.21 --- build.gradle | 2 +- changelog.md | 4 +-- gradle.properties | 12 ++++----- gradle/libs.versions.toml | 6 ++--- .../impl/client/BlabberRpgDialogueScreen.java | 25 ++++++++++--------- .../java/org/ladysnake/blabber/Blabber.java | 2 +- .../blabber/impl/common/BlabberRegistrar.java | 2 +- .../blabber/impl/common/DialogueLoader.java | 2 +- .../DialogueIllustrationFakePlayer.java | 2 +- .../impl/mixin/EntitySelectorMixin.java | 2 +- .../babblings/tests/BlabberTestSuite.java | 14 +++++------ .../full_health.json | 0 .../holding_emerald.json | 0 13 files changed, 37 insertions(+), 36 deletions(-) rename src/testmod/resources/data/babblings/{predicates => predicate}/full_health.json (100%) rename src/testmod/resources/data/babblings/{predicates => predicate}/holding_emerald.json (100%) diff --git a/build.gradle b/build.gradle index 7fdc5799..8c718af1 100644 --- a/build.gradle +++ b/build.gradle @@ -80,7 +80,7 @@ dependencies { modLocalImplementation(libs.rei.api) compileOnly(sourceSets.reiDummy.output) modCompileOnly(libs.emi) - modLocalImplementation(libs.jei) + modCompileOnly(libs.jei) compileOnly(libs.mcAnnotations) diff --git a/changelog.md b/changelog.md index 04e9d02a..1c387f84 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,7 @@ ------------------------------------------------------ -Version 1.7.0-mc1.20.6 +Version 1.7.0 ------------------------------------------------------ -Updated to MC 1.20.6 +Updated to MC 1.21 **Mod Interactions** - JEI no longer appears on the dialogue screen with the RPG layout diff --git a/gradle.properties b/gradle.properties index 77e97775..beb6c12e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,24 +3,24 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties # check these on https://fabricmc.net/versions.html - minecraft_version=1.20.6 - yarn_mappings=1.20.6+build.1 + minecraft_version=1.21 + yarn_mappings=1.21+build.2 loader_version=0.15.11 java_version=21 # Mod Properties - mod_version = 1.7.0-mc1.20.6 + mod_version = 1.7.0 maven_group = org.ladysnake archives_base_name = blabber # Dependencies - fabric_version=0.98.0+1.20.6 + fabric_version=0.100.1+1.21 # Publishing license_header = LGPL curseforge_id = 565396 modrinth_id = 2oRMVFgd - curseforge_versions = 1.20.5; 1.20.6 + curseforge_versions = 1.21 cf_requirements = fabric-api cf_embeddeds = cardinal-components-api - release_type = beta + release_type = release diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 9ab74dda..556a415a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,10 +1,10 @@ [versions] -cca = "6.0.0" -elmendorf = "0.12.0" +cca = "6.1.0" +elmendorf = "0.13.0" emi = "1.1.6+1.20.6" fpa = "0.2-SNAPSHOT" mcAnnotations = "1.0" -modmenu = "10.0.0-beta.1" +modmenu = "11.0.0-beta.2" rei = "14.0.688" jei = "GE5LkM6l" # 18.0.0.62 diff --git a/src/client/java/org/ladysnake/blabber/impl/client/BlabberRpgDialogueScreen.java b/src/client/java/org/ladysnake/blabber/impl/client/BlabberRpgDialogueScreen.java index 937f1daf..104bc0f1 100644 --- a/src/client/java/org/ladysnake/blabber/impl/client/BlabberRpgDialogueScreen.java +++ b/src/client/java/org/ladysnake/blabber/impl/client/BlabberRpgDialogueScreen.java @@ -98,6 +98,7 @@ public void renderInGameBackground(DrawContext context) { if (i == selectedChoice) this.selectionIconMarginTop = ((strHeight - 9) / 2) - 4; y += strHeight + choiceGap; } + context.draw(); // Bottom background context.fillGradient(0, this.mainTextMinY - 20, this.width, this.mainTextMinY - TEXT_TOP_MARGIN, 0x00101010, 0xc0101010); context.fillGradient(0, this.mainTextMinY - TEXT_TOP_MARGIN, this.width, this.height, 0xc0101010, 0xd0101010); @@ -116,19 +117,19 @@ public static void fillHorizontalGradient(DrawContext context, int startX, int s float g1 = (float) ColorHelper.Argb.getGreen(colorEnd) / 255.0F; float b1 = (float) ColorHelper.Argb.getBlue(colorEnd) / 255.0F; Matrix4f matrix4f = context.getMatrices().peek().getPositionMatrix(); - vertexConsumer.vertex(matrix4f, (float)startX, (float)startY - verticalPadding, (float)z).color(r1, g1, b1, a1).next(); - vertexConsumer.vertex(matrix4f, (float)startX, (float)startY, (float)z).color(r0, g0, b0, a0).next(); - vertexConsumer.vertex(matrix4f, (float)endX, (float)startY, (float)z).color(r1, g1, b1, a1).next(); - vertexConsumer.vertex(matrix4f, (float)endX, (float)startY - verticalPadding, (float)z).color(r1, g1, b1, a1).next(); + vertexConsumer.vertex(matrix4f, (float)startX, (float)startY - verticalPadding, (float)z).color(r1, g1, b1, a1); + vertexConsumer.vertex(matrix4f, (float)startX, (float)startY, (float)z).color(r0, g0, b0, a0); + vertexConsumer.vertex(matrix4f, (float)endX, (float)startY, (float)z).color(r1, g1, b1, a1); + vertexConsumer.vertex(matrix4f, (float)endX, (float)startY - verticalPadding, (float)z).color(r1, g1, b1, a1); - vertexConsumer.vertex(matrix4f, (float)startX, (float)startY, (float)z).color(r0, g0, b0, a0).next(); - vertexConsumer.vertex(matrix4f, (float)startX, (float)endY, (float)z).color(r0, g0, b0, a0).next(); - vertexConsumer.vertex(matrix4f, (float)endX, (float)endY, (float)z).color(r1, g1, b1, a1).next(); - vertexConsumer.vertex(matrix4f, (float)endX, (float)startY, (float)z).color(r1, g1, b1, a1).next(); + vertexConsumer.vertex(matrix4f, (float)startX, (float)startY, (float)z).color(r0, g0, b0, a0); + vertexConsumer.vertex(matrix4f, (float)startX, (float)endY, (float)z).color(r0, g0, b0, a0); + vertexConsumer.vertex(matrix4f, (float)endX, (float)endY, (float)z).color(r1, g1, b1, a1); + vertexConsumer.vertex(matrix4f, (float)endX, (float)startY, (float)z).color(r1, g1, b1, a1); - vertexConsumer.vertex(matrix4f, (float)startX, (float)endY, (float)z).color(r0, g0, b0, a0).next(); - vertexConsumer.vertex(matrix4f, (float)startX, (float)endY + verticalPadding, (float)z).color(r1, g1, b1, a1).next(); - vertexConsumer.vertex(matrix4f, (float)endX, (float)endY + verticalPadding, (float)z).color(r1, g1, b1, a1).next(); - vertexConsumer.vertex(matrix4f, (float)endX, (float)endY, (float)z).color(r1, g1, b1, a1).next(); + vertexConsumer.vertex(matrix4f, (float)startX, (float)endY, (float)z).color(r0, g0, b0, a0); + vertexConsumer.vertex(matrix4f, (float)startX, (float)endY + verticalPadding, (float)z).color(r1, g1, b1, a1); + vertexConsumer.vertex(matrix4f, (float)endX, (float)endY + verticalPadding, (float)z).color(r1, g1, b1, a1); + vertexConsumer.vertex(matrix4f, (float)endX, (float)endY, (float)z).color(r1, g1, b1, a1); } } diff --git a/src/main/java/org/ladysnake/blabber/Blabber.java b/src/main/java/org/ladysnake/blabber/Blabber.java index 177958aa..74198245 100644 --- a/src/main/java/org/ladysnake/blabber/Blabber.java +++ b/src/main/java/org/ladysnake/blabber/Blabber.java @@ -53,7 +53,7 @@ public final class Blabber implements ModInitializer { public static final Logger LOGGER = LogManager.getLogger(MOD_ID); public static Identifier id(String path) { - return new Identifier(MOD_ID, path); + return Identifier.of(MOD_ID, path); } /** diff --git a/src/main/java/org/ladysnake/blabber/impl/common/BlabberRegistrar.java b/src/main/java/org/ladysnake/blabber/impl/common/BlabberRegistrar.java index bddb642d..32dfabd1 100644 --- a/src/main/java/org/ladysnake/blabber/impl/common/BlabberRegistrar.java +++ b/src/main/java/org/ladysnake/blabber/impl/common/BlabberRegistrar.java @@ -119,7 +119,7 @@ public static void init() { } public static CustomPayload.Id payloadId(String name) { - return CustomPayload.id(Blabber.MOD_ID + ":" + name); + return new CustomPayload.Id<>(Blabber.id(name)); } @Override diff --git a/src/main/java/org/ladysnake/blabber/impl/common/DialogueLoader.java b/src/main/java/org/ladysnake/blabber/impl/common/DialogueLoader.java index 55a7ab29..98cda67e 100644 --- a/src/main/java/org/ladysnake/blabber/impl/common/DialogueLoader.java +++ b/src/main/java/org/ladysnake/blabber/impl/common/DialogueLoader.java @@ -69,7 +69,7 @@ public CompletableFuture> load(ResourceManager manager.findResources(BLABBER_DIALOGUES_PATH, (res) -> res.getPath().endsWith(".json")).forEach((location, resource) -> { try (Reader in = new InputStreamReader(resource.getInputStream())) { JsonObject jsonObject = GSON.fromJson(in, JsonObject.class); - Identifier id = new Identifier(location.getNamespace(), location.getPath().substring(BLABBER_DIALOGUES_PATH.length() + 1, location.getPath().length() - 5)); + Identifier id = Identifier.of(location.getNamespace(), location.getPath().substring(BLABBER_DIALOGUES_PATH.length() + 1, location.getPath().length() - 5)); DialogueTemplate dialogue = DialogueTemplate.CODEC.parse(JsonOps.INSTANCE, jsonObject).getOrThrow(message -> { Blabber.LOGGER.error("(Blabber) Could not parse dialogue file from {}: {}", location, message); return new RuntimeException(message); diff --git a/src/main/java/org/ladysnake/blabber/impl/common/illustrations/entity/DialogueIllustrationFakePlayer.java b/src/main/java/org/ladysnake/blabber/impl/common/illustrations/entity/DialogueIllustrationFakePlayer.java index 3694528f..11f909e6 100644 --- a/src/main/java/org/ladysnake/blabber/impl/common/illustrations/entity/DialogueIllustrationFakePlayer.java +++ b/src/main/java/org/ladysnake/blabber/impl/common/illustrations/entity/DialogueIllustrationFakePlayer.java @@ -22,7 +22,7 @@ import com.mojang.serialization.DataResult; import com.mojang.serialization.MapCodec; import com.mojang.serialization.codecs.RecordCodecBuilder; -import net.minecraft.client.render.entity.PlayerModelPart; +import net.minecraft.entity.player.PlayerModelPart; import net.minecraft.nbt.NbtCompound; import net.minecraft.network.PacketByteBuf; import net.minecraft.network.codec.PacketCodec; diff --git a/src/main/java/org/ladysnake/blabber/impl/mixin/EntitySelectorMixin.java b/src/main/java/org/ladysnake/blabber/impl/mixin/EntitySelectorMixin.java index 1e24e60f..696a3d30 100644 --- a/src/main/java/org/ladysnake/blabber/impl/mixin/EntitySelectorMixin.java +++ b/src/main/java/org/ladysnake/blabber/impl/mixin/EntitySelectorMixin.java @@ -36,7 +36,7 @@ public abstract class EntitySelectorMixin implements BlabberEntitySelectorExt { @Unique private boolean blabber$interlocutorSelector; - @Inject(method = "getUnfilteredEntities", at = @At(value = "FIELD", target = "Lnet/minecraft/command/EntitySelector;senderOnly:Z"), cancellable = true) + @Inject(method = "getEntities(Lnet/minecraft/server/command/ServerCommandSource;)Ljava/util/List;", at = @At(value = "FIELD", target = "Lnet/minecraft/command/EntitySelector;senderOnly:Z"), cancellable = true) private void replaceSelf(ServerCommandSource source, CallbackInfoReturnable> cir) throws CommandSyntaxException { if (this.blabber$interlocutorSelector) { cir.setReturnValue(source.getPlayerOrThrow().getComponent(PlayerDialogueTracker.KEY).getInterlocutor().map(List::of).orElse(List.of())); diff --git a/src/testmod/java/org/ladysnake/babblings/tests/BlabberTestSuite.java b/src/testmod/java/org/ladysnake/babblings/tests/BlabberTestSuite.java index 0d1af710..06a0163e 100644 --- a/src/testmod/java/org/ladysnake/babblings/tests/BlabberTestSuite.java +++ b/src/testmod/java/org/ladysnake/babblings/tests/BlabberTestSuite.java @@ -33,7 +33,7 @@ public final class BlabberTestSuite implements FabricGameTest { @GameTest(templateName = EMPTY_STRUCTURE) public void nominal(TestContext ctx) { ServerPlayerEntity player = ctx.spawnServerPlayer(2, 2, 2); - Blabber.startDialogue(player, new Identifier("babblings:remnant_choice")); + Blabber.startDialogue(player, Identifier.of("babblings:remnant_choice")); GameTestUtil.assertTrue("startDialogue should work", player.currentScreenHandler instanceof DialogueScreenHandler handler && handler.isUnskippable() && handler.getCurrentStateKey().equals("introduction") && handler.getAvailableChoices().size() == 3); ((DialogueScreenHandler) player.currentScreenHandler).makeChoice(player, 0); GameTestUtil.assertTrue("choice 0 should work", player.currentScreenHandler instanceof DialogueScreenHandler handler && handler.getCurrentStateKey().equals("explanation") && handler.getAvailableChoices().size() == 1); @@ -52,10 +52,10 @@ public void nominal(TestContext ctx) { public void registryGetsPopulated(TestContext ctx) { GameTestUtil.assertTrue("dialogue registry should match expected state (was " + DialogueRegistry.getIds() + ")", DialogueRegistry.getIds().equals(Set.of( - new Identifier("babblings:illustration_tests"), - new Identifier("babblings:mountain_king"), - new Identifier("babblings:perception_check"), - new Identifier("babblings:remnant_choice") + Identifier.of("babblings:illustration_tests"), + Identifier.of("babblings:mountain_king"), + Identifier.of("babblings:perception_check"), + Identifier.of("babblings:remnant_choice") ) )); ctx.complete(); @@ -64,7 +64,7 @@ public void registryGetsPopulated(TestContext ctx) { @GameTest(templateName = EMPTY_STRUCTURE) public void availableChoicesCanGetSelected(TestContext ctx) { ServerPlayerEntity player = ctx.spawnServerPlayer(2, 2, 2); - Blabber.startDialogue(player, new Identifier("babblings:mountain_king"), player); + Blabber.startDialogue(player, Identifier.of("babblings:mountain_king"), player); ((DialogueScreenHandler) player.currentScreenHandler).makeChoice(player, 1); ((DialogueScreenHandler) player.currentScreenHandler).makeChoice(player, 0); GameTestUtil.assertTrue("dialogue should end", player.currentScreenHandler == player.playerScreenHandler); @@ -75,7 +75,7 @@ public void availableChoicesCanGetSelected(TestContext ctx) { public void unavailableChoicesCannotGetSelected(TestContext ctx) { ServerPlayerEntity player = ctx.spawnServerPlayer(2, 2, 2); player.setHealth(10f); - Blabber.startDialogue(player, new Identifier("babblings:mountain_king"), player); + Blabber.startDialogue(player, Identifier.of("babblings:mountain_king"), player); ((DialogueScreenHandler) player.currentScreenHandler).makeChoice(player, 1); GameTestUtil.assertTrue("dialogue should be at state bargain", player.currentScreenHandler instanceof DialogueScreenHandler handler && handler.getCurrentStateKey().equals("bargain")); ((DialogueScreenHandler) player.currentScreenHandler).makeChoice(player, 0); diff --git a/src/testmod/resources/data/babblings/predicates/full_health.json b/src/testmod/resources/data/babblings/predicate/full_health.json similarity index 100% rename from src/testmod/resources/data/babblings/predicates/full_health.json rename to src/testmod/resources/data/babblings/predicate/full_health.json diff --git a/src/testmod/resources/data/babblings/predicates/holding_emerald.json b/src/testmod/resources/data/babblings/predicate/holding_emerald.json similarity index 100% rename from src/testmod/resources/data/babblings/predicates/holding_emerald.json rename to src/testmod/resources/data/babblings/predicate/holding_emerald.json