diff --git a/src/main/java/dev/latvian/mods/kubejs/client/LangKubeEvent.java b/src/main/java/dev/latvian/mods/kubejs/client/LangKubeEvent.java index be077c453..f48b0397f 100644 --- a/src/main/java/dev/latvian/mods/kubejs/client/LangKubeEvent.java +++ b/src/main/java/dev/latvian/mods/kubejs/client/LangKubeEvent.java @@ -1,6 +1,7 @@ package dev.latvian.mods.kubejs.client; import dev.latvian.mods.kubejs.event.KubeEvent; +import dev.latvian.mods.kubejs.util.KubeResourceLocation; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.block.Block; @@ -64,4 +65,10 @@ public void renameEntity(ResourceLocation id, String name) { public void renameBiome(ResourceLocation id, String name) { add(id.getNamespace(), "biome." + id.getNamespace() + "." + id.getPath().replace('/', '.'), name); } + + public void painting(KubeResourceLocation paintingId, String title, String author) { + var id = "painting." + paintingId.wrapped().getNamespace() + "." + paintingId.wrapped().getPath(); + add(paintingId.wrapped().getNamespace(), id + ".title", title); + add(paintingId.wrapped().getNamespace(), id + ".author", author); + } } diff --git a/src/main/java/dev/latvian/mods/kubejs/core/MinecraftEnvironmentKJS.java b/src/main/java/dev/latvian/mods/kubejs/core/MinecraftEnvironmentKJS.java index 850755608..2f1f6b976 100644 --- a/src/main/java/dev/latvian/mods/kubejs/core/MinecraftEnvironmentKJS.java +++ b/src/main/java/dev/latvian/mods/kubejs/core/MinecraftEnvironmentKJS.java @@ -14,15 +14,15 @@ public interface MinecraftEnvironmentKJS extends MessageSenderKJS { return kjs$getScheduledEvents().schedule(timer, false, callback); } - default ScheduledEvents.ScheduledEvent kjs$scheduleInTicks(long ticks, ScheduledEvents.Callback callback) { - return kjs$getScheduledEvents().schedule(TickDuration.of(ticks), false, callback); + default ScheduledEvents.ScheduledEvent kjs$scheduleInTicks(TickDuration ticks, ScheduledEvents.Callback callback) { + return kjs$getScheduledEvents().schedule(ticks, false, callback); } default ScheduledEvents.ScheduledEvent kjs$scheduleRepeating(TemporalAmount timer, ScheduledEvents.Callback callback) { return kjs$getScheduledEvents().schedule(timer, false, callback); } - default ScheduledEvents.ScheduledEvent kjs$scheduleRepeatingInTicks(long ticks, ScheduledEvents.Callback callback) { - return kjs$getScheduledEvents().schedule(TickDuration.of(ticks), true, callback); + default ScheduledEvents.ScheduledEvent kjs$scheduleRepeatingInTicks(TickDuration ticks, ScheduledEvents.Callback callback) { + return kjs$getScheduledEvents().schedule(ticks, true, callback); } } diff --git a/src/main/java/dev/latvian/mods/kubejs/web/KJSHTTPRequest.java b/src/main/java/dev/latvian/mods/kubejs/web/KJSHTTPRequest.java index 110d5e4eb..12e08bb01 100644 --- a/src/main/java/dev/latvian/mods/kubejs/web/KJSHTTPRequest.java +++ b/src/main/java/dev/latvian/mods/kubejs/web/KJSHTTPRequest.java @@ -39,6 +39,7 @@ public ResourceLocation id() { } public DataComponentPatch components(DynamicOps ops) throws CommandSyntaxException { - return DataComponentWrapper.patchOrEmptyOf(ops, "[" + query().get("components").asString() + "]"); + var str = query("components").asString(); + return str.isEmpty() ? DataComponentPatch.EMPTY : DataComponentWrapper.patchOrEmptyOf(ops, "[" + str + "]"); } }