Advertisement
Superloup10

WolflinModLoadingContext

Jan 28th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.59 KB | None | 0 0
  1. package fr.wolfdev.wolflin.lang
  2.  
  3. import net.minecraftforge.fml.ExtensionPoint
  4.  
  5. class WolflinModLoadingContext {
  6.     var activeContainer: WolflinModContainer? = null
  7.     fun getModEventBus() = activeContainer!!.getEventBus()
  8.     fun <T> registerExtensionPoint(point: ExtensionPoint<T>, extension: () -> T) {
  9.         activeContainer!!.registerExtensionPoint(point, extension)
  10.     }
  11.  
  12.     companion object {
  13.         private val context = ThreadLocal.withInitial {WolflinModLoadingContext()}
  14.         fun get(): WolflinModLoadingContext {
  15.             return context.get()
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement