From 1ef69325a49604d753e27b96309528fc77320e0b Mon Sep 17 00:00:00 2001 From: IzzelAliz Date: Sat, 30 Jan 2021 17:31:10 +0800 Subject: [PATCH] Assign connection only for fake players (#144) --- .../mixin/core/entity/player/ServerPlayerEntityMixin.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/player/ServerPlayerEntityMixin.java b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/player/ServerPlayerEntityMixin.java index 214a284f..73267bc8 100644 --- a/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/player/ServerPlayerEntityMixin.java +++ b/arclight-common/src/main/java/io/izzel/arclight/common/mixin/core/entity/player/ServerPlayerEntityMixin.java @@ -81,6 +81,7 @@ import net.minecraft.world.biome.BiomeManager; import net.minecraft.world.server.ServerWorld; import net.minecraft.world.storage.IWorldInfo; import net.minecraftforge.common.ForgeHooks; +import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.ITeleporter; import net.minecraftforge.fml.hooks.BasicEventHooks; import net.minecraftforge.fml.server.ServerLifecycleHooks; @@ -193,7 +194,9 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin implemen this.canPickUpLoot = true; this.maxHealthCache = this.getMaxHealth(); this.arclight$initialized = true; - this.connection = new BlackholeNetHandler(this.getServer(), (ServerPlayerEntity) (Object) this); + if ((Object) this instanceof FakePlayer) { + this.connection = new BlackholeNetHandler(this.getServer(), (ServerPlayerEntity) (Object) this); + } } @Override