@ -31,7 +31,12 @@
import net.minecraft.world.storage.ISaveHandler;
import net.minecraftforge.common.ChestGenHooks;
import static net.minecraftforge.common.ChestGenHooks.BONUS_CHEST;
@@ -67,11 +74,26 @@
@@ -63,15 +70,31 @@
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeEventFactory;
import net.minecraftforge.event.world.WorldEvent;
+import net.minecraftforge.cauldron.command.CauldronCommand;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -59,7 +64,7 @@
private final PlayerManager thePlayerManager;
private Set pendingTickListEntriesHashSet;
private TreeSet pendingTickListEntriesTreeSet;
@@ -92,9 +114 ,13 @@
@@ -92,9 +115 ,13 @@
protected Set<ChunkCoordIntPair> doneChunks = new HashSet<ChunkCoordIntPair>();
public List<Teleporter> customTeleporters = new ArrayList<Teleporter>();
@ -73,7 +78,7 @@
this.mcServer = p_i45284_1_;
this.theEntityTracker = new EntityTracker(this);
this.thePlayerManager = new PlayerManager(this);
@@ -106,12 +132 ,12 @@
@@ -106,12 +133 ,12 @@
if (this.pendingTickListEntriesHashSet == null)
{
@ -88,7 +93,7 @@
}
this.worldTeleporter = new Teleporter(this);
@@ -124,6 +150 ,47 @@
@@ -124,6 +151 ,47 @@
this.mapStorage.setData("scoreboard", scoreboardsavedata);
}
@ -136,7 +141,7 @@
if (!(this instanceof WorldServerMulti)) //Forge: We fix the global mapStorage, which causes us to share scoreboards early. So don't associate the save data with the temporary scoreboard
{
scoreboardsavedata.func_96499_a(this.worldScoreboard);
@@ -132,6 +199 ,31 @@
@@ -132,6 +200 ,31 @@
DimensionManager.setWorld(p_i45284_4_, this);
}
@ -168,7 +173,7 @@
public void tick()
{
super.tick();
@@ -155,12 +247 ,19 @@
@@ -155,12 +248 ,19 @@
}
this.theProfiler.startSection("mobSpawner");
@ -191,7 +196,7 @@
this.theProfiler.endStartSection("chunkSource");
this.chunkProvider.unloadQueuedChunks();
int j = this.calculateSkylightSubtracted(1.0F);
@@ -170,30 +269 ,47 @@
@@ -170,30 +270 ,47 @@
this.skylightSubtracted = j;
}
@ -240,7 +245,7 @@
}
public BiomeGenBase.SpawnListEntry spawnRandomCreature(EnumCreatureType p_73057_1_, int p_73057_2_, int p_73057_3_, int p_73057_4_)
@@ -212,7 +328 ,7 @@
@@ -212,7 +329 ,7 @@
{
EntityPlayer entityplayer = (EntityPlayer)iterator.next();
@ -249,7 +254,7 @@
{
this.allPlayersSleeping = false;
break;
@@ -240,7 +356 ,25 @@
@@ -240,7 +357 ,25 @@
private void resetRainAndThunder()
{
@ -276,7 +281,7 @@
}
public boolean areAllPlayersAsleep()
@@ -248,19 +382 ,26 @@
@@ -248,19 +383 ,26 @@
if (this.allPlayersSleeping && !this.isRemote)
{
Iterator iterator = this.playerEntities.iterator();
@ -306,7 +311,7 @@
return false;
}
else
@@ -302,15 +443 ,29 @@
@@ -302,15 +444 ,29 @@
super.func_147456_g();
int i = 0;
int j = 0;
@ -342,7 +347,7 @@
this.func_147467_a(k, l, chunk);
this.theProfiler.endStartSection("tickChunk");
chunk.func_150804_b(false);
@@ -346,12 +501 ,32 @@
@@ -346,12 +502 ,32 @@
if (this.isBlockFreezableNaturally(j1 + k, l1 - 1, k1 + l))
{
@ -377,7 +382,7 @@
}
if (this.isRaining())
@@ -388,6 +563 ,7 @@
@@ -388,6 +564 ,7 @@
if (block.getTickRandomly())
{
++i;
@ -385,7 +390,7 @@
block.updateTick(this, j2 + k, l2 + extendedblockstorage.getYLocation(), k2 + l, this.rand);
}
}
@@ -396,6 +572 ,13 @@
@@ -396,6 +573 ,13 @@
this.theProfiler.endSection();
}
@ -399,7 +404,7 @@
}
public boolean isBlockTickScheduledThisTick(int p_147477_1_, int p_147477_2_, int p_147477_3_, Block p_147477_4_)
@@ -474,7 +657 ,7 @@
@@ -474,7 +658 ,7 @@
public void updateEntities()
{
@ -408,7 +413,7 @@
{
if (this.updateEntityTick++ >= 1200)
{
@@ -487,6 +670 ,7 @@
@@ -487,6 +671 ,7 @@
}
super.updateEntities();
@ -416,16 +421,54 @@
}
public void resetUpdateEntityTick()
@@ -498,7 +682,7 @@
@@ -494,19 +679,60 @@
this.updateEntityTick = 0;
}
+ public void reevaluate()
+ {
+ if(this.pendingTickListEntriesTreeSet.size() > this.pendingTickListEntriesHashSet.size())
+ {
+ for(Object o : this.pendingTickListEntriesTreeSet)
+ {
+ if(!this.pendingTickListEntriesHashSet.contains(o))
+ {
+ //this.pendingTickListEntriesHashSet.add(o);
+ NextTickListEntry t = (NextTickListEntry) o;
+ System.out.println("Detected TreeSet culprit at " +t.xCoord+", "+t.yCoord+", " + t.zCoord + " and leaving. Notify someone we got a bogey!");
+ }
+ }
+ }
+ else if(this.pendingTickListEntriesTreeSet.size() < this.pendingTickListEntriesHashSet.size())
+ {
+ for(Object o : this.pendingTickListEntriesHashSet)
+ {
+ if(!this.pendingTickListEntriesTreeSet.contains(o))
+ {
+ //this.pendingTickListEntriesTreeSet.add(o);
+ NextTickListEntry t = (NextTickListEntry) o;
+ System.out.println("Detected HashSet culprit at " +t.xCoord+", "+t.yCoord+", " + t.zCoord + " and leaving. Notify someone we got a bogey!");
+ }
+ }
+ }
+ }
+
+ long last = 0L;
public boolean tickUpdates(boolean p_72955_1_)
{
int i = this.pendingTickListEntriesTreeSet.size();
- if (i != this.pendingTickListEntriesHashSet.size())
+ if (false)//i != this.pendingTickListEntriesHashSet.size())
+ if (CauldronCommand.debug )//i != this.pendingTickListEntriesHashSet.size())
{
throw new IllegalStateException("TickNextTick list out of synch");
- throw new IllegalStateException("TickNextTick list out of synch");
+ if(System.currentTimeMillis() - last > 20000){
+ System.out.println("[WARN - Robotia] TickNextTick list out of synch by " +Math.abs(this.pendingTickListEntriesTreeSet.size()-this.pendingTickListEntriesHashSet.size() ));
+ reevaluate(); last = System.currentTimeMillis();}
+ //throw new IllegalStateException("TickNextTick list out of synch");
}
@@ -506,7 +690,16 @@
- else
+ if(true)
{
if (i > 1000)
{
@ -443,7 +486,15 @@
}
this.theProfiler.startSection("cleaning");
@@ -651,7 +844,37 @@
@@ -579,6 +805,7 @@
this.pendingTickListEntriesThisTick.clear();
return !this.pendingTickListEntriesTreeSet.isEmpty();
}
+ return !this.pendingTickListEntriesTreeSet.isEmpty();
}
public List getPendingBlockUpdates(Chunk p_72920_1_, boolean p_72920_2_)
@@ -651,7 +878,37 @@
protected IChunkProvider createChunkProvider()
{
IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider);
@ -482,7 +533,7 @@
return this.theChunkProviderServer;
}
@@ -659,29 +882 ,31 @@
@@ -659,29 +916 ,31 @@
{
ArrayList arraylist = new ArrayList();
@ -529,7 +580,7 @@
return arraylist;
}
@@ -704,7 +929 ,7 @@
@@ -704,7 +963 ,7 @@
if (this.pendingTickListEntriesHashSet == null)
{
@ -538,7 +589,7 @@
}
if (this.pendingTickListEntriesTreeSet == null)
@@ -733,7 +958 ,28 @@
@@ -733,7 +992 ,28 @@
int i = 0;
int j = this.provider.getAverageGroundLevel();
int k = 0;
@ -567,7 +618,7 @@
if (chunkposition != null)
{
i = chunkposition.chunkPosX;
@@ -876,6 +1122 ,20 @@
@@ -876,6 +1156 ,20 @@
public boolean addWeatherEffect(Entity p_72942_1_)
{
@ -588,7 +639,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 ,24 @@
@@ -894,13 +1188 ,24 @@
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_)
{
@ -614,7 +665,7 @@
if (!p_72885_10_)
{
explosion.affectedBlockPositions.clear();
@@ -977,7 +124 8,7 @@
@@ -977,7 +1282 ,7 @@
{
boolean flag = this.isRaining();
super.updateWeather();
@ -623,7 +674,7 @@
if (this.prevRainingStrength != this.rainingStrength)
{
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
@@ -988,10 +125 9,6 @@
@@ -988,10 +1293 ,6 @@
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
}
@ -634,7 +685,7 @@
if (flag != this.isRaining())
{
if (flag)
@@ -1006,6 +127 3,33 @@
@@ -1006,6 +1307 ,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);
}
@ -668,7 +719,7 @@
}
protected int func_152379_p()
@@ -1069,4 +1363 ,51 @@
@@ -1069,4 +1397 ,51 @@
this();
}
}