Search in sources :

Example 1 with PacketHandle

use of com.bergerkiller.generated.net.minecraft.network.protocol.PacketHandle in project BKCommonLib by bergerhealer.

the class VehicleMountHandler_BaseImpl method synchronizeAndQueuePackets.

// Calls a method while synchronized, afterwards flushes all queued packets and returns the return value
protected final <T> T synchronizeAndQueuePackets(Supplier<T> s) {
    T result;
    synchronized (this) {
        result = s.get();
    }
    PacketHandle p;
    while ((p = this._queuedPackets.poll()) != null) {
        PacketUtil.queuePacket(this._player, p);
    }
    return result;
}
Also used : PacketHandle(com.bergerkiller.generated.net.minecraft.network.protocol.PacketHandle)

Aggregations

PacketHandle (com.bergerkiller.generated.net.minecraft.network.protocol.PacketHandle)1