Fabric API

Fabric API

108M Downloads

Client commands appear in command block suggestions

haykam821 opened this issue ยท 0 comments

commented

A command registered to the client command dispatcher is still shown within the suggestions for a command block, most likely because of a mixin that affects all uses of the server command dispatcher even in situations where client commands are not applicable:

@SuppressWarnings({"unchecked", "rawtypes"})
@Inject(method = "onCommandTree", at = @At("RETURN"))
private void onOnCommandTree(CommandTreeS2CPacket packet, CallbackInfo info) {
// Add the commands to the vanilla dispatcher for completion.
// It's done here because both the server and the client commands have
// to be in the same dispatcher and completion results.
ClientCommandInternals.addCommands((CommandDispatcher) commandDispatcher, (FabricClientCommandSource) commandSource);
}