3
0

Do fully player cloning to avoid duping of items (probably related to #301)

This commit is contained in:
Sergey
2016-01-31 20:08:36 +07:00
parent 201b43272f
commit 8c5b2f7229
3 changed files with 50 additions and 32 deletions

View File

@ -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;
+ }
}

View File

@ -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);
}
}
}