mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-23 16:59:16 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@abc49bf Begin update to 1.20.5 PaperMC/Paper@f2c45ed do some work PaperMC/Paper@00c14f2 Move logging patches after adventure PaperMC/Paper@ef057bb work on Adventure patch PaperMC/Paper@380c4d2 Add plugin remapping patches PaperMC/Paper@7cdf804 Work PaperMC/Paper@dd6ce09 Fix reflection diff and order wrt commodore diff PaperMC/Paper@598a1cb Apply shadow removal patch PaperMC/Paper@ffccfd5 Apply timings PaperMC/Paper@eb41348 33 PaperMC/Paper@9cac5b6 Fix continueServerUpdate with 2-line subjects PaperMC/Paper@2eeed9e 41 PaperMC/Paper@d07c487 Don't use defaultToolchain method for run tasks PaperMC/Paper@f2350fe Set mercury sourceCompat PaperMC/Paper@5cfd92b Fix api compile PaperMC/Paper@862d004 work on some API stuff PaperMC/Paper@d6a3c0c fix 2 of our javadoc errors PaperMC/Paper@487555b update PaperMC/Paper@0225537 Update upstream PaperMC/Paper@906f906 Patches! PaperMC/Paper@8244815 221 PaperMC/Paper@309ebc1 253 PaperMC/Paper@1d7d7e9 301 PaperMC/Paper@9079c90 354 PaperMC/Paper@cc46148 405 PaperMC/Paper@5be858e Patches! PaperMC/Paper@2d9d0d8 Patches! PaperMC/Paper@a403a8d Patches!!!!!!! PaperMC/Paper@21afc0a Patches!!!!!!! PaperMC/Paper@1de0dc8 666 plus 1 PaperMC/Paper@4e654f2 More patch work PaperMC/Paper@e832328 Check for existing am session before running continueServerUpdate PaperMC/Paper@fc5c0da 683 PaperMC/Paper@90095cd 694 PaperMC/Paper@71ae391 more work (721) PaperMC/Paper@22227cc more more work (757) PaperMC/Paper@4d9e824 more more work (806) PaperMC/Paper@9617829 Restore original formatting for MC-252817 patch PaperMC/Paper@0518559 Update reflection rewriter to 0.0.1 release PaperMC/Paper@e0a245d Patches!!!!!!! PaperMC/Paper@1104431 955 PaperMC/Paper@1df7e21 Apply more API-implementing patches PaperMC/Paper@b733809 Drop conduit api patch (upstream implemented same api with same method signatures) PaperMC/Paper@c95db4f adventure 4.17.0-SNAPSHOT PaperMC/Paper@bb1351c some work on adventure PaperMC/Paper@1444b36 work on adventure PaperMC/Paper@ce0e78c compile fixes PaperMC/Paper@25f7c68 compile fixes PaperMC/Paper@690b1cd compile fixes PaperMC/Paper@b673721 compile fixes PaperMC/Paper@6a87d14 dataconverter PaperMC/Paper@ec9f7e3 starlight PaperMC/Paper@e9eec78 chunk system PaperMC/Paper@f6ea373 Patches PaperMC/Paper@ec4ada8 Apply and move up non-optimization patches PaperMC/Paper@c9907c6 More patches PaperMC/Paper@2debcaf More more patches, including hopper optimization patch PaperMC/Paper@6da0d8c (Almost) all patches applied PaperMC/Paper@345b5c1 Patches!!!!!!! (we are done) PaperMC/Paper@4590038 Fix properly resend patches PaperMC/Paper@457e2c8 pass more stuff PaperMC/Paper@b8da9ac item meta patch work PaperMC/Paper@ccf158a update smithing recipe copy data components API PaperMC/Paper@653f043 readd fix bee aging patch PaperMC/Paper@bab31b6 Update Enchantment damage increase API PaperMC/Paper@f4c7639 Un-jankify root user detection PaperMC/Paper@9c58056 Some more compilation fixes PaperMC/Paper@b984f66 Missing FQN in CraftPotionBrewer getter PaperMC/Paper@768befe Remove patch renaming scripts PaperMC/Paper@04a25c2 Fix WorldCreator#keepSpawnLoaded PaperMC/Paper@820f999 Fixes for cb pkg ver PaperMC/Paper@ca9001a compile fixes PaperMC/Paper@d01f6b2 Fix more compile issues PaperMC/Paper@8d3759d More more compile fixes PaperMC/Paper@ed79038 More compile fixes PaperMC/Paper@2641c02 Updated Upstream (Bukkit/CraftBukkit) PaperMC/Paper@68aea43 Fixup damage source change PaperMC/Paper@3062eb2 address my own comments PaperMC/Paper@e85e1ec fixup sus effect entry patches PaperMC/Paper@10e6143 fixup adventure's book meta handling PaperMC/Paper@a244281 Replace VanillaGradle use and update generated API PaperMC/Paper@31ad90b some more compile fixes PaperMC/Paper@d2ef062 generator fix PaperMC/Paper@7c6411b compile fixes PaperMC/Paper@867eb90 compile fixes PaperMC/Paper@62b96c5 compile fixes PaperMC/Paper@c5c2a5f hunk system fixes PaperMC/Paper@bcdf1f9 fixup loom pattern select event patch PaperMC/Paper@43d110e fix issue with item default attribute API PaperMC/Paper@2997fd6 plugin manager updates PaperMC/Paper@7e9da43 support patch versions in api-version PaperMC/Paper@813cfbf Fix compile issues PaperMC/Paper@478a971 Fix light setting in protochunk PaperMC/Paper@8b28f9f Fix accumulated total ticking chunks not being updated PaperMC/Paper@00dac83 Drop old decompile fix PaperMC/Paper@f6fae41 fix chat_type issue PaperMC/Paper@cc81668 fix some issues on the todo list PaperMC/Paper@44e68c3 fix some more issues PaperMC/Paper@1bc278b Update patched spigot decompiler to fix inconsistency based on processing order PaperMC/Paper@19ac9d4 remove no longer needed patches and fix tests PaperMC/Paper@e856d17 Update paper plugin check in PluginRemapper PaperMC/Paper@882ea0a fix adventure translations PaperMC/Paper@4c53ace fix exact choice recipes PaperMC/Paper@464cc81 fix custom potion mixes PaperMC/Paper@ff77f82 paperweight 1.6.0 PaperMC/Paper@6a4974b Remove shadow from build classpath PaperMC/Paper@c38f96b deprecate our ItemRarity API PaperMC/Paper@ba8512a fix javadocs for SpawnerEntry$Equipment API PaperMC/Paper@f1fc1b3 readd old UUID format patch PaperMC/Paper@5485043 Don't tell people to build the reobf jar PaperMC/Paper@2f19f0f fix enchantment order issue PaperMC/Paper@80bd015 fix adventure converters not using RegistryOps PaperMC/Paper@68e23db add back missing call to profile fill events PaperMC/Paper@9bac389 more fixes PaperMC/Paper@81f4405 add back hunk to async SavedData IO PaperMC/Paper@91b5de6 bunch of fixes and improvements PaperMC/Paper@f85d423 improve dumpitem and pgive commands PaperMC/Paper@5731f34 Restore Handle Large Packets Disconnecting Client Patch PaperMC/Paper@f037f08 Unify plugin remapping debug flags PaperMC/Paper@c82766d fix item flags PaperMC/Paper@f933c35 Update DataConverter to 1.20.6-rc1 PaperMC/Paper@55b1a87 fix PotionEffectType#getEffectAttributes PaperMC/Paper@0b1b1fe fix helmet damage reduction inconsistencies PaperMC/Paper@e2552ee Start cleaning up plugin remapping patches PaperMC/Paper@711dbd7 Bump adventure ansi serializer PaperMC/Paper@af97400 update generator PaperMC/Paper@b7e148a Move obfhelper/stack deobf diff into original patch PaperMC/Paper@a390119 Move cb version definition to gradle patch PaperMC/Paper@20af7a7 remove funny diff PaperMC/Paper@b3ea907 more ItemFlag fixes PaperMC/Paper@53d8edd properly check for experimental stuff in generator PaperMC/Paper@a771940 Revert to vanilla handling of LivingEntity#actuallyHurt (#10463) PaperMC/Paper@06cae13 Update jdk version and distribution in actions PaperMC/Paper@dd571d8 Fix bad diff in build gradle file PaperMC/Paper@d02bb81 proper migration to gamerules for keep spawn loaded distance PaperMC/Paper@aeb3f37 update paperweight to 1.6.1 PaperMC/Paper@75c22d5 Bump tiny-remapper PaperMC/Paper@8454786 Bump tiny-remapper (real) PaperMC/Paper@d99d84a Temporarily comment out adventure jd links PaperMC/Paper@83767f9 Use JetBrains runtime for run tasks PaperMC/Paper@4ad6022 improve checking handled tags in itemmeta (#9470) PaperMC/Paper@8ce62b3 Fix issue with hopppers PaperMC/Paper@7e3d5b5 bump paperweight to 1.6.2 to fix spurious build failure from scanJar OOM PaperMC/Paper@d964c15 fix last test issue PaperMC/Paper@3e90a19 Updated Upstream (Bukkit/CraftBukkit) PaperMC/Paper@d93c6f9 remove calls to DoNotUse methods PaperMC/Paper@f187fd6 Only scan `org.bukkit.craftbukkit.inventory` in `MetaHandledTagsTest` PaperMC/Paper@a3c4dc9 Fix the incorrect codec usage in the Style convert (#10465) PaperMC/Paper@e16263c Fix firework meta NPE PaperMC/Paper@306b203 more fixes for ItemMeta relating to components PaperMC/Paper@1a03cc9 Fix test compilation PaperMC/Paper@6e31f38 Fix book meta lacking resolved tag from older versions (Fixes #10470) PaperMC/Paper@37b3891 Fix another missing book meta tag PaperMC/Paper@c4a1cd1 Fix issue with empty lists in adventure predicates PaperMC/Paper@9d6e7e3 Don't hard fail on plugin remap error PaperMC/Paper@4491ac0 respect hard list size limits in ItemMeta PaperMC/Paper@aed7dca Fix overly strong name validation in player heads PaperMC/Paper@0f4d328 final missing validation for data components PaperMC/Paper@52ff3b7 Add itemName components (Resolves #10467) (#10471) PaperMC/Paper@ba673a3 [ci skip] Feature requests are now in GitHub Discussions (#10606) PaperMC/Paper@0f3e324 [ci skip] Fix discussion template file name (#10607) PaperMC/Paper@82a8012 [ci skip] adjust projects workflow for label changes PaperMC/Paper@61c9c07 Fix CraftMetaBlockState adding extra tags PaperMC/Paper@7f2d531 Rewrite reflection in library loader jars (#10608) PaperMC/Paper@05308fc Remap plugin libraries with namespace set to spigot (#10610) PaperMC/Paper@69a971a Reset component prototype on itemtype change PaperMC/Paper@f9397e1 Fix incorrect Commodore mapping of sweeping enchant PaperMC/Paper@8f7ac62 Validate manifest provided mapping namespace (#10612) PaperMC/Paper@fbe3c00 [ci skip] update projects workflow configuration PaperMC/Paper@44ee092 1.20.6 (#10623) PaperMC/Paper@812ccb9 fix spawnChunkRadius gamerule resetting PaperMC/Paper@25e44bc fix dumpitem command nbt format PaperMC/Paper@3fdd094 Fix sealed package check in BytecodeModifyingURLClassLoader (#10627) PaperMC/Paper@937a67a Add initial size cap to component map PaperMC/Paper@4ea67ab [ci skip] Remove trailing comma in projects action PaperMC/Paper@8c058f8 Update paperweight to 1.6.3 (#10626) PaperMC/Paper@fa6013d Fixes beds not exploding in the nether PaperMC/Paper@3e0eb4a Updated Upstream (CraftBukkit) (#10624) PaperMC/Paper@4cfd9e2 Expose canReach to mob pathfinding API (#10636) PaperMC/Paper@b8c454c Add damage check for mending (#10631) PaperMC/Paper@310b47b Update Java version references, add note on var usages PaperMC/Paper@faa7aa2 Add GameMode#isInvulnerable (#10633) PaperMC/Paper@18c201b Add EquipmentSlot#getOppositeHand (#10632) PaperMC/Paper@544ce20 Expose #hasColor to leather armor (#10638) PaperMC/Paper@59fe7cc default save-empty-scoreboard-teams to vanilla PaperMC/Paper@0db72ac Fix can_place_on conversion and size check for item containers PaperMC/Paper@156675c Fix lodestone compass target conversion PaperMC/Paper@5632210 add RegistryAccess for managing registries (#10154) PaperMC/Paper@6fcca46 Add missing step in V3818 PaperMC/Paper@7401313 fix shear drops for wolf and bogged PaperMC/Paper@7ae2c67 Keep components using single items in creative (#10664) PaperMC/Paper@b13c7db Add missing experimental field and annotations (#10653) PaperMC/Paper@9d8d38d Updated Upstream (CraftBukkit) (#10646) PaperMC/Paper@0e43d3c Added API to get player's proxy address (#10400) PaperMC/Paper@54c5ecb Add missing SpigotConfig logCommands check (#10659) PaperMC/Paper@816ea9e [ci skip] Update old particle reference in javadoc (#10652) PaperMC/Paper@716dfd8 Fix EntityLoadCrossbowEvent (#10645) PaperMC/Paper@21d91ce Prevent profile lookups when unnecessary (#10651) PaperMC/Paper@2a6a5fe Add a way to check whether the chest is blocked (#10635) PaperMC/Paper@ac3a547 Fix BlockStateMeta (#10647)
216 lines
12 KiB
Diff
216 lines
12 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Samsuik <kfian294ma4@gmail.com>
|
|
Date: Fri, 19 Apr 2024 22:20:03 +0100
|
|
Subject: [PATCH] Optimise paper explosions
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
index 482609cb5395e626f7fc5890a6db3570c6a07166..0a9683c2005ab85708bfb6bbb051f68bed133918 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -112,6 +112,41 @@ public class Explosion {
|
|
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
|
|
}
|
|
|
|
+ // Sakura start - optimise paper explosions
|
|
+ /*
|
|
+ * Sort the explosion rays to better utilise the chunk and block cache.
|
|
+ * x + Vanilla Sorted
|
|
+ * z @ z 8 5
|
|
+ * - x 6 7 6 4
|
|
+ * 4 @ 5 7 @ 3
|
|
+ * 2 3 8 2
|
|
+ * 1 1
|
|
+ */
|
|
+ private static final java.util.Comparator<double[]> SORT_EXPLOSION_RAYS = java.util.Comparator.comparingDouble(vec -> {
|
|
+ double sign = Math.signum(vec[0]);
|
|
+ double dir = (sign - 1) / 2;
|
|
+ return sign + 8 + vec[2] * dir;
|
|
+ });
|
|
+
|
|
+ private static double[] sortExplosionRays(final it.unimi.dsi.fastutil.doubles.DoubleArrayList rayCoords) {
|
|
+ List<double[]> explosionRays = new ArrayList<>();
|
|
+
|
|
+ for (int i = 0; i < rayCoords.size(); i += 3) {
|
|
+ double[] ray = new double[3];
|
|
+ rayCoords.getElements(i, ray, 0, 3);
|
|
+ explosionRays.add(ray);
|
|
+ }
|
|
+
|
|
+ rayCoords.clear();
|
|
+ explosionRays.sort(SORT_EXPLOSION_RAYS);
|
|
+
|
|
+ double[] rays = new double[explosionRays.size() * 3];
|
|
+ for (int i = 0; i < explosionRays.size() * 3; i++) {
|
|
+ rays[i] = explosionRays.get(i / 3)[i % 3];
|
|
+ }
|
|
+ return rays;
|
|
+ }
|
|
+ // Sakura end - optimise paper explosions
|
|
// Paper start - optimise collisions
|
|
private static final double[] CACHED_RAYS;
|
|
static {
|
|
@@ -137,7 +172,7 @@ public class Explosion {
|
|
}
|
|
}
|
|
|
|
- CACHED_RAYS = rayCoords.toDoubleArray();
|
|
+ CACHED_RAYS = sortExplosionRays(rayCoords); // Sakura - optimise paper explosions
|
|
}
|
|
|
|
private static final int CHUNK_CACHE_SHIFT = 2;
|
|
@@ -431,7 +466,7 @@ public class Explosion {
|
|
}
|
|
// CraftBukkit end
|
|
this.level.gameEvent(this.source, (Holder) GameEvent.EXPLODE, new Vec3(this.x, this.y, this.z));
|
|
- Set<BlockPos> set = Sets.newHashSet();
|
|
+ // Sakura - moved into searchForBlocks
|
|
boolean flag = true;
|
|
|
|
int i;
|
|
@@ -457,6 +492,17 @@ public class Explosion {
|
|
|
|
initialCache = this.getOrCacheExplosionBlock(blockX, blockY, blockZ, key, true);
|
|
}
|
|
+ // Sakura start - optimise paper explosions
|
|
+ if (initialCache.resistance <= (this.radius * 1.3f) && this.interactsWithBlocks()) {
|
|
+ this.searchForBlocks(blockCache, initialCache);
|
|
+ }
|
|
+ this.locateAndImpactEntities(blockCache);
|
|
+ this.clearBlockCache();
|
|
+ }
|
|
+
|
|
+ protected final void searchForBlocks(final ExplosionBlockCache[] blockCache, final ExplosionBlockCache initialCache) {
|
|
+ Set<BlockPos> set = Sets.newHashSet();
|
|
+ // Sakura end - optimise paper explosions
|
|
// only ~1/3rd of the loop iterations in vanilla will result in a ray, as it is iterating the perimeter of
|
|
// a 16x16x16 cube
|
|
// we can cache the rays and their normals as well, so that we eliminate the excess iterations / checks and
|
|
@@ -542,23 +588,63 @@ public class Explosion {
|
|
}
|
|
|
|
this.toBlow.addAll(set);
|
|
- float f2 = this.radius * 2.0F;
|
|
+ // Sakura start - optimise paper explosions
|
|
+ }
|
|
|
|
- i = Mth.floor(this.x - (double) f2 - 1.0D);
|
|
- j = Mth.floor(this.x + (double) f2 + 1.0D);
|
|
+ protected final AABB getExplosionBounds(float f2) {
|
|
+ // Sakura - moved into locateAndImpactEntities
|
|
+
|
|
+ int i = Mth.floor(this.x - (double) f2 - 1.0D);
|
|
+ int j = Mth.floor(this.x + (double) f2 + 1.0D);
|
|
int l = Mth.floor(this.y - (double) f2 - 1.0D);
|
|
int i1 = Mth.floor(this.y + (double) f2 + 1.0D);
|
|
int j1 = Mth.floor(this.z - (double) f2 - 1.0D);
|
|
int k1 = Mth.floor(this.z + (double) f2 + 1.0D);
|
|
- List<Entity> list = this.level.getEntities(this.source, new AABB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1), (com.google.common.base.Predicate<Entity>) entity -> entity.isAlive() && !entity.isSpectator()); // Paper - Fix lag from explosions processing dead entities
|
|
- Vec3 vec3d = new Vec3(this.x, this.y, this.z);
|
|
- Iterator iterator = list.iterator();
|
|
+ return new AABB((double) i, (double) l, (double) j1, (double) j, (double) i1, (double) k1);
|
|
+ }
|
|
|
|
+ protected final void locateAndImpactEntities(final ExplosionBlockCache[] blockCache) {
|
|
+ float f2 = this.radius * 2.0F;
|
|
+
|
|
+ Vec3 vec3d = new Vec3(this.x, this.y, this.z);
|
|
final BlockPos.MutableBlockPos blockPos = new BlockPos.MutableBlockPos(); // Paper - optimise explosions
|
|
|
|
- while (iterator.hasNext()) {
|
|
- Entity entity = (Entity) iterator.next();
|
|
+ int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this.level);
|
|
+ int maxSection = io.papermc.paper.util.WorldUtil.getMaxSection(this.level);
|
|
+
|
|
+ int minChunkX = Mth.floor(this.x - f2) >> 4;
|
|
+ int maxChunkX = Mth.floor(this.x + f2) >> 4;
|
|
+ int minChunkY = Mth.clamp(Mth.floor(this.y - f2) >> 4, minSection, maxSection);
|
|
+ int maxChunkY = Mth.clamp(Mth.floor(this.y + f2) >> 4, minSection, maxSection);
|
|
+ int minChunkZ = Mth.floor(this.z - f2) >> 4;
|
|
+ int maxChunkZ = Mth.floor(this.z + f2) >> 4;
|
|
|
|
+ io.papermc.paper.chunk.system.entity.EntityLookup entityLookup = ((net.minecraft.server.level.ServerLevel) this.level).getEntityLookup();
|
|
+
|
|
+ for (int chunkX = minChunkX; chunkX <= maxChunkX; ++chunkX) {
|
|
+ for (int chunkZ = minChunkZ; chunkZ <= maxChunkZ; ++chunkZ) {
|
|
+ io.papermc.paper.world.ChunkEntitySlices chunk = entityLookup.getChunk(chunkX, chunkZ);
|
|
+ if (chunk == null) continue; // empty slice
|
|
+
|
|
+ for (int chunkY = minChunkY; chunkY <= maxChunkY; ++chunkY) {
|
|
+ this.impactEntities(blockCache, blockPos, f2, vec3d, chunk.getSectionEntities(chunkY));
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ protected final void impactEntities(final ExplosionBlockCache[] blockCache, final BlockPos.MutableBlockPos blockPos, float f2, Vec3 vec3d, Entity[] entities) {
|
|
+ for (int i = 0; i < entities.length; i++) {
|
|
+ Entity entity = entities[i];
|
|
+ if (entity == null) break; // end of entity section
|
|
+ this.impactEntity(blockCache, blockPos, f2, vec3d, entity);
|
|
+ if (entity != entities[i]) i--; // entities can be removed mid-explosion
|
|
+ }
|
|
+ }
|
|
+
|
|
+ protected final void impactEntity(final ExplosionBlockCache[] blockCache, final BlockPos.MutableBlockPos blockPos, float f2, Vec3 vec3d, Entity entity) {
|
|
+ if (entity.isAlive() && !entity.isSpectator()) { // Paper - Fix lag from explosions processing dead entities
|
|
+ // Sakura end - optimise paper explosions
|
|
if (!entity.ignoreExplosion(this)) {
|
|
double d7 = Math.sqrt(entity.distanceToSqr(vec3d)) / (double) f2;
|
|
|
|
@@ -582,24 +668,27 @@ public class Explosion {
|
|
// - Damaging EntityEnderDragon does nothing
|
|
// - EntityEnderDragon hitbock always covers the other parts and is therefore always present
|
|
if (entity instanceof EnderDragonPart) {
|
|
- continue;
|
|
+ return; // Sakura - optimise paper explosions
|
|
}
|
|
|
|
entity.lastDamageCancelled = false;
|
|
|
|
if (entity instanceof EnderDragon) {
|
|
+ // Sakura start - optimise paper explosions
|
|
+ AABB bounds = this.getExplosionBounds(f2);
|
|
for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) {
|
|
// Calculate damage separately for each EntityComplexPart
|
|
- if (list.contains(entityComplexPart)) {
|
|
- entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entityComplexPart, getSeenFraction(vec3d, entityComplexPart, blockCache, blockPos))); // Paper - actually optimise explosions and use the right entity to calculate the damage
|
|
+ if (entityComplexPart.getBoundingBox().intersects(bounds)) {
|
|
+ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entityComplexPart, getBlockDensity(vec3d, entityComplexPart, blockCache, blockPos))); // Paper - actually optimise explosions and use the right entity to calculate the damage
|
|
}
|
|
}
|
|
} else {
|
|
- entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entity, blockCache, blockPos))); // Paper - actually optimise explosions
|
|
+ entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getBlockDensity(vec3d, entity, blockCache, blockPos))); // Paper - actually optimise explosions
|
|
+ // Sakura end - optimise paper explosions
|
|
}
|
|
|
|
if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
|
|
- continue;
|
|
+ return; // Sakura - optimise paper explosions
|
|
}
|
|
// CraftBukkit end
|
|
}
|
|
@@ -635,7 +724,7 @@ public class Explosion {
|
|
final org.bukkit.entity.Entity hitBy = this.damageSource.getEntity() != null ? this.damageSource.getEntity().getBukkitEntity() : this.source.getBukkitEntity();
|
|
com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent paperEvent = new com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent(((LivingEntity) entity).getBukkitLivingEntity(), hitBy, (float) event.getForce(), org.bukkit.craftbukkit.util.CraftVector.toBukkit(vec3d1));
|
|
if (!paperEvent.callEvent()) {
|
|
- continue;
|
|
+ return; // Sakura - optimise paper explosions
|
|
}
|
|
vec3d1 = org.bukkit.craftbukkit.util.CraftVector.toNMS(paperEvent.getAcceleration());
|
|
}
|
|
@@ -659,8 +748,12 @@ public class Explosion {
|
|
}
|
|
}
|
|
}
|
|
+ // Sakura start - optimise paper explosions
|
|
}
|
|
+ }
|
|
|
|
+ protected void clearBlockCache() {
|
|
+ // Sakura end - optimise paper explosions
|
|
this.blockCache = null; // Paper - optimise explosions
|
|
this.chunkPosCache = null; // Paper - optimise explosions
|
|
this.chunkCache = null; // Paper - optimise explosions
|