neoforged / bus Goto Github PK
View Code? Open in Web Editor NEWEvent firing and listening framework, based on the event bus concept
License: GNU Lesser General Public License v2.1
Event firing and listening framework, based on the event bus concept
License: GNU Lesser General Public License v2.1
This should use listeners[x].listenerName()
to have a more readable name (right now the method is unused!).
They could just be regular subclass fields. We could move Event.Result
to forge as a general-purpose "boolean or default" enum.
Hi!
I've been discussing event priorities with someone over on the Twilight Forest Discord server as they wanted to change the priority of our death event so their mod would properly work. While doing this, we had the realization that only having 5 different priorities that had no sorting order (at least I don't think it does?) is a rather flawed system.
My proposal: take a page out of how Mixin does it and allow people to specify an int for the priority. The default could just be 0, and mods that need a lower priority could just specify a negative number if needed. Mods could then be sorted based on this priority (perhaps by the actual mod loading order if multiple mods use the same value) and it would allow for finer control of when things fire.
It doesn't seem too useful and right now it isn't particularly performant - once capabilities get reworked Forge won't be making use of it anymore.
As far as I can tell it's just a matter of adding such a method to Event
:
protected void reset() {
isCanceled = false;
result = Result.DEFAULT;
phase = null;
}
(event.setCanceled(false).setResult(Result.DEFAULT).setPhase(null)
will not work due to setPhase
)
Of course, this should come with a nice test too.
I don't see the use case, and it makes the implementation of ListenerList
a lot more painful.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.