Do fully player cloning to avoid duping of items (probably related to #301)
This commit is contained in:
parent
201b43272f
commit
8c5b2f7229
@ -380,7 +380,7 @@
|
||||
public EntityPlayerMP createPlayerForUser(GameProfile p_148545_1_)
|
||||
{
|
||||
UUID uuid = EntityPlayer.func_146094_a(p_148545_1_);
|
||||
@@ -410,80 +619,200 @@
|
||||
@@ -410,80 +619,204 @@
|
||||
return new EntityPlayerMP(this.mcServer, this.mcServer.worldServerForDimension(0), p_148545_1_, (ItemInWorldManager)object);
|
||||
}
|
||||
|
||||
@ -487,7 +487,7 @@
|
||||
+ Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled() || event.getTo() == null)
|
||||
+ {
|
||||
+ return null;
|
||||
+ return par1EntityPlayerMP;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
@ -501,12 +501,16 @@
|
||||
+ // Phase 4 - handle bed spawn
|
||||
+ ChunkCoordinates bedSpawnChunkCoords = par1EntityPlayerMP.getBedLocation(targetDimension);
|
||||
+ boolean spawnForced = par1EntityPlayerMP.isSpawnForced(targetDimension);
|
||||
+ par1EntityPlayerMP.dimension = targetDimension;
|
||||
+ // CraftBukkit start
|
||||
+ EntityPlayerMP entityplayermp1 = par1EntityPlayerMP;
|
||||
+ par1EntityPlayerMP.dimension = targetDimension;
|
||||
+ EntityPlayerMP entityplayermp1 = new EntityPlayerMP(mcServer, mcServer.worldServerForDimension(targetDimension), par1EntityPlayerMP.getGameProfile(), new ItemInWorldManager(mcServer.worldServerForDimension(targetDimension)));
|
||||
+ entityplayermp1.playerNetServerHandler = par1EntityPlayerMP.playerNetServerHandler;
|
||||
+ entityplayermp1.playerNetServerHandler.playerEntity = entityplayermp1;
|
||||
+ entityplayermp1.clonePlayer(par1EntityPlayerMP, returnFromEnd); // KCauldron - clone player
|
||||
+ entityplayermp1.setWorld(this.mcServer.worldServerForDimension(par1EntityPlayerMP.dimension)); // make sure to update reference for bed spawn logic
|
||||
+ entityplayermp1.setWorld(mcServer.worldServerForDimension(targetDimension));;
|
||||
+ entityplayermp1.playerConqueredTheEnd = false;
|
||||
+ entityplayermp1.setEntityId(par1EntityPlayerMP.getEntityId());
|
||||
+ func_72381_a(entityplayermp1, par1EntityPlayerMP, mcServer.worldServerForDimension(targetDimension));
|
||||
ChunkCoordinates chunkcoordinates1;
|
||||
+ boolean isBedSpawn = false;
|
||||
+ org.bukkit.World toWorld = entityplayermp1.getBukkitEntity().getWorld();
|
||||
@ -621,7 +625,7 @@
|
||||
return entityplayermp1;
|
||||
}
|
||||
|
||||
@@ -492,34 +821,112 @@
|
||||
@@ -492,34 +825,112 @@
|
||||
transferPlayerToDimension(p_72356_1_, p_72356_2_, mcServer.worldServerForDimension(p_72356_2_).getDefaultTeleporter());
|
||||
}
|
||||
|
||||
@ -753,7 +757,7 @@
|
||||
}
|
||||
|
||||
public void transferEntityToWorld(Entity p_82448_1_, int p_82448_2_, WorldServer p_82448_3_, WorldServer p_82448_4_, Teleporter teleporter)
|
||||
@@ -605,6 +1012,109 @@
|
||||
@@ -605,6 +1016,109 @@
|
||||
p_82448_1_.setWorld(p_82448_4_);
|
||||
}
|
||||
|
||||
@ -863,7 +867,7 @@
|
||||
public void sendPlayerInfoToAllPlayers()
|
||||
{
|
||||
if (++this.playerPingIndex > 600)
|
||||
@@ -612,11 +1122,13 @@
|
||||
@@ -612,11 +1126,13 @@
|
||||
this.playerPingIndex = 0;
|
||||
}
|
||||
|
||||
@ -877,7 +881,7 @@
|
||||
}
|
||||
|
||||
public void sendPacketToAllPlayers(Packet p_148540_1_)
|
||||
@@ -877,13 +1389,24 @@
|
||||
@@ -877,13 +1393,24 @@
|
||||
for (int j = 0; j < this.playerEntityList.size(); ++j)
|
||||
{
|
||||
EntityPlayerMP entityplayermp = (EntityPlayerMP)this.playerEntityList.get(j);
|
||||
@ -904,7 +908,7 @@
|
||||
if (d4 * d4 + d5 * d5 + d6 * d6 < p_148543_8_ * p_148543_8_)
|
||||
{
|
||||
entityplayermp.playerNetServerHandler.sendPacket(p_148543_11_);
|
||||
@@ -941,13 +1464,16 @@
|
||||
@@ -941,13 +1468,16 @@
|
||||
p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(1, 0.0F));
|
||||
p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(7, p_72354_2_.getRainStrength(1.0F)));
|
||||
p_72354_1_.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(8, p_72354_2_.getWeightedThunderStrength(1.0F)));
|
||||
@ -922,7 +926,7 @@
|
||||
p_72385_1_.playerNetServerHandler.sendPacket(new S09PacketHeldItemChange(p_72385_1_.inventory.currentItem));
|
||||
}
|
||||
|
||||
@@ -961,9 +1487,17 @@
|
||||
@@ -961,9 +1491,17 @@
|
||||
return this.maxPlayers;
|
||||
}
|
||||
|
||||
@ -941,7 +945,7 @@
|
||||
}
|
||||
|
||||
public void setWhiteListEnabled(boolean p_72371_1_)
|
||||
@@ -1032,12 +1566,30 @@
|
||||
@@ -1032,12 +1570,30 @@
|
||||
|
||||
public void removeAllPlayers()
|
||||
{
|
||||
|
@ -388,13 +388,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -469,12 +650,13 @@
|
||||
{
|
||||
this.pendingTickListEntriesHashSet.add(nextticklistentry);
|
||||
this.pendingTickListEntriesTreeSet.add(nextticklistentry);
|
||||
+ getChunkFromBlockCoords(p_147446_1_, p_147446_3_).blockUpdates.add(nextticklistentry); // KCauldron
|
||||
}
|
||||
}
|
||||
@@ -474,7 +655,7 @@
|
||||
|
||||
public void updateEntities()
|
||||
{
|
||||
@ -403,7 +397,7 @@
|
||||
{
|
||||
if (this.updateEntityTick++ >= 1200)
|
||||
{
|
||||
@@ -487,6 +669,7 @@
|
||||
@@ -487,6 +668,7 @@
|
||||
}
|
||||
|
||||
super.updateEntities();
|
||||
@ -411,7 +405,7 @@
|
||||
}
|
||||
|
||||
public void resetUpdateEntityTick()
|
||||
@@ -506,7 +689,16 @@
|
||||
@@ -506,7 +688,16 @@
|
||||
{
|
||||
if (i > 1000)
|
||||
{
|
||||
@ -429,7 +423,7 @@
|
||||
}
|
||||
|
||||
this.theProfiler.startSection("cleaning");
|
||||
@@ -523,6 +715,7 @@
|
||||
@@ -523,6 +714,7 @@
|
||||
|
||||
this.pendingTickListEntriesTreeSet.remove(nextticklistentry);
|
||||
this.pendingTickListEntriesHashSet.remove(nextticklistentry);
|
||||
@ -437,7 +431,7 @@
|
||||
this.pendingTickListEntriesThisTick.add(nextticklistentry);
|
||||
}
|
||||
|
||||
@@ -651,7 +844,37 @@
|
||||
@@ -651,7 +843,37 @@
|
||||
protected IChunkProvider createChunkProvider()
|
||||
{
|
||||
IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider);
|
||||
@ -476,7 +470,7 @@
|
||||
return this.theChunkProviderServer;
|
||||
}
|
||||
|
||||
@@ -659,29 +882,31 @@
|
||||
@@ -659,29 +881,31 @@
|
||||
{
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
@ -523,7 +517,7 @@
|
||||
return arraylist;
|
||||
}
|
||||
|
||||
@@ -733,7 +958,28 @@
|
||||
@@ -733,7 +957,28 @@
|
||||
int i = 0;
|
||||
int j = this.provider.getAverageGroundLevel();
|
||||
int k = 0;
|
||||
@ -552,7 +546,7 @@
|
||||
if (chunkposition != null)
|
||||
{
|
||||
i = chunkposition.chunkPosX;
|
||||
@@ -876,6 +1122,20 @@
|
||||
@@ -876,6 +1121,20 @@
|
||||
|
||||
public boolean addWeatherEffect(Entity p_72942_1_)
|
||||
{
|
||||
@ -573,7 +567,7 @@
|
||||
if (super.addWeatherEffect(p_72942_1_))
|
||||
{
|
||||
this.mcServer.getConfigurationManager().sendToAllNear(p_72942_1_.posX, p_72942_1_.posY, p_72942_1_.posZ, 512.0D, this.provider.dimensionId, new S2CPacketSpawnGlobalEntity(p_72942_1_));
|
||||
@@ -894,13 +1154,23 @@
|
||||
@@ -894,13 +1153,23 @@
|
||||
|
||||
public Explosion newExplosion(Entity p_72885_1_, double p_72885_2_, double p_72885_4_, double p_72885_6_, float p_72885_8_, boolean p_72885_9_, boolean p_72885_10_)
|
||||
{
|
||||
@ -598,7 +592,7 @@
|
||||
if (!p_72885_10_)
|
||||
{
|
||||
explosion.affectedBlockPositions.clear();
|
||||
@@ -977,7 +1247,7 @@
|
||||
@@ -977,7 +1246,7 @@
|
||||
{
|
||||
boolean flag = this.isRaining();
|
||||
super.updateWeather();
|
||||
@ -607,7 +601,7 @@
|
||||
if (this.prevRainingStrength != this.rainingStrength)
|
||||
{
|
||||
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
|
||||
@@ -988,10 +1258,6 @@
|
||||
@@ -988,10 +1257,6 @@
|
||||
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
|
||||
}
|
||||
|
||||
@ -618,7 +612,7 @@
|
||||
if (flag != this.isRaining())
|
||||
{
|
||||
if (flag)
|
||||
@@ -1006,6 +1272,33 @@
|
||||
@@ -1006,6 +1271,33 @@
|
||||
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
|
||||
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
|
||||
}
|
||||
@ -652,7 +646,7 @@
|
||||
}
|
||||
|
||||
protected int func_152379_p()
|
||||
@@ -1069,4 +1362,51 @@
|
||||
@@ -1069,4 +1361,65 @@
|
||||
this();
|
||||
}
|
||||
}
|
||||
@ -703,4 +697,18 @@
|
||||
+ return this.getBlock(x, y, z);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
+
|
||||
+ // KCauldron start
|
||||
+ public NextTickListEntry allocateEntry(int x, int y, int z, Block block, int time, int priority)
|
||||
+ {
|
||||
+ NextTickListEntry nextticklistentry = new NextTickListEntry(x, y, z, block);
|
||||
+ nextticklistentry.setPriority(priority);
|
||||
+ if (block.getMaterial() != Material.air)
|
||||
+ nextticklistentry.setScheduledTime((long)time + this.worldInfo.getWorldTotalTime());
|
||||
+ if (!this.pendingTickListEntriesHashSet.contains(nextticklistentry)) {
|
||||
+ this.pendingTickListEntriesHashSet.add(nextticklistentry);
|
||||
+ this.pendingTickListEntriesTreeSet.add(nextticklistentry);
|
||||
+ }
|
||||
+ return nextticklistentry;
|
||||
+ }
|
||||
}
|
||||
|
@ -227,7 +227,13 @@
|
||||
if (p_75823_2_.hasKey("TileTicks", 9))
|
||||
{
|
||||
NBTTagList nbttaglist3 = p_75823_2_.getTagList("TileTicks", 10);
|
||||
@@ -515,6 +568,7 @@
|
||||
@@ -511,10 +564,12 @@
|
||||
for (int j1 = 0; j1 < nbttaglist3.tagCount(); ++j1)
|
||||
{
|
||||
NBTTagCompound nbttagcompound5 = nbttaglist3.getCompoundTagAt(j1);
|
||||
- p_75823_1_.func_147446_b(nbttagcompound5.getInteger("x"), nbttagcompound5.getInteger("y"), nbttagcompound5.getInteger("z"), Block.getBlockById(nbttagcompound5.getInteger("i")), nbttagcompound5.getInteger("t"), nbttagcompound5.getInteger("p"));
|
||||
+ NextTickListEntry entry = ((net.minecraft.world.WorldServer) p_75823_1_).allocateEntry(nbttagcompound5.getInteger("x"), nbttagcompound5.getInteger("y"), nbttagcompound5.getInteger("z"), Block.getBlockById(nbttagcompound5.getInteger("i")), nbttagcompound5.getInteger("t"), nbttagcompound5.getInteger("p"));
|
||||
+ chunk.blockUpdates.add(entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user