13
0
geforkt von Mirrors/Paper

Remove stale POIs

Dieser Commit ist enthalten in:
Shane Freeder 2021-01-09 14:17:07 +01:00
Ursprung 6ba5436a48
Commit cabf9f914d

Datei anzeigen

@ -79,7 +79,7 @@
+ public final LevelStorageSource.LevelStorageAccess convertable;
+ public final UUID uuid;
+ public boolean hasPhysicsEvent = true; // Paper - BlockPhysicsEvent
+
+ public LevelChunk getChunkIfLoaded(int x, int z) {
+ return this.chunkSource.getChunk(x, z, false);
+ }
@ -132,7 +132,7 @@
+
+ int maxBlockX = Mth.floor(axisalignedbb.maxX + 1.0E-7D) + 3;
+ int maxBlockZ = Mth.floor(axisalignedbb.maxZ + 1.0E-7D) + 3;
+
+ int minChunkX = minBlockX >> 4;
+ int minChunkZ = minBlockZ >> 4;
+
@ -823,12 +823,9 @@
public <T extends ParticleOptions> int sendParticles(T parameters, boolean force, boolean important, double x, double y, double z, int count, double offsetX, double offsetY, double offsetZ, double speed) {
- ClientboundLevelParticlesPacket packetplayoutworldparticles = new ClientboundLevelParticlesPacket(parameters, force, important, x, y, z, (float) offsetX, (float) offsetY, (float) offsetZ, (float) speed, count);
- int j = 0;
+ return this.sendParticlesSource(null, parameters, force, important, x, y, z, count, offsetX, offsetY, offsetZ, speed); // CraftBukkit - visibility api support
+ }
- for (int k = 0; k < this.players.size(); ++k) {
- ServerPlayer entityplayer = (ServerPlayer) this.players.get(k);
+
+ // CraftBukkit start - visibility api support
+ public <T extends ParticleOptions> int sendParticlesSource(ServerPlayer sender, T t0, boolean flag, boolean flag1, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6) {
+ // Paper start - Particle API
@ -838,13 +835,15 @@
+ // Paper end - Particle API
+ // CraftBukkit end
+ ClientboundLevelParticlesPacket packetplayoutworldparticles = new ClientboundLevelParticlesPacket(t0, flag, flag1, d0, d1, d2, (float) d3, (float) d4, (float) d5, (float) d6, i);
+ int j = 0;
int j = 0;
- if (this.sendParticles(entityplayer, force, x, y, z, packetplayoutworldparticles)) {
- for (int k = 0; k < this.players.size(); ++k) {
- ServerPlayer entityplayer = (ServerPlayer) this.players.get(k);
+ for (Player entityhuman : receivers) { // Paper - Particle API
+ ServerPlayer entityplayer = (ServerPlayer) entityhuman; // Paper - Particle API
+ if (sender != null && !entityplayer.getBukkitEntity().canSee(sender.getBukkitEntity())) continue; // CraftBukkit
+
- if (this.sendParticles(entityplayer, force, x, y, z, packetplayoutworldparticles)) {
+ if (this.sendParticles(entityplayer, flag, d0, d1, d2, packetplayoutworldparticles)) {
++j;
}
@ -892,7 +891,19 @@
this.getServer().getPlayerList().broadcastAll(new ClientboundSetDefaultSpawnPositionPacket(pos, angle));
}
@@ -1649,6 +2020,11 @@
@@ -1419,6 +1790,11 @@
});
optional1.ifPresent((holder) -> {
this.getServer().execute(() -> {
+ // Paper start - Remove stale POIs
+ if (optional.isEmpty() && this.getPoiManager().exists(blockposition1, poiType -> true)) {
+ this.getPoiManager().remove(blockposition1);
+ }
+ // Paper end - Remove stale POIs
this.getPoiManager().add(blockposition1, holder);
DebugPackets.sendPoiAddedPacket(this, blockposition1);
});
@@ -1649,6 +2025,11 @@
@Override
public void blockUpdated(BlockPos pos, Block block) {
if (!this.isDebug()) {
@ -904,7 +915,7 @@
this.updateNeighborsAt(pos, block);
}
@@ -1668,12 +2044,12 @@
@@ -1668,12 +2049,12 @@
}
public boolean isFlat() {
@ -919,7 +930,7 @@
}
@Nullable
@@ -1696,7 +2072,7 @@
@@ -1696,7 +2077,7 @@
private static <T> String getTypeCount(Iterable<T> items, Function<T, String> classifier) {
try {
Object2IntOpenHashMap<String> object2intopenhashmap = new Object2IntOpenHashMap();
@ -928,7 +939,7 @@
while (iterator.hasNext()) {
T t0 = iterator.next();
@@ -1705,7 +2081,7 @@
@@ -1705,7 +2086,7 @@
object2intopenhashmap.addTo(s, 1);
}
@ -937,7 +948,7 @@
String s1 = (String) entry.getKey();
return s1 + ":" + entry.getIntValue();
@@ -1717,6 +2093,7 @@
@@ -1717,6 +2098,7 @@
@Override
public LevelEntityGetter<Entity> getEntities() {
@ -945,7 +956,7 @@
return this.entityManager.getEntityGetter();
}
@@ -1802,6 +2179,17 @@
@@ -1802,6 +2184,17 @@
return this.serverLevelData.getGameRules();
}
@ -963,7 +974,7 @@
@Override
public CrashReportCategory fillReportDetails(CrashReport report) {
CrashReportCategory crashreportsystemdetails = super.fillReportDetails(report);
@@ -1836,7 +2224,8 @@
@@ -1836,7 +2229,8 @@
}
public void onTrackingStart(Entity entity) {
@ -973,7 +984,7 @@
if (entity instanceof ServerPlayer entityplayer) {
ServerLevel.this.players.add(entityplayer);
ServerLevel.this.updateSleepingPlayerList();
@@ -1864,9 +2253,53 @@
@@ -1864,9 +2258,53 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::add);
@ -1027,7 +1038,7 @@
ServerLevel.this.getChunkSource().removeEntity(entity);
if (entity instanceof ServerPlayer entityplayer) {
ServerLevel.this.players.remove(entityplayer);
@@ -1895,6 +2328,15 @@
@@ -1895,6 +2333,15 @@
}
entity.updateDynamicGameEventListener(DynamicGameEventListener::remove);