Hotfix - packets w/ compatibility and optimization

This commit is contained in:
Sotr
2019-03-21 20:59:20 +08:00
parent 0ebb3705c8
commit 58ed872c56
31 changed files with 67 additions and 2606 deletions

View File

@@ -1,6 +1,8 @@
package net.minecraft.server;
import com.google.common.collect.Lists;
import com.google.common.collect.Queues;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import io.akarin.server.core.PacketType;
@@ -8,6 +10,7 @@ import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelPromise;
import io.netty.channel.DefaultEventLoopGroup;
import io.netty.channel.SimpleChannelInboundHandler;
import io.netty.channel.epoll.EpollEventLoopGroup;
@@ -18,10 +21,13 @@ import io.netty.handler.timeout.TimeoutException;
import io.netty.util.AttributeKey;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
import io.netty.util.concurrent.PromiseNotifier;
import java.net.SocketAddress;
import java.nio.channels.Channels;
import java.util.Iterator;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.locks.ReentrantReadWriteLock;
import javax.annotation.Nullable;
import javax.crypto.SecretKey;
@@ -47,7 +53,8 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
return new DefaultEventLoopGroup(0, (new ThreadFactoryBuilder()).setNameFormat("Netty Local Client IO #%d").setDaemon(true).build());
});
private final EnumProtocolDirection h;
private final io.akarin.server.misc.CheckedConcurrentLinkedQueue<NetworkManager.QueuedPacket> packetQueue = new io.akarin.server.misc.CheckedConcurrentLinkedQueue<NetworkManager.QueuedPacket>(); private final Queue<NetworkManager.QueuedPacket> getPacketQueue() { return this.packetQueue; } // Paper - OBFHELPER // Akarin
private final ConcurrentLinkedQueue<NetworkManager.QueuedPacket> packetQueue = new ConcurrentLinkedQueue<NetworkManager.QueuedPacket>(); private final Queue<NetworkManager.QueuedPacket> getPacketQueue() { return this.packetQueue; } // Paper - OBFHELPER // Akarin
private final Queue<PacketPlayOutMapChunk> pendingChunkQueue = Lists.newLinkedList(); // Akarin - remove packet queue
private final ReentrantReadWriteLock j = new ReentrantReadWriteLock();
public Channel channel;
public SocketAddress socketAddress; public void setSpoofedRemoteAddress(SocketAddress address) { this.socketAddress = address; } // Paper - OBFHELPER
@@ -165,80 +172,53 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
this.packetListener = packetlistener;
}
public final void sendPacket(Packet<?> packet) { // Akarin - add final
public void sendPacket(Packet<?> packet) {
this.sendPacket(packet, (GenericFutureListener) null);
}
// Akarin start
public final void sendPackets(Packet<?> packet0, Packet<?> packet1) {
if (this.isConnected()) { // why send packet to whom not connected?
this.j.readLock().lock();
try {
// Send queued packets
this.sendPacketQueueUnsafe();
//this.j.readLock().lock();
//try {
// Queue new packets
this.packetQueue.offer(new QueuedPacket(packet0, null));
this.packetQueue.offer(new QueuedPacket(packet1, null));
} finally {
this.j.readLock().unlock();
}
this.dispatchPacket(packet0, null);
this.dispatchPacket(packet1, null);
//} finally {
// this.j.readLock().unlock();
//}
}
}
public final void sendPackets(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2) {
if (this.isConnected()) { // why send packet to whom not connected?
this.j.readLock().lock();
try {
// Send queued packets
this.sendPacketQueueUnsafe();
//this.j.readLock().lock();
//try {
// Queue new packets
this.packetQueue.offer(new QueuedPacket(packet0, null));
this.packetQueue.offer(new QueuedPacket(packet1, null));
this.packetQueue.offer(new QueuedPacket(packet2, null));
} finally {
this.j.readLock().unlock();
}
this.dispatchPacket(packet0, null);
this.dispatchPacket(packet1, null);
this.dispatchPacket(packet2, null);
//} finally {
//this.j.readLock().unlock();
//}
}
}
public final void sendPackets(Packet<?> packet0, Packet<?> packet1, Packet<?> packet2, Packet<?> packet3, Packet<?> packet4, Packet<?> packet5, Packet<?> packet6) {
if (this.isConnected()) { // why send packet to whom not connected?
this.j.readLock().lock();
try {
// Send queued packets
this.sendPacketQueueUnsafe();
//this.j.readLock().lock();
//try {
// Queue new packets
this.packetQueue.offer(new QueuedPacket(packet0, null));
this.packetQueue.offer(new QueuedPacket(packet1, null));
this.packetQueue.offer(new QueuedPacket(packet2, null));
this.packetQueue.offer(new QueuedPacket(packet3, null));
this.packetQueue.offer(new QueuedPacket(packet4, null));
this.packetQueue.offer(new QueuedPacket(packet5, null));
this.packetQueue.offer(new QueuedPacket(packet6, null));
} finally {
this.j.readLock().unlock();
}
}
}
private final void dispatchOrQueuePacketUnsafe(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
if (packet.canDispatchImmediately()) {
this.dispatchPacket(packet, genericfuturelistener);
} else {
this.packetQueue.offer(new QueuedPacket(packet, genericfuturelistener));
}
}
private final void sendPacketQueueUnsafe() {
while (!this.packetQueue.isEmpty()) {
QueuedPacket queuedPacket = this.packetQueue.poll(packet ->
packet != null && (
!(packet.getPacket().getType() == PacketType.PLAY_OUT_MAP_CHUNK) ||
(((PacketPlayOutMapChunk) packet.getPacket()).isReady())
), null);
if (queuedPacket != null)
this.dispatchPacket(queuedPacket.getPacket(), queuedPacket.getGenericFutureListener());
this.dispatchPacket(packet0, null);
this.dispatchPacket(packet1, null);
this.dispatchPacket(packet2, null);
this.dispatchPacket(packet3, null);
this.dispatchPacket(packet4, null);
this.dispatchPacket(packet5, null);
this.dispatchPacket(packet6, null);
//} finally {
//this.j.readLock().unlock();
//}
}
}
// Akarin end
@@ -246,16 +226,13 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
if (this.isConnected() /*&& this.sendPacketQueue() && !(packet instanceof PacketPlayOutMapChunk && !((PacketPlayOutMapChunk) packet).isReady())*/) { // Paper - Async-Anti-Xray - Add chunk packets which are not ready or all packets if the packet queue contains chunk packets which are not ready to the packet queue and send the packets later in the right order // Akarin
//this.o(); // Paper - Async-Anti-Xray - Move to if statement (this.sendPacketQueue())
// Akarin start
this.j.readLock().lock();
try {
// Send queued packets
this.sendPacketQueueUnsafe();
//this.j.readLock().lock();
//try {
// Dispatch or queue new packets
this.dispatchOrQueuePacketUnsafe(packet, genericfuturelistener);
} finally {
this.j.readLock().unlock();
}
//this.dispatchPacket(packet, genericfuturelistener);
this.dispatchPacket(packet, genericfuturelistener);
//} finally {
// this.j.readLock().unlock();
//}
} else if (false) {
// Akarin end
this.j.writeLock().lock();
@@ -269,8 +246,14 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
}
private final void dispatchPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER // Akarin - add final
private void b(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
// Akarin start
private final void dispatchPacket(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER
private final void b(Packet<?> packet, @Nullable GenericFutureListener<? extends Future<? super Void>> genericfuturelistener) {
if (!packet.canDispatchImmediately() && packet.getType() == PacketType.PLAY_OUT_MAP_CHUNK) {
this.pendingChunkQueue.add((PacketPlayOutMapChunk) packet);
return;
}
// Akarin end
EnumProtocol enumprotocol = EnumProtocol.a(packet);
EnumProtocol enumprotocol1 = (EnumProtocol) this.channel.attr(NetworkManager.c).get();
@@ -323,6 +306,16 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
private boolean sendPacketQueue() { return this.o(); } // OBFHELPER // void -> boolean
private boolean o() { // void -> boolean
if (this.channel != null && this.channel.isOpen()) {
// Akarin start
Iterator<PacketPlayOutMapChunk> iterator = this.pendingChunkQueue.iterator();
while (iterator.hasNext()) {
PacketPlayOutMapChunk packet = iterator.next();
if (packet.isReady()) {
this.dispatchPacket(packet, null);
iterator.remove();
}
}
/*
if (this.packetQueue.isEmpty()) { // return if the packet queue is empty so that the write lock by Anti-Xray doesn't affect the vanilla performance at all
return true;
}
@@ -334,7 +327,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
NetworkManager.QueuedPacket networkmanager_queuedpacket = (NetworkManager.QueuedPacket) this.getPacketQueue().peek(); // poll -> peek
if (networkmanager_queuedpacket != null) { // Fix NPE (Spigot bug caused by handleDisconnection())
if (networkmanager_queuedpacket.getPacket().getType() == PacketType.PLAY_OUT_MAP_CHUNK && !((PacketPlayOutMapChunk) networkmanager_queuedpacket.getPacket()).isReady()) { // Check if the peeked packet is a chunk packet which is not ready
if (networkmanager_queuedpacket.getPacket() instanceof PacketPlayOutMapChunk && !((PacketPlayOutMapChunk) networkmanager_queuedpacket.getPacket()).isReady()) { // Check if the peeked packet is a chunk packet which is not ready
return false; // Return false if the peeked packet is a chunk packet which is not ready
} else {
this.getPacketQueue().poll(); // poll here
@@ -345,6 +338,8 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
} finally {
this.j.writeLock().unlock(); // readLock -> writeLock (because of race condition between peek and poll)
}
*/
// Akarin end
}
@@ -353,7 +348,7 @@ public class NetworkManager extends SimpleChannelInboundHandler<Packet<?>> {
// Paper end
public void a() {
this.o();
//this.o(); // Akarin - remove packet queue
if (this.packetListener instanceof ITickable) {
((ITickable) this.packetListener).tick();
}

View File

@@ -27,7 +27,7 @@ public interface Packet<T extends PacketListener> {
}
public default boolean canDispatchImmediately() {
return false;
return true;
}
// Akarin end
}

View File

@@ -1,109 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutAbilities implements Packet<PacketListenerPlayOut> {
private boolean a;
private boolean b;
private boolean c;
private boolean d;
private float e;
private float f;
public PacketPlayOutAbilities() {}
public PacketPlayOutAbilities(PlayerAbilities playerabilities) {
this.a(playerabilities.isInvulnerable);
this.b(playerabilities.isFlying);
this.c(playerabilities.canFly);
this.d(playerabilities.canInstantlyBuild);
this.a(playerabilities.a());
this.b(playerabilities.b());
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
byte b0 = packetdataserializer.readByte();
this.a((b0 & 1) > 0);
this.b((b0 & 2) > 0);
this.c((b0 & 4) > 0);
this.d((b0 & 8) > 0);
this.a(packetdataserializer.readFloat());
this.b(packetdataserializer.readFloat());
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
byte b0 = 0;
if (this.b()) {
b0 = (byte) (b0 | 1);
}
if (this.c()) {
b0 = (byte) (b0 | 2);
}
if (this.d()) {
b0 = (byte) (b0 | 4);
}
if (this.e()) {
b0 = (byte) (b0 | 8);
}
packetdataserializer.writeByte(b0);
packetdataserializer.writeFloat(this.e);
packetdataserializer.writeFloat(this.f);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
public boolean b() {
return this.a;
}
public void a(boolean flag) {
this.a = flag;
}
public boolean c() {
return this.b;
}
public void b(boolean flag) {
this.b = flag;
}
public boolean d() {
return this.c;
}
public void c(boolean flag) {
this.c = flag;
}
public boolean e() {
return this.d;
}
public void d(boolean flag) {
this.d = flag;
}
public void a(float f) {
this.e = f;
}
public void b(float f) {
this.f = f;
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,114 +0,0 @@
package net.minecraft.server;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.Map.Entry;
public class PacketPlayOutAdvancements implements Packet<PacketListenerPlayOut> {
private boolean a;
private Map<MinecraftKey, Advancement.SerializedAdvancement> b;
private Set<MinecraftKey> c;
private Map<MinecraftKey, AdvancementProgress> d;
public PacketPlayOutAdvancements() {}
public PacketPlayOutAdvancements(boolean flag, Collection<Advancement> collection, Set<MinecraftKey> set, Map<MinecraftKey, AdvancementProgress> map) {
this.a = flag;
this.b = Maps.newHashMap();
Iterator iterator = collection.iterator();
while (iterator.hasNext()) {
Advancement advancement = (Advancement) iterator.next();
this.b.put(advancement.getName(), advancement.a());
}
this.c = set;
this.d = Maps.newHashMap(map);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.readBoolean();
this.b = Maps.newHashMap();
this.c = Sets.newLinkedHashSet();
this.d = Maps.newHashMap();
int i = packetdataserializer.g();
MinecraftKey minecraftkey;
int j;
for (j = 0; j < i; ++j) {
minecraftkey = packetdataserializer.l();
Advancement.SerializedAdvancement advancement_serializedadvancement = Advancement.SerializedAdvancement.b(packetdataserializer);
this.b.put(minecraftkey, advancement_serializedadvancement);
}
i = packetdataserializer.g();
for (j = 0; j < i; ++j) {
minecraftkey = packetdataserializer.l();
this.c.add(minecraftkey);
}
i = packetdataserializer.g();
for (j = 0; j < i; ++j) {
minecraftkey = packetdataserializer.l();
this.d.put(minecraftkey, AdvancementProgress.b(packetdataserializer));
}
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.writeBoolean(this.a);
packetdataserializer.d(this.b.size());
Iterator iterator = this.b.entrySet().iterator();
Entry entry;
while (iterator.hasNext()) {
entry = (Entry) iterator.next();
MinecraftKey minecraftkey = (MinecraftKey) entry.getKey();
Advancement.SerializedAdvancement advancement_serializedadvancement = (Advancement.SerializedAdvancement) entry.getValue();
packetdataserializer.a(minecraftkey);
advancement_serializedadvancement.a(packetdataserializer);
}
packetdataserializer.d(this.c.size());
iterator = this.c.iterator();
while (iterator.hasNext()) {
MinecraftKey minecraftkey1 = (MinecraftKey) iterator.next();
packetdataserializer.a(minecraftkey1);
}
packetdataserializer.d(this.d.size());
iterator = this.d.entrySet().iterator();
while (iterator.hasNext()) {
entry = (Entry) iterator.next();
packetdataserializer.a((MinecraftKey) entry.getKey());
((AdvancementProgress) entry.getValue()).a(packetdataserializer);
}
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,36 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutAnimation implements Packet<PacketListenerPlayOut> {
private int a;
private int b;
public PacketPlayOutAnimation() {}
public PacketPlayOutAnimation(Entity entity, int i) {
this.a = entity.getId();
this.b = i;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.g();
this.b = packetdataserializer.readUnsignedByte();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.d(this.a);
packetdataserializer.writeByte(this.b);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,37 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
import javax.annotation.Nullable;
public class PacketPlayOutAttachEntity implements Packet<PacketListenerPlayOut> {
private int a;
private int b;
public PacketPlayOutAttachEntity() {}
public PacketPlayOutAttachEntity(Entity entity, @Nullable Entity entity1) {
this.a = entity.getId();
this.b = entity1 != null ? entity1.getId() : -1;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.readInt();
this.b = packetdataserializer.readInt();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.writeInt(this.a);
packetdataserializer.writeInt(this.b);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,36 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutAutoRecipe implements Packet<PacketListenerPlayOut> {
private int a;
private MinecraftKey b;
public PacketPlayOutAutoRecipe() {}
public PacketPlayOutAutoRecipe(int i, IRecipe irecipe) {
this.a = i;
this.b = irecipe.getKey();
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.readByte();
this.b = packetdataserializer.l();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.writeByte(this.a);
packetdataserializer.a(this.b);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,36 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutBed implements Packet<PacketListenerPlayOut> {
private int a;
private BlockPosition b;
public PacketPlayOutBed() {}
public PacketPlayOutBed(EntityHuman entityhuman, BlockPosition blockposition) {
this.a = entityhuman.getId();
this.b = blockposition;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.g();
this.b = packetdataserializer.e();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.d(this.a);
packetdataserializer.a(this.b);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,44 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutBlockAction implements Packet<PacketListenerPlayOut> {
private BlockPosition a;
private int b;
private int c;
private Block d;
public PacketPlayOutBlockAction() {}
public PacketPlayOutBlockAction(BlockPosition blockposition, Block block, int i, int j) {
this.a = blockposition;
this.d = block;
this.b = i;
this.c = j;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.e();
this.b = packetdataserializer.readUnsignedByte();
this.c = packetdataserializer.readUnsignedByte();
this.d = (Block) IRegistry.BLOCK.fromId(packetdataserializer.g());
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.a(this.a);
packetdataserializer.writeByte(this.b);
packetdataserializer.writeByte(this.c);
packetdataserializer.d(IRegistry.BLOCK.a(this.d)); // Akarin - fixes decompile error
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,40 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutBlockBreakAnimation implements Packet<PacketListenerPlayOut> {
private int a;
private BlockPosition b;
private int c;
public PacketPlayOutBlockBreakAnimation() {}
public PacketPlayOutBlockBreakAnimation(int i, BlockPosition blockposition, int j) {
this.a = i;
this.b = blockposition;
this.c = j;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.g();
this.b = packetdataserializer.e();
this.c = packetdataserializer.readUnsignedByte();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.d(this.a);
packetdataserializer.a(this.b);
packetdataserializer.writeByte(this.c);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,36 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutBlockChange implements Packet<PacketListenerPlayOut> {
private BlockPosition a;
public IBlockData block;
public PacketPlayOutBlockChange() {}
public PacketPlayOutBlockChange(IBlockAccess iblockaccess, BlockPosition blockposition) {
this.a = blockposition;
this.block = iblockaccess.getType(blockposition);
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.e();
this.block = (IBlockData) Block.REGISTRY_ID.fromId(packetdataserializer.g());
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.a(this.a);
packetdataserializer.d(Block.getCombinedId(this.block));
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -62,10 +62,5 @@ public class PacketPlayOutChat implements Packet<PacketListenerPlayOut> {
public io.akarin.server.core.PacketType getType() {
return io.akarin.server.core.PacketType.PLAY_OUT_CHAT;
}
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,32 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutCloseWindow implements Packet<PacketListenerPlayOut> {
private int a;
public PacketPlayOutCloseWindow() {}
public PacketPlayOutCloseWindow(int i) {
this.a = i;
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.readUnsignedByte();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.writeByte(this.a);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,40 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutCollect implements Packet<PacketListenerPlayOut> {
private int a;
private int b;
private int c;
public PacketPlayOutCollect() {}
public PacketPlayOutCollect(int i, int j, int k) {
this.a = i;
this.b = j;
this.c = k;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.g();
this.b = packetdataserializer.g();
this.c = packetdataserializer.g();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.d(this.a);
packetdataserializer.d(this.b);
packetdataserializer.d(this.c);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,82 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutCombatEvent implements Packet<PacketListenerPlayOut> {
public PacketPlayOutCombatEvent.EnumCombatEventType a;
public int b;
public int c;
public int d;
public IChatBaseComponent e;
public PacketPlayOutCombatEvent() {}
public PacketPlayOutCombatEvent(CombatTracker combattracker, PacketPlayOutCombatEvent.EnumCombatEventType packetplayoutcombatevent_enumcombateventtype) {
this(combattracker, packetplayoutcombatevent_enumcombateventtype, new ChatComponentText(""));
}
public PacketPlayOutCombatEvent(CombatTracker combattracker, PacketPlayOutCombatEvent.EnumCombatEventType packetplayoutcombatevent_enumcombateventtype, IChatBaseComponent ichatbasecomponent) {
this.a = packetplayoutcombatevent_enumcombateventtype;
EntityLiving entityliving = combattracker.c();
switch (packetplayoutcombatevent_enumcombateventtype) {
case END_COMBAT:
this.d = combattracker.f();
this.c = entityliving == null ? -1 : entityliving.getId();
break;
case ENTITY_DIED:
this.b = combattracker.h().getId();
this.c = entityliving == null ? -1 : entityliving.getId();
this.e = ichatbasecomponent;
}
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = (PacketPlayOutCombatEvent.EnumCombatEventType) packetdataserializer.a(PacketPlayOutCombatEvent.EnumCombatEventType.class);
if (this.a == PacketPlayOutCombatEvent.EnumCombatEventType.END_COMBAT) {
this.d = packetdataserializer.g();
this.c = packetdataserializer.readInt();
} else if (this.a == PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED) {
this.b = packetdataserializer.g();
this.c = packetdataserializer.readInt();
this.e = packetdataserializer.f();
}
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.a((Enum) this.a);
if (this.a == PacketPlayOutCombatEvent.EnumCombatEventType.END_COMBAT) {
packetdataserializer.d(this.d);
packetdataserializer.writeInt(this.c);
} else if (this.a == PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED) {
packetdataserializer.d(this.b);
packetdataserializer.writeInt(this.c);
packetdataserializer.a(this.e);
}
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
public boolean a() {
return this.a == PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED;
}
public static enum EnumCombatEventType {
ENTER_COMBAT, END_COMBAT, ENTITY_DIED;
private EnumCombatEventType() {}
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,269 +0,0 @@
package net.minecraft.server;
import com.google.common.collect.Maps;
import com.mojang.brigadier.arguments.ArgumentType;
import com.mojang.brigadier.builder.ArgumentBuilder;
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
import com.mojang.brigadier.builder.RequiredArgumentBuilder;
import com.mojang.brigadier.context.CommandContext;
import com.mojang.brigadier.tree.ArgumentCommandNode;
import com.mojang.brigadier.tree.CommandNode;
import com.mojang.brigadier.tree.LiteralCommandNode;
import com.mojang.brigadier.tree.RootCommandNode;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import javax.annotation.Nullable;
public class PacketPlayOutCommands implements Packet<PacketListenerPlayOut> {
private RootCommandNode<ICompletionProvider> a;
public PacketPlayOutCommands() {}
public PacketPlayOutCommands(RootCommandNode<ICompletionProvider> rootcommandnode) {
this.a = rootcommandnode;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
PacketPlayOutCommands.a[] apacketplayoutcommands_a = new PacketPlayOutCommands.a[packetdataserializer.g()];
Deque<PacketPlayOutCommands.a> deque = new ArrayDeque(apacketplayoutcommands_a.length);
for (int i = 0; i < apacketplayoutcommands_a.length; ++i) {
apacketplayoutcommands_a[i] = this.c(packetdataserializer);
deque.add(apacketplayoutcommands_a[i]);
}
boolean flag;
do {
if (deque.isEmpty()) {
this.a = (RootCommandNode) apacketplayoutcommands_a[packetdataserializer.g()].e;
return;
}
flag = false;
Iterator iterator = deque.iterator();
while (iterator.hasNext()) {
PacketPlayOutCommands.a packetplayoutcommands_a = (PacketPlayOutCommands.a) iterator.next();
if (packetplayoutcommands_a.a(apacketplayoutcommands_a)) {
iterator.remove();
flag = true;
}
}
} while (flag);
throw new IllegalStateException("Server sent an impossible command tree");
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
Map<CommandNode<ICompletionProvider>, Integer> map = Maps.newHashMap();
Deque<CommandNode<ICompletionProvider>> deque = new ArrayDeque();
deque.add(this.a);
while (!deque.isEmpty()) {
CommandNode<ICompletionProvider> commandnode = (CommandNode) deque.pollFirst();
if (!map.containsKey(commandnode)) {
int i = map.size();
map.put(commandnode, i);
deque.addAll(commandnode.getChildren());
if (commandnode.getRedirect() != null) {
deque.add(commandnode.getRedirect());
}
}
}
CommandNode<ICompletionProvider>[] acommandnode = (CommandNode[]) (new CommandNode[map.size()]);
Entry entry;
for (Iterator iterator = map.entrySet().iterator(); iterator.hasNext(); acommandnode[(Integer) entry.getValue()] = (CommandNode) entry.getKey()) {
entry = (Entry) iterator.next();
}
packetdataserializer.d(acommandnode.length);
CommandNode[] acommandnode1 = acommandnode;
int j = acommandnode.length;
for (int k = 0; k < j; ++k) {
CommandNode<ICompletionProvider> commandnode1 = acommandnode1[k];
this.a(packetdataserializer, commandnode1, map);
}
packetdataserializer.d((Integer) map.get(this.a));
}
private PacketPlayOutCommands.a c(PacketDataSerializer packetdataserializer) {
byte b0 = packetdataserializer.readByte();
int[] aint = packetdataserializer.b();
int i = (b0 & 8) != 0 ? packetdataserializer.g() : 0;
ArgumentBuilder<ICompletionProvider, ?> argumentbuilder = this.a(packetdataserializer, b0);
return new PacketPlayOutCommands.a(argumentbuilder, b0, i, aint);
}
@Nullable
private ArgumentBuilder<ICompletionProvider, ?> a(PacketDataSerializer packetdataserializer, byte b0) {
int i = b0 & 3;
if (i == 2) {
String s = packetdataserializer.e(32767);
ArgumentType<?> argumenttype = ArgumentRegistry.a(packetdataserializer);
if (argumenttype == null) {
return null;
} else {
RequiredArgumentBuilder<ICompletionProvider, ?> requiredargumentbuilder = RequiredArgumentBuilder.argument(s, argumenttype);
if ((b0 & 16) != 0) {
requiredargumentbuilder.suggests(CompletionProviders.a(packetdataserializer.l()));
}
return requiredargumentbuilder;
}
} else {
return i == 1 ? LiteralArgumentBuilder.literal(packetdataserializer.e(32767)) : null;
}
}
private void a(PacketDataSerializer packetdataserializer, CommandNode<ICompletionProvider> commandnode, Map<CommandNode<ICompletionProvider>, Integer> map) {
byte b0 = 0;
if (commandnode.getRedirect() != null) {
b0 = (byte) (b0 | 8);
}
if (commandnode.getCommand() != null) {
b0 = (byte) (b0 | 4);
}
if (commandnode instanceof RootCommandNode) {
b0 = (byte) (b0 | 0);
} else if (commandnode instanceof ArgumentCommandNode) {
b0 = (byte) (b0 | 2);
if (((ArgumentCommandNode) commandnode).getCustomSuggestions() != null) {
b0 = (byte) (b0 | 16);
}
} else {
if (!(commandnode instanceof LiteralCommandNode)) {
throw new UnsupportedOperationException("Unknown node type " + commandnode);
}
b0 = (byte) (b0 | 1);
}
packetdataserializer.writeByte(b0);
packetdataserializer.d(commandnode.getChildren().size());
Iterator iterator = commandnode.getChildren().iterator();
while (iterator.hasNext()) {
CommandNode<ICompletionProvider> commandnode1 = (CommandNode) iterator.next();
packetdataserializer.d((Integer) map.get(commandnode1));
}
if (commandnode.getRedirect() != null) {
packetdataserializer.d((Integer) map.get(commandnode.getRedirect()));
}
if (commandnode instanceof ArgumentCommandNode) {
ArgumentCommandNode<ICompletionProvider, ?> argumentcommandnode = (ArgumentCommandNode) commandnode;
packetdataserializer.a(argumentcommandnode.getName());
ArgumentRegistry.a(packetdataserializer, argumentcommandnode.getType());
if (argumentcommandnode.getCustomSuggestions() != null) {
packetdataserializer.a(CompletionProviders.a(argumentcommandnode.getCustomSuggestions()));
}
} else if (commandnode instanceof LiteralCommandNode) {
packetdataserializer.a(((LiteralCommandNode) commandnode).getLiteral());
}
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
static class a {
@Nullable
private final ArgumentBuilder<ICompletionProvider, ?> a;
private final byte b;
private final int c;
private final int[] d;
private CommandNode<ICompletionProvider> e;
private a(@Nullable ArgumentBuilder<ICompletionProvider, ?> argumentbuilder, byte b0, int i, int[] aint) {
this.a = argumentbuilder;
this.b = b0;
this.c = i;
this.d = aint;
}
public boolean a(PacketPlayOutCommands.a[] apacketplayoutcommands_a) {
if (this.e == null) {
if (this.a == null) {
this.e = new RootCommandNode();
} else {
if ((this.b & 8) != 0) {
if (apacketplayoutcommands_a[this.c].e == null) {
return false;
}
this.a.redirect(apacketplayoutcommands_a[this.c].e);
}
if ((this.b & 4) != 0) {
this.a.executes((commandcontext) -> {
return 0;
});
}
this.e = this.a.build();
}
}
int[] aint = this.d;
int i = aint.length;
int j;
int k;
for (k = 0; k < i; ++k) {
j = aint[k];
if (apacketplayoutcommands_a[j].e == null) {
return false;
}
}
aint = this.d;
i = aint.length;
for (k = 0; k < i; ++k) {
j = aint[k];
CommandNode<ICompletionProvider> commandnode = apacketplayoutcommands_a[j].e;
if (!(commandnode instanceof RootCommandNode)) {
this.e.addChild(commandnode);
}
}
return true;
}
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,139 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutEntity implements Packet<PacketListenerPlayOut> {
protected int a;
protected int b;
protected int c;
protected int d;
protected byte e;
protected byte f;
protected boolean g;
protected boolean h;
public PacketPlayOutEntity() {}
public PacketPlayOutEntity(int i) {
this.a = i;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.g();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.d(this.a);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
public String toString() {
return "Entity_" + super.toString();
}
public static class PacketPlayOutEntityLook extends PacketPlayOutEntity {
public PacketPlayOutEntityLook() {
this.h = true;
}
public PacketPlayOutEntityLook(int i, byte b0, byte b1, boolean flag) {
super(i);
this.e = b0;
this.f = b1;
this.h = true;
this.g = flag;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
super.a(packetdataserializer);
this.e = packetdataserializer.readByte();
this.f = packetdataserializer.readByte();
this.g = packetdataserializer.readBoolean();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
super.b(packetdataserializer);
packetdataserializer.writeByte(this.e);
packetdataserializer.writeByte(this.f);
packetdataserializer.writeBoolean(this.g);
}
}
public static class PacketPlayOutRelEntityMove extends PacketPlayOutEntity {
public PacketPlayOutRelEntityMove() {}
public PacketPlayOutRelEntityMove(int i, long j, long k, long l, boolean flag) {
super(i);
this.b = (int) j;
this.c = (int) k;
this.d = (int) l;
this.g = flag;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
super.a(packetdataserializer);
this.b = packetdataserializer.readShort();
this.c = packetdataserializer.readShort();
this.d = packetdataserializer.readShort();
this.g = packetdataserializer.readBoolean();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
super.b(packetdataserializer);
packetdataserializer.writeShort(this.b);
packetdataserializer.writeShort(this.c);
packetdataserializer.writeShort(this.d);
packetdataserializer.writeBoolean(this.g);
}
}
public static class PacketPlayOutRelEntityMoveLook extends PacketPlayOutEntity {
public PacketPlayOutRelEntityMoveLook() {
this.h = true;
}
public PacketPlayOutRelEntityMoveLook(int i, long j, long k, long l, byte b0, byte b1, boolean flag) {
super(i);
this.b = (int) j;
this.c = (int) k;
this.d = (int) l;
this.e = b0;
this.f = b1;
this.g = flag;
this.h = true;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
super.a(packetdataserializer);
this.b = packetdataserializer.readShort();
this.c = packetdataserializer.readShort();
this.d = packetdataserializer.readShort();
this.e = packetdataserializer.readByte();
this.f = packetdataserializer.readByte();
this.g = packetdataserializer.readBoolean();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
super.b(packetdataserializer);
packetdataserializer.writeShort(this.b);
packetdataserializer.writeShort(this.c);
packetdataserializer.writeShort(this.d);
packetdataserializer.writeByte(this.e);
packetdataserializer.writeByte(this.f);
packetdataserializer.writeBoolean(this.g);
}
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,56 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutEntityTeleport implements Packet<PacketListenerPlayOut> {
private int a;
private double b;
private double c;
private double d;
private byte e;
private byte f;
private boolean g;
public PacketPlayOutEntityTeleport() {}
public PacketPlayOutEntityTeleport(Entity entity) {
this.a = entity.getId();
this.b = entity.locX;
this.c = entity.locY;
this.d = entity.locZ;
this.e = (byte) ((int) (entity.yaw * 256.0F / 360.0F));
this.f = (byte) ((int) (entity.pitch * 256.0F / 360.0F));
this.g = entity.onGround;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.g();
this.b = packetdataserializer.readDouble();
this.c = packetdataserializer.readDouble();
this.d = packetdataserializer.readDouble();
this.e = packetdataserializer.readByte();
this.f = packetdataserializer.readByte();
this.g = packetdataserializer.readBoolean();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.d(this.a);
packetdataserializer.writeDouble(this.b);
packetdataserializer.writeDouble(this.c);
packetdataserializer.writeDouble(this.d);
packetdataserializer.writeByte(this.e);
packetdataserializer.writeByte(this.f);
packetdataserializer.writeBoolean(this.g);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -209,7 +209,7 @@ public class PacketPlayOutMapChunk implements Packet<PacketListenerPlayOut> {
public io.akarin.server.core.PacketType getType() {
return io.akarin.server.core.PacketType.PLAY_OUT_MAP_CHUNK;
}
@Override
public boolean canDispatchImmediately() {
return this.ready;

View File

@@ -1,62 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutOpenWindow implements Packet<PacketListenerPlayOut> {
private int a;
private String b;
private IChatBaseComponent c;
private int d;
private int e;
public PacketPlayOutOpenWindow() {}
public PacketPlayOutOpenWindow(int i, String s, IChatBaseComponent ichatbasecomponent) {
this(i, s, ichatbasecomponent, 0);
}
public PacketPlayOutOpenWindow(int i, String s, IChatBaseComponent ichatbasecomponent, int j) {
this.a = i;
this.b = s;
this.c = ichatbasecomponent;
this.d = j;
}
public PacketPlayOutOpenWindow(int i, String s, IChatBaseComponent ichatbasecomponent, int j, int k) {
this(i, s, ichatbasecomponent, j);
this.e = k;
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.readUnsignedByte();
this.b = packetdataserializer.e(32);
this.c = packetdataserializer.f();
this.d = packetdataserializer.readUnsignedByte();
if (this.b.equals("EntityHorse")) {
this.e = packetdataserializer.readInt();
}
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.writeByte(this.a);
packetdataserializer.a(this.b);
packetdataserializer.a(this.c);
packetdataserializer.writeByte(this.d);
if (this.b.equals("EntityHorse")) {
packetdataserializer.writeInt(this.e);
}
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,48 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutRespawn implements Packet<PacketListenerPlayOut> {
private DimensionManager a;
private EnumDifficulty b;
private EnumGamemode c;
private WorldType d;
public PacketPlayOutRespawn() {}
public PacketPlayOutRespawn(DimensionManager dimensionmanager, EnumDifficulty enumdifficulty, WorldType worldtype, EnumGamemode enumgamemode) {
this.a = dimensionmanager;
this.b = enumdifficulty;
this.c = enumgamemode;
this.d = worldtype;
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = DimensionManager.a(packetdataserializer.readInt());
this.b = EnumDifficulty.getById(packetdataserializer.readUnsignedByte());
this.c = EnumGamemode.getById(packetdataserializer.readUnsignedByte());
this.d = WorldType.getType(packetdataserializer.e(16));
if (this.d == null) {
this.d = WorldType.NORMAL;
}
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.writeInt(this.a.getDimensionID());
packetdataserializer.writeByte(this.b.a());
packetdataserializer.writeByte(this.c.getId());
packetdataserializer.a(this.d.name());
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -28,10 +28,5 @@ public class PacketPlayOutSpawnPosition implements Packet<PacketListenerPlayOut>
public io.akarin.server.core.PacketType getType() {
return io.akarin.server.core.PacketType.PLAY_OUT_SPAWN_POSITION;
}
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,65 +0,0 @@
package net.minecraft.server;
import it.unimi.dsi.fastutil.objects.Object2IntMap;
import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap;
import it.unimi.dsi.fastutil.objects.ObjectIterator;
import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry;
import java.io.IOException;
public class PacketPlayOutStatistic implements Packet<PacketListenerPlayOut> {
private Object2IntMap<Statistic<?>> a;
public PacketPlayOutStatistic() {}
public PacketPlayOutStatistic(Object2IntMap<Statistic<?>> object2intmap) {
this.a = object2intmap;
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
int i = packetdataserializer.g();
this.a = new Object2IntOpenHashMap(i);
for (int j = 0; j < i; ++j) {
this.a((StatisticWrapper) IRegistry.STATS.fromId(packetdataserializer.g()), packetdataserializer);
}
}
private <T> void a(StatisticWrapper<T> statisticwrapper, PacketDataSerializer packetdataserializer) {
int i = packetdataserializer.g();
int j = packetdataserializer.g();
this.a.put(statisticwrapper.b(statisticwrapper.a().fromId(i)), j);
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.d(this.a.size());
ObjectIterator objectiterator = this.a.object2IntEntrySet().iterator();
while (objectiterator.hasNext()) {
Entry<Statistic<?>> entry = (Entry) objectiterator.next();
Statistic<?> statistic = (Statistic) entry.getKey();
packetdataserializer.d(IRegistry.STATS.a(statistic.a())); // Akarin - fixes decompile error
packetdataserializer.d(this.a(statistic));
packetdataserializer.d(entry.getIntValue());
}
}
private <T> int a(Statistic<T> statistic) {
return statistic.a().a().a(statistic.b());
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,69 +0,0 @@
package net.minecraft.server;
import com.google.common.collect.Lists;
import com.mojang.brigadier.context.StringRange;
import com.mojang.brigadier.suggestion.Suggestion;
import com.mojang.brigadier.suggestion.Suggestions;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
public class PacketPlayOutTabComplete implements Packet<PacketListenerPlayOut> {
private int a;
private Suggestions b;
public PacketPlayOutTabComplete() {}
public PacketPlayOutTabComplete(int i, Suggestions suggestions) {
this.a = i;
this.b = suggestions;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.g();
int i = packetdataserializer.g();
int j = packetdataserializer.g();
StringRange stringrange = StringRange.between(i, i + j);
int k = packetdataserializer.g();
List<Suggestion> list = Lists.newArrayListWithCapacity(k);
for (int l = 0; l < k; ++l) {
String s = packetdataserializer.e(32767);
IChatBaseComponent ichatbasecomponent = packetdataserializer.readBoolean() ? packetdataserializer.f() : null;
list.add(new Suggestion(stringrange, s, ichatbasecomponent));
}
this.b = new Suggestions(stringrange, list);
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.d(this.a);
packetdataserializer.d(this.b.getRange().getStart());
packetdataserializer.d(this.b.getRange().getLength());
packetdataserializer.d(this.b.getList().size());
Iterator iterator = this.b.getList().iterator();
while (iterator.hasNext()) {
Suggestion suggestion = (Suggestion) iterator.next();
packetdataserializer.a(suggestion.getText());
packetdataserializer.writeBoolean(suggestion.getTooltip() != null);
if (suggestion.getTooltip() != null) {
packetdataserializer.a(ChatComponentUtils.a(suggestion.getTooltip()));
}
}
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,48 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketPlayOutVehicleMove implements Packet<PacketListenerPlayOut> {
private double a;
private double b;
private double c;
private float d;
private float e;
public PacketPlayOutVehicleMove() {}
public PacketPlayOutVehicleMove(Entity entity) {
this.a = entity.locX;
this.b = entity.locY;
this.c = entity.locZ;
this.d = entity.yaw;
this.e = entity.pitch;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.readDouble();
this.b = packetdataserializer.readDouble();
this.c = packetdataserializer.readDouble();
this.d = packetdataserializer.readFloat();
this.e = packetdataserializer.readFloat();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.writeDouble(this.a);
packetdataserializer.writeDouble(this.b);
packetdataserializer.writeDouble(this.c);
packetdataserializer.writeFloat(this.d);
packetdataserializer.writeFloat(this.e);
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,67 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
public class PacketPlayOutWindowItems implements Packet<PacketListenerPlayOut> {
private int a;
private List<ItemStack> b;
//Paper start
@Override
public boolean packetTooLarge(NetworkManager manager) {
for (int i = 0 ; i < this.b.size() ; i++) {
manager.sendPacket(new PacketPlayOutSetSlot(this.a, i, this.b.get(i)));
}
return true;
}
// Paper end
public PacketPlayOutWindowItems() {}
public PacketPlayOutWindowItems(int i, NonNullList<ItemStack> nonnulllist) {
this.a = i;
this.b = NonNullList.a(nonnulllist.size(), ItemStack.a);
for (int j = 0; j < this.b.size(); ++j) {
this.b.set(j, ((ItemStack) nonnulllist.get(j)).cloneItemStack());
}
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.readUnsignedByte();
short short0 = packetdataserializer.readShort();
this.b = NonNullList.a(short0, ItemStack.a);
for (int i = 0; i < short0; ++i) {
this.b.set(i, packetdataserializer.k());
}
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.writeByte(this.a);
packetdataserializer.writeShort(this.b.size());
Iterator iterator = this.b.iterator();
while (iterator.hasNext()) {
ItemStack itemstack = (ItemStack) iterator.next();
packetdataserializer.a(itemstack);
}
}
public void a(PacketListenerPlayOut packetlistenerplayout) {
packetlistenerplayout.a(this);
}
// Akarin start
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,37 +0,0 @@
package net.minecraft.server;
import java.io.IOException;
public class PacketStatusOutPong implements Packet<PacketStatusOutListener> {
private long a;
public PacketStatusOutPong() {}
public PacketStatusOutPong(long i) {
this.a = i;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.a = packetdataserializer.readLong();
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.writeLong(this.a);
}
public void a(PacketStatusOutListener packetstatusoutlistener) {
packetstatusoutlistener.a(this);
}
// Akarin start
@Override
public io.akarin.server.core.PacketType getType() {
return io.akarin.server.core.PacketType.STATUS_OUT_PONG;
}
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}

View File

@@ -1,40 +0,0 @@
package net.minecraft.server;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.IOException;
public class PacketStatusOutServerInfo implements Packet<PacketStatusOutListener> {
private static final Gson a = (new GsonBuilder()).registerTypeAdapter(ServerPing.ServerData.class, new ServerPing.ServerData.Serializer()).registerTypeAdapter(ServerPing.ServerPingPlayerSample.class, new ServerPing.ServerPingPlayerSample.Serializer()).registerTypeAdapter(ServerPing.class, new ServerPing.Serializer()).registerTypeHierarchyAdapter(IChatBaseComponent.class, new IChatBaseComponent.ChatSerializer()).registerTypeHierarchyAdapter(ChatModifier.class, new ChatModifier.ChatModifierSerializer()).registerTypeAdapterFactory(new ChatTypeAdapterFactory()).create();
private ServerPing b;
public PacketStatusOutServerInfo() {}
public PacketStatusOutServerInfo(ServerPing serverping) {
this.b = serverping;
}
public void a(PacketDataSerializer packetdataserializer) throws IOException {
this.b = (ServerPing) ChatDeserializer.a(PacketStatusOutServerInfo.a, packetdataserializer.e(32767), ServerPing.class);
}
public void b(PacketDataSerializer packetdataserializer) throws IOException {
packetdataserializer.a(PacketStatusOutServerInfo.a.toJson(this.b));
}
public void a(PacketStatusOutListener packetstatusoutlistener) {
packetstatusoutlistener.a(this);
}
// Akarin start
@Override
public io.akarin.server.core.PacketType getType() {
return io.akarin.server.core.PacketType.STATUS_OUT_SERVER_INFO;
}
@Override
public boolean canDispatchImmediately() {
return true;
}
// Akarin end
}