Data API move from API5 to 7 help

Hi there, I have been away from the general sponge / minecraft / java scene for a couple of years
time however decided to came back today. What I found was that towards the end of 2017 the data api had been changed and a couple of my plugins that highly depend on it needed updating. Being extremely rusty on the whole java thing I read though the changes (picking up minimal understanding) and believed I was on the right track when I found this - Refactor Data Registration by gabizou · Pull Request #1531 · SpongePowered/SpongeAPI · GitHub . Unfortunately having made the changes according to this thread intelliJ was still angry at me and I can’t compile. I have had another look around the forums and it seems around this time a number of posts were made with similar issues however wasn’t able to apply the answers to my specific problem hence writing this post. The current status of my code is that I have put a API5 comment above the code I used to have and an API7 comment above what I believed to be the new updated code according to the post I read.

image

I have also uploaded the full code on github to help understand whats going on (sorry about my horrible code)

I would speculate that when I was doing this years back I added multiple variables to each set of data that may no longer be allowed.

TLDR; I am having issues with updating some old code using the data api before changes for api 6. Any help would be greatly appreciated.

I have seen that the docs seem to have API 6 (I think) Data API instructions even in the API 7. I heard on the twitch stream that they are updating the docs to API 7 still.

Anyway, here is a good example of a up to date version of the data API made by pie_flavor.

Oh amazing, thanks for your help. I will look though the code, suprised I didn’t find this myself to be honest haha

So after going through all my stuff and converting it I still couldn’t get it to work due to crashes at startup. After allot of fiddling I decided to test the example code and that crashes on startup in the exact same way. Any other suggestions?

Crash log (Sponge key registry module initialisation error)

