diff --git a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/CustomFilterEventJS.java b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/CustomFilterEventJS.java new file mode 100644 index 0000000..9207253 --- /dev/null +++ b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/CustomFilterEventJS.java @@ -0,0 +1,22 @@ +package dev.ftb.mods.ftbxmodcompat.ftbfiltersystem.kubejs; + +import dev.latvian.mods.kubejs.event.EventJS; +import net.minecraft.world.item.ItemStack; + +public class CustomFilterEventJS extends EventJS { + private final ItemStack stack; + private final String data; + + public CustomFilterEventJS(ItemStack stack, String data) { + this.stack = stack; + this.data = data; + } + + public ItemStack getStack() { + return stack; + } + + public String getData() { + return data; + } +} diff --git a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/FFSEvents.java b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/FFSEvents.java new file mode 100644 index 0000000..89fcf65 --- /dev/null +++ b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/FFSEvents.java @@ -0,0 +1,11 @@ +package dev.ftb.mods.ftbxmodcompat.ftbfiltersystem.kubejs; + +import dev.latvian.mods.kubejs.event.EventGroup; +import dev.latvian.mods.kubejs.event.EventHandler; +import dev.latvian.mods.kubejs.event.Extra; + +public interface FFSEvents { + EventGroup EVENT_GROUP = EventGroup.of("FTBFilterSystemEvents"); + + EventHandler CUSTOM_FILTER = EVENT_GROUP.server("customFilter", () -> CustomFilterEventJS.class).extra(Extra.STRING).hasResult(); +} diff --git a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/FFSKubeJSPlugin.java b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/FFSKubeJSPlugin.java new file mode 100644 index 0000000..d7a11f7 --- /dev/null +++ b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/FFSKubeJSPlugin.java @@ -0,0 +1,23 @@ +package dev.ftb.mods.ftbxmodcompat.ftbfiltersystem.kubejs; + +import dev.architectury.event.EventResult; +import dev.ftb.mods.ftbfiltersystem.api.event.CustomFilterEvent; +import dev.latvian.mods.kubejs.KubeJSPlugin; +import dev.latvian.mods.kubejs.script.ScriptType; +import net.minecraft.world.item.ItemStack; + +public class FFSKubeJSPlugin extends KubeJSPlugin { + @Override + public void init() { + CustomFilterEvent.MATCH_ITEM.register(FFSKubeJSPlugin::onCustomFilter); + } + + @Override + public void registerEvents() { + FFSEvents.EVENT_GROUP.register(); + } + + private static EventResult onCustomFilter(ItemStack stack, String eventId, String extraData) { + return FFSEvents.CUSTOM_FILTER.post(ScriptType.SERVER, eventId, new CustomFilterEventJS(stack, extraData)).arch(); + } +} diff --git a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/kubejs/KubeJSIntegration.java b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/kubejs/KubeJSIntegration.java index 218093f..aabdc44 100644 --- a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/kubejs/KubeJSIntegration.java +++ b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/kubejs/KubeJSIntegration.java @@ -17,6 +17,7 @@ import net.minecraft.world.entity.player.Player; public class KubeJSIntegration extends KubeJSPlugin { + @Override public void init() { CustomTaskEvent.EVENT.register(KubeJSIntegration::onCustomTask); CustomRewardEvent.EVENT.register(KubeJSIntegration::onCustomReward); diff --git a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/rei/FTBQuestsREIIntegration.java b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/rei/FTBQuestsREIIntegration.java index 0aceb38..db76d7c 100644 --- a/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/rei/FTBQuestsREIIntegration.java +++ b/common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbquests/rei/FTBQuestsREIIntegration.java @@ -3,17 +3,23 @@ import dev.ftb.mods.ftbxmodcompat.FTBXModCompat; import dev.ftb.mods.ftbxmodcompat.ftbquests.recipemod_common.WrappedLootCrate; import dev.ftb.mods.ftbxmodcompat.ftbquests.recipemod_common.WrappedQuest; +import me.shedaniel.math.Rectangle; import me.shedaniel.rei.api.client.entry.filtering.base.BasicFilteringRule; import me.shedaniel.rei.api.client.plugins.REIClientPlugin; import me.shedaniel.rei.api.client.registry.category.CategoryRegistry; import me.shedaniel.rei.api.client.registry.display.DisplayRegistry; +import me.shedaniel.rei.api.client.registry.screen.ExclusionZones; +import me.shedaniel.rei.api.client.registry.screen.ExclusionZonesProvider; import me.shedaniel.rei.api.client.view.ViewSearchBuilder; import me.shedaniel.rei.api.common.entry.EntryStack; import me.shedaniel.rei.api.common.entry.type.EntryDefinition; import me.shedaniel.rei.api.common.entry.type.EntryTypeRegistry; import me.shedaniel.rei.api.common.entry.type.VanillaEntryTypes; +import net.minecraft.client.gui.screens.Screen; import net.minecraft.world.item.ItemStack; +import java.util.Collection; + public class FTBQuestsREIIntegration implements REIClientPlugin { private static BasicFilteringRule.MarkDirty cratesChanged; diff --git a/common/src/main/resources/kubejs.plugins.txt b/common/src/main/resources/kubejs.plugins.txt index 47d94d3..b5f5441 100644 --- a/common/src/main/resources/kubejs.plugins.txt +++ b/common/src/main/resources/kubejs.plugins.txt @@ -1,3 +1,4 @@ dev.ftb.mods.ftbxmodcompat.ftbquests.kubejs.KubeJSIntegration ftbquests dev.ftb.mods.ftbxmodcompat.ftbchunks.kubejs.FTBChunksKubeJSPlugin ftbchunks -dev.ftb.mods.ftbxmodcompat.ftbteams.kubejs.FTBTeamsKubeJSPlugin ftbteams \ No newline at end of file +dev.ftb.mods.ftbxmodcompat.ftbteams.kubejs.FTBTeamsKubeJSPlugin ftbteams +dev.ftb.mods.ftbxmodcompat.ftbfiltersystem.kubejs.FFSKubeJSPlugin ftbfiltersystem \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index c7dd600..9088737 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ ftb_chunks_version=2001.2.0 ftb_ranks_version=2001.1.3 ftb_essentials_version=2001.2.0 ftb_teams_version=2001.1.4 -ftb_filter_system_version=1.0.1-SNAPSHOT +ftb_filter_system_version=1.0.2-SNAPSHOT itemfilters_version=2001.1.0-build.55 kubejs_version=2001.6.3-build.18