1
0
forked from xjboss/KCauldronX

修复方块不更新的bug

This commit is contained in:
聪聪 2017-07-04 22:30:53 +08:00
parent 4600900a0f
commit 9dc4f12762
2 changed files with 54 additions and 39 deletions

View File

@ -551,7 +551,7 @@
if (p_147465_1_ >= -30000000 && p_147465_3_ >= -30000000 && p_147465_1_ < 30000000 && p_147465_3_ < 30000000)
{
if (p_147465_2_ < 0)
@@ -435,32 +770,29 @@
@@ -435,32 +770,31 @@
{
Chunk chunk = this.getChunkFromChunkCoords(p_147465_1_ >> 4, p_147465_3_ >> 4);
Block block1 = null;
@ -580,6 +580,8 @@
- blockSnapshot = null;
+ if(flag&&tSnapshot!=null){
+ tBlockCapture.addCapturedBlock(tSnapshot);
+ }else{
+ tSnapshot=null;
}
this.theProfiler.startSection("checkLight");
@ -588,11 +590,11 @@
- if (flag && blockSnapshot == null) // Don't notify clients or update physics while capturing blockstates
+ // Cauldron add !this.captureBlockStates
+ if (flag && tBlockCapture != null&&tBlockCapture.mEnable) // Don't notify clients or update physics while capturing blockstates
+ if (flag && tSnapshot == null) // Don't notify clients or update physics while capturing blockstates
{
// Modularize client and physic updates
this.markAndNotifyBlock(p_147465_1_, p_147465_2_, p_147465_3_, chunk, block1, p_147465_4_, p_147465_6_);
@@ -496,6 +828,20 @@
@@ -496,6 +830,20 @@
public int getBlockMetadata(int p_72805_1_, int p_72805_2_, int p_72805_3_)
{
@ -613,7 +615,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 +857,7 @@
@@ -511,7 +859,7 @@
Chunk chunk = this.getChunkFromChunkCoords(p_72805_1_ >> 4, p_72805_3_ >> 4);
p_72805_1_ &= 15;
p_72805_3_ &= 15;
@ -622,7 +624,7 @@
}
}
else
@@ -610,6 +956,12 @@
@@ -610,6 +958,12 @@
public void notifyBlockChange(int p_147444_1_, int p_147444_2_, int p_147444_3_, Block p_147444_4_)
{
@ -635,7 +637,7 @@
this.notifyBlocksOfNeighborChange(p_147444_1_, p_147444_2_, p_147444_3_, p_147444_4_);
}
@@ -694,6 +1046,21 @@
@@ -694,6 +1048,21 @@
try
{
@ -657,7 +659,7 @@
block.onNeighborBlockChange(this, p_147460_1_, p_147460_2_, p_147460_3_, p_147460_4_);
}
catch (Throwable throwable1)
@@ -1307,8 +1674,22 @@
@@ -1307,8 +1676,22 @@
public boolean spawnEntityInWorld(Entity p_72838_1_)
{
@ -681,7 +683,7 @@
int i = MathHelper.floor_double(p_72838_1_.posX / 16.0D);
int j = MathHelper.floor_double(p_72838_1_.posZ / 16.0D);
@@ -1319,23 +1700,99 @@
@@ -1319,23 +1702,99 @@
flag = true;
}
@ -783,7 +785,7 @@
return true;
}
}
@@ -1346,6 +1803,8 @@
@@ -1346,6 +1805,8 @@
{
((IWorldAccess)this.worldAccesses.get(i)).onEntityCreate(p_72923_1_);
}
@ -792,7 +794,7 @@
}
public void onEntityRemoved(Entity p_72847_1_)
@@ -1354,6 +1813,8 @@
@@ -1354,6 +1815,8 @@
{
((IWorldAccess)this.worldAccesses.get(i)).onEntityDestroy(p_72847_1_);
}
@ -801,7 +803,7 @@
}
public void removeEntity(Entity p_72900_1_)
@@ -1397,6 +1858,19 @@
@@ -1397,6 +1860,19 @@
}
this.loadedEntityList.remove(p_72973_1_);
@ -821,7 +823,7 @@
this.onEntityRemoved(p_72973_1_);
}
@@ -1408,40 +1882,58 @@
@@ -1408,40 +1884,58 @@
public List getCollidingBoundingBoxes(Entity p_72945_1_, AxisAlignedBB p_72945_2_)
{
this.collidingBoundingBoxes.clear();
@ -894,7 +896,7 @@
for (int j2 = 0; j2 < list.size(); ++j2)
{
@@ -1797,11 +2289,22 @@
@@ -1797,11 +2291,22 @@
Entity entity;
CrashReport crashreport;
CrashReportCategory crashreportcategory;
@ -917,7 +919,7 @@
try
{
++entity.ticksExisted;
@@ -1812,14 +2315,7 @@
@@ -1812,14 +2317,7 @@
crashreport = CrashReport.makeCrashReport(throwable2, "Ticking entity");
crashreportcategory = crashreport.makeCategory("Entity being ticked");
@ -933,7 +935,7 @@
if (ForgeModContainer.removeErroringEntities)
{
@@ -1862,10 +2358,14 @@
@@ -1862,10 +2360,14 @@
this.unloadedEntityList.clear();
this.theProfiler.endStartSection("regular");
@ -951,7 +953,7 @@
if (entity.ridingEntity != null)
{
@@ -1884,7 +2384,9 @@
@@ -1884,7 +2386,9 @@
{
try
{
@ -961,7 +963,7 @@
}
catch (Throwable throwable1)
{
@@ -1916,30 +2418,84 @@
@@ -1916,30 +2420,84 @@
{
this.getChunkFromChunkCoords(j, l).removeEntity(entity);
}
@ -1053,7 +1055,7 @@
crashreport = CrashReport.makeCrashReport(throwable, "Ticking block entity");
crashreportcategory = crashreport.makeCategory("Block entity being ticked");
tileentity.func_145828_a(crashreportcategory);
@@ -1955,23 +2511,13 @@
@@ -1955,23 +2513,13 @@
}
}
}
@ -1082,7 +1084,7 @@
if (!this.field_147483_b.isEmpty())
{
for (Object tile : field_147483_b)
@@ -1981,6 +2527,7 @@
@@ -1981,6 +2529,7 @@
this.loadedTileEntityList.removeAll(this.field_147483_b);
this.field_147483_b.clear();
}
@ -1090,7 +1092,7 @@
this.field_147481_N = false;
@@ -2016,17 +2563,23 @@
@@ -2016,17 +2565,23 @@
this.addedTileEntityList.clear();
}
@ -1117,7 +1119,7 @@
}
public void updateEntity(Entity p_72870_1_)
@@ -2036,21 +2589,41 @@
@@ -2036,21 +2591,41 @@
public void updateEntityWithOptionalForce(Entity p_72866_1_, boolean p_72866_2_)
{
@ -1161,7 +1163,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 +2707,7 @@
@@ -2134,6 +2709,7 @@
p_72866_1_.riddenByEntity = null;
}
}
@ -1169,7 +1171,7 @@
}
}
@@ -2570,7 +3144,7 @@
@@ -2570,7 +3146,7 @@
return;
}
@ -1178,7 +1180,7 @@
{
if (this.field_147481_N)
{
@@ -2612,6 +3186,9 @@
@@ -2612,6 +3188,9 @@
public void func_147457_a(TileEntity p_147457_1_)
{
@ -1188,7 +1190,7 @@
this.field_147483_b.add(p_147457_1_);
}
@@ -2718,7 +3295,15 @@
@@ -2718,7 +3297,15 @@
if (i <= 0)
{
@ -1205,7 +1207,7 @@
}
}
@@ -2754,7 +3339,15 @@
@@ -2754,7 +3341,15 @@
if (j <= 0)
{
@ -1222,7 +1224,7 @@
}
}
@@ -2777,8 +3370,41 @@
@@ -2777,8 +3372,41 @@
protected void setActivePlayerChunksAndCheckLight()
{
this.activeChunkSet.clear();
@ -1265,7 +1267,7 @@
int i;
EntityPlayer entityplayer;
int j;
@@ -2788,17 +3414,28 @@
@@ -2788,17 +3416,28 @@
for (i = 0; i < this.playerEntities.size(); ++i)
{
entityplayer = (EntityPlayer)this.playerEntities.get(i);
@ -1300,7 +1302,7 @@
}
this.theProfiler.endSection();
@@ -2810,7 +3447,7 @@
@@ -2810,7 +3449,7 @@
this.theProfiler.startSection("playerCheckLight");
@ -1309,7 +1311,7 @@
{
i = this.rand.nextInt(this.playerEntities.size());
entityplayer = (EntityPlayer)this.playerEntities.get(i);
@@ -3034,9 +3671,9 @@
@@ -3034,9 +3673,9 @@
}
}
@ -1321,7 +1323,7 @@
{
return false;
}
@@ -3166,6 +3803,16 @@
@@ -3166,6 +3805,16 @@
}
}
@ -1338,7 +1340,7 @@
this.theProfiler.endSection();
return true;
}
@@ -3284,8 +3931,21 @@
@@ -3284,8 +3933,21 @@
{
Entity entity = (Entity)this.loadedEntityList.get(j);
@ -1361,7 +1363,7 @@
++i;
}
}
@@ -3298,6 +3958,7 @@
@@ -3298,6 +3960,7 @@
for (int i = 0; i < p_72868_1_.size(); ++i)
{
Entity entity = (Entity)p_72868_1_.get(i);
@ -1369,7 +1371,7 @@
if (!MinecraftForge.EVENT_BUS.post(new EntityJoinWorldEvent(entity, this)))
{
loadedEntityList.add(entity);
@@ -3314,8 +3975,17 @@
@@ -3314,8 +3977,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_);
@ -1388,7 +1390,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 +4134,12 @@
@@ -3464,6 +4136,12 @@
for (int i = 0; i < this.playerEntities.size(); ++i)
{
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
@ -1401,7 +1403,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 +4165,12 @@
@@ -3489,7 +4167,12 @@
for (int i = 0; i < this.playerEntities.size(); ++i)
{
EntityPlayer entityplayer1 = (EntityPlayer)this.playerEntities.get(i);
@ -1415,7 +1417,7 @@
if (!entityplayer1.capabilities.disableDamage && entityplayer1.isEntityAlive())
{
double d5 = entityplayer1.getDistanceSq(p_72846_1_, p_72846_3_, p_72846_5_);
@@ -3660,6 +4341,18 @@
@@ -3660,6 +4343,18 @@
public void updateAllPlayersSleepingFlag() {}
@ -1434,7 +1436,7 @@
public float getWeightedThunderStrength(float p_72819_1_)
{
return (this.prevThunderingStrength + (this.thunderingStrength - this.prevThunderingStrength) * p_72819_1_) * this.getRainStrength(p_72819_1_);
@@ -3932,8 +4625,8 @@
@@ -3932,8 +4627,8 @@
*/
public void addTileEntity(TileEntity entity)
{
@ -1445,7 +1447,7 @@
{
dest.add(entity);
}
@@ -4029,4 +4722,122 @@
@@ -4029,4 +4724,122 @@
}
return count;
}

View File

@ -10,6 +10,7 @@ import cc.Location;
import cc.capture.EntitySnapshot;
import cc.capture.ItemSnapshot;
import cc.capture.WorldCapture;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
@ -127,6 +128,18 @@ public class CaptureBlock extends ACapture{
}
tResult=false;
}else{
for(BlockSnapshot tSnapshot : this.mCapturedBlocks){
int tBlockX=tSnapshot.x;
int tBlockY=tSnapshot.y;
int tBlockZ=tSnapshot.z;
int tMetadata=this.mWorld.getBlockMetadata(tBlockX,tBlockY,tBlockZ);
Block tOldBlock=tSnapshot.replacedBlock;
Block tNewBlock=this.mWorld.getBlock(tBlockX,tBlockY,tBlockZ);
if(tNewBlock!=null&&!(tNewBlock.hasTileEntity(tMetadata))){
tNewBlock.onBlockAdded(this.mWorld,tBlockX,tBlockY,tBlockZ);
}
this.mWorld.markAndNotifyBlock(tBlockX,tBlockY,tBlockZ,null,tOldBlock,tNewBlock,tSnapshot.flag);
}
for(EntitySnapshot sSnapshot : this.mCapturedEntitys){
sSnapshot.apply();
}