Incendo / cloud-minecraft

Integrations between Minecraft and Cloud Command Framework
https://cloud.incendo.org/minecraft/
MIT License
27 stars 8 forks source link

Adapt for 1.21 changes #78

Closed onebeastchris closed 4 months ago

onebeastchris commented 4 months ago

Hey! The ResourceLocation constructor with one string argument was removed in 1.21 in favor of a new parse() method. Hence, this lead to cloud breaking in 1.21, so here we are. This is my first time trying to contribute, so if there's anything you'd like to me to change, please let me know :)

Tested on 1.21 Spigot, seems to work there.

Stacktrace:

Caused by: java.lang.ExceptionInInitializerError
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.MinecraftArgumentTypes$ArgumentTypeGetterImpl.<init>(MinecraftArgumentTypes.java:83) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.MinecraftArgumentTypes$ArgumentTypeGetterImpl.<init>(MinecraftArgumentTypes.java:77) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.MinecraftArgumentTypes.<clinit>(MinecraftArgumentTypes.java:52) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.parser.ItemStackParser$ModernParser.<clinit>(ItemStackParser.java:147) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.parser.ItemStackParser.<init>(ItemStackParser.java:118) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.parser.ItemStackParser.itemStackParser(ItemStackParser.java:80) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.BukkitCommandManager.<init>(BukkitCommandManager.java:131) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.paper.PaperCommandManager.<init>(PaperCommandManager.java:84) ~[?:?]
    at org.geysermc.floodgate.module.SpigotCommandModule.commandManager(SpigotCommandModule.java:61) ~[?:?]
    at org.geysermc.floodgate.module.SpigotCommandModule$$FastClassByGuice$$12e0963.GUICE$TRAMPOLINE(<generated>) ~[?:?]
    at org.geysermc.floodgate.module.SpigotCommandModule$$FastClassByGuice$$12e0963.apply(<generated>) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:260) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderMethod.doProvision(ProviderMethod.java:171) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.provision(InternalProviderInstanceBindingImpl.java:185) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.get(InternalProviderInstanceBindingImpl.java:162) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1181) ~[?:?]
    at org.geysermc.floodgate.register.CommandRegister.<init>(CommandRegister.java:49) ~[?:?]
    at org.geysermc.floodgate.register.CommandRegister$$FastClassByGuice$$1741aa4.GUICE$TRAMPOLINE(<generated>) ~[?:?]
    at org.geysermc.floodgate.register.CommandRegister$$FastClassByGuice$$1741aa4.apply(<generated>) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:186) ~[?:?]
    ... 16 more
Caused by: java.lang.RuntimeException: java.lang.NoSuchMethodException: net.minecraft.resources.MinecraftKey.<init>(java.lang.String)
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.CraftBukkitReflection.needConstructor(CraftBukkitReflection.java:179) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.RegistryReflection.<clinit>(RegistryReflection.java:54) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.MinecraftArgumentTypes$ArgumentTypeGetterImpl.<init>(MinecraftArgumentTypes.java:83) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.MinecraftArgumentTypes$ArgumentTypeGetterImpl.<init>(MinecraftArgumentTypes.java:77) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.MinecraftArgumentTypes.<clinit>(MinecraftArgumentTypes.java:52) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.parser.ItemStackParser$ModernParser.<clinit>(ItemStackParser.java:147) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.parser.ItemStackParser.<init>(ItemStackParser.java:118) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.parser.ItemStackParser.itemStackParser(ItemStackParser.java:80) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.BukkitCommandManager.<init>(BukkitCommandManager.java:131) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.paper.PaperCommandManager.<init>(PaperCommandManager.java:84) ~[?:?]
    at org.geysermc.floodgate.module.SpigotCommandModule.commandManager(SpigotCommandModule.java:61) ~[?:?]
    at org.geysermc.floodgate.module.SpigotCommandModule$$FastClassByGuice$$12e0963.GUICE$TRAMPOLINE(<generated>) ~[?:?]
    at org.geysermc.floodgate.module.SpigotCommandModule$$FastClassByGuice$$12e0963.apply(<generated>) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:260) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderMethod.doProvision(ProviderMethod.java:171) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.provision(InternalProviderInstanceBindingImpl.java:185) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.get(InternalProviderInstanceBindingImpl.java:162) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1181) ~[?:?]
    at org.geysermc.floodgate.register.CommandRegister.<init>(CommandRegister.java:49) ~[?:?]
    at org.geysermc.floodgate.register.CommandRegister$$FastClassByGuice$$1741aa4.GUICE$TRAMPOLINE(<generated>) ~[?:?]
    at org.geysermc.floodgate.register.CommandRegister$$FastClassByGuice$$1741aa4.apply(<generated>) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:186) ~[?:?]
    ... 16 more
