diff --git a/build.gradle b/build.gradle index 1bad1f2c..7f324d46 100644 --- a/build.gradle +++ b/build.gradle @@ -158,11 +158,9 @@ dependencies { include fabricApi.module("fabric-api-base", fabric_api_version) include fabricApi.module("fabric-networking-v0", fabric_api_version) - afterEvaluate { - subprojects.each { - compile project(path: ":${it.name}", configuration: "dev") - include project(":${it.name}") - } + subprojects.each { + compile project(path: ":${it.name}", configuration: "dev") + include project(":${it.name}") } } diff --git a/cardinal-components-base/src/main/java/dev/onyxstudios/cca/internal/base/ComponentsInternals.java b/cardinal-components-base/src/main/java/dev/onyxstudios/cca/internal/base/ComponentsInternals.java index 396c55ad..89d68900 100644 --- a/cardinal-components-base/src/main/java/dev/onyxstudios/cca/internal/base/ComponentsInternals.java +++ b/cardinal-components-base/src/main/java/dev/onyxstudios/cca/internal/base/ComponentsInternals.java @@ -42,15 +42,15 @@ public final class ComponentsInternals { public static final Logger LOGGER = LogManager.getLogger("Cardinal Components API"); - private static final Field EVENT$TYPE; + private static final Field EVENT$HANDLERS; private static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup(); private static final Map>, MethodHandle> FACTORY_CACHE = new HashMap<>(); private static final MethodHandle IMPL_HANDLE; static { try { - EVENT$TYPE = Class.forName("net.fabricmc.fabric.impl.base.event.ArrayBackedEvent").getDeclaredField("type"); - EVENT$TYPE.setAccessible(true); + EVENT$HANDLERS = Class.forName("net.fabricmc.fabric.impl.base.event.ArrayBackedEvent").getDeclaredField("handlers"); + EVENT$HANDLERS.setAccessible(true); IMPL_HANDLE = LOOKUP.findStatic(ComponentsInternals.class, "initComponents", MethodType.methodType(void.class, ComponentType.class, Function.class, Object.class, ComponentContainer.class)); } catch (NoSuchFieldException | ClassNotFoundException e) { throw new RuntimeException("Failed to hack fabric API", e); @@ -75,7 +75,7 @@ private static void initComponents(Compone @SuppressWarnings("unchecked") private static MethodHandle createCallbackFactory(Event event) { try { - Class> eventType = (Class>) EVENT$TYPE.get(event); + Class> eventType = (Class>) EVENT$HANDLERS.get(event).getClass().getComponentType(); MethodType eventSamType = findSam(eventType); return LambdaMetafactory.metafactory( LOOKUP, diff --git a/changelog.md b/changelog.md index 41a94a17..65d89144 100644 --- a/changelog.md +++ b/changelog.md @@ -1,3 +1,9 @@ +------------------------------------------------------ +Version 2.8.1 +------------------------------------------------------ +Fixes +- Fixed a crash at launch with Fabric API 0.34.0 and up (1.17 versions are unaffected) + ------------------------------------------------------ Version 2.8.0 ------------------------------------------------------ diff --git a/gradle.properties b/gradle.properties index 69775556..01ba4c29 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,10 +7,10 @@ yarn_mappings=5 loader_version=0.10.6+build.214 #Fabric api -fabric_api_version=0.32.5+1.16 +fabric_api_version=0.34.0+1.16 #Publishing -mod_version = 2.8.0 +mod_version = 2.8.1 curseforge_id = 318449 curseforge_versions = 1.16.2; 1.16.3; 1.16.4; 1.16.5 changelog_url = https://github.com/OnyxStudios/Cardinal-Components-API/blob/master/changelog.md