-
Notifications
You must be signed in to change notification settings - Fork 35
Update to support EventBus7 #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Chidoziealways
wants to merge
9
commits into
thedarkcolour:5.x
Choose a base branch
from
Chidoziealways:5.x
base: 5.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
ee773cb
Update to support EventBus7
Chidoziealways bad92ba
Finished Updating to Kotlin P1
Chidoziealways f908362
Finished Updating to Kotlin P2
Chidoziealways 19a2464
Finished Updating to Kotlin P3 FINISHED
Chidoziealways 9233794
Made required changes
Chidoziealways 1eac749
removed unnecesary gradle properties
Chidoziealways 3be40d8
Continued update
Chidoziealways 02e70ea
Finished Update to 1.21.7 EventBus 7 Forge 1.21.7-57.0.2
Chidoziealways 337172a
FINISHED UPDATING TO 1.21.7-57.0.2 ADDED REAL SUPPORT FOR EventBusSUb…
Chidoziealways File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
|
@@ -12,5 +12,5 @@ min_mc_version = 1.20.6 | |
unsupported_mc_version = 1.22 | ||
|
||
# KOTLIN FOR FORGE VERSION | ||
kff_version=5.9.0 | ||
kff_max_version=6.0.0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be 7.0.0, not 6.1.0 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've changed that |
||
kff_version=6.0.0 | ||
kff_max_version=7.0.0 |
This file contains hidden or 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
4 changes: 2 additions & 2 deletions
4
src/fakecraft/java/net/minecraftforge/common/MinecraftForge.java
This file contains hidden or 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,7 +1,7 @@ | ||
package net.minecraftforge.common; | ||
|
||
import net.minecraftforge.eventbus.api.IEventBus; | ||
import net.minecraftforge.eventbus.api.bus.BusGroup; | ||
|
||
public class MinecraftForge { | ||
public static final IEventBus EVENT_BUS = null; | ||
public static final BusGroup EVENT_BUS = null; | ||
} |
51 changes: 51 additions & 0 deletions
51
src/kfflang/forge/kotlin/thedarkcolour/common/KotlinMod.kt
This file contains hidden or 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,51 @@ | ||
package thedarkcolour.common | ||
|
||
import net.minecraftforge.api.distmarker.Dist | ||
import net.minecraftforge.eventbus.api.bus.BusGroup | ||
import net.minecraftforge.fml.Bindings | ||
import net.minecraftforge.fml.common.Mod | ||
import thedarkcolour.kotlinforforge.KotlinModLoadingContext | ||
import java.util.function.Supplier | ||
|
||
/** | ||
* This defines a Kotlin Mod Class | ||
* Any class found with this annotation applied will be loaded as a Mod. The instance that is loaded will | ||
* represent the mod to other Mods in the system. It will be sent various subclasses of [ModLifecycleEvent] | ||
* at pre-defined times during the loading of the game. | ||
* @author Chidoziealways | ||
* @since 6.0.0 | ||
*/ | ||
|
||
@Retention(AnnotationRetention.RUNTIME) | ||
@Target(AnnotationTarget.CLASS) | ||
public annotation class KotlinMod(val value: String) { | ||
|
||
public annotation class KotlinEventBusSubscriber( | ||
val value: Array<Dist> = [Dist.CLIENT, Dist.DEDICATED_SERVER], | ||
val modId: String = "", | ||
val bus: KotlinBus = KotlinBus.BOTH | ||
) { | ||
} | ||
} | ||
|
||
public enum class KotlinBus(public val eventBusSupplier: Supplier<BusGroup?>) { | ||
/** | ||
* The main BusGroup that most game events are fired on. | ||
*/ | ||
FORGE(Bindings.getForgeBus()), | ||
|
||
/** | ||
* The Mod-Specific event BusGroup, usually for mod lifecycle events. | ||
* @see KotlinModLoadingContext.getKBusGroup() | ||
*/ | ||
MOD({ KotlinModLoadingContext.get().getKBusGroup() }), | ||
|
||
/** | ||
* Both the [FORGE] and [MOD] buses. This is slower to register events in your class but | ||
* allows you to listen to events from different BusGroup types without needing separate classes annotated | ||
* with [thedarkcolour.common.KotlinMod.KotlinEventBusSubscriber]. | ||
*/ | ||
BOTH({null}); | ||
|
||
public fun bus(): Supplier<BusGroup?> = eventBusSupplier | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why all of these random Gradle options? If these changes are just for your setup, please remove them from the PR