2015-05-25 12:37:24 +02:00
|
|
|
--- a/net/minecraft/server/PlayerChunkMap.java
|
|
|
|
+++ b/net/minecraft/server/PlayerChunkMap.java
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -35,6 +35,7 @@
|
2019-05-14 02:00:00 +02:00
|
|
|
import org.apache.commons.lang3.mutable.MutableBoolean;
|
2019-04-23 04:00:00 +02:00
|
|
|
import org.apache.logging.log4j.LogManager;
|
|
|
|
import org.apache.logging.log4j.Logger;
|
2019-05-16 01:11:20 +02:00
|
|
|
+import org.bukkit.entity.Player; // CraftBukkit
|
2019-04-23 04:00:00 +02:00
|
|
|
|
|
|
|
public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d {
|
|
|
|
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -181,9 +182,12 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
|
|
|
|
return completablefuture1.thenApply((list1) -> {
|
|
|
|
List<IChunkAccess> list2 = Lists.newArrayList();
|
|
|
|
- final int l1 = 0;
|
|
|
|
+ // CraftBukkit start - decompile error
|
|
|
|
+ int cnt = 0;
|
|
|
|
|
|
|
|
- for (Iterator iterator = list1.iterator(); iterator.hasNext(); ++l1) {
|
|
|
|
+ for (Iterator iterator = list1.iterator(); iterator.hasNext(); ++cnt) {
|
|
|
|
+ final int l1 = cnt;
|
2016-12-06 12:05:58 +01:00
|
|
|
+ // CraftBukkit end
|
2019-04-23 04:00:00 +02:00
|
|
|
final Either<IChunkAccess, PlayerChunk.Failure> either = (Either) iterator.next();
|
|
|
|
Optional<IChunkAccess> optional = either.left();
|
|
|
|
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -279,7 +283,7 @@
|
2019-05-14 02:00:00 +02:00
|
|
|
PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.x.getName());
|
|
|
|
} else {
|
|
|
|
this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> {
|
|
|
|
- IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow((Object) null);
|
|
|
|
+ IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow(null); // CraftBukkit - decompile error
|
2016-12-06 12:05:58 +01:00
|
|
|
|
2019-05-14 02:00:00 +02:00
|
|
|
if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) {
|
|
|
|
this.saveChunk(ichunkaccess);
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -290,7 +294,6 @@
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
|
2019-04-26 08:56:49 +02:00
|
|
|
}
|
|
|
|
-
|
|
|
|
protected void unloadChunks(BooleanSupplier booleansupplier) {
|
|
|
|
GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler();
|
2019-04-23 04:00:00 +02:00
|
|
|
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -416,7 +419,7 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
return CompletableFuture.completedFuture(Either.right(playerchunk_failure));
|
|
|
|
});
|
|
|
|
}, (runnable) -> {
|
|
|
|
- this.mailboxWorldGen.a((Object) ChunkTaskQueueSorter.a(playerchunk, runnable));
|
|
|
|
+ this.mailboxWorldGen.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // CraftBukkit - decompile error
|
|
|
|
});
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
|
|
|
}
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -498,7 +501,7 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
long i = playerchunk.h().pair();
|
2016-05-10 13:47:39 +02:00
|
|
|
|
2019-04-23 04:00:00 +02:00
|
|
|
playerchunk.getClass();
|
2019-05-14 02:00:00 +02:00
|
|
|
- mailbox.a((Object) ChunkTaskQueueSorter.a(runnable, i, playerchunk::getTicketLevel));
|
|
|
|
+ mailbox.a(ChunkTaskQueueSorter.a(runnable, i, playerchunk::getTicketLevel)); // CraftBukkit - decompile error
|
2019-04-23 04:00:00 +02:00
|
|
|
});
|
2014-11-25 22:32:16 +01:00
|
|
|
}
|
2019-04-23 04:00:00 +02:00
|
|
|
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -515,7 +518,7 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
return Either.left(chunk);
|
|
|
|
});
|
|
|
|
}, (runnable) -> {
|
|
|
|
- this.mailboxMain.a((Object) ChunkTaskQueueSorter.a(playerchunk, runnable));
|
|
|
|
+ this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // CraftBukkit - decompile error
|
|
|
|
});
|
|
|
|
|
|
|
|
completablefuture1.thenAcceptAsync((either) -> {
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -529,7 +532,7 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
return Either.left(chunk);
|
|
|
|
});
|
|
|
|
}, (runnable) -> {
|
|
|
|
- this.mailboxMain.a((Object) ChunkTaskQueueSorter.a(playerchunk, runnable));
|
|
|
|
+ this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // CraftBukkit - decompile error
|
|
|
|
});
|
|
|
|
return completablefuture1;
|
|
|
|
}
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -543,7 +546,7 @@
|
2019-05-14 02:00:00 +02:00
|
|
|
return chunk;
|
|
|
|
});
|
|
|
|
}, (runnable) -> {
|
|
|
|
- this.mailboxMain.a((Object) ChunkTaskQueueSorter.a(playerchunk, runnable));
|
|
|
|
+ this.mailboxMain.a(ChunkTaskQueueSorter.a(playerchunk, runnable)); // CraftBukkit - decompile error
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -607,9 +610,10 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
ChunkCoordIntPair chunkcoordintpair = playerchunk.h();
|
|
|
|
Packet<?>[] apacket = new Packet[2];
|
|
|
|
|
|
|
|
+ int finall = l; // CraftBukkit - decompile error
|
|
|
|
this.a(chunkcoordintpair, false).forEach((entityplayer) -> {
|
|
|
|
int i1 = b(chunkcoordintpair, entityplayer, true);
|
|
|
|
- boolean flag = i1 <= l;
|
|
|
|
+ boolean flag = i1 <= finall; // CraftBukkit - decompile error
|
2019-05-14 02:00:00 +02:00
|
|
|
boolean flag1 = i1 <= this.viewDistance;
|
2019-04-23 04:00:00 +02:00
|
|
|
|
|
|
|
this.sendChunk(entityplayer, chunkcoordintpair, apacket, flag, flag1);
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -664,7 +668,7 @@
|
2019-05-14 02:00:00 +02:00
|
|
|
private NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException {
|
2019-04-23 04:00:00 +02:00
|
|
|
NBTTagCompound nbttagcompound = this.read(chunkcoordintpair);
|
|
|
|
|
|
|
|
- return nbttagcompound == null ? null : this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.m, nbttagcompound);
|
|
|
|
+ return nbttagcompound == null ? null : this.getChunkData(this.world.getWorldProvider().getDimensionManager(), this.m, nbttagcompound, chunkcoordintpair, world); // CraftBukkit
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean d(ChunkCoordIntPair chunkcoordintpair) {
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -984,7 +988,7 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
public final Set<EntityPlayer> trackedPlayers = Sets.newHashSet();
|
|
|
|
|
|
|
|
public EntityTracker(Entity entity, int i, int j, boolean flag) {
|
|
|
|
- this.trackerEntry = new EntityTrackerEntry(PlayerChunkMap.this.world, entity, j, flag, this::broadcast);
|
|
|
|
+ this.trackerEntry = new EntityTrackerEntry(PlayerChunkMap.this.world, entity, j, flag, this::broadcast, trackedPlayers); // CraftBukkit
|
|
|
|
this.tracker = entity;
|
|
|
|
this.trackingDistance = i;
|
|
|
|
this.e = SectionPosition.a(entity);
|
2019-05-16 01:11:20 +02:00
|
|
|
@@ -1053,6 +1057,17 @@
|
2019-04-23 04:00:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
+ // CraftBukkit start - respect vanish API
|
|
|
|
+ if (this.tracker instanceof EntityPlayer) {
|
|
|
|
+ Player player = ((EntityPlayer) this.tracker).getBukkitEntity();
|
|
|
|
+ if (!entityplayer.getBukkitEntity().canSee(player)) {
|
|
|
|
+ flag1 = false;
|
|
|
|
+ }
|
|
|
|
+ }
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2019-04-23 04:00:00 +02:00
|
|
|
+ entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId()));
|
|
|
|
+ // CraftBukkit end
|
2014-11-25 22:32:16 +01:00
|
|
|
+
|
2019-04-23 04:00:00 +02:00
|
|
|
if (flag1 && this.trackedPlayers.add(entityplayer)) {
|
|
|
|
this.trackerEntry.b(entityplayer);
|
|
|
|
}
|