Fix fake players not being able to respawn for exiting the end (#1664)
* Allow fake players to respawn (to return from the end) * Fixes #1645 (Fake players get stuck in the end exit portal) * fix up some imports
This commit is contained in:
1 parent
8c09946bef
commit
8307794f19
2 files changed
+35
-2
No files matched your search
@@ -1,8 +1,10 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.server.network.ServerGamePacketListenerImpl;
|
||||
import net.minecraft.server.players.PlayerList;
|
||||
@@ -44,4 +46,13 @@ public abstract class PlayerList_fakePlayersMixin
|
||||
return new ServerGamePacketListenerImpl(this.server, clientConnection, playerIn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "respawn", at = @At(value = "NEW", target = "net/minecraft/server/level/ServerPlayer"))
|
||||
public ServerPlayer makePlayerForRespawn(MinecraftServer minecraftServer, ServerLevel serverLevel, GameProfile gameProfile, ServerPlayer serverPlayer, boolean bl)
|
||||
{
|
||||
if (serverPlayer instanceof EntityPlayerMPFake) {
|
||||
return EntityPlayerMPFake.respawnFake(minecraftServer, serverLevel, gameProfile);
|
||||
}
|
||||
return new ServerPlayer(minecraftServer, serverLevel, gameProfile);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user