Updated Upstream (Paper & Tuinity)

Upstream has released updates that appears to apply and compile correctly

Paper Changes:
6f66fa571 Fix Light Thread causing world memory leak - Fixes #4045
674230907 Improve EntityTargetLivingEntityEvent for 1.16 mobs

Tuinity Changes:
30dc21f Notify poi changes in setTypeAndDataRaw
This commit is contained in:
William Blake Galbreath
2020-08-06 20:47:38 -05:00
parent 60ce52a46b
commit d6d9539cd2
5 changed files with 41 additions and 29 deletions

2
Paper

Submodule Paper updated: 9788250b10...6f66fa5714

View File

@@ -1 +1 @@
1.16.1--57ffa5163aff13683299c03bda1dc3e019c523f4
1.16.1--e2ec806ca4dcf4854e569776c890609c89ca46c1

View File

@@ -4017,7 +4017,7 @@ index c14cdb6024..8ec21eb955 100644
if (chunk != null) {
playerchunkmap.callbackExecutor.execute(() -> {
diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java
index 5c5ee28f23..46d8beae87 100644
index 03a79ff992..d59ef07e1c 100644
--- a/src/main/java/net/minecraft/server/PlayerChunkMap.java
+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java
@@ -119,31 +119,28 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -4087,10 +4087,11 @@ index 5c5ee28f23..46d8beae87 100644
int chunkX = MCUtil.getChunkCoordinate(player.locX());
int chunkZ = MCUtil.getChunkCoordinate(player.locZ());
// Note: players need to be explicitly added to distance maps before they can be updated
@@ -275,6 +275,29 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
@@ -276,6 +276,30 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// Paper end
private final java.util.concurrent.ExecutorService lightThread;
+
+ // Tuinity start
+ public static enum RegionData implements com.tuinity.tuinity.chunk.SingleThreadChunkRegionManager.RegionDataCreator<RegionData> {
+ // Tuinity start - optimise notify()
@@ -4117,7 +4118,7 @@ index 5c5ee28f23..46d8beae87 100644
public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler<Runnable> iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier<WorldPersistentData> supplier, int i, boolean flag) {
super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag);
//this.visibleChunks = this.updatingChunks.clone(); // Paper - no more cloning
@@ -441,6 +464,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -442,6 +466,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
PlayerChunkMap.this.sendChunk(player, new ChunkCoordIntPair(rangeX, rangeZ), null, true, false); // unloaded, loaded
});
// Paper end - no-tick view distance
@@ -4127,7 +4128,7 @@ index 5c5ee28f23..46d8beae87 100644
}
// Paper start - Chunk Prioritization
public void queueHolderUpdate(PlayerChunk playerchunk) {
@@ -753,6 +779,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -754,6 +781,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@Nullable
private PlayerChunk a(long i, int j, @Nullable PlayerChunk playerchunk, int k) {
@@ -4135,7 +4136,7 @@ index 5c5ee28f23..46d8beae87 100644
if (k > PlayerChunkMap.GOLDEN_TICKET && j > PlayerChunkMap.GOLDEN_TICKET) {
return playerchunk;
} else {
@@ -775,6 +802,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -776,6 +804,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
playerchunk.a(j);
} else {
playerchunk = new PlayerChunk(new ChunkCoordIntPair(i), j, this.lightEngine, this.p, this);
@@ -4143,7 +4144,7 @@ index 5c5ee28f23..46d8beae87 100644
}
this.updatingChunks.put(i, playerchunk);
@@ -966,7 +994,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -968,7 +997,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, chunkPos.x, chunkPos.z,
@@ -4152,7 +4153,7 @@ index 5c5ee28f23..46d8beae87 100644
if (!chunk.isNeedsSaving()) {
return;
@@ -1000,7 +1028,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1002,7 +1031,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
asyncSaveData = ChunkRegionLoader.getAsyncSaveData(this.world, chunk);
}
@@ -4161,7 +4162,7 @@ index 5c5ee28f23..46d8beae87 100644
asyncSaveData, chunk);
chunk.setLastSaved(this.world.getTime());
@@ -1039,6 +1067,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1041,6 +1070,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
this.lightEngine.a(ichunkaccess.getPos());
this.lightEngine.queueUpdate();
this.worldLoadListener.a(ichunkaccess.getPos(), (ChunkStatus) null);
@@ -4169,7 +4170,7 @@ index 5c5ee28f23..46d8beae87 100644
}
}
@@ -1055,6 +1084,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1057,6 +1087,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
protected boolean b() {
@@ -4177,7 +4178,7 @@ index 5c5ee28f23..46d8beae87 100644
if (!this.updatingChunksModified) {
return false;
} else {
@@ -1242,7 +1272,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1244,7 +1275,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
// Paper end
this.mailboxWorldGen.a(ChunkTaskQueueSorter.a(playerchunk, runnable));
@@ -4189,7 +4190,7 @@ index 5c5ee28f23..46d8beae87 100644
}
protected void c(ChunkCoordIntPair chunkcoordintpair) {
@@ -1494,6 +1527,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1496,6 +1530,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
}
public void setViewDistance(int i) { // Paper - public
@@ -4197,7 +4198,7 @@ index 5c5ee28f23..46d8beae87 100644
int j = MathHelper.clamp(i + 1, 3, 33); // Paper - diff on change, these make the lower view distance limit 2 and the upper 32
if (j != this.viewDistance) {
@@ -1507,6 +1541,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -1509,6 +1544,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
// Paper start - no-tick view distance
public final void setNoTickViewDistance(int viewDistance) {
@@ -4205,7 +4206,7 @@ index 5c5ee28f23..46d8beae87 100644
viewDistance = viewDistance == -1 ? -1 : MathHelper.clamp(viewDistance, 2, 32);
this.noTickViewDistance = viewDistance;
@@ -2033,23 +2068,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
@@ -2035,23 +2071,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
private final void processTrackQueue() {
this.world.timings.tracker1.startTiming();
try {
@@ -6288,7 +6289,7 @@ index 1fa7061f7a..52aee91d2d 100644
return voxelshape != b() && voxelshape1 != b() ? (voxelshape.isEmpty() && voxelshape1.isEmpty() ? false : !c(b(), b(voxelshape, voxelshape1, OperatorBoolean.OR), OperatorBoolean.ONLY_FIRST)) : true;
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index a173d2562e..21f34b82f0 100644
index a173d2562e..8c47db51a0 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -94,6 +94,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -6308,20 +6309,23 @@ index a173d2562e..21f34b82f0 100644
this.generator = gen;
this.world = new CraftWorld((WorldServer) this, gen, env);
this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
@@ -397,13 +400,38 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -397,13 +400,41 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
}
+ // Tuinity start
+ // Does not affect TE. This simply just a raw set type - runs no logic.
+ final void setTypeAndDataRaw(final BlockPosition pos, final IBlockData blockData, final TileEntity tileEntity) {
+ this.getChunkAt(pos.getX() >> 4, pos.getZ() >> 4).setTypeAndDataRaw(pos, blockData);
+ Chunk chunk = this.getChunkAt(pos.getX() >> 4, pos.getZ() >> 4);
+ IBlockData old = chunk.getType(pos);
+ chunk.setTypeAndDataRaw(pos, blockData);
+ if (tileEntity == null) {
+ this.removeTileEntity(pos);
+ } else {
+ this.setTileEntity(pos, tileEntity);
+ }
+ ((WorldServer)this).getChunkProvider().flagDirty(pos);
+ this.notifyPoiChange(pos, old, blockData);
+ }
+ // Tuinity end
+
@@ -6348,7 +6352,7 @@ index a173d2562e..21f34b82f0 100644
// CraftBukkit start - tree generation
if (this.captureTreeGeneration) {
// Paper start
@@ -436,7 +464,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -436,7 +467,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
// CraftBukkit end
@@ -6357,7 +6361,7 @@ index a173d2562e..21f34b82f0 100644
this.chunkPacketBlockController.onBlockChange(this, blockposition, iblockdata, iblockdata1, i); // Paper - Anti-Xray
if (iblockdata1 == null) {
@@ -504,6 +532,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -504,6 +535,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
// CraftBukkit start - Split off from above in order to directly send client and physic updates
public void notifyAndUpdatePhysics(BlockPosition blockposition, Chunk chunk, IBlockData oldBlock, IBlockData newBlock, IBlockData actualBlock, int i, int j) {
@@ -6365,7 +6369,15 @@ index a173d2562e..21f34b82f0 100644
IBlockData iblockdata = newBlock;
IBlockData iblockdata1 = oldBlock;
IBlockData iblockdata2 = actualBlock;
@@ -936,6 +965,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -552,6 +584,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
}
// CraftBukkit end
+ public final void notifyPoiChange(BlockPosition blockposition, IBlockData old, IBlockData neww) { this.a(blockposition, old, neww); } // Tuinity - OBFHELPER
public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {}
public boolean setAir(BlockPosition blockposition) { return this.a(blockposition, false); } // Paper - OBFHELPER
@@ -936,6 +969,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return;
// Paper end
}
@@ -6373,7 +6385,7 @@ index a173d2562e..21f34b82f0 100644
}
// Paper start - Prevent armor stands from doing entity lookups
@Override
@@ -1031,7 +1061,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1031,7 +1065,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
while (iterator.hasNext()) {
TileEntity tileentity1 = (TileEntity) iterator.next();
@@ -6382,7 +6394,7 @@ index a173d2562e..21f34b82f0 100644
tileentity1.an_();
iterator.remove();
}
@@ -1120,6 +1150,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1120,6 +1154,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public List<Entity> getHardCollidingEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate<Entity> predicate) {
// copied from below
List<Entity> list = Lists.newArrayList();
@@ -6394,7 +6406,7 @@ index a173d2562e..21f34b82f0 100644
int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D);
int j = MathHelper.floor((axisalignedbb.maxX + 2.0D) / 16.0D);
int k = MathHelper.floor((axisalignedbb.minZ - 2.0D) / 16.0D);
@@ -1143,8 +1178,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1143,8 +1182,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@Override
public List<Entity> getEntities(@Nullable Entity entity, AxisAlignedBB axisalignedbb, @Nullable Predicate<? super Entity> predicate) {

View File

@@ -233,10 +233,10 @@ index 0a25523f3c..e8637244ce 100644
return iblockdata.r(iblockaccess, blockposition) ? false : (iblockdata.isPowerSource() ? false : (!fluid.isEmpty() ? false : (iblockdata.a((Tag) TagsBlock.PREVENT_MOB_SPAWNING_INSIDE) ? false : !entitytypes.a(iblockdata))));
}
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index dd5a80c769..e6c03ffc2f 100644
index 54a6a37c81..a22b78a655 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1496,6 +1496,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1500,6 +1500,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
return new DifficultyDamageScaler(this.getDifficulty(), this.getDayTime(), i, f);
}

View File

@@ -49,10 +49,10 @@ index 120bf8436f..848a185c04 100644
return true;
diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java
index 7bcc852100..4682de9f11 100644
index a5079ad349..657d005d29 100644
--- a/src/main/java/net/minecraft/server/World.java
+++ b/src/main/java/net/minecraft/server/World.java
@@ -1568,4 +1568,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
@@ -1572,4 +1572,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable {
public final boolean isDebugWorld() {
return this.debugWorld;
}