mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 22:44:32 +00:00
Fix bug with strict bulk registration
See EventBus#89 for more details
This commit is contained in:
1 parent
5e8942e0a7
commit
47f7c68ed5
4 files changed
+11
-6
No files matched your search
+1
-1
@@ -168,7 +168,7 @@ patcher {
|
||||
|
||||
runs {
|
||||
forge_client {
|
||||
property 'eventbus.checkTypesOnDispatch', 'true'
|
||||
property 'eventbus.api.strictRuntimeChecks', 'true'
|
||||
property 'org.lwjgl.system.SharedLibraryExtractDirectory', 'lwjgl_dll'
|
||||
|
||||
args '--launchTarget', 'forge_dev_client',
|
||||
|
||||
+7
-2
@@ -152,6 +152,9 @@ public class AutomaticEventSubscriber {
|
||||
if (!Modifier.isStatic(method.getModifiers()))
|
||||
continue;
|
||||
|
||||
if (method.isSynthetic())
|
||||
continue; // EventBus#89
|
||||
|
||||
int paramCount = method.getParameterCount();
|
||||
if (paramCount == 0 || paramCount > 2)
|
||||
continue;
|
||||
@@ -187,8 +190,10 @@ public class AutomaticEventSubscriber {
|
||||
public static void registerStrict(BusGroup busGroup, Class<?> listenerClass) {
|
||||
Class<? extends Event> firstValidListenerEventType = null;
|
||||
|
||||
Method[] declaredMethods = listenerClass.getDeclaredMethods();
|
||||
if (declaredMethods.length == 0) {
|
||||
List<Method> declaredMethods = Arrays.stream(listenerClass.getDeclaredMethods())
|
||||
.filter(Predicate.not(Method::isSynthetic)) // EventBus#89
|
||||
.toList();
|
||||
if (declaredMethods.isEmpty()) {
|
||||
var errMsg = "No declared methods found in " + listenerClass.getName();
|
||||
var superClass = listenerClass.getSuperclass();
|
||||
if (superClass != null && superClass != Record.class && superClass != Enum.class) {
|
||||
|
||||
+1
-1
@@ -145,7 +145,7 @@ dependencies {
|
||||
// Forge 1.21.6+ uses EventBus 7, which shifts most of its runtime validation to compile-time via an annotation processor
|
||||
// to improve performance in production environments. This line is required to enable said compile-time validation
|
||||
// in your development environment, helping you catch issues early.
|
||||
annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.7'
|
||||
annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.8'
|
||||
|
||||
// Example mod dependency with JEI
|
||||
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||
|
||||
+2
-2
@@ -32,8 +32,8 @@ dependencyResolutionManagement {
|
||||
library('accesstransformers', 'net.minecraftforge:accesstransformers:8.2.2')
|
||||
library('coremods', 'net.minecraftforge:coremods:5.2.6')
|
||||
library('nashorn', 'org.openjdk.nashorn:nashorn-core:15.4') // Needed by coremods, because the JRE no longer ships JS
|
||||
library('eventbus', 'net.minecraftforge:eventbus:7.0-beta.7')
|
||||
library('eventbus-validator', 'net.minecraftforge:eventbus-validator:7.0-beta.7')
|
||||
library('eventbus', 'net.minecraftforge:eventbus:7.0-beta.8')
|
||||
library('eventbus-validator', 'net.minecraftforge:eventbus-validator:7.0-beta.8')
|
||||
library('mergetool-api', 'net.minecraftforge:mergetool-api:1.0')
|
||||
|
||||
library('mixin', 'org.spongepowered:mixin:0.8.7')
|
||||
|
||||
Reference in new issue
Block a user