Fixes packet send
This commit is contained in:
@@ -17,6 +17,8 @@ import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import co.aikar.timings.Timing;
|
||||
import co.aikar.timings.Timings;
|
||||
import io.akarin.server.core.AkarinGlobalConfig;
|
||||
import net.minecraft.server.Entity;
|
||||
import net.minecraft.server.EntityTracker;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.Packet;
|
||||
import net.minecraft.server.PlayerConnection;
|
||||
@@ -51,6 +53,9 @@ public abstract class Akari {
|
||||
public AssignableThread(Runnable run) {
|
||||
super(run);
|
||||
}
|
||||
public AssignableThread() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
public static class AssignableFactory implements ThreadFactory {
|
||||
|
||||
@@ -11,8 +11,8 @@ import net.minecraft.server.Blocks;
|
||||
import net.minecraft.server.ItemMonsterEgg;
|
||||
|
||||
@Mixin(value = ItemMonsterEgg.class, remap = false)
|
||||
public abstract class MonsterEggGuardian {
|
||||
@Redirect(method = "a", at = @At(
|
||||
public abstract class MixinItemMonsterEgg {
|
||||
@Redirect(method = "a*", at = @At(
|
||||
value = "FIELD",
|
||||
target = "net/minecraft/server/Blocks.MOB_SPAWNER:Lnet/minecraft/server/Block;",
|
||||
opcode = Opcodes.GETSTATIC
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.server.BlockPosition;
|
||||
import net.minecraft.server.CrashReport;
|
||||
import net.minecraft.server.CustomFunctionData;
|
||||
import net.minecraft.server.ITickable;
|
||||
import net.minecraft.server.MCUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.MojangStatisticsGenerator;
|
||||
import net.minecraft.server.PlayerList;
|
||||
|
||||
@@ -35,7 +35,7 @@ public abstract class MixinTimingHandler {
|
||||
return (Timing) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Inject(method = "startTiming", at = @At("HEAD"), cancellable = true)
|
||||
public void onStartTiming(CallbackInfoReturnable ci) {
|
||||
if (!Akari.isPrimaryThread(false)) ci.setReturnValue(this); // Avoid modify any field
|
||||
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.server.WorldServer;
|
||||
|
||||
@Mixin(value = WorldServer.class, remap = false)
|
||||
public abstract class MixinWorldServer implements IMixinLockProvider {
|
||||
@Redirect(method = "doTick", at = @At(
|
||||
@Redirect(method = "doTick()V", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "net/minecraft/server/PlayerChunkMap.flush()V"
|
||||
))
|
||||
|
||||
@@ -32,6 +32,12 @@ public abstract class OptimisticNetworkManager {
|
||||
|
||||
@Overwrite // PAIL: trySendQueue
|
||||
private boolean m() {
|
||||
// Akarin start - process slack packets
|
||||
while (!Akari.slackPackets.isEmpty()) {
|
||||
// Plugins that hook into those packets will notify their listeners later, so keep sync
|
||||
dispatchPacket(Akari.slackPackets.poll(), null);
|
||||
}
|
||||
// Akarin end
|
||||
if (this.channel != null && this.channel.isOpen()) {
|
||||
if (this.packets.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;
|
||||
@@ -55,12 +61,6 @@ public abstract class OptimisticNetworkManager {
|
||||
} finally {
|
||||
this.queueLock.readLock().unlock();
|
||||
}
|
||||
// Akarin start - process slack packets
|
||||
while (!Akari.slackPackets.isEmpty()) {
|
||||
// Plugins that hook into those packets will notify their listeners later, so keep sync
|
||||
dispatchPacket(Akari.slackPackets.poll(), null);
|
||||
}
|
||||
// Akarin end
|
||||
|
||||
}
|
||||
return true; // Return true if all packets were dispatched
|
||||
|
||||
@@ -18,7 +18,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import io.akarin.api.internal.Akari;
|
||||
import net.minecraft.server.BaseBlockPosition;
|
||||
import net.minecraft.server.Block;
|
||||
import net.minecraft.server.BlockDiodeAbstract;
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class MixinEntityInsentient extends EntityLiving {
|
||||
super(world);
|
||||
}
|
||||
|
||||
@Redirect(method = "doTick", at = @At(value = "FIELD", target = ENTITY_LIVING_AGE_FIELD, opcode = Opcodes.PUTFIELD, ordinal = 0))
|
||||
@Redirect(method = "doTick()V", at = @At(value = "FIELD", target = ENTITY_LIVING_AGE_FIELD, opcode = Opcodes.PUTFIELD, ordinal = 0))
|
||||
public void fixupEntityDespawnAge(EntityInsentient self, int modifier) {
|
||||
int ticks = (int) ((IMixinRealTimeTicking) self.getWorld()).getRealTimeTicks();
|
||||
this.ticksFarFromPlayer += ticks;
|
||||
|
||||
@@ -34,7 +34,7 @@ import net.minecraft.server.Entity;
|
||||
import net.minecraft.server.EntityPlayer;
|
||||
import net.minecraft.server.World;
|
||||
|
||||
@Mixin(value = EntityPlayer.class, remap = false)
|
||||
@Mixin(value = EntityPlayer.class, remap = false, priority = 1001)
|
||||
public abstract class MixinEntityPlayer extends Entity {
|
||||
private static final String ENTITY_PLAYER_MP_PORTAL_COOLDOWN_FIELD = "Lnet/minecraft/entity/player/EntityPlayer;portalCooldown:I";
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@ package net.minecraft.server;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import io.akarin.api.internal.Akari;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.util.ArrayDeque; // Paper
|
||||
import java.util.ArrayList;
|
||||
|
||||
Reference in New Issue
Block a user