#672: Add PersistentDataHolder to Chunk

By: Nesaak <52047222+Nesaak@users.noreply.github.com>
This commit is contained in:
CraftBukkit/Spigot
2020-10-17 17:37:49 +11:00
parent a3cf5aea1a
commit 071360817a
3 changed files with 79 additions and 13 deletions

View File

@@ -18,7 +18,7 @@
this.loc = chunkcoordintpair;
this.i = chunkconverter;
HeightMap.Type[] aheightmap_type = HeightMap.Type.values();
@@ -96,8 +96,19 @@
@@ -96,8 +96,22 @@
}
}
@@ -33,12 +33,15 @@
+
+ public boolean mustNotSave;
+ public boolean needsDecoration;
+
+ private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry();
+ public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY);
+ // CraftBukkit end
+
public Chunk(World world, ProtoChunk protochunk) {
this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null);
Iterator iterator = protochunk.y().iterator();
@@ -139,6 +150,7 @@
@@ -139,6 +153,7 @@
this.b(protochunk.r());
this.s = true;
@@ -46,7 +49,7 @@
}
@Override
@@ -229,9 +241,16 @@
@@ -229,9 +244,16 @@
}
}
@@ -63,7 +66,7 @@
int i = blockposition.getX() & 15;
int j = blockposition.getY();
int k = blockposition.getZ() & 15;
@@ -283,7 +302,8 @@
@@ -283,7 +305,8 @@
}
}
@@ -73,7 +76,7 @@
iblockdata.onPlace(this.world, blockposition, iblockdata1, flag);
}
@@ -378,7 +398,12 @@
@@ -378,7 +401,12 @@
@Nullable
public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) {
@@ -87,7 +90,7 @@
if (tileentity == null) {
NBTTagCompound nbttagcompound = (NBTTagCompound) this.e.remove(blockposition);
@@ -424,6 +449,13 @@
@@ -424,6 +452,13 @@
tileentity1.al_();
}
@@ -101,7 +104,7 @@
}
}
@@ -473,6 +505,50 @@
@@ -473,6 +508,50 @@
}
@@ -152,7 +155,7 @@
public void markDirty() {
this.s = true;
}
@@ -526,7 +602,7 @@
@@ -526,7 +605,7 @@
Iterator iterator = this.entitySlices[k].a(Entity.class).iterator();
while (iterator.hasNext()) {
@@ -161,7 +164,7 @@
if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) {
list.add(entity);
@@ -547,7 +623,7 @@
@@ -547,7 +626,7 @@
Iterator iterator = this.entitySlices[k].a(oclass).iterator();
while (iterator.hasNext()) {
@@ -170,7 +173,7 @@
if (t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) {
list.add(t0);
@@ -621,7 +697,7 @@
@@ -621,7 +700,7 @@
@Override
public boolean isNeedsSaving() {
@@ -179,7 +182,7 @@
}
public void d(boolean flag) {
@@ -763,7 +839,7 @@
@@ -763,7 +842,7 @@
public void B() {
if (this.o instanceof ProtoChunkTickList) {
@@ -188,7 +191,7 @@
return this.getType(blockposition).getBlock();
});
this.o = TickListEmpty.b();
@@ -773,7 +849,7 @@
@@ -773,7 +852,7 @@
}
if (this.p instanceof ProtoChunkTickList) {
@@ -197,7 +200,7 @@
return this.getFluid(blockposition).getType();
});
this.p = TickListEmpty.b();
@@ -785,12 +861,12 @@
@@ -785,12 +864,12 @@
}
public void a(WorldServer worldserver) {