3
0

Rewrite NextTickListEntry.hashCode() to implement real hashcode, not incremental ids :)

New function is more stable and gives a good distribution of numbers with less colissions.

Fix #313
This commit is contained in:
Sergey Shatunov 2016-02-01 16:03:58 +07:00
parent 6c2be10dc9
commit 12b0a52ae0
2 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@
public int hashCode() public int hashCode()
{ {
- return (this.xCoord * 1024 * 1024 + this.zCoord * 1024 + this.yCoord) * 256; - return (this.xCoord * 1024 * 1024 + this.zCoord * 1024 + this.yCoord) * 256;
+ return (int) (tickEntryID & 0xFFFFFFFF); + return ((yCoord * 31 + xCoord) * 31 + zCoord) * 17 + yCoord;
} }
public NextTickListEntry setScheduledTime(long p_77176_1_) public NextTickListEntry setScheduledTime(long p_77176_1_)

View File

@ -67,7 +67,7 @@
- public List loadedChunks = new ArrayList(); - public List loadedChunks = new ArrayList();
+ public boolean loadChunkOnProvideRequest = MinecraftServer.getServer().cauldronConfig.loadChunkOnRequest.getValue(); // Cauldron - if true, allows mods to force load chunks. to disable, set load-chunk-on-request in cauldron.yml to false + public boolean loadChunkOnProvideRequest = MinecraftServer.getServer().cauldronConfig.loadChunkOnRequest.getValue(); // Cauldron - if true, allows mods to force load chunks. to disable, set load-chunk-on-request in cauldron.yml to false
+ public int initialTick; // Cauldron counter to keep track of when this loader was created + public int initialTick; // Cauldron counter to keep track of when this loader was created
+ public TLongObjectMap<Chunk> loadedChunkHashMap_KC = new TSynchronizedLongObjectMap<Chunk>(new TLongObjectHashMap<Chunk>()); + public TLongObjectMap<Chunk> loadedChunkHashMap_KC = new TLongObjectHashMap<Chunk>();
+ public List loadedChunks = new ArrayList(); // Cauldron - vanilla compatibility + public List loadedChunks = new ArrayList(); // Cauldron - vanilla compatibility
public WorldServer worldObj; public WorldServer worldObj;
private Set<Long> loadingChunks = com.google.common.collect.Sets.newHashSet(); private Set<Long> loadingChunks = com.google.common.collect.Sets.newHashSet();