From d4dd070613811e9c98886c20fe890e8f31e821d4 Mon Sep 17 00:00:00 2001 From: okx-code Date: Sun, 18 Aug 2024 17:36:14 +0100 Subject: [PATCH] Update to 1.20.6 --- build.gradle | 4 ++-- .../gui/screen/CompactedConfigScreen.java | 2 +- .../civmodern/common/macro/IceRoadMacro.java | 7 ++++--- .../common/mixins/ItemStackMixin.java | 19 ++++++------------- .../sh/okx/civmodern/common/radar/Radar.java | 2 +- fabric/src/main/resources/fabric.mod.json | 2 +- gradle.properties | 12 ++++++------ 7 files changed, 21 insertions(+), 27 deletions(-) diff --git a/build.gradle b/build.gradle index c45fdca..1efd4a5 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ plugins { id("architectury-plugin") version "3.4-SNAPSHOT" - id("dev.architectury.loom") version "1.5-SNAPSHOT" apply false + id("dev.architectury.loom") version "1.7-SNAPSHOT" apply false } architectury { @@ -50,7 +50,7 @@ allprojects { tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" - options.release = 17 + options.release = 21 } java { diff --git a/common/src/main/java/sh/okx/civmodern/common/gui/screen/CompactedConfigScreen.java b/common/src/main/java/sh/okx/civmodern/common/gui/screen/CompactedConfigScreen.java index e656c6d..d7daa89 100644 --- a/common/src/main/java/sh/okx/civmodern/common/gui/screen/CompactedConfigScreen.java +++ b/common/src/main/java/sh/okx/civmodern/common/gui/screen/CompactedConfigScreen.java @@ -42,7 +42,7 @@ public class CompactedConfigScreen extends Screen { display.put("Lore", lore); tag.put("display", display); item.put("tag", tag); - ITEM = ItemStack.of(item); + ITEM = ItemStack.parse(Minecraft.getInstance().level.registryAccess(), item).get(); } private final AbstractCivModernMod mod; diff --git a/common/src/main/java/sh/okx/civmodern/common/macro/IceRoadMacro.java b/common/src/main/java/sh/okx/civmodern/common/macro/IceRoadMacro.java index a3b08a6..5d3fb86 100644 --- a/common/src/main/java/sh/okx/civmodern/common/macro/IceRoadMacro.java +++ b/common/src/main/java/sh/okx/civmodern/common/macro/IceRoadMacro.java @@ -3,6 +3,7 @@ import com.google.common.eventbus.Subscribe; import net.minecraft.client.KeyMapping; import net.minecraft.client.Minecraft; +import net.minecraft.core.component.DataComponents; import net.minecraft.world.food.FoodProperties; import net.minecraft.world.item.ItemStack; import org.jetbrains.annotations.NotNull; @@ -108,9 +109,9 @@ private void tick( private boolean tryEat(ItemStack item) { Minecraft mc = Minecraft.getInstance(); - FoodProperties food = item.getItem().getFoodProperties(); - if (food != null && food.getNutrition() > 0) { - if (mc.player.getFoodData().getFoodLevel() + food.getNutrition() <= 20) { + FoodProperties food = item.getItem().components().get(DataComponents.FOOD); + if (food != null && food.nutrition() > 0) { + if (mc.player.getFoodData().getFoodLevel() + food.nutrition() <= 20) { return true; } } diff --git a/common/src/main/java/sh/okx/civmodern/common/mixins/ItemStackMixin.java b/common/src/main/java/sh/okx/civmodern/common/mixins/ItemStackMixin.java index 1c234ad..6ec263e 100644 --- a/common/src/main/java/sh/okx/civmodern/common/mixins/ItemStackMixin.java +++ b/common/src/main/java/sh/okx/civmodern/common/mixins/ItemStackMixin.java @@ -1,11 +1,13 @@ package sh.okx.civmodern.common.mixins; +import net.minecraft.core.component.DataComponents; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; import net.minecraft.nbt.Tag; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Style; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.component.ItemLore; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Unique; import sh.okx.civmodern.common.features.ExtendedItemStack; @@ -26,21 +28,12 @@ public boolean isMarkedAsCompacted() { @Unique private boolean civmodern$isCompacted() { - final CompoundTag itemTag = ((ItemStack) (Object) this).getTag(); - if (itemTag == null) { + ItemLore lore = ((ItemStack) (Object) this).getComponents().get(DataComponents.LORE); + Component name = ((ItemStack) (Object) this).getComponents().get(DataComponents.ITEM_NAME); + if (lore == null || name == null) { return false; } - if (!(itemTag.get(ItemStack.TAG_DISPLAY) instanceof final CompoundTag displayTag)) { - return false; - } - if (!(displayTag.get(ItemStack.TAG_LORE) instanceof final ListTag loreTag)) { - return false; - } - if (loreTag.getElementType() != Tag.TAG_STRING) { - return false; - } - for (final Tag element : loreTag) { - final Component line = Component.Serializer.fromJson(element.getAsString()); + for (Component line : lore.lines()) { if (line == null) { continue; } diff --git a/common/src/main/java/sh/okx/civmodern/common/radar/Radar.java b/common/src/main/java/sh/okx/civmodern/common/radar/Radar.java index 2f1653e..b1fb4db 100644 --- a/common/src/main/java/sh/okx/civmodern/common/radar/Radar.java +++ b/common/src/main/java/sh/okx/civmodern/common/radar/Radar.java @@ -290,7 +290,7 @@ private void renderEntity(GuiGraphics guiGraphics, Player player, Entity entity, } BakedModel bakedModel = Minecraft.getInstance().getItemRenderer().getModel(item, player.level(), player, 0); guiGraphics.pose().scale(config.getIconSize(), config.getIconSize(), 1); - guiGraphics.pose().mulPoseMatrix(new Matrix4f().scaling(1.0f, -1.0f, 1.0f)); + guiGraphics.pose().mulPose(new Matrix4f().scaling(1.0f, -1.0f, 1.0f)); guiGraphics.pose().scale(16.0f, 16.0f, 16.0f); boolean notUseBlockLight = !bakedModel.usesBlockLight(); diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index 03dec00..8c6366e 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -30,4 +30,4 @@ "mixins": [ "civmodern.mixins.json" ] -} \ No newline at end of file +} diff --git a/gradle.properties b/gradle.properties index d6d8df8..edb8215 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,21 +2,21 @@ org.gradle.jvmargs=-Xmx3072M archives_base_name=civmodern maven_group=sh.okx.civmodern -mod_version=1.6.3 +mod_version=1.6.4 mod_description=Civ Modern copyright_licence=GPLv3 mod_home_url=https://github.com/okx-code/civmodern mod_source_url=https://github.com/okx-code/civmodern mod_issues_url=https://github.com/okx-code/civmodern/issues -minecraft_version=1.20.4 +minecraft_version=1.20.6 architectury_version=11.1.13 # https://parchmentmc.org/docs/getting-started -parchment_version=2024.04.14 +parchment_version=2024.06.16 enabled_platforms=fabric,forge # https://fabricmc.net/versions.html -fabric_loader_version=0.15.7 -fabric_api_version=0.96.4+1.20.4 +fabric_loader_version=0.15.11 +fabric_api_version=0.100.8+1.20.6 -forge_version=1.20.4-49.0.31 +forge_version=1.20.6-50.1.0