Browse Source

LinkedHashSet, not HashSet...!

master
Robotia 9 years ago
parent
commit
e7b2f5845b
  1. 74
      patches/net/minecraft/world/WorldServer.java.patch

74
patches/net/minecraft/world/WorldServer.java.patch

@ -1,6 +1,6 @@
--- ../src-base/minecraft/net/minecraft/world/WorldServer.java --- ../src-base/minecraft/net/minecraft/world/WorldServer.java
+++ ../src-work/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; package net.minecraft.world;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -10,8 +10,9 @@
+ +
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
+import java.util.LinkedHashSet;
import java.util.HashSet; import java.util.HashSet;
@@ -10,7 +12,10 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.Set; import java.util.Set;
@ -22,7 +23,7 @@
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockEventData; import net.minecraft.block.BlockEventData;
import net.minecraft.block.material.Material; 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.chunk.storage.IChunkLoader;
import net.minecraft.world.gen.ChunkProviderServer; import net.minecraft.world.gen.ChunkProviderServer;
import net.minecraft.world.gen.feature.WorldGeneratorBonusChest; import net.minecraft.world.gen.feature.WorldGeneratorBonusChest;
@ -30,7 +31,7 @@
import net.minecraft.world.storage.ISaveHandler; import net.minecraft.world.storage.ISaveHandler;
import net.minecraftforge.common.ChestGenHooks; import net.minecraftforge.common.ChestGenHooks;
import static net.minecraftforge.common.ChestGenHooks.BONUS_CHEST; 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.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
@ -58,7 +59,7 @@
private final PlayerManager thePlayerManager; private final PlayerManager thePlayerManager;
private Set pendingTickListEntriesHashSet; private Set pendingTickListEntriesHashSet;
private TreeSet pendingTickListEntriesTreeSet; private TreeSet pendingTickListEntriesTreeSet;
@@ -92,9 +113,13 @@ @@ -92,9 +114,13 @@
protected Set<ChunkCoordIntPair> doneChunks = new HashSet<ChunkCoordIntPair>(); protected Set<ChunkCoordIntPair> doneChunks = new HashSet<ChunkCoordIntPair>();
public List<Teleporter> customTeleporters = new ArrayList<Teleporter>(); public List<Teleporter> customTeleporters = new ArrayList<Teleporter>();
@ -72,12 +73,12 @@
this.mcServer = p_i45284_1_; this.mcServer = p_i45284_1_;
this.theEntityTracker = new EntityTracker(this); this.theEntityTracker = new EntityTracker(this);
this.thePlayerManager = new PlayerManager(this); this.thePlayerManager = new PlayerManager(this);
@@ -106,12 +131,12 @@ @@ -106,12 +132,12 @@
if (this.pendingTickListEntriesHashSet == null) if (this.pendingTickListEntriesHashSet == null)
{ {
- this.pendingTickListEntriesHashSet = new HashSet(); - this.pendingTickListEntriesHashSet = new HashSet();
+ this.pendingTickListEntriesHashSet = Collections.synchronizedSet(new HashSet()); + this.pendingTickListEntriesHashSet = Collections.synchronizedSet(new LinkedHashSet());
} }
if (this.pendingTickListEntriesTreeSet == null) if (this.pendingTickListEntriesTreeSet == null)
@ -87,7 +88,7 @@
} }
this.worldTeleporter = new Teleporter(this); this.worldTeleporter = new Teleporter(this);
@@ -124,6 +149,47 @@ @@ -124,6 +150,47 @@
this.mapStorage.setData("scoreboard", scoreboardsavedata); this.mapStorage.setData("scoreboard", scoreboardsavedata);
} }
@ -114,7 +115,7 @@
+ +
+ if (this.pendingTickListEntriesHashSet == null) + if (this.pendingTickListEntriesHashSet == null)
+ { + {
+ this.pendingTickListEntriesHashSet = Collections.synchronizedSet(new HashSet()); + this.pendingTickListEntriesHashSet = Collections.synchronizedSet(new LinkedHashSet());
+ } + }
+ +
+ if (this.pendingTickListEntriesTreeSet == null) + 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 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); scoreboardsavedata.func_96499_a(this.worldScoreboard);
@@ -132,6 +198,31 @@ @@ -132,6 +199,31 @@
DimensionManager.setWorld(p_i45284_4_, this); DimensionManager.setWorld(p_i45284_4_, this);
} }
@ -167,7 +168,7 @@
public void tick() public void tick()
{ {
super.tick(); super.tick();
@@ -155,12 +246,19 @@ @@ -155,12 +247,19 @@
} }
this.theProfiler.startSection("mobSpawner"); this.theProfiler.startSection("mobSpawner");
@ -190,7 +191,7 @@
this.theProfiler.endStartSection("chunkSource"); this.theProfiler.endStartSection("chunkSource");
this.chunkProvider.unloadQueuedChunks(); this.chunkProvider.unloadQueuedChunks();
int j = this.calculateSkylightSubtracted(1.0F); int j = this.calculateSkylightSubtracted(1.0F);
@@ -170,30 +268,47 @@ @@ -170,30 +269,47 @@
this.skylightSubtracted = j; 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_) 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(); EntityPlayer entityplayer = (EntityPlayer)iterator.next();
@ -248,7 +249,7 @@
{ {
this.allPlayersSleeping = false; this.allPlayersSleeping = false;
break; break;
@@ -240,7 +355,25 @@ @@ -240,7 +356,25 @@
private void resetRainAndThunder() private void resetRainAndThunder()
{ {
@ -275,7 +276,7 @@
} }
public boolean areAllPlayersAsleep() public boolean areAllPlayersAsleep()
@@ -248,19 +381,26 @@ @@ -248,19 +382,26 @@
if (this.allPlayersSleeping && !this.isRemote) if (this.allPlayersSleeping && !this.isRemote)
{ {
Iterator iterator = this.playerEntities.iterator(); Iterator iterator = this.playerEntities.iterator();
@ -305,7 +306,7 @@
return false; return false;
} }
else else
@@ -302,15 +442,29 @@ @@ -302,15 +443,29 @@
super.func_147456_g(); super.func_147456_g();
int i = 0; int i = 0;
int j = 0; int j = 0;
@ -341,7 +342,7 @@
this.func_147467_a(k, l, chunk); this.func_147467_a(k, l, chunk);
this.theProfiler.endStartSection("tickChunk"); this.theProfiler.endStartSection("tickChunk");
chunk.func_150804_b(false); chunk.func_150804_b(false);
@@ -346,12 +500,32 @@ @@ -346,12 +501,32 @@
if (this.isBlockFreezableNaturally(j1 + k, l1 - 1, k1 + l)) if (this.isBlockFreezableNaturally(j1 + k, l1 - 1, k1 + l))
{ {
@ -376,7 +377,7 @@
} }
if (this.isRaining()) if (this.isRaining())
@@ -388,6 +562,7 @@ @@ -388,6 +563,7 @@
if (block.getTickRandomly()) if (block.getTickRandomly())
{ {
++i; ++i;
@ -384,7 +385,7 @@
block.updateTick(this, j2 + k, l2 + extendedblockstorage.getYLocation(), k2 + l, this.rand); block.updateTick(this, j2 + k, l2 + extendedblockstorage.getYLocation(), k2 + l, this.rand);
} }
} }
@@ -396,6 +571,13 @@ @@ -396,6 +572,13 @@
this.theProfiler.endSection(); 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_) 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() public void updateEntities()
{ {
@ -407,7 +408,7 @@
{ {
if (this.updateEntityTick++ >= 1200) if (this.updateEntityTick++ >= 1200)
{ {
@@ -487,6 +669,7 @@ @@ -487,6 +670,7 @@
} }
super.updateEntities(); super.updateEntities();
@ -415,7 +416,7 @@
} }
public void resetUpdateEntityTick() public void resetUpdateEntityTick()
@@ -498,7 +681,7 @@ @@ -498,7 +682,7 @@
{ {
int i = this.pendingTickListEntriesTreeSet.size(); int i = this.pendingTickListEntriesTreeSet.size();
@ -424,7 +425,7 @@
{ {
throw new IllegalStateException("TickNextTick list out of synch"); throw new IllegalStateException("TickNextTick list out of synch");
} }
@@ -506,7 +689,16 @@ @@ -506,7 +690,16 @@
{ {
if (i > 1000) if (i > 1000)
{ {
@ -442,7 +443,7 @@
} }
this.theProfiler.startSection("cleaning"); this.theProfiler.startSection("cleaning");
@@ -651,7 +843,37 @@ @@ -651,7 +844,37 @@
protected IChunkProvider createChunkProvider() protected IChunkProvider createChunkProvider()
{ {
IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider); IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider);
@ -481,7 +482,7 @@
return this.theChunkProviderServer; return this.theChunkProviderServer;
} }
@@ -659,29 +881,31 @@ @@ -659,29 +882,31 @@
{ {
ArrayList arraylist = new ArrayList(); ArrayList arraylist = new ArrayList();
@ -528,7 +529,16 @@
return arraylist; 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 i = 0;
int j = this.provider.getAverageGroundLevel(); int j = this.provider.getAverageGroundLevel();
int k = 0; int k = 0;
@ -557,7 +567,7 @@
if (chunkposition != null) if (chunkposition != null)
{ {
i = chunkposition.chunkPosX; i = chunkposition.chunkPosX;
@@ -876,6 +1121,20 @@ @@ -876,6 +1122,20 @@
public boolean addWeatherEffect(Entity p_72942_1_) public boolean addWeatherEffect(Entity p_72942_1_)
{ {
@ -578,7 +588,7 @@
if (super.addWeatherEffect(p_72942_1_)) 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_)); 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_) 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_) if (!p_72885_10_)
{ {
explosion.affectedBlockPositions.clear(); explosion.affectedBlockPositions.clear();
@@ -977,7 +1247,7 @@ @@ -977,7 +1248,7 @@
{ {
boolean flag = this.isRaining(); boolean flag = this.isRaining();
super.updateWeather(); super.updateWeather();
@ -613,7 +623,7 @@
if (this.prevRainingStrength != this.rainingStrength) if (this.prevRainingStrength != this.rainingStrength)
{ {
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId); 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); this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
} }
@ -624,7 +634,7 @@
if (flag != this.isRaining()) if (flag != this.isRaining())
{ {
if (flag) 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(7, this.rainingStrength), this.provider.dimensionId);
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId); this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
} }
@ -658,7 +668,7 @@
} }
protected int func_152379_p() protected int func_152379_p()
@@ -1069,4 +1362,51 @@ @@ -1069,4 +1363,51 @@
this(); this();
} }
} }

Loading…
Cancel
Save