Provide a default connection for (fake) player
This commit is contained in:
parent
cfc83f9aea
commit
66feec6cf2
@ -11,6 +11,7 @@ import io.izzel.arclight.common.bridge.util.FoodStatsBridge;
|
|||||||
import io.izzel.arclight.common.bridge.world.TeleporterBridge;
|
import io.izzel.arclight.common.bridge.world.TeleporterBridge;
|
||||||
import io.izzel.arclight.common.bridge.world.WorldBridge;
|
import io.izzel.arclight.common.bridge.world.WorldBridge;
|
||||||
import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
import io.izzel.arclight.common.mod.util.ArclightCaptures;
|
||||||
|
import io.izzel.arclight.common.mod.util.BlackholeNetHandler;
|
||||||
import io.izzel.arclight.common.mod.util.ChestBlockDoubleInventoryHacks;
|
import io.izzel.arclight.common.mod.util.ChestBlockDoubleInventoryHacks;
|
||||||
import net.minecraft.block.NetherPortalBlock;
|
import net.minecraft.block.NetherPortalBlock;
|
||||||
import net.minecraft.block.PortalInfo;
|
import net.minecraft.block.PortalInfo;
|
||||||
@ -192,6 +193,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin implemen
|
|||||||
this.canPickUpLoot = true;
|
this.canPickUpLoot = true;
|
||||||
this.maxHealthCache = this.getMaxHealth();
|
this.maxHealthCache = this.getMaxHealth();
|
||||||
this.arclight$initialized = true;
|
this.arclight$initialized = true;
|
||||||
|
this.connection = new BlackholeNetHandler(this.getServer(), (ServerPlayerEntity) (Object) this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -0,0 +1,41 @@
|
|||||||
|
package io.izzel.arclight.common.mod.util;
|
||||||
|
|
||||||
|
import io.netty.util.concurrent.Future;
|
||||||
|
import io.netty.util.concurrent.GenericFutureListener;
|
||||||
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
|
import net.minecraft.network.IPacket;
|
||||||
|
import net.minecraft.network.NetworkManager;
|
||||||
|
import net.minecraft.network.PacketDirection;
|
||||||
|
import net.minecraft.network.play.ServerPlayNetHandler;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class BlackholeNetHandler extends ServerPlayNetHandler {
|
||||||
|
|
||||||
|
public BlackholeNetHandler(MinecraftServer server, ServerPlayerEntity playerIn) {
|
||||||
|
super(server, new BlackholeNetworkManager(), playerIn);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPacket(IPacket<?> packetIn) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPacket(IPacket<?> packetIn, @Nullable GenericFutureListener<? extends Future<? super Void>> futureListeners) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class BlackholeNetworkManager extends NetworkManager {
|
||||||
|
|
||||||
|
public BlackholeNetworkManager() {
|
||||||
|
super(PacketDirection.SERVERBOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPacket(IPacket<?> packetIn) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void sendPacket(IPacket<?> packetIn, @Nullable GenericFutureListener<? extends Future<? super Void>> p_201058_2_) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user