Skip to content

Commit

Permalink
Update to 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyrofab committed Jun 15, 2024
1 parent f8b872d commit 24b5c1a
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 36 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/ladysnake/blabber/Blabber.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ public static void init() {
}

public static <T extends CustomPayload> CustomPayload.Id<T> payloadId(String name) {
return CustomPayload.id(Blabber.MOD_ID + ":" + name);
return new CustomPayload.Id<>(Blabber.id(name));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public CompletableFuture<Map<Identifier, DialogueTemplate>> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<List<? extends Entity>> cir) throws CommandSyntaxException {
if (this.blabber$interlocutorSelector) {
cir.setReturnValue(source.getPlayerOrThrow().getComponent(PlayerDialogueTracker.KEY).getInterlocutor().map(List::of).orElse(List.of()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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();
Expand All @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 24b5c1a

Please sign in to comment.