1
0
Fork 0

Even don't try to spawn invalid entityitem, fix for extrabiomes

kcx-1614
Prototik 2015-05-27 18:26:08 +07:00
parent a42829ecb6
commit d24b372625
3 changed files with 52 additions and 29 deletions

View File

@ -780,3 +780,14 @@
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,10 @@
}
}
}
+
+ // Cauldron start
+ public boolean entityAllowedToSpawn() {
+ return true;
+ }
+ // Cauldron end
}

View File

@ -299,3 +299,14 @@
} }
public void setEntityItemStack(ItemStack p_92058_1_) public void setEntityItemStack(ItemStack p_92058_1_)
@@ -451,4 +526,10 @@
{
this.field_145801_f = p_145799_1_;
}
+
+ @Override
+ public boolean entityAllowedToSpawn() {
+ ItemStack stack = getDataWatcher().getWatchableObjectItemStack(10);
+ return stack != null && stack.stackSize > 0;
+ }
}

View File

@ -608,7 +608,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,12 @@ @@ -1307,6 +1709,13 @@
public boolean spawnEntityInWorld(Entity p_72838_1_) public boolean spawnEntityInWorld(Entity p_72838_1_)
{ {
@ -618,10 +618,11 @@
+ +
+ public boolean addEntity(Entity p_72838_1_, SpawnReason spawnReason) // Changed signature, added SpawnReason + public boolean addEntity(Entity p_72838_1_, SpawnReason spawnReason) // Changed signature, added SpawnReason
+ { + {
+ if (!p_72838_1_.entityAllowedToSpawn()) return false; // Cauldron
// 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,8 +1727,84 @@ @@ -1319,8 +1728,84 @@
flag = true; flag = true;
} }
@ -706,7 +707,7 @@
return false; return false;
} }
else else
@@ -1332,10 +1816,10 @@ @@ -1332,10 +1817,10 @@
this.updateAllPlayersSleepingFlag(); this.updateAllPlayersSleepingFlag();
} }
if (MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false; if (MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(p_72838_1_, this)) && !flag) return false;
@ -718,7 +719,7 @@
return true; return true;
} }
} }
@@ -1346,6 +1830,8 @@ @@ -1346,6 +1831,8 @@
{ {
((IWorldAccess)this.worldAccesses.get(i)).onEntityCreate(p_72923_1_); ((IWorldAccess)this.worldAccesses.get(i)).onEntityCreate(p_72923_1_);
} }
@ -727,7 +728,7 @@
} }
public void onEntityRemoved(Entity p_72847_1_) public void onEntityRemoved(Entity p_72847_1_)
@@ -1354,6 +1840,8 @@ @@ -1354,6 +1841,8 @@
{ {
((IWorldAccess)this.worldAccesses.get(i)).onEntityDestroy(p_72847_1_); ((IWorldAccess)this.worldAccesses.get(i)).onEntityDestroy(p_72847_1_);
} }
@ -736,7 +737,7 @@
} }
public void removeEntity(Entity p_72900_1_) public void removeEntity(Entity p_72900_1_)
@@ -1397,6 +1885,19 @@ @@ -1397,6 +1886,19 @@
} }
this.loadedEntityList.remove(p_72973_1_); this.loadedEntityList.remove(p_72973_1_);
@ -756,7 +757,7 @@
this.onEntityRemoved(p_72973_1_); this.onEntityRemoved(p_72973_1_);
} }
@@ -1408,40 +1909,58 @@ @@ -1408,40 +1910,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();
@ -829,7 +830,7 @@
for (int j2 = 0; j2 < list.size(); ++j2) for (int j2 = 0; j2 < list.size(); ++j2)
{ {
@@ -1797,11 +2316,22 @@ @@ -1797,11 +2317,22 @@
Entity entity; Entity entity;
CrashReport crashreport; CrashReport crashreport;
CrashReportCategory crashreportcategory; CrashReportCategory crashreportcategory;
@ -852,7 +853,7 @@
try try
{ {
++entity.ticksExisted; ++entity.ticksExisted;
@@ -1862,10 +2392,14 @@ @@ -1862,10 +2393,14 @@
this.unloadedEntityList.clear(); this.unloadedEntityList.clear();
this.theProfiler.endStartSection("regular"); this.theProfiler.endStartSection("regular");
@ -870,7 +871,7 @@
if (entity.ridingEntity != null) if (entity.ridingEntity != null)
{ {
@@ -1884,7 +2418,9 @@ @@ -1884,7 +2419,9 @@
{ {
try try
{ {
@ -880,7 +881,7 @@
} }
catch (Throwable throwable1) catch (Throwable throwable1)
{ {
@@ -1917,29 +2453,67 @@ @@ -1917,29 +2454,67 @@
this.getChunkFromChunkCoords(j, l).removeEntity(entity); this.getChunkFromChunkCoords(j, l).removeEntity(entity);
} }
@ -954,7 +955,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 +2529,13 @@ @@ -1955,23 +2530,13 @@
} }
} }
} }
@ -983,7 +984,7 @@
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 +2545,7 @@ @@ -1981,6 +2546,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();
} }
@ -991,7 +992,7 @@
this.field_147481_N = false; this.field_147481_N = false;
@@ -2016,17 +2581,23 @@ @@ -2016,17 +2582,23 @@
this.addedTileEntityList.clear(); this.addedTileEntityList.clear();
} }
@ -1018,7 +1019,7 @@
} }
public void updateEntity(Entity p_72870_1_) public void updateEntity(Entity p_72870_1_)
@@ -2041,16 +2612,27 @@ @@ -2041,16 +2613,27 @@
boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4)); boolean isForced = getPersistentChunks().containsKey(new ChunkCoordIntPair(i >> 4, j >> 4));
byte b0 = isForced ? (byte)0 : 32; byte b0 = isForced ? (byte)0 : 32;
boolean canUpdate = !p_72866_2_ || this.checkChunksExist(i - b0, 0, j - b0, i + b0, 0, j + b0); boolean canUpdate = !p_72866_2_ || this.checkChunksExist(i - b0, 0, j - b0, i + b0, 0, j + b0);
@ -1047,7 +1048,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 +2716,7 @@ @@ -2134,6 +2717,7 @@
p_72866_1_.riddenByEntity = null; p_72866_1_.riddenByEntity = null;
} }
} }
@ -1055,7 +1056,7 @@
} }
} }
@@ -2570,7 +3153,7 @@ @@ -2570,7 +3154,7 @@
return; return;
} }
@ -1064,7 +1065,7 @@
{ {
if (this.field_147481_N) if (this.field_147481_N)
{ {
@@ -2718,7 +3301,15 @@ @@ -2718,7 +3302,15 @@
if (i <= 0) if (i <= 0)
{ {
@ -1081,7 +1082,7 @@
} }
} }
@@ -2754,7 +3345,15 @@ @@ -2754,7 +3346,15 @@
if (j <= 0) if (j <= 0)
{ {
@ -1098,7 +1099,7 @@
} }
} }
@@ -2777,8 +3376,41 @@ @@ -2777,8 +3377,41 @@
protected void setActivePlayerChunksAndCheckLight() protected void setActivePlayerChunksAndCheckLight()
{ {
this.activeChunkSet.clear(); this.activeChunkSet.clear();
@ -1141,7 +1142,7 @@
int i; int i;
EntityPlayer entityplayer; EntityPlayer entityplayer;
int j; int j;
@@ -2788,17 +3420,28 @@ @@ -2788,17 +3421,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);
@ -1176,7 +1177,7 @@
} }
this.theProfiler.endSection(); this.theProfiler.endSection();
@@ -2810,7 +3453,7 @@ @@ -2810,7 +3454,7 @@
this.theProfiler.startSection("playerCheckLight"); this.theProfiler.startSection("playerCheckLight");
@ -1185,7 +1186,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 +3927,21 @@ @@ -3284,8 +3928,21 @@
{ {
Entity entity = (Entity)this.loadedEntityList.get(j); Entity entity = (Entity)this.loadedEntityList.get(j);
@ -1208,7 +1209,7 @@
++i; ++i;
} }
} }
@@ -3314,8 +3970,17 @@ @@ -3314,8 +3971,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_) 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_);
@ -1227,7 +1228,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 +4129,12 @@ @@ -3464,6 +4130,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);
@ -1240,7 +1241,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 +4160,12 @@ @@ -3489,7 +4161,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);
@ -1254,7 +1255,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 +4336,18 @@ @@ -3660,6 +4337,18 @@
public void updateAllPlayersSleepingFlag() {} public void updateAllPlayersSleepingFlag() {}
@ -1273,7 +1274,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 +4620,8 @@ @@ -3932,8 +4621,8 @@
*/ */
public void addTileEntity(TileEntity entity) public void addTileEntity(TileEntity entity)
{ {
@ -1284,7 +1285,7 @@
{ {
dest.add(entity); dest.add(entity);
} }
@@ -4029,4 +4717,73 @@ @@ -4029,4 +4718,73 @@
} }
return count; return count;
} }