“C:\Program Files\Java\jdk1.8.0_51\bin\java” -Dvisualvm.id=224598222279427 “-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.5\lib\idea_rt.jar=55838:C:\Program Files\JetBrains\IntelliJ IDEA 2017.2.5\bin” -Dfile.encoding=UTF-8 -classpath “C:\Program Files\Java\jdk1.8.0_51\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\rt.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_51\jre\lib\ext\zipfs.jar;C:\Users\Jamie\Documents\Sponge\Server\BankNotes\out\production\classes;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\org.spongepowered\spongeapi\7.0.0-SNAPSHOT\98d46a49149eeb19e76581eea9e53447f0152600\spongeapi-7.0.0-SNAPSHOT.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\org.slf4j\slf4j-api\1.7.25\da76ca59f6a57ee3102f8f9bd9cee742973efa8a\slf4j-api-1.7.25.jar;C:\Users\Jamie.gradle\caches\SpongeStart\start;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.google.guava\guava\21.0\3a3d111be1be1b745edfa7d91678a12d7ed38709\guava-21.0.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.google.errorprone\error_prone_annotations\2.0.15\822652ed7196d119b35d2e22eb9cd4ffda11e640\error_prone_annotations-2.0.15.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.google.code.gson\gson\2.8.0\c4ba5371a29ac9b2ad6129b1d39ea38750043eff\gson-2.8.0.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\org.apache.commons\commons-lang3\3.5\6c6c702c89bfff3cd9e80b04d668c5e190d588c6\commons-lang3-3.5.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.google.code.findbugs\jsr305\3.0.1\f7be08ec23c21485b9b5a1cf1654c2ec8c58168d\jsr305-3.0.1.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.google.inject\guice\4.1.0\eeb69005da379a10071aa4948c48d89250febb07\guice-4.1.0.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.github.ben-manes.caffeine\caffeine\2.5.4\a162a31c2973550a8cd37cb9773a814ae3394fbb\caffeine-2.5.4.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.github.ben-manes.caffeine\guava\2.5.4\973a21f7148066558ba5eebe9ce244d05e8b54c2\guava-2.5.4.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\org.spongepowered\plugin-meta\0.4.1\41378ca359e2b4ad935294d1ca3e533e7cdf8f64\plugin-meta-0.4.1.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\ninja.leaping.configurate\configurate-hocon\3.3\197f6098e3593f1a71b4eb64460eea696ec0321e\configurate-hocon-3.3.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\ninja.leaping.configurate\configurate-gson\3.3\6a1b83122014a3bff9e7b2c6ed117af89690a9fe\configurate-gson-3.3.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\ninja.leaping.configurate\configurate-yaml\3.3\b2791ab4e9bf1a4b604a4e55d5c223289f748971\configurate-yaml-3.3.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.flowpowered\flow-math\1.0.3\d98020239e5015091ad3be927cef9dea0d61a234\flow-math-1.0.3.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.flowpowered\flow-noise\1.0.1-SNAPSHOT\e837af613d75e382041cedc083047bc7c5c6034c\flow-noise-1.0.1-SNAPSHOT.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\org.ow2.asm\asm\5.2\4ce3ecdc7115bcbf9d4ff4e6ec638e60760819df\asm-5.2.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\javax.inject\javax.inject\1\6975da39a7040257bd51d21a231b76c915872d38\javax.inject-1.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\aopalliance\aopalliance\1.0\235ba8b489512805ac13a8f9ea77a1ca5ebe3e8\aopalliance-1.0.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\com.typesafe\config\1.3.1\2cf7a6cc79732e3bdf1647d7404279900ca63eb0\config-1.3.1.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\ninja.leaping.configurate\configurate-core\3.3\b58d26f1bb8c26fab57c759cec63fd48e683b021\configurate-core-3.3.jar;C:\Users\Jamie.gradle\caches\modules-2\files-2.1\org.yaml\snakeyaml\1.18\e4a441249ade301985cb8d009d4e4a72b85bf68e\snakeyaml-1.18.jar” StartServer
Running folder: C:\Users\Jamie\Documents\Sponge\Server\BankNotes\run.
2018-05-05 10:54:05,388 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
2018-05-05 10:54:05,392 main WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream
[10:54:05] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[10:54:05] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLServerTweaker
[10:54:05] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLServerTweaker
[10:54:05] [main/INFO] [FML]: Forge Mod Loader version 14.23.1.2555 for Minecraft 1.12.2 loading
[10:54:05] [main/INFO] [FML]: Java is Java HotSpot™ 64-Bit Server VM, version 1.8.0_51, running on Windows 8.1:amd64:6.3, installed at C:\Program Files\Java\jdk1.8.0_51\jre
[10:54:06] [main/INFO] [FML]: Loading tweaker org.spongepowered.asm.launch.MixinTweaker from sponge.jar
[10:54:06] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[10:54:06] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepowered.asm.launch.MixinTweaker
[10:54:06] [main/INFO] [mixin]: SpongePowered MIXIN Subsystem Version=0.7.4 Source=file:/C:/Users/Jamie/Documents/Sponge/Server/BankNotes/run/mods/sponge.jar Service=LaunchWrapper Env=SERVER
[10:54:06] [main/WARN] [FML]: The coremod SpongeCoremod (org.spongepowered.mod.SpongeCoremod) is not signed!
[10:54:06] [main/INFO] [mixin]: Compatibility level set to JAVA_8
[10:54:06] [main/INFO] [mixin]: Adding new token provider org.spongepowered.mod.SpongeCoremod$TokenProvider to MixinEnvironment[DEFAULT]
[10:54:06] [main/INFO] [mixin]: Adding new token provider org.spongepowered.mod.SpongeCoremod$TokenProvider to MixinEnvironment[PREINIT]
[10:54:06] [main/INFO] [mixin]: Adding new token provider org.spongepowered.mod.SpongeCoremod$TokenProvider to MixinEnvironment[INIT]
[10:54:06] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[10:54:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[10:54:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker
[10:54:06] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[10:54:09] [main/INFO] [FML]: Found valid fingerprint for Minecraft Forge. Certificate fingerprint e3c3d50c7c986df74c645c0ac54639741c90a557
[10:54:09] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper
[10:54:09] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.asm.launch.MixinTweaker
[10:54:09] [main/INFO] [mixin]: Initialised Mixin FML Remapper Adapter with net.minecraftforge.fml.common.asm.transformers.deobf.FMLDeobfuscatingRemapper@7e8a46b7
[10:54:09] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker
[10:54:09] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker
[10:54:09] [main/INFO] [LaunchWrapper]: Loading tweak class name org.spongepowered.asm.mixin.EnvironmentStateTweaker
[10:54:09] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker
[10:54:09] [main/INFO] [LaunchWrapper]: Calling tweak class org.spongepowered.asm.mixin.EnvironmentStateTweaker
[10:54:16] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.server.MinecraftServer}
[10:54:21] [Server thread/INFO]: Starting minecraft server version 1.12.2
[10:54:21] [Server thread/INFO] [FML]: MinecraftForge v14.23.1.2555 Initialized
[10:54:21] [Server thread/INFO] [FML]: Starts to replace vanilla recipe ingredients with ore ingredients.
[10:54:21] [Server thread/INFO] [FML]: Replaced 1036 ore ingredients
[10:54:21] [Server thread/INFO] [Sponge]: Found mcmod.info at jar:file:/C:/Users/Jamie/Documents/Sponge/Server/BankNotes/run/mods/sponge.jar!/mcmod.info
[10:54:21] [Server thread/INFO] [Sponge]: Creating injector in stage ‘PRODUCTION’
[10:54:24] [Server thread/ERROR] [FML]: A problem occurred instantiating the injected mod container org.spongepowered.mod.SpongeMod
java.lang.RuntimeException: Error trying to initialize module: org.spongepowered.common.registry.type.data.KeyRegistryModule
at org.spongepowered.common.registry.util.RegistryModuleLoader.tryModulePhaseRegistration(RegistryModuleLoader.java:73) ~[RegistryModuleLoader.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.common.registry.SpongeGameRegistry.registerModulePhase(SpongeGameRegistry.java:529) ~[SpongeGameRegistry.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.common.registry.SpongeGameRegistry.preRegistryInit(SpongeGameRegistry.java:189) ~[SpongeGameRegistry.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.mod.SpongeMod.(SpongeMod.java:143) ~[SpongeMod.class:1.12.2-2555-7.0.0-BETA-2794]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_51]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_51]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_51]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[?:1.8.0_51]
at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_51]
at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:377) [Loader.class:?]
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:541) [Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:97) [FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:331) [FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125) [nz.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51]
Caused by: java.lang.IllegalArgumentException: Could not find a Supplier for the provided builder class: org.spongepowered.api.data.key.Key.Builder
at org.spongepowered.common.registry.SpongeGameRegistry.createBuilder(SpongeGameRegistry.java:350) ~[SpongeGameRegistry.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.api.data.key.Key.builder(Key.java:58) ~[Key.class:?]
at org.spongepowered.api.data.key.KeyFactory.makeSingleKey(KeyFactory.java:80) ~[KeyFactory.class:?]
at org.spongepowered.common.registry.type.data.KeyRegistryModule.registerDefaults(KeyRegistryModule.java:73) ~[KeyRegistryModule.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.common.registry.util.RegistryModuleLoader.tryModulePhaseRegistration(RegistryModuleLoader.java:61) ~[RegistryModuleLoader.class:1.12.2-2555-7.0.0-BETA-2794]
… 15 more
[10:54:24] [Server thread/ERROR]: Encountered an unexpected exception
net.minecraftforge.fml.common.LoaderException: java.lang.RuntimeException: Error trying to initialize module: org.spongepowered.common.registry.type.data.KeyRegistryModule

at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:382) ~[Loader.class:?]
at net.minecraftforge.fml.common.Loader.loadMods(Loader.java:541) ~[Loader.class:?]
at net.minecraftforge.fml.server.FMLServerHandler.beginServerLoading(FMLServerHandler.java:97) ~[FMLServerHandler.class:?]
at net.minecraftforge.fml.common.FMLCommonHandler.onServerStart(FMLCommonHandler.java:331) ~[FMLCommonHandler.class:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:125) ~[nz.class:?]
at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:484) [MinecraftServer.class:?]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_51]

