From e7b2f5845b930e316ae20bd30e15131b4e48d603 Mon Sep 17 00:00:00 2001 From: Robotia Date: Sun, 24 Jan 2016 18:40:48 -0500 Subject: [PATCH] LinkedHashSet, not HashSet...! --- .../minecraft/world/WorldServer.java.patch | 74 +++++++++++-------- 1 file changed, 42 insertions(+), 32 deletions(-) diff --git a/patches/net/minecraft/world/WorldServer.java.patch b/patches/net/minecraft/world/WorldServer.java.patch index f526f59..a820573 100644 --- a/patches/net/minecraft/world/WorldServer.java.patch +++ b/patches/net/minecraft/world/WorldServer.java.patch @@ -1,6 +1,6 @@ --- ../src-base/minecraft/net/minecraft/world/WorldServer.java +++ ../src-work/minecraft/net/minecraft/world/WorldServer.java -@@ -1,8 +1,10 @@ +@@ -1,16 +1,22 @@ package net.minecraft.world; import com.google.common.collect.Lists; @@ -10,8 +10,9 @@ + import java.io.File; import java.util.ArrayList; ++import java.util.LinkedHashSet; import java.util.HashSet; -@@ -10,7 +12,10 @@ + import java.util.Iterator; import java.util.List; import java.util.Random; import java.util.Set; @@ -22,7 +23,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockEventData; import net.minecraft.block.material.Material; -@@ -56,6 +61,7 @@ +@@ -56,6 +62,7 @@ import net.minecraft.world.chunk.storage.IChunkLoader; import net.minecraft.world.gen.ChunkProviderServer; import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; @@ -30,7 +31,7 @@ import net.minecraft.world.storage.ISaveHandler; import net.minecraftforge.common.ChestGenHooks; import static net.minecraftforge.common.ChestGenHooks.BONUS_CHEST; -@@ -67,11 +73,26 @@ +@@ -67,11 +74,26 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -58,7 +59,7 @@ private final PlayerManager thePlayerManager; private Set pendingTickListEntriesHashSet; private TreeSet pendingTickListEntriesTreeSet; -@@ -92,9 +113,13 @@ +@@ -92,9 +114,13 @@ protected Set doneChunks = new HashSet(); public List customTeleporters = new ArrayList(); @@ -72,12 +73,12 @@ this.mcServer = p_i45284_1_; this.theEntityTracker = new EntityTracker(this); this.thePlayerManager = new PlayerManager(this); -@@ -106,12 +131,12 @@ +@@ -106,12 +132,12 @@ if (this.pendingTickListEntriesHashSet == null) { - this.pendingTickListEntriesHashSet = new HashSet(); -+ this.pendingTickListEntriesHashSet = Collections.synchronizedSet(new HashSet()); ++ this.pendingTickListEntriesHashSet = Collections.synchronizedSet(new LinkedHashSet()); } if (this.pendingTickListEntriesTreeSet == null) @@ -87,7 +88,7 @@ } this.worldTeleporter = new Teleporter(this); -@@ -124,6 +149,47 @@ +@@ -124,6 +150,47 @@ this.mapStorage.setData("scoreboard", scoreboardsavedata); } @@ -114,7 +115,7 @@ + + if (this.pendingTickListEntriesHashSet == null) + { -+ this.pendingTickListEntriesHashSet = Collections.synchronizedSet(new HashSet()); ++ this.pendingTickListEntriesHashSet = Collections.synchronizedSet(new LinkedHashSet()); + } + + if (this.pendingTickListEntriesTreeSet == null) @@ -135,7 +136,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 +198,31 @@ +@@ -132,6 +199,31 @@ DimensionManager.setWorld(p_i45284_4_, this); } @@ -167,7 +168,7 @@ public void tick() { super.tick(); -@@ -155,12 +246,19 @@ +@@ -155,12 +247,19 @@ } this.theProfiler.startSection("mobSpawner"); @@ -190,7 +191,7 @@ this.theProfiler.endStartSection("chunkSource"); this.chunkProvider.unloadQueuedChunks(); int j = this.calculateSkylightSubtracted(1.0F); -@@ -170,30 +268,47 @@ +@@ -170,30 +269,47 @@ this.skylightSubtracted = j; } @@ -239,7 +240,7 @@ } public BiomeGenBase.SpawnListEntry spawnRandomCreature(EnumCreatureType p_73057_1_, int p_73057_2_, int p_73057_3_, int p_73057_4_) -@@ -212,7 +327,7 @@ +@@ -212,7 +328,7 @@ { EntityPlayer entityplayer = (EntityPlayer)iterator.next(); @@ -248,7 +249,7 @@ { this.allPlayersSleeping = false; break; -@@ -240,7 +355,25 @@ +@@ -240,7 +356,25 @@ private void resetRainAndThunder() { @@ -275,7 +276,7 @@ } public boolean areAllPlayersAsleep() -@@ -248,19 +381,26 @@ +@@ -248,19 +382,26 @@ if (this.allPlayersSleeping && !this.isRemote) { Iterator iterator = this.playerEntities.iterator(); @@ -305,7 +306,7 @@ return false; } else -@@ -302,15 +442,29 @@ +@@ -302,15 +443,29 @@ super.func_147456_g(); int i = 0; int j = 0; @@ -341,7 +342,7 @@ this.func_147467_a(k, l, chunk); this.theProfiler.endStartSection("tickChunk"); chunk.func_150804_b(false); -@@ -346,12 +500,32 @@ +@@ -346,12 +501,32 @@ if (this.isBlockFreezableNaturally(j1 + k, l1 - 1, k1 + l)) { @@ -376,7 +377,7 @@ } if (this.isRaining()) -@@ -388,6 +562,7 @@ +@@ -388,6 +563,7 @@ if (block.getTickRandomly()) { ++i; @@ -384,7 +385,7 @@ block.updateTick(this, j2 + k, l2 + extendedblockstorage.getYLocation(), k2 + l, this.rand); } } -@@ -396,6 +571,13 @@ +@@ -396,6 +572,13 @@ this.theProfiler.endSection(); } @@ -398,7 +399,7 @@ } public boolean isBlockTickScheduledThisTick(int p_147477_1_, int p_147477_2_, int p_147477_3_, Block p_147477_4_) -@@ -474,7 +656,7 @@ +@@ -474,7 +657,7 @@ public void updateEntities() { @@ -407,7 +408,7 @@ { if (this.updateEntityTick++ >= 1200) { -@@ -487,6 +669,7 @@ +@@ -487,6 +670,7 @@ } super.updateEntities(); @@ -415,7 +416,7 @@ } public void resetUpdateEntityTick() -@@ -498,7 +681,7 @@ +@@ -498,7 +682,7 @@ { int i = this.pendingTickListEntriesTreeSet.size(); @@ -424,7 +425,7 @@ { throw new IllegalStateException("TickNextTick list out of synch"); } -@@ -506,7 +689,16 @@ +@@ -506,7 +690,16 @@ { if (i > 1000) { @@ -442,7 +443,7 @@ } this.theProfiler.startSection("cleaning"); -@@ -651,7 +843,37 @@ +@@ -651,7 +844,37 @@ protected IChunkProvider createChunkProvider() { IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider); @@ -481,7 +482,7 @@ return this.theChunkProviderServer; } -@@ -659,29 +881,31 @@ +@@ -659,29 +882,31 @@ { ArrayList arraylist = new ArrayList(); @@ -528,7 +529,16 @@ return arraylist; } -@@ -733,7 +957,28 @@ +@@ -704,7 +929,7 @@ + + if (this.pendingTickListEntriesHashSet == null) + { +- this.pendingTickListEntriesHashSet = new HashSet(); ++ this.pendingTickListEntriesHashSet = Collections.synchronizedSet(new LinkedHashSet()); + } + + if (this.pendingTickListEntriesTreeSet == null) +@@ -733,7 +958,28 @@ int i = 0; int j = this.provider.getAverageGroundLevel(); int k = 0; @@ -557,7 +567,7 @@ if (chunkposition != null) { i = chunkposition.chunkPosX; -@@ -876,6 +1121,20 @@ +@@ -876,6 +1122,20 @@ public boolean addWeatherEffect(Entity p_72942_1_) { @@ -578,7 +588,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 +1153,24 @@ +@@ -894,13 +1154,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_) { @@ -604,7 +614,7 @@ if (!p_72885_10_) { explosion.affectedBlockPositions.clear(); -@@ -977,7 +1247,7 @@ +@@ -977,7 +1248,7 @@ { boolean flag = this.isRaining(); super.updateWeather(); @@ -613,7 +623,7 @@ if (this.prevRainingStrength != this.rainingStrength) { this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); -@@ -988,10 +1258,6 @@ +@@ -988,10 +1259,6 @@ this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); } @@ -624,7 +634,7 @@ if (flag != this.isRaining()) { if (flag) -@@ -1006,6 +1272,33 @@ +@@ -1006,6 +1273,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); } @@ -658,7 +668,7 @@ } protected int func_152379_p() -@@ -1069,4 +1362,51 @@ +@@ -1069,4 +1363,51 @@ this(); } }