Assign connection only for fake players (#144)

This commit is contained in:
IzzelAliz 2021-01-30 17:31:10 +08:00
parent b7ee2e0ddf
commit 1ef69325a4

View File

@ -81,6 +81,7 @@ import net.minecraft.world.biome.BiomeManager;
import net.minecraft.world.server.ServerWorld; import net.minecraft.world.server.ServerWorld;
import net.minecraft.world.storage.IWorldInfo; import net.minecraft.world.storage.IWorldInfo;
import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.common.ForgeHooks;
import net.minecraftforge.common.util.FakePlayer;
import net.minecraftforge.common.util.ITeleporter; import net.minecraftforge.common.util.ITeleporter;
import net.minecraftforge.fml.hooks.BasicEventHooks; import net.minecraftforge.fml.hooks.BasicEventHooks;
import net.minecraftforge.fml.server.ServerLifecycleHooks; import net.minecraftforge.fml.server.ServerLifecycleHooks;
@ -193,8 +194,10 @@ 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;
if ((Object) this instanceof FakePlayer) {
this.connection = new BlackholeNetHandler(this.getServer(), (ServerPlayerEntity) (Object) this); this.connection = new BlackholeNetHandler(this.getServer(), (ServerPlayerEntity) (Object) this);
} }
}
@Override @Override
public boolean bridge$initialized() { public boolean bridge$initialized() {