package moe.ymc.acron.cmd; import com.mojang.brigadier.ResultConsumer; import io.netty.channel.Channel; import moe.ymc.acron.net.ClientConfiguration; import net.minecraft.command.argument.EntityAnchorArgumentType; import net.minecraft.entity.Entity; import net.minecraft.server.MinecraftServer; import net.minecraft.server.command.CommandOutput; import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.world.ServerWorld; import net.minecraft.text.LiteralText; import net.minecraft.text.Text; import net.minecraft.util.math.Vec2f; import net.minecraft.util.math.Vec3d; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class CmdSrc extends ServerCommandSource { private static final Logger LOGGER = LogManager.getLogger(); private final CmdResConsumer resConsumer; public CmdSrc(@NotNull Channel channel, int id, boolean display, @NotNull ClientConfiguration configuration, @NotNull MinecraftServer server) { this(new CmdOut(channel, id, display), configuration.pos(), configuration.rot(), configuration.world(), 4, configuration.name(), new LiteralText(configuration.name()), server, null, false, new CmdResConsumer(channel, id), EntityAnchorArgumentType.EntityAnchor.FEET); } public CmdSrc(CommandOutput output, Vec3d pos, Vec2f rot, ServerWorld world, int level, String name, Text displayName, MinecraftServer server, @Nullable Entity entity, boolean silent, CmdResConsumer consumer, EntityAnchorArgumentType.EntityAnchor entityAnchor) { super(output, pos, rot, world, level, name, displayName, server, entity, silent, consumer, entityAnchor); this.resConsumer = consumer; } public void sendResultIfNot() { resConsumer.sendResultIfNot(); } }