Skip to content

Commit

Permalink
Fixed components being required in some web endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
LatvianModder committed Dec 22, 2024
1 parent 7163a1a commit 5162282
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public ResourceLocation id() {
}

public DataComponentPatch components(DynamicOps<Tag> 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 + "]");
}
}

0 comments on commit 5162282

Please sign in to comment.