Just only hold the last BlockState update for the same location. This fixes SPIGOT-44

Dieser Commit ist enthalten in:
Fabian Faßbender 2014-11-29 19:08:50 +01:00
Ursprung 26672b7db8
Commit 4d0f5edb05

Datei anzeigen

@ -1,5 +1,5 @@
--- ../work/decompile-8eb82bde//net/minecraft/server/World.java 2014-11-28 17:43:43.433707428 +0000 --- ../work/decompile-8eb82bde//net/minecraft/server/World.java Sat Nov 29 18:03:51 2014
+++ src/main/java/net/minecraft/server/World.java 2014-11-28 17:38:23.000000000 +0000 +++ src/main/java/net/minecraft/server/World.java Sat Nov 29 17:58:45 2014
@@ -13,6 +13,22 @@ @@ -13,6 +13,22 @@
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
@ -33,7 +33,7 @@
private int K; private int K;
public boolean allowMonsters; public boolean allowMonsters;
public boolean allowAnimals; public boolean allowAnimals;
@@ -55,7 +72,39 @@ @@ -55,7 +72,52 @@
private final WorldBorder M; private final WorldBorder M;
int[] H; int[] H;
@ -46,7 +46,20 @@
+ +
+ public boolean captureBlockStates = false; + public boolean captureBlockStates = false;
+ public boolean captureTreeGeneration = false; + public boolean captureTreeGeneration = false;
+ public ArrayList<BlockState> capturedBlockStates= new ArrayList<BlockState>(); + public ArrayList<BlockState> capturedBlockStates= new ArrayList<BlockState>(){
+ @Override
+ public boolean add( BlockState blockState ) {
+ Iterator<BlockState> blockStateIterator = this.iterator();
+ while( blockStateIterator.hasNext() ) {
+ BlockState blockState1 = blockStateIterator.next();
+ if ( blockState1.getLocation().equals( blockState.getLocation() ) ) {
+ blockStateIterator.remove();
+ }
+ }
+
+ return super.add( blockState );
+ }
+ };
+ public long ticksPerAnimalSpawns; + public long ticksPerAnimalSpawns;
+ public long ticksPerMonsterSpawns; + public long ticksPerMonsterSpawns;
+ public boolean populating; + public boolean populating;
@ -74,7 +87,7 @@
this.K = this.random.nextInt(12000); this.K = this.random.nextInt(12000);
this.allowMonsters = true; this.allowMonsters = true;
this.allowAnimals = true; this.allowAnimals = true;
@@ -66,6 +115,8 @@ @@ -66,6 +128,8 @@
this.worldProvider = worldprovider; this.worldProvider = worldprovider;
this.isStatic = flag; this.isStatic = flag;
this.M = worldprovider.getWorldBorder(); this.M = worldprovider.getWorldBorder();
@ -83,7 +96,7 @@
} }
public World b() { public World b() {
@@ -184,6 +235,27 @@ @@ -184,6 +248,27 @@
} }
public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) { public boolean setTypeAndData(BlockPosition blockposition, IBlockData iblockdata, int i) {
@ -111,7 +124,7 @@
if (!this.isValidLocation(blockposition)) { if (!this.isValidLocation(blockposition)) {
return false; return false;
} else if (!this.isStatic && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) { } else if (!this.isStatic && this.worldData.getType() == WorldType.DEBUG_ALL_BLOCK_STATES) {
@@ -191,9 +263,23 @@ @@ -191,9 +276,24 @@
} else { } else {
Chunk chunk = this.getChunkAtWorldCoords(blockposition); Chunk chunk = this.getChunkAtWorldCoords(blockposition);
Block block = iblockdata.getBlock(); Block block = iblockdata.getBlock();
@ -120,6 +133,7 @@
+ BlockState blockstate = null; + BlockState blockstate = null;
+ if (this.captureBlockStates) { + if (this.captureBlockStates) {
+ blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), i); + blockstate = org.bukkit.craftbukkit.block.CraftBlockState.getBlockState(this, blockposition.getX(), blockposition.getY(), blockposition.getZ(), i);
+ System.out.println(blockposition + " - " + i);
+ this.capturedBlockStates.add(blockstate); + this.capturedBlockStates.add(blockstate);
+ } + }
+ // CraftBukkit end + // CraftBukkit end
@ -135,7 +149,7 @@
return false; return false;
} else { } else {
Block block1 = iblockdata1.getBlock(); Block block1 = iblockdata1.getBlock();
@@ -204,6 +290,7 @@ @@ -204,6 +304,7 @@
this.methodProfiler.b(); this.methodProfiler.b();
} }
@ -143,7 +157,7 @@
if ((i & 2) != 0 && (!this.isStatic || (i & 4) == 0) && chunk.isReady()) { if ((i & 2) != 0 && (!this.isStatic || (i & 4) == 0) && chunk.isReady()) {
this.notify(blockposition); this.notify(blockposition);
} }
@@ -214,12 +301,35 @@ @@ -214,12 +315,35 @@
this.updateAdjacentComparators(blockposition, block); this.updateAdjacentComparators(blockposition, block);
} }
} }
@ -179,7 +193,7 @@
public boolean setAir(BlockPosition blockposition) { public boolean setAir(BlockPosition blockposition) {
return this.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3); return this.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
} }
@@ -253,6 +363,11 @@ @@ -253,6 +377,11 @@
public void update(BlockPosition blockposition, Block block) { public void update(BlockPosition blockposition, Block block) {
if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) { if (this.worldData.getType() != WorldType.DEBUG_ALL_BLOCK_STATES) {
@ -191,7 +205,7 @@
this.applyPhysics(blockposition, block); this.applyPhysics(blockposition, block);
} }
@@ -328,6 +443,17 @@ @@ -328,6 +457,17 @@
IBlockData iblockdata = this.getType(blockposition); IBlockData iblockdata = this.getType(blockposition);
try { try {
@ -209,7 +223,7 @@
iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block); iblockdata.getBlock().doPhysics(this, blockposition, iblockdata, block);
} catch (Throwable throwable) { } catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours"); CrashReport crashreport = CrashReport.a(throwable, "Exception while updating neighbours");
@@ -497,6 +623,17 @@ @@ -497,6 +637,17 @@
} }
public IBlockData getType(BlockPosition blockposition) { public IBlockData getType(BlockPosition blockposition) {
@ -227,7 +241,7 @@
if (!this.isValidLocation(blockposition)) { if (!this.isValidLocation(blockposition)) {
return Blocks.AIR.getBlockData(); return Blocks.AIR.getBlockData();
} else { } else {
@@ -704,6 +841,13 @@ @@ -704,6 +855,13 @@
} }
public boolean addEntity(Entity entity) { public boolean addEntity(Entity entity) {
@ -241,7 +255,7 @@
int i = MathHelper.floor(entity.locX / 16.0D); int i = MathHelper.floor(entity.locX / 16.0D);
int j = MathHelper.floor(entity.locZ / 16.0D); int j = MathHelper.floor(entity.locZ / 16.0D);
boolean flag = entity.attachedToPlayer; boolean flag = entity.attachedToPlayer;
@@ -712,7 +856,35 @@ @@ -712,7 +870,35 @@
flag = true; flag = true;
} }
@ -277,7 +291,7 @@
return false; return false;
} else { } else {
if (entity instanceof EntityHuman) { if (entity instanceof EntityHuman) {
@@ -734,6 +906,7 @@ @@ -734,6 +920,7 @@
((IWorldAccess) this.u.get(i)).a(entity); ((IWorldAccess) this.u.get(i)).a(entity);
} }
@ -285,7 +299,7 @@
} }
protected void b(Entity entity) { protected void b(Entity entity) {
@@ -741,6 +914,7 @@ @@ -741,6 +928,7 @@
((IWorldAccess) this.u.get(i)).b(entity); ((IWorldAccess) this.u.get(i)).b(entity);
} }
@ -293,7 +307,7 @@
} }
public void kill(Entity entity) { public void kill(Entity entity) {
@@ -775,7 +949,15 @@ @@ -775,7 +963,15 @@
this.getChunkAt(i, j).b(entity); this.getChunkAt(i, j).b(entity);
} }
@ -310,7 +324,7 @@
this.b(entity); this.b(entity);
} }
@@ -958,6 +1140,11 @@ @@ -958,6 +1154,11 @@
for (i = 0; i < this.k.size(); ++i) { for (i = 0; i < this.k.size(); ++i) {
entity = (Entity) this.k.get(i); entity = (Entity) this.k.get(i);
@ -322,7 +336,7 @@
try { try {
++entity.ticksLived; ++entity.ticksLived;
@@ -1001,8 +1188,10 @@ @@ -1001,8 +1202,10 @@
this.g.clear(); this.g.clear();
this.methodProfiler.c("regular"); this.methodProfiler.c("regular");
@ -335,7 +349,7 @@
if (entity.vehicle != null) { if (entity.vehicle != null) {
if (!entity.vehicle.dead && entity.vehicle.passenger == entity) { if (!entity.vehicle.dead && entity.vehicle.passenger == entity) {
continue; continue;
@@ -1033,7 +1222,7 @@ @@ -1033,7 +1236,7 @@
this.getChunkAt(j, k).b(entity); this.getChunkAt(j, k).b(entity);
} }
@ -344,7 +358,7 @@
this.b(entity); this.b(entity);
} }
@@ -1042,6 +1231,14 @@ @@ -1042,6 +1245,14 @@
this.methodProfiler.c("blockEntities"); this.methodProfiler.c("blockEntities");
this.L = true; this.L = true;
@ -359,7 +373,7 @@
Iterator iterator = this.tileEntityList.iterator(); Iterator iterator = this.tileEntityList.iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
@@ -1073,11 +1270,13 @@ @@ -1073,11 +1284,13 @@
} }
this.L = false; this.L = false;
@ -373,7 +387,7 @@
this.methodProfiler.c("pendingBlockEntities"); this.methodProfiler.c("pendingBlockEntities");
if (!this.a.isEmpty()) { if (!this.a.isEmpty()) {
@@ -1085,9 +1284,11 @@ @@ -1085,9 +1298,11 @@
TileEntity tileentity1 = (TileEntity) this.a.get(l); TileEntity tileentity1 = (TileEntity) this.a.get(l);
if (!tileentity1.x()) { if (!tileentity1.x()) {
@ -385,7 +399,7 @@
if (this.isLoaded(tileentity1.getPosition())) { if (this.isLoaded(tileentity1.getPosition())) {
this.getChunkAtWorldCoords(tileentity1.getPosition()).a(tileentity1.getPosition(), tileentity1); this.getChunkAtWorldCoords(tileentity1.getPosition()).a(tileentity1.getPosition(), tileentity1);
@@ -1141,7 +1342,10 @@ @@ -1141,7 +1356,10 @@
int j = MathHelper.floor(entity.locZ); int j = MathHelper.floor(entity.locZ);
byte b0 = 32; byte b0 = 32;
@ -397,7 +411,7 @@
entity.P = entity.locX; entity.P = entity.locX;
entity.Q = entity.locY; entity.Q = entity.locY;
entity.R = entity.locZ; entity.R = entity.locZ;
@@ -1615,7 +1819,13 @@ @@ -1615,7 +1833,13 @@
--j; --j;
this.worldData.setThunderDuration(j); this.worldData.setThunderDuration(j);
if (j <= 0) { if (j <= 0) {
@ -412,7 +426,7 @@
} }
} }
@@ -1639,7 +1849,14 @@ @@ -1639,7 +1863,14 @@
--k; --k;
this.worldData.setWeatherDuration(k); this.worldData.setWeatherDuration(k);
if (k <= 0) { if (k <= 0) {
@ -428,7 +442,7 @@
} }
} }
@@ -1656,7 +1873,7 @@ @@ -1656,7 +1887,7 @@
} }
protected void D() { protected void D() {
@ -437,7 +451,7 @@
this.methodProfiler.a("buildList"); this.methodProfiler.a("buildList");
int i; int i;
@@ -1673,7 +1890,7 @@ @@ -1673,7 +1904,7 @@
for (int i1 = -l; i1 <= l; ++i1) { for (int i1 = -l; i1 <= l; ++i1) {
for (int j1 = -l; j1 <= l; ++j1) { for (int j1 = -l; j1 <= l; ++j1) {
@ -446,7 +460,7 @@
} }
} }
} }
@@ -1851,7 +2068,10 @@ @@ -1851,7 +2082,10 @@
} }
public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) { public boolean c(EnumSkyBlock enumskyblock, BlockPosition blockposition) {
@ -458,7 +472,7 @@
return false; return false;
} else { } else {
int i = 0; int i = 0;
@@ -2095,8 +2315,17 @@ @@ -2095,8 +2329,17 @@
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = (Entity) iterator.next(); Entity entity = (Entity) iterator.next();
@ -477,7 +491,7 @@
++i; ++i;
} }
} }
@@ -2105,12 +2334,17 @@ @@ -2105,12 +2348,17 @@
} }
public void b(Collection collection) { public void b(Collection collection) {
@ -497,7 +511,7 @@
this.a(entity); this.a(entity);
} }
@@ -2124,7 +2358,13 @@ @@ -2124,7 +2372,13 @@
Block block1 = this.getType(blockposition).getBlock(); Block block1 = this.getType(blockposition).getBlock();
AxisAlignedBB axisalignedbb = flag ? null : block.a(this, blockposition, block.getBlockData()); AxisAlignedBB axisalignedbb = flag ? null : block.a(this, blockposition, block.getBlockData());
@ -512,7 +526,7 @@
} }
public int getBlockPower(BlockPosition blockposition, EnumDirection enumdirection) { public int getBlockPower(BlockPosition blockposition, EnumDirection enumdirection) {
@@ -2215,6 +2455,11 @@ @@ -2215,6 +2469,11 @@
for (int i = 0; i < this.players.size(); ++i) { for (int i = 0; i < this.players.size(); ++i) {
EntityHuman entityhuman1 = (EntityHuman) this.players.get(i); EntityHuman entityhuman1 = (EntityHuman) this.players.get(i);
@ -524,7 +538,7 @@
if (IEntitySelector.d.apply(entityhuman1)) { if (IEntitySelector.d.apply(entityhuman1)) {
double d5 = entityhuman1.e(d0, d1, d2); double d5 = entityhuman1.e(d0, d1, d2);
@@ -2269,7 +2514,7 @@ @@ -2269,7 +2528,7 @@
return null; return null;
} }
@ -533,7 +547,7 @@
this.dataManager.checkSession(); this.dataManager.checkSession();
} }
@@ -2331,6 +2576,16 @@ @@ -2331,6 +2590,16 @@
public void everyoneSleeping() {} public void everyoneSleeping() {}
@ -550,7 +564,7 @@
public float h(float f) { public float h(float f) {
return (this.q + (this.r - this.q) * f) * this.j(f); return (this.q + (this.r - this.q) * f) * this.j(f);
} }
@@ -2538,6 +2793,6 @@ @@ -2538,6 +2807,6 @@
int l = j * 16 + 8 - blockposition.getZ(); int l = j * 16 + 8 - blockposition.getZ();
short short0 = 128; short short0 = 128;