Fabric API

Fabric API

106M Downloads

Fabric isn't capable of loading classes with an EnumProperty<>

lucbf opened this issue ยท 5 comments

commented

This tutorial uses BooleanProperty: https://fabricmc.net/wiki/tutorial:blockstate
but replacing it with an EnumProperty causes an ExceptionInInnitializerError, even if you just leave the field alone. Tested on 20w49a and 20w51a

commented

Please share the logs related to the crash. We cannot deduce the problem without knowing how and where it crashed.
(Also this is probably not really related to this repo since Fabric Loader is not only for Minecraft, but eh whatever we are already here)

commented

---- Minecraft Crash Report ----
// Everything's going to plan. No, really, that was supposed to happen.

Time: 18/12/2020 16:40
Description: Initializing game

java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'redstone_unlimiter'!
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:53)
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke(EntrypointUtils.java:36)
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointClient.start(EntrypointClient.java:32)
at net.minecraft.client.MinecraftClient.(MinecraftClient.java:470)
at net.minecraft.client.main.Main.main(Main.java:149)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:224)
at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:141)
at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:27)
at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
Caused by: java.lang.ExceptionInInitializerError
at com.github.M4gma.RedstoneUnlimiter.Main.onInitialize(Main.java:63)
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:50)
... 12 more
Caused by: java.lang.IllegalArgumentException: Multiple values have the same name 'null'
at net.minecraft.state.property.EnumProperty.(EnumProperty.java:29)
at net.minecraft.state.property.EnumProperty.of(EnumProperty.java:100)
at net.minecraft.state.property.EnumProperty.of(EnumProperty.java:85)
at net.minecraft.state.property.EnumProperty.of(EnumProperty.java:74)
at com.github.M4gma.RedstoneUnlimiter.BoardBlock.(BoardBlock.java:12)
... 14 more

A detailed walkthrough of the error, its code path and all known details is as follows:

-- Head --
Thread: Render thread
Stacktrace:
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke0(EntrypointUtils.java:53)
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointUtils.invoke(EntrypointUtils.java:36)
at net.fabricmc.loader.entrypoint.minecraft.hooks.EntrypointClient.start(EntrypointClient.java:32)
at net.minecraft.client.MinecraftClient.(MinecraftClient.java:470)

-- Initialization --
Details:
Stacktrace:
at net.minecraft.client.main.Main.main(Main.java:149)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:224)
at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:141)
at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:27)
at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)

-- System Details --
Details:
Minecraft Version: 20w51a
Minecraft Version ID: 20w51a
Operating System: Windows 10 (amd64) version 10.0
Java Version: 12.0.2, Oracle Corporation
Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode, sharing), Oracle Corporation
Memory: 241502360 bytes (230 MB) / 1092616192 bytes (1042 MB) up to 1853882368 bytes (1768 MB)
CPUs: 8
JVM Flags: 0 total;
Fabric Mods:
fabric: Fabric API 0.28.3+1.17
fabric-api-base: Fabric API Base 0.2.0+eaafab808e
fabric-biome-api-v1: Fabric Biome API (v1) 3.1.1+836e66a38e
fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.4+9f7a74238e
fabric-command-api-v1: Fabric Command API (v1) 1.0.9+9f7a74238e
fabric-commands-v0: Fabric Commands (v0) 0.2.0+9f7a74238e
fabric-containers-v0: Fabric Containers (v0) 0.1.9+bee3a8868e
fabric-content-registries-v0: Fabric Content Registries (v0) 0.2.0+880269e68e
fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.1.2+b7f9825d8e
fabric-dimensions-v1: fabric-dimensions-v1 2.0.2+e1f1abb18e
fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.4.3+9f7a74238e
fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.0+9f7a74238e
fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.4+3e817a628e
fabric-item-api-v1: Fabric Item API (v1) 1.2.1+9f7a74238e
fabric-item-groups-v0: Fabric Item Groups (v0) 0.2.1+9f7a74238e
fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.1+730711c68e
fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.0+9f7a74238e
fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 1.4.0+8f5b7a468e
fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.0.3+0c3d83a58e
fabric-mining-levels-v0: Fabric Mining Levels (v0) 0.1.2+9f7a74238e
fabric-models-v0: Fabric Models (v0) 0.1.1+9f7a74238e
fabric-networking-api-v1: Fabric Networking API (v1) 1.0.0+fd1187378e
fabric-networking-blockentity-v0: Fabric Networking Block Entity (v0) 0.2.7+bee3a8868e
fabric-networking-v0: Fabric Networking (v0) 0.3.1+96f0bfaa8e
fabric-object-builder-api-v1: Fabric Object Builder API (v1) 1.10.2+9f7a74238e
fabric-object-builders-v0: Fabric Object Builders (v0) 0.7.2+9f7a74238e
fabric-particles-v1: fabric-particles-v1 0.2.2+9f7a74238e
fabric-registry-sync-v0: Fabric Registry Sync (v0) 0.7.4+836e66a38e
fabric-renderer-api-v1: Fabric Renderer API (v1) 0.3.4+e1f1abb18e
fabric-renderer-indigo: Fabric Renderer - Indigo 0.4.5+e1f1abb18e
fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 3.0.3+0c3d83a58e
fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.1.4+9f7a74238e
fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 0.1.12+9f7a74238e
fabric-rendering-v0: Fabric Rendering (v0) 1.1.1+9f7a74238e
fabric-rendering-v1: Fabric Rendering (v1) 1.3.1+9f7a74238e
fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.3.5+e1f1abb18e
fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.1.3+9f7a74238e
fabric-structure-api-v1: Fabric Structure API (v1) 1.1.2+cc3cc6c68e
fabric-tag-extensions-v0: Fabric Tag Extensions (v0) 1.1.1+e1f1abb18e
fabric-textures-v0: Fabric Textures (v0) 1.0.5+9f7a74238e
fabric-tool-attribute-api-v1: Fabric Tool Attribute API (v1) 1.2.7+9f7a74238e
fabricloader: Fabric Loader 0.10.8
minecraft: Minecraft 1.17-alpha.20.51.a
redstone_unlimiter: Redstone Unlimiter 1.0.0
Launched Version: Fabric
Backend library: LWJGL version 3.2.2 build 10
Backend API: NO CONTEXT
GL Caps:
Using VBOs: Yes
Is Modded: Definitely; Client brand changed to 'fabric'
Type: Client (map_client.txt)
CPU:

commented
    public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type) {
        return of(name, type, (Predicate)Predicates.alwaysTrue());
    }

    public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type, Predicate<T> filter) {
        return of(name, type, (Collection)Arrays.stream(type.getEnumConstants()).filter(filter).collect(Collectors.toList()));
    }

    public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type, T... values) {
        return of(name, type, (Collection)Lists.newArrayList(values));
    }

    public static <T extends Enum<T> & StringIdentifiable> EnumProperty<T> of(String name, Class<T> type, Collection<T> values) {
        return new EnumProperty(name, type, values);
    }
commented

This is not a Fabric issue, you just have something wrong with the code for your block's property:
Caused by: java.lang.IllegalArgumentException: Multiple values have the same name 'null'
...
at com.github.M4gma.RedstoneUnlimiter.BoardBlock.(BoardBlock.java:12)

Getting help with fixing this is probably better suited to the mod-dev channels in the Fabric Discord.

commented

Closing this since this seems to be a usage issue with EnumProperty.

If you need assistance elsewhere I would try the #mod-dev channels on the Fabric discord