Caused by: java.lang.NoSuchMethodException: net.minecraft.resources.MinecraftKey.<init>(java.lang.String)
    at java.base/java.lang.Class.getConstructor0(Class.java:3761) ~[?:?]
    at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2930) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.CraftBukkitReflection.needConstructor(CraftBukkitReflection.java:177) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.RegistryReflection.<clinit>(RegistryReflection.java:54) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.MinecraftArgumentTypes$ArgumentTypeGetterImpl.<init>(MinecraftArgumentTypes.java:83) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.MinecraftArgumentTypes$ArgumentTypeGetterImpl.<init>(MinecraftArgumentTypes.java:77) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.internal.MinecraftArgumentTypes.<clinit>(MinecraftArgumentTypes.java:52) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.parser.ItemStackParser$ModernParser.<clinit>(ItemStackParser.java:147) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.parser.ItemStackParser.<init>(ItemStackParser.java:118) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.parser.ItemStackParser.itemStackParser(ItemStackParser.java:80) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.bukkit.BukkitCommandManager.<init>(BukkitCommandManager.java:131) ~[?:?]
    at org.geysermc.floodgate.shadow.org.incendo.cloud.paper.PaperCommandManager.<init>(PaperCommandManager.java:84) ~[?:?]
    at org.geysermc.floodgate.module.SpigotCommandModule.commandManager(SpigotCommandModule.java:61) ~[?:?]
    at org.geysermc.floodgate.module.SpigotCommandModule$$FastClassByGuice$$12e0963.GUICE$TRAMPOLINE(<generated>) ~[?:?]
    at org.geysermc.floodgate.module.SpigotCommandModule$$FastClassByGuice$$12e0963.apply(<generated>) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderMethod$FastClassProviderMethod.doProvision(ProviderMethod.java:260) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderMethod.doProvision(ProviderMethod.java:171) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.provision(InternalProviderInstanceBindingImpl.java:185) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalProviderInstanceBindingImpl$CyclicFactory.get(InternalProviderInstanceBindingImpl.java:162) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InjectorImpl$1.get(InjectorImpl.java:1148) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1181) ~[?:?]
    at org.geysermc.floodgate.register.CommandRegister.<init>(CommandRegister.java:49) ~[?:?]
    at org.geysermc.floodgate.register.CommandRegister$$FastClassByGuice$$1741aa4.GUICE$TRAMPOLINE(<generated>) ~[?:?]
    at org.geysermc.floodgate.register.CommandRegister$$FastClassByGuice$$1741aa4.apply(<generated>) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.DefaultConstructionProxyFactory$FastClassProxy.newInstance(DefaultConstructionProxyFactory.java:82) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ConstructorInjector.provision(ConstructorInjector.java:114) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:91) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:300) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.SingletonScope$1.get(SingletonScope.java:169) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:45) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalInjectorCreator.loadEagerSingletons(InternalInjectorCreator.java:213) ~[?:?]
    at org.geysermc.floodgate.shadow.com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:186) ~[?:?]
    ... 16 more
jpenilla commented 4 months ago

Are you sure you tested using a production spigot jar?

    public static MinecraftKey a(String var0) {
        return a(var0, ':');
    }

This is the method on spigot. parse will only work on Paper with it's Mojang-mapped runtime.

onebeastchris commented 4 months ago

I've tested this on Spigot 1.21 built with their build tools, yeah