diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d07234..63791b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Kube Utils Changelog -## [20.4.0] +## [21.1.0] ### Changed -- Updated to 1.20.4 +- Updated to 1.21.1 thanks to [@Saereth](https://github.com/Saereth) diff --git a/build.gradle b/build.gradle index ca4205b..672b7ac 100644 --- a/build.gradle +++ b/build.gradle @@ -59,9 +59,10 @@ repositories { maven { name = "Kubejs" - url "https://maven.saps.dev/minecraft" + url "https://maven.latvian.dev/releases" content { includeGroup "dev.latvian.mods" + includeGroup "dev.latvian.apps" } } diff --git a/src/main/java/pro/mikey/kubeutils/KubeUtils.java b/src/main/java/pro/mikey/kubeutils/KubeUtils.java index 4cc3498..fda0720 100644 --- a/src/main/java/pro/mikey/kubeutils/KubeUtils.java +++ b/src/main/java/pro/mikey/kubeutils/KubeUtils.java @@ -1,5 +1,6 @@ package pro.mikey.kubeutils; +import net.minecraft.resources.ResourceLocation; import net.neoforged.fml.common.Mod; import net.neoforged.neoforge.common.NeoForge; import org.apache.logging.log4j.LogManager; @@ -19,4 +20,8 @@ public KubeUtils() { public static String getId() { return MOD_ID; } + + public static ResourceLocation id(String path) { + return ResourceLocation.fromNamespaceAndPath(MOD_ID, path); + } } diff --git a/src/main/java/pro/mikey/kubeutils/kubejs/modules/LevelKu.java b/src/main/java/pro/mikey/kubeutils/kubejs/modules/LevelKu.java index 6c53cd3..e63d943 100644 --- a/src/main/java/pro/mikey/kubeutils/kubejs/modules/LevelKu.java +++ b/src/main/java/pro/mikey/kubeutils/kubejs/modules/LevelKu.java @@ -24,7 +24,7 @@ import java.util.function.Predicate; public class LevelKu { - private static final ResourceLocation UNKNOWN = ResourceLocation.tryParse(KubeUtils.getId() + ":unknown"); + private static final ResourceLocation UNKNOWN = KubeUtils.id("unknown"); private final ServerLevel level; public LevelKu(ServerLevel level) { @@ -40,6 +40,9 @@ public LevelKu(ServerLevel level) { */ public void spawnStructure(String structureFile, BlockPos spawnLocation) { ResourceLocation structureLocation = ResourceLocation.tryParse(structureFile); + if (structureLocation == null) { + return; + } Optional structureTemplate = level.getServer().getStructureManager().get(structureLocation); structureTemplate.ifPresent(e -> e.placeInWorld(level, spawnLocation, spawnLocation, new StructurePlaceSettings(), level.random, Block.UPDATE_ALL)); diff --git a/src/main/java/pro/mikey/kubeutils/kubejs/modules/PlayerKu.java b/src/main/java/pro/mikey/kubeutils/kubejs/modules/PlayerKu.java index 95e6757..eeae6fb 100644 --- a/src/main/java/pro/mikey/kubeutils/kubejs/modules/PlayerKu.java +++ b/src/main/java/pro/mikey/kubeutils/kubejs/modules/PlayerKu.java @@ -1,12 +1,12 @@ package pro.mikey.kubeutils.kubejs.modules; +import dev.latvian.mods.kubejs.color.Color; import dev.latvian.mods.kubejs.core.ComponentKJS; import dev.latvian.mods.kubejs.core.EntityKJS; import net.minecraft.client.player.LocalPlayer; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; import net.minecraft.world.entity.player.Player; -import net.neoforged.neoforge.client.event.RenderTooltipEvent; import pro.mikey.kubeutils.kubejs.events.PlayerStarterItems; @@ -47,20 +47,18 @@ public void showActionBarComponent(Component component) { public void showActionBar(String text) { this.player.displayClientMessage(Component.literal(text), true); } - //TODO: Fix showActionBar functions to work with new KubeJS API -/* - public void showActionBar(String text, RenderTooltipEvent.Color color, boolean bold, boolean italic) { - this.player.displayClientMessage(((ComponentKJS) ((((ComponentKJS) ((ComponentKJS) Component.literal(text)).kjs$color((KubeColor) color)).kjs$bold(bold)))).kjs$italic(italic), true); + + public void showActionBar(String text, Color color, boolean bold, boolean italic) { + this.player.displayClientMessage(((ComponentKJS) ((((ComponentKJS) ((ComponentKJS) Component.literal(text)).kjs$color(color)).kjs$bold(bold)))).kjs$italic(italic), true); } - public void showActionBar(String text, RenderTooltipEvent.Color color) { + public void showActionBar(String text, Color color) { this.showActionBar(text, color, false, false); } - public void showActionBar(String text, RenderTooltipEvent.Color color, boolean bold) { + public void showActionBar(String text, Color color, boolean bold) { this.showActionBar(text, color, bold, false); } - */ //#endregion /** diff --git a/src/main/java/pro/mikey/kubeutils/kubejs/modules/UtilsKu.java b/src/main/java/pro/mikey/kubeutils/kubejs/modules/UtilsKu.java index 4cf3a87..e71d340 100644 --- a/src/main/java/pro/mikey/kubeutils/kubejs/modules/UtilsKu.java +++ b/src/main/java/pro/mikey/kubeutils/kubejs/modules/UtilsKu.java @@ -14,8 +14,8 @@ import net.minecraft.world.level.material.Fluids; public class UtilsKu { - private static final ResourceLocation EMPTY_LOCATION = ResourceLocation.tryParse("minecraft:empty"); - private static final ResourceLocation AIR_LOCATION = ResourceLocation.tryParse("minecraft:air"); + private static final ResourceLocation EMPTY_LOCATION = ResourceLocation.withDefaultNamespace("empty"); + private static final ResourceLocation AIR_LOCATION = ResourceLocation.withDefaultNamespace("air"); public UtilsKu() { } diff --git a/src/main/resources/META-INF/neoforge.mods.toml b/src/main/resources/META-INF/neoforge.mods.toml index 1b4f568..e5c345e 100644 --- a/src/main/resources/META-INF/neoforge.mods.toml +++ b/src/main/resources/META-INF/neoforge.mods.toml @@ -14,7 +14,7 @@ Provides extra methods and tools to the standard KubeJS mod [[dependencies.kubeutils]] modId = "neoforge" required = true -versionRange = "[${neo_version_range}" +versionRange = "[${neoforge_base_two},)" ordering = "NONE" side = "BOTH"