Caused by: java.lang.RuntimeException: Error trying to initialize module: org.spongepowered.common.registry.type.data.KeyRegistryModule
at org.spongepowered.common.registry.util.RegistryModuleLoader.tryModulePhaseRegistration(RegistryModuleLoader.java:73) ~[RegistryModuleLoader.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.common.registry.SpongeGameRegistry.registerModulePhase(SpongeGameRegistry.java:529) ~[SpongeGameRegistry.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.common.registry.SpongeGameRegistry.preRegistryInit(SpongeGameRegistry.java:189) ~[SpongeGameRegistry.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.mod.SpongeMod.(SpongeMod.java:143) ~[SpongeMod.class:1.12.2-2555-7.0.0-BETA-2794]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_51]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_51]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_51]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[?:1.8.0_51]
at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_51]
at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:377) ~[Loader.class:?]
… 6 more
Caused by: java.lang.IllegalArgumentException: Could not find a Supplier for the provided builder class: org.spongepowered.api.data.key.Key.Builder
at org.spongepowered.common.registry.SpongeGameRegistry.createBuilder(SpongeGameRegistry.java:350) ~[SpongeGameRegistry.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.api.data.key.Key.builder(Key.java:58) ~[Key.class:?]
at org.spongepowered.api.data.key.KeyFactory.makeSingleKey(KeyFactory.java:80) ~[KeyFactory.class:?]
at org.spongepowered.common.registry.type.data.KeyRegistryModule.registerDefaults(KeyRegistryModule.java:73) ~[KeyRegistryModule.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.common.registry.util.RegistryModuleLoader.tryModulePhaseRegistration(RegistryModuleLoader.java:61) ~[RegistryModuleLoader.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.common.registry.SpongeGameRegistry.registerModulePhase(SpongeGameRegistry.java:529) ~[SpongeGameRegistry.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.common.registry.SpongeGameRegistry.preRegistryInit(SpongeGameRegistry.java:189) ~[SpongeGameRegistry.class:1.12.2-2555-7.0.0-BETA-2794]
at org.spongepowered.mod.SpongeMod.(SpongeMod.java:143) ~[SpongeMod.class:1.12.2-2555-7.0.0-BETA-2794]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_51]
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_51]
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_51]
at java.lang.reflect.Constructor.newInstance(Constructor.java:422) ~[?:1.8.0_51]
at java.lang.Class.newInstance(Class.java:442) ~[?:1.8.0_51]
at net.minecraftforge.fml.common.Loader.identifyMods(Loader.java:377) ~[Loader.class:?]
… 6 more
[10:54:24] [Server thread/ERROR]: This crash report has been saved to: C:\Users\Jamie\Documents\Sponge\Server\BankNotes\run.\crash-reports\crash-2018-05-05_10.54.24-server.txt
[10:54:24] [Server thread/INFO]: Stopping server
[10:54:24] [Server thread/INFO]: Saving worlds
[10:54:24] [Server thread/WARN] [FML]: Can’t revert to frozen GameData state without freezing first.
[10:54:24] [Server thread/INFO] [FML]: The state engine was in incorrect state CONSTRUCTING and forced into state SERVER_STOPPED. Errors may have been discarded.
[10:54:25] [Server thread/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: java.lang.NullPointerException
[10:54:25] [Server thread/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:315)
[10:54:25] [Server thread/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at org.spongepowered.mod.event.SpongeModEventManager.post(SpongeModEventManager.java:361)
[10:54:25] [Server thread/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at org.spongepowered.common.SpongeImpl.postState(SpongeImpl.java:203)
[10:54:25] [Server thread/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at org.spongepowered.common.SpongeImpl.postShutdownEvents(SpongeImpl.java:208)
[10:54:25] [Server thread/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraft.server.dedicated.DedicatedServer.handler$postGameStoppingEvent$znb000(DedicatedServer.java:827)
[10:54:25] [Server thread/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraft.server.dedicated.DedicatedServer.func_71240_o(DedicatedServer.java)
[10:54:25] [Server thread/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:587)
[10:54:25] [Server thread/INFO] [STDERR]: [java.lang.ThreadGroup:uncaughtException:1052]: at java.lang.Thread.run(Thread.java:745)
[10:54:25] [Server Shutdown Thread/INFO]: Stopping server
[10:54:25] [Server Shutdown Thread/INFO]: Saving worlds

Process finished with exit code 0

Erm. Wow thats a old Java version (8 update 52). And next time you post a error it is best to post it on something like pastebin and then send the link over as it doesnt destory the formatting.

Anyway, the error.

Caused by: 
java.lang.IllegalArgumentException: Could not find a Supplier for the provided builder class: org.spongepowered.api.data.key.Key.Builder

Would it be possible to see your plugin class (the one with the @Plugin inside)

Yeah I usually use pastebin but got over excited with the hidden text button on here haha

Will update the old java, the code that generated that error is the example code that you linked me. Decided to try apply it to a smaller project I used custom data and then do it for my bigger project. You can find the code here - GitHub - JamieS1211/BankNotes

Thanks again for your help

Sorry went out due to the fact of a NaybourCatStuckException. Anyway. Unless your on Java update 44 or lower then you are fine, its just security of your pc is what I would be concerned with.

Anyway in the BankNotes class (im assuming is your main class (its the first one i saw with the @plugin)). The register of the data is commented out. And if it wasn’t comment out, the manipulatorid is wrong. You currently have it as

.manipulatorId("standard_data")

when “standard_data” is not a key. After looking at your keys class I found that you have your key as “banknotes:banknotevalue” therefore the manipulator id would be “banknotevalue” as it needs to be the key without the plugin id.

I have personally used the example code to create a new plugin that should be releasing soon, so I can personally say that the example code works.

Oh and I dont think it matters but the register code is currently on GameInitializationEvent when the example states that it should be PreGameInitializationEvent

Interesting exception haha. My jre was up to date just the JDK that was old as hell (you can tell I haven’t been working on java since forever).

Yeah forgot to un-comment that was trying to disable bits of code at a time to see if I could isolate the error. Thanks for explaining that the manipulatorId is the same as the key id, I didn’t understand that.

Weirdly enough I have changed that and am still getting the crashes, maybe I will fiddle with my sponge version? What version did you test the example code on?

If you could reupload a up to date version of the crash log on pastebin I maybe able to get more out of it.
As for my version of Sponge, im a vanilla guy and running a very slightly outdated version.

7.1.0-SNAPSHOT-06016f29
SpongeVanilla: 1.12.2-7.1.0-BETA-33

After going through many versions and gradle settings etc. I have got it working. Thank you very much for your help, making this community great!

Now just to apply it all to my big project and figures crossed!

1 Like

Ok so everything is now working nicely from inside the plugin but having an issue with other code using the data implemented. So confusingly enough I use pixelmon shops to offer items NBT data matching the data added by the plugin that is then usable by the plugin. Or this used to be the case. Having copied the NBT tags and pasted them into the data to be offered by pixelmon the data is failing.

The images below shows right and left an item in a chest. The right hand side was generated inside the plugin with the normal offer tag code and the left hand side was offered by pixelmon.
image

The NBT tags that are offered by pixelmon.
image

I am wondering if there is a hierarchical order issue? This used to work just fine and having spoken to the current pixelmon dev team they have assured me that nothing has been changed on their end. Before updating to the new api method I used to offer these tags for the same purposes, maybe I got something wrong now its changed to the new stuff for API 7?

image

Any help would be appreciated, praying I missed something obvious in my tags or smt haha

From looking at your screenshot of the NBT tags, your custom data is failing to deserialize on the left side (which is why it shows up in “FailedData”). I’m not sure how pixelmon is “offering”, but there should be some exceptions printing to log to show you where it’s going wrong. You can find the config options here to view why it’s failing.

Hi, thanks for your info. I had a good look though and this is the case.

I had the thought that maybe pixelmon tried to register the data before my plugin had implemented it however looking though the logs (and moving the data registration to GameConstructionEvent) this isn’t the case. This is evident by the sponge failed data warning showing up in the startup log after the plugin has registered the data. Startup log can be found here: https://pastebin.com/Em1V6JLh

Following your link mentioned the “sponge/custom-data.cnf” file that I then had a look at. Interestingly enough my data “prisontools:safaritoken” shows up in both the failed data list and registered data list.

sponge/custom-data.cnf

image

Another interesting (to me at least) detail is that when an item with the custom data is kept in a players inventory and that player logs out then back in the data succeeds however the two failed data tags remain. This can be seen in the following image. The two items were created together, one was placed in the chest the other in a player inventory. The player the re-logged and placed the second item in the chest and analysed the chest. The item in position 0 was kept in the player inventory for re-logging and item in position 1 was kept in the chest from its generation.

Analysed items in chest

image

My general conclusion is that I have screwed something up big time. The code that I use to register the data can be found here: PrisonTools/PrisonTools.java at master · JamieS1211/PrisonTools · GitHub

Any help would be greatly appriciated as always. Thanks again! :smiley:

Still having problems with this… anyone have any ideas?

Try doing the following. I’ve downloaded and verified the data and keys are registered:

	@SuppressWarnings("UnusedParameters")
	@Listener
	public void onInitial(GameConstructionEvent event) {
		getLogger().info("PrisonTools custom data being registered");
	}

	@Listener
	public void onKeyRegister(GameRegistryEvent.Register<Key<?>> event) {
		MyKeys.dummy();
		event.register(MyKeys.EVENT_TYPE);
		event.register(MyKeys.IS_EVENT_TOKEN);
		event.register(MyKeys.EVTRAIN_TIME);
		event.register(MyKeys.EVTRAIN_ZONE);
		event.register(MyKeys.IS_EVTRAIN_TOKEN);
		event.register(MyKeys.IS_GYM_TOKEN);
		event.register(MyKeys.GYM_RANK);
		event.register(MyKeys.IS_SAFARI_TOKEN);
		event.register(MyKeys.SAFARI_TIME);
		event.register(MyKeys.SAFARI_ZONE);
	}

	@Listener
	public void onDataRegister(GameRegistryEvent.Register<DataRegistration<?, ?>> event) {
		DataRegistration.builder()
			.dataName("Event Token")
			.manipulatorId("eventtoken") // prefix is added for you and you can't add it yourself. This is the key without the plugin ID
			.dataClass(EventTokenData.class)
			.immutableClass(ImmutableEventTokenData.class)
			.builder(new EventTokenDataBuilder())
			.buildAndRegister(container);


		DataRegistration.builder()
			.dataName("EVTrain Token")
			.manipulatorId("evtraintoken") // prefix is added for you and you can't add it yourself. This is the key without the plugin ID
			.dataClass(EVTrainTokenData.class)
			.immutableClass(ImmutableEVTrainTokenData.class)
			.builder(new EVTrainTokenDataBuilder())
			.buildAndRegister(container);


		DataRegistration.builder()
			.dataName("Gym Token")
			.manipulatorId("gymtoken") // prefix is added for you and you can't add it yourself. This is the key without the plugin ID
			.dataClass(GymTokenData.class)
			.immutableClass(ImmutableGymTokenData.class)
			.builder(new GymTokenDataBuilder())
			.buildAndRegister(container);


		DataRegistration.builder()
			.dataName("Safari Token")
			.manipulatorId("safaritoken") // prefix is added for you and you can't add it yourself. This is the key without the plugin ID
			.dataClass(SafariTokenData.class)
			.immutableClass(ImmutableSafariTokenData.class)
			.builder(new SafariTokenDataBuilder())
			.buildAndRegister(container);
	}

Thanks for the reply, I tried again with making those changes however still no joy. Same behaviour as before. I also tried with 2 of my other special types of data (Gym and EVTrain) and both had the same issue. All 3 data types I tried showed up in both the failed data and registered data. Any more ideas or is this just a lost cause to try and get it to work as it did in API 5?

I was considering a workaround where on an interaction to check if something had the failed data version of the registered data and then offer the data that failed again however wasn’t able to find a nice way to find failed data as a set from the item with that failed data.

So I cloned the plugin and started doing some investigating to replicate the issue. I’ve noticed some code issues so far which may be attributing to some data not working as expected, even in the past:
45%20PM

For starters, the fields are being set on themselves. IntelliJ is the IDE I use, so it has some of these code smells inspected and notified me of that even without having to read through all the code so far.

Anyways, I’m investigating it but as Sponge bugs need to get fixed sooner, it may take me some time to resolve why this isn’t working.

Thanks, yeah I use IntelliJ too but don’t have all that fancy colours. As you may have noticed from the start of this thread I am not really sure what I should be setting this too, was basically given a template to use for the custom data.

Your help is massively appreciated :slight_smile:

@gabizou any update on this atall?