diff --git a/src/main/java/net/minecraft/server/management/ServerConfigurationManager.java b/src/main/java/net/minecraft/server/management/ServerConfigurationManager.java index 5d25fee..c96bd04 100644 --- a/src/main/java/net/minecraft/server/management/ServerConfigurationManager.java +++ b/src/main/java/net/minecraft/server/management/ServerConfigurationManager.java @@ -305,24 +305,8 @@ int cx = MathHelper.floor_double(par1EntityPlayerMP.posX) >> 4; int cz = MathHelper.floor_double(par1EntityPlayerMP.posZ) >> 4; - if(worldserver.chunkExists(cx, cz)) - { - worldserver.spawnEntityInWorld(par1EntityPlayerMP); - this.func_72375_a(par1EntityPlayerMP, (WorldServer)null); - } - else - { - worldserver.theChunkProviderServer.loadAsync(cx, cz, new IChunkLoadCallback() - { - @Override - public void onChunkLoaded(Chunk chunk) - { - worldserver.spawnEntityInWorld(par1EntityPlayerMP); - func_72375_a(par1EntityPlayerMP, (WorldServer)null); - } - }); - worldserver.theChunkProviderServer.loadAsyncRadius(cx, cz, 1, IChunkLoadCallback.EMPTY); - } + worldserver.spawnEntityInWorld(par1EntityPlayerMP); + func_72375_a(par1EntityPlayerMP, (WorldServer)null); for (int i = 0; i < this.playerEntityList.size(); ++i) { @@ -523,8 +507,9 @@ p_72356_1_.playerNetServerHandler.sendPacket(new S07PacketRespawn(p_72356_1_.dimension, p_72356_1_.worldObj.difficultySetting, p_72356_1_.worldObj.getWorldInfo().getTerrainType(), p_72356_1_.theItemInWorldManager.getGameType())); worldserver.removePlayerEntityDangerously(p_72356_1_); p_72356_1_.isDead = false; - this.transferEntityToWorld(p_72356_1_, j, worldserver, worldserver1, teleporter); + p_72356_1_.setWorld(worldserver1); this.func_72375_a(p_72356_1_, worldserver); + this.transferEntityToWorld(p_72356_1_, j, worldserver, worldserver1, teleporter); p_72356_1_.playerNetServerHandler.setPlayerLocation(p_72356_1_.posX, p_72356_1_.posY, p_72356_1_.posZ, p_72356_1_.rotationYaw, p_72356_1_.rotationPitch); p_72356_1_.theItemInWorldManager.setWorld(worldserver1); this.updateTimeAndWeatherForPlayer(p_72356_1_, worldserver1); diff --git a/src/main/java/net/minecraft/world/World.java b/src/main/java/net/minecraft/world/World.java index e065dff..246951a 100644 --- a/src/main/java/net/minecraft/world/World.java +++ b/src/main/java/net/minecraft/world/World.java @@ -18,6 +18,7 @@ import org.ultramine.server.ConfigurationHandler; import org.ultramine.server.chunk.ChunkHash; +import org.ultramine.server.chunk.IChunkLoadCallback; import net.minecraft.block.Block; import net.minecraft.block.BlockHopper; @@ -1288,24 +1289,25 @@ return true; } - public boolean spawnEntityInWorld(Entity p_72838_1_) + public boolean spawnEntityInWorld(final Entity p_72838_1_) { int i = MathHelper.floor_double(p_72838_1_.posX / 16.0D); int j = MathHelper.floor_double(p_72838_1_.posZ / 16.0D); boolean flag = p_72838_1_.forceSpawn; + boolean chunkExists = chunkExists(i, j); - if (p_72838_1_ instanceof EntityPlayer) + if (p_72838_1_.isEntityPlayer()) { flag = true; } - if (!flag && !this.chunkExists(i, j)) + if (!flag && !chunkExists) { return false; } else { - if (p_72838_1_ instanceof EntityPlayer) + if (p_72838_1_.isEntityPlayer()) { EntityPlayer entityplayer = (EntityPlayer)p_72838_1_; this.playerEntities.add(entityplayer); @@ -1313,7 +1315,25 @@ } if (MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false; - this.getChunkFromChunkCoords(i, j).addEntity(p_72838_1_); + if(chunkExists || isRemote) + { + this.getChunkFromChunkCoords(i, j).addEntity(p_72838_1_); + } + else if(p_72838_1_.isEntityPlayerMP()) + { + p_72838_1_.addedToChunk = false; + } + else + { + ((WorldServer)this).theChunkProviderServer.loadAsync(i, j, new IChunkLoadCallback() + { + @Override + public void onChunkLoaded(Chunk chunk) + { + chunk.addEntity(p_72838_1_); + } + }); + } this.loadedEntityList.add(p_72838_1_); this.onEntityAdded(p_72838_1_); return true; @@ -1997,7 +2017,7 @@ //boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); //byte b0 = isForced ? (byte)0 : 32; //boolean canUpdate = !p_72866_2_ || this.checkChunksExist(i - b0, 0, j - b0, i + b0, 0, j + b0); - boolean canUpdate = p_72866_1_.isEntityPlayerMP() || activeChunkSet.containsKey(ChunkHash.chunkToKey(i >> 4, j >> 4)); + boolean canUpdate = p_72866_1_.isEntityPlayerMP() || activeChunkSet.containsKey(ChunkHash.chunkToKey(i >> 4, j >> 4)) || isRemote && p_72866_1_.isEntityPlayer(); //if (!canUpdate) //{