Fix KubeJS crash

Closes #158
This commit is contained in:
thedarkcolour 2025-10-27 13:59:39 -07:00
parent f60d69b5da
commit 99db21f327
No known key found for this signature in database
GPG Key ID: 86B37B3575FD5976
4 changed files with 18 additions and 12 deletions

View File

@ -1,3 +1,6 @@
## Ex Deorum 3.10
- Now requires KubeJS 7.2 to fix incompatibility (#158)
## Ex Deorum 3.9
- Add `#exdeorum:hammer_fortune_blacklist` and `#exdeorum:compressed_hammer_fortune_blacklist` item tags, allowing pack makers to prevent Fortune from affecting a block's hammer or compressed hammer drops

View File

@ -6,17 +6,17 @@ org.gradle.parallel=true
org.gradle.caching=true
mc_version=1.21.1
neo_version=21.1.172
neo_version=21.1.213
neo_version_range=[21.1,)
loader_version_range=[4,)
jei_version=19.21.0.247
jei_version=19.25.0.323
emi_version=1.1.18
cloth_config_version=15.0.127
top_version=12.0.3-5
kubejs_version=2101.7.1-build.181
rhino_version=2101.2.7-build.74
kubejs_version=2101.7.2-build.296
rhino_version=2101.2.7-build.81
architectury_version=13.0.8
parchment_minecraft_version=1.21.1

View File

@ -1,6 +1,6 @@
/*
* Ex Deorum
* Copyright (c) 2024 thedarkcolour
* Copyright (c) 2025 thedarkcolour
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -20,7 +20,7 @@ package thedarkcolour.exdeorum.compat.kubejs;
import com.google.gson.JsonObject;
import com.mojang.serialization.JsonOps;
import dev.latvian.mods.kubejs.bindings.event.ServerEvents;
import dev.latvian.mods.kubejs.plugin.builtin.event.ServerEvents;
import dev.latvian.mods.kubejs.recipe.RecipesKubeEvent;
import dev.latvian.mods.kubejs.recipe.filter.RecipeFilterParseEvent;
import dev.latvian.mods.kubejs.recipe.match.ReplacementMatchInfo;
@ -81,7 +81,10 @@ class ExDeorumKubeJsBindings {
@HideFromJS
private static void removeDefaultRecipes(RecipesKubeEvent event, DeferredHolder<? extends RecipeType<?>, ? extends RecipeType<?>> recipeType) {
event.remove(null, (ctx, r) -> r.kjs$getType().equals(recipeType.getId()) && r.kjs$getOrCreateId().getNamespace().equals(ExDeorum.ID));
event.remove(null, (ctx) -> {
var r = ctx.recipe();
return r.kjs$getType().equals(recipeType.getId()) && r.kjs$getOrCreateId().getNamespace().equals(ExDeorum.ID);
});
}
@HideFromJS

View File

@ -1,6 +1,6 @@
/*
* Ex Deorum
* Copyright (c) 2024 thedarkcolour
* Copyright (c) 2025 thedarkcolour
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -18,17 +18,17 @@
package thedarkcolour.exdeorum.compat.kubejs;
import dev.latvian.mods.kubejs.core.RecipeLikeKJS;
import dev.latvian.mods.kubejs.recipe.KubeRecipe;
import dev.latvian.mods.kubejs.recipe.filter.RecipeFilter;
import dev.latvian.mods.kubejs.recipe.filter.RecipeMatchContext;
import dev.latvian.mods.kubejs.recipe.match.ItemMatch;
import dev.latvian.mods.kubejs.recipe.match.ReplacementMatchInfo;
import dev.latvian.mods.rhino.Context;
import thedarkcolour.exdeorum.recipe.sieve.SieveRecipe;
public record SieveMeshFilter(ReplacementMatchInfo info) implements RecipeFilter {
@Override
public boolean test(Context cx, RecipeLikeKJS r) {
return r instanceof KubeRecipe recipeJs && recipeJs.getOriginalRecipe() instanceof SieveRecipe sieveRecipe && this.info.match() instanceof ItemMatch match && match.matches(cx, sieveRecipe.mesh, false);
public boolean test(RecipeMatchContext ctx) {
var r = ctx.recipe();
return r instanceof KubeRecipe recipeJs && recipeJs.getOriginalRecipe() instanceof SieveRecipe sieveRecipe && this.info.match() instanceof ItemMatch match && match.matches(ctx, sieveRecipe.mesh, false);
}
}