public virtual net.minecraft.src.EntityPlayerMP RecreatePlayerEntity(net.minecraft.src.EntityPlayerMP entityplayermp, int i) { mcServer.GetEntityTracker(entityplayermp.dimension).RemoveTrackedPlayerSymmetric( entityplayermp); mcServer.GetEntityTracker(entityplayermp.dimension).UntrackEntity(entityplayermp); GetPlayerManager(entityplayermp.dimension).RemovePlayer(entityplayermp); playerEntities.Remove(entityplayermp); mcServer.GetWorldServer(entityplayermp.dimension).RemovePlayer(entityplayermp); net.minecraft.src.ChunkCoordinates chunkcoordinates = entityplayermp.GetSpawnChunk (); entityplayermp.dimension = i; net.minecraft.src.EntityPlayerMP entityplayermp1 = new net.minecraft.src.EntityPlayerMP (mcServer, mcServer.GetWorldServer(entityplayermp.dimension), entityplayermp.username , new net.minecraft.src.ItemInWorldManager(mcServer.GetWorldServer(entityplayermp .dimension))); entityplayermp1.entityId = entityplayermp.entityId; entityplayermp1.netServerHandler = entityplayermp.netServerHandler; net.minecraft.src.WorldServer worldserver = mcServer.GetWorldServer(entityplayermp .dimension); if (chunkcoordinates != null) { net.minecraft.src.ChunkCoordinates chunkcoordinates1 = net.minecraft.src.EntityPlayer .Func_25051_a(mcServer.GetWorldServer(entityplayermp.dimension), chunkcoordinates ); if (chunkcoordinates1 != null) { entityplayermp1.SetLocationAndAngles((float)chunkcoordinates1.posX + 0.5F, (float )chunkcoordinates1.posY + 0.1F, (float)chunkcoordinates1.posZ + 0.5F, 0.0F, 0.0F ); entityplayermp1.SetSpawnChunk(chunkcoordinates); } else { entityplayermp1.netServerHandler.SendPacket(new net.minecraft.src.Packet70Bed (0)); } } worldserver.chunkProviderServer.LoadChunk((int)entityplayermp1.posX >> 4, (int)entityplayermp1 .posZ >> 4); for (; worldserver.GetCollidingBoundingBoxes(entityplayermp1, entityplayermp1.boundingBox ).Count != 0; entityplayermp1.SetPosition(entityplayermp1.posX, entityplayermp1. posY + 1.0D, entityplayermp1.posZ)) { } entityplayermp1.netServerHandler.SendPacket(new net.minecraft.src.Packet9Respawn (unchecked ((byte)entityplayermp1.dimension))); entityplayermp1.netServerHandler.TeleportTo(entityplayermp1.posX, entityplayermp1 .posY, entityplayermp1.posZ, entityplayermp1.rotationYaw, entityplayermp1.rotationPitch ); Func_28170_a(entityplayermp1, worldserver); GetPlayerManager(entityplayermp1.dimension).AddPlayer(entityplayermp1); worldserver.AddEntity(entityplayermp1); playerEntities.Add(entityplayermp1); entityplayermp1.Func_20057_k(); entityplayermp1.Func_22068_s(); return(entityplayermp1); }
public virtual void PlayerLoggedIn(net.minecraft.src.EntityPlayerMP entityplayermp) { playerEntities.Add(entityplayermp); SharpBukkitPlayers[entityplayermp.username.ToLower()] = new SharpBukkitPlayer(entityplayermp); //SHARP net.minecraft.src.WorldServer worldserver = mcServer.GetWorldServer(entityplayermp .dimension); worldserver.chunkProviderServer.LoadChunk((int)entityplayermp.posX >> 4, (int)entityplayermp .posZ >> 4); for (; worldserver.GetCollidingBoundingBoxes(entityplayermp, entityplayermp.boundingBox ).Count != 0; entityplayermp.SetPosition(entityplayermp.posX, entityplayermp.posY + 1.0D, entityplayermp.posZ)) { } worldserver.AddEntity(entityplayermp); GetPlayerManager(entityplayermp.dimension).AddPlayer(entityplayermp); }
public virtual void SendPlayerToOtherDimension(net.minecraft.src.EntityPlayerMP entityplayermp ) { net.minecraft.src.WorldServer worldserver = mcServer.GetWorldServer(entityplayermp .dimension); int i = 0; if (entityplayermp.dimension == -1) { i = 0; } else { i = -1; } entityplayermp.dimension = i; net.minecraft.src.WorldServer worldserver1 = mcServer.GetWorldServer(entityplayermp .dimension); entityplayermp.netServerHandler.SendPacket(new net.minecraft.src.Packet9Respawn (unchecked ((byte)entityplayermp.dimension))); worldserver.RemovePlayer(entityplayermp); entityplayermp.isDead = false; double d = entityplayermp.posX; double d1 = entityplayermp.posZ; double d2 = 8D; if (entityplayermp.dimension == -1) { d /= d2; d1 /= d2; entityplayermp.SetLocationAndAngles(d, entityplayermp.posY, d1, entityplayermp.rotationYaw , entityplayermp.rotationPitch); if (entityplayermp.IsEntityAlive()) { worldserver.UpdateEntityWithOptionalForce(entityplayermp, false); } } else { d *= d2; d1 *= d2; entityplayermp.SetLocationAndAngles(d, entityplayermp.posY, d1, entityplayermp.rotationYaw , entityplayermp.rotationPitch); if (entityplayermp.IsEntityAlive()) { worldserver.UpdateEntityWithOptionalForce(entityplayermp, false); } } if (entityplayermp.IsEntityAlive()) { worldserver1.AddEntity(entityplayermp); entityplayermp.SetLocationAndAngles(d, entityplayermp.posY, d1, entityplayermp.rotationYaw , entityplayermp.rotationPitch); worldserver1.UpdateEntityWithOptionalForce(entityplayermp, false); worldserver1.chunkProviderServer.chunkLoadOverride = true; (new net.minecraft.src.PortalTravelAgent()).SetExitLocation(worldserver1, entityplayermp ); worldserver1.chunkProviderServer.chunkLoadOverride = false; } Func_28172_a(entityplayermp); entityplayermp.netServerHandler.TeleportTo(entityplayermp.posX, entityplayermp .posY, entityplayermp.posZ, entityplayermp.rotationYaw, entityplayermp.rotationPitch ); entityplayermp.SetWorldHandler(worldserver1); Func_28170_a(entityplayermp, worldserver1); Func_30008_g(entityplayermp); }