1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
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();
}
}
|