mirror of
https://github.com/GeyserMC/MCProtocolLib.git
synced 2024-12-26 23:52:31 -05:00
Merge pull request #872 from AlexProgrammerDE/feature/1.21.4
Merge master into 1.21.4 again
This commit is contained in:
commit
ce8109ef3b
201 changed files with 1127 additions and 242 deletions
|
@ -0,0 +1,149 @@
|
|||
package org.geysermc.mcprotocollib.network.helper;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.AddressedEnvelope;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.EventLoop;
|
||||
import io.netty.handler.codec.dns.DefaultDnsQuestion;
|
||||
import io.netty.handler.codec.dns.DefaultDnsRawRecord;
|
||||
import io.netty.handler.codec.dns.DefaultDnsRecordDecoder;
|
||||
import io.netty.handler.codec.dns.DnsRecordType;
|
||||
import io.netty.handler.codec.dns.DnsResponse;
|
||||
import io.netty.handler.codec.dns.DnsSection;
|
||||
import io.netty.handler.codec.haproxy.HAProxyCommand;
|
||||
import io.netty.handler.codec.haproxy.HAProxyMessage;
|
||||
import io.netty.handler.codec.haproxy.HAProxyMessageEncoder;
|
||||
import io.netty.handler.codec.haproxy.HAProxyProtocolVersion;
|
||||
import io.netty.handler.codec.haproxy.HAProxyProxiedProtocol;
|
||||
import io.netty.handler.proxy.HttpProxyHandler;
|
||||
import io.netty.handler.proxy.Socks4ProxyHandler;
|
||||
import io.netty.handler.proxy.Socks5ProxyHandler;
|
||||
import io.netty.resolver.dns.DnsNameResolver;
|
||||
import io.netty.resolver.dns.DnsNameResolverBuilder;
|
||||
import org.geysermc.mcprotocollib.network.BuiltinFlags;
|
||||
import org.geysermc.mcprotocollib.network.ProxyInfo;
|
||||
import org.geysermc.mcprotocollib.network.Session;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public class NettyHelper {
|
||||
private static final Logger log = LoggerFactory.getLogger(NettyHelper.class);
|
||||
private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b";
|
||||
|
||||
public static InetSocketAddress resolveAddress(Session session, EventLoop eventLoop, String host, int port) {
|
||||
String name = session.getPacketProtocol().getSRVRecordPrefix() + "._tcp." + host;
|
||||
log.debug("Attempting SRV lookup for \"{}\".", name);
|
||||
|
||||
if (session.getFlag(BuiltinFlags.ATTEMPT_SRV_RESOLVE, true) && (!host.matches(IP_REGEX) && !host.equalsIgnoreCase("localhost"))) {
|
||||
try (DnsNameResolver resolver = new DnsNameResolverBuilder(eventLoop)
|
||||
.channelFactory(TransportHelper.TRANSPORT_TYPE.datagramChannelFactory())
|
||||
.build()) {
|
||||
AddressedEnvelope<DnsResponse, InetSocketAddress> envelope = resolver.query(new DefaultDnsQuestion(name, DnsRecordType.SRV)).get();
|
||||
try {
|
||||
DnsResponse response = envelope.content();
|
||||
if (response.count(DnsSection.ANSWER) > 0) {
|
||||
DefaultDnsRawRecord record = response.recordAt(DnsSection.ANSWER, 0);
|
||||
if (record.type() == DnsRecordType.SRV) {
|
||||
ByteBuf buf = record.content();
|
||||
buf.skipBytes(4); // Skip priority and weight.
|
||||
|
||||
int tempPort = buf.readUnsignedShort();
|
||||
String tempHost = DefaultDnsRecordDecoder.decodeName(buf);
|
||||
if (tempHost.endsWith(".")) {
|
||||
tempHost = tempHost.substring(0, tempHost.length() - 1);
|
||||
}
|
||||
|
||||
log.debug("Found SRV record containing \"{}:{}\".", tempHost, tempPort);
|
||||
|
||||
host = tempHost;
|
||||
port = tempPort;
|
||||
} else {
|
||||
log.debug("Received non-SRV record in response.");
|
||||
}
|
||||
} else {
|
||||
log.debug("No SRV record found.");
|
||||
}
|
||||
} finally {
|
||||
envelope.release();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.debug("Failed to resolve SRV record.", e);
|
||||
}
|
||||
} else {
|
||||
log.debug("Not resolving SRV record for {}", host);
|
||||
}
|
||||
|
||||
// Resolve host here
|
||||
try {
|
||||
InetAddress resolved = InetAddress.getByName(host);
|
||||
log.debug("Resolved {} -> {}", host, resolved.getHostAddress());
|
||||
return new InetSocketAddress(resolved, port);
|
||||
} catch (UnknownHostException e) {
|
||||
log.debug("Failed to resolve host, letting Netty do it instead.", e);
|
||||
return InetSocketAddress.createUnresolved(host, port);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initializeHAProxySupport(Session session, Channel channel) {
|
||||
InetSocketAddress clientAddress = session.getFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS);
|
||||
if (clientAddress == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
channel.pipeline().addLast("proxy-protocol-encoder", HAProxyMessageEncoder.INSTANCE);
|
||||
channel.pipeline().addLast("proxy-protocol-packet-sender", new ChannelInboundHandlerAdapter() {
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
InetSocketAddress remoteAddress = (InetSocketAddress) ctx.channel().remoteAddress();
|
||||
HAProxyProxiedProtocol proxiedProtocol = clientAddress.getAddress() instanceof Inet4Address ? HAProxyProxiedProtocol.TCP4 : HAProxyProxiedProtocol.TCP6;
|
||||
ctx.channel().writeAndFlush(new HAProxyMessage(
|
||||
HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, proxiedProtocol,
|
||||
clientAddress.getAddress().getHostAddress(), remoteAddress.getAddress().getHostAddress(),
|
||||
clientAddress.getPort(), remoteAddress.getPort()
|
||||
)).addListener(future -> channel.pipeline().remove("proxy-protocol-encoder"));
|
||||
ctx.pipeline().remove(this);
|
||||
|
||||
super.channelActive(ctx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void addProxy(ProxyInfo proxy, ChannelPipeline pipeline) {
|
||||
if (proxy == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (proxy.type()) {
|
||||
case HTTP -> {
|
||||
if (proxy.username() != null && proxy.password() != null) {
|
||||
pipeline.addLast("proxy", new HttpProxyHandler(proxy.address(), proxy.username(), proxy.password()));
|
||||
} else {
|
||||
pipeline.addLast("proxy", new HttpProxyHandler(proxy.address()));
|
||||
}
|
||||
}
|
||||
case SOCKS4 -> {
|
||||
if (proxy.username() != null) {
|
||||
pipeline.addLast("proxy", new Socks4ProxyHandler(proxy.address(), proxy.username()));
|
||||
} else {
|
||||
pipeline.addLast("proxy", new Socks4ProxyHandler(proxy.address()));
|
||||
}
|
||||
}
|
||||
case SOCKS5 -> {
|
||||
if (proxy.username() != null && proxy.password() != null) {
|
||||
pipeline.addLast("proxy", new Socks5ProxyHandler(proxy.address(), proxy.username(), proxy.password()));
|
||||
} else {
|
||||
pipeline.addLast("proxy", new Socks5ProxyHandler(proxy.address()));
|
||||
}
|
||||
}
|
||||
default -> throw new UnsupportedOperationException("Unsupported proxy type: " + proxy.type());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,6 +29,8 @@ import java.util.concurrent.ThreadFactory;
|
|||
import java.util.function.Function;
|
||||
|
||||
public class TransportHelper {
|
||||
public static final TransportHelper.TransportType TRANSPORT_TYPE = TransportHelper.determineTransportMethod();
|
||||
|
||||
public enum TransportMethod {
|
||||
NIO, EPOLL, KQUEUE, IO_URING
|
||||
}
|
||||
|
@ -45,7 +47,7 @@ public class TransportHelper {
|
|||
boolean supportsTcpFastOpenClient) {
|
||||
}
|
||||
|
||||
public static TransportType determineTransportMethod() {
|
||||
private static TransportType determineTransportMethod() {
|
||||
if (isClassAvailable("io.netty.incubator.channel.uring.IOUring") && IOUring.isAvailable()) {
|
||||
return new TransportType(
|
||||
TransportMethod.IO_URING,
|
||||
|
|
|
@ -9,13 +9,14 @@ import org.geysermc.mcprotocollib.network.Session;
|
|||
public interface Packet {
|
||||
|
||||
/**
|
||||
* Gets whether the packet has handling priority.
|
||||
* If the result is true, the packet will be handled immediately after being
|
||||
* decoded.
|
||||
* Gets whether the packet should run on an async game thread rather than blocking the network (Netty) thread.
|
||||
* Packets that qualify for this are usually packets with an ensureRunningOnSameThread call at the top of their packet listener method in the Minecraft code.
|
||||
* Packets which need extra attention because they aren't "fully" handled async are marked using
|
||||
* // GAME THREAD DETAIL comments in the MCProtocolLib code.
|
||||
*
|
||||
* @return Whether the packet has priority.
|
||||
* @return Whether the packet be handled async from the Netty thread.
|
||||
*/
|
||||
default boolean isPriority() {
|
||||
default boolean shouldRunOnGameThread() {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package org.geysermc.mcprotocollib.network.tcp;
|
||||
|
||||
import io.netty.channel.DefaultEventLoopGroup;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class DefaultPacketHandlerExecutor {
|
||||
/**
|
||||
* Controls whether non-priority packets are handled in a separate event loop
|
||||
*/
|
||||
public static boolean USE_EVENT_LOOP_FOR_PACKETS = true;
|
||||
private static EventLoopGroup PACKET_EVENT_LOOP;
|
||||
private static final int SHUTDOWN_QUIET_PERIOD_MS = 100;
|
||||
private static final int SHUTDOWN_TIMEOUT_MS = 500;
|
||||
|
||||
public static Executor createExecutor() {
|
||||
if (!USE_EVENT_LOOP_FOR_PACKETS) {
|
||||
return Runnable::run;
|
||||
}
|
||||
|
||||
if (PACKET_EVENT_LOOP == null) {
|
||||
// See TcpClientSession.newThreadFactory() for details on
|
||||
// daemon threads and their interaction with the runtime.
|
||||
PACKET_EVENT_LOOP = new DefaultEventLoopGroup(new DefaultThreadFactory(DefaultPacketHandlerExecutor.class, true));
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(
|
||||
() -> PACKET_EVENT_LOOP.shutdownGracefully(SHUTDOWN_QUIET_PERIOD_MS, SHUTDOWN_TIMEOUT_MS, TimeUnit.MILLISECONDS)));
|
||||
}
|
||||
|
||||
return PACKET_EVENT_LOOP.next();
|
||||
}
|
||||
}
|
|
@ -1,55 +1,28 @@
|
|||
package org.geysermc.mcprotocollib.network.tcp;
|
||||
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import io.netty.channel.AddressedEnvelope;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.ChannelInboundHandlerAdapter;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.ChannelPipeline;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.handler.codec.dns.DefaultDnsQuestion;
|
||||
import io.netty.handler.codec.dns.DefaultDnsRawRecord;
|
||||
import io.netty.handler.codec.dns.DefaultDnsRecordDecoder;
|
||||
import io.netty.handler.codec.dns.DnsRecordType;
|
||||
import io.netty.handler.codec.dns.DnsResponse;
|
||||
import io.netty.handler.codec.dns.DnsSection;
|
||||
import io.netty.handler.codec.haproxy.HAProxyCommand;
|
||||
import io.netty.handler.codec.haproxy.HAProxyMessage;
|
||||
import io.netty.handler.codec.haproxy.HAProxyMessageEncoder;
|
||||
import io.netty.handler.codec.haproxy.HAProxyProtocolVersion;
|
||||
import io.netty.handler.codec.haproxy.HAProxyProxiedProtocol;
|
||||
import io.netty.handler.proxy.HttpProxyHandler;
|
||||
import io.netty.handler.proxy.Socks4ProxyHandler;
|
||||
import io.netty.handler.proxy.Socks5ProxyHandler;
|
||||
import io.netty.handler.timeout.ReadTimeoutHandler;
|
||||
import io.netty.handler.timeout.WriteTimeoutHandler;
|
||||
import io.netty.resolver.dns.DnsNameResolver;
|
||||
import io.netty.resolver.dns.DnsNameResolverBuilder;
|
||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.geysermc.mcprotocollib.network.BuiltinFlags;
|
||||
import org.geysermc.mcprotocollib.network.ProxyInfo;
|
||||
import org.geysermc.mcprotocollib.network.codec.PacketCodecHelper;
|
||||
import org.geysermc.mcprotocollib.network.helper.NettyHelper;
|
||||
import org.geysermc.mcprotocollib.network.helper.TransportHelper;
|
||||
import org.geysermc.mcprotocollib.network.packet.PacketProtocol;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class TcpClientSession extends TcpSession {
|
||||
private static final TransportHelper.TransportType TRANSPORT_TYPE = TransportHelper.determineTransportMethod();
|
||||
private static final String IP_REGEX = "\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\b";
|
||||
private static final Logger log = LoggerFactory.getLogger(TcpClientSession.class);
|
||||
private static EventLoopGroup EVENT_LOOP_GROUP;
|
||||
|
||||
/**
|
||||
|
@ -76,7 +49,11 @@ public class TcpClientSession extends TcpSession {
|
|||
}
|
||||
|
||||
public TcpClientSession(String host, int port, String bindAddress, int bindPort, PacketProtocol protocol, ProxyInfo proxy) {
|
||||
super(host, port, protocol);
|
||||
this(host, port, bindAddress, bindPort, protocol, proxy, DefaultPacketHandlerExecutor.createExecutor());
|
||||
}
|
||||
|
||||
public TcpClientSession(String host, int port, String bindAddress, int bindPort, PacketProtocol protocol, ProxyInfo proxy, Executor packetHandlerExecutor) {
|
||||
super(host, port, protocol, packetHandlerExecutor);
|
||||
this.bindAddress = bindAddress;
|
||||
this.bindPort = bindPort;
|
||||
this.proxy = proxy;
|
||||
|
@ -94,12 +71,12 @@ public class TcpClientSession extends TcpSession {
|
|||
}
|
||||
|
||||
final Bootstrap bootstrap = new Bootstrap()
|
||||
.channelFactory(TRANSPORT_TYPE.socketChannelFactory())
|
||||
.channelFactory(TransportHelper.TRANSPORT_TYPE.socketChannelFactory())
|
||||
.option(ChannelOption.TCP_NODELAY, true)
|
||||
.option(ChannelOption.IP_TOS, 0x18)
|
||||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, getFlag(BuiltinFlags.CLIENT_CONNECT_TIMEOUT, 30) * 1000)
|
||||
.group(EVENT_LOOP_GROUP)
|
||||
.remoteAddress(resolveAddress())
|
||||
.remoteAddress(NettyHelper.resolveAddress(this, EVENT_LOOP_GROUP.next(), getHost(), getPort()))
|
||||
.localAddress(bindAddress, bindPort)
|
||||
.handler(new ChannelInitializer<>() {
|
||||
@Override
|
||||
|
@ -109,9 +86,9 @@ public class TcpClientSession extends TcpSession {
|
|||
|
||||
ChannelPipeline pipeline = channel.pipeline();
|
||||
|
||||
addProxy(pipeline);
|
||||
NettyHelper.addProxy(proxy, pipeline);
|
||||
|
||||
initializeHAProxySupport(channel);
|
||||
NettyHelper.initializeHAProxySupport(TcpClientSession.this, channel);
|
||||
|
||||
pipeline.addLast("read-timeout", new ReadTimeoutHandler(getFlag(BuiltinFlags.READ_TIMEOUT, 30)));
|
||||
pipeline.addLast("write-timeout", new WriteTimeoutHandler(getFlag(BuiltinFlags.WRITE_TIMEOUT, 0)));
|
||||
|
@ -127,7 +104,7 @@ public class TcpClientSession extends TcpSession {
|
|||
}
|
||||
});
|
||||
|
||||
if (getFlag(BuiltinFlags.TCP_FAST_OPEN, false) && TRANSPORT_TYPE.supportsTcpFastOpenClient()) {
|
||||
if (getFlag(BuiltinFlags.TCP_FAST_OPEN, false) && TransportHelper.TRANSPORT_TYPE.supportsTcpFastOpenClient()) {
|
||||
bootstrap.option(ChannelOption.TCP_FASTOPEN_CONNECT, true);
|
||||
}
|
||||
|
||||
|
@ -150,121 +127,12 @@ public class TcpClientSession extends TcpSession {
|
|||
return this.codecHelper;
|
||||
}
|
||||
|
||||
private InetSocketAddress resolveAddress() {
|
||||
String name = this.getPacketProtocol().getSRVRecordPrefix() + "._tcp." + this.getHost();
|
||||
log.debug("Attempting SRV lookup for \"{}\".", name);
|
||||
|
||||
if (getFlag(BuiltinFlags.ATTEMPT_SRV_RESOLVE, true) && (!this.host.matches(IP_REGEX) && !this.host.equalsIgnoreCase("localhost"))) {
|
||||
try (DnsNameResolver resolver = new DnsNameResolverBuilder(EVENT_LOOP_GROUP.next())
|
||||
.channelFactory(TRANSPORT_TYPE.datagramChannelFactory())
|
||||
.build()) {
|
||||
AddressedEnvelope<DnsResponse, InetSocketAddress> envelope = resolver.query(new DefaultDnsQuestion(name, DnsRecordType.SRV)).get();
|
||||
try {
|
||||
DnsResponse response = envelope.content();
|
||||
if (response.count(DnsSection.ANSWER) > 0) {
|
||||
DefaultDnsRawRecord record = response.recordAt(DnsSection.ANSWER, 0);
|
||||
if (record.type() == DnsRecordType.SRV) {
|
||||
ByteBuf buf = record.content();
|
||||
buf.skipBytes(4); // Skip priority and weight.
|
||||
|
||||
int port = buf.readUnsignedShort();
|
||||
String host = DefaultDnsRecordDecoder.decodeName(buf);
|
||||
if (host.endsWith(".")) {
|
||||
host = host.substring(0, host.length() - 1);
|
||||
}
|
||||
|
||||
log.debug("Found SRV record containing \"{}:{}\".", host, port);
|
||||
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
} else {
|
||||
log.debug("Received non-SRV record in response.");
|
||||
}
|
||||
} else {
|
||||
log.debug("No SRV record found.");
|
||||
}
|
||||
} finally {
|
||||
envelope.release();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.debug("Failed to resolve SRV record.", e);
|
||||
}
|
||||
} else {
|
||||
log.debug("Not resolving SRV record for {}", this.host);
|
||||
}
|
||||
|
||||
// Resolve host here
|
||||
try {
|
||||
InetAddress resolved = InetAddress.getByName(getHost());
|
||||
log.debug("Resolved {} -> {}", getHost(), resolved.getHostAddress());
|
||||
return new InetSocketAddress(resolved, getPort());
|
||||
} catch (UnknownHostException e) {
|
||||
log.debug("Failed to resolve host, letting Netty do it instead.", e);
|
||||
return InetSocketAddress.createUnresolved(getHost(), getPort());
|
||||
}
|
||||
}
|
||||
|
||||
private void addProxy(ChannelPipeline pipeline) {
|
||||
if (proxy == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (proxy.type()) {
|
||||
case HTTP -> {
|
||||
if (proxy.username() != null && proxy.password() != null) {
|
||||
pipeline.addLast("proxy", new HttpProxyHandler(proxy.address(), proxy.username(), proxy.password()));
|
||||
} else {
|
||||
pipeline.addLast("proxy", new HttpProxyHandler(proxy.address()));
|
||||
}
|
||||
}
|
||||
case SOCKS4 -> {
|
||||
if (proxy.username() != null) {
|
||||
pipeline.addLast("proxy", new Socks4ProxyHandler(proxy.address(), proxy.username()));
|
||||
} else {
|
||||
pipeline.addLast("proxy", new Socks4ProxyHandler(proxy.address()));
|
||||
}
|
||||
}
|
||||
case SOCKS5 -> {
|
||||
if (proxy.username() != null && proxy.password() != null) {
|
||||
pipeline.addLast("proxy", new Socks5ProxyHandler(proxy.address(), proxy.username(), proxy.password()));
|
||||
} else {
|
||||
pipeline.addLast("proxy", new Socks5ProxyHandler(proxy.address()));
|
||||
}
|
||||
}
|
||||
default -> throw new UnsupportedOperationException("Unsupported proxy type: " + proxy.type());
|
||||
}
|
||||
}
|
||||
|
||||
private void initializeHAProxySupport(Channel channel) {
|
||||
InetSocketAddress clientAddress = getFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS);
|
||||
if (clientAddress == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
channel.pipeline().addLast("proxy-protocol-encoder", HAProxyMessageEncoder.INSTANCE);
|
||||
channel.pipeline().addLast("proxy-protocol-packet-sender", new ChannelInboundHandlerAdapter() {
|
||||
@Override
|
||||
public void channelActive(ChannelHandlerContext ctx) throws Exception {
|
||||
InetSocketAddress remoteAddress = (InetSocketAddress) ctx.channel().remoteAddress();
|
||||
HAProxyProxiedProtocol proxiedProtocol = clientAddress.getAddress() instanceof Inet4Address ? HAProxyProxiedProtocol.TCP4 : HAProxyProxiedProtocol.TCP6;
|
||||
ctx.channel().writeAndFlush(new HAProxyMessage(
|
||||
HAProxyProtocolVersion.V2, HAProxyCommand.PROXY, proxiedProtocol,
|
||||
clientAddress.getAddress().getHostAddress(), remoteAddress.getAddress().getHostAddress(),
|
||||
clientAddress.getPort(), remoteAddress.getPort()
|
||||
)).addListener(future -> channel.pipeline().remove("proxy-protocol-encoder"));
|
||||
ctx.pipeline().remove(this);
|
||||
|
||||
super.channelActive(ctx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void createTcpEventLoopGroup() {
|
||||
if (EVENT_LOOP_GROUP != null) {
|
||||
return;
|
||||
}
|
||||
|
||||
EVENT_LOOP_GROUP = TRANSPORT_TYPE.eventLoopGroupFactory().apply(newThreadFactory());
|
||||
EVENT_LOOP_GROUP = TransportHelper.TRANSPORT_TYPE.eventLoopGroupFactory().apply(newThreadFactory());
|
||||
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(
|
||||
() -> EVENT_LOOP_GROUP.shutdownGracefully(SHUTDOWN_QUIET_PERIOD_MS, SHUTDOWN_TIMEOUT_MS, TimeUnit.MILLISECONDS)));
|
||||
|
|
|
@ -19,17 +19,23 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
public class TcpServer extends AbstractServer {
|
||||
private static final TransportHelper.TransportType TRANSPORT_TYPE = TransportHelper.determineTransportMethod();
|
||||
private static final Logger log = LoggerFactory.getLogger(TcpServer.class);
|
||||
|
||||
private final Supplier<Executor> packetHandlerExecutorFactory;
|
||||
private EventLoopGroup group;
|
||||
private Channel channel;
|
||||
|
||||
public TcpServer(String host, int port, Supplier<? extends PacketProtocol> protocol) {
|
||||
this(host, port, protocol, DefaultPacketHandlerExecutor::createExecutor);
|
||||
}
|
||||
|
||||
public TcpServer(String host, int port, Supplier<? extends PacketProtocol> protocol, Supplier<Executor> packetHandlerExecutorFactory) {
|
||||
super(host, port, protocol);
|
||||
this.packetHandlerExecutorFactory = packetHandlerExecutorFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,10 +49,10 @@ public class TcpServer extends AbstractServer {
|
|||
return;
|
||||
}
|
||||
|
||||
this.group = TRANSPORT_TYPE.eventLoopGroupFactory().apply(null);
|
||||
this.group = TransportHelper.TRANSPORT_TYPE.eventLoopGroupFactory().apply(null);
|
||||
|
||||
ServerBootstrap bootstrap = new ServerBootstrap()
|
||||
.channelFactory(TRANSPORT_TYPE.serverSocketChannelFactory())
|
||||
.channelFactory(TransportHelper.TRANSPORT_TYPE.serverSocketChannelFactory())
|
||||
.group(this.group)
|
||||
.childOption(ChannelOption.TCP_NODELAY, true)
|
||||
.childOption(ChannelOption.IP_TOS, 0x18)
|
||||
|
@ -57,7 +63,7 @@ public class TcpServer extends AbstractServer {
|
|||
InetSocketAddress address = (InetSocketAddress) channel.remoteAddress();
|
||||
PacketProtocol protocol = createPacketProtocol();
|
||||
|
||||
TcpSession session = new TcpServerSession(address.getHostName(), address.getPort(), protocol, TcpServer.this);
|
||||
TcpSession session = new TcpServerSession(address.getHostName(), address.getPort(), protocol, TcpServer.this, packetHandlerExecutorFactory.get());
|
||||
session.getPacketProtocol().newServerSession(TcpServer.this, session);
|
||||
|
||||
ChannelPipeline pipeline = channel.pipeline();
|
||||
|
@ -76,7 +82,7 @@ public class TcpServer extends AbstractServer {
|
|||
}
|
||||
});
|
||||
|
||||
if (getGlobalFlag(BuiltinFlags.TCP_FAST_OPEN, false) && TRANSPORT_TYPE.supportsTcpFastOpenServer()) {
|
||||
if (getGlobalFlag(BuiltinFlags.TCP_FAST_OPEN, false) && TransportHelper.TRANSPORT_TYPE.supportsTcpFastOpenServer()) {
|
||||
bootstrap.option(ChannelOption.TCP_FASTOPEN, 3);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,13 +7,14 @@ import org.geysermc.mcprotocollib.network.packet.PacketProtocol;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
public class TcpServerSession extends TcpSession {
|
||||
private final TcpServer server;
|
||||
private final PacketCodecHelper codecHelper;
|
||||
|
||||
public TcpServerSession(String host, int port, PacketProtocol protocol, TcpServer server) {
|
||||
super(host, port, protocol);
|
||||
public TcpServerSession(String host, int port, PacketProtocol protocol, TcpServer server, Executor packetHandlerExecutor) {
|
||||
super(host, port, protocol, packetHandlerExecutor);
|
||||
this.server = server;
|
||||
this.codecHelper = protocol.createHelper();
|
||||
}
|
||||
|
|
|
@ -3,11 +3,7 @@ package org.geysermc.mcprotocollib.network.tcp;
|
|||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandlerContext;
|
||||
import io.netty.channel.DefaultEventLoopGroup;
|
||||
import io.netty.channel.EventLoop;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.SimpleChannelInboundHandler;
|
||||
import io.netty.util.concurrent.DefaultThreadFactory;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
|
@ -33,24 +29,16 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public abstract class TcpSession extends SimpleChannelInboundHandler<Packet> implements Session {
|
||||
private static final Logger log = LoggerFactory.getLogger(TcpSession.class);
|
||||
|
||||
/**
|
||||
* Controls whether non-priority packets are handled in a separate event loop
|
||||
*/
|
||||
public static boolean USE_EVENT_LOOP_FOR_PACKETS = true;
|
||||
private static EventLoopGroup PACKET_EVENT_LOOP;
|
||||
private static final int SHUTDOWN_QUIET_PERIOD_MS = 100;
|
||||
private static final int SHUTDOWN_TIMEOUT_MS = 500;
|
||||
|
||||
protected String host;
|
||||
protected int port;
|
||||
private final PacketProtocol protocol;
|
||||
private final EventLoop eventLoop = createEventLoop();
|
||||
private final Executor packetHandlerExecutor;
|
||||
|
||||
private final Map<String, Object> flags = new HashMap<>();
|
||||
private final List<SessionListener> listeners = new CopyOnWriteArrayList<>();
|
||||
|
@ -58,10 +46,11 @@ public abstract class TcpSession extends SimpleChannelInboundHandler<Packet> imp
|
|||
private Channel channel;
|
||||
protected boolean disconnected = false;
|
||||
|
||||
public TcpSession(String host, int port, PacketProtocol protocol) {
|
||||
public TcpSession(String host, int port, PacketProtocol protocol, Executor packetHandlerExecutor) {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.protocol = protocol;
|
||||
this.packetHandlerExecutor = packetHandlerExecutor;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -269,21 +258,6 @@ public abstract class TcpSession extends SimpleChannelInboundHandler<Packet> imp
|
|||
}
|
||||
}
|
||||
|
||||
private @Nullable EventLoop createEventLoop() {
|
||||
if (!USE_EVENT_LOOP_FOR_PACKETS) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (PACKET_EVENT_LOOP == null) {
|
||||
// See TcpClientSession.newThreadFactory() for details on
|
||||
// daemon threads and their interaction with the runtime.
|
||||
PACKET_EVENT_LOOP = new DefaultEventLoopGroup(new DefaultThreadFactory(this.getClass(), true));
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(
|
||||
() -> PACKET_EVENT_LOOP.shutdownGracefully(SHUTDOWN_QUIET_PERIOD_MS, SHUTDOWN_TIMEOUT_MS, TimeUnit.MILLISECONDS)));
|
||||
}
|
||||
return PACKET_EVENT_LOOP.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Channel getChannel() {
|
||||
return this.channel;
|
||||
|
@ -322,8 +296,8 @@ public abstract class TcpSession extends SimpleChannelInboundHandler<Packet> imp
|
|||
|
||||
@Override
|
||||
protected void channelRead0(ChannelHandlerContext ctx, Packet packet) {
|
||||
if (!packet.isPriority() && eventLoop != null) {
|
||||
eventLoop.execute(() -> this.callPacketReceived(packet));
|
||||
if (packet.shouldRunOnGameThread()) {
|
||||
packetHandlerExecutor.execute(() -> this.callPacketReceived(packet));
|
||||
} else {
|
||||
this.callPacketReceived(packet);
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ import org.geysermc.mcprotocollib.protocol.packet.login.clientbound.ClientboundL
|
|||
import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundHelloPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundKeyPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundLoginAcknowledgedPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.clientbound.ClientboundPongResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ping.clientbound.ClientboundPongResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.clientbound.ClientboundStatusResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.serverbound.ServerboundPingRequestPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ping.serverbound.ServerboundPingRequestPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.serverbound.ServerboundStatusRequestPacket;
|
||||
|
||||
import javax.crypto.KeyGenerator;
|
||||
|
|
|
@ -35,9 +35,9 @@ import org.geysermc.mcprotocollib.protocol.packet.login.clientbound.ClientboundL
|
|||
import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundHelloPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundKeyPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundLoginAcknowledgedPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.clientbound.ClientboundPongResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ping.clientbound.ClientboundPongResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.clientbound.ClientboundStatusResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.serverbound.ServerboundPingRequestPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ping.serverbound.ServerboundPingRequestPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.serverbound.ServerboundStatusRequestPacket;
|
||||
|
||||
import javax.crypto.SecretKey;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.geysermc.mcprotocollib.protocol.codec;
|
||||
|
||||
import org.geysermc.mcprotocollib.protocol.data.ProtocolState;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundCookieRequestPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.cookie.clientbound.ClientboundCookieRequestPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundCustomPayloadPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundCustomReportDetailsPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundDisconnectPacket;
|
||||
|
@ -13,7 +13,7 @@ import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.Clientbound
|
|||
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundStoreCookiePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundTransferPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ClientboundUpdateTagsPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.clientbound.ServerboundCookieResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.cookie.serverbound.ServerboundCookieResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.serverbound.ServerboundClientInformationPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.serverbound.ServerboundCustomPayloadPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.common.serverbound.ServerboundKeepAlivePacket;
|
||||
|
@ -209,9 +209,9 @@ import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundC
|
|||
import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundHelloPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundKeyPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.login.serverbound.ServerboundLoginAcknowledgedPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.clientbound.ClientboundPongResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ping.clientbound.ClientboundPongResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.clientbound.ClientboundStatusResponsePacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.serverbound.ServerboundPingRequestPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.ping.serverbound.ServerboundPingRequestPacket;
|
||||
import org.geysermc.mcprotocollib.protocol.packet.status.serverbound.ServerboundStatusRequestPacket;
|
||||
|
||||
public class MinecraftCodec {
|
||||
|
|
|
@ -26,4 +26,10 @@ public class ClientboundCustomPayloadPacket implements MinecraftPacket {
|
|||
helper.writeResourceLocation(out, this.channel);
|
||||
out.writeBytes(this.data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
// GAME THREAD DETAIL: Only non-discarded payloads are handled async.
|
||||
return false; // False, you need to handle making it async yourself
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,4 +33,9 @@ public class ClientboundCustomReportDetailsPacket implements MinecraftPacket {
|
|||
helper.writeString(out, entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,4 @@ public class ClientboundDisconnectPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeComponent(out, this.reason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPriority() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,9 @@ public class ClientboundPingPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
out.writeInt(this.id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,9 @@ public class ClientboundResourcePackPopPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeNullable(out, this.id, helper::writeUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,4 +38,9 @@ public class ClientboundResourcePackPushPacket implements MinecraftPacket {
|
|||
out.writeBoolean(this.required);
|
||||
helper.writeNullable(out, this.prompt, helper::writeComponent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,4 +52,9 @@ public class ClientboundServerLinksPacket implements MinecraftPacket {
|
|||
helper.writeString(out, link.link());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,9 @@ public class ClientboundStoreCookiePacket implements MinecraftPacket {
|
|||
helper.writeResourceLocation(out, this.key);
|
||||
helper.writeByteArray(out, this.payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,10 @@ public class ClientboundTransferPacket implements MinecraftPacket {
|
|||
helper.writeString(out, this.host);
|
||||
helper.writeVarInt(out, this.port);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
// GAME THREAD DETAIL: Code runs before packet is made async.
|
||||
return false; // False, you need to handle making it async yourself
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,4 +53,9 @@ public class ClientboundUpdateTagsPacket implements MinecraftPacket {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,4 +72,10 @@ public class ServerboundClientInformationPacket implements MinecraftPacket {
|
|||
out.writeBoolean(allowsListing);
|
||||
helper.writeVarInt(out, this.particleStatus.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
// GAME THREAD DETAIL: Code is only async during GAME state.
|
||||
return false; // False, you need to handle making it async yourself
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,4 +29,9 @@ public class ServerboundResourcePackPacket implements MinecraftPacket {
|
|||
helper.writeUUID(out, id);
|
||||
helper.writeVarInt(out, this.status.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,11 @@ public class ClientboundFinishConfigurationPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTerminal() {
|
||||
return true;
|
||||
|
|
|
@ -31,4 +31,9 @@ public class ClientboundRegistryDataPacket implements MinecraftPacket {
|
|||
helper.writeNullable(buf, entry.getData(), helper::writeAnyTag);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,9 @@ public class ClientboundSelectKnownPacks implements MinecraftPacket {
|
|||
helper.writeString(buf, entry.getVersion());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,11 @@ public class ServerboundFinishConfigurationPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf buf, MinecraftCodecHelper helper) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTerminal() {
|
||||
return true;
|
||||
|
|
|
@ -39,4 +39,9 @@ public class ServerboundSelectKnownPacks implements MinecraftPacket {
|
|||
helper.writeString(out, entry.getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package org.geysermc.mcprotocollib.protocol.packet.common.clientbound;
|
||||
package org.geysermc.mcprotocollib.protocol.packet.cookie.clientbound;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
@ -22,4 +22,9 @@ public class ClientboundCookieRequestPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeResourceLocation(out, this.key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
package org.geysermc.mcprotocollib.protocol.packet.common.clientbound;
|
||||
package org.geysermc.mcprotocollib.protocol.packet.cookie.serverbound;
|
||||
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import lombok.AllArgsConstructor;
|
|
@ -33,11 +33,6 @@ public class ClientIntentionPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.intent.ordinal() + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPriority() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTerminal() {
|
||||
return true;
|
||||
|
|
|
@ -91,4 +91,9 @@ public class ClientboundAwardStatsPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, entry.getIntValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,4 +138,9 @@ public class ClientboundBossEventPacket implements MinecraftPacket {
|
|||
out.writeByte(flags);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,4 +16,9 @@ public class ClientboundBundlePacket implements MinecraftPacket {
|
|||
@Override
|
||||
public void serialize(ByteBuf buf, MinecraftCodecHelper helper) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,9 @@ public class ClientboundChangeDifficultyPacket implements MinecraftPacket {
|
|||
out.writeByte(this.difficulty.ordinal());
|
||||
out.writeBoolean(this.difficultyLocked);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,4 +62,9 @@ public class ClientboundCommandSuggestionsPacket implements MinecraftPacket {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -300,4 +300,9 @@ public class ClientboundCommandsPacket implements MinecraftPacket {
|
|||
|
||||
helper.writeVarInt(out, this.firstNodeIndex);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,9 @@ public class ClientboundCooldownPacket implements MinecraftPacket {
|
|||
helper.writeResourceLocation(out, this.cooldownGroup);
|
||||
helper.writeVarInt(out, this.cooldownTicks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,4 +31,9 @@ public class ClientboundCustomChatCompletionsPacket implements MinecraftPacket {
|
|||
helper.writeString(out, entry);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,9 @@ public class ClientboundDeleteChatPacket implements MinecraftPacket {
|
|||
out.writeBytes(messageSignature.getMessageSignature());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,4 +35,9 @@ public class ClientboundDisguisedChatPacket implements MinecraftPacket {
|
|||
helper.writeComponent(out, this.name);
|
||||
helper.writeNullable(out, this.targetName, helper::writeComponent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,4 +61,9 @@ public class ClientboundLoginPacket implements MinecraftPacket {
|
|||
helper.writePlayerSpawnInfo(out, this.commonPlayerSpawnInfo);
|
||||
out.writeBoolean(this.enforcesSecureChat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,4 +84,9 @@ public class ClientboundPlayerChatPacket implements MinecraftPacket {
|
|||
helper.writeComponent(out, this.name);
|
||||
helper.writeNullable(out, this.targetName, helper::writeComponent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,4 +23,9 @@ public class ClientboundPlayerInfoRemovePacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeList(out, this.profileIds, helper::writeUUID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -127,4 +127,9 @@ public class ClientboundPlayerInfoUpdatePacket implements MinecraftPacket {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,11 @@ public class ClientboundRecipeBookAddPacket implements MinecraftPacket {
|
|||
out.writeBoolean(this.replace);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public record Entry(RecipeDisplayEntry contents, boolean notification, boolean highlight) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,4 +29,9 @@ public class ClientboundRecipeBookRemovePacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, recipe);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,6 +38,11 @@ public class ClientboundRecipeBookSettingsPacket implements MinecraftPacket {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
|
||||
private record TypeSettings(boolean open, boolean filtering) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,4 +39,9 @@ public class ClientboundRespawnPacket implements MinecraftPacket {
|
|||
}
|
||||
out.writeByte(dataToKeep);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,9 @@ public class ClientboundSelectAdvancementsTabPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeNullable(out, this.tabId, helper::writeString);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,9 @@ public class ClientboundServerDataPacket implements MinecraftPacket {
|
|||
helper.writeComponent(out, this.motd);
|
||||
helper.writeNullable(out, this.iconBytes, helper::writeByteArray);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,9 @@ public class ClientboundSetCameraPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeVarInt(out, this.cameraEntityId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,4 +46,9 @@ public class ClientboundSoundEntityPacket implements MinecraftPacket {
|
|||
out.writeFloat(this.pitch);
|
||||
out.writeLong(this.seed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,11 @@ public class ClientboundStartConfigurationPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTerminal() {
|
||||
return true;
|
||||
|
|
|
@ -55,4 +55,9 @@ public class ClientboundStopSoundPacket implements MinecraftPacket {
|
|||
helper.writeResourceLocation(out, this.sound);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,9 @@ public class ClientboundSystemChatPacket implements MinecraftPacket {
|
|||
helper.writeComponent(out, this.content);
|
||||
out.writeBoolean(this.overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,9 @@ public class ClientboundTabListPacket implements MinecraftPacket {
|
|||
helper.writeComponent(out, this.header);
|
||||
helper.writeComponent(out, this.footer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,9 @@ public class ClientboundTickingStatePacket implements MinecraftPacket {
|
|||
out.writeFloat(tickRate);
|
||||
out.writeBoolean(isFrozen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,4 +22,9 @@ public class ClientboundTickingStepPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeVarInt(out, this.tickSteps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -166,4 +166,9 @@ public class ClientboundUpdateAdvancementsPacket implements MinecraftPacket {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,4 +60,9 @@ public class ClientboundUpdateRecipesPacket implements MinecraftPacket {
|
|||
|
||||
public record SelectableRecipe(Ingredient input, SlotDisplay recipe) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,4 +30,9 @@ public class ClientboundAnimatePacket implements MinecraftPacket {
|
|||
out.writeByte(this.animation.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,4 +41,9 @@ public class ClientboundDamageEventPacket implements MinecraftPacket {
|
|||
out.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,9 @@ public class ClientboundEntityEventPacket implements MinecraftPacket {
|
|||
out.writeInt(this.entityId);
|
||||
helper.writeEntityEvent(out, this.event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,4 +41,9 @@ public class ClientboundEntityPositionSyncPacket implements MinecraftPacket {
|
|||
out.writeFloat(this.xRot);
|
||||
out.writeBoolean(this.onGround);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,9 @@ public class ClientboundHurtAnimationPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.id);
|
||||
out.writeFloat(this.yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,4 +33,9 @@ public class ClientboundMoveEntityPosPacket implements MinecraftPacket {
|
|||
out.writeShort((int) (this.moveZ * 4096));
|
||||
out.writeBoolean(this.onGround);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,4 +39,9 @@ public class ClientboundMoveEntityPosRotPacket implements MinecraftPacket {
|
|||
out.writeByte((byte) (this.pitch * 256 / 360));
|
||||
out.writeBoolean(this.onGround);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,4 +30,9 @@ public class ClientboundMoveEntityRotPacket implements MinecraftPacket {
|
|||
out.writeByte((byte) (this.pitch * 256 / 360));
|
||||
out.writeBoolean(this.onGround);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,4 +50,9 @@ public class ClientboundMoveMinecartPacket implements MinecraftPacket {
|
|||
output.writeFloat(lerpStep.weight());
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,4 +30,9 @@ public class ClientboundMoveVehiclePacket implements MinecraftPacket {
|
|||
out.writeFloat(this.yRot);
|
||||
out.writeFloat(this.xRot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,9 @@ public class ClientboundProjectilePowerPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.id);
|
||||
out.writeDouble(this.accelerationPower);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,4 +28,9 @@ public class ClientboundRemoveEntitiesPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, entityId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,9 @@ public class ClientboundRemoveMobEffectPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.entityId);
|
||||
helper.writeEffect(out, this.effect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,9 @@ public class ClientboundRotateHeadPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.entityId);
|
||||
out.writeByte((byte) (this.headYaw * 256 / 360));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,4 +26,9 @@ public class ClientboundSetEntityDataPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.entityId);
|
||||
helper.writeEntityMetadata(out, this.metadata);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,9 @@ public class ClientboundSetEntityLinkPacket implements MinecraftPacket {
|
|||
out.writeInt(this.entityId);
|
||||
out.writeInt(this.attachedToId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,4 +30,9 @@ public class ClientboundSetEntityMotionPacket implements MinecraftPacket {
|
|||
out.writeShort((int) (this.motionY * 8000));
|
||||
out.writeShort((int) (this.motionZ * 8000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,4 +47,9 @@ public class ClientboundSetEquipmentPacket implements MinecraftPacket {
|
|||
helper.writeOptionalItemStack(out, this.equipment[i].getItem());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,4 +31,9 @@ public class ClientboundSetPassengersPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, entityId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,4 +27,9 @@ public class ClientboundTakeItemEntityPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.collectorEntityId);
|
||||
helper.writeVarInt(out, this.itemCount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,4 +64,9 @@ public class ClientboundTeleportEntityPacket implements MinecraftPacket {
|
|||
|
||||
out.writeBoolean(this.onGround);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,4 +54,9 @@ public class ClientboundUpdateAttributesPacket implements MinecraftPacket {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,4 +63,9 @@ public class ClientboundUpdateMobEffectPacket implements MinecraftPacket {
|
|||
|
||||
out.writeByte(flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,9 @@ public class ClientboundBlockChangedAckPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeVarInt(out, this.sequence);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,4 +58,9 @@ public class ClientboundPlayerAbilitiesPacket implements MinecraftPacket {
|
|||
out.writeFloat(this.flySpeed);
|
||||
out.writeFloat(this.walkSpeed);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,4 +25,9 @@ public class ClientboundPlayerCombatKillPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.playerId);
|
||||
helper.writeComponent(out, this.message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -55,4 +55,9 @@ public class ClientboundPlayerLookAtPacket implements MinecraftPacket {
|
|||
out.writeBoolean(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,4 +66,9 @@ public class ClientboundPlayerPositionPacket implements MinecraftPacket {
|
|||
|
||||
out.writeInt(flags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,4 +24,9 @@ public class ClientboundPlayerRotationPacket implements MinecraftPacket {
|
|||
out.writeFloat(this.yRot);
|
||||
out.writeFloat(this.xRot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,4 +27,9 @@ public class ClientboundSetExperiencePacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.level);
|
||||
helper.writeVarInt(out, this.totalExperience);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,4 +27,9 @@ public class ClientboundSetHealthPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.food);
|
||||
out.writeFloat(this.saturation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,9 @@ public class ClientboundSetHeldSlotPacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeVarInt(out, this.slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -120,4 +120,9 @@ public class ClientboundAddEntityPacket implements MinecraftPacket {
|
|||
out.writeShort((int) (this.motionY * 8000));
|
||||
out.writeShort((int) (this.motionZ * 8000));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,4 +33,9 @@ public class ClientboundAddExperienceOrbPacket implements MinecraftPacket {
|
|||
out.writeDouble(this.z);
|
||||
out.writeShort(this.exp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,4 +21,9 @@ public class ClientboundContainerClosePacket implements MinecraftPacket {
|
|||
public void serialize(ByteBuf out, MinecraftCodecHelper helper) {
|
||||
helper.writeVarInt(out, this.containerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,4 +39,9 @@ public class ClientboundContainerSetContentPacket implements MinecraftPacket {
|
|||
}
|
||||
helper.writeOptionalItemStack(out, this.carriedItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,4 +32,9 @@ public class ClientboundContainerSetDataPacket implements MinecraftPacket {
|
|||
out.writeShort(this.rawProperty);
|
||||
out.writeShort(this.value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,4 +32,9 @@ public class ClientboundContainerSetSlotPacket implements MinecraftPacket {
|
|||
out.writeShort(this.slot);
|
||||
helper.writeOptionalItemStack(out, this.item);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,4 +27,9 @@ public class ClientboundHorseScreenOpenPacket implements MinecraftPacket {
|
|||
helper.writeVarInt(out, this.inventoryColumns);
|
||||
out.writeInt(this.entityId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRunOnGameThread() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue