-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fire a KJS event for the FFS CustomFilterEvent.MATCH_ITEM event
- Loading branch information
Showing
7 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
.../src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/CustomFilterEventJS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/FFSEvents.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} |
23 changes: 23 additions & 0 deletions
23
common/src/main/java/dev/ftb/mods/ftbxmodcompat/ftbfiltersystem/kubejs/FFSKubeJSPlugin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
dev.ftb.mods.ftbxmodcompat.ftbteams.kubejs.FTBTeamsKubeJSPlugin ftbteams | ||
dev.ftb.mods.ftbxmodcompat.ftbfiltersystem.kubejs.FFSKubeJSPlugin ftbfiltersystem |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters