3
0

移动null判断位置

This commit is contained in:
聪聪 2017-06-27 14:30:01 +08:00
parent cdd20299e5
commit 20c5060e12

View File

@ -610,7 +610,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,8 +1698,24 @@ @@ -1307,8 +1698,22 @@
public boolean spawnEntityInWorld(Entity p_72838_1_) public boolean spawnEntityInWorld(Entity p_72838_1_)
{ {
@ -620,12 +620,10 @@
+ +
+ 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 + if (p_72838_1_==null||!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;
+ if(!this.isRemote){ + if(!this.isRemote){
+ if(p_72838_1_==null)
+ return false;
+ if(p_72838_1_ instanceof net.minecraft.entity.item.EntityItem&&this.restoringBlockSnapshots) + if(p_72838_1_ instanceof net.minecraft.entity.item.EntityItem&&this.restoringBlockSnapshots)
+ return false; + return false;
+ if(this.captureBlockSnapshots){ + if(this.captureBlockSnapshots){
@ -636,7 +634,7 @@
int i = MathHelper.floor_double(p_72838_1_.posX / 16.0D); int i = MathHelper.floor_double(p_72838_1_.posX / 16.0D);
int j = MathHelper.floor_double(p_72838_1_.posZ / 16.0D); int j = MathHelper.floor_double(p_72838_1_.posZ / 16.0D);
@@ -1319,23 +1726,99 @@ @@ -1319,23 +1724,99 @@
flag = true; flag = true;
} }
@ -738,7 +736,7 @@
return true; return true;
} }
} }
@@ -1346,6 +1829,8 @@ @@ -1346,6 +1827,8 @@
{ {
((IWorldAccess)this.worldAccesses.get(i)).onEntityCreate(p_72923_1_); ((IWorldAccess)this.worldAccesses.get(i)).onEntityCreate(p_72923_1_);
} }
@ -747,7 +745,7 @@
} }
public void onEntityRemoved(Entity p_72847_1_) public void onEntityRemoved(Entity p_72847_1_)
@@ -1354,6 +1839,8 @@ @@ -1354,6 +1837,8 @@
{ {
((IWorldAccess)this.worldAccesses.get(i)).onEntityDestroy(p_72847_1_); ((IWorldAccess)this.worldAccesses.get(i)).onEntityDestroy(p_72847_1_);
} }
@ -756,7 +754,7 @@
} }
public void removeEntity(Entity p_72900_1_) public void removeEntity(Entity p_72900_1_)
@@ -1397,6 +1884,19 @@ @@ -1397,6 +1882,19 @@
} }
this.loadedEntityList.remove(p_72973_1_); this.loadedEntityList.remove(p_72973_1_);
@ -776,7 +774,7 @@
this.onEntityRemoved(p_72973_1_); this.onEntityRemoved(p_72973_1_);
} }
@@ -1408,40 +1908,58 @@ @@ -1408,40 +1906,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();
@ -849,7 +847,7 @@
for (int j2 = 0; j2 < list.size(); ++j2) for (int j2 = 0; j2 < list.size(); ++j2)
{ {
@@ -1797,11 +2315,22 @@ @@ -1797,11 +2313,22 @@
Entity entity; Entity entity;
CrashReport crashreport; CrashReport crashreport;
CrashReportCategory crashreportcategory; CrashReportCategory crashreportcategory;
@ -872,7 +870,7 @@
try try
{ {
++entity.ticksExisted; ++entity.ticksExisted;
@@ -1862,10 +2391,14 @@ @@ -1862,10 +2389,14 @@
this.unloadedEntityList.clear(); this.unloadedEntityList.clear();
this.theProfiler.endStartSection("regular"); this.theProfiler.endStartSection("regular");
@ -890,7 +888,7 @@
if (entity.ridingEntity != null) if (entity.ridingEntity != null)
{ {
@@ -1884,7 +2417,9 @@ @@ -1884,7 +2415,9 @@
{ {
try try
{ {
@ -900,7 +898,7 @@
} }
catch (Throwable throwable1) catch (Throwable throwable1)
{ {
@@ -1916,30 +2451,85 @@ @@ -1916,30 +2449,85 @@
{ {
this.getChunkFromChunkCoords(j, l).removeEntity(entity); this.getChunkFromChunkCoords(j, l).removeEntity(entity);
} }
@ -993,7 +991,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 +2545,13 @@ @@ -1955,23 +2543,13 @@
} }
} }
} }
@ -1022,7 +1020,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 +2561,7 @@ @@ -1981,6 +2559,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();
} }
@ -1030,7 +1028,7 @@
this.field_147481_N = false; this.field_147481_N = false;
@@ -2016,17 +2597,23 @@ @@ -2016,17 +2595,23 @@
this.addedTileEntityList.clear(); this.addedTileEntityList.clear();
} }
@ -1057,7 +1055,7 @@
} }
public void updateEntity(Entity p_72870_1_) public void updateEntity(Entity p_72870_1_)
@@ -2036,21 +2623,36 @@ @@ -2036,21 +2621,36 @@
public void updateEntityWithOptionalForce(Entity p_72866_1_, boolean p_72866_2_) public void updateEntityWithOptionalForce(Entity p_72866_1_, boolean p_72866_2_)
{ {
@ -1096,7 +1094,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 +2736,7 @@ @@ -2134,6 +2734,7 @@
p_72866_1_.riddenByEntity = null; p_72866_1_.riddenByEntity = null;
} }
} }
@ -1104,7 +1102,7 @@
} }
} }
@@ -2570,7 +3173,7 @@ @@ -2570,7 +3171,7 @@
return; return;
} }
@ -1113,7 +1111,7 @@
{ {
if (this.field_147481_N) if (this.field_147481_N)
{ {
@@ -2612,6 +3215,9 @@ @@ -2612,6 +3213,9 @@
public void func_147457_a(TileEntity p_147457_1_) public void func_147457_a(TileEntity p_147457_1_)
{ {
@ -1123,7 +1121,7 @@
this.field_147483_b.add(p_147457_1_); this.field_147483_b.add(p_147457_1_);
} }
@@ -2718,7 +3324,15 @@ @@ -2718,7 +3322,15 @@
if (i <= 0) if (i <= 0)
{ {
@ -1140,7 +1138,7 @@
} }
} }
@@ -2754,7 +3368,15 @@ @@ -2754,7 +3366,15 @@
if (j <= 0) if (j <= 0)
{ {
@ -1157,7 +1155,7 @@
} }
} }
@@ -2777,8 +3399,41 @@ @@ -2777,8 +3397,41 @@
protected void setActivePlayerChunksAndCheckLight() protected void setActivePlayerChunksAndCheckLight()
{ {
this.activeChunkSet.clear(); this.activeChunkSet.clear();
@ -1200,7 +1198,7 @@
int i; int i;
EntityPlayer entityplayer; EntityPlayer entityplayer;
int j; int j;
@@ -2788,17 +3443,28 @@ @@ -2788,17 +3441,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);
@ -1235,7 +1233,7 @@
} }
this.theProfiler.endSection(); this.theProfiler.endSection();
@@ -2810,7 +3476,7 @@ @@ -2810,7 +3474,7 @@
this.theProfiler.startSection("playerCheckLight"); this.theProfiler.startSection("playerCheckLight");
@ -1244,7 +1242,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);
@@ -3034,9 +3700,9 @@ @@ -3034,9 +3698,9 @@
} }
} }
@ -1256,7 +1254,7 @@
{ {
return false; return false;
} }
@@ -3166,6 +3832,16 @@ @@ -3166,6 +3830,16 @@
} }
} }
@ -1273,7 +1271,7 @@
this.theProfiler.endSection(); this.theProfiler.endSection();
return true; return true;
} }
@@ -3284,8 +3960,21 @@ @@ -3284,8 +3958,21 @@
{ {
Entity entity = (Entity)this.loadedEntityList.get(j); Entity entity = (Entity)this.loadedEntityList.get(j);
@ -1296,7 +1294,7 @@
++i; ++i;
} }
} }
@@ -3298,6 +3987,7 @@ @@ -3298,6 +3985,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);
@ -1304,7 +1302,7 @@
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 +4004,17 @@ @@ -3314,8 +4002,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_);
@ -1323,7 +1321,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 +4163,12 @@ @@ -3464,6 +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);
@ -1336,7 +1334,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 +4194,12 @@ @@ -3489,7 +4192,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);
@ -1350,7 +1348,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 +4370,18 @@ @@ -3660,6 +4368,18 @@
public void updateAllPlayersSleepingFlag() {} public void updateAllPlayersSleepingFlag() {}
@ -1369,7 +1367,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 +4654,8 @@ @@ -3932,8 +4652,8 @@
*/ */
public void addTileEntity(TileEntity entity) public void addTileEntity(TileEntity entity)
{ {
@ -1380,7 +1378,7 @@
{ {
dest.add(entity); dest.add(entity);
} }
@@ -4029,4 +4751,122 @@ @@ -4029,4 +4749,122 @@
} }
return count; return count;
} }