Upstream Paper

This commit is contained in:
Sotr
2018-07-30 21:56:14 +08:00
parent 601ec9e90d
commit b743d7dc4c
4 changed files with 8 additions and 4 deletions

View File

@@ -982,6 +982,8 @@ public class Chunk {
}
}
// Spigot End
entity.setCurrentChunk(null); // Paper
entity.entitySlice = null; // Paper
// Do not pass along players, as doing so can get them stuck outside of time.
// (which for example disables inventory icon updates and prevents block breaking)

View File

@@ -85,7 +85,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
private static final List<ItemStack> b = Collections.emptyList();
private static final AxisAlignedBB c = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D);
private static double f = 1.0D;
private static int entityCount;
private static int entityCount = 1; // Paper - MC-111480 - ID 0 is treated as special for DataWatchers, start 1
private int id;
public boolean i; public boolean blocksEntitySpawning() { return i; } // Paper - OBFHELPER
public final List<Entity> passengers;
@@ -345,6 +345,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
this.locX = d0;
this.locY = d1;
this.locZ = d2;
if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk
float f = this.width / 2.0F;
float f1 = this.length;
@@ -990,6 +991,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
this.locX = (axisalignedbb.a + axisalignedbb.d) / 2.0D;
this.locY = axisalignedbb.b;
this.locZ = (axisalignedbb.c + axisalignedbb.f) / 2.0D;
if (valid) world.entityJoinedWorld(this, false); // Paper - ensure Entity is moved to its proper chunk
}
protected SoundEffect ae() {
@@ -1792,7 +1794,7 @@ public abstract class Entity implements ICommandListener, KeyedObject { // Paper
*/
public Chunk getCurrentChunk() {
final Chunk chunk = currentChunk != null ? currentChunk.get() : null;
return chunk != null && chunk.isLoaded() ? chunk : null;
return chunk != null && chunk.isLoaded() ? chunk : (isAddedToChunk() ? world.getChunkIfLoaded(getChunkX(), getChunkZ()) : null);
}
/**
* Returns the chunk at the location, using the entities local cache if avail

View File

@@ -1960,7 +1960,7 @@ public abstract class World implements IBlockAccess {
this.getChunkAt(entity.ab, entity.ad).a(entity, entity.ac);
}
if (!entity.bD() && !this.isChunkLoaded(i, k, true)) {
if (false && !entity.bD() && !this.isChunkLoaded(i, k, true)) { // Paper - Always send entities into a new chunk, never lose them
entity.aa = false;
} else {
this.getChunkAt(i, k).a(entity);