1.8.9 version (?):
function register(eventClass, listener) { //we are making reflected event bus to access private fields & methods adaptedBus = new Reflector(MinecraftForge.EVENT_BUS); //getting an actual mod container (it seems that activeModContainer() returns null in LiquidBounce so we are checking for null & redefining to minecraft mod container) activeModContainer = Loader.instance().activeModContainer(); !activeModContainer && (activeModContainer = Loader.instance().getMinecraftModContainer()); //https://github.com/MinecraftForge/MinecraftForge/blob/d06e0ad71b8471923cc809dde58251de8299a143/src/main/java/net/minecraftforge/fml/common/eventhandler/EventBus.java#L58 adaptedBus.listenerOwners.put(listener, activeModContainer); ctr = eventClass.getConstructor(); ctr.setAccessible(true); EVENT = ctr.newInstance(); //don't remove this line because event won't call without it asm = new ASMEventHandler(listener, getMethod(listener, "invoke"), activeModContainer); //registering a new listener EVENT.getListenerList().register(adaptedBus.busID, EventPriority.NORMAL, listener); others = adaptedBus.listeners.get(listener); if (!others) { others = new ArrayList(); adaptedBus.listeners.put(listener, others); } others.add(asm) }ScriptAPI
A place to ask for help on writing scripts
306
Topics
2.2k
Posts
-
-
-
net.ccbluex.liquidbounce api?
Unsolved -
Subscribing to Forge events?
Solved -
how do i use the c0e packet
Solved -
Core not working
Unsolved -
-
This topic is deleted!
Unsolved -
How do i read chat
Solved -
This topic is deleted!
Unsolved -
Problem With Script
Solved -
Cant find problem in my code
Solved -
This topic is deleted!
Solved -
Adding new modes to modules?
Unsolved -
-
Create Custom GUI
Unsolved -
Hello. Script not work
Unsolved -
This topic is deleted!
Unsolved -
Help with if statement
Solved -