You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, two TypeTokens which are equal, can have different hashCodes. This makes it so that HashMap does not behave as expected. This causes a problem with the parser registry, where if a parser is registered using TypeToken.get(TypeFactory.parameterizedClass(Set::class.java, ItemStackPredicateArgument::class.java)), then it cannot be properly resolved.
Stack trace:
java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'altoclef'!
at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.lambda$invoke0$0(EntrypointUtils.java:51)
at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33)
at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:49)
at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke(EntrypointUtils.java:35)
at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:52)
at net.minecraft.client.MinecraftClient.<init>(MinecraftClient.java:520)
at net.minecraft.client.main.Main.main(Main.java:179)
at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:462)
at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
Caused by: java.lang.IllegalArgumentException: Parameter 'arg1' in method 'call' has parser 'java.util.Set<? extends net.minecraft.command.argument.ItemPredicateArgumentType$ItemStackPredicateArgument>' but no parser exists for that type
at cloud.commandframework.annotations.AnnotationParser.lambda$buildArgument$7(AnnotationParser.java:720)
at java.base/java.util.Optional.orElseThrow(Optional.java:403)
at cloud.commandframework.annotations.AnnotationParser.buildArgument(AnnotationParser.java:719)
at cloud.commandframework.annotations.AnnotationParser.construct(AnnotationParser.java:570)
at cloud.commandframework.annotations.AnnotationParser.parse(AnnotationParser.java:435)
at gay.solonovamax.altoclef.AltoClef.initializeCommands(AltoClef.kt:398)
at gay.solonovamax.altoclef.AltoClef.onInitialize(AltoClef.kt:229)
at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:47)
... 8 more
Code:
funinitializeCommands() {
val itemStackPredicateType =object:TypeToken<ItemStackPredicateArgument>() {}
val itemStackPredicateSetType =TypeToken.get(TypeFactory.parameterizedClass(Set::class.java, ItemStackPredicateArgument::class.java))
manager.parserRegistry().registerParserSupplier(itemStackPredicateType) {
FabricArgumentParsers.contextual(ItemPredicateArgumentType::itemPredicate)
}
manager.parserRegistry().registerParserSupplier(itemStackPredicateSetType) { parameters ->SetArgument.SetParser(parameters, itemStackPredicateType, manager)
}
val manager =FabricClientCommandManager(
// AsyncCommandCoordinator.builder<ClientCommand>()// .withAsynchronousParsing()// .withExecutor(scheduledThreadPool)// .build(),CommandExecutionCoordinator.simpleCoordinator(),
::ClientCommand,
ClientCommand::source
)
MinecraftExceptionHandler<ClientCommand>()
.withDefaultHandlers()
.withDecorator { message:Component-> messagePrefix.append(message) }
.apply(manager, AudienceProvider.nativeAudience<ClientCommand>())
val annotationParser =AnnotationParser<ClientCommand>(manager) { SimpleCommandMeta.empty() }.apply {
installCoroutineSupport()
}
annotationParser.parse(
UtilCommands()
)
}
data classClientCommand(valsource:FabricClientCommandSource) : ForwardingAudience.Single {
privateval audience:Audience=FabricClientAudiences.of().audience()
overridefunaudience(): Audience= audience
}
@CommandMethod("altoclef")
classUtilCommands {
@CommandMethod("deposit <items>")
@CommandDescription("Deposit ALL of our items")
fundeposit(
command:ClientCommand,
@Argument("items")
items:Set<ItemPredicateArgumentType.ItemStackPredicateArgument>, // TODO: we need a custom parser for this (also probably a wrapper class)
) {
val validItems =Registries.ITEM.filter { item ->
items.any { it.test(item.defaultStack) }
}
val itemTarget =ItemTarget(validItems.toTypedArray())
itemTarget.infinite()
runUserTask(StoreInAnyContainerTask(false, itemTarget))
}
}
The text was updated successfully, but these errors were encountered:
See leangen/geantyref#17 for more info.
Currently, two
TypeToken
s which areequal
, can have differenthashCode
s. This makes it so thatHashMap
does not behave as expected. This causes a problem with the parser registry, where if a parser is registered usingTypeToken.get(TypeFactory.parameterizedClass(Set::class.java, ItemStackPredicateArgument::class.java))
, then it cannot be properly resolved.Stack trace:
Code:
The text was updated successfully, but these errors were encountered: