Add a debug output when argument type is not registered

This commit is contained in:
IzzelAliz 2023-08-05 11:59:29 +08:00
parent ed03da36dd
commit 7683441492

View File

@ -1,6 +1,7 @@
package io.izzel.arclight.common.mixin.core.network.protocol.game;
import com.mojang.brigadier.arguments.ArgumentType;
import io.izzel.arclight.common.mod.ArclightMod;
import io.netty.buffer.Unpooled;
import net.minecraft.commands.synchronization.ArgumentTypeInfo;
import net.minecraft.core.registries.BuiltInRegistries;
@ -30,7 +31,11 @@ public class ClientboundCommandsPacket_ArgumentNodeStubMixin {
ci.cancel();
buf.writeVarInt(ARCLIGHT_WRAP_INDEX);
//noinspection deprecation
buf.writeVarInt(BuiltInRegistries.COMMAND_ARGUMENT_TYPE.getId(type));
var id = BuiltInRegistries.COMMAND_ARGUMENT_TYPE.getId(type);
if (id == -1) {
ArclightMod.LOGGER.debug("Command argument type {} is not registered", type);
}
buf.writeVarInt(id);
var payload = new FriendlyByteBuf(Unpooled.buffer());
type.serializeToNetwork((T) node, payload);
buf.writeVarInt(payload.readableBytes());