Rollback to the state of .152 build with some critical fixes and updates
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
--- ../src-base/minecraft/net/minecraft/world/World.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/World.java
|
||||
@@ -2,16 +2,21 @@
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
@ -8,21 +8,15 @@
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
+import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
+import java.util.Queue;
|
||||
import java.util.Random;
|
||||
@@ -12,6 +13,7 @@
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.Callable;
|
||||
+import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
+
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockHopper;
|
||||
import net.minecraft.block.BlockLiquid;
|
||||
@@ -23,9 +28,11 @@
|
||||
@@ -23,9 +25,11 @@
|
||||
import net.minecraft.crash.CrashReport;
|
||||
import net.minecraft.crash.CrashReportCategory;
|
||||
import net.minecraft.entity.Entity;
|
||||
@ -34,7 +28,7 @@
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.pathfinding.PathEntity;
|
||||
@@ -51,7 +58,6 @@
|
||||
@@ -51,7 +55,6 @@
|
||||
import net.minecraft.world.storage.ISaveHandler;
|
||||
import net.minecraft.world.storage.MapStorage;
|
||||
import net.minecraft.world.storage.WorldInfo;
|
||||
@ -42,7 +36,7 @@
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
|
||||
import com.google.common.collect.ImmutableSetMultimap;
|
||||
@@ -70,6 +76,55 @@
|
||||
@@ -70,6 +73,55 @@
|
||||
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
|
||||
import net.minecraft.entity.EnumCreatureType;
|
||||
|
||||
@ -98,22 +92,16 @@
|
||||
public abstract class World implements IBlockAccess
|
||||
{
|
||||
/**
|
||||
@@ -82,16 +137,17 @@
|
||||
public final MapStorage perWorldStorage;
|
||||
@@ -83,15 +135,14 @@
|
||||
|
||||
public boolean scheduledUpdatesAreImmediate;
|
||||
- public List loadedEntityList = new ArrayList();
|
||||
public List loadedEntityList = new ArrayList();
|
||||
- protected List unloadedEntityList = new ArrayList();
|
||||
- public List loadedTileEntityList = new ArrayList();
|
||||
- private List addedTileEntityList = new ArrayList();
|
||||
+ public List unloadedEntityList = new ArrayList(); // Cauldron
|
||||
public List loadedTileEntityList = new ArrayList();
|
||||
private List addedTileEntityList = new ArrayList();
|
||||
- private List field_147483_b = new ArrayList();
|
||||
+ public Queue<Entity> loadedEntityList_KC = new kcauldron.wrapper.ProcessingQueue<Entity>(new ConcurrentLinkedQueue<Entity>()); // KCauldron
|
||||
+ public List<Entity> loadedEntityList = new kcauldron.wrapper.QueueToList<Entity>(((kcauldron.wrapper.ProcessingQueue<Entity>)loadedEntityList_KC).unwrap()); // KCauldron
|
||||
+ public List<Entity> unloadedEntityList = com.google.common.collect.ImmutableList.of(); // KCauldron
|
||||
+ public Queue<TileEntity> loadedTileEntityList_KC = new kcauldron.wrapper.ProcessingQueue<TileEntity>(new ConcurrentLinkedQueue<TileEntity>()); // KCauldron
|
||||
+ public List<TileEntity> loadedTileEntityList = new kcauldron.wrapper.QueueToList<TileEntity>(((kcauldron.wrapper.ProcessingQueue<TileEntity>)loadedTileEntityList_KC).unwrap()); // KCauldron
|
||||
+ private List<TileEntity> addedTileEntityList = new ArrayList<TileEntity>(); // KCauldron
|
||||
+ public List<TileEntity> field_147483_b = com.google.common.collect.ImmutableList.of(); // KCauldron
|
||||
+ public List field_147483_b = new ArrayList(); // Cauldron
|
||||
public List playerEntities = new ArrayList();
|
||||
public List weatherEffects = new ArrayList();
|
||||
private long cloudColour = 16777215L;
|
||||
@ -122,7 +110,7 @@
|
||||
protected final int DIST_HASH_MAGIC = 1013904223;
|
||||
public float prevRainingStrength;
|
||||
public float rainingStrength;
|
||||
@@ -100,26 +156,87 @@
|
||||
@@ -100,26 +151,88 @@
|
||||
public int lastLightningBolt;
|
||||
public EnumDifficulty difficultySetting;
|
||||
public Random rand = new Random();
|
||||
@ -152,6 +140,7 @@
|
||||
+ public long ticksPerAnimalSpawns;
|
||||
+ public long ticksPerMonsterSpawns;
|
||||
+ public boolean populating;
|
||||
+ private int tickPosition;
|
||||
+ // CraftBukkit end
|
||||
+ public Set activeChunkSet = new HashSet(); // Cauldron - protected -> public
|
||||
private int ambientTickCountdown;
|
||||
@ -193,7 +182,7 @@
|
||||
+ // Spigot start
|
||||
+
|
||||
+ /** Positions to update */
|
||||
+ public final gnu.trove.map.hash.TLongShortHashMap activeChunkSet_CB;
|
||||
+ protected final gnu.trove.map.hash.TLongShortHashMap activeChunkSet_CB;
|
||||
+ public float growthOdds = 100;
|
||||
+ protected float modifiedOdds = 100;
|
||||
+
|
||||
@ -217,7 +206,7 @@
|
||||
private static final String __OBFID = "CL_00000140";
|
||||
public boolean restoringBlockSnapshots = false;
|
||||
public boolean captureBlockSnapshots = false;
|
||||
@@ -166,6 +283,26 @@
|
||||
@@ -166,6 +279,27 @@
|
||||
return this.provider.worldChunkMgr;
|
||||
}
|
||||
|
||||
@ -230,6 +219,7 @@
|
||||
+ public final SpigotTimings.WorldTimingsHandler timings; // Spigot
|
||||
+ private org.spigotmc.TickLimiter entityLimiter; // Spigot
|
||||
+ private org.spigotmc.TickLimiter tileLimiter; // Spigot
|
||||
+ private int tileTickPosition; // Spigot
|
||||
+
|
||||
+ public CraftWorld getWorld()
|
||||
+ {
|
||||
@ -244,7 +234,7 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public World(ISaveHandler p_i45368_1_, String p_i45368_2_, WorldProvider p_i45368_3_, WorldSettings p_i45368_4_, Profiler p_i45368_5_)
|
||||
{
|
||||
@@ -179,6 +316,12 @@
|
||||
@@ -179,6 +313,12 @@
|
||||
this.worldInfo = new WorldInfo(p_i45368_4_, p_i45368_2_);
|
||||
this.provider = p_i45368_3_;
|
||||
perWorldStorage = new MapStorage((ISaveHandler)null);
|
||||
@ -257,7 +247,7 @@
|
||||
}
|
||||
|
||||
// Broken up so that the WorldClient gets the chance to set the mapstorage object before the dimension initializes
|
||||
@@ -207,8 +350,175 @@
|
||||
@@ -207,8 +347,175 @@
|
||||
this.calculateInitialWeather();
|
||||
}
|
||||
|
||||
@ -433,7 +423,7 @@
|
||||
this.ambientTickCountdown = this.rand.nextInt(12000);
|
||||
this.spawnHostileMobs = true;
|
||||
this.spawnPeacefulMobs = true;
|
||||
@@ -216,7 +526,6 @@
|
||||
@@ -216,7 +523,6 @@
|
||||
this.lightUpdateBlockList = new int[32768];
|
||||
this.saveHandler = p_i45369_1_;
|
||||
this.theProfiler = p_i45369_5_;
|
||||
@ -441,7 +431,7 @@
|
||||
this.worldInfo = p_i45369_1_.loadWorldInfo();
|
||||
|
||||
if (p_i45369_4_ != null)
|
||||
@@ -235,13 +544,26 @@
|
||||
@@ -235,13 +541,26 @@
|
||||
if (this.worldInfo == null)
|
||||
{
|
||||
this.worldInfo = new WorldInfo(p_i45369_3_, p_i45369_2_);
|
||||
@ -468,17 +458,15 @@
|
||||
this.chunkProvider = this.createChunkProvider();
|
||||
|
||||
if (this instanceof WorldServer)
|
||||
@@ -293,7 +615,9 @@
|
||||
|
||||
@@ -294,6 +613,7 @@
|
||||
this.calculateInitialSkylight();
|
||||
this.calculateInitialWeather();
|
||||
+ if (getServer() != null && world != null) getServer().addWorld(world); // CraftBukkit
|
||||
}
|
||||
+ // Cauldron end
|
||||
|
||||
private static MapStorage s_mapStorage;
|
||||
private static ISaveHandler s_savehandler;
|
||||
@@ -336,6 +660,18 @@
|
||||
@@ -336,6 +656,18 @@
|
||||
|
||||
public Block getBlock(int p_147439_1_, int p_147439_2_, int p_147439_3_)
|
||||
{
|
||||
@ -497,7 +485,7 @@
|
||||
if (p_147439_1_ >= -30000000 && p_147439_3_ >= -30000000 && p_147439_1_ < 30000000 && p_147439_3_ < 30000000 && p_147439_2_ >= 0 && p_147439_2_ < 256)
|
||||
{
|
||||
Chunk chunk = null;
|
||||
@@ -404,7 +740,7 @@
|
||||
@@ -404,7 +736,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@ -506,7 +494,7 @@
|
||||
{
|
||||
return this.chunkProvider.chunkExists(p_72916_1_, p_72916_2_);
|
||||
}
|
||||
@@ -421,6 +757,27 @@
|
||||
@@ -421,6 +753,27 @@
|
||||
|
||||
public boolean setBlock(int p_147465_1_, int p_147465_2_, int p_147465_3_, Block p_147465_4_, int p_147465_5_, int p_147465_6_)
|
||||
{
|
||||
@ -534,7 +522,7 @@
|
||||
if (p_147465_1_ >= -30000000 && p_147465_3_ >= -30000000 && p_147465_1_ < 30000000 && p_147465_3_ < 30000000)
|
||||
{
|
||||
if (p_147465_2_ < 0)
|
||||
@@ -448,8 +805,22 @@
|
||||
@@ -448,8 +801,22 @@
|
||||
this.capturedBlockSnapshots.add(blockSnapshot);
|
||||
}
|
||||
|
||||
@ -557,7 +545,7 @@
|
||||
if (!flag && blockSnapshot != null)
|
||||
{
|
||||
this.capturedBlockSnapshots.remove(blockSnapshot);
|
||||
@@ -460,6 +831,7 @@
|
||||
@@ -460,6 +827,7 @@
|
||||
this.func_147451_t(p_147465_1_, p_147465_2_, p_147465_3_);
|
||||
this.theProfiler.endSection();
|
||||
|
||||
@ -565,7 +553,7 @@
|
||||
if (flag && blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates
|
||||
{
|
||||
// Modularize client and physic updates
|
||||
@@ -496,6 +868,19 @@
|
||||
@@ -496,6 +864,19 @@
|
||||
|
||||
public int getBlockMetadata(int p_72805_1_, int p_72805_2_, int p_72805_3_)
|
||||
{
|
||||
@ -585,7 +573,7 @@
|
||||
if (p_72805_1_ >= -30000000 && p_72805_3_ >= -30000000 && p_72805_1_ < 30000000 && p_72805_3_ < 30000000)
|
||||
{
|
||||
if (p_72805_2_ < 0)
|
||||
@@ -511,7 +896,7 @@
|
||||
@@ -511,7 +892,7 @@
|
||||
Chunk chunk = this.getChunkFromChunkCoords(p_72805_1_ >> 4, p_72805_3_ >> 4);
|
||||
p_72805_1_ &= 15;
|
||||
p_72805_3_ &= 15;
|
||||
@ -594,7 +582,7 @@
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -610,6 +995,12 @@
|
||||
@@ -610,6 +991,12 @@
|
||||
|
||||
public void notifyBlockChange(int p_147444_1_, int p_147444_2_, int p_147444_3_, Block p_147444_4_)
|
||||
{
|
||||
@ -607,7 +595,7 @@
|
||||
this.notifyBlocksOfNeighborChange(p_147444_1_, p_147444_2_, p_147444_3_, p_147444_4_);
|
||||
}
|
||||
|
||||
@@ -694,6 +1085,21 @@
|
||||
@@ -694,6 +1081,21 @@
|
||||
|
||||
try
|
||||
{
|
||||
@ -629,7 +617,7 @@
|
||||
block.onNeighborBlockChange(this, p_147460_1_, p_147460_2_, p_147460_3_, p_147460_4_);
|
||||
}
|
||||
catch (Throwable throwable1)
|
||||
@@ -1307,6 +1713,13 @@
|
||||
@@ -1307,6 +1709,13 @@
|
||||
|
||||
public boolean spawnEntityInWorld(Entity p_72838_1_)
|
||||
{
|
||||
@ -643,7 +631,7 @@
|
||||
// do not drop any items while restoring blocksnapshots. Prevents dupes
|
||||
if (!this.isRemote && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false;
|
||||
|
||||
@@ -1319,23 +1732,99 @@
|
||||
@@ -1319,23 +1728,99 @@
|
||||
flag = true;
|
||||
}
|
||||
|
||||
@ -739,14 +727,13 @@
|
||||
- if (MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false;
|
||||
-
|
||||
this.getChunkFromChunkCoords(i, j).addEntity(p_72838_1_);
|
||||
- this.loadedEntityList.add(p_72838_1_);
|
||||
+ this.loadedEntityList_KC.add(p_72838_1_);
|
||||
this.loadedEntityList.add(p_72838_1_);
|
||||
this.onEntityAdded(p_72838_1_);
|
||||
+ net.minecraftforge.cauldron.CauldronHooks.logEntitySpawn(this, p_72838_1_, spawnReason);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1346,6 +1835,8 @@
|
||||
@@ -1346,6 +1831,8 @@
|
||||
{
|
||||
((IWorldAccess)this.worldAccesses.get(i)).onEntityCreate(p_72923_1_);
|
||||
}
|
||||
@ -755,7 +742,7 @@
|
||||
}
|
||||
|
||||
public void onEntityRemoved(Entity p_72847_1_)
|
||||
@@ -1354,6 +1845,8 @@
|
||||
@@ -1354,6 +1841,8 @@
|
||||
{
|
||||
((IWorldAccess)this.worldAccesses.get(i)).onEntityDestroy(p_72847_1_);
|
||||
}
|
||||
@ -764,16 +751,27 @@
|
||||
}
|
||||
|
||||
public void removeEntity(Entity p_72900_1_)
|
||||
@@ -1396,7 +1889,7 @@
|
||||
this.getChunkFromChunkCoords(i, j).removeEntity(p_72973_1_);
|
||||
@@ -1397,6 +1886,19 @@
|
||||
}
|
||||
|
||||
- this.loadedEntityList.remove(p_72973_1_);
|
||||
+ this.loadedEntityList_KC.remove(p_72973_1_);
|
||||
this.loadedEntityList.remove(p_72973_1_);
|
||||
+ // CraftBukkit start - Decrement loop variable field if we've already ticked this entity
|
||||
+ int index = this.loadedEntityList.indexOf(p_72973_1_);
|
||||
+
|
||||
+ if (index != -1)
|
||||
+ {
|
||||
+ if (index <= this.tickPosition)
|
||||
+ {
|
||||
+ this.tickPosition--;
|
||||
+ }
|
||||
+
|
||||
+ this.loadedEntityList.remove(index);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
this.onEntityRemoved(p_72973_1_);
|
||||
}
|
||||
|
||||
@@ -1408,40 +1901,58 @@
|
||||
@@ -1408,40 +1910,58 @@
|
||||
public List getCollidingBoundingBoxes(Entity p_72945_1_, AxisAlignedBB p_72945_2_)
|
||||
{
|
||||
this.collidingBoundingBoxes.clear();
|
||||
@ -846,7 +844,7 @@
|
||||
|
||||
for (int j2 = 0; j2 < list.size(); ++j2)
|
||||
{
|
||||
@@ -1797,11 +2308,22 @@
|
||||
@@ -1797,11 +2317,22 @@
|
||||
Entity entity;
|
||||
CrashReport crashreport;
|
||||
CrashReportCategory crashreportcategory;
|
||||
@ -869,60 +867,25 @@
|
||||
try
|
||||
{
|
||||
++entity.ticksExisted;
|
||||
@@ -1838,35 +2360,26 @@
|
||||
}
|
||||
}
|
||||
@@ -1862,10 +2393,14 @@
|
||||
|
||||
- this.theProfiler.endStartSection("remove");
|
||||
- this.loadedEntityList.removeAll(this.unloadedEntityList);
|
||||
- int j;
|
||||
- int l;
|
||||
+ this.theProfiler.endStartSection("regular");
|
||||
this.unloadedEntityList.clear();
|
||||
this.theProfiler.endStartSection("regular");
|
||||
+ org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||
+ timings.entityTick.startTiming(); // Spigot
|
||||
|
||||
- for (i = 0; i < this.unloadedEntityList.size(); ++i)
|
||||
- {
|
||||
- entity = (Entity)this.unloadedEntityList.get(i);
|
||||
- j = entity.chunkCoordX;
|
||||
- l = entity.chunkCoordZ;
|
||||
-
|
||||
- if (entity.addedToChunk && this.chunkExists(j, l))
|
||||
- {
|
||||
- this.getChunkFromChunkCoords(j, l).removeEntity(entity);
|
||||
+ Iterator<Entity> entityIterator = loadedEntityList_KC.iterator();
|
||||
+ for (entityLimiter.initTick(); entityIterator.hasNext() && entityLimiter.shouldContinue();) {
|
||||
+ entity = entityIterator.next();
|
||||
+
|
||||
+ if (entity.markedForRemoval || entity.isDead) {
|
||||
+ theProfiler.startSection("remove");
|
||||
+ int x = entity.chunkCoordX;
|
||||
+ int y = entity.chunkCoordZ;
|
||||
+ if (entity.addedToChunk && chunkExists(x, y))
|
||||
+ getChunkFromChunkCoords(x, y).removeEntity(entity);
|
||||
+ onEntityRemoved(entity);
|
||||
+ entityIterator.remove();
|
||||
+ theProfiler.endSection();
|
||||
+ continue;
|
||||
}
|
||||
- }
|
||||
|
||||
- for (i = 0; i < this.unloadedEntityList.size(); ++i)
|
||||
- {
|
||||
- this.onEntityRemoved((Entity)this.unloadedEntityList.get(i));
|
||||
- }
|
||||
-
|
||||
- this.unloadedEntityList.clear();
|
||||
- this.theProfiler.endStartSection("regular");
|
||||
-
|
||||
- for (i = 0; i < this.loadedEntityList.size(); ++i)
|
||||
- {
|
||||
- entity = (Entity)this.loadedEntityList.get(i);
|
||||
-
|
||||
+ int entitiesThisCycle = 0;
|
||||
+ if (tickPosition < 0) tickPosition = 0;
|
||||
+ for (entityLimiter.initTick(); entitiesThisCycle < loadedEntityList.size() && (entitiesThisCycle % 10 == 0 || entityLimiter.shouldContinue()); tickPosition++, entitiesThisCycle++) {
|
||||
+ tickPosition = (tickPosition < loadedEntityList.size()) ? tickPosition : 0;
|
||||
+ entity = (Entity)this.loadedEntityList.get(this.tickPosition);
|
||||
|
||||
if (entity.ridingEntity != null)
|
||||
{
|
||||
if (!entity.ridingEntity.isDead && entity.ridingEntity.riddenByEntity == entity)
|
||||
@@ -1884,7 +2397,9 @@
|
||||
@@ -1884,7 +2419,9 @@
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -932,27 +895,19 @@
|
||||
}
|
||||
catch (Throwable throwable1)
|
||||
{
|
||||
@@ -1905,41 +2420,56 @@
|
||||
@@ -1916,30 +2453,69 @@
|
||||
{
|
||||
this.getChunkFromChunkCoords(j, l).removeEntity(entity);
|
||||
}
|
||||
-
|
||||
- this.loadedEntityList.remove(i--);
|
||||
+ if (this.tickPosition < this.loadedEntityList.size()) // KCauldron
|
||||
+ this.loadedEntityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable
|
||||
+ else kcauldron.KLog.get().warning("Entity removal desync! " + entity); // KCauldron
|
||||
this.onEntityRemoved(entity);
|
||||
}
|
||||
|
||||
this.theProfiler.endSection();
|
||||
- this.theProfiler.startSection("remove");
|
||||
-
|
||||
- if (entity.isDead)
|
||||
- {
|
||||
- j = entity.chunkCoordX;
|
||||
- l = entity.chunkCoordZ;
|
||||
-
|
||||
- if (entity.addedToChunk && this.chunkExists(j, l))
|
||||
- {
|
||||
- this.getChunkFromChunkCoords(j, l).removeEntity(entity);
|
||||
- }
|
||||
-
|
||||
- this.loadedEntityList.remove(i--);
|
||||
- this.onEntityRemoved(entity);
|
||||
- }
|
||||
-
|
||||
- this.theProfiler.endSection();
|
||||
}
|
||||
|
||||
+ timings.entityTick.stopTiming(); // Spigot
|
||||
@ -960,44 +915,50 @@
|
||||
+ timings.tileEntityTick.startTiming(); // Spigot
|
||||
this.field_147481_N = true;
|
||||
- Iterator iterator = this.loadedTileEntityList.iterator();
|
||||
|
||||
-
|
||||
- while (iterator.hasNext())
|
||||
- {
|
||||
+ // CraftBukkit start - From below, clean up tile entities before ticking them
|
||||
+ if (!this.field_147483_b.isEmpty())
|
||||
{
|
||||
- TileEntity tileentity = (TileEntity)iterator.next();
|
||||
+ Iterator<TileEntity> tileEntityIterator = loadedTileEntityList_KC.iterator();
|
||||
+ for (tileLimiter.initTick(); tileEntityIterator.hasNext() && tileLimiter.shouldContinue();) {
|
||||
+ TileEntity tileentity = tileEntityIterator.next();
|
||||
+ for (Object tile : field_147483_b)
|
||||
+ {
|
||||
+ ((TileEntity) tile).onChunkUnload();
|
||||
+ }
|
||||
+ this.loadedTileEntityList.removeAll(this.field_147483_b);
|
||||
+ this.field_147483_b.clear();
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
|
||||
- if (!tileentity.isInvalid() && tileentity.hasWorldObj() && this.blockExists(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord))
|
||||
+ int tilesThisCycle = 0;
|
||||
+ for (tileLimiter.initTick(); tilesThisCycle < loadedTileEntityList.size() && (tilesThisCycle % 10 == 0 || tileLimiter.shouldContinue()); tileTickPosition++, tilesThisCycle++) {
|
||||
+ tileTickPosition = (tileTickPosition < loadedTileEntityList.size()) ? tileTickPosition : 0;
|
||||
+ TileEntity tileentity = (TileEntity) this.loadedTileEntityList.get(tileTickPosition);
|
||||
+
|
||||
+ // Spigot start
|
||||
+ if (tileentity == null)
|
||||
+ {
|
||||
{
|
||||
+ getServer().getLogger().severe("Cauldron has detected a null entity and has removed it, preventing a crash");
|
||||
+ tileEntityIterator.remove();
|
||||
+ tilesThisCycle--;
|
||||
+ this.loadedTileEntityList.remove(tileTickPosition--);
|
||||
+ continue;
|
||||
+ }
|
||||
+ // Spigot end
|
||||
+
|
||||
+ // KCauldron start
|
||||
+ if (tileentity.markedForRemoval) {
|
||||
+ tileentity.onChunkUnload();
|
||||
+ tileEntityIterator.remove();
|
||||
+ continue;
|
||||
+ }
|
||||
+ // KCauldron end
|
||||
+
|
||||
+ if (tileentity.isInvalid()) {
|
||||
+ tileEntityIterator.remove();
|
||||
+ tilesThisCycle--;
|
||||
+ this.loadedTileEntityList.remove(tileTickPosition--);
|
||||
+ if (this.chunkExists(tileentity.xCoord >> 4, tileentity.zCoord >> 4)) {
|
||||
+ Chunk chunk = this.getChunkFromChunkCoords(tileentity.xCoord >> 4, tileentity.zCoord >> 4);
|
||||
+ if (chunk != null) chunk.removeInvalidTileEntity(tileentity.xCoord & 15, tileentity.yCoord, tileentity.zCoord & 15);
|
||||
+ }
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
- if (!tileentity.isInvalid() && tileentity.hasWorldObj() && this.blockExists(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord))
|
||||
+
|
||||
+ if (tileentity.hasWorldObj() && CauldronHooks.canTileEntityTick(tileentity, this)
|
||||
+ && this.blockExists(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord))
|
||||
{
|
||||
+ {
|
||||
try
|
||||
{
|
||||
+ tileentity.tickTimer.startTiming(); // Spigot
|
||||
@ -1011,7 +972,7 @@
|
||||
crashreport = CrashReport.makeCrashReport(throwable, "Ticking block entity");
|
||||
crashreportcategory = crashreport.makeCategory("Block entity being ticked");
|
||||
tileentity.func_145828_a(crashreportcategory);
|
||||
@@ -1955,23 +2485,13 @@
|
||||
@@ -1955,23 +2531,13 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1031,16 +992,16 @@
|
||||
- }
|
||||
- }
|
||||
}
|
||||
+ this.field_147481_N = false;
|
||||
|
||||
+ timings.tileEntityTick.stopTiming(); // Spigot
|
||||
+ timings.tileEntityPending.startTiming(); // Spigot
|
||||
+ this.field_147481_N = false;
|
||||
+
|
||||
+ /* CraftBukkit start - Moved up
|
||||
if (!this.field_147483_b.isEmpty())
|
||||
{
|
||||
for (Object tile : field_147483_b)
|
||||
@@ -1981,6 +2501,7 @@
|
||||
@@ -1981,6 +2547,7 @@
|
||||
this.loadedTileEntityList.removeAll(this.field_147483_b);
|
||||
this.field_147483_b.clear();
|
||||
}
|
||||
@ -1048,19 +1009,7 @@
|
||||
|
||||
this.field_147481_N = false;
|
||||
|
||||
@@ -1994,9 +2515,9 @@
|
||||
|
||||
if (!tileentity1.isInvalid())
|
||||
{
|
||||
- if (!this.loadedTileEntityList.contains(tileentity1))
|
||||
+ if (!this.loadedTileEntityList_KC.contains(tileentity1))
|
||||
{
|
||||
- this.loadedTileEntityList.add(tileentity1);
|
||||
+ this.loadedTileEntityList_KC.add(tileentity1);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2016,17 +2537,23 @@
|
||||
@@ -2016,17 +2583,23 @@
|
||||
this.addedTileEntityList.clear();
|
||||
}
|
||||
|
||||
@ -1074,7 +1023,7 @@
|
||||
- List dest = field_147481_N ? addedTileEntityList : loadedTileEntityList;
|
||||
- for(TileEntity entity : (Collection<TileEntity>)p_147448_1_)
|
||||
+ // Cauldron start
|
||||
+ Collection dest = field_147481_N ? addedTileEntityList : loadedTileEntityList_KC; // List -> Collection for CB loadedTileEntityList type change
|
||||
+ Collection dest = field_147481_N ? addedTileEntityList : loadedTileEntityList; // List -> Collection for CB loadedTileEntityList type change
|
||||
+ for(Object entity : p_147448_1_)
|
||||
{
|
||||
- if(entity.canUpdate()) dest.add(entity);
|
||||
@ -1087,7 +1036,7 @@
|
||||
}
|
||||
|
||||
public void updateEntity(Entity p_72870_1_)
|
||||
@@ -2036,21 +2563,33 @@
|
||||
@@ -2036,21 +2609,33 @@
|
||||
|
||||
public void updateEntityWithOptionalForce(Entity p_72866_1_, boolean p_72866_2_)
|
||||
{
|
||||
@ -1122,7 +1071,7 @@
|
||||
p_72866_1_.lastTickPosX = p_72866_1_.posX;
|
||||
p_72866_1_.lastTickPosY = p_72866_1_.posY;
|
||||
p_72866_1_.lastTickPosZ = p_72866_1_.posZ;
|
||||
@@ -2134,6 +2673,7 @@
|
||||
@@ -2134,6 +2719,7 @@
|
||||
p_72866_1_.riddenByEntity = null;
|
||||
}
|
||||
}
|
||||
@ -1130,16 +1079,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2500,7 +3040,7 @@
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getDebugLoadedEntities()
|
||||
{
|
||||
- return "All: " + this.loadedEntityList.size();
|
||||
+ return "All: " + this.loadedEntityList_KC.size();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@@ -2570,7 +3110,7 @@
|
||||
@@ -2570,7 +3156,7 @@
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1148,35 +1088,7 @@
|
||||
{
|
||||
if (this.field_147481_N)
|
||||
{
|
||||
@@ -2591,7 +3131,7 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
- this.loadedTileEntityList.add(p_147455_4_);
|
||||
+ this.loadedTileEntityList_KC.add(p_147455_4_);
|
||||
}
|
||||
}
|
||||
Chunk chunk = this.getChunkFromChunkCoords(p_147455_1_ >> 4, p_147455_3_ >> 4);
|
||||
@@ -2612,7 +3152,7 @@
|
||||
|
||||
public void func_147457_a(TileEntity p_147457_1_)
|
||||
{
|
||||
- this.field_147483_b.add(p_147457_1_);
|
||||
+ p_147457_1_.markedForRemoval = true;
|
||||
}
|
||||
|
||||
public boolean func_147469_q(int p_147469_1_, int p_147469_2_, int p_147469_3_)
|
||||
@@ -2666,7 +3206,9 @@
|
||||
|
||||
public void tick()
|
||||
{
|
||||
+ timings.weatherUpdate.startTiming(); // KCauldron
|
||||
this.updateWeather();
|
||||
+ timings.weatherUpdate.stopTiming(); // KCauldron
|
||||
}
|
||||
|
||||
private void calculateInitialWeather()
|
||||
@@ -2718,7 +3260,15 @@
|
||||
@@ -2718,7 +3304,15 @@
|
||||
|
||||
if (i <= 0)
|
||||
{
|
||||
@ -1193,7 +1105,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2754,7 +3304,15 @@
|
||||
@@ -2754,7 +3348,15 @@
|
||||
|
||||
if (j <= 0)
|
||||
{
|
||||
@ -1210,7 +1122,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2777,8 +3335,41 @@
|
||||
@@ -2777,8 +3379,41 @@
|
||||
protected void setActivePlayerChunksAndCheckLight()
|
||||
{
|
||||
this.activeChunkSet.clear();
|
||||
@ -1253,7 +1165,7 @@
|
||||
int i;
|
||||
EntityPlayer entityplayer;
|
||||
int j;
|
||||
@@ -2788,17 +3379,28 @@
|
||||
@@ -2788,17 +3423,28 @@
|
||||
for (i = 0; i < this.playerEntities.size(); ++i)
|
||||
{
|
||||
entityplayer = (EntityPlayer)this.playerEntities.get(i);
|
||||
@ -1288,7 +1200,7 @@
|
||||
}
|
||||
|
||||
this.theProfiler.endSection();
|
||||
@@ -2810,7 +3412,7 @@
|
||||
@@ -2810,7 +3456,7 @@
|
||||
|
||||
this.theProfiler.startSection("playerCheckLight");
|
||||
|
||||
@ -1297,20 +1209,16 @@
|
||||
{
|
||||
i = this.rand.nextInt(this.playerEntities.size());
|
||||
entityplayer = (EntityPlayer)this.playerEntities.get(i);
|
||||
@@ -3280,12 +3882,23 @@
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
- for (int j = 0; j < this.loadedEntityList.size(); ++j)
|
||||
+ for (Entity entity : loadedEntityList_KC)
|
||||
@@ -3284,8 +3930,21 @@
|
||||
{
|
||||
- Entity entity = (Entity)this.loadedEntityList.get(j);
|
||||
+ // CraftBukkit start - Split out persistent check, don't apply it to special persistent mobs
|
||||
+ if (entity instanceof EntityLiving)
|
||||
+ {
|
||||
+ EntityLiving entityliving = (EntityLiving) entity;
|
||||
Entity entity = (Entity)this.loadedEntityList.get(j);
|
||||
|
||||
- if ((!(entity instanceof EntityLiving) || !((EntityLiving)entity).isNoDespawnRequired()) && p_72907_1_.isAssignableFrom(entity.getClass()))
|
||||
+ // CraftBukkit start - Split out persistent check, don't apply it to special persistent mobs
|
||||
+ if (entity instanceof EntityLiving)
|
||||
{
|
||||
+ EntityLiving entityliving = (EntityLiving) entity;
|
||||
+
|
||||
+ if (entityliving.canDespawn_CB() && entityliving.isNoDespawnRequired())
|
||||
+ {
|
||||
+ continue;
|
||||
@ -1318,34 +1226,21 @@
|
||||
+ }
|
||||
+
|
||||
+ if (p_72907_1_.isAssignableFrom(entity.getClass()))
|
||||
{
|
||||
+ {
|
||||
+ // if ((!(entity instanceof EntityLiving) || !((EntityLiving)entity).isNoDespawnRequired()) && p_72907_1_.isAssignableFrom(entity.getClass()))
|
||||
+ // CraftBukkit end
|
||||
++i;
|
||||
}
|
||||
}
|
||||
@@ -3298,9 +3911,10 @@
|
||||
@@ -3298,6 +3957,7 @@
|
||||
for (int i = 0; i < p_72868_1_.size(); ++i)
|
||||
{
|
||||
Entity entity = (Entity)p_72868_1_.get(i);
|
||||
+ if (!entity.entityAllowedToSpawn()) continue;
|
||||
if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(entity, this)))
|
||||
{
|
||||
- loadedEntityList.add(entity);
|
||||
+ loadedEntityList_KC.add(entity);
|
||||
this.onEntityAdded(entity);
|
||||
}
|
||||
}
|
||||
@@ -3308,14 +3922,25 @@
|
||||
|
||||
public void unloadEntities(List p_72828_1_)
|
||||
{
|
||||
- this.unloadedEntityList.addAll(p_72828_1_);
|
||||
+ for (Object o : p_72828_1_) {
|
||||
+ ((Entity)o).markedForRemoval = true;
|
||||
+ }
|
||||
}
|
||||
|
||||
loadedEntityList.add(entity);
|
||||
@@ -3314,8 +3974,17 @@
|
||||
public boolean canPlaceEntityOnSide(Block p_147472_1_, int p_147472_2_, int p_147472_3_, int p_147472_4_, boolean p_147472_5_, int p_147472_6_, Entity p_147472_7_, ItemStack p_147472_8_)
|
||||
{
|
||||
Block block1 = this.getBlock(p_147472_2_, p_147472_3_, p_147472_4_);
|
||||
@ -1364,7 +1259,7 @@
|
||||
}
|
||||
|
||||
public PathEntity getPathEntityToEntity(Entity p_72865_1_, Entity p_72865_2_, float p_72865_3_, boolean p_72865_4_, boolean p_72865_5_, boolean p_72865_6_, boolean p_72865_7_)
|
||||
@@ -3464,6 +4089,12 @@
|
||||
@@ -3464,6 +4133,12 @@
|
||||
for (int i = 0; i < this.playerEntities.size(); ++i)
|
||||
{
|
||||
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
|
||||
@ -1377,7 +1272,7 @@
|
||||
double d5 = entityplayer1.getDistanceSq(p_72977_1_, p_72977_3_, p_72977_5_);
|
||||
|
||||
if ((p_72977_7_ < 0.0D || d5 < p_72977_7_ * p_72977_7_) && (d4 == -1.0D || d5 < d4))
|
||||
@@ -3489,7 +4120,12 @@
|
||||
@@ -3489,7 +4164,12 @@
|
||||
for (int i = 0; i < this.playerEntities.size(); ++i)
|
||||
{
|
||||
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
|
||||
@ -1391,21 +1286,7 @@
|
||||
if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive())
|
||||
{
|
||||
double d5 = entityplayer1.getDistanceSq(p_72846_1_, p_72846_3_, p_72846_5_);
|
||||
@@ -3612,11 +4248,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
- if (!this.loadedEntityList.contains(p_72897_1_))
|
||||
+ if (!this.loadedEntityList_KC.contains(p_72897_1_))
|
||||
{
|
||||
if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(p_72897_1_, this)))
|
||||
{
|
||||
- this.loadedEntityList.add(p_72897_1_);
|
||||
+ this.loadedEntityList_KC.add(p_72897_1_);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3660,6 +4296,18 @@
|
||||
@@ -3660,6 +4340,18 @@
|
||||
|
||||
public void updateAllPlayersSleepingFlag() {}
|
||||
|
||||
@ -1424,29 +1305,18 @@
|
||||
public float getWeightedThunderStrength(float p_72819_1_)
|
||||
{
|
||||
return (this.prevThunderingStrength + (this.thunderingStrength - this.prevThunderingStrength) * p_72819_1_) * this.getRainStrength(p_72819_1_);
|
||||
@@ -3932,8 +4580,8 @@
|
||||
@@ -3932,8 +4624,8 @@
|
||||
*/
|
||||
public void addTileEntity(TileEntity entity)
|
||||
{
|
||||
- List dest = field_147481_N ? addedTileEntityList : loadedTileEntityList;
|
||||
- if(entity.canUpdate())
|
||||
+ Collection dest = field_147481_N ? addedTileEntityList : loadedTileEntityList_KC; // Cauldron - List -> Collection for CB loadedTileEntityList type change
|
||||
+ Collection dest = field_147481_N ? addedTileEntityList : loadedTileEntityList; // Cauldron - List -> Collection for CB loadedTileEntityList type change
|
||||
+ if (CauldronHooks.canUpdate(entity))
|
||||
{
|
||||
dest.add(entity);
|
||||
}
|
||||
@@ -4020,13 +4668,82 @@
|
||||
public int countEntities(EnumCreatureType type, boolean forSpawnCount)
|
||||
{
|
||||
int count = 0;
|
||||
- for (int x = 0; x < loadedEntityList.size(); x++)
|
||||
+ for (Entity entity : loadedEntityList_KC)
|
||||
{
|
||||
- if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount))
|
||||
+ if (entity.isCreatureType(type, forSpawnCount))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
@@ -4029,4 +4721,73 @@
|
||||
}
|
||||
return count;
|
||||
}
|
||||
@ -1464,7 +1334,7 @@
|
||||
+
|
||||
+ public boolean isActiveChunk(int x, int z)
|
||||
+ {
|
||||
+ return activeChunkSet_CB.containsKey(chunkToKey(x, z)) || getPersistentChunks().containsKey(new ChunkCoordIntPair(x, z));
|
||||
+ return getPersistentChunks().containsKey(new ChunkCoordIntPair(x, z)) || activeChunkSet_CB.containsKey(chunkToKey(x, z));
|
||||
+ }
|
||||
+
|
||||
+ public boolean isActiveChunk(long key)
|
||||
|
@ -69,22 +69,12 @@
|
||||
this.mcServer = p_i45284_1_;
|
||||
this.theEntityTracker = new EntityTracker(this);
|
||||
this.thePlayerManager = new PlayerManager(this);
|
||||
@@ -106,7 +129,7 @@
|
||||
|
||||
if (this.pendingTickListEntriesHashSet == null)
|
||||
{
|
||||
- this.pendingTickListEntriesHashSet = new HashSet();
|
||||
+ this.pendingTickListEntriesHashSet = com.google.common.collect.Sets.newConcurrentHashSet();
|
||||
}
|
||||
|
||||
if (this.pendingTickListEntriesTreeSet == null)
|
||||
@@ -124,6 +147,48 @@
|
||||
@@ -124,6 +147,47 @@
|
||||
this.mapStorage.setData("scoreboard", scoreboardsavedata);
|
||||
}
|
||||
|
||||
+ scoreboardsavedata.func_96499_a(this.worldScoreboard);
|
||||
+ ((ServerScoreboard) this.worldScoreboard).func_96547_a(scoreboardsavedata);
|
||||
+ DimensionManager.setWorld(p_i45284_4_, this);
|
||||
+ }
|
||||
+
|
||||
+ // Add env and gen to constructor
|
||||
@ -106,7 +96,7 @@
|
||||
+
|
||||
+ if (this.pendingTickListEntriesHashSet == null)
|
||||
+ {
|
||||
+ this.pendingTickListEntriesHashSet = com.google.common.collect.Sets.newConcurrentHashSet();
|
||||
+ this.pendingTickListEntriesHashSet = new HashSet();
|
||||
+ }
|
||||
+
|
||||
+ if (this.pendingTickListEntriesTreeSet == null)
|
||||
@ -127,7 +117,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 +197,31 @@
|
||||
@@ -132,6 +196,31 @@
|
||||
DimensionManager.setWorld(p_i45284_4_, this);
|
||||
}
|
||||
|
||||
@ -159,17 +149,7 @@
|
||||
public void tick()
|
||||
{
|
||||
super.tick();
|
||||
@@ -141,7 +231,9 @@
|
||||
this.difficultySetting = EnumDifficulty.HARD;
|
||||
}
|
||||
|
||||
+ timings.cleanupCache.startTiming(); // KCauldron
|
||||
this.provider.worldChunkMgr.cleanupCache();
|
||||
+ timings.cleanupCache.stopTiming(); // KCauldron
|
||||
|
||||
if (this.areAllPlayersAsleep())
|
||||
{
|
||||
@@ -155,12 +247,19 @@
|
||||
@@ -155,12 +244,19 @@
|
||||
}
|
||||
|
||||
this.theProfiler.startSection("mobSpawner");
|
||||
@ -192,7 +172,7 @@
|
||||
this.theProfiler.endStartSection("chunkSource");
|
||||
this.chunkProvider.unloadQueuedChunks();
|
||||
int j = this.calculateSkylightSubtracted(1.0F);
|
||||
@@ -170,30 +269,47 @@
|
||||
@@ -170,30 +266,47 @@
|
||||
this.skylightSubtracted = j;
|
||||
}
|
||||
|
||||
@ -241,7 +221,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 +325,7 @@
|
||||
{
|
||||
EntityPlayer entityplayer = (EntityPlayer)iterator.next();
|
||||
|
||||
@ -250,7 +230,7 @@
|
||||
{
|
||||
this.allPlayersSleeping = false;
|
||||
break;
|
||||
@@ -240,7 +356,25 @@
|
||||
@@ -240,7 +353,25 @@
|
||||
|
||||
private void resetRainAndThunder()
|
||||
{
|
||||
@ -277,7 +257,7 @@
|
||||
}
|
||||
|
||||
public boolean areAllPlayersAsleep()
|
||||
@@ -248,19 +382,26 @@
|
||||
@@ -248,19 +379,26 @@
|
||||
if (this.allPlayersSleeping && !this.isRemote)
|
||||
{
|
||||
Iterator iterator = this.playerEntities.iterator();
|
||||
@ -307,7 +287,7 @@
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -302,15 +443,29 @@
|
||||
@@ -302,15 +440,29 @@
|
||||
super.func_147456_g();
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
@ -343,7 +323,7 @@
|
||||
this.func_147467_a(k, l, chunk);
|
||||
this.theProfiler.endStartSection("tickChunk");
|
||||
chunk.func_150804_b(false);
|
||||
@@ -346,12 +501,32 @@
|
||||
@@ -346,12 +498,32 @@
|
||||
|
||||
if (this.isBlockFreezableNaturally(j1 + k, l1 - 1, k1 + l))
|
||||
{
|
||||
@ -378,7 +358,7 @@
|
||||
}
|
||||
|
||||
if (this.isRaining())
|
||||
@@ -388,6 +563,7 @@
|
||||
@@ -388,6 +560,7 @@
|
||||
if (block.getTickRandomly())
|
||||
{
|
||||
++i;
|
||||
@ -386,7 +366,7 @@
|
||||
block.updateTick(this, j2 + k, l2 + extendedblockstorage.getYLocation(), k2 + l, this.rand);
|
||||
}
|
||||
}
|
||||
@@ -396,6 +572,13 @@
|
||||
@@ -396,6 +569,13 @@
|
||||
|
||||
this.theProfiler.endSection();
|
||||
}
|
||||
@ -400,23 +380,7 @@
|
||||
}
|
||||
|
||||
public boolean isBlockTickScheduledThisTick(int p_147477_1_, int p_147477_2_, int p_147477_3_, Block p_147477_4_)
|
||||
@@ -450,7 +633,7 @@
|
||||
if (!this.pendingTickListEntriesHashSet.contains(nextticklistentry))
|
||||
{
|
||||
this.pendingTickListEntriesHashSet.add(nextticklistentry);
|
||||
- this.pendingTickListEntriesTreeSet.add(nextticklistentry);
|
||||
+ //this.pendingTickListEntriesTreeSet.add(nextticklistentry); // KCauldron
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -468,13 +651,13 @@
|
||||
if (!this.pendingTickListEntriesHashSet.contains(nextticklistentry))
|
||||
{
|
||||
this.pendingTickListEntriesHashSet.add(nextticklistentry);
|
||||
- this.pendingTickListEntriesTreeSet.add(nextticklistentry);
|
||||
+ //this.pendingTickListEntriesTreeSet.add(nextticklistentry); // KCauldron
|
||||
}
|
||||
}
|
||||
@@ -474,7 +654,7 @@
|
||||
|
||||
public void updateEntities()
|
||||
{
|
||||
@ -425,19 +389,7 @@
|
||||
{
|
||||
if (this.updateEntityTick++ >= 1200)
|
||||
{
|
||||
@@ -496,9 +679,9 @@
|
||||
|
||||
public boolean tickUpdates(boolean p_72955_1_)
|
||||
{
|
||||
- int i = this.pendingTickListEntriesTreeSet.size();
|
||||
+ int i = this.pendingTickListEntriesHashSet.size();
|
||||
|
||||
- if (i != this.pendingTickListEntriesHashSet.size())
|
||||
+ if (false) // KCauldron
|
||||
{
|
||||
throw new IllegalStateException("TickNextTick list out of synch");
|
||||
}
|
||||
@@ -506,22 +689,31 @@
|
||||
@@ -506,7 +686,16 @@
|
||||
{
|
||||
if (i > 1000)
|
||||
{
|
||||
@ -455,43 +407,7 @@
|
||||
}
|
||||
|
||||
this.theProfiler.startSection("cleaning");
|
||||
NextTickListEntry nextticklistentry;
|
||||
|
||||
- for (int j = 0; j < i; ++j)
|
||||
+ for (Iterator iter = pendingTickListEntriesHashSet.iterator(); i >= 0 && iter.hasNext(); i--)
|
||||
{
|
||||
- nextticklistentry = (NextTickListEntry)this.pendingTickListEntriesTreeSet.first();
|
||||
+ nextticklistentry = (NextTickListEntry) iter.next();
|
||||
|
||||
if (!p_72955_1_ && nextticklistentry.scheduledTime > this.worldInfo.getWorldTotalTime())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
- this.pendingTickListEntriesTreeSet.remove(nextticklistentry);
|
||||
+ //this.pendingTickListEntriesTreeSet.remove(nextticklistentry); // KCauldron
|
||||
this.pendingTickListEntriesHashSet.remove(nextticklistentry);
|
||||
this.pendingTickListEntriesThisTick.add(nextticklistentry);
|
||||
}
|
||||
@@ -577,7 +769,7 @@
|
||||
|
||||
this.theProfiler.endSection();
|
||||
this.pendingTickListEntriesThisTick.clear();
|
||||
- return !this.pendingTickListEntriesTreeSet.isEmpty();
|
||||
+ return !this.pendingTickListEntriesHashSet.isEmpty();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +788,7 @@
|
||||
|
||||
if (i1 == 0)
|
||||
{
|
||||
- iterator = this.pendingTickListEntriesTreeSet.iterator();
|
||||
+ iterator = this.pendingTickListEntriesHashSet.iterator();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -651,7 +843,37 @@
|
||||
@@ -651,7 +840,37 @@
|
||||
protected IChunkProvider createChunkProvider()
|
||||
{
|
||||
IChunkLoader ichunkloader = this.saveHandler.getChunkLoader(this.provider);
|
||||
@ -530,7 +446,7 @@
|
||||
return this.theChunkProviderServer;
|
||||
}
|
||||
|
||||
@@ -659,29 +881,31 @@
|
||||
@@ -659,29 +878,31 @@
|
||||
{
|
||||
ArrayList arraylist = new ArrayList();
|
||||
|
||||
@ -577,16 +493,7 @@
|
||||
return arraylist;
|
||||
}
|
||||
|
||||
@@ -704,7 +928,7 @@
|
||||
|
||||
if (this.pendingTickListEntriesHashSet == null)
|
||||
{
|
||||
- this.pendingTickListEntriesHashSet = new HashSet();
|
||||
+ this.pendingTickListEntriesHashSet = com.google.common.collect.Sets.newConcurrentHashSet();
|
||||
}
|
||||
|
||||
if (this.pendingTickListEntriesTreeSet == null)
|
||||
@@ -733,7 +957,28 @@
|
||||
@@ -733,7 +954,28 @@
|
||||
int i = 0;
|
||||
int j = this.provider.getAverageGroundLevel();
|
||||
int k = 0;
|
||||
@ -615,7 +522,7 @@
|
||||
if (chunkposition != null)
|
||||
{
|
||||
i = chunkposition.chunkPosX;
|
||||
@@ -876,6 +1121,20 @@
|
||||
@@ -876,6 +1118,20 @@
|
||||
|
||||
public boolean addWeatherEffect(Entity p_72942_1_)
|
||||
{
|
||||
@ -636,7 +543,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,23 @@
|
||||
@@ -894,13 +1150,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_)
|
||||
{
|
||||
@ -661,7 +568,7 @@
|
||||
if (!p_72885_10_)
|
||||
{
|
||||
explosion.affectedBlockPositions.clear();
|
||||
@@ -977,7 +1246,7 @@
|
||||
@@ -977,7 +1243,7 @@
|
||||
{
|
||||
boolean flag = this.isRaining();
|
||||
super.updateWeather();
|
||||
@ -670,7 +577,7 @@
|
||||
if (this.prevRainingStrength != this.rainingStrength)
|
||||
{
|
||||
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(7, this.rainingStrength), this.provider.dimensionId);
|
||||
@@ -988,10 +1257,6 @@
|
||||
@@ -988,10 +1254,6 @@
|
||||
this.mcServer.getConfigurationManager().sendPacketToAllPlayersInDimension(new S2BPacketChangeGameState(8, this.thunderingStrength), this.provider.dimensionId);
|
||||
}
|
||||
|
||||
@ -681,7 +588,7 @@
|
||||
if (flag != this.isRaining())
|
||||
{
|
||||
if (flag)
|
||||
@@ -1006,6 +1271,33 @@
|
||||
@@ -1006,6 +1268,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);
|
||||
}
|
||||
@ -715,7 +622,7 @@
|
||||
}
|
||||
|
||||
protected int func_152379_p()
|
||||
@@ -1069,4 +1361,51 @@
|
||||
@@ -1069,4 +1358,51 @@
|
||||
this();
|
||||
}
|
||||
}
|
||||
|
@ -1,33 +0,0 @@
|
||||
--- ../src-base/minecraft/net/minecraft/world/chunk/storage/RegionFile.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/chunk/storage/RegionFile.java
|
||||
@@ -43,7 +43,8 @@
|
||||
|
||||
if (this.dataFile.length() < 4096L)
|
||||
{
|
||||
- for (i = 0; i < 1024; ++i)
|
||||
+ // KCauldron start
|
||||
+ /*for (i = 0; i < 1024; ++i)
|
||||
{
|
||||
this.dataFile.writeInt(0);
|
||||
}
|
||||
@@ -51,7 +52,10 @@
|
||||
for (i = 0; i < 1024; ++i)
|
||||
{
|
||||
this.dataFile.writeInt(0);
|
||||
- }
|
||||
+ }*/
|
||||
+ dataFile.write(emptySector);
|
||||
+ dataFile.write(emptySector);
|
||||
+ // KCauldron end
|
||||
|
||||
this.sizeDelta += 8192;
|
||||
}
|
||||
@@ -209,7 +213,7 @@
|
||||
|
||||
public DataOutputStream getChunkDataOutputStream(int p_76710_1_, int p_76710_2_)
|
||||
{
|
||||
- return this.outOfBounds(p_76710_1_, p_76710_2_) ? null : new DataOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(p_76710_1_, p_76710_2_)));
|
||||
+ return this.outOfBounds(p_76710_1_, p_76710_2_) ? null : new DataOutputStream(new java.io.BufferedOutputStream(new DeflaterOutputStream(new RegionFile.ChunkBuffer(p_76710_1_, p_76710_2_)))); // KCauldron
|
||||
}
|
||||
|
||||
protected synchronized void write(int p_76706_1_, int p_76706_2_, byte[] p_76706_3_, int p_76706_4_)
|
@ -250,9 +250,9 @@
|
||||
+ Chunk chunk = (Chunk) this.loadedChunkHashMap_KC.get(LongHash.toLong(p_73154_1_, p_73154_2_));
|
||||
+ chunk = chunk == null ? (shouldLoadChunk() ? this.loadChunk(p_73154_1_, p_73154_2_) : this.defaultEmptyChunk) : chunk; // Cauldron handle forge server tick events and load the chunk within 5 seconds of the world being loaded (for chunk loaders)
|
||||
+
|
||||
+ if (chunk == defaultEmptyChunk || chunk == null)
|
||||
+ if (chunk == this.defaultEmptyChunk)
|
||||
+ {
|
||||
+ return defaultEmptyChunk;
|
||||
+ return chunk;
|
||||
+ }
|
||||
+
|
||||
+ if ((p_73154_1_ != chunk.xPosition || p_73154_2_ != chunk.zPosition) && !worldObj.isProfilingWorld())
|
||||
|
@ -15,12 +15,10 @@
|
||||
public class MapData extends WorldSavedData
|
||||
{
|
||||
public int xCenter;
|
||||
@@ -23,12 +31,22 @@
|
||||
public byte[] colors = new byte[16384];
|
||||
@@ -24,11 +32,21 @@
|
||||
public List playersArrayList = new ArrayList();
|
||||
private Map playersHashMap = new HashMap();
|
||||
- public Map playersVisibleOnMap = new LinkedHashMap();
|
||||
+ public Map<UUID, MapData.MapCoord> playersVisibleOnMap = new LinkedHashMap();
|
||||
public Map playersVisibleOnMap = new LinkedHashMap();
|
||||
+
|
||||
+ // CraftBukkit start
|
||||
+ public final CraftMapView mapView;
|
||||
@ -39,7 +37,7 @@
|
||||
}
|
||||
|
||||
public void readFromNBT(NBTTagCompound p_76184_1_)
|
||||
@@ -107,14 +125,14 @@
|
||||
@@ -107,7 +125,7 @@
|
||||
{
|
||||
if (!this.playersHashMap.containsKey(p_76191_1_))
|
||||
{
|
||||
@ -48,41 +46,6 @@
|
||||
this.playersHashMap.put(p_76191_1_, mapinfo);
|
||||
this.playersArrayList.add(mapinfo);
|
||||
}
|
||||
|
||||
if (!p_76191_1_.inventory.hasItemStack(p_76191_2_))
|
||||
{
|
||||
- this.playersVisibleOnMap.remove(p_76191_1_.getCommandSenderName());
|
||||
+ this.playersVisibleOnMap.remove(p_76191_1_.getUniqueID());
|
||||
}
|
||||
|
||||
for (int i = 0; i < this.playersArrayList.size(); ++i)
|
||||
@@ -166,7 +184,7 @@
|
||||
{
|
||||
if (Math.abs(f) >= 320.0F || Math.abs(f1) >= 320.0F)
|
||||
{
|
||||
- this.playersVisibleOnMap.remove(p_82567_3_);
|
||||
+ this.playersVisibleOnMap.remove(java.util.UUID.nameUUIDFromBytes(p_82567_3_.getBytes(org.apache.commons.codec.Charsets.US_ASCII)));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -194,7 +212,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- this.playersVisibleOnMap.put(p_82567_3_, new MapData.MapCoord((byte)p_82567_1_, b0, b1, b2));
|
||||
+ this.playersVisibleOnMap.put(java.util.UUID.nameUUIDFromBytes(p_82567_3_.getBytes(org.apache.commons.codec.Charsets.US_ASCII)), new MapData.MapCoord((byte)p_82567_1_, b0, b1, b2));
|
||||
}
|
||||
|
||||
public byte[] getUpdatePacketData(ItemStack p_76193_1_, World p_76193_2_, EntityPlayer p_76193_3_)
|
||||
@@ -250,7 +268,7 @@
|
||||
byte b3 = p_76192_1_[i * 3 + 2];
|
||||
byte b0 = p_76192_1_[i * 3 + 3];
|
||||
byte b1 = (byte)(p_76192_1_[i * 3 + 1] & 15);
|
||||
- this.playersVisibleOnMap.put("icon-" + i, new MapData.MapCoord(b2, b3, b0, b1));
|
||||
+ this.playersVisibleOnMap.put(java.util.UUID.nameUUIDFromBytes(("icon-" + i).getBytes(org.apache.commons.codec.Charsets.US_ASCII)), new MapData.MapCoord(b2, b3, b0, b1));
|
||||
}
|
||||
}
|
||||
else if (p_76192_1_[0] == 2)
|
||||
@@ -265,7 +283,7 @@
|
||||
|
||||
if (mapinfo == null)
|
||||
|
@ -1,19 +0,0 @@
|
||||
--- ../src-base/minecraft/net/minecraft/world/storage/ThreadedFileIOBase.java
|
||||
+++ ../src-work/minecraft/net/minecraft/world/storage/ThreadedFileIOBase.java
|
||||
@@ -39,14 +39,14 @@
|
||||
++this.savedIOCounter;
|
||||
}
|
||||
|
||||
- try
|
||||
+ /*try // KCauldron start
|
||||
{
|
||||
Thread.sleep(this.isThreadWaiting ? 0L : 10L);
|
||||
}
|
||||
catch (InterruptedException interruptedexception1)
|
||||
{
|
||||
interruptedexception1.printStackTrace();
|
||||
- }
|
||||
+ }*/ // KCauldron end
|
||||
}
|
||||
|
||||
if (this.threadedIOQueue.isEmpty())
|
Reference in New Issue
Block a user