From e293687fce4727737143d3b98885004f259ae9cb Mon Sep 17 00:00:00 2001 From: pietro-lopes <97140255+pietro-lopes@users.noreply.github.com> Date: Mon, 20 May 2024 16:54:02 -0300 Subject: [PATCH 1/2] fix registry to persist script order (#810) --- .../java/dev/latvian/mods/kubejs/event/EventHandler.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/dev/latvian/mods/kubejs/event/EventHandler.java b/common/src/main/java/dev/latvian/mods/kubejs/event/EventHandler.java index 47cf3d4db..f98e8fe6a 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/event/EventHandler.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/event/EventHandler.java @@ -13,8 +13,8 @@ import org.jetbrains.annotations.Nullable; import java.util.HashMap; -import java.util.HashSet; -import java.util.IdentityHashMap; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.Map; import java.util.Set; import java.util.function.Consumer; @@ -141,7 +141,7 @@ public void listen(ScriptType type, @Nullable Object extraId, IEventHandler hand map = eventContainers; } else { if (extraEventContainers == null) { - extraEventContainers = extra.identity ? new IdentityHashMap<>() : new HashMap<>(); + extraEventContainers = extra.identity ? new LinkedHashMap<>() : new HashMap<>(); } map = extraEventContainers.get(extraId); @@ -359,7 +359,7 @@ public Set findUniqueExtraIds(ScriptType type) { return Set.of(); } - var set = new HashSet<>(); + var set = new LinkedHashSet<>(); forEachListener(type, c -> { if (c.extraId != null) { From 73dea2b7cfb34f56fcad31f5007383d347b5fa02 Mon Sep 17 00:00:00 2001 From: pietro-lopes <97140255+pietro-lopes@users.noreply.github.com> Date: Mon, 20 May 2024 17:00:00 -0300 Subject: [PATCH 2/2] enables customizable bucket models to fluid builder (#830) --- .../kubejs/fluid/FluidBucketItemBuilder.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/dev/latvian/mods/kubejs/fluid/FluidBucketItemBuilder.java b/common/src/main/java/dev/latvian/mods/kubejs/fluid/FluidBucketItemBuilder.java index 79abced03..60f6efad2 100644 --- a/common/src/main/java/dev/latvian/mods/kubejs/fluid/FluidBucketItemBuilder.java +++ b/common/src/main/java/dev/latvian/mods/kubejs/fluid/FluidBucketItemBuilder.java @@ -21,6 +21,21 @@ public BucketItem createObject() { @Override public void generateAssetJsons(AssetJsonGenerator generator) { - generator.itemModel(id, m -> m.parent("kubejs:item/generated_bucket")); + if (modelJson != null) { + generator.json(AssetJsonGenerator.asItemModelLocation(id), modelJson); + return; + } + + generator.itemModel(id, m -> { + if (!parentModel.isEmpty()) { + m.parent(parentModel); + } else { + m.parent("kubejs:item/generated_bucket"); + } + + if (textureJson.size() > 0) { + m.textures(textureJson); + } + }); } }