-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Frankenstein some deprecated methods back into EventHandler
(KubeJS is too powerful to let this API break!)
- Loading branch information
1 parent
1c16825
commit 38c8f89
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/EventHandlerBridgeMixin.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,17 @@ | ||
package dev.latvian.mods.kubejs.core.mixin.common; | ||
|
||
import dev.latvian.mods.kubejs.event.EventHandler; | ||
import dev.latvian.mods.kubejs.event.EventJS; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@SuppressWarnings("ReferenceToMixin") | ||
@Mixin(value = EventHandler.class, remap = false) | ||
public abstract class EventHandlerBridgeMixin { | ||
public EventHandler cancelable() { | ||
return ((EventHandlerInvoker) this).callHasResult(); | ||
} | ||
|
||
public boolean post(Object extraId, EventJS event) { | ||
return ((EventHandlerInvoker) this).callPost(event, extraId).interruptFalse(); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
common/src/main/java/dev/latvian/mods/kubejs/core/mixin/common/EventHandlerInvoker.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,18 @@ | ||
package dev.latvian.mods.kubejs.core.mixin.common; | ||
|
||
import dev.latvian.mods.kubejs.event.EventHandler; | ||
import dev.latvian.mods.kubejs.event.EventJS; | ||
import dev.latvian.mods.kubejs.event.EventResult; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Invoker; | ||
|
||
@Mixin(value = EventHandler.class, remap = false) | ||
public interface EventHandlerInvoker { | ||
|
||
@Invoker(remap = false) | ||
EventHandler callHasResult(); | ||
|
||
@Invoker(remap = false) | ||
EventResult callPost(EventJS event, @Nullable Object extraId); | ||
} |
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