Fix crash with mek fake player

This commit is contained in:
IzzelAliz 2021-01-25 20:26:05 +08:00
parent 66feec6cf2
commit aae03a229f
2 changed files with 2 additions and 1 deletions

View File

@ -122,6 +122,7 @@ public abstract class PlayerEntityMixin extends LivingEntityMixin implements Pla
@Shadow protected EnderChestInventory enterChestInventory;
@Shadow public abstract Either<PlayerEntity.SleepResult, Unit> trySleep(BlockPos at);
@Shadow public int sleepTimer;
@Shadow public abstract GameProfile getGameProfile();
// @formatter:on
public boolean fauxSleeping;

View File

@ -189,7 +189,7 @@ public abstract class ServerPlayerEntityMixin extends PlayerEntityMixin implemen
@Inject(method = "<init>", at = @At("RETURN"))
public void arclight$init(CallbackInfo ci) {
this.displayName = getScoreboardName();
this.displayName = this.getGameProfile() != null ? getScoreboardName() : "~FakePlayer~";
this.canPickUpLoot = true;
this.maxHealthCache = this.getMaxHealth();
this.arclight$initialized = true;