Allow for respawning in different dimensions.

This commit is contained in:
LexManos 2012-09-11 18:28:55 -07:00
parent 72bba82150
commit af6b8820d4
2 changed files with 26 additions and 4 deletions

View file

@ -50,3 +50,12 @@
{
this.playerEntity.theItemInWorldManager.activateBlockOrUseItem(this.playerEntity, var2, var3, var5, var6, var7, var8, par1Packet15Place.getXOffset(), par1Packet15Place.getYOffset(), par1Packet15Place.getZOffset());
}
@@ -787,7 +792,7 @@
return;
}
- this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, 0, false);
+ this.playerEntity = this.mcServer.getConfigurationManager().respawnPlayer(this.playerEntity, playerEntity.dimension, false);
}
}
}

View file

@ -8,7 +8,20 @@
public abstract class ServerConfigurationManager
{
@@ -319,6 +320,7 @@
@@ -299,6 +300,12 @@
*/
public EntityPlayerMP respawnPlayer(EntityPlayerMP par1EntityPlayerMP, int par2, boolean par3)
{
+ World world = mcServer.worldServerForDimension(par2);
+ if (world == null || !world.provider.canRespawnHere())
+ {
+ par2 = 0;
+ }
+
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removeAllTrackingPlayers(par1EntityPlayerMP);
par1EntityPlayerMP.getServerForPlayer().getEntityTracker().removeEntityFromAllTrackingPlayers(par1EntityPlayerMP);
par1EntityPlayerMP.getServerForPlayer().getPlayerManager().removePlayer(par1EntityPlayerMP);
@@ -319,6 +326,7 @@
EntityPlayerMP var6 = new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension), par1EntityPlayerMP.username, (ItemInWorldManager)var5);
var6.clonePlayer(par1EntityPlayerMP, par3);
@ -16,7 +29,7 @@
var6.entityId = par1EntityPlayerMP.entityId;
var6.serverForThisPlayer = par1EntityPlayerMP.serverForThisPlayer;
WorldServer var7 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
@@ -362,6 +364,11 @@
@@ -362,6 +370,11 @@
public void transferPlayerToDimension(EntityPlayerMP par1EntityPlayerMP, int par2)
{
@ -28,7 +41,7 @@
int var3 = par1EntityPlayerMP.dimension;
WorldServer var4 = this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension);
par1EntityPlayerMP.dimension = par2;
@@ -369,33 +376,14 @@
@@ -369,33 +382,14 @@
par1EntityPlayerMP.serverForThisPlayer.sendPacketToPlayer(new Packet9Respawn(par1EntityPlayerMP.dimension, (byte)par1EntityPlayerMP.worldObj.difficultySetting, var5.getWorldInfo().getTerrainType(), var5.getHeight(), par1EntityPlayerMP.theItemInWorldManager.getGameType()));
var4.removeEntity(par1EntityPlayerMP);
par1EntityPlayerMP.isDead = false;
@ -70,7 +83,7 @@
{
ChunkCoordinates var12 = var5.getEntrancePortalLocation();
var6 = (double)var12.posX;
@@ -419,7 +407,7 @@
@@ -419,7 +413,7 @@
var5.spawnEntityInWorld(par1EntityPlayerMP);
par1EntityPlayerMP.setLocationAndAngles(var6, par1EntityPlayerMP.posY, var8, par1EntityPlayerMP.rotationYaw, par1EntityPlayerMP.rotationPitch);
var5.updateEntityWithOptionalForce(par1EntityPlayerMP, false);