forked from xjboss/KCauldronX
Transparent unloading {,tile}entities from world
This commit is contained in:
parent
1488e0fdc4
commit
4a63dcacca
Binary file not shown.
@ -80,7 +80,7 @@
|
|||||||
private static final String __OBFID = "CL_00001533";
|
private static final String __OBFID = "CL_00001533";
|
||||||
/** Forge: Used to store custom data for each entity. */
|
/** Forge: Used to store custom data for each entity. */
|
||||||
private NBTTagCompound customEntityData;
|
private NBTTagCompound customEntityData;
|
||||||
@@ -135,7 +175,16 @@
|
@@ -135,7 +175,17 @@
|
||||||
public ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
|
public ArrayList<EntityItem> capturedDrops = new ArrayList<EntityItem>();
|
||||||
private UUID persistentID;
|
private UUID persistentID;
|
||||||
|
|
||||||
@ -94,10 +94,11 @@
|
|||||||
+ // Spigot end
|
+ // Spigot end
|
||||||
protected HashMap<String, IExtendedEntityProperties> extendedProperties;
|
protected HashMap<String, IExtendedEntityProperties> extendedProperties;
|
||||||
+ public String spawnReason; // Cauldron - used to handle CraftBukkit's SpawnReason with CustomSpawners
|
+ public String spawnReason; // Cauldron - used to handle CraftBukkit's SpawnReason with CustomSpawners
|
||||||
|
+ public boolean markedForRemoval = false;
|
||||||
|
|
||||||
public int getEntityId()
|
public int getEntityId()
|
||||||
{
|
{
|
||||||
@@ -159,7 +208,7 @@
|
@@ -159,7 +209,7 @@
|
||||||
this.rand = new Random();
|
this.rand = new Random();
|
||||||
this.fireResistance = 1;
|
this.fireResistance = 1;
|
||||||
this.firstUpdate = true;
|
this.firstUpdate = true;
|
||||||
@ -106,7 +107,7 @@
|
|||||||
this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
|
this.myEntitySize = Entity.EnumEntitySize.SIZE_2;
|
||||||
this.worldObj = p_i1582_1_;
|
this.worldObj = p_i1582_1_;
|
||||||
this.setPosition(0.0D, 0.0D, 0.0D);
|
this.setPosition(0.0D, 0.0D, 0.0D);
|
||||||
@@ -167,8 +216,15 @@
|
@@ -167,8 +217,15 @@
|
||||||
if (p_i1582_1_ != null)
|
if (p_i1582_1_ != null)
|
||||||
{
|
{
|
||||||
this.dimension = p_i1582_1_.provider.dimensionId;
|
this.dimension = p_i1582_1_.provider.dimensionId;
|
||||||
@ -122,7 +123,7 @@
|
|||||||
this.dataWatcher = new DataWatcher(this);
|
this.dataWatcher = new DataWatcher(this);
|
||||||
this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
|
this.dataWatcher.addObject(0, Byte.valueOf((byte)0));
|
||||||
this.dataWatcher.addObject(1, Short.valueOf((short)300));
|
this.dataWatcher.addObject(1, Short.valueOf((short)300));
|
||||||
@@ -277,6 +333,41 @@
|
@@ -277,6 +334,41 @@
|
||||||
|
|
||||||
protected void setRotation(float p_70101_1_, float p_70101_2_)
|
protected void setRotation(float p_70101_1_, float p_70101_2_)
|
||||||
{
|
{
|
||||||
@ -164,7 +165,7 @@
|
|||||||
this.rotationYaw = p_70101_1_ % 360.0F;
|
this.rotationYaw = p_70101_1_ % 360.0F;
|
||||||
this.rotationPitch = p_70101_2_ % 360.0F;
|
this.rotationPitch = p_70101_2_ % 360.0F;
|
||||||
}
|
}
|
||||||
@@ -343,7 +434,7 @@
|
@@ -343,7 +435,7 @@
|
||||||
|
|
||||||
if (this.inPortal)
|
if (this.inPortal)
|
||||||
{
|
{
|
||||||
@ -173,7 +174,7 @@
|
|||||||
{
|
{
|
||||||
if (this.ridingEntity == null && this.portalCounter++ >= i)
|
if (this.ridingEntity == null && this.portalCounter++ >= i)
|
||||||
{
|
{
|
||||||
@@ -457,7 +548,35 @@
|
@@ -457,7 +549,35 @@
|
||||||
{
|
{
|
||||||
if (!this.isImmuneToFire)
|
if (!this.isImmuneToFire)
|
||||||
{
|
{
|
||||||
@ -210,7 +211,7 @@
|
|||||||
this.setFire(15);
|
this.setFire(15);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -492,6 +611,30 @@
|
@@ -492,6 +612,30 @@
|
||||||
|
|
||||||
public void moveEntity(double p_70091_1_, double p_70091_3_, double p_70091_5_)
|
public void moveEntity(double p_70091_1_, double p_70091_3_, double p_70091_5_)
|
||||||
{
|
{
|
||||||
@ -241,7 +242,7 @@
|
|||||||
if (this.noClip)
|
if (this.noClip)
|
||||||
{
|
{
|
||||||
this.boundingBox.offset(p_70091_1_, p_70091_3_, p_70091_5_);
|
this.boundingBox.offset(p_70091_1_, p_70091_3_, p_70091_5_);
|
||||||
@@ -756,6 +899,34 @@
|
@@ -756,6 +900,34 @@
|
||||||
d10 = this.posY - d4;
|
d10 = this.posY - d4;
|
||||||
d11 = this.posZ - d5;
|
d11 = this.posZ - d5;
|
||||||
|
|
||||||
@ -276,7 +277,7 @@
|
|||||||
if (this.canTriggerWalking() && !flag && this.ridingEntity == null)
|
if (this.canTriggerWalking() && !flag && this.ridingEntity == null)
|
||||||
{
|
{
|
||||||
int j1 = MathHelper.floor_double(this.posX);
|
int j1 = MathHelper.floor_double(this.posX);
|
||||||
@@ -798,6 +969,8 @@
|
@@ -798,6 +970,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,7 +286,7 @@
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.func_145775_I();
|
this.func_145775_I();
|
||||||
@@ -809,7 +982,8 @@
|
@@ -809,7 +983,8 @@
|
||||||
this.addEntityCrashInfo(crashreportcategory);
|
this.addEntityCrashInfo(crashreportcategory);
|
||||||
throw new ReportedException(crashreport);
|
throw new ReportedException(crashreport);
|
||||||
}
|
}
|
||||||
@ -295,7 +296,7 @@
|
|||||||
boolean flag2 = this.isWet();
|
boolean flag2 = this.isWet();
|
||||||
|
|
||||||
if (this.worldObj.func_147470_e(this.boundingBox.contract(0.001D, 0.001D, 0.001D)))
|
if (this.worldObj.func_147470_e(this.boundingBox.contract(0.001D, 0.001D, 0.001D)))
|
||||||
@@ -820,8 +994,20 @@
|
@@ -820,8 +995,20 @@
|
||||||
{
|
{
|
||||||
++this.fire;
|
++this.fire;
|
||||||
|
|
||||||
@ -317,7 +318,7 @@
|
|||||||
this.setFire(8);
|
this.setFire(8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -839,6 +1025,8 @@
|
@@ -839,6 +1026,8 @@
|
||||||
|
|
||||||
this.worldObj.theProfiler.endSection();
|
this.worldObj.theProfiler.endSection();
|
||||||
}
|
}
|
||||||
@ -326,7 +327,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected String getSwimSound()
|
protected String getSwimSound()
|
||||||
@@ -867,7 +1055,18 @@
|
@@ -867,7 +1056,18 @@
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -346,7 +347,7 @@
|
|||||||
}
|
}
|
||||||
catch (Throwable throwable)
|
catch (Throwable throwable)
|
||||||
{
|
{
|
||||||
@@ -928,6 +1127,7 @@
|
@@ -928,6 +1128,7 @@
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,7 +355,7 @@
|
|||||||
protected void dealFireDamage(int p_70081_1_)
|
protected void dealFireDamage(int p_70081_1_)
|
||||||
{
|
{
|
||||||
if (!this.isImmuneToFire)
|
if (!this.isImmuneToFire)
|
||||||
@@ -935,7 +1135,16 @@
|
@@ -935,7 +1136,16 @@
|
||||||
this.attackEntityFrom(DamageSource.inFire, (float)p_70081_1_);
|
this.attackEntityFrom(DamageSource.inFire, (float)p_70081_1_);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -371,7 +372,7 @@
|
|||||||
public final boolean isImmuneToFire()
|
public final boolean isImmuneToFire()
|
||||||
{
|
{
|
||||||
return this.isImmuneToFire;
|
return this.isImmuneToFire;
|
||||||
@@ -1184,6 +1393,8 @@
|
@@ -1184,6 +1394,8 @@
|
||||||
|
|
||||||
public void onCollideWithPlayer(EntityPlayer p_70100_1_) {}
|
public void onCollideWithPlayer(EntityPlayer p_70100_1_) {}
|
||||||
|
|
||||||
@ -380,7 +381,7 @@
|
|||||||
public void applyEntityCollision(Entity p_70108_1_)
|
public void applyEntityCollision(Entity p_70108_1_)
|
||||||
{
|
{
|
||||||
if (p_70108_1_.riddenByEntity != this && p_70108_1_.ridingEntity != this)
|
if (p_70108_1_.riddenByEntity != this && p_70108_1_.ridingEntity != this)
|
||||||
@@ -1310,6 +1521,20 @@
|
@@ -1310,6 +1522,20 @@
|
||||||
{
|
{
|
||||||
p_70109_1_.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
|
p_70109_1_.setTag("Pos", this.newDoubleNBTList(new double[] {this.posX, this.posY + (double)this.ySize, this.posZ}));
|
||||||
p_70109_1_.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
|
p_70109_1_.setTag("Motion", this.newDoubleNBTList(new double[] {this.motionX, this.motionY, this.motionZ}));
|
||||||
@ -401,7 +402,7 @@
|
|||||||
p_70109_1_.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
|
p_70109_1_.setTag("Rotation", this.newFloatNBTList(new float[] {this.rotationYaw, this.rotationPitch}));
|
||||||
p_70109_1_.setFloat("FallDistance", this.fallDistance);
|
p_70109_1_.setFloat("FallDistance", this.fallDistance);
|
||||||
p_70109_1_.setShort("Fire", (short)this.fire);
|
p_70109_1_.setShort("Fire", (short)this.fire);
|
||||||
@@ -1320,6 +1545,12 @@
|
@@ -1320,6 +1546,12 @@
|
||||||
p_70109_1_.setInteger("PortalCooldown", this.timeUntilPortal);
|
p_70109_1_.setInteger("PortalCooldown", this.timeUntilPortal);
|
||||||
p_70109_1_.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
|
p_70109_1_.setLong("UUIDMost", this.getUniqueID().getMostSignificantBits());
|
||||||
p_70109_1_.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
|
p_70109_1_.setLong("UUIDLeast", this.getUniqueID().getLeastSignificantBits());
|
||||||
@ -414,7 +415,7 @@
|
|||||||
if (customEntityData != null)
|
if (customEntityData != null)
|
||||||
{
|
{
|
||||||
p_70109_1_.setTag("ForgeData", customEntityData);
|
p_70109_1_.setTag("ForgeData", customEntityData);
|
||||||
@@ -1370,7 +1601,7 @@
|
@@ -1370,7 +1602,7 @@
|
||||||
this.motionX = nbttaglist1.func_150309_d(0);
|
this.motionX = nbttaglist1.func_150309_d(0);
|
||||||
this.motionY = nbttaglist1.func_150309_d(1);
|
this.motionY = nbttaglist1.func_150309_d(1);
|
||||||
this.motionZ = nbttaglist1.func_150309_d(2);
|
this.motionZ = nbttaglist1.func_150309_d(2);
|
||||||
@ -423,7 +424,7 @@
|
|||||||
if (Math.abs(this.motionX) > 10.0D)
|
if (Math.abs(this.motionX) > 10.0D)
|
||||||
{
|
{
|
||||||
this.motionX = 0.0D;
|
this.motionX = 0.0D;
|
||||||
@@ -1385,7 +1616,7 @@
|
@@ -1385,7 +1617,7 @@
|
||||||
{
|
{
|
||||||
this.motionZ = 0.0D;
|
this.motionZ = 0.0D;
|
||||||
}
|
}
|
||||||
@ -432,7 +433,7 @@
|
|||||||
this.prevPosX = this.lastTickPosX = this.posX = nbttaglist.func_150309_d(0);
|
this.prevPosX = this.lastTickPosX = this.posX = nbttaglist.func_150309_d(0);
|
||||||
this.prevPosY = this.lastTickPosY = this.posY = nbttaglist.func_150309_d(1);
|
this.prevPosY = this.lastTickPosY = this.posY = nbttaglist.func_150309_d(1);
|
||||||
this.prevPosZ = this.lastTickPosZ = this.posZ = nbttaglist.func_150309_d(2);
|
this.prevPosZ = this.lastTickPosZ = this.posZ = nbttaglist.func_150309_d(2);
|
||||||
@@ -1436,6 +1667,76 @@
|
@@ -1436,6 +1668,76 @@
|
||||||
{
|
{
|
||||||
this.setPosition(this.posX, this.posY, this.posZ);
|
this.setPosition(this.posX, this.posY, this.posZ);
|
||||||
}
|
}
|
||||||
@ -509,7 +510,7 @@
|
|||||||
}
|
}
|
||||||
catch (Throwable throwable)
|
catch (Throwable throwable)
|
||||||
{
|
{
|
||||||
@@ -1653,6 +1954,31 @@
|
@@ -1653,6 +1955,31 @@
|
||||||
|
|
||||||
public void mountEntity(Entity p_70078_1_)
|
public void mountEntity(Entity p_70078_1_)
|
||||||
{
|
{
|
||||||
@ -541,7 +542,7 @@
|
|||||||
this.entityRiderPitchDelta = 0.0D;
|
this.entityRiderPitchDelta = 0.0D;
|
||||||
this.entityRiderYawDelta = 0.0D;
|
this.entityRiderYawDelta = 0.0D;
|
||||||
|
|
||||||
@@ -1660,6 +1986,20 @@
|
@@ -1660,6 +1987,20 @@
|
||||||
{
|
{
|
||||||
if (this.ridingEntity != null)
|
if (this.ridingEntity != null)
|
||||||
{
|
{
|
||||||
@ -562,7 +563,7 @@
|
|||||||
this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.boundingBox.minY + (double)this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch);
|
this.setLocationAndAngles(this.ridingEntity.posX, this.ridingEntity.boundingBox.minY + (double)this.ridingEntity.height, this.ridingEntity.posZ, this.rotationYaw, this.rotationPitch);
|
||||||
this.ridingEntity.riddenByEntity = null;
|
this.ridingEntity.riddenByEntity = null;
|
||||||
}
|
}
|
||||||
@@ -1668,22 +2008,61 @@
|
@@ -1668,22 +2009,61 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -631,7 +632,7 @@
|
|||||||
this.ridingEntity = p_70078_1_;
|
this.ridingEntity = p_70078_1_;
|
||||||
p_70078_1_.riddenByEntity = this;
|
p_70078_1_.riddenByEntity = this;
|
||||||
}
|
}
|
||||||
@@ -1860,12 +2239,59 @@
|
@@ -1860,12 +2240,59 @@
|
||||||
|
|
||||||
public void onStruckByLightning(EntityLightningBolt p_70077_1_)
|
public void onStruckByLightning(EntityLightningBolt p_70077_1_)
|
||||||
{
|
{
|
||||||
@ -693,7 +694,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2038,36 +2464,62 @@
|
@@ -2038,36 +2465,62 @@
|
||||||
{
|
{
|
||||||
this.worldObj.theProfiler.startSection("changeDimension");
|
this.worldObj.theProfiler.startSection("changeDimension");
|
||||||
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
MinecraftServer minecraftserver = MinecraftServer.getServer();
|
||||||
@ -772,7 +773,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.isDead = true;
|
this.isDead = true;
|
||||||
@@ -2077,7 +2529,6 @@
|
@@ -2077,7 +2530,6 @@
|
||||||
this.worldObj.theProfiler.endSection();
|
this.worldObj.theProfiler.endSection();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -780,7 +781,7 @@
|
|||||||
public float func_145772_a(Explosion p_145772_1_, World p_145772_2_, int p_145772_3_, int p_145772_4_, int p_145772_5_, Block p_145772_6_)
|
public float func_145772_a(Explosion p_145772_1_, World p_145772_2_, int p_145772_3_, int p_145772_4_, int p_145772_5_, Block p_145772_6_)
|
||||||
{
|
{
|
||||||
return p_145772_6_.getExplosionResistance(this, p_145772_2_, p_145772_3_, p_145772_4_, p_145772_5_, posX, posY + getEyeHeight(), posZ);
|
return p_145772_6_.getExplosionResistance(this, p_145772_2_, p_145772_3_, p_145772_4_, p_145772_5_, posX, posY + getEyeHeight(), posZ);
|
||||||
@@ -2474,4 +2925,14 @@
|
@@ -2474,4 +2926,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java
|
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntity.java
|
||||||
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java
|
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntity.java
|
||||||
@@ -22,18 +22,22 @@
|
@@ -22,18 +22,23 @@
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
|
|
||||||
@ -22,10 +22,11 @@
|
|||||||
public int blockMetadata = -1;
|
public int blockMetadata = -1;
|
||||||
public Block blockType;
|
public Block blockType;
|
||||||
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
|
+ public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot
|
||||||
|
+ public boolean markedForRemoval = false;
|
||||||
private static final String __OBFID = "CL_00000340";
|
private static final String __OBFID = "CL_00000340";
|
||||||
|
|
||||||
public static void addMapping(Class p_145826_0_, String p_145826_1_)
|
public static void addMapping(Class p_145826_0_, String p_145826_1_)
|
||||||
@@ -106,7 +110,11 @@
|
@@ -106,7 +111,11 @@
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
@ -38,7 +39,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (tileentity != null)
|
if (tileentity != null)
|
||||||
@@ -282,6 +290,20 @@
|
@@ -282,6 +291,20 @@
|
||||||
addMapping(TileEntityFlowerPot.class, "FlowerPot");
|
addMapping(TileEntityFlowerPot.class, "FlowerPot");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
--- ../src-base/minecraft/net/minecraft/world/World.java
|
--- ../src-base/minecraft/net/minecraft/world/World.java
|
||||||
+++ ../src-work/minecraft/net/minecraft/world/World.java
|
+++ ../src-work/minecraft/net/minecraft/world/World.java
|
||||||
@@ -2,6 +2,7 @@
|
@@ -2,16 +2,19 @@
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
@ -8,7 +8,11 @@
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@@ -12,6 +13,7 @@
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
+import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Random;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
@ -16,7 +20,7 @@
|
|||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockHopper;
|
import net.minecraft.block.BlockHopper;
|
||||||
import net.minecraft.block.BlockLiquid;
|
import net.minecraft.block.BlockLiquid;
|
||||||
@@ -23,9 +25,11 @@
|
@@ -23,9 +26,11 @@
|
||||||
import net.minecraft.crash.CrashReport;
|
import net.minecraft.crash.CrashReport;
|
||||||
import net.minecraft.crash.CrashReportCategory;
|
import net.minecraft.crash.CrashReportCategory;
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
@ -28,7 +32,7 @@
|
|||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.pathfinding.PathEntity;
|
import net.minecraft.pathfinding.PathEntity;
|
||||||
@@ -51,7 +55,6 @@
|
@@ -51,7 +56,6 @@
|
||||||
import net.minecraft.world.storage.ISaveHandler;
|
import net.minecraft.world.storage.ISaveHandler;
|
||||||
import net.minecraft.world.storage.MapStorage;
|
import net.minecraft.world.storage.MapStorage;
|
||||||
import net.minecraft.world.storage.WorldInfo;
|
import net.minecraft.world.storage.WorldInfo;
|
||||||
@ -36,7 +40,7 @@
|
|||||||
import cpw.mods.fml.common.FMLLog;
|
import cpw.mods.fml.common.FMLLog;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableSetMultimap;
|
import com.google.common.collect.ImmutableSetMultimap;
|
||||||
@@ -70,6 +73,55 @@
|
@@ -70,6 +74,55 @@
|
||||||
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
|
import net.minecraftforge.event.entity.PlaySoundAtEntityEvent;
|
||||||
import net.minecraft.entity.EnumCreatureType;
|
import net.minecraft.entity.EnumCreatureType;
|
||||||
|
|
||||||
@ -92,16 +96,20 @@
|
|||||||
public abstract class World implements IBlockAccess
|
public abstract class World implements IBlockAccess
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@@ -83,15 +135,14 @@
|
@@ -82,16 +135,15 @@
|
||||||
|
public final MapStorage perWorldStorage;
|
||||||
|
|
||||||
public boolean scheduledUpdatesAreImmediate;
|
public boolean scheduledUpdatesAreImmediate;
|
||||||
public List loadedEntityList = new ArrayList();
|
- public List loadedEntityList = new ArrayList();
|
||||||
- protected List unloadedEntityList = new ArrayList();
|
- protected List unloadedEntityList = new ArrayList();
|
||||||
+ public List unloadedEntityList = new ArrayList(); // Cauldron
|
- public List loadedTileEntityList = new ArrayList();
|
||||||
public List loadedTileEntityList = new ArrayList();
|
- private List addedTileEntityList = new ArrayList();
|
||||||
private List addedTileEntityList = new ArrayList();
|
|
||||||
- private List field_147483_b = new ArrayList();
|
- private List field_147483_b = new ArrayList();
|
||||||
+ public List field_147483_b = new ArrayList(); // Cauldron
|
+ public List<Entity> loadedEntityList = new LinkedList<Entity>(); // KCauldron
|
||||||
|
+ public List<Entity> unloadedEntityList = com.google.common.collect.ImmutableList.of(); // KCauldron
|
||||||
|
+ public List<TileEntity> loadedTileEntityList = new LinkedList<TileEntity>(); // KCauldron
|
||||||
|
+ private List<TileEntity> addedTileEntityList = new ArrayList<TileEntity>(); // KCauldron
|
||||||
|
+ public List<TileEntity> field_147483_b = com.google.common.collect.ImmutableList.of(); // KCauldron
|
||||||
public List playerEntities = new ArrayList();
|
public List playerEntities = new ArrayList();
|
||||||
public List weatherEffects = new ArrayList();
|
public List weatherEffects = new ArrayList();
|
||||||
private long cloudColour = 16777215L;
|
private long cloudColour = 16777215L;
|
||||||
@ -110,7 +118,7 @@
|
|||||||
protected final int DIST_HASH_MAGIC = 1013904223;
|
protected final int DIST_HASH_MAGIC = 1013904223;
|
||||||
public float prevRainingStrength;
|
public float prevRainingStrength;
|
||||||
public float rainingStrength;
|
public float rainingStrength;
|
||||||
@@ -100,26 +151,88 @@
|
@@ -100,26 +152,88 @@
|
||||||
public int lastLightningBolt;
|
public int lastLightningBolt;
|
||||||
public EnumDifficulty difficultySetting;
|
public EnumDifficulty difficultySetting;
|
||||||
public Random rand = new Random();
|
public Random rand = new Random();
|
||||||
@ -206,7 +214,7 @@
|
|||||||
private static final String __OBFID = "CL_00000140";
|
private static final String __OBFID = "CL_00000140";
|
||||||
public boolean restoringBlockSnapshots = false;
|
public boolean restoringBlockSnapshots = false;
|
||||||
public boolean captureBlockSnapshots = false;
|
public boolean captureBlockSnapshots = false;
|
||||||
@@ -166,6 +279,27 @@
|
@@ -166,6 +280,27 @@
|
||||||
return this.provider.worldChunkMgr;
|
return this.provider.worldChunkMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +242,7 @@
|
|||||||
@SideOnly(Side.CLIENT)
|
@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_)
|
public World(ISaveHandler p_i45368_1_, String p_i45368_2_, WorldProvider p_i45368_3_, WorldSettings p_i45368_4_, Profiler p_i45368_5_)
|
||||||
{
|
{
|
||||||
@@ -179,6 +313,12 @@
|
@@ -179,6 +314,12 @@
|
||||||
this.worldInfo = new WorldInfo(p_i45368_4_, p_i45368_2_);
|
this.worldInfo = new WorldInfo(p_i45368_4_, p_i45368_2_);
|
||||||
this.provider = p_i45368_3_;
|
this.provider = p_i45368_3_;
|
||||||
perWorldStorage = new MapStorage((ISaveHandler)null);
|
perWorldStorage = new MapStorage((ISaveHandler)null);
|
||||||
@ -247,7 +255,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Broken up so that the WorldClient gets the chance to set the mapstorage object before the dimension initializes
|
// Broken up so that the WorldClient gets the chance to set the mapstorage object before the dimension initializes
|
||||||
@@ -207,8 +347,175 @@
|
@@ -207,8 +348,175 @@
|
||||||
this.calculateInitialWeather();
|
this.calculateInitialWeather();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,7 +431,7 @@
|
|||||||
this.ambientTickCountdown = this.rand.nextInt(12000);
|
this.ambientTickCountdown = this.rand.nextInt(12000);
|
||||||
this.spawnHostileMobs = true;
|
this.spawnHostileMobs = true;
|
||||||
this.spawnPeacefulMobs = true;
|
this.spawnPeacefulMobs = true;
|
||||||
@@ -216,7 +523,6 @@
|
@@ -216,7 +524,6 @@
|
||||||
this.lightUpdateBlockList = new int[32768];
|
this.lightUpdateBlockList = new int[32768];
|
||||||
this.saveHandler = p_i45369_1_;
|
this.saveHandler = p_i45369_1_;
|
||||||
this.theProfiler = p_i45369_5_;
|
this.theProfiler = p_i45369_5_;
|
||||||
@ -431,7 +439,7 @@
|
|||||||
this.worldInfo = p_i45369_1_.loadWorldInfo();
|
this.worldInfo = p_i45369_1_.loadWorldInfo();
|
||||||
|
|
||||||
if (p_i45369_4_ != null)
|
if (p_i45369_4_ != null)
|
||||||
@@ -235,13 +541,26 @@
|
@@ -235,13 +542,26 @@
|
||||||
if (this.worldInfo == null)
|
if (this.worldInfo == null)
|
||||||
{
|
{
|
||||||
this.worldInfo = new WorldInfo(p_i45369_3_, p_i45369_2_);
|
this.worldInfo = new WorldInfo(p_i45369_3_, p_i45369_2_);
|
||||||
@ -458,7 +466,7 @@
|
|||||||
this.chunkProvider = this.createChunkProvider();
|
this.chunkProvider = this.createChunkProvider();
|
||||||
|
|
||||||
if (this instanceof WorldServer)
|
if (this instanceof WorldServer)
|
||||||
@@ -294,6 +613,7 @@
|
@@ -294,6 +614,7 @@
|
||||||
this.calculateInitialSkylight();
|
this.calculateInitialSkylight();
|
||||||
this.calculateInitialWeather();
|
this.calculateInitialWeather();
|
||||||
}
|
}
|
||||||
@ -466,7 +474,7 @@
|
|||||||
|
|
||||||
private static MapStorage s_mapStorage;
|
private static MapStorage s_mapStorage;
|
||||||
private static ISaveHandler s_savehandler;
|
private static ISaveHandler s_savehandler;
|
||||||
@@ -336,6 +656,18 @@
|
@@ -336,6 +657,18 @@
|
||||||
|
|
||||||
public Block getBlock(int p_147439_1_, int p_147439_2_, int p_147439_3_)
|
public Block getBlock(int p_147439_1_, int p_147439_2_, int p_147439_3_)
|
||||||
{
|
{
|
||||||
@ -485,7 +493,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)
|
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;
|
Chunk chunk = null;
|
||||||
@@ -404,7 +736,7 @@
|
@@ -404,7 +737,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -494,7 +502,7 @@
|
|||||||
{
|
{
|
||||||
return this.chunkProvider.chunkExists(p_72916_1_, p_72916_2_);
|
return this.chunkProvider.chunkExists(p_72916_1_, p_72916_2_);
|
||||||
}
|
}
|
||||||
@@ -421,6 +753,27 @@
|
@@ -421,6 +754,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_)
|
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_)
|
||||||
{
|
{
|
||||||
@ -522,7 +530,7 @@
|
|||||||
if (p_147465_1_ >= -30000000 && p_147465_3_ >= -30000000 && p_147465_1_ < 30000000 && p_147465_3_ < 30000000)
|
if (p_147465_1_ >= -30000000 && p_147465_3_ >= -30000000 && p_147465_1_ < 30000000 && p_147465_3_ < 30000000)
|
||||||
{
|
{
|
||||||
if (p_147465_2_ < 0)
|
if (p_147465_2_ < 0)
|
||||||
@@ -448,8 +801,22 @@
|
@@ -448,8 +802,22 @@
|
||||||
this.capturedBlockSnapshots.add(blockSnapshot);
|
this.capturedBlockSnapshots.add(blockSnapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -545,7 +553,7 @@
|
|||||||
if (!flag && blockSnapshot != null)
|
if (!flag && blockSnapshot != null)
|
||||||
{
|
{
|
||||||
this.capturedBlockSnapshots.remove(blockSnapshot);
|
this.capturedBlockSnapshots.remove(blockSnapshot);
|
||||||
@@ -460,6 +827,7 @@
|
@@ -460,6 +828,7 @@
|
||||||
this.func_147451_t(p_147465_1_, p_147465_2_, p_147465_3_);
|
this.func_147451_t(p_147465_1_, p_147465_2_, p_147465_3_);
|
||||||
this.theProfiler.endSection();
|
this.theProfiler.endSection();
|
||||||
|
|
||||||
@ -553,7 +561,7 @@
|
|||||||
if (flag && blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates
|
if (flag && blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates
|
||||||
{
|
{
|
||||||
// Modularize client and physic updates
|
// Modularize client and physic updates
|
||||||
@@ -496,6 +864,19 @@
|
@@ -496,6 +865,19 @@
|
||||||
|
|
||||||
public int getBlockMetadata(int p_72805_1_, int p_72805_2_, int p_72805_3_)
|
public int getBlockMetadata(int p_72805_1_, int p_72805_2_, int p_72805_3_)
|
||||||
{
|
{
|
||||||
@ -573,7 +581,7 @@
|
|||||||
if (p_72805_1_ >= -30000000 && p_72805_3_ >= -30000000 && p_72805_1_ < 30000000 && p_72805_3_ < 30000000)
|
if (p_72805_1_ >= -30000000 && p_72805_3_ >= -30000000 && p_72805_1_ < 30000000 && p_72805_3_ < 30000000)
|
||||||
{
|
{
|
||||||
if (p_72805_2_ < 0)
|
if (p_72805_2_ < 0)
|
||||||
@@ -511,7 +892,7 @@
|
@@ -511,7 +893,7 @@
|
||||||
Chunk chunk = this.getChunkFromChunkCoords(p_72805_1_ >> 4, p_72805_3_ >> 4);
|
Chunk chunk = this.getChunkFromChunkCoords(p_72805_1_ >> 4, p_72805_3_ >> 4);
|
||||||
p_72805_1_ &= 15;
|
p_72805_1_ &= 15;
|
||||||
p_72805_3_ &= 15;
|
p_72805_3_ &= 15;
|
||||||
@ -582,7 +590,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -610,6 +991,12 @@
|
@@ -610,6 +992,12 @@
|
||||||
|
|
||||||
public void notifyBlockChange(int p_147444_1_, int p_147444_2_, int p_147444_3_, Block p_147444_4_)
|
public void notifyBlockChange(int p_147444_1_, int p_147444_2_, int p_147444_3_, Block p_147444_4_)
|
||||||
{
|
{
|
||||||
@ -595,7 +603,7 @@
|
|||||||
this.notifyBlocksOfNeighborChange(p_147444_1_, p_147444_2_, p_147444_3_, p_147444_4_);
|
this.notifyBlocksOfNeighborChange(p_147444_1_, p_147444_2_, p_147444_3_, p_147444_4_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -694,6 +1081,21 @@
|
@@ -694,6 +1082,21 @@
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -617,7 +625,7 @@
|
|||||||
block.onNeighborBlockChange(this, p_147460_1_, p_147460_2_, p_147460_3_, p_147460_4_);
|
block.onNeighborBlockChange(this, p_147460_1_, p_147460_2_, p_147460_3_, p_147460_4_);
|
||||||
}
|
}
|
||||||
catch (Throwable throwable1)
|
catch (Throwable throwable1)
|
||||||
@@ -1307,6 +1709,13 @@
|
@@ -1307,6 +1710,13 @@
|
||||||
|
|
||||||
public boolean spawnEntityInWorld(Entity p_72838_1_)
|
public boolean spawnEntityInWorld(Entity p_72838_1_)
|
||||||
{
|
{
|
||||||
@ -631,7 +639,7 @@
|
|||||||
// do not drop any items while restoring blocksnapshots. Prevents dupes
|
// 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;
|
if (!this.isRemote && (p_72838_1_ == null || (p_72838_1_ instanceof net.minecraft.entity.item.EntityItem && this.restoringBlockSnapshots))) return false;
|
||||||
|
|
||||||
@@ -1319,23 +1728,99 @@
|
@@ -1319,23 +1729,99 @@
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,7 +741,7 @@
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1346,6 +1831,8 @@
|
@@ -1346,6 +1832,8 @@
|
||||||
{
|
{
|
||||||
((IWorldAccess)this.worldAccesses.get(i)).onEntityCreate(p_72923_1_);
|
((IWorldAccess)this.worldAccesses.get(i)).onEntityCreate(p_72923_1_);
|
||||||
}
|
}
|
||||||
@ -742,7 +750,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onEntityRemoved(Entity p_72847_1_)
|
public void onEntityRemoved(Entity p_72847_1_)
|
||||||
@@ -1354,6 +1841,8 @@
|
@@ -1354,6 +1842,8 @@
|
||||||
{
|
{
|
||||||
((IWorldAccess)this.worldAccesses.get(i)).onEntityDestroy(p_72847_1_);
|
((IWorldAccess)this.worldAccesses.get(i)).onEntityDestroy(p_72847_1_);
|
||||||
}
|
}
|
||||||
@ -751,7 +759,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void removeEntity(Entity p_72900_1_)
|
public void removeEntity(Entity p_72900_1_)
|
||||||
@@ -1397,6 +1886,19 @@
|
@@ -1397,6 +1887,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadedEntityList.remove(p_72973_1_);
|
this.loadedEntityList.remove(p_72973_1_);
|
||||||
@ -771,7 +779,7 @@
|
|||||||
this.onEntityRemoved(p_72973_1_);
|
this.onEntityRemoved(p_72973_1_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1408,40 +1910,58 @@
|
@@ -1408,40 +1911,58 @@
|
||||||
public List getCollidingBoundingBoxes(Entity p_72945_1_, AxisAlignedBB p_72945_2_)
|
public List getCollidingBoundingBoxes(Entity p_72945_1_, AxisAlignedBB p_72945_2_)
|
||||||
{
|
{
|
||||||
this.collidingBoundingBoxes.clear();
|
this.collidingBoundingBoxes.clear();
|
||||||
@ -844,7 +852,7 @@
|
|||||||
|
|
||||||
for (int j2 = 0; j2 < list.size(); ++j2)
|
for (int j2 = 0; j2 < list.size(); ++j2)
|
||||||
{
|
{
|
||||||
@@ -1797,11 +2317,22 @@
|
@@ -1797,11 +2318,22 @@
|
||||||
Entity entity;
|
Entity entity;
|
||||||
CrashReport crashreport;
|
CrashReport crashreport;
|
||||||
CrashReportCategory crashreportcategory;
|
CrashReportCategory crashreportcategory;
|
||||||
@ -867,25 +875,61 @@
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
++entity.ticksExisted;
|
++entity.ticksExisted;
|
||||||
@@ -1862,10 +2393,14 @@
|
@@ -1838,35 +2370,27 @@
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.unloadedEntityList.clear();
|
- this.theProfiler.endStartSection("remove");
|
||||||
this.theProfiler.endStartSection("regular");
|
- this.loadedEntityList.removeAll(this.unloadedEntityList);
|
||||||
|
- int j;
|
||||||
|
- int l;
|
||||||
|
+ this.theProfiler.endStartSection("regular");
|
||||||
+ org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
+ org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||||
+ timings.entityTick.startTiming(); // Spigot
|
+ timings.entityTick.startTiming(); // Spigot
|
||||||
|
|
||||||
- for (i = 0; i < this.loadedEntityList.size(); ++i)
|
- for (i = 0; i < this.unloadedEntityList.size(); ++i)
|
||||||
- {
|
- {
|
||||||
- entity = (Entity)this.loadedEntityList.get(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);
|
||||||
+ int entitiesThisCycle = 0;
|
+ int entitiesThisCycle = 0;
|
||||||
+ if (tickPosition < 0) tickPosition = 0;
|
+ if (tickPosition < 0) tickPosition = 0;
|
||||||
+ for (entityLimiter.initTick(); entitiesThisCycle < loadedEntityList.size() && (entitiesThisCycle % 10 == 0 || entityLimiter.shouldContinue()); tickPosition++, entitiesThisCycle++) {
|
+ for (entityLimiter.initTick(); entitiesThisCycle < loadedEntityList.size() && (entitiesThisCycle % 10 == 0 || entityLimiter.shouldContinue()); tickPosition++, entitiesThisCycle++) {
|
||||||
+ tickPosition = (tickPosition < loadedEntityList.size()) ? tickPosition : 0;
|
+ tickPosition = (tickPosition < loadedEntityList.size()) ? tickPosition : 0;
|
||||||
+ entity = (Entity)this.loadedEntityList.get(this.tickPosition);
|
+ entity = (Entity)this.loadedEntityList.get(this.tickPosition);
|
||||||
|
+
|
||||||
|
+ if (entity.markedForRemoval) {
|
||||||
|
+ int x = entity.chunkCoordX;
|
||||||
|
+ int y = entity.chunkCoordZ;
|
||||||
|
+ if (entity.addedToChunk && chunkExists(x, y))
|
||||||
|
+ getChunkFromChunkCoords(x, y).removeEntity(entity);
|
||||||
|
+ onEntityRemoved(entity);
|
||||||
|
+ entitiesThisCycle--;
|
||||||
|
+ loadedEntityList.remove(tickPosition--);
|
||||||
|
+ 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);
|
||||||
|
-
|
||||||
if (entity.ridingEntity != null)
|
if (entity.ridingEntity != null)
|
||||||
{
|
{
|
||||||
@@ -1884,7 +2419,9 @@
|
if (!entity.ridingEntity.isDead && entity.ridingEntity.riddenByEntity == entity)
|
||||||
|
@@ -1884,7 +2408,9 @@
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -895,16 +939,21 @@
|
|||||||
}
|
}
|
||||||
catch (Throwable throwable1)
|
catch (Throwable throwable1)
|
||||||
{
|
{
|
||||||
@@ -1916,30 +2453,69 @@
|
@@ -1909,37 +2435,64 @@
|
||||||
|
|
||||||
|
if (entity.isDead)
|
||||||
{
|
{
|
||||||
this.getChunkFromChunkCoords(j, l).removeEntity(entity);
|
- j = entity.chunkCoordX;
|
||||||
}
|
- l = entity.chunkCoordZ;
|
||||||
|
-
|
||||||
|
- if (entity.addedToChunk && this.chunkExists(j, l))
|
||||||
|
- {
|
||||||
|
- this.getChunkFromChunkCoords(j, l).removeEntity(entity);
|
||||||
|
- }
|
||||||
-
|
-
|
||||||
- this.loadedEntityList.remove(i--);
|
- this.loadedEntityList.remove(i--);
|
||||||
+ if (this.tickPosition < this.loadedEntityList.size()) // KCauldron
|
- this.onEntityRemoved(entity);
|
||||||
+ this.loadedEntityList.remove(this.tickPosition--); // CraftBukkit - Use field for loop variable
|
+ entity.markedForRemoval = true;
|
||||||
+ else kcauldron.KLog.get().warning("Entity removal desync! " + entity); // KCauldron
|
|
||||||
this.onEntityRemoved(entity);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.theProfiler.endSection();
|
this.theProfiler.endSection();
|
||||||
@ -915,22 +964,10 @@
|
|||||||
+ timings.tileEntityTick.startTiming(); // Spigot
|
+ timings.tileEntityTick.startTiming(); // Spigot
|
||||||
this.field_147481_N = true;
|
this.field_147481_N = true;
|
||||||
- Iterator iterator = this.loadedTileEntityList.iterator();
|
- 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();
|
|
||||||
+ 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))
|
- while (iterator.hasNext())
|
||||||
|
- {
|
||||||
|
- TileEntity tileentity = (TileEntity)iterator.next();
|
||||||
+ int tilesThisCycle = 0;
|
+ int tilesThisCycle = 0;
|
||||||
+ for (tileLimiter.initTick(); tilesThisCycle < loadedTileEntityList.size() && (tilesThisCycle % 10 == 0 || tileLimiter.shouldContinue()); tileTickPosition++, tilesThisCycle++) {
|
+ for (tileLimiter.initTick(); tilesThisCycle < loadedTileEntityList.size() && (tilesThisCycle % 10 == 0 || tileLimiter.shouldContinue()); tileTickPosition++, tilesThisCycle++) {
|
||||||
+ tileTickPosition = (tileTickPosition < loadedTileEntityList.size()) ? tileTickPosition : 0;
|
+ tileTickPosition = (tileTickPosition < loadedTileEntityList.size()) ? tileTickPosition : 0;
|
||||||
@ -938,7 +975,7 @@
|
|||||||
+
|
+
|
||||||
+ // Spigot start
|
+ // Spigot start
|
||||||
+ if (tileentity == null)
|
+ if (tileentity == null)
|
||||||
{
|
+ {
|
||||||
+ getServer().getLogger().severe("Cauldron has detected a null entity and has removed it, preventing a crash");
|
+ getServer().getLogger().severe("Cauldron has detected a null entity and has removed it, preventing a crash");
|
||||||
+ tilesThisCycle--;
|
+ tilesThisCycle--;
|
||||||
+ this.loadedTileEntityList.remove(tileTickPosition--);
|
+ this.loadedTileEntityList.remove(tileTickPosition--);
|
||||||
@ -946,6 +983,15 @@
|
|||||||
+ }
|
+ }
|
||||||
+ // Spigot end
|
+ // Spigot end
|
||||||
+
|
+
|
||||||
|
+ // KCauldron start
|
||||||
|
+ if (tileentity.markedForRemoval) {
|
||||||
|
+ tileentity.onChunkUnload();
|
||||||
|
+ tilesThisCycle--;
|
||||||
|
+ loadedTileEntityList.remove(tileTickPosition--);
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+ // KCauldron end
|
||||||
|
+
|
||||||
+ if (tileentity.isInvalid()) {
|
+ if (tileentity.isInvalid()) {
|
||||||
+ tilesThisCycle--;
|
+ tilesThisCycle--;
|
||||||
+ this.loadedTileEntityList.remove(tileTickPosition--);
|
+ this.loadedTileEntityList.remove(tileTickPosition--);
|
||||||
@ -955,10 +1001,11 @@
|
|||||||
+ }
|
+ }
|
||||||
+ continue;
|
+ continue;
|
||||||
+ }
|
+ }
|
||||||
+
|
|
||||||
|
- if (!tileentity.isInvalid() && tileentity.hasWorldObj() && this.blockExists(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord))
|
||||||
+ if (tileentity.hasWorldObj() && CauldronHooks.canTileEntityTick(tileentity, this)
|
+ if (tileentity.hasWorldObj() && CauldronHooks.canTileEntityTick(tileentity, this)
|
||||||
+ && this.blockExists(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord))
|
+ && this.blockExists(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord))
|
||||||
+ {
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
+ tileentity.tickTimer.startTiming(); // Spigot
|
+ tileentity.tickTimer.startTiming(); // Spigot
|
||||||
@ -972,7 +1019,7 @@
|
|||||||
crashreport = CrashReport.makeCrashReport(throwable, "Ticking block entity");
|
crashreport = CrashReport.makeCrashReport(throwable, "Ticking block entity");
|
||||||
crashreportcategory = crashreport.makeCategory("Block entity being ticked");
|
crashreportcategory = crashreport.makeCategory("Block entity being ticked");
|
||||||
tileentity.func_145828_a(crashreportcategory);
|
tileentity.func_145828_a(crashreportcategory);
|
||||||
@@ -1955,23 +2531,13 @@
|
@@ -1955,23 +2508,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -992,16 +1039,16 @@
|
|||||||
- }
|
- }
|
||||||
- }
|
- }
|
||||||
}
|
}
|
||||||
|
+ this.field_147481_N = false;
|
||||||
|
|
||||||
+ timings.tileEntityTick.stopTiming(); // Spigot
|
+ timings.tileEntityTick.stopTiming(); // Spigot
|
||||||
+ timings.tileEntityPending.startTiming(); // Spigot
|
+ timings.tileEntityPending.startTiming(); // Spigot
|
||||||
+ this.field_147481_N = false;
|
|
||||||
+
|
+
|
||||||
+ /* CraftBukkit start - Moved up
|
+ /* CraftBukkit start - Moved up
|
||||||
if (!this.field_147483_b.isEmpty())
|
if (!this.field_147483_b.isEmpty())
|
||||||
{
|
{
|
||||||
for (Object tile : field_147483_b)
|
for (Object tile : field_147483_b)
|
||||||
@@ -1981,6 +2547,7 @@
|
@@ -1981,6 +2524,7 @@
|
||||||
this.loadedTileEntityList.removeAll(this.field_147483_b);
|
this.loadedTileEntityList.removeAll(this.field_147483_b);
|
||||||
this.field_147483_b.clear();
|
this.field_147483_b.clear();
|
||||||
}
|
}
|
||||||
@ -1009,7 +1056,7 @@
|
|||||||
|
|
||||||
this.field_147481_N = false;
|
this.field_147481_N = false;
|
||||||
|
|
||||||
@@ -2016,17 +2583,23 @@
|
@@ -2016,17 +2560,23 @@
|
||||||
this.addedTileEntityList.clear();
|
this.addedTileEntityList.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1036,7 +1083,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void updateEntity(Entity p_72870_1_)
|
public void updateEntity(Entity p_72870_1_)
|
||||||
@@ -2036,21 +2609,33 @@
|
@@ -2036,21 +2586,33 @@
|
||||||
|
|
||||||
public void updateEntityWithOptionalForce(Entity p_72866_1_, boolean p_72866_2_)
|
public void updateEntityWithOptionalForce(Entity p_72866_1_, boolean p_72866_2_)
|
||||||
{
|
{
|
||||||
@ -1071,7 +1118,7 @@
|
|||||||
p_72866_1_.lastTickPosX = p_72866_1_.posX;
|
p_72866_1_.lastTickPosX = p_72866_1_.posX;
|
||||||
p_72866_1_.lastTickPosY = p_72866_1_.posY;
|
p_72866_1_.lastTickPosY = p_72866_1_.posY;
|
||||||
p_72866_1_.lastTickPosZ = p_72866_1_.posZ;
|
p_72866_1_.lastTickPosZ = p_72866_1_.posZ;
|
||||||
@@ -2134,6 +2719,7 @@
|
@@ -2134,6 +2696,7 @@
|
||||||
p_72866_1_.riddenByEntity = null;
|
p_72866_1_.riddenByEntity = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1079,7 +1126,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2570,7 +3156,7 @@
|
@@ -2570,7 +3133,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1088,7 +1135,16 @@
|
|||||||
{
|
{
|
||||||
if (this.field_147481_N)
|
if (this.field_147481_N)
|
||||||
{
|
{
|
||||||
@@ -2718,7 +3304,15 @@
|
@@ -2612,7 +3175,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_)
|
||||||
|
@@ -2718,7 +3281,15 @@
|
||||||
|
|
||||||
if (i <= 0)
|
if (i <= 0)
|
||||||
{
|
{
|
||||||
@ -1105,7 +1161,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2754,7 +3348,15 @@
|
@@ -2754,7 +3325,15 @@
|
||||||
|
|
||||||
if (j <= 0)
|
if (j <= 0)
|
||||||
{
|
{
|
||||||
@ -1122,7 +1178,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2777,8 +3379,41 @@
|
@@ -2777,8 +3356,41 @@
|
||||||
protected void setActivePlayerChunksAndCheckLight()
|
protected void setActivePlayerChunksAndCheckLight()
|
||||||
{
|
{
|
||||||
this.activeChunkSet.clear();
|
this.activeChunkSet.clear();
|
||||||
@ -1165,7 +1221,7 @@
|
|||||||
int i;
|
int i;
|
||||||
EntityPlayer entityplayer;
|
EntityPlayer entityplayer;
|
||||||
int j;
|
int j;
|
||||||
@@ -2788,17 +3423,28 @@
|
@@ -2788,17 +3400,28 @@
|
||||||
for (i = 0; i < this.playerEntities.size(); ++i)
|
for (i = 0; i < this.playerEntities.size(); ++i)
|
||||||
{
|
{
|
||||||
entityplayer = (EntityPlayer)this.playerEntities.get(i);
|
entityplayer = (EntityPlayer)this.playerEntities.get(i);
|
||||||
@ -1200,7 +1256,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.theProfiler.endSection();
|
this.theProfiler.endSection();
|
||||||
@@ -2810,7 +3456,7 @@
|
@@ -2810,7 +3433,7 @@
|
||||||
|
|
||||||
this.theProfiler.startSection("playerCheckLight");
|
this.theProfiler.startSection("playerCheckLight");
|
||||||
|
|
||||||
@ -1209,7 +1265,7 @@
|
|||||||
{
|
{
|
||||||
i = this.rand.nextInt(this.playerEntities.size());
|
i = this.rand.nextInt(this.playerEntities.size());
|
||||||
entityplayer = (EntityPlayer)this.playerEntities.get(i);
|
entityplayer = (EntityPlayer)this.playerEntities.get(i);
|
||||||
@@ -3284,8 +3930,21 @@
|
@@ -3284,8 +3907,21 @@
|
||||||
{
|
{
|
||||||
Entity entity = (Entity)this.loadedEntityList.get(j);
|
Entity entity = (Entity)this.loadedEntityList.get(j);
|
||||||
|
|
||||||
@ -1232,7 +1288,7 @@
|
|||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3298,6 +3957,7 @@
|
@@ -3298,6 +3934,7 @@
|
||||||
for (int i = 0; i < p_72868_1_.size(); ++i)
|
for (int i = 0; i < p_72868_1_.size(); ++i)
|
||||||
{
|
{
|
||||||
Entity entity = (Entity)p_72868_1_.get(i);
|
Entity entity = (Entity)p_72868_1_.get(i);
|
||||||
@ -1240,7 +1296,16 @@
|
|||||||
if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(entity, this)))
|
if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(entity, this)))
|
||||||
{
|
{
|
||||||
loadedEntityList.add(entity);
|
loadedEntityList.add(entity);
|
||||||
@@ -3314,8 +3974,17 @@
|
@@ -3308,14 +3945,25 @@
|
||||||
|
|
||||||
|
public void unloadEntities(List p_72828_1_)
|
||||||
|
{
|
||||||
|
- this.unloadedEntityList.addAll(p_72828_1_);
|
||||||
|
+ for (Object o : p_72828_1_) {
|
||||||
|
+ ((Entity)o).markedForRemoval = true;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
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_)
|
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_);
|
Block block1 = this.getBlock(p_147472_2_, p_147472_3_, p_147472_4_);
|
||||||
@ -1259,7 +1324,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_)
|
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 +4133,12 @@
|
@@ -3464,6 +4112,12 @@
|
||||||
for (int i = 0; i < this.playerEntities.size(); ++i)
|
for (int i = 0; i < this.playerEntities.size(); ++i)
|
||||||
{
|
{
|
||||||
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
|
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
|
||||||
@ -1272,7 +1337,7 @@
|
|||||||
double d5 = entityplayer1.getDistanceSq(p_72977_1_, p_72977_3_, p_72977_5_);
|
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))
|
if ((p_72977_7_ < 0.0D || d5 < p_72977_7_ * p_72977_7_) && (d4 == -1.0D || d5 < d4))
|
||||||
@@ -3489,7 +4164,12 @@
|
@@ -3489,7 +4143,12 @@
|
||||||
for (int i = 0; i < this.playerEntities.size(); ++i)
|
for (int i = 0; i < this.playerEntities.size(); ++i)
|
||||||
{
|
{
|
||||||
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
|
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
|
||||||
@ -1286,7 +1351,7 @@
|
|||||||
if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive())
|
if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive())
|
||||||
{
|
{
|
||||||
double d5 = entityplayer1.getDistanceSq(p_72846_1_, p_72846_3_, p_72846_5_);
|
double d5 = entityplayer1.getDistanceSq(p_72846_1_, p_72846_3_, p_72846_5_);
|
||||||
@@ -3660,6 +4340,18 @@
|
@@ -3660,6 +4319,18 @@
|
||||||
|
|
||||||
public void updateAllPlayersSleepingFlag() {}
|
public void updateAllPlayersSleepingFlag() {}
|
||||||
|
|
||||||
@ -1305,7 +1370,7 @@
|
|||||||
public float getWeightedThunderStrength(float p_72819_1_)
|
public float getWeightedThunderStrength(float p_72819_1_)
|
||||||
{
|
{
|
||||||
return (this.prevThunderingStrength + (this.thunderingStrength - this.prevThunderingStrength) * p_72819_1_) * this.getRainStrength(p_72819_1_);
|
return (this.prevThunderingStrength + (this.thunderingStrength - this.prevThunderingStrength) * p_72819_1_) * this.getRainStrength(p_72819_1_);
|
||||||
@@ -3932,8 +4624,8 @@
|
@@ -3932,8 +4603,8 @@
|
||||||
*/
|
*/
|
||||||
public void addTileEntity(TileEntity entity)
|
public void addTileEntity(TileEntity entity)
|
||||||
{
|
{
|
||||||
@ -1316,7 +1381,7 @@
|
|||||||
{
|
{
|
||||||
dest.add(entity);
|
dest.add(entity);
|
||||||
}
|
}
|
||||||
@@ -4029,4 +4721,73 @@
|
@@ -4029,4 +4700,73 @@
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import net.minecraft.server.MinecraftServer;
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.world.WorldServer;
|
||||||
import net.minecraftforge.cauldron.CauldronHooks;
|
import net.minecraftforge.cauldron.CauldronHooks;
|
||||||
import net.minecraftforge.cauldron.configuration.BoolSetting;
|
import net.minecraftforge.cauldron.configuration.BoolSetting;
|
||||||
import net.minecraftforge.cauldron.configuration.IntSetting;
|
import net.minecraftforge.cauldron.configuration.IntSetting;
|
||||||
@ -116,9 +118,7 @@ public class CauldronCommand extends Command
|
|||||||
ChatColor.GOLD + " Tile Entities: " + ChatColor.GRAY + world.loadedTileEntityList.size()
|
ChatColor.GOLD + " Tile Entities: " + ChatColor.GRAY + world.loadedTileEntityList.size()
|
||||||
);
|
);
|
||||||
sender.sendMessage(ChatColor.GOLD + " Entities Last Tick: " + ChatColor.GRAY + world.entitiesTicked +
|
sender.sendMessage(ChatColor.GOLD + " Entities Last Tick: " + ChatColor.GRAY + world.entitiesTicked +
|
||||||
ChatColor.GOLD + " Tiles Last Tick: " + ChatColor.GRAY + world.tilesTicked +
|
ChatColor.GOLD + " Tiles Last Tick: " + ChatColor.GRAY + world.tilesTicked
|
||||||
ChatColor.GOLD + " Removed Entities: " + ChatColor.GRAY + world.unloadedEntityList.size() +
|
|
||||||
ChatColor.GOLD + " Removed Tile Entities: " + ChatColor.GRAY + world.field_147483_b.size()
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user