mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-22 08:19:26 +00:00
Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@7fbb827 Finish API patches PaperMC/Paper@8a37f93 62 PaperMC/Paper@2055809 117 PaperMC/Paper@0b75522 194 PaperMC/Paper@ec05cb8 279 PaperMC/Paper@0bc9aee 385 PaperMC/Paper@27e29cc 487/1053 PaperMC/Paper@083bd9e 531/1053 PaperMC/Paper@ed2ea45 538 PaperMC/Paper@ba163e1 585/1053 PaperMC/Paper@8731266 650/1053 PaperMC/Paper@52b49fb 788/1053 PaperMC/Paper@33b36cd update some patches PaperMC/Paper@14c0336 922 PaperMC/Paper@a399f23 956 PaperMC/Paper@4140de2 960 PaperMC/Paper@6d4e235 988 PaperMC/Paper@6a34750 Move unapplied patches to the back PaperMC/Paper@3c04f9f Fix a few compile errors PaperMC/Paper@0d3ce2d Fix more compile issues PaperMC/Paper@a308c7c Fix more compile issues PaperMC/Paper@69d1d0a Pretend to fix compile errors PaperMC/Paper@547f09d Some work on the ItemMend events PaperMC/Paper@184a943 Adopt previous commit changes in API PaperMC/Paper@5442bff Make it compile PaperMC/Paper@038f8d9 Fixup and deprecate player profiles in ping event PaperMC/Paper@66f7b67 Fix body equipmentslot and effect enum PaperMC/Paper@38b3182 Updated Upstream (Bukkit/CraftBukkit) PaperMC/Paper@df633e5 DataConverter 1.21 PaperMC/Paper@f569389 Update ConcurrentUtil PaperMC/Paper@5fca3ae update generated API PaperMC/Paper@188cff2 remove old vanilla goals PaperMC/Paper@ffe310a remove api that was scheduled for removal PaperMC/Paper@730882f Chunk System and Starlight WIP PaperMC/Paper@512fd08 Update Gradle Wrapper to v8.8 PaperMC/Paper@097284d Bump tiny-remapper to 0.10.3 PaperMC/Paper@ee9b820 Update more optimization patches PaperMC/Paper@5d834b1 rebuild patches PaperMC/Paper@4bc15f1 Updated Upstream (Bukkit/CraftBukkit) PaperMC/Paper@0b6701d Revert DamageSource#getCausingEntity to vanilla PaperMC/Paper@5bd7f4e Update AbstractArrow item method implementations for 1.20.6 (#10885) PaperMC/Paper@fb511c6 Fix Player#sendBlockState (#10855) PaperMC/Paper@b420038 Fix ItemMeta#removeEnchantments (#10886) PaperMC/Paper@a835ad1 Merge remote-tracking branch 'origin/dev/1.21' into dev/1.21 PaperMC/Paper@04dad71 Improve enchantWithLevels logic PaperMC/Paper@0008fa1 Add back more optimization patches PaperMC/Paper@56b5b7d Fix max chunk status checks PaperMC/Paper@c1aefee correctly change enchantment registry to a 'delayed' version PaperMC/Paper@d41636f Add back RecipeIterator fixes patch (#10887) PaperMC/Paper@7df4725 Configurable damage tick when blocking with shield (#10877) PaperMC/Paper@3555a77 Properly forward DispenseEvent #getItem to saddle PaperMC/Paper@e339ec2 Deprecate BlockData#getDestroySpeed for removal PaperMC/Paper@b090c65 Remove unnecessary changes from chunk status fix PaperMC/Paper@5e7cd07 add some generated typed/tag keys PaperMC/Paper@5a5412c Owen fixing stuff!!! PaperMC/Paper@7240d9d Restore functionality to sand dupe setting PaperMC/Paper@f873bce Fix NPE in V3808 PaperMC/Paper@1f8e7a7 address compile and test issue (#10890) PaperMC/Paper@60f3bd8 De-deprecate BlockData#getDestroySpeed PaperMC/Paper@752f957 Add back more patches PaperMC/Paper@dc684c6 Remove bad server.scheduleOnMain disconnect calls from old patches PaperMC/Paper@c84a3b5 Remove fully dropped patches PaperMC/Paper@d8c2980 Add Adventure API to ServerLinks (#10891) PaperMC/Paper@ec4c712 update 'improve mass craft perf' patch PaperMC/Paper@e1c0033 Updated Upstream (Bukkit/CraftBukkit) PaperMC/Paper@fbc2a55 Update Wither#canTravelThroughPortals PaperMC/Paper@167961e call EntityDamageItemEvent for thorns PaperMC/Paper@106dbae Fix getAddress connection check PaperMC/Paper@d9111cc Registry Modification API (#10893) PaperMC/Paper@f8ee0a0 Fix implementations of ChunkHolder#getChunkIfPresent PaperMC/Paper@61b85e4 Fix legacy cb version in remapper PaperMC/Paper@de8220c Update ChunkMap#distanceManager mapping patch PaperMC/Paper@8dfb85c Enchantment and GameEvent Registry builders (#10889) PaperMC/Paper@fb762cf remove remaining reference to 'pgive' PaperMC/Paper@a7f6633 make EntityPortalReadyEvent#setTargetWorld work again PaperMC/Paper@152f4fe Add back improved watchdog support patch PaperMC/Paper@13992b1 Make chunk system loggers calm down a bit PaperMC/Paper@bf8552f Delegate ItemStack (#10852) PaperMC/Paper@b3e072a Fix `hasFiredAsync` parameter when `AsyncPlayerSendCommandsEvent` is called (#10896) PaperMC/Paper@21c9a7c Rebuild patches PaperMC/Paper@b9f7098 [ci skip] Fix javadoc mistake in EnchantmentRegistryEntry.Builder (#10898) PaperMC/Paper@b4b8208 Fix NPE for Jukebox#setRecord PaperMC/Paper@4514f41 Correct duplicate attribute check (#10901) PaperMC/Paper@090775e Use ItemStack.empty() when air is passed into constructor PaperMC/Paper@7bbe682 Fix CraftWorld#isChunkGenerated PaperMC/Paper@126f6d7 Remove getUnloadingChunkHolder check PaperMC/Paper@d23825a Add missing null check to getFullChunkIfLoaded PaperMC/Paper@3b1c85b Execute chunk tasks while waiting for chunk load in isChunkGenerated PaperMC/Paper@4ea696f Add ticket for chunk load in isChunkGenerated PaperMC/Paper@250e78c Re-add fixlight command PaperMC/Paper@c0268ca Copy missing diff from old chunk system patch PaperMC/Paper@38428c0 Cleanup MCUtils patch for chunk system PaperMC/Paper@f4ddd4a Fix ChunkHolder#getFullChunkNow returning non-null when it should not PaperMC/Paper@e0d9d60 Add debug for chunk system unload crash PaperMC/Paper@2df432f Re-add chunk system debug commands PaperMC/Paper@cf60574 Fix jukebox playable component not being applied on item meta (#10922) PaperMC/Paper@666bc4d Experimental annotation changes (#10914) PaperMC/Paper@bab07e0 Validate speed for tool component rule (#10923) PaperMC/Paper@2118196 Fixes exception log messages getting dropped during bootstrap (#10935) PaperMC/Paper@8b1d26d Fix diff in sprint interruption option (Closes #10939) PaperMC/Paper@0a1b133 Revert "Fixes exception log messages getting dropped during bootstrap (#10935)" (Closes #10945) PaperMC/Paper@a0fad76 Fix base damage for trident (#10948) PaperMC/Paper@d64be7e Fix NPE of AbstractArrow#getWeapon (#10933) PaperMC/Paper@081146c Validate using_converts_to for food component (#10931) PaperMC/Paper@0409a68 deprecate and update some entity tags (#10932) PaperMC/Paper@9cd0201 Preserve velocity for fireball (#10934) PaperMC/Paper@19105a9 Fix unload queue storing chunks in wrong sections PaperMC/Paper@77c763b Fix PlayerShearBlockEvent drops ignored for Pumpkin (#10956) PaperMC/Paper@76c2f16 Fix wrong diff applying delta twice (#10959) PaperMC/Paper@812701d Do not crash when an exp orb attempts to mend an unrepairable item PaperMC/Paper@19eefe9 Fix SoundEffects only to players diff (#10966) PaperMC/Paper@95aa440 Add missing effect cause and deprecate PATROL_CAPTAIN cause (#10958) PaperMC/Paper@b2e5587 Expose LivingEntity#canUseSlot (#10930) PaperMC/Paper@97afc9a Fix StackOverflowError for new dispenser interaction (#10949) PaperMC/Paper@5ae4758 Fix speed for launched trident using api (#10936) PaperMC/Paper@897ece4 Call EntityPortalEnterEvent on endgateways and make cancellable (#10892) PaperMC/Paper@1d3fc0e Bump reflection-rewriter to 0.0.2 (#10927) PaperMC/Paper@b99d071 Swap some nullable annotations (#10960) PaperMC/Paper@dd31654 bump reflection-rewriter to 0.0.3 (#10969) PaperMC/Paper@dd49fba Fix NPE when retrieving an entity with a null UUID
This commit is contained in:
@@ -13,7 +13,7 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
remapper("net.fabricmc:tiny-remapper:0.10.2:fat")
|
||||
remapper("net.fabricmc:tiny-remapper:0.10.3:fat")
|
||||
decompiler("org.vineflower:vineflower:1.10.1")
|
||||
paperclip("io.papermc:paperclip:3.0.3")
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
group=me.samsuik.sakura
|
||||
version=1.20.6-R0.1-SNAPSHOT
|
||||
version=1.21-R0.1-SNAPSHOT
|
||||
|
||||
mcVersion=1.20.6
|
||||
paperRef=79e2cb620ef03539390d97940824b38b707918f5
|
||||
mcVersion=1.21
|
||||
paperRef=dd49fba8c534d48c3693a751075ecb5836a9d458
|
||||
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Customise Version Command
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
|
||||
index 47039514503d99e84cb99f4941707a7726286516..3e426dc442fd7c82cfd89c4c46290f0c857eddf9 100644
|
||||
index b9b751ea0d11381e846d5f35f39f285c075c171a..d629598719298aa15666b559490a0f6db92b2483 100644
|
||||
--- a/src/main/java/org/bukkit/Bukkit.java
|
||||
+++ b/src/main/java/org/bukkit/Bukkit.java
|
||||
@@ -124,6 +124,20 @@ public final class Bukkit {
|
||||
@@ -125,6 +125,20 @@ public final class Bukkit {
|
||||
// Paper end
|
||||
}
|
||||
|
||||
|
||||
@@ -209,10 +209,10 @@ index 0000000000000000000000000000000000000000..3df11f07ce533b8b911ec423be850374
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
|
||||
index 6c327a07bf8a6aa11a2d7dad12b2830acc539484..078c379e17050b747163b08d7f1fcc2290a6f513 100644
|
||||
index 7c56182acaf827f4b1a986a61cea8e9960604c98..4c2e82a6421722d9a990ff4a216cedc159c7e579 100644
|
||||
--- a/src/main/java/org/bukkit/entity/Player.java
|
||||
+++ b/src/main/java/org/bukkit/entity/Player.java
|
||||
@@ -58,6 +58,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
@@ -59,6 +59,15 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient, net.kyori.adventure.identity.Identified, net.kyori.adventure.bossbar.BossBarViewer, com.destroystokyo.paper.network.NetworkClient { // Paper
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Sakura Configuration Files
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/configuration/Configurations.java b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
index 96142deb42700f888ea08689ab62c27ef2b881fd..92bbebf2d09225ac67685bec1a724f1d3ae25fe9 100644
|
||||
index 87e5f614ba988547a827486740db217e28585773..0375c9eb296ba7e8ed64e8d00dbc13a581dd4f90 100644
|
||||
--- a/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
+++ b/src/main/java/io/papermc/paper/configuration/Configurations.java
|
||||
@@ -96,7 +96,7 @@ public abstract class Configurations<G, W> {
|
||||
@@ -1040,10 +1040,10 @@ index 0000000000000000000000000000000000000000..4024f9738e039ffffd560a07a2210f75
|
||||
+public record DurableMaterial(int durability, float resistance) {
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 3751c2a077bd13bac330b93c6efc2a640a17f4f2..420e375f7dac5c001278c0cb15a98aa39d609aec 100644
|
||||
index 68f60e77e0bfd42b6419491c1d59b6432974216b..1af29c2d6c591b11fd509821d54e6ea781c0929d 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -310,6 +310,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -317,6 +317,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
public final double[] recentTps = new double[ 3 ];
|
||||
// Spigot end
|
||||
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
|
||||
@@ -1051,7 +1051,7 @@ index 3751c2a077bd13bac330b93c6efc2a640a17f4f2..420e375f7dac5c001278c0cb15a98aa3
|
||||
public static long currentTickLong = 0L; // Paper - track current tick as a long
|
||||
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
|
||||
@@ -418,6 +419,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -433,6 +434,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
|
||||
// CraftBukkit end
|
||||
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
|
||||
@@ -1063,10 +1063,10 @@ index 3751c2a077bd13bac330b93c6efc2a640a17f4f2..420e375f7dac5c001278c0cb15a98aa3
|
||||
|
||||
private void readScoreboard(DimensionDataStorage persistentStateManager) {
|
||||
diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
index ad967cc2283f902c76e48a59d59cf0dbdacbb5e3..fef543e614ef7394ab70ad05d3158bc81a8bbdf5 100644
|
||||
index 7d82cc6b847124cf4225428ba310309544928148..2b718bb263780e9b942da0c3664e911b5b3be34e 100644
|
||||
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
|
||||
@@ -233,6 +233,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
@@ -237,6 +237,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this); // Paper - setup /paper command
|
||||
com.destroystokyo.paper.Metrics.PaperMetrics.startMetrics(); // Paper - start metrics
|
||||
com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now
|
||||
@@ -1079,10 +1079,10 @@ index ad967cc2283f902c76e48a59d59cf0dbdacbb5e3..fef543e614ef7394ab70ad05d3158bc8
|
||||
this.setPvpAllowed(dedicatedserverproperties.pvp);
|
||||
this.setFlightAllowed(dedicatedserverproperties.allowFlight);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index ca56a0b596976448da6bb2a0e82b3d5cd4133e12..b5a66132f7ec10feb4682db38c80e5064e78f9f3 100644
|
||||
index 798016774df02c3f7ebf909c9cc125f8427a39be..993dcba233c4816d020d671d8bf3f6133a1e86a3 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -697,7 +697,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -502,7 +502,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
|
||||
|
||||
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
|
||||
@@ -1092,10 +1092,10 @@ index ca56a0b596976448da6bb2a0e82b3d5cd4133e12..b5a66132f7ec10feb4682db38c80e506
|
||||
this.convertable = convertable_conversionsession;
|
||||
this.uuid = WorldUUID.getUUID(convertable_conversionsession.levelDirectory.path().toFile());
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 14281a4e72f49dc4eb2ca3da8479c1f81a3a175d..f2cd3046fdd280b03586e645216ccef15fc4b116 100644
|
||||
index fee155c81df385faa474e3aec777a30375ecb07d..e345fbcf798c0b663780d206ce337233e28dfc4e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -169,6 +169,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -170,6 +170,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
return this.paperConfig;
|
||||
}
|
||||
// Paper end - add paper world config
|
||||
@@ -1108,12 +1108,12 @@ index 14281a4e72f49dc4eb2ca3da8479c1f81a3a175d..f2cd3046fdd280b03586e645216ccef1
|
||||
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
@@ -205,9 +211,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -258,9 +264,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
||||
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura - sakura configuration files // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
||||
- protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, java.util.concurrent.Executor executor) { // Paper - create paper world config & Anti-Xray
|
||||
+ protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura - sakura configuration files// Paper - create paper world config & Anti-Xray
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
||||
+ this.sakuraConfig = sakuraWorldConfigCreator.get(); // Sakura - sakura configuration files
|
||||
@@ -1121,10 +1121,10 @@ index 14281a4e72f49dc4eb2ca3da8479c1f81a3a175d..f2cd3046fdd280b03586e645216ccef1
|
||||
this.world = new CraftWorld((ServerLevel) this, gen, biomeProvider, env);
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 5db08432b6afd3639688830e717f40ceaf599248..4ea6a5af351d5bf40154571a2e8d6af26a1bcb58 100644
|
||||
index caf6ff33b42472d30f28629470e12889f50490cc..1e2dcd25fc9e605481c809fcb3121b4197640957 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1056,6 +1056,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1059,6 +1059,7 @@ public final class CraftServer implements Server {
|
||||
|
||||
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
|
||||
this.console.paperConfigurations.reloadConfigs(this.console);
|
||||
@@ -1132,7 +1132,7 @@ index 5db08432b6afd3639688830e717f40ceaf599248..4ea6a5af351d5bf40154571a2e8d6af2
|
||||
for (ServerLevel world : this.console.getAllLevels()) {
|
||||
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
|
||||
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters, config.spawnAnimals); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
|
||||
@@ -1087,6 +1088,7 @@ public final class CraftServer implements Server {
|
||||
@@ -1090,6 +1091,7 @@ public final class CraftServer implements Server {
|
||||
this.reloadData();
|
||||
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
|
||||
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
|
||||
@@ -1141,7 +1141,7 @@ index 5db08432b6afd3639688830e717f40ceaf599248..4ea6a5af351d5bf40154571a2e8d6af2
|
||||
this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions");
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
index b86ba59158964f73abd6622341a9acb98a33fa44..163be3f86f3fabce0e6f10b83ac6db07596dac5d 100644
|
||||
index 6e1f92b45504cef0c4dcbbebf3df339ef4cad0a1..c361c408b0382ac7bffa960ba56c37157544c25f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
|
||||
@@ -176,6 +176,14 @@ public class Main {
|
||||
|
||||
@@ -0,0 +1,340 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Tue, 5 May 2020 20:18:05 -0700
|
||||
Subject: [PATCH] Paper Unapplied - Use distance map to optimise entity tracker
|
||||
|
||||
Use the distance map to find candidate players for tracking.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index c96740a82eac9101f74edeb44edf4b64d1d633e0..daad83ea92bac1432feed77d5fc2d5c5c15a1b96 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -169,12 +169,37 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
// Paper start - distance maps
|
||||
private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets<ServerPlayer> pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>();
|
||||
+ // Paper start - use distance map to optimise tracker
|
||||
+ public static boolean isLegacyTrackingEntity(Entity entity) {
|
||||
+ return entity.isLegacyTrackingEntity;
|
||||
+ }
|
||||
+
|
||||
+ // inlined EnumMap, TrackingRange.TrackingRangeType
|
||||
+ static final org.spigotmc.TrackingRange.TrackingRangeType[] TRACKING_RANGE_TYPES = org.spigotmc.TrackingRange.TrackingRangeType.values();
|
||||
+ public final com.destroystokyo.paper.util.misc.PlayerAreaMap[] playerEntityTrackerTrackMaps;
|
||||
+ final int[] entityTrackerTrackRanges;
|
||||
+ public final int getEntityTrackerRange(final int ordinal) {
|
||||
+ return this.entityTrackerTrackRanges[ordinal];
|
||||
+ }
|
||||
+
|
||||
+ private int convertSpigotRangeToVanilla(final int vanilla) {
|
||||
+ return net.minecraft.server.MinecraftServer.getServer().getScaledTrackingDistance(vanilla);
|
||||
+ }
|
||||
+ // Paper end - use distance map to optimise tracker
|
||||
|
||||
void addPlayerToDistanceMaps(ServerPlayer player) {
|
||||
int chunkX = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getX());
|
||||
int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
this.nearbyPlayers.addPlayer(player);
|
||||
+ // Paper start - use distance map to optimise entity tracker
|
||||
+ for (int i = 0, len = TRACKING_RANGE_TYPES.length; i < len; ++i) {
|
||||
+ com.destroystokyo.paper.util.misc.PlayerAreaMap trackMap = this.playerEntityTrackerTrackMaps[i];
|
||||
+ int trackRange = this.entityTrackerTrackRanges[i];
|
||||
+
|
||||
+ trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player)));
|
||||
+ }
|
||||
+ // Paper end - use distance map to optimise entity tracker
|
||||
}
|
||||
|
||||
void removePlayerFromDistanceMaps(ServerPlayer player) {
|
||||
@@ -182,6 +207,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
this.nearbyPlayers.removePlayer(player);
|
||||
+ // Paper start - use distance map to optimise tracker
|
||||
+ for (int i = 0, len = TRACKING_RANGE_TYPES.length; i < len; ++i) {
|
||||
+ this.playerEntityTrackerTrackMaps[i].remove(player);
|
||||
+ }
|
||||
+ // Paper end - use distance map to optimise tracker
|
||||
}
|
||||
|
||||
void updateMaps(ServerPlayer player) {
|
||||
@@ -189,6 +219,14 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
int chunkZ = io.papermc.paper.util.MCUtil.getChunkCoordinate(player.getZ());
|
||||
// Note: players need to be explicitly added to distance maps before they can be updated
|
||||
this.nearbyPlayers.tickPlayer(player);
|
||||
+ // Paper start - use distance map to optimise entity tracker
|
||||
+ for (int i = 0, len = TRACKING_RANGE_TYPES.length; i < len; ++i) {
|
||||
+ com.destroystokyo.paper.util.misc.PlayerAreaMap trackMap = this.playerEntityTrackerTrackMaps[i];
|
||||
+ int trackRange = this.entityTrackerTrackRanges[i];
|
||||
+
|
||||
+ trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, io.papermc.paper.chunk.system.ChunkSystem.getSendViewDistance(player)));
|
||||
+ }
|
||||
+ // Paper end - use distance map to optimise entity tracker
|
||||
}
|
||||
// Paper end
|
||||
// Paper start
|
||||
@@ -248,6 +286,48 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper start
|
||||
this.nearbyPlayers = new io.papermc.paper.util.player.NearbyPlayers(this.level);
|
||||
// Paper end
|
||||
+ // Paper start - use distance map to optimise entity tracker
|
||||
+ this.playerEntityTrackerTrackMaps = new com.destroystokyo.paper.util.misc.PlayerAreaMap[TRACKING_RANGE_TYPES.length];
|
||||
+ this.entityTrackerTrackRanges = new int[TRACKING_RANGE_TYPES.length];
|
||||
+
|
||||
+ org.spigotmc.SpigotWorldConfig spigotWorldConfig = this.level.spigotConfig;
|
||||
+
|
||||
+ for (int ordinal = 0, len = TRACKING_RANGE_TYPES.length; ordinal < len; ++ordinal) {
|
||||
+ org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = TRACKING_RANGE_TYPES[ordinal];
|
||||
+ int configuredSpigotValue;
|
||||
+ switch (trackingRangeType) {
|
||||
+ case PLAYER:
|
||||
+ configuredSpigotValue = spigotWorldConfig.playerTrackingRange;
|
||||
+ break;
|
||||
+ case ANIMAL:
|
||||
+ configuredSpigotValue = spigotWorldConfig.animalTrackingRange;
|
||||
+ break;
|
||||
+ case MONSTER:
|
||||
+ configuredSpigotValue = spigotWorldConfig.monsterTrackingRange;
|
||||
+ break;
|
||||
+ case MISC:
|
||||
+ configuredSpigotValue = spigotWorldConfig.miscTrackingRange;
|
||||
+ break;
|
||||
+ case OTHER:
|
||||
+ configuredSpigotValue = spigotWorldConfig.otherTrackingRange;
|
||||
+ break;
|
||||
+ case ENDERDRAGON:
|
||||
+ configuredSpigotValue = EntityType.ENDER_DRAGON.clientTrackingRange() * 16;
|
||||
+ break;
|
||||
+ case DISPLAY:
|
||||
+ configuredSpigotValue = spigotWorldConfig.displayTrackingRange;
|
||||
+ break;
|
||||
+ default:
|
||||
+ throw new IllegalStateException("Missing case for enum " + trackingRangeType);
|
||||
+ }
|
||||
+ configuredSpigotValue = convertSpigotRangeToVanilla(configuredSpigotValue);
|
||||
+
|
||||
+ int trackRange = (configuredSpigotValue >>> 4) + ((configuredSpigotValue & 15) != 0 ? 1 : 0);
|
||||
+ this.entityTrackerTrackRanges[ordinal] = trackRange;
|
||||
+
|
||||
+ this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets);
|
||||
+ }
|
||||
+ // Paper end - use distance map to optimise entity tracker
|
||||
}
|
||||
|
||||
// Paper start
|
||||
@@ -821,17 +901,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
|
||||
public void move(ServerPlayer player) {
|
||||
- ObjectIterator objectiterator = this.entityMap.values().iterator();
|
||||
-
|
||||
- while (objectiterator.hasNext()) {
|
||||
- ChunkMap.TrackedEntity playerchunkmap_entitytracker = (ChunkMap.TrackedEntity) objectiterator.next();
|
||||
-
|
||||
- if (playerchunkmap_entitytracker.entity == player) {
|
||||
- playerchunkmap_entitytracker.updatePlayers(this.level.players());
|
||||
- } else {
|
||||
- playerchunkmap_entitytracker.updatePlayer(player);
|
||||
- }
|
||||
- }
|
||||
+ // Paper - delay this logic for the entity tracker tick, no need to duplicate it
|
||||
|
||||
SectionPos sectionposition = player.getLastSectionPos();
|
||||
SectionPos sectionposition1 = SectionPos.of((EntityAccess) player);
|
||||
@@ -909,7 +979,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
|
||||
entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker
|
||||
this.entityMap.put(entity.getId(), playerchunkmap_entitytracker);
|
||||
- playerchunkmap_entitytracker.updatePlayers(this.level.players());
|
||||
+ playerchunkmap_entitytracker.updatePlayers(entity.getPlayersInTrackRange()); // Paper - don't search all players
|
||||
if (entity instanceof ServerPlayer) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) entity;
|
||||
|
||||
@@ -951,9 +1021,38 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
entity.tracker = null; // Paper - We're no longer tracked
|
||||
}
|
||||
|
||||
+ // Paper start - optimised tracker
|
||||
+ private final void processTrackQueue() {
|
||||
+ this.level.timings.tracker1.startTiming();
|
||||
+ try {
|
||||
+ for (TrackedEntity tracker : this.entityMap.values()) {
|
||||
+ // update tracker entry
|
||||
+ tracker.updatePlayers(tracker.entity.getPlayersInTrackRange());
|
||||
+ }
|
||||
+ } finally {
|
||||
+ this.level.timings.tracker1.stopTiming();
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ this.level.timings.tracker2.startTiming();
|
||||
+ try {
|
||||
+ for (TrackedEntity tracker : this.entityMap.values()) {
|
||||
+ tracker.serverEntity.sendChanges();
|
||||
+ }
|
||||
+ } finally {
|
||||
+ this.level.timings.tracker2.stopTiming();
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - optimised tracker
|
||||
+
|
||||
protected void tick() {
|
||||
+ // Paper start - optimized tracker
|
||||
+ if (true) {
|
||||
+ this.processTrackQueue();
|
||||
+ return;
|
||||
+ }
|
||||
+ // Paper end - optimized tracker
|
||||
// Paper - rewrite chunk system
|
||||
-
|
||||
List<ServerPlayer> list = Lists.newArrayList();
|
||||
List<ServerPlayer> list1 = this.level.players();
|
||||
ObjectIterator objectiterator = this.entityMap.values().iterator();
|
||||
@@ -1108,6 +1207,42 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.lastSectionPos = SectionPos.of((EntityAccess) entity);
|
||||
}
|
||||
|
||||
+ // Paper start - use distance map to optimise tracker
|
||||
+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> lastTrackerCandidates;
|
||||
+
|
||||
+ final void updatePlayers(com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> newTrackerCandidates) {
|
||||
+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> oldTrackerCandidates = this.lastTrackerCandidates;
|
||||
+ this.lastTrackerCandidates = newTrackerCandidates;
|
||||
+
|
||||
+ if (newTrackerCandidates != null) {
|
||||
+ Object[] rawData = newTrackerCandidates.getBackingSet();
|
||||
+ for (int i = 0, len = rawData.length; i < len; ++i) {
|
||||
+ Object raw = rawData[i];
|
||||
+ if (!(raw instanceof ServerPlayer)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ ServerPlayer player = (ServerPlayer)raw;
|
||||
+ this.updatePlayer(player);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (oldTrackerCandidates == newTrackerCandidates) {
|
||||
+ // this is likely the case.
|
||||
+ // means there has been no range changes, so we can just use the above for tracking.
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ // stuff could have been removed, so we need to check the trackedPlayers set
|
||||
+ // for players that were removed
|
||||
+
|
||||
+ for (ServerPlayerConnection conn : this.seenBy.toArray(new ServerPlayerConnection[0])) { // avoid CME
|
||||
+ if (newTrackerCandidates == null || !newTrackerCandidates.contains(conn.getPlayer())) {
|
||||
+ this.updatePlayer(conn.getPlayer());
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - use distance map to optimise tracker
|
||||
+
|
||||
public boolean equals(Object object) {
|
||||
return object instanceof ChunkMap.TrackedEntity ? ((ChunkMap.TrackedEntity) object).entity.getId() == this.entity.getId() : false;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 2519c08a45ce3febcf51ac308ad98ac0e2657cf3..3062e108ed80ace0f2caf03c70a8e48f276be450 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -63,6 +63,7 @@ import net.minecraft.network.syncher.EntityDataSerializers;
|
||||
import net.minecraft.network.syncher.SyncedDataHolder;
|
||||
import net.minecraft.network.syncher.SynchedEntityData;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
+import io.papermc.paper.util.MCUtil;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerEntity;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
@@ -445,6 +446,38 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return this.originWorld;
|
||||
}
|
||||
// Paper end - Entity origin API
|
||||
+ // Paper start - optimise entity tracking
|
||||
+ final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this);
|
||||
+
|
||||
+ public boolean isLegacyTrackingEntity = false;
|
||||
+
|
||||
+ public final void setLegacyTrackingEntity(final boolean isLegacyTrackingEntity) {
|
||||
+ this.isLegacyTrackingEntity = isLegacyTrackingEntity;
|
||||
+ }
|
||||
+
|
||||
+ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> getPlayersInTrackRange() {
|
||||
+ // determine highest range of passengers
|
||||
+ if (this.passengers.isEmpty()) {
|
||||
+ return ((ServerLevel)this.level).getChunkSource().chunkMap.playerEntityTrackerTrackMaps[this.trackingRangeType.ordinal()]
|
||||
+ .getObjectsInRange(MCUtil.getCoordinateKey(this));
|
||||
+ }
|
||||
+ Iterable<Entity> passengers = this.getIndirectPassengers();
|
||||
+ net.minecraft.server.level.ChunkMap chunkMap = ((ServerLevel)this.level).getChunkSource().chunkMap;
|
||||
+ org.spigotmc.TrackingRange.TrackingRangeType type = this.trackingRangeType;
|
||||
+ int range = chunkMap.getEntityTrackerRange(type.ordinal());
|
||||
+
|
||||
+ for (Entity passenger : passengers) {
|
||||
+ org.spigotmc.TrackingRange.TrackingRangeType passengerType = passenger.trackingRangeType;
|
||||
+ int passengerRange = chunkMap.getEntityTrackerRange(passengerType.ordinal());
|
||||
+ if (passengerRange > range) {
|
||||
+ type = passengerType;
|
||||
+ range = passengerRange;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this));
|
||||
+ }
|
||||
+ // Paper end - optimise entity tracking
|
||||
public float getBukkitYaw() {
|
||||
return this.yRot;
|
||||
}
|
||||
diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
index bb06f89a29f30144e7e2113e088a503db006a83c..e4425b242fe73d1fd2bd10c313aa16925432329f 100644
|
||||
--- a/src/main/java/org/spigotmc/TrackingRange.java
|
||||
+++ b/src/main/java/org/spigotmc/TrackingRange.java
|
||||
@@ -55,4 +55,48 @@ public class TrackingRange
|
||||
return config.otherTrackingRange;
|
||||
}
|
||||
}
|
||||
+
|
||||
+ // Paper start - optimise entity tracking
|
||||
+ // copied from above, TODO check on update
|
||||
+ public static TrackingRangeType getTrackingRangeType(Entity entity)
|
||||
+ {
|
||||
+ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EnderDragon) return TrackingRangeType.ENDERDRAGON; // Paper - enderdragon is exempt
|
||||
+ if ( entity instanceof ServerPlayer )
|
||||
+ {
|
||||
+ return TrackingRangeType.PLAYER;
|
||||
+ // Paper start - Simplify and set water mobs to animal tracking range
|
||||
+ }
|
||||
+ switch (entity.activationType) {
|
||||
+ case RAIDER:
|
||||
+ case MONSTER:
|
||||
+ case FLYING_MONSTER:
|
||||
+ return TrackingRangeType.MONSTER;
|
||||
+ case WATER:
|
||||
+ case VILLAGER:
|
||||
+ case ANIMAL:
|
||||
+ return TrackingRangeType.ANIMAL;
|
||||
+ case MISC:
|
||||
+ }
|
||||
+ if ( entity instanceof ItemFrame || entity instanceof Painting || entity instanceof ItemEntity || entity instanceof ExperienceOrb )
|
||||
+ // Paper end
|
||||
+ {
|
||||
+ return TrackingRangeType.MISC;
|
||||
+ } else if (entity instanceof Display) {
|
||||
+ return TrackingRangeType.DISPLAY;
|
||||
+ } else
|
||||
+ {
|
||||
+ return TrackingRangeType.OTHER;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static enum TrackingRangeType {
|
||||
+ PLAYER,
|
||||
+ ANIMAL,
|
||||
+ MONSTER,
|
||||
+ MISC,
|
||||
+ OTHER,
|
||||
+ ENDERDRAGON,
|
||||
+ DISPLAY;
|
||||
+ }
|
||||
+ // Paper end - optimise entity tracking
|
||||
}
|
||||
4723
patches/server/0005-Paper-Unapplied-Collision-optimisations.patch
Normal file
4723
patches/server/0005-Paper-Unapplied-Collision-optimisations.patch
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,521 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Spottedleaf <Spottedleaf@users.noreply.github.com>
|
||||
Date: Tue, 12 Sep 2023 06:50:16 -0700
|
||||
Subject: [PATCH] Paper Unapplied - Actually optimise explosions
|
||||
|
||||
The vast majority of blocks an explosion of power ~4 tries
|
||||
to destroy are duplicates. The core of the block destroying
|
||||
part of this patch is to cache the block state, resistance, and
|
||||
whether it should explode - as those will not change.
|
||||
|
||||
The other part of this patch is to optimise the visibility
|
||||
percentage calculation. The new visibility calculation takes
|
||||
advantage of the block caching already done by the explosion logic.
|
||||
It continues to update the cache as the visibility calculation
|
||||
uses many rays which can overlap significantly.
|
||||
|
||||
Effectively, the patch uses a lot of caching to eliminate
|
||||
redundant operations.
|
||||
|
||||
Performance benchmarking explosions is challenging, as it varies
|
||||
depending on the power, the number of nearby entities, and the
|
||||
nearby terrain. This means that no benchmark can cover all the cases.
|
||||
I decided to test a giant block of TNT, as that's where the optimisations
|
||||
would be needed the most.
|
||||
|
||||
I tested using a 50x10x50 block of TNT above ground
|
||||
and determined the following:
|
||||
|
||||
Vanilla time per explosion: 2.27ms
|
||||
Lithium time per explosion: 1.07ms
|
||||
This patch time per explosion: 0.45ms
|
||||
|
||||
The results indicate that this logic is 5 times faster than Vanilla
|
||||
and 2.3 times faster than Lithium.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index bff83fe413c7baef4ba56a3270ea4463a58c792f..7aa9ddb1d61ffb7da3f867e5a5bd04e3432b5621 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -113,6 +113,271 @@ public class Explosion {
|
||||
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
|
||||
}
|
||||
|
||||
+ // Paper start - optimise collisions
|
||||
+ private static final double[] CACHED_RAYS;
|
||||
+ static {
|
||||
+ final it.unimi.dsi.fastutil.doubles.DoubleArrayList rayCoords = new it.unimi.dsi.fastutil.doubles.DoubleArrayList();
|
||||
+
|
||||
+ for (int x = 0; x <= 15; ++x) {
|
||||
+ for (int y = 0; y <= 15; ++y) {
|
||||
+ for (int z = 0; z <= 15; ++z) {
|
||||
+ if ((x == 0 || x == 15) || (y == 0 || y == 15) || (z == 0 || z == 15)) {
|
||||
+ double xDir = (double)((float)x / 15.0F * 2.0F - 1.0F);
|
||||
+ double yDir = (double)((float)y / 15.0F * 2.0F - 1.0F);
|
||||
+ double zDir = (double)((float)z / 15.0F * 2.0F - 1.0F);
|
||||
+
|
||||
+ double mag = Math.sqrt(
|
||||
+ xDir * xDir + yDir * yDir + zDir * zDir
|
||||
+ );
|
||||
+
|
||||
+ rayCoords.add((xDir / mag) * (double)0.3F);
|
||||
+ rayCoords.add((yDir / mag) * (double)0.3F);
|
||||
+ rayCoords.add((zDir / mag) * (double)0.3F);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ CACHED_RAYS = rayCoords.toDoubleArray();
|
||||
+ }
|
||||
+
|
||||
+ private static final int CHUNK_CACHE_SHIFT = 2;
|
||||
+ private static final int CHUNK_CACHE_MASK = (1 << CHUNK_CACHE_SHIFT) - 1;
|
||||
+ private static final int CHUNK_CACHE_WIDTH = 1 << CHUNK_CACHE_SHIFT;
|
||||
+
|
||||
+ private static final int BLOCK_EXPLOSION_CACHE_SHIFT = 3;
|
||||
+ private static final int BLOCK_EXPLOSION_CACHE_MASK = (1 << BLOCK_EXPLOSION_CACHE_SHIFT) - 1;
|
||||
+ private static final int BLOCK_EXPLOSION_CACHE_WIDTH = 1 << BLOCK_EXPLOSION_CACHE_SHIFT;
|
||||
+
|
||||
+ // resistance = (res + 0.3F) * 0.3F;
|
||||
+ // so for resistance = 0, we need res = -0.3F
|
||||
+ private static final Float ZERO_RESISTANCE = Float.valueOf(-0.3f);
|
||||
+ private it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<ExplosionBlockCache> blockCache = null;
|
||||
+
|
||||
+ public static final class ExplosionBlockCache {
|
||||
+
|
||||
+ public final long key;
|
||||
+ public final BlockPos immutablePos;
|
||||
+ public final BlockState blockState;
|
||||
+ public final FluidState fluidState;
|
||||
+ public final float resistance;
|
||||
+ public final boolean outOfWorld;
|
||||
+ public Boolean shouldExplode; // null -> not called yet
|
||||
+ public net.minecraft.world.phys.shapes.VoxelShape cachedCollisionShape;
|
||||
+
|
||||
+ public ExplosionBlockCache(long key, BlockPos immutablePos, BlockState blockState, FluidState fluidState, float resistance,
|
||||
+ boolean outOfWorld) {
|
||||
+ this.key = key;
|
||||
+ this.immutablePos = immutablePos;
|
||||
+ this.blockState = blockState;
|
||||
+ this.fluidState = fluidState;
|
||||
+ this.resistance = resistance;
|
||||
+ this.outOfWorld = outOfWorld;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private long[] chunkPosCache = null;
|
||||
+ private net.minecraft.world.level.chunk.LevelChunk[] chunkCache = null;
|
||||
+
|
||||
+ private ExplosionBlockCache getOrCacheExplosionBlock(final int x, final int y, final int z,
|
||||
+ final long key, final boolean calculateResistance) {
|
||||
+ ExplosionBlockCache ret = this.blockCache.get(key);
|
||||
+ if (ret != null) {
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ BlockPos pos = new BlockPos(x, y, z);
|
||||
+
|
||||
+ if (!this.level.isInWorldBounds(pos)) {
|
||||
+ ret = new ExplosionBlockCache(key, pos, null, null, 0.0f, true);
|
||||
+ } else {
|
||||
+ net.minecraft.world.level.chunk.LevelChunk chunk;
|
||||
+ long chunkKey = io.papermc.paper.util.CoordinateUtils.getChunkKey(x >> 4, z >> 4);
|
||||
+ int chunkCacheKey = ((x >> 4) & CHUNK_CACHE_MASK) | (((z >> 4) << CHUNK_CACHE_SHIFT) & (CHUNK_CACHE_MASK << CHUNK_CACHE_SHIFT));
|
||||
+ if (this.chunkPosCache[chunkCacheKey] == chunkKey) {
|
||||
+ chunk = this.chunkCache[chunkCacheKey];
|
||||
+ } else {
|
||||
+ this.chunkPosCache[chunkCacheKey] = chunkKey;
|
||||
+ this.chunkCache[chunkCacheKey] = chunk = this.level.getChunk(x >> 4, z >> 4);
|
||||
+ }
|
||||
+
|
||||
+ BlockState blockState = chunk.getBlockStateFinal(x, y, z);
|
||||
+ FluidState fluidState = blockState.getFluidState();
|
||||
+
|
||||
+ Optional<Float> resistance = !calculateResistance ? Optional.empty() : this.damageCalculator.getBlockExplosionResistance((Explosion)(Object)this, this.level, pos, blockState, fluidState);
|
||||
+
|
||||
+ ret = new ExplosionBlockCache(
|
||||
+ key, pos, blockState, fluidState,
|
||||
+ (resistance.orElse(ZERO_RESISTANCE).floatValue() + 0.3f) * 0.3f,
|
||||
+ false
|
||||
+ );
|
||||
+ }
|
||||
+
|
||||
+ this.blockCache.put(key, ret);
|
||||
+
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ private boolean clipsAnything(final Vec3 from, final Vec3 to,
|
||||
+ final io.papermc.paper.util.CollisionUtil.LazyEntityCollisionContext context,
|
||||
+ final ExplosionBlockCache[] blockCache,
|
||||
+ final BlockPos.MutableBlockPos currPos) {
|
||||
+ // assume that context.delegated = false
|
||||
+ final double adjX = io.papermc.paper.util.CollisionUtil.COLLISION_EPSILON * (from.x - to.x);
|
||||
+ final double adjY = io.papermc.paper.util.CollisionUtil.COLLISION_EPSILON * (from.y - to.y);
|
||||
+ final double adjZ = io.papermc.paper.util.CollisionUtil.COLLISION_EPSILON * (from.z - to.z);
|
||||
+
|
||||
+ if (adjX == 0.0 && adjY == 0.0 && adjZ == 0.0) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ final double toXAdj = to.x - adjX;
|
||||
+ final double toYAdj = to.y - adjY;
|
||||
+ final double toZAdj = to.z - adjZ;
|
||||
+ final double fromXAdj = from.x + adjX;
|
||||
+ final double fromYAdj = from.y + adjY;
|
||||
+ final double fromZAdj = from.z + adjZ;
|
||||
+
|
||||
+ int currX = Mth.floor(fromXAdj);
|
||||
+ int currY = Mth.floor(fromYAdj);
|
||||
+ int currZ = Mth.floor(fromZAdj);
|
||||
+
|
||||
+ final double diffX = toXAdj - fromXAdj;
|
||||
+ final double diffY = toYAdj - fromYAdj;
|
||||
+ final double diffZ = toZAdj - fromZAdj;
|
||||
+
|
||||
+ final double dxDouble = Math.signum(diffX);
|
||||
+ final double dyDouble = Math.signum(diffY);
|
||||
+ final double dzDouble = Math.signum(diffZ);
|
||||
+
|
||||
+ final int dx = (int)dxDouble;
|
||||
+ final int dy = (int)dyDouble;
|
||||
+ final int dz = (int)dzDouble;
|
||||
+
|
||||
+ final double normalizedDiffX = diffX == 0.0 ? Double.MAX_VALUE : dxDouble / diffX;
|
||||
+ final double normalizedDiffY = diffY == 0.0 ? Double.MAX_VALUE : dyDouble / diffY;
|
||||
+ final double normalizedDiffZ = diffZ == 0.0 ? Double.MAX_VALUE : dzDouble / diffZ;
|
||||
+
|
||||
+ double normalizedCurrX = normalizedDiffX * (diffX > 0.0 ? (1.0 - Mth.frac(fromXAdj)) : Mth.frac(fromXAdj));
|
||||
+ double normalizedCurrY = normalizedDiffY * (diffY > 0.0 ? (1.0 - Mth.frac(fromYAdj)) : Mth.frac(fromYAdj));
|
||||
+ double normalizedCurrZ = normalizedDiffZ * (diffZ > 0.0 ? (1.0 - Mth.frac(fromZAdj)) : Mth.frac(fromZAdj));
|
||||
+
|
||||
+ for (;;) {
|
||||
+ currPos.set(currX, currY, currZ);
|
||||
+
|
||||
+ // ClipContext.Block.COLLIDER -> BlockBehaviour.BlockStateBase::getCollisionShape
|
||||
+ // ClipContext.Fluid.NONE -> ignore fluids
|
||||
+
|
||||
+ // read block from cache
|
||||
+ final long key = BlockPos.asLong(currX, currY, currZ);
|
||||
+
|
||||
+ final int cacheKey =
|
||||
+ (currX & BLOCK_EXPLOSION_CACHE_MASK) |
|
||||
+ (currY & BLOCK_EXPLOSION_CACHE_MASK) << (BLOCK_EXPLOSION_CACHE_SHIFT) |
|
||||
+ (currZ & BLOCK_EXPLOSION_CACHE_MASK) << (BLOCK_EXPLOSION_CACHE_SHIFT + BLOCK_EXPLOSION_CACHE_SHIFT);
|
||||
+ ExplosionBlockCache cachedBlock = blockCache[cacheKey];
|
||||
+ if (cachedBlock == null || cachedBlock.key != key) {
|
||||
+ blockCache[cacheKey] = cachedBlock = this.getOrCacheExplosionBlock(currX, currY, currZ, key, false);
|
||||
+ }
|
||||
+
|
||||
+ final BlockState blockState = cachedBlock.blockState;
|
||||
+ if (blockState != null && !blockState.emptyCollisionShape()) {
|
||||
+ net.minecraft.world.phys.shapes.VoxelShape collision = cachedBlock.cachedCollisionShape;
|
||||
+ if (collision == null) {
|
||||
+ collision = blockState.getConstantCollisionShape();
|
||||
+ if (collision == null) {
|
||||
+ collision = blockState.getCollisionShape(this.level, currPos, context);
|
||||
+ if (!context.isDelegated()) {
|
||||
+ // if it was not delegated during this call, assume that for any future ones it will not be delegated
|
||||
+ // again, and cache the result
|
||||
+ cachedBlock.cachedCollisionShape = collision;
|
||||
+ }
|
||||
+ } else {
|
||||
+ cachedBlock.cachedCollisionShape = collision;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (!collision.isEmpty() && collision.clip(from, to, currPos) != null) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (normalizedCurrX > 1.0 && normalizedCurrY > 1.0 && normalizedCurrZ > 1.0) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ // inc the smallest normalized coordinate
|
||||
+
|
||||
+ if (normalizedCurrX < normalizedCurrY) {
|
||||
+ if (normalizedCurrX < normalizedCurrZ) {
|
||||
+ currX += dx;
|
||||
+ normalizedCurrX += normalizedDiffX;
|
||||
+ } else {
|
||||
+ // x < y && x >= z <--> z < y && z <= x
|
||||
+ currZ += dz;
|
||||
+ normalizedCurrZ += normalizedDiffZ;
|
||||
+ }
|
||||
+ } else if (normalizedCurrY < normalizedCurrZ) {
|
||||
+ // y <= x && y < z
|
||||
+ currY += dy;
|
||||
+ normalizedCurrY += normalizedDiffY;
|
||||
+ } else {
|
||||
+ // y <= x && z <= y <--> z <= y && z <= x
|
||||
+ currZ += dz;
|
||||
+ normalizedCurrZ += normalizedDiffZ;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private float getSeenFraction(final Vec3 source, final Entity target,
|
||||
+ final ExplosionBlockCache[] blockCache,
|
||||
+ final BlockPos.MutableBlockPos blockPos) {
|
||||
+ final AABB boundingBox = target.getBoundingBox();
|
||||
+ final double diffX = boundingBox.maxX - boundingBox.minX;
|
||||
+ final double diffY = boundingBox.maxY - boundingBox.minY;
|
||||
+ final double diffZ = boundingBox.maxZ - boundingBox.minZ;
|
||||
+
|
||||
+ final double incX = 1.0 / (diffX * 2.0 + 1.0);
|
||||
+ final double incY = 1.0 / (diffY * 2.0 + 1.0);
|
||||
+ final double incZ = 1.0 / (diffZ * 2.0 + 1.0);
|
||||
+
|
||||
+ if (incX < 0.0 || incY < 0.0 || incZ < 0.0) {
|
||||
+ return 0.0f;
|
||||
+ }
|
||||
+
|
||||
+ final double offX = (1.0 - Math.floor(1.0 / incX) * incX) * 0.5 + boundingBox.minX;
|
||||
+ final double offY = boundingBox.minY;
|
||||
+ final double offZ = (1.0 - Math.floor(1.0 / incZ) * incZ) * 0.5 + boundingBox.minZ;
|
||||
+
|
||||
+ final io.papermc.paper.util.CollisionUtil.LazyEntityCollisionContext context = new io.papermc.paper.util.CollisionUtil.LazyEntityCollisionContext(target);
|
||||
+
|
||||
+ int totalRays = 0;
|
||||
+ int missedRays = 0;
|
||||
+
|
||||
+ for (double dx = 0.0; dx <= 1.0; dx += incX) {
|
||||
+ final double fromX = Math.fma(dx, diffX, offX);
|
||||
+ for (double dy = 0.0; dy <= 1.0; dy += incY) {
|
||||
+ final double fromY = Math.fma(dy, diffY, offY);
|
||||
+ for (double dz = 0.0; dz <= 1.0; dz += incZ) {
|
||||
+ ++totalRays;
|
||||
+
|
||||
+ final Vec3 from = new Vec3(
|
||||
+ fromX,
|
||||
+ fromY,
|
||||
+ Math.fma(dz, diffZ, offZ)
|
||||
+ );
|
||||
+
|
||||
+ if (!this.clipsAnything(from, source, context, blockCache, blockPos)) {
|
||||
+ ++missedRays;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return (float)missedRays / (float)totalRays;
|
||||
+ }
|
||||
+ // Paper end - optimise collisions
|
||||
+
|
||||
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
|
||||
return (ExplosionDamageCalculator) (entity == null ? Explosion.EXPLOSION_DAMAGE_CALCULATOR : new EntityBasedExplosionDamageCalculator(entity));
|
||||
}
|
||||
@@ -173,40 +438,88 @@ public class Explosion {
|
||||
int i;
|
||||
int j;
|
||||
|
||||
- for (int k = 0; k < 16; ++k) {
|
||||
- for (i = 0; i < 16; ++i) {
|
||||
- for (j = 0; j < 16; ++j) {
|
||||
- if (k == 0 || k == 15 || i == 0 || i == 15 || j == 0 || j == 15) {
|
||||
- double d0 = (double) ((float) k / 15.0F * 2.0F - 1.0F);
|
||||
- double d1 = (double) ((float) i / 15.0F * 2.0F - 1.0F);
|
||||
- double d2 = (double) ((float) j / 15.0F * 2.0F - 1.0F);
|
||||
- double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
-
|
||||
- d0 /= d3;
|
||||
- d1 /= d3;
|
||||
- d2 /= d3;
|
||||
+ // Paper start - optimise explosions
|
||||
+ this.blockCache = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>();
|
||||
+
|
||||
+ this.chunkPosCache = new long[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH];
|
||||
+ java.util.Arrays.fill(this.chunkPosCache, ChunkPos.INVALID_CHUNK_POS);
|
||||
+
|
||||
+ this.chunkCache = new net.minecraft.world.level.chunk.LevelChunk[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH];
|
||||
+
|
||||
+ final ExplosionBlockCache[] blockCache = new ExplosionBlockCache[BLOCK_EXPLOSION_CACHE_WIDTH * BLOCK_EXPLOSION_CACHE_WIDTH * BLOCK_EXPLOSION_CACHE_WIDTH];
|
||||
+ // use initial cache value that is most likely to be used: the source position
|
||||
+ final ExplosionBlockCache initialCache;
|
||||
+ {
|
||||
+ final int blockX = Mth.floor(this.x);
|
||||
+ final int blockY = Mth.floor(this.y);
|
||||
+ final int blockZ = Mth.floor(this.z);
|
||||
+
|
||||
+ final long key = BlockPos.asLong(blockX, blockY, blockZ);
|
||||
+
|
||||
+ initialCache = this.getOrCacheExplosionBlock(blockX, blockY, blockZ, key, true);
|
||||
+ }
|
||||
+ // 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
|
||||
+ // calculations in one go
|
||||
+ // additional aggressive caching of block retrieval is very significant, as at low power (i.e tnt) most
|
||||
+ // block retrievals are not unique
|
||||
+ for (int ray = 0, len = CACHED_RAYS.length; ray < len;) {
|
||||
+ {
|
||||
+ {
|
||||
+ {
|
||||
+ ExplosionBlockCache cachedBlock = initialCache;
|
||||
+
|
||||
+ double d0 = CACHED_RAYS[ray];
|
||||
+ double d1 = CACHED_RAYS[ray + 1];
|
||||
+ double d2 = CACHED_RAYS[ray + 2];
|
||||
+ ray += 3;
|
||||
+ // Paper end - optimise explosions
|
||||
float f = this.radius * (0.7F + this.level.random.nextFloat() * 0.6F);
|
||||
double d4 = this.x;
|
||||
double d5 = this.y;
|
||||
double d6 = this.z;
|
||||
|
||||
for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) {
|
||||
- BlockPos blockposition = BlockPos.containing(d4, d5, d6);
|
||||
- BlockState iblockdata = this.level.getBlockState(blockposition);
|
||||
- if (!iblockdata.isDestroyable()) continue; // Paper - Protect Bedrock and End Portal/Frames from being destroyed
|
||||
- FluidState fluid = iblockdata.getFluidState(); // Paper - Perf: Optimize call to getFluid for explosions
|
||||
+ // Paper start - optimise explosions
|
||||
+ final int blockX = Mth.floor(d4);
|
||||
+ final int blockY = Mth.floor(d5);
|
||||
+ final int blockZ = Mth.floor(d6);
|
||||
+
|
||||
+ final long key = BlockPos.asLong(blockX, blockY, blockZ);
|
||||
+
|
||||
+ if (cachedBlock.key != key) {
|
||||
+ final int cacheKey =
|
||||
+ (blockX & BLOCK_EXPLOSION_CACHE_MASK) |
|
||||
+ (blockY & BLOCK_EXPLOSION_CACHE_MASK) << (BLOCK_EXPLOSION_CACHE_SHIFT) |
|
||||
+ (blockZ & BLOCK_EXPLOSION_CACHE_MASK) << (BLOCK_EXPLOSION_CACHE_SHIFT + BLOCK_EXPLOSION_CACHE_SHIFT);
|
||||
+ cachedBlock = blockCache[cacheKey];
|
||||
+ if (cachedBlock == null || cachedBlock.key != key) {
|
||||
+ blockCache[cacheKey] = cachedBlock = this.getOrCacheExplosionBlock(blockX, blockY, blockZ, key, true);
|
||||
+ }
|
||||
+ }
|
||||
|
||||
- if (!this.level.isInWorldBounds(blockposition)) {
|
||||
+ if (cachedBlock.outOfWorld) {
|
||||
break;
|
||||
}
|
||||
|
||||
- Optional<Float> optional = this.damageCalculator.getBlockExplosionResistance(this, this.level, blockposition, iblockdata, fluid);
|
||||
+ BlockPos blockposition = cachedBlock.immutablePos;
|
||||
+ BlockState iblockdata = cachedBlock.blockState;
|
||||
+ // Paper end - optimise explosions
|
||||
|
||||
- if (optional.isPresent()) {
|
||||
- f -= ((Float) optional.get() + 0.3F) * 0.3F;
|
||||
- }
|
||||
+ if (!iblockdata.isDestroyable()) continue; // Paper
|
||||
+ // Paper - optimise explosions
|
||||
|
||||
- if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) {
|
||||
+ f -= cachedBlock.resistance; // Paper - optimise explosions
|
||||
+
|
||||
+ if (f > 0.0F && cachedBlock.shouldExplode == null) { // Paper - optimise explosions
|
||||
+ // Paper start - optimise explosions
|
||||
+ // note: we expect shouldBlockExplode to be pure with respect to power, as Vanilla currently is.
|
||||
+ // basically, it is unused, which allows us to cache the result
|
||||
+ final boolean shouldExplode = this.damageCalculator.shouldBlockExplode(this, this.level, cachedBlock.immutablePos, cachedBlock.blockState, f);
|
||||
+ cachedBlock.shouldExplode = shouldExplode ? Boolean.TRUE : Boolean.FALSE;
|
||||
+ if (shouldExplode && (this.fire || !cachedBlock.blockState.isAir())) {
|
||||
+ // Paper end - optimise explosions
|
||||
set.add(blockposition);
|
||||
// Paper start - prevent headless pistons from forming
|
||||
if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
|
||||
@@ -217,11 +530,12 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
// Paper end - prevent headless pistons from forming
|
||||
+ } // Paper - optimise explosions
|
||||
}
|
||||
|
||||
- d4 += d0 * 0.30000001192092896D;
|
||||
- d5 += d1 * 0.30000001192092896D;
|
||||
- d6 += d2 * 0.30000001192092896D;
|
||||
+ d4 += d0; // Paper - optimise explosions
|
||||
+ d5 += d1; // Paper - optimise explosions
|
||||
+ d6 += d2; // Paper - optimise explosions
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,6 +555,8 @@ public class Explosion {
|
||||
Vec3 vec3d = new Vec3(this.x, this.y, this.z);
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
+ final BlockPos.MutableBlockPos blockPos = new BlockPos.MutableBlockPos(); // Paper - optimise explosions
|
||||
+
|
||||
while (iterator.hasNext()) {
|
||||
Entity entity = (Entity) iterator.next();
|
||||
|
||||
@@ -276,11 +592,11 @@ public class Explosion {
|
||||
for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) {
|
||||
// Calculate damage separately for each EntityComplexPart
|
||||
if (list.contains(entityComplexPart)) {
|
||||
- entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity));
|
||||
+ 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
|
||||
}
|
||||
}
|
||||
} else {
|
||||
- entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity));
|
||||
+ entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entity, blockCache, blockPos))); // Paper - actually optimise explosions
|
||||
}
|
||||
|
||||
if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
|
||||
@@ -289,7 +605,7 @@ public class Explosion {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
- double d12 = (1.0D - d7) * this.getBlockDensity(vec3d, entity) * (double) this.damageCalculator.getKnockbackMultiplier(entity); // Paper - Optimize explosions
|
||||
+ double d12 = (1.0D - d7) * this.getBlockDensity(vec3d, entity, blockCache, blockPos) * (double) this.damageCalculator.getKnockbackMultiplier(entity); // Paper - Optimize explosions
|
||||
double d13;
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
@@ -328,6 +644,9 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
|
||||
+ this.blockCache = null; // Paper - optimise explosions
|
||||
+ this.chunkPosCache = null; // Paper - optimise explosions
|
||||
+ this.chunkCache = null; // Paper - optimise explosions
|
||||
}
|
||||
|
||||
public void finalizeExplosion(boolean particles) {
|
||||
@@ -547,14 +866,14 @@ public class Explosion {
|
||||
private BlockInteraction() {}
|
||||
}
|
||||
// Paper start - Optimize explosions
|
||||
- private float getBlockDensity(Vec3 vec3d, Entity entity) {
|
||||
+ private float getBlockDensity(Vec3 vec3d, Entity entity, ExplosionBlockCache[] blockCache, BlockPos.MutableBlockPos blockPos) { // Paper - optimise explosions
|
||||
if (!this.level.paperConfig().environment.optimizeExplosions) {
|
||||
- return getSeenPercent(vec3d, entity);
|
||||
+ return this.getSeenFraction(vec3d, entity, blockCache, blockPos); // Paper - optimise explosions
|
||||
}
|
||||
CacheKey key = new CacheKey(this, entity.getBoundingBox());
|
||||
Float blockDensity = this.level.explosionDensityCache.get(key);
|
||||
if (blockDensity == null) {
|
||||
- blockDensity = getSeenPercent(vec3d, entity);
|
||||
+ blockDensity = this.getSeenFraction(vec3d, entity, blockCache, blockPos); // Paper - optimise explosions;
|
||||
this.level.explosionDensityCache.put(key, blockDensity);
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
|
||||
index 0ef9b402d129b072134688c06719a56328581158..1eb259b48bcab6172c15546744eea410c6a3e1fe 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/ExplosionDamageCalculator.java
|
||||
@@ -26,11 +26,17 @@ public class ExplosionDamageCalculator {
|
||||
return 1.0F;
|
||||
}
|
||||
|
||||
+ @io.papermc.paper.annotation.DoNotUse @Deprecated // Paper
|
||||
public float getEntityDamageAmount(Explosion explosion, Entity entity) {
|
||||
+ // Paper start - actually optimise explosions
|
||||
+ return this.getEntityDamageAmount(explosion, entity, Explosion.getSeenPercent(explosion.center(), entity));
|
||||
+ }
|
||||
+ public float getEntityDamageAmount(Explosion explosion, Entity entity, double seenPercent) {
|
||||
+ // Paper end - actually optimise explosions
|
||||
float f = explosion.radius() * 2.0F;
|
||||
Vec3 vec3 = explosion.center();
|
||||
double d = Math.sqrt(entity.distanceToSqr(vec3)) / (double)f;
|
||||
- double e = (1.0 - d) * (double)Explosion.getSeenPercent(vec3, entity);
|
||||
+ double e = (1.0 - d) * seenPercent; // Paper - actually optimise explosions
|
||||
return (float)((e * e + e) / 2.0 * 7.0 * (double)f + 1.0);
|
||||
}
|
||||
}
|
||||
@@ -231,10 +231,10 @@ index 0000000000000000000000000000000000000000..3f518f3f1241d3dc1f76fab42e9fd789
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 48648f73925c79282df19158ef52678d10608f44..9677324fc698789e9cd880705985d6112c6bd9bb 100644
|
||||
index 1af29c2d6c591b11fd509821d54e6ea781c0929d..3f4997b642c9de1982a500d3a6ff07a9ca59da10 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1798,6 +1798,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1747,6 +1747,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.pop();
|
||||
this.profiler.pop();
|
||||
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
||||
@@ -243,10 +243,10 @@ index 48648f73925c79282df19158ef52678d10608f44..9677324fc698789e9cd880705985d611
|
||||
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index f2cd3046fdd280b03586e645216ccef15fc4b116..1059530bb6f817352c8304f6a1544aeb5ac14b30 100644
|
||||
index 11a002ec4482716d35ed04f2e24c96e8f7fe6f64..439f1e69cc330aa590311eb4e308e539815ad0d5 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -175,6 +175,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -176,6 +176,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
return this.sakuraConfig;
|
||||
}
|
||||
// Sakura end - sakura configuration files
|
||||
@@ -260,10 +260,10 @@ index f2cd3046fdd280b03586e645216ccef15fc4b116..1059530bb6f817352c8304f6a1544aeb
|
||||
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
|
||||
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
index f2b20ed5063a293f0b464548f590d652170cd1d8..91ad056cd98d799caf811defde57dbdcecc07700 100644
|
||||
index 8045d6c9398d1c88595da6e41aa1ed27fb6fbad0..4ddf48ff3a66c873f8c1d2ac8bfeab91266aeb4a 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
|
||||
@@ -252,6 +252,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
@@ -251,6 +251,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
|
||||
}
|
||||
// Paper end
|
||||
|
||||
@@ -255,10 +255,10 @@ index 1a37654aff9a9c86c9f7af10a1cf721371f0c5ec..82644b34a77dc5e5af38260b7b07b3ec
|
||||
public ClientboundSectionBlocksUpdatePacket(SectionPos sectionPos, ShortSet positions, LevelChunkSection section) {
|
||||
this.sectionPos = sectionPos;
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 9677324fc698789e9cd880705985d6112c6bd9bb..606ae62f597761296412e14750758fa185fc3c48 100644
|
||||
index 3f4997b642c9de1982a500d3a6ff07a9ca59da10..524ca2d1719ac52ae287f6c4c56ca9d024f084eb 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1799,6 +1799,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1748,6 +1748,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.profiler.pop();
|
||||
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
||||
worldserver.localConfig().expire(currentTickLong); // Sakura - add local config
|
||||
@@ -267,10 +267,10 @@ index 9677324fc698789e9cd880705985d6112c6bd9bb..606ae62f597761296412e14750758fa1
|
||||
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 7fb9ba3dadb1eca4a1000ea8cf4d13fed2b7db1e..7fb48e8924e7f6acfcaaecf284f9bf1925612a16 100644
|
||||
index daad83ea92bac1432feed77d5fc2d5c5c15a1b96..a9e41f1f87afa9778ec4d4bc3f01ef5e6cbefc91 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1438,6 +1438,22 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1312,6 +1312,22 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
}
|
||||
// Paper end - Configurable entity tracking range by Y
|
||||
|
||||
@@ -294,10 +294,10 @@ index 7fb9ba3dadb1eca4a1000ea8cf4d13fed2b7db1e..7fb48e8924e7f6acfcaaecf284f9bf19
|
||||
if (flag && !player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) { // Paper - only consider hits
|
||||
flag = false;
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index b5a66132f7ec10feb4682db38c80e5064e78f9f3..747ebfb09dcd4c619ee0543c8aa79c05416687a4 100644
|
||||
index 993dcba233c4816d020d671d8bf3f6133a1e86a3..85120c39a5fd60ff59e0b1b90815e541b83d964e 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1959,7 +1959,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1697,7 +1697,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
while (iterator.hasNext()) {
|
||||
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
|
||||
|
||||
@@ -307,10 +307,10 @@ index b5a66132f7ec10feb4682db38c80e5064e78f9f3..747ebfb09dcd4c619ee0543c8aa79c05
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
index 6a4637eef14cbd84bbe26ef16f004b8f93367a3d..bed136477493365d62d1b82e8f7802513a394991 100644
|
||||
index 2636b018cdd12e4d7f00b775257585ab8eb91171..98e052fecf852d9426671615d9c21f8cc94fb349 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
|
||||
@@ -277,6 +277,7 @@ public class ServerPlayer extends Player {
|
||||
@@ -280,6 +280,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper
|
||||
// Paper end - Optional per player mob spawns
|
||||
public final int[] mobBackoffCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper - per player mob count backoff
|
||||
@@ -318,7 +318,7 @@ index 6a4637eef14cbd84bbe26ef16f004b8f93367a3d..bed136477493365d62d1b82e8f780251
|
||||
|
||||
// CraftBukkit start
|
||||
public CraftPlayer.TransferCookieConnection transferCookieConnection;
|
||||
@@ -596,6 +597,15 @@ public class ServerPlayer extends Player {
|
||||
@@ -587,6 +588,15 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
this.respawnDimension = (ResourceKey) dataresult1.resultOrPartial(logger1::error).orElse(Level.OVERWORLD);
|
||||
}
|
||||
}
|
||||
@@ -334,7 +334,7 @@ index 6a4637eef14cbd84bbe26ef16f004b8f93367a3d..bed136477493365d62d1b82e8f780251
|
||||
|
||||
this.spawnExtraParticlesOnFall = nbt.getBoolean("spawn_extra_particles_on_fall");
|
||||
Tag nbtbase = nbt.get("raid_omen_position");
|
||||
@@ -674,6 +684,13 @@ public class ServerPlayer extends Player {
|
||||
@@ -665,6 +675,13 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple
|
||||
});
|
||||
}
|
||||
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
|
||||
@@ -349,10 +349,10 @@ index 6a4637eef14cbd84bbe26ef16f004b8f93367a3d..bed136477493365d62d1b82e8f780251
|
||||
nbt.putBoolean("spawn_extra_particles_on_fall", this.spawnExtraParticlesOnFall);
|
||||
if (this.raidOmenPosition != null) {
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
index 308aef9c4933b2bcdd622a34b68efab4a220fe4d..2aee1167e7c4f47f3fe82d135904beac0374bdfd 100644
|
||||
index b43f87ff4b9853b5d4bbea5ff9686d64d9d0d26b..79533a1677430039f410f66b55927e1dd8e35b15 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
|
||||
@@ -42,6 +42,23 @@ import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
@@ -43,6 +43,23 @@ import org.bukkit.craftbukkit.util.CraftLocation;
|
||||
import org.bukkit.craftbukkit.util.Waitable;
|
||||
import org.bukkit.event.player.PlayerKickEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||
@@ -376,7 +376,7 @@ index 308aef9c4933b2bcdd622a34b68efab4a220fe4d..2aee1167e7c4f47f3fe82d135904beac
|
||||
|
||||
public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener, CraftPlayer.TransferCookieConnection {
|
||||
|
||||
@@ -94,6 +111,65 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -95,6 +112,65 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
protected final org.bukkit.craftbukkit.CraftServer cserver;
|
||||
public boolean processedDisconnect;
|
||||
|
||||
@@ -442,7 +442,7 @@ index 308aef9c4933b2bcdd622a34b68efab4a220fe4d..2aee1167e7c4f47f3fe82d135904beac
|
||||
public CraftPlayer getCraftPlayer() {
|
||||
return (this.player == null) ? null : (CraftPlayer) this.player.getBukkitEntity();
|
||||
// CraftBukkit end
|
||||
@@ -300,6 +376,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -301,6 +377,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
ClientboundSetDefaultSpawnPositionPacket packet6 = (ClientboundSetDefaultSpawnPositionPacket) packet;
|
||||
this.player.compassTarget = CraftLocation.toBukkit(packet6.pos, this.getCraftPlayer().getWorld());
|
||||
}
|
||||
@@ -455,7 +455,7 @@ index 308aef9c4933b2bcdd622a34b68efab4a220fe4d..2aee1167e7c4f47f3fe82d135904beac
|
||||
// CraftBukkit end
|
||||
if (packet.isTerminal()) {
|
||||
this.close();
|
||||
@@ -313,8 +395,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
@@ -314,8 +396,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Sending packet");
|
||||
CrashReportCategory crashreportsystemdetails = crashreport.addCategory("Packet being sent");
|
||||
|
||||
@@ -469,10 +469,10 @@ index 308aef9c4933b2bcdd622a34b68efab4a220fe4d..2aee1167e7c4f47f3fe82d135904beac
|
||||
throw new ReportedException(crashreport);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
index 4ae88bfcead40cd05f9514a48a922a37767cb3cf..e675c47bf6630ccb843120902a10b9dc3952f5c7 100644
|
||||
index 7796e191747be545e744564a2b0b65790f69114d..b3bb98db278afde02786e5daa6fbb6e0fddad526 100644
|
||||
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
|
||||
@@ -3174,6 +3174,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
@@ -3119,6 +3119,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
|
||||
|
||||
event.setCancelled(cancelled);
|
||||
AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224
|
||||
@@ -481,13 +481,13 @@ index 4ae88bfcead40cd05f9514a48a922a37767cb3cf..e675c47bf6630ccb843120902a10b9dc
|
||||
if (this.player.containerMenu != oldContainer) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 7ef9f67d27cc240191dd5d07e8dcf5fbdebe1049..c33e325d7eb4584986de338f966a79e868ef300e 100644
|
||||
index 07feecd51ac3f5465027f0d26be53255c913b684..198ad71c934dd48f8a55927a3f15b6d8fa398903 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -568,6 +568,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
public boolean updatingSectionStatus = false;
|
||||
// Paper end
|
||||
@@ -562,6 +562,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return this.getIndirectPassengersStream().anyMatch((entity) -> entity instanceof Player);
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
+ // Sakura start - visibility api and command
|
||||
+ public boolean isPrimedTNT;
|
||||
+ public boolean isFallingBlock;
|
||||
@@ -496,10 +496,10 @@ index 7ef9f67d27cc240191dd5d07e8dcf5fbdebe1049..c33e325d7eb4584986de338f966a79e8
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index d504d10fbe45dfe3f2f3d08d2473df6cd18f6dcf..28b8efdd224e4dbb32f3eac1c9e2c512e2695dc8 100644
|
||||
index b83be9bbb9f348da83c0fd1ecc7f65c8a58b45b9..1bfdebe6c1057ee19fb96d8f0f571c9d20d14cc6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -74,6 +74,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -78,6 +78,7 @@ public class FallingBlockEntity extends Entity {
|
||||
this.blockState = Blocks.SAND.defaultBlockState();
|
||||
this.dropItem = true;
|
||||
this.fallDamageMax = 40;
|
||||
@@ -508,10 +508,10 @@ index d504d10fbe45dfe3f2f3d08d2473df6cd18f6dcf..28b8efdd224e4dbb32f3eac1c9e2c512
|
||||
|
||||
public FallingBlockEntity(Level world, double x, double y, double z, BlockState block) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index f1f352ec0e51f5db59254841a06c176c5a876fc9..dace8dc0c051ce9355d878154466ee3a548a3832 100644
|
||||
index 42bd2d9a1528b6210e4dfb56233062fd97c9743b..28a15f612239614c6c56974da5855ce3bfd7c89e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -37,6 +37,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -57,6 +57,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
public PrimedTnt(EntityType<? extends PrimedTnt> type, Level world) {
|
||||
super(type, world);
|
||||
this.blocksBuilding = true;
|
||||
@@ -520,23 +520,22 @@ index f1f352ec0e51f5db59254841a06c176c5a876fc9..dace8dc0c051ce9355d878154466ee3a
|
||||
|
||||
public PrimedTnt(Level world, double x, double y, double z, @Nullable LivingEntity igniter) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 1059530bb6f817352c8304f6a1544aeb5ac14b30..5a43957309019bec27b9624e5268d6a8c50c165d 100644
|
||||
index 439f1e69cc330aa590311eb4e308e539815ad0d5..05a4b69fbaf36269bea3a050022a54d28211c285 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -217,6 +217,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
|
||||
@@ -269,6 +269,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
return this.getChunkSource().getChunk(chunkX, chunkZ, leastStatus, false);
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
+ public final it.unimi.dsi.fastutil.longs.Long2IntMap minimalTNT = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); // Sakura - visibility api
|
||||
+
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura - sakura configuration files // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura - sakura configuration files// Paper - create paper world config & Anti-Xray
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
index 7e6116963d835d4606ef3d93b69d3e44b61288e1..c0109fd2db0724418d55e68a27c363c8c24ff8c1 100644
|
||||
index 7eea190ce8a62960ecc42ff56a4ef71b754184fb..a280b9c9c1451f72758b30b9c514c889c846c88c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -543,6 +543,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -545,6 +545,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
this.getHandle().displayName = name == null ? this.getName() : name;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise rayTracing
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index dc88014c4d9f172cc54e5d77b488128f9ffbc73d..9ea24dc18f70e8e3c8998f6c2b5eb3ac885df54f 100644
|
||||
index 7aa9ddb1d61ffb7da3f867e5a5bd04e3432b5621..3d5131e51fb924778c392267699fe2c11bf2f40f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -296,7 +296,7 @@ public class Explosion {
|
||||
@@ -297,7 +297,7 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ index dc88014c4d9f172cc54e5d77b488128f9ffbc73d..9ea24dc18f70e8e3c8998f6c2b5eb3ac
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
|
||||
index e6b17f32f2b6930739a98c6139442383c1847add..24c1caa060e7c41eac81c19f873ac9273c6b84c2 100644
|
||||
index 001e2e6ed4b8b63a23dc0013882674834812a961..138fd28437fb4923773b8e6ba9bb53c3ce540e0d 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
|
||||
@@ -720,6 +720,110 @@ public abstract class VoxelShape {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Reduce deltaMovement Allocations
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index c33e325d7eb4584986de338f966a79e868ef300e..29e609be885944dbb4868e34e7eb83b8a136619c 100644
|
||||
index 198ad71c934dd48f8a55927a3f15b6d8fa398903..3fcc7eb45a1729a31697788870c7375e9c1f7303 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1294,7 +1294,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1253,7 +1253,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.tryCheckInsideBlocks();
|
||||
float f = this.getBlockSpeedFactor();
|
||||
|
||||
@@ -17,7 +17,7 @@ index c33e325d7eb4584986de338f966a79e868ef300e..29e609be885944dbb4868e34e7eb83b8
|
||||
// Paper start - remove expensive streams from here
|
||||
boolean noneMatch = true;
|
||||
AABB fireSearchBox = this.getBoundingBox().deflate(1.0E-6D);
|
||||
@@ -1831,7 +1831,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1871,7 +1871,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
double d0 = this.getGravity();
|
||||
|
||||
if (d0 != 0.0D) {
|
||||
@@ -26,7 +26,7 @@ index c33e325d7eb4584986de338f966a79e868ef300e..29e609be885944dbb4868e34e7eb83b8
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2123,6 +2123,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2171,6 +2171,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public void moveTo(double x, double y, double z, float yaw, float pitch) {
|
||||
// Paper start - Fix Entity Teleportation and cancel velocity if teleported
|
||||
if (!preserveMotion) {
|
||||
@@ -34,26 +34,26 @@ index c33e325d7eb4584986de338f966a79e868ef300e..29e609be885944dbb4868e34e7eb83b8
|
||||
this.deltaMovement = Vec3.ZERO;
|
||||
} else {
|
||||
this.preserveMotion = false;
|
||||
@@ -3525,29 +3526,33 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3600,29 +3601,33 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public void onAboveBubbleCol(boolean drag) {
|
||||
- Vec3 vec3d = this.getDeltaMovement();
|
||||
+ // Sakura start - reduce movement allocations
|
||||
+ // Sakura start - remove bubble column allocations
|
||||
+ // Vec3 vec3d = this.getDeltaMovement();
|
||||
+ this.syncDeltaMovement();
|
||||
double d0;
|
||||
|
||||
if (drag) {
|
||||
- d0 = Math.max(-0.9D, vec3d.y - 0.03D);
|
||||
+ d0 = Math.max(-0.9D, movementY - 0.03D);
|
||||
+ d0 = Math.max(-0.9D, this.movementY - 0.03D);
|
||||
} else {
|
||||
- d0 = Math.min(1.8D, vec3d.y + 0.1D);
|
||||
+ d0 = Math.min(1.8D, movementY + 0.1D);
|
||||
+ d0 = Math.min(1.8D, this.movementY + 0.1D);
|
||||
}
|
||||
|
||||
- this.setDeltaMovement(vec3d.x, d0, vec3d.z);
|
||||
+ this.setDeltaMovement(movementX, d0, movementZ);
|
||||
+ this.setDeltaMovement(this.movementX, d0, this.movementZ);
|
||||
}
|
||||
|
||||
public void onInsideBubbleColumn(boolean drag) {
|
||||
@@ -64,19 +64,19 @@ index c33e325d7eb4584986de338f966a79e868ef300e..29e609be885944dbb4868e34e7eb83b8
|
||||
|
||||
if (drag) {
|
||||
- d0 = Math.max(-0.3D, vec3d.y - 0.03D);
|
||||
+ d0 = Math.max(-0.3D, movementY - 0.03D);
|
||||
+ d0 = Math.max(-0.3D, this.movementY - 0.03D);
|
||||
} else {
|
||||
- d0 = Math.min(0.7D, vec3d.y + 0.06D);
|
||||
+ d0 = Math.min(0.7D, movementY + 0.06D);
|
||||
+ d0 = Math.min(0.7D, this.movementY + 0.06D);
|
||||
}
|
||||
|
||||
- this.setDeltaMovement(vec3d.x, d0, vec3d.z);
|
||||
+ this.setDeltaMovement(movementX, d0, movementZ);
|
||||
+ // Sakura end
|
||||
+ this.setDeltaMovement(this.movementX, d0, this.movementZ);
|
||||
+ // Sakura end - remove bubble column allocations
|
||||
this.resetFallDistance();
|
||||
}
|
||||
|
||||
@@ -4546,16 +4551,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4560,16 +4565,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
vec3d = vec3d.normalize();
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ index c33e325d7eb4584986de338f966a79e868ef300e..29e609be885944dbb4868e34e7eb83b8
|
||||
+ // Vec3 vec3d2 = this.getDeltaMovement();
|
||||
+ this.syncDeltaMovement();
|
||||
|
||||
vec3d = vec3d.scale(speed * 1.0D);
|
||||
vec3d = vec3d.scale(speed);
|
||||
double d3 = 0.003D;
|
||||
|
||||
- if (Math.abs(vec3d2.x) < 0.003D && Math.abs(vec3d2.z) < 0.003D && vec3d.length() < 0.0045000000000000005D) {
|
||||
@@ -99,7 +99,7 @@ index c33e325d7eb4584986de338f966a79e868ef300e..29e609be885944dbb4868e34e7eb83b8
|
||||
}
|
||||
|
||||
this.fluidHeight.put(tag, d1);
|
||||
@@ -4626,11 +4634,53 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4640,11 +4648,53 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return this.chunkPosition;
|
||||
}
|
||||
|
||||
@@ -109,68 +109,68 @@ index c33e325d7eb4584986de338f966a79e868ef300e..29e609be885944dbb4868e34e7eb83b8
|
||||
+ private double movementZ;
|
||||
+ private boolean movementDirty;
|
||||
+
|
||||
+ public void addDeltaMovement(double x, double y, double z) {
|
||||
+ syncDeltaMovement();
|
||||
+ movementX += x;
|
||||
+ movementY += y;
|
||||
+ movementZ += z;
|
||||
+ public final void addDeltaMovement(double x, double y, double z) {
|
||||
+ this.syncDeltaMovement();
|
||||
+ this.movementX += x;
|
||||
+ this.movementY += y;
|
||||
+ this.movementZ += z;
|
||||
+ }
|
||||
+
|
||||
+ public void scaleDeltaMovement(double n) {
|
||||
+ syncDeltaMovement();
|
||||
+ movementX *= n;
|
||||
+ movementY *= n;
|
||||
+ movementZ *= n;
|
||||
+ public final void scaleDeltaMovement(double n) {
|
||||
+ this.syncDeltaMovement();
|
||||
+ this.movementX *= n;
|
||||
+ this.movementY *= n;
|
||||
+ this.movementZ *= n;
|
||||
+ }
|
||||
+
|
||||
+ public void multiplyDeltaMovement(double x, double y, double z) {
|
||||
+ syncDeltaMovement();
|
||||
+ movementX *= x;
|
||||
+ movementY *= y;
|
||||
+ movementZ *= z;
|
||||
+ public final void multiplyDeltaMovement(double x, double y, double z) {
|
||||
+ this.syncDeltaMovement();
|
||||
+ this.movementX *= x;
|
||||
+ this.movementY *= y;
|
||||
+ this.movementZ *= z;
|
||||
+ }
|
||||
+
|
||||
+ private void updateDeltaMovement() {
|
||||
+ if (movementDirty) {
|
||||
+ deltaMovement = new Vec3(movementX, movementY, movementZ);
|
||||
+ movementDirty = false;
|
||||
+ if (this.movementDirty) {
|
||||
+ this.deltaMovement = new Vec3(this.movementX, this.movementY, this.movementZ);
|
||||
+ this.movementDirty = false;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ private void syncDeltaMovement() {
|
||||
+ if (!movementDirty) {
|
||||
+ setDeltaMovement(deltaMovement.x, deltaMovement.y, deltaMovement.z);
|
||||
+ if (!this.movementDirty) {
|
||||
+ this.setDeltaMovement(this.deltaMovement.x, this.deltaMovement.y, this.deltaMovement.z);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
public Vec3 getDeltaMovement() {
|
||||
+ updateDeltaMovement();
|
||||
+ this.updateDeltaMovement();
|
||||
return this.deltaMovement;
|
||||
}
|
||||
|
||||
public void setDeltaMovement(Vec3 velocity) {
|
||||
+ movementDirty = false;
|
||||
synchronized (this.posLock) { // Paper
|
||||
+ this.movementDirty = false;
|
||||
this.deltaMovement = velocity;
|
||||
} // Paper
|
||||
@@ -4641,7 +4691,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
@@ -4653,7 +4703,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public void setDeltaMovement(double x, double y, double z) {
|
||||
- this.setDeltaMovement(new Vec3(x, y, z));
|
||||
+ movementX = x;
|
||||
+ movementY = y;
|
||||
+ movementZ = z;
|
||||
+ movementDirty = true;
|
||||
+ // Sakura end
|
||||
+ this.movementX = x;
|
||||
+ this.movementY = y;
|
||||
+ this.movementZ = z;
|
||||
+ this.movementDirty = true;
|
||||
+ // Sakura end - reduce deltamovement allocations
|
||||
}
|
||||
|
||||
public final int getBlockX() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 28b8efdd224e4dbb32f3eac1c9e2c512e2695dc8..7da6420aed597ee1bf544059c79a063512adcd40 100644
|
||||
index 1bfdebe6c1057ee19fb96d8f0f571c9d20d14cc6..0b84c21749d942851d5126b795e4b609070ed31f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -183,7 +183,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -188,7 +188,7 @@ public class FallingBlockEntity extends Entity {
|
||||
} else {
|
||||
BlockState iblockdata = this.level().getBlockState(blockposition);
|
||||
|
||||
@@ -179,7 +179,7 @@ index 28b8efdd224e4dbb32f3eac1c9e2c512e2695dc8..7da6420aed597ee1bf544059c79a0635
|
||||
if (!iblockdata.is(Blocks.MOVING_PISTON)) {
|
||||
if (!this.cancelDrop) {
|
||||
boolean flag2 = iblockdata.canBeReplaced((BlockPlaceContext) (new DirectionalPlaceContext(this.level(), blockposition, Direction.DOWN, ItemStack.EMPTY, Direction.UP)));
|
||||
@@ -250,7 +250,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -255,7 +255,7 @@ public class FallingBlockEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,10 +189,10 @@ index 28b8efdd224e4dbb32f3eac1c9e2c512e2695dc8..7da6420aed597ee1bf544059c79a0635
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index dace8dc0c051ce9355d878154466ee3a548a3832..fda88328472130df8317a84fc726a73c35850c3a 100644
|
||||
index 28a15f612239614c6c56974da5855ce3bfd7c89e..d14128dd5d63e93a3d4aec76b0ee8d0e7d786687 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -85,9 +85,9 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -106,9 +106,9 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
return;
|
||||
}
|
||||
// Paper end - Configurable TNT height nerf
|
||||
@@ -205,10 +205,10 @@ index dace8dc0c051ce9355d878154466ee3a548a3832..fda88328472130df8317a84fc726a73c
|
||||
|
||||
int i = this.getFuse() - 1;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 37896ccb5eea0ec4e301ca97092c8ccef3aa1da5..85c0855eaf20013b60ed643052b783f7f6e30584 100644
|
||||
index 3d5131e51fb924778c392267699fe2c11bf2f40f..3a35dcdfd639240363891f412beeef47b8b41e06 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -618,17 +618,23 @@ public class Explosion {
|
||||
@@ -619,17 +619,23 @@ public class Explosion {
|
||||
d8 *= d13;
|
||||
d9 *= d13;
|
||||
d10 *= d13;
|
||||
@@ -235,10 +235,10 @@ index 37896ccb5eea0ec4e301ca97092c8ccef3aa1da5..85c0855eaf20013b60ed643052b783f7
|
||||
Player entityhuman = (Player) entity;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
index cf8b8c8efd1c9c81eb5f02d75bd75875eb66771f..30e23f67a1a816dfb4f32cfe45bc8dd40938317a 100644
|
||||
index 2c356d2c40fe52672f108b2dbb89b7a27616e4d1..472f64bb1fc2ebf7e89e4e90d780732de3c85aef 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
|
||||
@@ -461,7 +461,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
@@ -460,7 +460,7 @@ public class Block extends BlockBehaviour implements ItemLike {
|
||||
}
|
||||
|
||||
public void updateEntityAfterFallOn(BlockGetter world, Entity entity) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optional Force Position Updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 7890f84d7a69e2e6820ef0daa35f898534f7372f..5aa02f28b6be60688e340099b1637fb0ebfe7aa9 100644
|
||||
index d14128dd5d63e93a3d4aec76b0ee8d0e7d786687..2eb69c7d7843a7b58479049633b838212d003c10 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -108,6 +108,14 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -129,6 +129,14 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Load Chunks on Movement
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
index ee8e9c0e3690e78f3cc621ddfca89ea4256d4803..299237a0c828e48425cc35a14d366020c78daefb 100644
|
||||
index 614a3de568ec1113f445dce37b46863f3cc1c741..f941c4bbf94f80dc3db3153297713a41c6c8ca48 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
@@ -1569,6 +1569,7 @@ public final class CollisionUtil {
|
||||
@@ -39,22 +39,22 @@ index ee8e9c0e3690e78f3cc621ddfca89ea4256d4803..299237a0c828e48425cc35a14d366020
|
||||
if (chunk == null) {
|
||||
if ((collisionFlags & COLLISION_FLAG_COLLIDE_WITH_UNLOADED_CHUNKS) != 0) {
|
||||
diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
index 658e63ebde81dc14c8ab5850fb246dc0aab25dea..f1ff1a67fee37ee7b241ceaa164fa4ee64d3767b 100644
|
||||
index f56e5c0f53f9b52a9247b9be9265b949494fc924..d0fc85480cc88aa2d04a03b0d3637fee41f003a4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/TicketType.java
|
||||
@@ -37,6 +37,7 @@ public class TicketType<T> {
|
||||
public static final TicketType<Long> NON_FULL_SYNC_LOAD = create("non_full_sync_load", Long::compareTo);
|
||||
public static final TicketType<ChunkPos> DELAY_UNLOAD = create("delay_unload", Comparator.comparingLong(ChunkPos::toLong), 1);
|
||||
// Paper end - rewrite chunk system
|
||||
@@ -25,6 +25,7 @@ public class TicketType<T> {
|
||||
public static final TicketType<ChunkPos> UNKNOWN = TicketType.create("unknown", Comparator.comparingLong(ChunkPos::toLong), 1);
|
||||
public static final TicketType<Unit> PLUGIN = TicketType.create("plugin", (a, b) -> 0); // CraftBukkit
|
||||
public static final TicketType<org.bukkit.plugin.Plugin> PLUGIN_TICKET = TicketType.create("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit
|
||||
+ public static final TicketType<Long> ENTITY_MOVEMENT = create("entity_movement", Long::compareTo, 10 * 20); // Sakura
|
||||
|
||||
public static <T> TicketType<T> create(String name, Comparator<T> argumentComparator) {
|
||||
return new TicketType<>(name, argumentComparator, 0L);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index a2104fae2b288f4cbd9e810d73bf986be0b7b969..88d01e59869f8e6c528fb3ae1485cd86a23cb383 100644
|
||||
index 3fcc7eb45a1729a31697788870c7375e9c1f7303..117f36743e1fa8a468528d44f0e16e6f7283880e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -572,6 +572,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -566,6 +566,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
public boolean isPrimedTNT;
|
||||
public boolean isFallingBlock;
|
||||
// Sakura end - visibility api and command
|
||||
@@ -74,21 +74,21 @@ index a2104fae2b288f4cbd9e810d73bf986be0b7b969..88d01e59869f8e6c528fb3ae1485cd86
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -1555,7 +1568,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1515,7 +1528,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
io.papermc.paper.util.CollisionUtil.getCollisions(
|
||||
world, this, collisionBox, potentialCollisionsVoxel, potentialCollisionsBB,
|
||||
- io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER,
|
||||
+ io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), // Sakura
|
||||
null, null
|
||||
world, this, collisionBox, potentialCollisionsVoxel, potentialCollisionsBB,
|
||||
- io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER,
|
||||
+ io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), // Sakura
|
||||
null, null
|
||||
);
|
||||
|
||||
@@ -4957,12 +4970,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4969,12 +4982,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
@Override
|
||||
public boolean shouldBeSaved() {
|
||||
- return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Paper - rewrite chunk system - it should check if the entity has ANY player passengers
|
||||
+ return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.loadChunks || this.isPassenger() ? false : !this.isVehicle() || !this.hasAnyPlayerPassengers()); // Sakura - used to determine whether a chunk should unload // Paper - rewrite chunk system - it should check if the entity has ANY player passengers
|
||||
- return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.isPassenger() ? false : !this.isVehicle() || !((ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity)this).moonrise$hasAnyPlayerPassengers()); // Paper - rewrite chunk system
|
||||
+ return this.removalReason != null && !this.removalReason.shouldSave() ? false : (this.loadChunks || this.isPassenger() ? false : !this.isVehicle() || !((ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity)this).moonrise$hasAnyPlayerPassengers()); // Sakura - used to determine whether a chunk should unload // Paper - rewrite chunk system
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -99,10 +99,10 @@ index a2104fae2b288f4cbd9e810d73bf986be0b7b969..88d01e59869f8e6c528fb3ae1485cd86
|
||||
|
||||
public boolean mayInteract(Level world, BlockPos pos) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 7da6420aed597ee1bf544059c79a063512adcd40..b6a4753252b748c06a62b7faa6b05c1fb904d62e 100644
|
||||
index 0b84c21749d942851d5126b795e4b609070ed31f..3feffddfb537451d88e316f39ee28a6fa22921aa 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -75,6 +75,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -79,6 +79,7 @@ public class FallingBlockEntity extends Entity {
|
||||
this.dropItem = true;
|
||||
this.fallDamageMax = 40;
|
||||
this.isFallingBlock = true; // Sakura
|
||||
@@ -111,10 +111,10 @@ index 7da6420aed597ee1bf544059c79a063512adcd40..b6a4753252b748c06a62b7faa6b05c1f
|
||||
|
||||
public FallingBlockEntity(Level world, double x, double y, double z, BlockState block) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index bbf6b4f705b3e9b289a7fdf82a78ef02f777297d..09f09a8fbf0eee62295001ce5b7ed5329445d2b0 100644
|
||||
index 2eb69c7d7843a7b58479049633b838212d003c10..bcee8b6254618dc7f444992ec8cdfe53b12458a7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -38,6 +38,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -58,6 +58,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
super(type, world);
|
||||
this.blocksBuilding = true;
|
||||
this.isPrimedTNT = true; // Sakura
|
||||
@@ -123,13 +123,13 @@ index bbf6b4f705b3e9b289a7fdf82a78ef02f777297d..09f09a8fbf0eee62295001ce5b7ed532
|
||||
|
||||
public PrimedTnt(Level world, double x, double y, double z, @Nullable LivingEntity igniter) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
index 14ee7b5b9b804bebd4e2a846b238547a28a36035..684ca1da2ca1d51f56461c60a900a5fc67e21ff3 100644
|
||||
index d388fbcbff63928f0e9140c02400a63ba8f19d9c..40471b340a9f92a4b60e19285ebf9d58a4857a60 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
|
||||
@@ -220,6 +220,17 @@ public class LevelChunk extends ChunkAccess {
|
||||
}
|
||||
@@ -127,6 +127,17 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
|
||||
return this.postProcessingDone;
|
||||
}
|
||||
// Paper end
|
||||
// Paper end - rewrite chunk system
|
||||
+ // Sakura start
|
||||
+ private long lastMovementLoadTicket = 0;
|
||||
+
|
||||
@@ -418,10 +418,10 @@ index 0000000000000000000000000000000000000000..6903863ad293a335a8ed1aeaa06fccb4
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 606ae62f597761296412e14750758fa185fc3c48..b72c796d30d4892e30d726c3b2a6b097b941979d 100644
|
||||
index 524ca2d1719ac52ae287f6c4c56ca9d024f084eb..041e42c25e536a960a2e59114d2761c54520002e 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1130,6 +1130,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1153,6 +1153,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
}
|
||||
}
|
||||
private static final java.math.BigDecimal TPS_BASE = new java.math.BigDecimal(1E9).multiply(new java.math.BigDecimal(SAMPLE_INTERVAL));
|
||||
@@ -429,66 +429,66 @@ index 606ae62f597761296412e14750758fa185fc3c48..b72c796d30d4892e30d726c3b2a6b097
|
||||
// Paper end
|
||||
// Spigot End
|
||||
|
||||
@@ -1208,6 +1209,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1223,6 +1224,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
|
||||
final long diff = currentTime - tickSection;
|
||||
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
|
||||
+ tickTracking.secondSample(levels.values(), currentTps.doubleValue()); // Sakura
|
||||
+ tickTracking.secondSample(levels.values(), currentTps.doubleValue()); // Sakura - add tps graph command
|
||||
tps1.add(currentTps, diff);
|
||||
tps5.add(currentTps, diff);
|
||||
tps15.add(currentTps, diff);
|
||||
@@ -1236,6 +1238,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
this.tickServer(flag ? () -> {
|
||||
return false;
|
||||
} : this::haveTime);
|
||||
+ tickTracking.tickSample((System.nanoTime() - currentTime) / 1_000_000L); // Sakura
|
||||
@@ -1258,6 +1260,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
throw new RuntimeException("Chunk system crash propagated to tick()", crash);
|
||||
}
|
||||
// Paper end - rewrite chunk system
|
||||
+ tickTracking.tickSample((System.nanoTime() - currentTime) / 1_000_000L); // Sakura - add tps graph command
|
||||
this.profiler.popPush("nextTickWait");
|
||||
this.mayHaveDelayedTasks = true;
|
||||
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + i, this.nextTickTimeNanos);
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
index b99f50604bafecbc68835974c9ed0caa91911a40..c912615ded011741f81c72739639e631f331710e 100644
|
||||
index 82e7f7c3c2f51bc135585f43bc5167bcde2f8a98..082e67be186d491eb4f37402a9a1f9d9bccedaf8 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
||||
@@ -90,6 +90,11 @@ public class ServerChunkCache extends ChunkSource {
|
||||
@@ -144,6 +144,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon
|
||||
this.clearCache();
|
||||
}
|
||||
|
||||
+ // Sakura start - tps graph command
|
||||
+ public final int getInternallyLoadedChunks() {
|
||||
+ return loadedChunkMap.size();
|
||||
+ return this.fullChunks.size();
|
||||
+ }
|
||||
+ // Sakura end - tps graph command
|
||||
// CraftBukkit start - properly implement isChunkLoaded
|
||||
public boolean isChunkLoaded(int chunkX, int chunkZ) {
|
||||
ChunkHolder chunk = this.chunkMap.getUpdatingChunkIfPresent(ChunkPos.asLong(chunkX, chunkZ));
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 747ebfb09dcd4c619ee0543c8aa79c05416687a4..4a3690c71eda93d2542e8c039442a51882f10475 100644
|
||||
index 85120c39a5fd60ff59e0b1b90815e541b83d964e..c4735c00c1e86975cffeed1597f69c52b6cb5a99 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -197,7 +197,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -198,7 +198,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
private final MinecraftServer server;
|
||||
public final PrimaryLevelData serverLevelData; // CraftBukkit - type
|
||||
private int lastSpawnChunkRadius;
|
||||
- final EntityTickList entityTickList;
|
||||
+ public final EntityTickList entityTickList; // Sakura - package-private -> public
|
||||
//public final PersistentEntitySectionManager<Entity> entityManager; // Paper - rewrite chunk system
|
||||
// Paper - rewrite chunk system
|
||||
private final GameEventDispatcher gameEventDispatcher;
|
||||
public boolean noSave;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
index 83a39f900551e39d5af6f17a339a386ddee4feef..172c8d9cc94ed6ddfd3f785ca97a6e6ebb58d2d9 100644
|
||||
index d8b4196adf955f8d414688dc451caac2d9c609d9..47556521b28e0bd1b1c3ef3781684feb3bdf8911 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/entity/EntityTickList.java
|
||||
@@ -9,7 +9,7 @@ import javax.annotation.Nullable;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
||||
public class EntityTickList {
|
||||
- private final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<Entity> entities = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(true); // Paper - rewrite this, always keep this updated - why would we EVER tick an entity that's not ticking?
|
||||
+ public final io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<Entity> entities = new io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet<>(true); // Sakura - tps graph // Paper - rewrite this, always keep this updated - why would we EVER tick an entity that's not ticking?
|
||||
- private final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<net.minecraft.world.entity.Entity> entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system
|
||||
+ public final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<net.minecraft.world.entity.Entity> entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Sakura - expose entity list // Paper - rewrite chunk system
|
||||
|
||||
private void ensureActiveIsNotIterated() {
|
||||
// Paper - replace with better logic, do not delay removals
|
||||
// Paper - rewrite chunk system
|
||||
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
index 6c2a3813e7d63d57f07a8fa2edbb9d231221d818..a7333afe790be4ca876cb15c5f32a085dd13c3bb 100644
|
||||
index db9c812cf7267adf0bfd8be7368140e91245d640..d852fbe24669f878899381979a559650d6580f91 100644
|
||||
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
||||
@@ -283,7 +283,7 @@ public class SpigotConfig
|
||||
@@ -1,117 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 19:16:49 +0100
|
||||
Subject: [PATCH] Copy EntityList methods to BasicEntityList
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
index c78cbec447032de9fe69748591bef6be300160ed..01701cdd0d984e35ff3453e6253ba9bcaa0db7b9 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -26,6 +26,8 @@ import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import org.bukkit.event.entity.EntityRemoveEvent;
|
||||
|
||||
+import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; // Sakura
|
||||
+
|
||||
public final class ChunkEntitySlices {
|
||||
|
||||
protected final int minSection;
|
||||
@@ -304,6 +306,13 @@ public final class ChunkEntitySlices {
|
||||
|
||||
protected static final class BasicEntityList<E extends Entity> {
|
||||
|
||||
+ // Sakura start - copy entitylist methods across
|
||||
+ protected final Int2IntOpenHashMap entityToIndex = new Int2IntOpenHashMap(2, 0.8f);
|
||||
+ {
|
||||
+ this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE);
|
||||
+ }
|
||||
+ // Sakura end
|
||||
+
|
||||
protected static final Entity[] EMPTY = new Entity[0];
|
||||
protected static final int DEFAULT_CAPACITY = 4;
|
||||
|
||||
@@ -326,55 +335,52 @@ public final class ChunkEntitySlices {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
- private void resize() {
|
||||
- if (this.storage == EMPTY) {
|
||||
- this.storage = (E[])new Entity[DEFAULT_CAPACITY];
|
||||
- } else {
|
||||
- this.storage = Arrays.copyOf(this.storage, this.storage.length * 2);
|
||||
- }
|
||||
- }
|
||||
-
|
||||
+ // Sakura start - copy entitylist methods across
|
||||
public void add(final E entity) {
|
||||
- final int idx = this.size++;
|
||||
- if (idx >= this.storage.length) {
|
||||
- this.resize();
|
||||
- this.storage[idx] = entity;
|
||||
- } else {
|
||||
- this.storage[idx] = entity;
|
||||
+ final int count = this.size;
|
||||
+ final int currIndex = this.entityToIndex.putIfAbsent(entity.getId(), count);
|
||||
+
|
||||
+ if (currIndex != Integer.MIN_VALUE) {
|
||||
+ return; // already in this list
|
||||
}
|
||||
- }
|
||||
|
||||
- public int indexOf(final E entity) {
|
||||
- final E[] storage = this.storage;
|
||||
+ E[] list = this.storage;
|
||||
|
||||
- for (int i = 0, len = Math.min(this.storage.length, this.size); i < len; ++i) {
|
||||
- if (storage[i] == entity) {
|
||||
- return i;
|
||||
- }
|
||||
+ if (list.length == count) {
|
||||
+ // resize required
|
||||
+ list = this.storage = Arrays.copyOf(list, (int)Math.max(4L, count * 2L)); // overflow results in negative
|
||||
}
|
||||
|
||||
- return -1;
|
||||
+ list[count] = entity;
|
||||
+ this.size = count + 1;
|
||||
+ }
|
||||
+
|
||||
+ public int indexOf(final E entity) {
|
||||
+ return this.entityToIndex.getOrDefault(entity.getId(), -1);
|
||||
}
|
||||
|
||||
public boolean remove(final E entity) {
|
||||
- final int idx = this.indexOf(entity);
|
||||
- if (idx == -1) {
|
||||
+ final int index = this.entityToIndex.remove(entity.getId());
|
||||
+ if (index == Integer.MIN_VALUE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
- final int size = --this.size;
|
||||
- final E[] storage = this.storage;
|
||||
- if (idx != size) {
|
||||
- System.arraycopy(storage, idx + 1, storage, idx, size - idx);
|
||||
+ // move the entity at the end to this index
|
||||
+ final int endIndex = --this.size;
|
||||
+ final E end = this.storage[endIndex];
|
||||
+ if (index != endIndex) {
|
||||
+ // not empty after this call
|
||||
+ this.entityToIndex.put(end.getId(), index); // update index
|
||||
}
|
||||
-
|
||||
- storage[size] = null;
|
||||
+ this.storage[index] = end;
|
||||
+ this.storage[endIndex] = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean has(final E entity) {
|
||||
- return this.indexOf(entity) != -1;
|
||||
+ return this.entityToIndex.containsKey(entity.getId());
|
||||
+ // Sakura end
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Optimise New Liquid Level
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
index 6d8ff6c06af5545634f255ed17dc1e489ece2548..67db57686dd29713128d5b233454b6147b8e460b 100644
|
||||
index c2943d892b067b3f1fb3b93301a092e912d71f08..5ad6880845ed699077ad355ef1edcfb1c6c7bee4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/material/FlowingFluid.java
|
||||
@@ -137,7 +137,7 @@ public abstract class FlowingFluid extends Fluid {
|
||||
@@ -155,19 +155,19 @@ index 0f99733660f91280e4c6262cf75b3c9cae86f65a..ba9f8fe6fafc54bbdfb104de28af4b39
|
||||
return SynchedEntityData.DataValue.create(this.accessor, this.value);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
index a2279262c93408c11f5d2290b48fd794975e8cfe..09975c9be245207281b616f77c768aa048b0c140 100644
|
||||
index 1d849ce4e2c85f149af25318b8ffb6dcef6c6788..055e8691467e18ee3a70c857f0972f34a5a58e58 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerEntity.java
|
||||
@@ -148,7 +148,7 @@ public class ServerEntity {
|
||||
@@ -140,7 +140,7 @@ public class ServerEntity {
|
||||
}
|
||||
}
|
||||
|
||||
- if (this.forceStateResync || this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isDirty()) { // Paper - fix desync when a player is added to the tracker
|
||||
+ if (this.forceStateResync || this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isForeignDirty()) { // Slice// Paper - fix desync when a player is added to the tracker
|
||||
- if (this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isDirty()) {
|
||||
+ if (this.tickCount % this.updateInterval == 0 || this.entity.hasImpulse || this.entity.getEntityData().isForeignDirty()) { // Slice
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@@ -390,7 +390,15 @@ public class ServerEntity {
|
||||
@@ -398,7 +398,15 @@ public class ServerEntity {
|
||||
|
||||
if (list != null) {
|
||||
this.trackedDataValues = datawatcher.getNonDefaultValues();
|
||||
@@ -185,10 +185,10 @@ index a2279262c93408c11f5d2290b48fd794975e8cfe..09975c9be245207281b616f77c768aa0
|
||||
|
||||
if (this.entity instanceof LivingEntity) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 88d01e59869f8e6c528fb3ae1485cd86a23cb383..6f330f99a80f291bce638b0769e5ed00c283ac78 100644
|
||||
index 117f36743e1fa8a468528d44f0e16e6f7283880e..71e8a4f30afac822cc0da9620b904a02c201e452 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -3470,7 +3470,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -3545,7 +3545,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
|
||||
return;
|
||||
}
|
||||
@@ -198,10 +198,10 @@ index 88d01e59869f8e6c528fb3ae1485cd86a23cb383..6f330f99a80f291bce638b0769e5ed00
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index b6a4753252b748c06a62b7faa6b05c1fb904d62e..86e12495ce807ba06210535350caa7db5e15d139 100644
|
||||
index 3feffddfb537451d88e316f39ee28a6fa22921aa..79c2ea81444c0ac9598f7fe334055326958a4f30 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -111,7 +111,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -115,7 +115,7 @@ public class FallingBlockEntity extends Entity {
|
||||
}
|
||||
|
||||
public void setStartPos(BlockPos pos) {
|
||||
@@ -211,10 +211,10 @@ index b6a4753252b748c06a62b7faa6b05c1fb904d62e..86e12495ce807ba06210535350caa7db
|
||||
|
||||
public BlockPos getStartPos() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 09f09a8fbf0eee62295001ce5b7ed5329445d2b0..16340c2f8a948136c9fe0b2314c9ec7cbee74937 100644
|
||||
index bcee8b6254618dc7f444992ec8cdfe53b12458a7..ac9781762a987b4d0121f69b9e873d169dfc24a0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -182,7 +182,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -203,7 +203,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
}
|
||||
|
||||
public void setFuse(int fuse) {
|
||||
@@ -224,10 +224,10 @@ index 09f09a8fbf0eee62295001ce5b7ed5329445d2b0..16340c2f8a948136c9fe0b2314c9ec7c
|
||||
|
||||
public int getFuse() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 686374e89e41b0917791264f3281f7384835bca8..74130ccef989757b81507f084cc30a0e593ecaf3 100644
|
||||
index 54ba25632c2a9e1c93a5b3a0b92e5280864c49d6..b352a8d299a13026d8e2c8e3405eb7f40b289d38 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -645,7 +645,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -649,7 +649,7 @@ public abstract class Player extends LivingEntity {
|
||||
public void increaseScore(int score) {
|
||||
int j = this.getScore();
|
||||
|
||||
@@ -235,4 +235,4 @@ index 686374e89e41b0917791264f3281f7384835bca8..74130ccef989757b81507f084cc30a0e
|
||||
+ this.entityData.set(Player.DATA_SCORE_ID, j + score, 0); // Slice
|
||||
}
|
||||
|
||||
public void startAutoSpinAttack(int riptideTicks) {
|
||||
public void startAutoSpinAttack(int riptideTicks, float riptideAttackDamage, ItemStack stack) {
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Use Optimised TrackedEntityMap
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 0bfd2005dc82b0262badfe6867835e80a6e6a1dc..34fdb52904a26bc7c4c95eee91882a3924ab037c 100644
|
||||
index a9e41f1f87afa9778ec4d4bc3f01ef5e6cbefc91..c46e07638db51bd549e39f0fcbe122d48ead9c31 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -254,7 +254,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
// Paper - rewrite chunk system
|
||||
@@ -242,7 +242,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
this.toDrop = new LongOpenHashSet();
|
||||
this.tickingGenerated = new AtomicInteger();
|
||||
this.playerMap = new PlayerMap();
|
||||
- this.entityMap = new Int2ObjectOpenHashMap();
|
||||
+ this.entityMap = new me.samsuik.sakura.utils.collections.TrackedEntityChunkMap(); // Sakura - optimised tracked entity map
|
||||
this.chunkTypeCache = new Long2ByteOpenHashMap();
|
||||
this.chunkSaveCooldowns = new Long2LongOpenHashMap();
|
||||
this.unloadQueue = Queues.newConcurrentLinkedQueue();
|
||||
// Paper - rewrite chunk system
|
||||
@@ -0,0 +1,81 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 14 Oct 2021 19:16:49 +0100
|
||||
Subject: [PATCH] Copy EntityList methods to BasicEntityList
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
index 87d2b3ec165e2e9e4bdbedd7adddaa2130ed507b..01e29fc7c91aa7ffeb54584c8ca0989900235251 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
@@ -413,6 +413,13 @@ public final class ChunkEntitySlices {
|
||||
|
||||
private E[] storage;
|
||||
private int size;
|
||||
+ // Sakura start - use methods from EntityList
|
||||
+ private it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap entityToIndex = null;
|
||||
+ private void setupIndexMap() {
|
||||
+ this.entityToIndex = new it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap(2, 0.8f);
|
||||
+ this.entityToIndex.defaultReturnValue(Integer.MIN_VALUE);
|
||||
+ }
|
||||
+ // Sakura end - use methods from EntityList
|
||||
|
||||
public BasicEntityList() {
|
||||
this(0);
|
||||
@@ -433,6 +440,7 @@ public final class ChunkEntitySlices {
|
||||
private void resize() {
|
||||
if (this.storage == EMPTY) {
|
||||
this.storage = (E[])new Entity[DEFAULT_CAPACITY];
|
||||
+ this.setupIndexMap(); // Sakura - use methods from EntityList
|
||||
} else {
|
||||
this.storage = Arrays.copyOf(this.storage, this.storage.length * 2);
|
||||
}
|
||||
@@ -446,6 +454,7 @@ public final class ChunkEntitySlices {
|
||||
} else {
|
||||
this.storage[idx] = entity;
|
||||
}
|
||||
+ this.entityToIndex.put(entity.getId(), idx); // Sakura - use methods from EntityList
|
||||
}
|
||||
|
||||
public int indexOf(final E entity) {
|
||||
@@ -461,24 +470,32 @@ public final class ChunkEntitySlices {
|
||||
}
|
||||
|
||||
public boolean remove(final E entity) {
|
||||
- final int idx = this.indexOf(entity);
|
||||
- if (idx == -1) {
|
||||
+ // Sakura start - use methods from EntityList
|
||||
+ if (this.entityToIndex == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
- final int size = --this.size;
|
||||
- final E[] storage = this.storage;
|
||||
- if (idx != size) {
|
||||
- System.arraycopy(storage, idx + 1, storage, idx, size - idx);
|
||||
+ final int index = this.entityToIndex.remove(entity.getId());
|
||||
+ if (index == Integer.MIN_VALUE) {
|
||||
+ return false;
|
||||
}
|
||||
|
||||
- storage[size] = null;
|
||||
+ // move the entity at the end to this index
|
||||
+ final int endIndex = --this.size;
|
||||
+ final E end = this.storage[endIndex];
|
||||
+ if (index != endIndex) {
|
||||
+ // not empty after this call
|
||||
+ this.entityToIndex.put(end.getId(), index); // update index
|
||||
+ }
|
||||
+ this.storage[index] = end;
|
||||
+ this.storage[endIndex] = null;
|
||||
+ // Sakura end - use methods from EntityList
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean has(final E entity) {
|
||||
- return this.indexOf(entity) != -1;
|
||||
+ return this.entityToIndex != null && this.entityToIndex.containsKey(entity.getId()); // Sakura - use methods from EntityList
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,31 +4,30 @@ Date: Thu, 3 Aug 2023 13:48:27 +0100
|
||||
Subject: [PATCH] Add utility methods to EntitySlices
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
index 01701cdd0d984e35ff3453e6253ba9bcaa0db7b9..8fcaa00e461c7f4413bf655ddd8165a2b908f900 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -252,6 +252,12 @@ public final class ChunkEntitySlices {
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
index 01e29fc7c91aa7ffeb54584c8ca0989900235251..c140e3a73712d2123bc9ed09e9bab25e48c4420e 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
@@ -318,6 +318,12 @@ public final class ChunkEntitySlices {
|
||||
return true;
|
||||
}
|
||||
+
|
||||
|
||||
+ // Sakura start
|
||||
+ public Entity[] getSectionEntities(int sectionY) {
|
||||
+ return this.allEntities.getSectionEntities(sectionY);
|
||||
+ }
|
||||
+ // Sakura end
|
||||
|
||||
+
|
||||
public void getHardCollidingEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
|
||||
this.hardCollidingEntities.getEntities(except, box, into, predicate);
|
||||
@@ -430,6 +436,18 @@ public final class ChunkEntitySlices {
|
||||
this.nonEmptyBitset[sectionIndex >>> 6] ^= (1L << (sectionIndex & (Long.SIZE - 1)));
|
||||
}
|
||||
@@ -542,6 +548,18 @@ public final class ChunkEntitySlices {
|
||||
}
|
||||
}
|
||||
+
|
||||
|
||||
+ // Sakura start
|
||||
+ public Entity[] getSectionEntities(int sectionY) {
|
||||
+ var list = entitiesBySection[sectionY - this.manager.minSection];
|
||||
+ BasicEntityList<Entity> list = this.entitiesBySection[sectionY - this.slices.minSection];
|
||||
+
|
||||
+ if (list != null) {
|
||||
+ return list.storage;
|
||||
@@ -37,6 +36,7 @@ index 01701cdd0d984e35ff3453e6253ba9bcaa0db7b9..8fcaa00e461c7f4413bf655ddd8165a2
|
||||
+ return new Entity[0];
|
||||
+ }
|
||||
+ // Sakura end
|
||||
|
||||
+
|
||||
public void getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
|
||||
if (this.count == 0) {
|
||||
return;
|
||||
@@ -5,10 +5,10 @@ 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 85c0855eaf20013b60ed643052b783f7f6e30584..f6a66790dc489be03ecc4b3fbcfdd2585b46d10b 100644
|
||||
index 3a35dcdfd639240363891f412beeef47b8b41e06..b6364b02142a71741bdeb5df3da58dcbd41d1ba5 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 {
|
||||
@@ -113,6 +113,41 @@ public class Explosion {
|
||||
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ index 85c0855eaf20013b60ed643052b783f7f6e30584..f6a66790dc489be03ecc4b3fbcfdd258
|
||||
// Paper start - optimise collisions
|
||||
private static final double[] CACHED_RAYS;
|
||||
static {
|
||||
@@ -137,7 +172,7 @@ public class Explosion {
|
||||
@@ -138,7 +173,7 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ index 85c0855eaf20013b60ed643052b783f7f6e30584..f6a66790dc489be03ecc4b3fbcfdd258
|
||||
}
|
||||
|
||||
private static final int CHUNK_CACHE_SHIFT = 2;
|
||||
@@ -431,7 +466,7 @@ public class Explosion {
|
||||
@@ -432,7 +467,7 @@ public class Explosion {
|
||||
}
|
||||
// CraftBukkit end
|
||||
this.level.gameEvent(this.source, (Holder) GameEvent.EXPLODE, new Vec3(this.x, this.y, this.z));
|
||||
@@ -68,7 +68,7 @@ index 85c0855eaf20013b60ed643052b783f7f6e30584..f6a66790dc489be03ecc4b3fbcfdd258
|
||||
boolean flag = true;
|
||||
|
||||
int i;
|
||||
@@ -457,6 +492,17 @@ public class Explosion {
|
||||
@@ -458,6 +493,17 @@ public class Explosion {
|
||||
|
||||
initialCache = this.getOrCacheExplosionBlock(blockX, blockY, blockZ, key, true);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ index 85c0855eaf20013b60ed643052b783f7f6e30584..f6a66790dc489be03ecc4b3fbcfdd258
|
||||
// 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 {
|
||||
@@ -543,23 +589,62 @@ public class Explosion {
|
||||
}
|
||||
|
||||
this.toBlow.addAll(set);
|
||||
@@ -128,12 +128,11 @@ index 85c0855eaf20013b60ed643052b783f7f6e30584..f6a66790dc489be03ecc4b3fbcfdd258
|
||||
+ 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();
|
||||
+
|
||||
+ ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup entityLookup = this.level.moonrise$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);
|
||||
+ ca.spottedleaf.moonrise.patches.chunk_system.level.entity.ChunkEntitySlices chunk = entityLookup.getChunk(chunkX, chunkZ);
|
||||
+ if (chunk == null) continue; // empty slice
|
||||
+
|
||||
+ for (int chunkY = minChunkY; chunkY <= maxChunkY; ++chunkY) {
|
||||
@@ -151,14 +150,14 @@ index 85c0855eaf20013b60ed643052b783f7f6e30584..f6a66790dc489be03ecc4b3fbcfdd258
|
||||
+ 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 {
|
||||
@@ -583,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) {
|
||||
@@ -191,7 +190,7 @@ index 85c0855eaf20013b60ed643052b783f7f6e30584..f6a66790dc489be03ecc4b3fbcfdd258
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@@ -647,8 +736,12 @@ public class Explosion {
|
||||
@@ -648,8 +736,12 @@ public class Explosion {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,10 +52,10 @@ index 0000000000000000000000000000000000000000..c9f2c5ae57878283e8c8bc3847fe63b9
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 6f330f99a80f291bce638b0769e5ed00c283ac78..ce16878d3c9c52e8edd4b073916bb3f7fd595649 100644
|
||||
index 71e8a4f30afac822cc0da9620b904a02c201e452..6b90cfe63dce4a56033c8ecc9e68895fe3d77390 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -585,6 +585,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -579,6 +579,25 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return flags;
|
||||
}
|
||||
// Sakura end - load chunks on cannon entity movement
|
||||
@@ -82,14 +82,14 @@ index 6f330f99a80f291bce638b0769e5ed00c283ac78..ce16878d3c9c52e8edd4b073916bb3f7
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 5a43957309019bec27b9624e5268d6a8c50c165d..829a21a6da2de36f38cae9e1a3920fcc732eac0e 100644
|
||||
index 05a4b69fbaf36269bea3a050022a54d28211c285..9afc93364fd1176f0dedced6042abc2df938228e 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1313,6 +1313,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1358,6 +1358,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
|
||||
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
|
||||
try {
|
||||
+ entity.storeEntityState(); // Sakura - store entity state
|
||||
tickConsumer.accept(entity);
|
||||
MinecraftServer.getServer().executeMidTickTasks(); // Paper - execute chunk tasks mid tick
|
||||
} catch (Throwable throwable) {
|
||||
if (throwable instanceof ThreadDeath) throw throwable; // Paper
|
||||
@@ -169,10 +169,10 @@ index 0000000000000000000000000000000000000000..e63935c17e213bf60571d120ad9ce311
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index b72c796d30d4892e30d726c3b2a6b097b941979d..054783956aa6179f9f0813393b7a9afa41a6d54a 100644
|
||||
index 041e42c25e536a960a2e59114d2761c54520002e..5b366c69a28e3806d5507ad029e27231f8ef7c5c 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1803,6 +1803,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1752,6 +1752,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
|
||||
worldserver.localConfig().expire(currentTickLong); // Sakura - add local config
|
||||
worldserver.minimalTNT.clear(); // Sakura - visibility api
|
||||
@@ -181,10 +181,10 @@ index b72c796d30d4892e30d726c3b2a6b097b941979d..054783956aa6179f9f0813393b7a9afa
|
||||
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 4a3690c71eda93d2542e8c039442a51882f10475..ada18c755cee73620e6c0020674dd0a5a1d8f79d 100644
|
||||
index c4735c00c1e86975cffeed1597f69c52b6cb5a99..0f49093fce5e4eab4e8912d407edca04f0e124a4 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -899,6 +899,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -713,6 +713,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
|
||||
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
|
||||
this.timings.entityTick.startTiming(); // Spigot
|
||||
@@ -192,7 +192,7 @@ index 4a3690c71eda93d2542e8c039442a51882f10475..ada18c755cee73620e6c0020674dd0a5
|
||||
this.entityTickList.forEach((entity) -> {
|
||||
if (!entity.isRemoved()) {
|
||||
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
|
||||
@@ -918,6 +919,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -732,6 +733,15 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
entity.stopRiding();
|
||||
}
|
||||
|
||||
@@ -209,10 +209,10 @@ index 4a3690c71eda93d2542e8c039442a51882f10475..ada18c755cee73620e6c0020674dd0a5
|
||||
this.guardEntityTick(this::tickNonPassenger, entity);
|
||||
gameprofilerfiller.pop();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index ce16878d3c9c52e8edd4b073916bb3f7fd595649..88964adf81cd03b26556b50b764caaddd49b59be 100644
|
||||
index 6b90cfe63dce4a56033c8ecc9e68895fe3d77390..190e0022cb45545d8a76f0f7819b6f2be0b64307 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -604,6 +604,116 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -598,6 +598,116 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return to.entityState() != null && to.entityState().isCurrentState(this);
|
||||
}
|
||||
// Sakura end - store entity data/state
|
||||
@@ -329,7 +329,7 @@ index ce16878d3c9c52e8edd4b073916bb3f7fd595649..88964adf81cd03b26556b50b764caadd
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -653,6 +763,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -647,6 +757,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.entityData = datawatcher_a.build();
|
||||
this.setPos(0.0D, 0.0D, 0.0D);
|
||||
this.eyeHeight = this.dimensions.eyeHeight();
|
||||
@@ -337,7 +337,7 @@ index ce16878d3c9c52e8edd4b073916bb3f7fd595649..88964adf81cd03b26556b50b764caadd
|
||||
}
|
||||
|
||||
public boolean isColliding(BlockPos pos, BlockState state) {
|
||||
@@ -2591,6 +2702,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2643,6 +2754,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
nbttagcompound.putBoolean("Paper.FreezeLock", true);
|
||||
}
|
||||
// Paper end
|
||||
@@ -349,7 +349,7 @@ index ce16878d3c9c52e8edd4b073916bb3f7fd595649..88964adf81cd03b26556b50b764caadd
|
||||
return nbttagcompound;
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
|
||||
@@ -2738,6 +2854,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2790,6 +2906,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
|
||||
}
|
||||
// Paper end
|
||||
@@ -361,7 +361,7 @@ index ce16878d3c9c52e8edd4b073916bb3f7fd595649..88964adf81cd03b26556b50b764caadd
|
||||
|
||||
} catch (Throwable throwable) {
|
||||
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
|
||||
@@ -4949,6 +5070,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4961,6 +5082,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
// Paper end - rewrite chunk system
|
||||
CraftEventFactory.callEntityRemoveEvent(this, cause);
|
||||
// CraftBukkit end
|
||||
@@ -374,10 +374,10 @@ index ce16878d3c9c52e8edd4b073916bb3f7fd595649..88964adf81cd03b26556b50b764caadd
|
||||
if (this.removalReason == null) {
|
||||
this.removalReason = entity_removalreason;
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 86e12495ce807ba06210535350caa7db5e15d139..a148befad883e5d524dcf643690f80a0bfd079e5 100644
|
||||
index 79c2ea81444c0ac9598f7fe334055326958a4f30..fa95135e3af7fdd610cad2230cc39b547cda0a8a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -133,6 +133,59 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -137,6 +137,59 @@ public class FallingBlockEntity extends Entity {
|
||||
return !this.isRemoved();
|
||||
}
|
||||
|
||||
@@ -437,7 +437,7 @@ index 86e12495ce807ba06210535350caa7db5e15d139..a148befad883e5d524dcf643690f80a0
|
||||
@Override
|
||||
protected double getDefaultGravity() {
|
||||
return 0.04D;
|
||||
@@ -202,6 +255,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -207,6 +260,7 @@ public class FallingBlockEntity extends Entity {
|
||||
return;
|
||||
}
|
||||
// CraftBukkit end
|
||||
@@ -446,10 +446,10 @@ index 86e12495ce807ba06210535350caa7db5e15d139..a148befad883e5d524dcf643690f80a0
|
||||
((ServerLevel) this.level()).getChunkSource().chunkMap.broadcast(this, new ClientboundBlockUpdatePacket(blockposition, this.level().getBlockState(blockposition)));
|
||||
this.discard(EntityRemoveEvent.Cause.DESPAWN);
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 16340c2f8a948136c9fe0b2314c9ec7cbee74937..dc9d72bc033735dd83d7b0f3fe79d0a51b9661ab 100644
|
||||
index ac9781762a987b4d0121f69b9e873d169dfc24a0..71f01c2cb7182764ef4c527b8e84e162ebfd761c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -70,6 +70,44 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -90,6 +90,44 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
return !this.isRemoved();
|
||||
}
|
||||
|
||||
@@ -494,7 +494,7 @@ index 16340c2f8a948136c9fe0b2314c9ec7cbee74937..dc9d72bc033735dd83d7b0f3fe79d0a5
|
||||
@Override
|
||||
protected double getDefaultGravity() {
|
||||
return 0.04D;
|
||||
@@ -97,6 +135,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -118,6 +156,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
if (i <= 0) {
|
||||
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
||||
// this.discard();
|
||||
@@ -503,17 +503,17 @@ index 16340c2f8a948136c9fe0b2314c9ec7cbee74937..dc9d72bc033735dd83d7b0f3fe79d0a5
|
||||
this.explode();
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 829a21a6da2de36f38cae9e1a3920fcc732eac0e..557472039d6451d5a8471ff56609ce49620d30df 100644
|
||||
index 9afc93364fd1176f0dedced6042abc2df938228e..66af21d21f42e796ae49a2ac8a4f7e2ef9fad99c 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -218,6 +218,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public abstract ResourceKey<LevelStem> getTypeKey();
|
||||
@@ -220,6 +220,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
|
||||
public final it.unimi.dsi.fastutil.longs.Long2IntMap minimalTNT = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); // Sakura - visibility api
|
||||
// Paper start - rewrite chunk system
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup entityLookup;
|
||||
+ public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura - cannon entity merging
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura - sakura configuration files // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
@Override
|
||||
public final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup moonrise$getEntityLookup() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
|
||||
index 1359d25a32b4a5d5e8e68ce737bd19f7b5afaf69..0afa2cfb04b5097788927076669e85fe24041df9 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFallingBlock.java
|
||||
@@ -129,10 +129,10 @@ index 0000000000000000000000000000000000000000..d7e24638f07f243502004970ab4ce646
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 701dfa3017bdcc73d55f28ca0623f9791a4c712d..9257505431d00aec2225b052492b8eb88ed4d63d 100644
|
||||
index 5b366c69a28e3806d5507ad029e27231f8ef7c5c..2df0f8a92174be654acb27785ff1f4880dcf3362 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1804,6 +1804,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1753,6 +1753,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.localConfig().expire(currentTickLong); // Sakura - add local config
|
||||
worldserver.minimalTNT.clear(); // Sakura - visibility api
|
||||
worldserver.mergeHistory.expire(currentTickLong); // Sakura - merge cannoning entities
|
||||
@@ -141,10 +141,10 @@ index 701dfa3017bdcc73d55f28ca0623f9791a4c712d..9257505431d00aec2225b052492b8eb8
|
||||
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index f6a66790dc489be03ecc4b3fbcfdd2585b46d10b..a6a0c579d8cdcf56492686feb477a32900703f96 100644
|
||||
index b6364b02142a71741bdeb5df3da58dcbd41d1ba5..c5668c12a20628e1f3b216590488b432ad9a0adf 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -401,7 +401,12 @@ public class Explosion {
|
||||
@@ -402,7 +402,12 @@ public class Explosion {
|
||||
Math.fma(dz, diffZ, offZ)
|
||||
);
|
||||
|
||||
@@ -158,7 +158,7 @@ index f6a66790dc489be03ecc4b3fbcfdd2585b46d10b..a6a0c579d8cdcf56492686feb477a329
|
||||
++missedRays;
|
||||
}
|
||||
}
|
||||
@@ -436,7 +441,16 @@ public class Explosion {
|
||||
@@ -437,7 +442,16 @@ public class Explosion {
|
||||
double d10 = Mth.lerp(d7, axisalignedbb.minZ, axisalignedbb.maxZ);
|
||||
Vec3 vec3d1 = new Vec3(d8 + d3, d9, d10 + d4);
|
||||
|
||||
@@ -188,7 +188,7 @@ index f6a66790dc489be03ecc4b3fbcfdd2585b46d10b..a6a0c579d8cdcf56492686feb477a329
|
||||
Iterator iterator = list.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -961,14 +980,12 @@ public class Explosion {
|
||||
@@ -965,14 +984,12 @@ public class Explosion {
|
||||
}
|
||||
// Paper start - Optimize explosions
|
||||
private float getBlockDensity(Vec3 vec3d, Entity entity, ExplosionBlockCache[] blockCache, BlockPos.MutableBlockPos blockPos) { // Paper - optimise explosions
|
||||
@@ -209,17 +209,17 @@ index f6a66790dc489be03ecc4b3fbcfdd2585b46d10b..a6a0c579d8cdcf56492686feb477a329
|
||||
|
||||
return blockDensity;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 557472039d6451d5a8471ff56609ce49620d30df..d41086a80ea03855fde694947fa61f2d48eaa114 100644
|
||||
index 66af21d21f42e796ae49a2ac8a4f7e2ef9fad99c..1d822411f6cef0137eeb6383f404500642d3a731 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -219,6 +219,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
|
||||
public final it.unimi.dsi.fastutil.longs.Long2IntMap minimalTNT = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); // Sakura - visibility api
|
||||
@@ -221,6 +221,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
// Paper start - rewrite chunk system
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup entityLookup;
|
||||
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura - cannon entity merging
|
||||
+ public final me.samsuik.sakura.explosion.density.BlockDensityCache densityCache = new me.samsuik.sakura.explosion.density.BlockDensityCache(); // Sakura - explosion density cache
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura - sakura configuration files // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
@Override
|
||||
public final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup moonrise$getEntityLookup() {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java b/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
||||
index 8b33e35c843e5c0b8988a2ef2a38a2673035292f..5ec557652558bb44e9be7d32fc214091d29aac78 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/BasePressurePlateBlock.java
|
||||
@@ -253,10 +253,10 @@ index 76aca266d3f3222502ff4c196228f08fcd88c5f8..6a63e60d80ee53a4611dfcdd9ab974f8
|
||||
TripWireHookBlock.notifyNeighbors(block, world, blockposition1, enumdirection1);
|
||||
TripWireHookBlock.emitState(world, blockposition1, flag4, flag5, flag2, flag3);
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/AABB.java b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
index 92394960fc76886f393cba02ac33c57739a4b383..f6c420fc86c08dcc49bfd56be6c47d2b32f813b6 100644
|
||||
index e4e99fb9f1670dbc1c032dd834c4bfb3c9d4a8ca..acbaa9f85caaadafb165d1fd835e4dde9e73e200 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/AABB.java
|
||||
@@ -502,4 +502,28 @@ public class AABB {
|
||||
@@ -519,4 +519,28 @@ public class AABB {
|
||||
public static AABB ofSize(Vec3 center, double dx, double dy, double dz) {
|
||||
return new AABB(center.x - dx / 2.0, center.y - dy / 2.0, center.z - dz / 2.0, center.x + dx / 2.0, center.y + dy / 2.0, center.z + dz / 2.0);
|
||||
}
|
||||
@@ -1,374 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 23 Sep 2021 15:19:31 +0100
|
||||
Subject: [PATCH] Limited Get Entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
||||
index 15ee41452992714108efe53b708b5a4e1da7c1ff..b62a1ae53a891802db17046271b9981ab3af1df0 100644
|
||||
--- a/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
||||
+++ b/src/main/java/io/papermc/paper/chunk/system/entity/EntityLookup.java
|
||||
@@ -522,6 +522,128 @@ public final class EntityLookup implements LevelEntityGetter<Entity> {
|
||||
return slices;
|
||||
}
|
||||
|
||||
+ // Sakura start - limited get entities
|
||||
+ public void getLimitedEntities(final Entity except, final AABB box, final List<Entity> into,
|
||||
+ final Predicate<? super Entity> predicate, final int limit, final int search) {
|
||||
+ final int minChunkX = (Mth.floor(box.minX) - 2) >> 4;
|
||||
+ final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4;
|
||||
+ final int maxChunkX = (Mth.floor(box.maxX) + 2) >> 4;
|
||||
+ final int maxChunkZ = (Mth.floor(box.maxZ) + 2) >> 4;
|
||||
+
|
||||
+ final int minRegionX = minChunkX >> REGION_SHIFT;
|
||||
+ final int minRegionZ = minChunkZ >> REGION_SHIFT;
|
||||
+ final int maxRegionX = maxChunkX >> REGION_SHIFT;
|
||||
+ final int maxRegionZ = maxChunkZ >> REGION_SHIFT;
|
||||
+
|
||||
+ for (int currRegionZ = minRegionZ; currRegionZ <= maxRegionZ; ++currRegionZ) {
|
||||
+ final int minZ = currRegionZ == minRegionZ ? minChunkZ & REGION_MASK : 0;
|
||||
+ final int maxZ = currRegionZ == maxRegionZ ? maxChunkZ & REGION_MASK : REGION_MASK;
|
||||
+
|
||||
+ for (int currRegionX = minRegionX; currRegionX <= maxRegionX; ++currRegionX) {
|
||||
+ final ChunkSlicesRegion region = this.getRegion(currRegionX, currRegionZ);
|
||||
+
|
||||
+ if (region == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ final int minX = currRegionX == minRegionX ? minChunkX & REGION_MASK : 0;
|
||||
+ final int maxX = currRegionX == maxRegionX ? maxChunkX & REGION_MASK : REGION_MASK;
|
||||
+
|
||||
+ for (int currZ = minZ; currZ <= maxZ; ++currZ) {
|
||||
+ for (int currX = minX; currX <= maxX; ++currX) {
|
||||
+ final ChunkEntitySlices chunk = region.get(currX | (currZ << REGION_SHIFT));
|
||||
+ if (chunk == null || !chunk.status.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ chunk.getLimitedEntities(except, box, into, predicate, limit, search);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public <T extends Entity> void getLimitedEntities(final EntityType<?> type, final AABB box, final List<? super T> into,
|
||||
+ final Predicate<? super T> predicate, final int limit, final int search) {
|
||||
+ final int minChunkX = (Mth.floor(box.minX) - 2) >> 4;
|
||||
+ final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4;
|
||||
+ final int maxChunkX = (Mth.floor(box.maxX) + 2) >> 4;
|
||||
+ final int maxChunkZ = (Mth.floor(box.maxZ) + 2) >> 4;
|
||||
+
|
||||
+ final int minRegionX = minChunkX >> REGION_SHIFT;
|
||||
+ final int minRegionZ = minChunkZ >> REGION_SHIFT;
|
||||
+ final int maxRegionX = maxChunkX >> REGION_SHIFT;
|
||||
+ final int maxRegionZ = maxChunkZ >> REGION_SHIFT;
|
||||
+
|
||||
+ for (int currRegionZ = minRegionZ; currRegionZ <= maxRegionZ; ++currRegionZ) {
|
||||
+ final int minZ = currRegionZ == minRegionZ ? minChunkZ & REGION_MASK : 0;
|
||||
+ final int maxZ = currRegionZ == maxRegionZ ? maxChunkZ & REGION_MASK : REGION_MASK;
|
||||
+
|
||||
+ for (int currRegionX = minRegionX; currRegionX <= maxRegionX; ++currRegionX) {
|
||||
+ final ChunkSlicesRegion region = this.getRegion(currRegionX, currRegionZ);
|
||||
+
|
||||
+ if (region == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ final int minX = currRegionX == minRegionX ? minChunkX & REGION_MASK : 0;
|
||||
+ final int maxX = currRegionX == maxRegionX ? maxChunkX & REGION_MASK : REGION_MASK;
|
||||
+
|
||||
+ for (int currZ = minZ; currZ <= maxZ; ++currZ) {
|
||||
+ for (int currX = minX; currX <= maxX; ++currX) {
|
||||
+ final ChunkEntitySlices chunk = region.get(currX | (currZ << REGION_SHIFT));
|
||||
+ if (chunk == null || !chunk.status.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ chunk.getLimitedEntities(type, box, (List)into, (Predicate)predicate, limit, search);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public <T extends Entity> void getLimitedEntities(final Class<? extends T> clazz, final Entity except, final AABB box, final List<? super T> into,
|
||||
+ final Predicate<? super T> predicate, final int limit, final int search) {
|
||||
+ final int minChunkX = (Mth.floor(box.minX) - 2) >> 4;
|
||||
+ final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4;
|
||||
+ final int maxChunkX = (Mth.floor(box.maxX) + 2) >> 4;
|
||||
+ final int maxChunkZ = (Mth.floor(box.maxZ) + 2) >> 4;
|
||||
+
|
||||
+ final int minRegionX = minChunkX >> REGION_SHIFT;
|
||||
+ final int minRegionZ = minChunkZ >> REGION_SHIFT;
|
||||
+ final int maxRegionX = maxChunkX >> REGION_SHIFT;
|
||||
+ final int maxRegionZ = maxChunkZ >> REGION_SHIFT;
|
||||
+
|
||||
+ for (int currRegionZ = minRegionZ; currRegionZ <= maxRegionZ; ++currRegionZ) {
|
||||
+ final int minZ = currRegionZ == minRegionZ ? minChunkZ & REGION_MASK : 0;
|
||||
+ final int maxZ = currRegionZ == maxRegionZ ? maxChunkZ & REGION_MASK : REGION_MASK;
|
||||
+
|
||||
+ for (int currRegionX = minRegionX; currRegionX <= maxRegionX; ++currRegionX) {
|
||||
+ final ChunkSlicesRegion region = this.getRegion(currRegionX, currRegionZ);
|
||||
+
|
||||
+ if (region == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ final int minX = currRegionX == minRegionX ? minChunkX & REGION_MASK : 0;
|
||||
+ final int maxX = currRegionX == maxRegionX ? maxChunkX & REGION_MASK : REGION_MASK;
|
||||
+
|
||||
+ for (int currZ = minZ; currZ <= maxZ; ++currZ) {
|
||||
+ for (int currX = minX; currX <= maxX; ++currX) {
|
||||
+ final ChunkEntitySlices chunk = region.get(currX | (currZ << REGION_SHIFT));
|
||||
+ if (chunk == null || !chunk.status.isOrAfter(FullChunkStatus.FULL)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ chunk.getLimitedEntities(clazz, except, box, into, predicate, limit, search);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Sakura end
|
||||
+
|
||||
public void getEntitiesWithoutDragonParts(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
|
||||
final int minChunkX = (Mth.floor(box.minX) - 2) >> 4;
|
||||
final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4;
|
||||
diff --git a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
index 8fcaa00e461c7f4413bf655ddd8165a2b908f900..404b99def4562942e036089085a667979b1cac81 100644
|
||||
--- a/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/io/papermc/paper/world/ChunkEntitySlices.java
|
||||
@@ -259,6 +259,30 @@ public final class ChunkEntitySlices {
|
||||
}
|
||||
// Sakura end
|
||||
|
||||
+ // Sakura start - limited get entities
|
||||
+ public void getLimitedEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate, final int limit, final int search) {
|
||||
+ this.allEntities.getLimitedEntities(except, box, into, predicate, limit, search);
|
||||
+ }
|
||||
+
|
||||
+ public <T extends Entity> void getLimitedEntities(final EntityType<?> type, final AABB box, final List<? super T> into,
|
||||
+ final Predicate<? super T> predicate, final int limit, final int search) {
|
||||
+ this.allEntities.getLimitedEntities(type, box, (List)into, (Predicate)predicate, limit, search);
|
||||
+ }
|
||||
+
|
||||
+ public <T extends Entity> void getLimitedEntities(final Class<? extends T> clazz, final Entity except, final AABB box, final List<? super T> into,
|
||||
+ final Predicate<? super T> predicate, final int limit, final int search) {
|
||||
+ EntityCollectionBySection collection = this.entitiesByClass.get(clazz);
|
||||
+ if (collection != null) {
|
||||
+ collection.getLimitedEntities(except, clazz, box, (List)into, (Predicate)predicate, limit, search);
|
||||
+ } else {
|
||||
+ synchronized (this) {
|
||||
+ this.entitiesByClass.putIfAbsent(clazz, collection = this.initClass(clazz));
|
||||
+ }
|
||||
+ collection.getLimitedEntities(except, clazz, box, (List)into, (Predicate)predicate, limit, search);
|
||||
+ }
|
||||
+ }
|
||||
+ // Sakura end
|
||||
+
|
||||
public void getHardCollidingEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
|
||||
this.hardCollidingEntities.getEntities(except, box, into, predicate);
|
||||
}
|
||||
@@ -449,6 +473,155 @@ public final class ChunkEntitySlices {
|
||||
}
|
||||
// Sakura end
|
||||
|
||||
+ // Sakura start - limited get entities
|
||||
+ public void getLimitedEntities(final Entity except, final Class<?> clazz, final AABB box, final List<Entity> into,
|
||||
+ final Predicate<? super Entity> predicate, final int limit, int search) {
|
||||
+ if (this.count == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final int minSection = this.manager.minSection;
|
||||
+ final int maxSection = this.manager.maxSection;
|
||||
+
|
||||
+ final int min = Mth.clamp(Mth.floor(box.minY - 2.0) >> 4, minSection, maxSection);
|
||||
+ final int max = Mth.clamp(Mth.floor(box.maxY + 2.0) >> 4, minSection, maxSection);
|
||||
+
|
||||
+ // TODO use the bitset
|
||||
+
|
||||
+ final BasicEntityList<Entity>[] entitiesBySection = this.entitiesBySection;
|
||||
+
|
||||
+ for (int section = min; section <= max; ++section) {
|
||||
+ final BasicEntityList<Entity> list = entitiesBySection[section - minSection];
|
||||
+
|
||||
+ if (list == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ final Entity[] storage = list.storage;
|
||||
+
|
||||
+ int len = Math.min(storage.length, list.size());
|
||||
+ int index = manager.world.random.nextInt(len); // starting position
|
||||
+
|
||||
+ for (int i = 0; i < len; ++i) {
|
||||
+ index = (index + 1) % len; // Update index
|
||||
+ final Entity entity = storage[index];
|
||||
+
|
||||
+ if (into.size() >= limit || search-- <= 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (entity == null || entity == except || !clazz.isInstance(entity) || !entity.getBoundingBox().intersects(box)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (predicate != null && !predicate.test(entity)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ into.add(entity);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public <T extends Entity> void getLimitedEntities(final EntityType<?> type, final AABB box, final List<? super T> into,
|
||||
+ final Predicate<? super T> predicate, final int limit, int search) {
|
||||
+ if (this.count == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final int minSection = this.manager.minSection;
|
||||
+ final int maxSection = this.manager.maxSection;
|
||||
+
|
||||
+ final int min = Mth.clamp(Mth.floor(box.minY - 2.0) >> 4, minSection, maxSection);
|
||||
+ final int max = Mth.clamp(Mth.floor(box.maxY + 2.0) >> 4, minSection, maxSection);
|
||||
+
|
||||
+ // TODO use the bitset
|
||||
+
|
||||
+ final BasicEntityList<Entity>[] entitiesBySection = this.entitiesBySection;
|
||||
+
|
||||
+ for (int section = min; section <= max; ++section) {
|
||||
+ final BasicEntityList<Entity> list = entitiesBySection[section - minSection];
|
||||
+
|
||||
+ if (list == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ final Entity[] storage = list.storage;
|
||||
+
|
||||
+ int len = Math.min(storage.length, list.size());
|
||||
+ int index = manager.world.random.nextInt(len); // starting position
|
||||
+
|
||||
+ for (int i = 0; i < len; ++i) {
|
||||
+ index = (index + 1) % len; // Update index
|
||||
+ final Entity entity = storage[index];
|
||||
+
|
||||
+ if (into.size() >= limit || search-- <= 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (entity == null || (type != null && entity.getType() != type) || !entity.getBoundingBox().intersects(box)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (predicate != null && !predicate.test((T)entity)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ into.add((T)entity);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public void getLimitedEntities(final Entity except, final AABB box, final List<Entity> into,
|
||||
+ final Predicate<? super Entity> predicate, final int limit, int search) {
|
||||
+ if (this.count == 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ final int minSection = this.manager.minSection;
|
||||
+ final int maxSection = this.manager.maxSection;
|
||||
+
|
||||
+ final int min = Mth.clamp(Mth.floor(box.minY - 2.0) >> 4, minSection, maxSection);
|
||||
+ final int max = Mth.clamp(Mth.floor(box.maxY + 2.0) >> 4, minSection, maxSection);
|
||||
+
|
||||
+ // TODO use the bitset
|
||||
+
|
||||
+ final BasicEntityList<Entity>[] entitiesBySection = this.entitiesBySection;
|
||||
+
|
||||
+ for (int section = min; section <= max; ++section) {
|
||||
+ final BasicEntityList<Entity> list = entitiesBySection[section - minSection];
|
||||
+
|
||||
+ if (list == null) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ final Entity[] storage = list.storage;
|
||||
+
|
||||
+ int len = Math.min(storage.length, list.size());
|
||||
+ int index = manager.world.random.nextInt(len); // starting position
|
||||
+
|
||||
+ for (int i = 0; i < len; ++i) {
|
||||
+ index = (index + 1) % len; // Update index
|
||||
+ final Entity entity = storage[index];
|
||||
+
|
||||
+ if (into.size() >= limit || search-- <= 0) {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ if (entity == null || entity == except || !entity.getBoundingBox().intersects(box)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ if (predicate != null && !predicate.test(entity)) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
+ into.add(entity);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ // Sakura end
|
||||
+
|
||||
public void getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
|
||||
if (this.count == 0) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 507d676c58daf2297eb729543a7f86c896a984d6..d041ad1e52c78c553da4d92745d2b07fc3eab522 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -221,6 +221,39 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura - cannon entity merging
|
||||
public final me.samsuik.sakura.explosion.density.BlockDensityCache densityCache = new me.samsuik.sakura.explosion.density.BlockDensityCache(); // Sakura - explosion density cache
|
||||
|
||||
+ // Sakura start - add entity retrival methods with search limits
|
||||
+ public final void getLimitedEntities(Entity except, AABB box, Predicate<? super Entity> predicate, List<Entity> into, int limit, int search) {
|
||||
+ ((ServerLevel)this).getEntityLookup().getLimitedEntities(except, box, into, predicate, limit, search);
|
||||
+ }
|
||||
+
|
||||
+ public final <T extends Entity> List<T> getLimitedEntities(net.minecraft.world.entity.EntityType<?> filter, AABB box, Predicate<? super T> predicate, int limit, int search) {
|
||||
+ List<T> ret = new java.util.ArrayList<>();
|
||||
+ ((ServerLevel)this).getEntityLookup().getLimitedEntities(filter, box, ret, predicate, limit, search);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ public final <T> void getLimitedEntitiesByClass(Class<? extends T> clazz, Entity except, final AABB box, List<? super T> into,
|
||||
+ Predicate<? super T> predicate, int limit, int search) {
|
||||
+ ((ServerLevel)this).getEntityLookup().getLimitedEntities((Class)clazz, except, box, (List)into, (Predicate)predicate, limit, search);
|
||||
+ }
|
||||
+
|
||||
+ public final <T extends Entity> List<T> getLimitedEntitiesOfClass(Class<T> entityClass, AABB box, Predicate<? super T> predicate, int limit, int search) {
|
||||
+ List<T> ret = new java.util.ArrayList<>();
|
||||
+ ((ServerLevel)this).getEntityLookup().getLimitedEntities(entityClass, null, box, ret, predicate, limit, search);
|
||||
+ return ret;
|
||||
+ }
|
||||
+
|
||||
+ public final List<Entity> getLimitedEntities(@Nullable Entity except, AABB box, Predicate<? super Entity> predicate, int limit, int search) {
|
||||
+ List<Entity> list = Lists.newArrayList();
|
||||
+ getLimitedEntities(except, box, predicate, list, limit, search);
|
||||
+ return list;
|
||||
+ }
|
||||
+
|
||||
+ public final List<Entity> getLimitedEntities(@Nullable Entity except, AABB box, int limit, int search) {
|
||||
+ return this.getLimitedEntities(except, box, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS, limit, search);
|
||||
+ }
|
||||
+ // Sakura end - add entity retrival methods with search limits
|
||||
+
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura - sakura configuration files // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper - create paper world config
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise explosions in protected regions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index ead8ddd7fd9941d4349b9b94ad313bf9d46bdc0b..d7e8dd148098de080c5bc0f76b36207501e1089f 100644
|
||||
index c5668c12a20628e1f3b216590488b432ad9a0adf..576b7260016b770a62ed9a291dd20bf7063897cd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -416,6 +416,21 @@ public class Explosion {
|
||||
@@ -417,6 +417,21 @@ public class Explosion {
|
||||
return (float)missedRays / (float)totalRays;
|
||||
}
|
||||
// Paper end - optimise collisions
|
||||
@@ -30,7 +30,7 @@ index ead8ddd7fd9941d4349b9b94ad313bf9d46bdc0b..d7e8dd148098de080c5bc0f76b362075
|
||||
|
||||
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
|
||||
return (ExplosionDamageCalculator) (entity == null ? Explosion.EXPLOSION_DAMAGE_CALCULATOR : new EntityBasedExplosionDamageCalculator(entity));
|
||||
@@ -507,7 +522,7 @@ public class Explosion {
|
||||
@@ -508,7 +523,7 @@ public class Explosion {
|
||||
initialCache = this.getOrCacheExplosionBlock(blockX, blockY, blockZ, key, true);
|
||||
}
|
||||
// Sakura start - optimise paper explosions
|
||||
@@ -4,11 +4,11 @@ Date: Fri, 3 May 2024 15:04:31 +0100
|
||||
Subject: [PATCH] Specialised Explosions
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java b/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java
|
||||
index 0fd814f1d65c111266a2b20f86561839a4cef755..932f7a0d030d2d4932e6e6d4a5805e9b683cce67 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/maplist/IteratorSafeOrderedReferenceSet.java
|
||||
@@ -125,6 +125,12 @@ public final class IteratorSafeOrderedReferenceSet<E> {
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java b/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java
|
||||
index c21e00812f1aaa1279834a0562d360d6b89e146c..442119e7c4670582556b067dfc03e39add7c2c9d 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/list/IteratorSafeOrderedReferenceSet.java
|
||||
@@ -107,6 +107,12 @@ public final class IteratorSafeOrderedReferenceSet<E> {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ index 0fd814f1d65c111266a2b20f86561839a4cef755..932f7a0d030d2d4932e6e6d4a5805e9b
|
||||
if (index >= 0) {
|
||||
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..d15eb10fa203236060b90c5fc1364564dec8753f
|
||||
index 0000000000000000000000000000000000000000..55bf4424d8e995ea7384f88f43465f90ae3c6704
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
|
||||
@@ -0,0 +1,200 @@
|
||||
@@ -155,10 +155,10 @@ index 0000000000000000000000000000000000000000..d15eb10fa203236060b90c5fc1364564
|
||||
+ int maxChunkY = Mth.clamp(Mth.floor(bb.maxY) >> 4, minSection, maxSection);
|
||||
+ int maxChunkZ = Mth.floor(bb.maxZ) >> 4;
|
||||
+
|
||||
+ io.papermc.paper.chunk.system.entity.EntityLookup entityLookup = this.level.getEntityLookup();
|
||||
+ ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup entityLookup = this.level.moonrise$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);
|
||||
+ ca.spottedleaf.moonrise.patches.chunk_system.level.entity.ChunkEntitySlices chunk = entityLookup.getChunk(chunkX, chunkZ);
|
||||
+
|
||||
+ if (chunk == null) {
|
||||
+ continue;
|
||||
@@ -229,13 +229,13 @@ index 0000000000000000000000000000000000000000..d15eb10fa203236060b90c5fc1364564
|
||||
+}
|
||||
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..1690428df289ac55a5a6eaf406a7accc3e6143af
|
||||
index 0000000000000000000000000000000000000000..3888c76dc16b76ae214aeb7265e8b0e9d600b863
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
@@ -0,0 +1,191 @@
|
||||
+package me.samsuik.sakura.explosion.special;
|
||||
+
|
||||
+import io.papermc.paper.util.maplist.IteratorSafeOrderedReferenceSet;
|
||||
+import ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet;
|
||||
+import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
+import me.samsuik.sakura.entity.EntityState;
|
||||
+import net.minecraft.core.BlockPos;
|
||||
@@ -425,10 +425,10 @@ index 0000000000000000000000000000000000000000..1690428df289ac55a5a6eaf406a7accc
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index ada18c755cee73620e6c0020674dd0a5a1d8f79d..00259cc930a0b1db38c3abbb5fcf7430d5f50079 100644
|
||||
index 0f49093fce5e4eab4e8912d407edca04f0e124a4..82ff83fd00b976d41d1d5b30ad34ede9af1a7e5b 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1964,6 +1964,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1702,6 +1702,12 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
explosion.clearToBlow();
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ index ada18c755cee73620e6c0020674dd0a5a1d8f79d..00259cc930a0b1db38c3abbb5fcf7430
|
||||
Iterator iterator = this.players.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
@@ -1974,7 +1980,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1712,7 +1718,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,10 +451,10 @@ index ada18c755cee73620e6c0020674dd0a5a1d8f79d..00259cc930a0b1db38c3abbb5fcf7430
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index dc9d72bc033735dd83d7b0f3fe79d0a51b9661ab..6cfa54da058939003576025cb0512e0bcc3e715b 100644
|
||||
index 71f01c2cb7182764ef4c527b8e84e162ebfd761c..a86ca8e7c66605260d8932b489d5d4fe8c74ab64 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -84,28 +84,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -104,28 +104,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
&& (tnt.entityState().fallDistance() == fallDistance
|
||||
|| tnt.entityState().fallDistance() > 2.5f && fallDistance > 2.5f);
|
||||
}
|
||||
@@ -485,10 +485,10 @@ index dc9d72bc033735dd83d7b0f3fe79d0a51b9661ab..6cfa54da058939003576025cb0512e0b
|
||||
|
||||
@Override
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 103eca429d899f4d004ac0cb1996339e66543080..d10d2581c6dfdaf7518bead4f2340c1b63b4bc44 100644
|
||||
index 576b7260016b770a62ed9a291dd20bf7063897cd..a376d53dba483b1da96bb468877a958f187a8680 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -56,9 +56,11 @@ public class Explosion {
|
||||
@@ -57,9 +57,11 @@ public class Explosion {
|
||||
private final Explosion.BlockInteraction blockInteraction;
|
||||
private final RandomSource random;
|
||||
private final Level level;
|
||||
@@ -503,7 +503,7 @@ index 103eca429d899f4d004ac0cb1996339e66543080..d10d2581c6dfdaf7518bead4f2340c1b
|
||||
@Nullable
|
||||
public final Entity source;
|
||||
private final float radius;
|
||||
@@ -186,7 +188,7 @@ public class Explosion {
|
||||
@@ -187,7 +189,7 @@ public class Explosion {
|
||||
// resistance = (res + 0.3F) * 0.3F;
|
||||
// so for resistance = 0, we need res = -0.3F
|
||||
private static final Float ZERO_RESISTANCE = Float.valueOf(-0.3f);
|
||||
@@ -512,7 +512,7 @@ index 103eca429d899f4d004ac0cb1996339e66543080..d10d2581c6dfdaf7518bead4f2340c1b
|
||||
|
||||
public static final class ExplosionBlockCache {
|
||||
|
||||
@@ -213,7 +215,29 @@ public class Explosion {
|
||||
@@ -214,7 +216,29 @@ public class Explosion {
|
||||
private long[] chunkPosCache = null;
|
||||
private net.minecraft.world.level.chunk.LevelChunk[] chunkCache = null;
|
||||
|
||||
@@ -543,7 +543,7 @@ index 103eca429d899f4d004ac0cb1996339e66543080..d10d2581c6dfdaf7518bead4f2340c1b
|
||||
final long key, final boolean calculateResistance) {
|
||||
ExplosionBlockCache ret = this.blockCache.get(key);
|
||||
if (ret != null) {
|
||||
@@ -311,7 +335,7 @@ public class Explosion {
|
||||
@@ -312,7 +336,7 @@ public class Explosion {
|
||||
(currZ & BLOCK_EXPLOSION_CACHE_MASK) << (BLOCK_EXPLOSION_CACHE_SHIFT + BLOCK_EXPLOSION_CACHE_SHIFT);
|
||||
ExplosionBlockCache cachedBlock = blockCache[cacheKey];
|
||||
if (cachedBlock == null || cachedBlock.key != key) {
|
||||
@@ -552,7 +552,7 @@ index 103eca429d899f4d004ac0cb1996339e66543080..d10d2581c6dfdaf7518bead4f2340c1b
|
||||
}
|
||||
|
||||
final BlockState blockState = cachedBlock.blockState;
|
||||
@@ -502,14 +526,7 @@ public class Explosion {
|
||||
@@ -503,14 +527,7 @@ public class Explosion {
|
||||
int j;
|
||||
|
||||
// Paper start - optimise explosions
|
||||
@@ -568,7 +568,7 @@ index 103eca429d899f4d004ac0cb1996339e66543080..d10d2581c6dfdaf7518bead4f2340c1b
|
||||
// use initial cache value that is most likely to be used: the source position
|
||||
final ExplosionBlockCache initialCache;
|
||||
{
|
||||
@@ -994,7 +1011,7 @@ public class Explosion {
|
||||
@@ -998,7 +1015,7 @@ public class Explosion {
|
||||
private BlockInteraction() {}
|
||||
}
|
||||
// Paper start - Optimize explosions
|
||||
@@ -578,10 +578,10 @@ index 103eca429d899f4d004ac0cb1996339e66543080..d10d2581c6dfdaf7518bead4f2340c1b
|
||||
float blockDensity = this.level.densityCache.getDensity(vec3d, entity);
|
||||
if (blockDensity == me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index d41086a80ea03855fde694947fa61f2d48eaa114..507d676c58daf2297eb729543a7f86c896a984d6 100644
|
||||
index 1d822411f6cef0137eeb6383f404500642d3a731..459d8b792c40caaebe38cfcf87533b325e76ceea 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1407,7 +1407,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -1451,7 +1451,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
}
|
||||
|
||||
Explosion.BlockInteraction explosion_effect1 = explosion_effect;
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Optimise Fast Movement
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 88964adf81cd03b26556b50b764caaddd49b59be..e689173f44a06ad320740dab2eceda5ff0e68fe2 100644
|
||||
index 190e0022cb45545d8a76f0f7819b6f2be0b64307..348714eb8d74cf917daa5586f0b4962351a96102 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -1276,6 +1276,95 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1245,6 +1245,95 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return this.onGround;
|
||||
}
|
||||
// Paper end - detailed watchdog information
|
||||
|
||||
+ // Sakura start - stripped back movement method for basic entities
|
||||
+ public void moveBasic(MoverType movementType, Vec3 movement) {
|
||||
@@ -40,7 +40,7 @@ index 88964adf81cd03b26556b50b764caaddd49b59be..e689173f44a06ad320740dab2eceda5f
|
||||
+ if (d0 > 1.0E-7D) {
|
||||
+ // NOTE: if there are any blocks in the future that rely on fall distance make sure this is correct.
|
||||
+ // The only block I am aware of is powdered snow that has a special case for falling blocks.
|
||||
+ if (this.fallDistance != 0.0F && d0 >= 1.0D && !isFallingBlock) {
|
||||
+ if (this.fallDistance != 0.0F && d0 >= 1.0D && !this.isFallingBlock) {
|
||||
+ BlockHitResult movingobjectpositionblock = this.level().clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this));
|
||||
+
|
||||
+ if (movingobjectpositionblock.getType() != HitResult.Type.MISS) {
|
||||
@@ -65,7 +65,7 @@ index 88964adf81cd03b26556b50b764caaddd49b59be..e689173f44a06ad320740dab2eceda5f
|
||||
+ this.minorHorizontalCollision = false;
|
||||
+ }
|
||||
+
|
||||
+ this.setOnGroundWithKnownMovement(this.verticalCollisionBelow, vec3d1);
|
||||
+ this.setOnGroundWithMovement(this.verticalCollisionBelow, vec3d1);
|
||||
+ BlockPos blockposition = this.getOnPosLegacy();
|
||||
+ BlockState iblockdata = this.level().getBlockState(blockposition);
|
||||
+
|
||||
@@ -103,8 +103,8 @@ index 88964adf81cd03b26556b50b764caaddd49b59be..e689173f44a06ad320740dab2eceda5f
|
||||
+
|
||||
public void move(MoverType movementType, Vec3 movement) {
|
||||
final Vec3 originalMovement = movement; // Paper - Expose pre-collision velocity
|
||||
// Paper start - detailed watchdog information
|
||||
@@ -1654,6 +1743,95 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (this.noPhysics) {
|
||||
@@ -1606,6 +1695,95 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return offsetFactor;
|
||||
}
|
||||
|
||||
@@ -199,12 +199,12 @@ index 88964adf81cd03b26556b50b764caaddd49b59be..e689173f44a06ad320740dab2eceda5f
|
||||
+
|
||||
private Vec3 collide(Vec3 movement) {
|
||||
// Paper start - optimise collisions
|
||||
final boolean xZero = movement.x == 0.0;
|
||||
// Sakura - This is temporary workaround until this patch is updated by Paper.
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index a148befad883e5d524dcf643690f80a0bfd079e5..eec86ec7088079f31a5348089f47f29e7a1adaa8 100644
|
||||
index fa95135e3af7fdd610cad2230cc39b547cda0a8a..533b7db0adc9aa9677106f807a992bc09ba60b28 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -200,7 +200,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -204,7 +204,7 @@ public class FallingBlockEntity extends Entity {
|
||||
|
||||
++this.time;
|
||||
this.applyGravity();
|
||||
@@ -214,12 +214,12 @@ index a148befad883e5d524dcf643690f80a0bfd079e5..eec86ec7088079f31a5348089f47f29e
|
||||
if (this.level().paperConfig().fixes.fallingBlockHeightNerf.test(v -> this.getY() > v)) {
|
||||
if (this.dropItem && this.level().getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 6cfa54da058939003576025cb0512e0bcc3e715b..d3073a058e4d200b0146d7b72ef3cd56a6a1d8d8 100644
|
||||
index a86ca8e7c66605260d8932b489d5d4fe8c74ab64..96878f577174b0ccef7c063153a0787ec3e97177 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -96,7 +96,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
public void tick() {
|
||||
@@ -117,7 +117,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot
|
||||
this.handlePortal();
|
||||
this.applyGravity();
|
||||
- this.move(MoverType.SELF, this.getDeltaMovement());
|
||||
+ this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura - optimise simple entity movement
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] isPushedByFluid API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index e689173f44a06ad320740dab2eceda5ff0e68fe2..cef9b3f34e13fb1b6b80179e12dfb1e03d66e39a 100644
|
||||
index 348714eb8d74cf917daa5586f0b4962351a96102..6066121c7bd432228b0503c8200d2dbe891bce29 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -714,6 +714,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -708,6 +708,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
}
|
||||
// Sakura end - cannon entity merging
|
||||
@@ -16,7 +16,7 @@ index e689173f44a06ad320740dab2eceda5ff0e68fe2..cef9b3f34e13fb1b6b80179e12dfb1e0
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -4305,7 +4306,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4329,7 +4330,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public boolean isPushedByFluid() {
|
||||
@@ -26,10 +26,10 @@ index e689173f44a06ad320740dab2eceda5ff0e68fe2..cef9b3f34e13fb1b6b80179e12dfb1e0
|
||||
|
||||
public static double getViewScale() {
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
index a2d336ceb52b63db5c03432ee7bc94dc6a742b82..b51f8f2975918db3a510cb64a93bdb935b8e7510 100644
|
||||
index 2cde808bfa797256409879505ba205a71f381981..f06b71b62bef13c9de519fd2758d107241904a1c 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
||||
@@ -201,6 +201,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
@@ -203,6 +203,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
||||
return this.entity.isInWater();
|
||||
}
|
||||
|
||||
@@ -5,18 +5,18 @@ Subject: [PATCH] Cannon Mechanics
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index eec86ec7088079f31a5348089f47f29e7a1adaa8..755c620be47f3f93852ac5e916b14d3c94167f27 100644
|
||||
index 533b7db0adc9aa9677106f807a992bc09ba60b28..ab68447f818c0dca777c25c04ac959e5f2b80132 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -68,6 +68,7 @@ public class FallingBlockEntity extends Entity {
|
||||
public CompoundTag blockData;
|
||||
@@ -72,6 +72,7 @@ public class FallingBlockEntity extends Entity {
|
||||
public boolean forceTickAfterTeleportToDuplicate;
|
||||
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
|
||||
public boolean autoExpire = true; // Paper - Expand FallingBlock API
|
||||
+ public boolean heightParity; // Sakura - configure cannon mechanics
|
||||
|
||||
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -76,6 +77,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -80,6 +81,7 @@ public class FallingBlockEntity extends Entity {
|
||||
this.fallDamageMax = 40;
|
||||
this.isFallingBlock = true; // Sakura
|
||||
this.loadChunks = world.sakuraConfig().cannons.loadChunks; // Sakura - falling blocks load chunks
|
||||
@@ -24,7 +24,7 @@ index eec86ec7088079f31a5348089f47f29e7a1adaa8..755c620be47f3f93852ac5e916b14d3c
|
||||
}
|
||||
|
||||
public FallingBlockEntity(Level world, double x, double y, double z, BlockState block) {
|
||||
@@ -185,6 +187,12 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -189,6 +191,12 @@ public class FallingBlockEntity extends Entity {
|
||||
return itemEntity;
|
||||
}
|
||||
// Sakura end
|
||||
@@ -38,10 +38,10 @@ index eec86ec7088079f31a5348089f47f29e7a1adaa8..755c620be47f3f93852ac5e916b14d3c
|
||||
@Override
|
||||
protected double getDefaultGravity() {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index d3073a058e4d200b0146d7b72ef3cd56a6a1d8d8..8760cfe061e33ac257c5fcf9c0833ba5b470d95b 100644
|
||||
index 96878f577174b0ccef7c063153a0787ec3e97177..ffb453616a5b5664c5b5a8a6410f3096d6c7f4e0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -52,6 +52,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -72,6 +72,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
this.yo = y;
|
||||
this.zo = z;
|
||||
this.owner = igniter;
|
||||
@@ -54,7 +54,7 @@ index d3073a058e4d200b0146d7b72ef3cd56a6a1d8d8..8760cfe061e33ac257c5fcf9c0833ba5
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -218,7 +224,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -255,7 +261,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
// Paper start - Option to prevent TNT from moving in water
|
||||
@Override
|
||||
public boolean isPushedByFluid() {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise TNT fluid state and pushing
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index cef9b3f34e13fb1b6b80179e12dfb1e03d66e39a..e8b850b0608e8d876f0f3415880e4f90ca3b9d85 100644
|
||||
index 6066121c7bd432228b0503c8200d2dbe891bce29..0946d71f8ef41f42db038c2efd527a319f55e069 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2256,7 +2256,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2296,7 +2296,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return this.isInWater() || flag;
|
||||
}
|
||||
|
||||
@@ -18,10 +18,10 @@ index cef9b3f34e13fb1b6b80179e12dfb1e03d66e39a..e8b850b0608e8d876f0f3415880e4f90
|
||||
|
||||
if (entity instanceof Boat entityboat) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index 8760cfe061e33ac257c5fcf9c0833ba5b470d95b..9d0d73ef60a739d37e2678f9e80398f9f33f6207 100644
|
||||
index ffb453616a5b5664c5b5a8a6410f3096d6c7f4e0..1bebee482d0a5ca1a56474660888be01d257b231 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -92,6 +92,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -112,6 +112,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
}
|
||||
// Sakura - specialised explosions
|
||||
// Sakura end
|
||||
132
patches/server/0030-Add-maxSearch-to-getEntities.patch
Normal file
132
patches/server/0030-Add-maxSearch-to-getEntities.patch
Normal file
@@ -0,0 +1,132 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Thu, 27 Jun 2024 17:02:32 +0100
|
||||
Subject: [PATCH] Add maxSearch to getEntities
|
||||
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
index c140e3a73712d2123bc9ed09e9bab25e48c4420e..ee58a65582800be827c8f386ec2d50a2eadad404 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
|
||||
@@ -336,10 +336,16 @@ public final class ChunkEntitySlices {
|
||||
this.allEntities.getEntities(except, box, into, predicate);
|
||||
}
|
||||
|
||||
+ // Sakura start - add maxSearch to getEntities
|
||||
+ public boolean getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate,
|
||||
+ final int maxCount) {
|
||||
+ return this.getEntities(except, box, into, predicate, maxCount, Integer.MAX_VALUE);
|
||||
+ }
|
||||
|
||||
public boolean getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate,
|
||||
- final int maxCount) {
|
||||
- return this.allEntities.getEntitiesWithEnderDragonPartsLimited(except, box, into, predicate, maxCount);
|
||||
+ final int maxCount, final int maxSearch) {
|
||||
+ return this.allEntities.getEntitiesWithEnderDragonPartsLimited(except, box, into, predicate, maxCount, maxSearch);
|
||||
+ // Sakura end - add maxSearch to getEntities
|
||||
}
|
||||
|
||||
public boolean getEntitiesWithoutDragonParts(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate,
|
||||
@@ -693,8 +699,16 @@ public final class ChunkEntitySlices {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Sakura start - add maxSearch to getEntities
|
||||
public boolean getEntitiesWithEnderDragonPartsLimited(final Entity except, final AABB box, final List<Entity> into,
|
||||
final Predicate<? super Entity> predicate, final int maxCount) {
|
||||
+ return this.getEntitiesWithEnderDragonPartsLimited(except, box, into, predicate, maxCount, Integer.MAX_VALUE);
|
||||
+ }
|
||||
+
|
||||
+ public boolean getEntitiesWithEnderDragonPartsLimited(final Entity except, final AABB box, final List<Entity> into,
|
||||
+ final Predicate<? super Entity> predicate, final int maxCount,
|
||||
+ final int maxSearch) {
|
||||
+ // Sakura end - add maxSearch to getEntities
|
||||
if (this.count == 0) {
|
||||
return false;
|
||||
}
|
||||
@@ -716,8 +730,14 @@ public final class ChunkEntitySlices {
|
||||
|
||||
final Entity[] storage = list.storage;
|
||||
|
||||
- for (int i = 0, len = Math.min(storage.length, list.size()); i < len; ++i) {
|
||||
- final Entity entity = storage[i];
|
||||
+ // Sakura start - add maxSearch to getEntities
|
||||
+ final int len = Math.min(storage.length, list.size());
|
||||
+ final int offset = this.slices.world.random.nextInt(len);
|
||||
+ for (int i = 0; i < len; ++i) {
|
||||
+ final int pos = (i + offset) % len;
|
||||
+ final Entity entity = storage[pos];
|
||||
+ if (i > maxSearch) break;
|
||||
+ // Sakura end - add maxSearch to getEntities
|
||||
|
||||
if (entity == null || entity == except || !entity.getBoundingBox().intersects(box)) {
|
||||
continue;
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java
|
||||
index f6a3eb3d1bb070bcc74133818682571d520d9894..e7d660a3adf8152b859be28b851088b6e9af8a96 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/EntityLookup.java
|
||||
@@ -765,8 +765,15 @@ public abstract class EntityLookup implements LevelEntityGetter<Entity> {
|
||||
}
|
||||
}
|
||||
|
||||
+ // Sakura start - add maxSearch to getEntities
|
||||
public void getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate,
|
||||
final int maxCount) {
|
||||
+ this.getEntities(except, box, into, predicate, maxCount, Integer.MAX_VALUE);
|
||||
+ }
|
||||
+
|
||||
+ public void getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate,
|
||||
+ final int maxCount, final int maxSearch) {
|
||||
+ // Sakura end - add maxSearch to getEntities
|
||||
final int minChunkX = (Mth.floor(box.minX) - 2) >> 4;
|
||||
final int minChunkZ = (Mth.floor(box.minZ) - 2) >> 4;
|
||||
final int maxChunkX = (Mth.floor(box.maxX) + 2) >> 4;
|
||||
@@ -798,7 +805,7 @@ public abstract class EntityLookup implements LevelEntityGetter<Entity> {
|
||||
continue;
|
||||
}
|
||||
|
||||
- if (chunk.getEntities(except, box, into, predicate, maxCount)) {
|
||||
+ if (chunk.getEntities(except, box, into, predicate, maxCount, maxSearch)) { // Sakura - add maxSearch to getEntities
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1041,4 +1048,4 @@ public abstract class EntityLookup implements LevelEntityGetter<Entity> {
|
||||
@Override
|
||||
public void onRemove(final Entity.RemovalReason reason) {}
|
||||
}
|
||||
-}
|
||||
\ No newline at end of file
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 459d8b792c40caaebe38cfcf87533b325e76ceea..71f64a9f894ba719581d04c40d8dc13c2c32b9ba 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -1598,10 +1598,18 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
this.getEntities(filter, box, predicate, result, Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
- // Paper start - rewrite chunk system
|
||||
+ // Sakura start - add maxSearch to getEntities
|
||||
public <T extends Entity> void getEntities(final EntityTypeTest<Entity, T> entityTypeTest,
|
||||
final AABB boundingBox, final Predicate<? super T> predicate,
|
||||
final List<? super T> into, final int maxCount) {
|
||||
+ this.getEntities(entityTypeTest, boundingBox, predicate, into, maxCount, Integer.MAX_VALUE);
|
||||
+ }
|
||||
+
|
||||
+ // Paper start - rewrite chunk system
|
||||
+ public <T extends Entity> void getEntities(final EntityTypeTest<Entity, T> entityTypeTest,
|
||||
+ final AABB boundingBox, final Predicate<? super T> predicate,
|
||||
+ final List<? super T> into, final int maxCount, final int maxSearch) {
|
||||
+ // Sakura end - add maxSearch to getEntities
|
||||
this.getProfiler().incrementCounter("getEntities");
|
||||
|
||||
if (entityTypeTest instanceof net.minecraft.world.entity.EntityType<T> byType) {
|
||||
@@ -1616,7 +1624,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
|
||||
if (entityTypeTest == null) {
|
||||
if (maxCount != Integer.MAX_VALUE) {
|
||||
- ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities((Entity)null, boundingBox, (List)into, (Predicate)predicate, maxCount);
|
||||
+ ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities((Entity)null, boundingBox, (List)into, (Predicate)predicate, maxCount, maxSearch); // Sakura - add maxSearch to getEntities
|
||||
return;
|
||||
} else {
|
||||
((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities((Entity)null, boundingBox, (List)into, (Predicate)predicate);
|
||||
@@ -1,134 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
|
||||
Date: Wed, 15 Nov 2023 20:52:56 +0000
|
||||
Subject: [PATCH] Configure Entity Knockback
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index a7bbd4d1ddb7e80724cdd05a6d6b37161e711264..72e32af2d329a4f27f91932fec0d3a92fae414fb 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1562,7 +1562,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
d0 = (Math.random() - Math.random()) * 0.01D;
|
||||
}
|
||||
|
||||
- this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE : io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
+ this.knockback((float) this.level().sakuraConfig().players.knockback.baseKnockback, d0, d1, entity1, entity1 == null ? io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE : io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events // Sakura - configure entity knockback
|
||||
if (!flag) {
|
||||
this.indicateDamage(d0, d1);
|
||||
}
|
||||
@@ -1616,7 +1616,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
protected void blockedByShield(LivingEntity target) {
|
||||
- target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events
|
||||
+ target.knockback((float) this.level().sakuraConfig().players.knockback.shieldHitKnockback, target.getX() - this.getX(), target.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events // Sakura - configure entity knockback
|
||||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource source) {
|
||||
@@ -1934,14 +1934,26 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public void knockback(double d0, double d1, double d2, @Nullable Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause cause) { // Paper - knockback events
|
||||
- d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
|
||||
+ d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE) * this.level().sakuraConfig().players.knockback.knockbackResistanceModifier; // Sakura - configure entity knockback
|
||||
if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0
|
||||
//this.hasImpulse = true; // CraftBukkit - Move down
|
||||
Vec3 vec3d = this.getDeltaMovement();
|
||||
Vec3 vec3d1 = (new Vec3(d1, 0.0D, d2)).normalize().scale(d0);
|
||||
+ // Sakura start - configure entity knockback
|
||||
+ double velocityX = vec3d.x / 2.0D - vec3d1.x;
|
||||
+ double velocityY = vec3d.y / 2.0D + this.level().sakuraConfig().players.knockback.knockbackVertical.or(d0);
|
||||
+ double velocityZ = vec3d.z / 2.0D - vec3d1.z;
|
||||
+
|
||||
+ // this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y
|
||||
+ if (!this.level().sakuraConfig().players.knockback.verticalKnockbackRequireGround || this.onGround()) {
|
||||
+ velocityY = Math.min(this.level().sakuraConfig().players.knockback.knockbackVerticalLimit, velocityY);
|
||||
+ } else {
|
||||
+ velocityY = vec3d.y;
|
||||
+ }
|
||||
+ // Sakura end - configure entity knockback
|
||||
|
||||
// Paper start - knockback events
|
||||
- Vec3 finalVelocity = new Vec3(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
+ Vec3 finalVelocity = new Vec3(velocityX, velocityY, velocityZ); // Sakura - configure entity knockback
|
||||
Vec3 diff = finalVelocity.subtract(vec3d);
|
||||
io.papermc.paper.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, cause, d0, diff);
|
||||
// Paper end - knockback events
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index c34de2a7303746ae236b7e81d87e7af42242baa7..3e0958f7b71fd7693d8f10d9b52144c32a039a0b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -195,6 +195,7 @@ public abstract class Player extends LivingEntity {
|
||||
public boolean ignoreFallDamageFromCurrentImpulse;
|
||||
public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
||||
+ private long lastSprintKnockback = -1; // Sakura - configure entity knockback
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
@@ -1290,7 +1291,7 @@ public abstract class Player extends LivingEntity {
|
||||
int i = 0;
|
||||
|
||||
i += EnchantmentHelper.getKnockbackBonus(this);
|
||||
- if (this.isSprinting() && flag) {
|
||||
+ if (this.isSprinting() && (!level().sakuraConfig().players.knockback.sprinting.requireFullAttack || flag)) { // Sakura - configure entity knockback
|
||||
sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
|
||||
++i;
|
||||
flag1 = true;
|
||||
@@ -1340,10 +1341,26 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
if (flag5) {
|
||||
if (i > 0) {
|
||||
- if (target instanceof LivingEntity) {
|
||||
- ((LivingEntity) target).knockback((double) ((float) i * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
+ // Sakura start - configure extra sprinting knockback
|
||||
+ float extraKnockback = (float) i * 0.5F;
|
||||
+ long millis = System.currentTimeMillis();
|
||||
+ long sinceLastKnockback = millis - this.lastSprintKnockback;
|
||||
+ if (flag1) { // attackHasExtraKnockback
|
||||
+ double knockbackToApply = 0.0;
|
||||
+ if (sinceLastKnockback >= this.level().sakuraConfig().players.knockback.sprinting.knockbackDelay.value().orElse(0)) {
|
||||
+ knockbackToApply = this.level().sakuraConfig().players.knockback.sprinting.extraKnockback;
|
||||
+ this.lastSprintKnockback = millis;
|
||||
+ }
|
||||
+ // -0.5 is to negate the vanilla sprinting knockback
|
||||
+ extraKnockback += -0.5F + (float) knockbackToApply;
|
||||
+ }
|
||||
+ if (extraKnockback == 0.0) {
|
||||
+ // required
|
||||
+ } else if (target instanceof LivingEntity) {
|
||||
+ ((LivingEntity) target).knockback((double) (extraKnockback), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
} else {
|
||||
- target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * (float) i * 0.5F), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
+ target.push((double) (-Mth.sin(this.getYRot() * 0.017453292F) * extraKnockback), 0.1D, (double) (Mth.cos(this.getYRot() * 0.017453292F) * extraKnockback), this); // Paper - Add EntityKnockbackByEntityEvent and EntityPushedByEntityAttackEvent
|
||||
+ // Sakura end - configure extra sprinting knockback
|
||||
}
|
||||
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
|
||||
@@ -1365,7 +1382,7 @@ public abstract class Player extends LivingEntity {
|
||||
if (entityliving != this && entityliving != target && !this.isAlliedTo((Entity) entityliving) && (!(entityliving instanceof ArmorStand) || !((ArmorStand) entityliving).isMarker()) && this.distanceToSqr((Entity) entityliving) < 9.0D) {
|
||||
// CraftBukkit start - Only apply knockback if the damage hits
|
||||
if (entityliving.hurt(this.damageSources().playerAttack(this).sweep().critical(flag2), f4)) { // Paper - add critical damage API
|
||||
- entityliving.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
+ entityliving.knockback((float) this.level().sakuraConfig().players.knockback.sweepingEdgeKnockback, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events // Sakura - configure entity knockback
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index 7dd5e0b935d98d552c916f8412569ff4aa0e9b04..d9deb1b47b2430936d74e782cfc4a6ac32a16c91 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -298,6 +298,12 @@ public class FishingHook extends Projectile {
|
||||
this.setHookedEntity(entityHitResult.getEntity());
|
||||
}
|
||||
|
||||
+ // Sakura start - configure entity knockback
|
||||
+ if (this.level().sakuraConfig().players.knockback.fishingHooksApplyKnockback) {
|
||||
+ Entity entity = entityHitResult.getEntity();
|
||||
+ entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0f);
|
||||
+ }
|
||||
+ // Sakura end - configure entity knockback
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -5,19 +5,20 @@ Subject: [PATCH] Optimise LivingEntity#pushEntities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 21e61bb75ac7ce468bc757633ce678b21bcb9deb..a7bbd4d1ddb7e80724cdd05a6d6b37161e711264 100644
|
||||
index e980c8c356b30d25e2fc5a73b91ad2c6edd4fe05..cdfcd8e3e7e357151b8a1d5ed8b051d6cf550fc1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3554,7 +3554,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3574,7 +3574,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
return;
|
||||
}
|
||||
// Paper end - don't run getEntities if we're not going to use its result
|
||||
- List<Entity> list = this.level().getEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule)); // Paper - Climbing should not bypass cramming gamerule
|
||||
+ // Sakura start - use maxEntityCollision limit for entity retrival
|
||||
+ // Sakura start - use maxEntityCollision limit for entity retrieval
|
||||
+ int limit = Math.max(i, this.level().paperConfig().collisions.maxEntityCollisions);
|
||||
+ int search = limit * limit;
|
||||
+ List<Entity> list = this.level().getLimitedEntities((Entity) this, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule), limit, search); // Paper - Climbing should not bypass cramming gamerule
|
||||
+ // Sakura end - use maxEntityCollision limit for entity retrival
|
||||
+ List<Entity> list = new ArrayList<>();
|
||||
+ this.level().getEntities(null, this.getBoundingBox(), EntitySelector.pushable(this, this.level().paperConfig().collisions.fixClimbingBypassingCrammingRule), list, limit, search); // Paper - Climbing should not bypass cramming gamerule
|
||||
+ // Sakura end - use maxEntityCollision limit for entity retrieval
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
// Paper - don't run getEntities if we're not going to use its result; moved up
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Despawn falling blocks inside moving pistons
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index fe21305f66cc60e2036d2023f5f49e4a23e014dc..b1193e2d8b43e66cc5a5a03bcc0e77577d98b863 100644
|
||||
index ab68447f818c0dca777c25c04ac959e5f2b80132..3e861f3546fee1dc4129abf3b72cf57a593db91c 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -234,7 +234,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -239,7 +239,7 @@ public class FallingBlockEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
130
patches/server/0033-Configure-Entity-Knockback.patch
Normal file
130
patches/server/0033-Configure-Entity-Knockback.patch
Normal file
@@ -0,0 +1,130 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
|
||||
Date: Wed, 15 Nov 2023 20:52:56 +0000
|
||||
Subject: [PATCH] Configure Entity Knockback
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index cdfcd8e3e7e357151b8a1d5ed8b051d6cf550fc1..1ac872c7cc0330d11d995849513b12a7adbe3126 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1545,7 +1545,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
d1 = source.getSourcePosition().z() - this.getZ();
|
||||
}
|
||||
|
||||
- this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE : io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
+ this.knockback((float) this.level().sakuraConfig().players.knockback.baseKnockback, d0, d1, entity1, entity1 == null ? io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE : io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events // Sakura - configure entity knockback
|
||||
if (!flag) {
|
||||
this.indicateDamage(d0, d1);
|
||||
}
|
||||
@@ -1599,7 +1599,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
protected void blockedByShield(LivingEntity target) {
|
||||
- target.knockback(0.5D, target.getX() - this.getX(), target.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events
|
||||
+ target.knockback((float) this.level().sakuraConfig().players.knockback.shieldHitKnockback, target.getX() - this.getX(), target.getZ() - this.getZ(), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SHIELD_BLOCK); // CraftBukkit // Paper - fix attacker & knockback events // Sakura - configure entity knockback
|
||||
}
|
||||
|
||||
private boolean checkTotemDeathProtection(DamageSource source) {
|
||||
@@ -1918,7 +1918,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
public void knockback(double d0, double d1, double d2, @Nullable Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause cause) { // Paper - knockback events
|
||||
- d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE);
|
||||
+ d0 *= 1.0D - this.getAttributeValue(Attributes.KNOCKBACK_RESISTANCE) * this.level().sakuraConfig().players.knockback.knockbackResistanceModifier; // Sakura - configure entity knockback
|
||||
if (true || d0 > 0.0D) { // CraftBukkit - Call event even when force is 0
|
||||
//this.hasImpulse = true; // CraftBukkit - Move down
|
||||
|
||||
@@ -1929,9 +1929,21 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
|
||||
Vec3 vec3d1 = (new Vec3(d1, 0.0D, d2)).normalize().scale(d0);
|
||||
+ // Sakura start - configure entity knockback
|
||||
+ double velocityX = vec3d.x / 2.0D - vec3d1.x;
|
||||
+ double velocityY = vec3d.y / 2.0D + this.level().sakuraConfig().players.knockback.knockbackVertical.or(d0);
|
||||
+ double velocityZ = vec3d.z / 2.0D - vec3d1.z;
|
||||
+
|
||||
+ // this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y
|
||||
+ if (!this.level().sakuraConfig().players.knockback.verticalKnockbackRequireGround || this.onGround()) {
|
||||
+ velocityY = Math.min(this.level().sakuraConfig().players.knockback.knockbackVerticalLimit, velocityY);
|
||||
+ } else {
|
||||
+ velocityY = vec3d.y;
|
||||
+ }
|
||||
+ // Sakura end - configure entity knockback
|
||||
|
||||
// Paper start - knockback events
|
||||
- Vec3 finalVelocity = new Vec3(vec3d.x / 2.0D - vec3d1.x, this.onGround() ? Math.min(0.4D, vec3d.y / 2.0D + d0) : vec3d.y, vec3d.z / 2.0D - vec3d1.z);
|
||||
+ Vec3 finalVelocity = new Vec3(velocityX, velocityY, velocityZ); // Sakura - configure entity knockback
|
||||
Vec3 diff = finalVelocity.subtract(vec3d);
|
||||
io.papermc.paper.event.entity.EntityKnockbackEvent event = CraftEventFactory.callEntityKnockbackEvent((org.bukkit.craftbukkit.entity.CraftLivingEntity) this.getBukkitEntity(), attacker, cause, d0, diff);
|
||||
// Paper end - knockback events
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index b352a8d299a13026d8e2c8e3405eb7f40b289d38..852ceb5aa9dc92981f0d9d012cff04177f88e606 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -196,6 +196,7 @@ public abstract class Player extends LivingEntity {
|
||||
private int currentImpulseContextResetGraceTime;
|
||||
public boolean affectsSpawning = true; // Paper - Affects Spawning API
|
||||
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
|
||||
+ private long lastSprintKnockback = -1; // Sakura - configure entity knockback
|
||||
|
||||
// CraftBukkit start
|
||||
public boolean fauxSleeping;
|
||||
@@ -1303,7 +1304,7 @@ public abstract class Player extends LivingEntity {
|
||||
boolean flag = f2 > 0.9F;
|
||||
boolean flag1;
|
||||
|
||||
- if (this.isSprinting() && flag) {
|
||||
+ if (this.isSprinting() && (!this.level().sakuraConfig().players.knockback.sprinting.requireFullAttack || flag)) { // Sakura - configure entity knockback
|
||||
sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
|
||||
flag1 = true;
|
||||
} else {
|
||||
@@ -1346,7 +1347,21 @@ public abstract class Player extends LivingEntity {
|
||||
float f5 = this.getKnockback(target, damagesource) + (flag1 ? 1.0F : 0.0F);
|
||||
|
||||
if (f5 > 0.0F) {
|
||||
- if (target instanceof LivingEntity) {
|
||||
+ // Sakura start - configure extra sprinting knockback
|
||||
+ long millis = System.currentTimeMillis();
|
||||
+ long sinceLastKnockback = millis - this.lastSprintKnockback;
|
||||
+ if (flag1) { // attackHasExtraKnockback
|
||||
+ double knockbackToApply = 0.0;
|
||||
+ if (sinceLastKnockback >= this.level().sakuraConfig().players.knockback.sprinting.knockbackDelay.value().orElse(0)) {
|
||||
+ knockbackToApply = this.level().sakuraConfig().players.knockback.sprinting.extraKnockback;
|
||||
+ this.lastSprintKnockback = millis;
|
||||
+ }
|
||||
+ f5 = (f5 - 1.0f) + ((float) knockbackToApply * 2.0f);
|
||||
+ }
|
||||
+ if (f5 == 0.0f) {
|
||||
+ // required
|
||||
+ } else if (target instanceof LivingEntity) {
|
||||
+ // Sakura end - configure extra sprinting knockback
|
||||
LivingEntity entityliving1 = (LivingEntity) target;
|
||||
|
||||
entityliving1.knockback((double) (f5 * 0.5F), (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // Paper - knockback events
|
||||
@@ -1376,7 +1391,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
// CraftBukkit start - Only apply knockback if the damage hits
|
||||
if (entityliving2.hurt(this.damageSources().playerAttack(this).sweep().critical(flag2), f7)) { // Paper - add critical damage API
|
||||
- entityliving2.knockback(0.4000000059604645D, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // CraftBukkit // Paper - knockback events
|
||||
+ entityliving2.knockback((float) this.level().sakuraConfig().players.knockback.sweepingEdgeKnockback, (double) Mth.sin(this.getYRot() * 0.017453292F), (double) (-Mth.cos(this.getYRot() * 0.017453292F)), this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK); // Sakura - configure entity knockback // CraftBukkit // Paper - knockback events
|
||||
}
|
||||
// CraftBukkit end
|
||||
Level world = this.level();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index 1223c5d23d0ea6aed068bdf0f5725e2ad49fc82c..43a3ac5858ffb2007e6f63ec0f3bc5a9971dce14 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -299,6 +299,12 @@ public class FishingHook extends Projectile {
|
||||
this.setHookedEntity(entityHitResult.getEntity());
|
||||
}
|
||||
|
||||
+ // Sakura start - configure entity knockback
|
||||
+ if (this.level().sakuraConfig().players.knockback.fishingHooksApplyKnockback) {
|
||||
+ Entity entity = entityHitResult.getEntity();
|
||||
+ entity.hurt(this.damageSources().thrown(this, this.getOwner()), 0.0f);
|
||||
+ }
|
||||
+ // Sakura end - configure entity knockback
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,10 +74,10 @@ index 0000000000000000000000000000000000000000..c58e52f7cc012babf4235e405e5fb501
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 9257505431d00aec2225b052492b8eb88ed4d63d..a342a604ad58e3ecc8907e7ec6d6fbf58c31d246 100644
|
||||
index 2df0f8a92174be654acb27785ff1f4880dcf3362..6ca79a23d7be043166a421aab881c55ef1238a4c 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1805,6 +1805,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1754,6 +1754,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.minimalTNT.clear(); // Sakura - visibility api
|
||||
worldserver.mergeHistory.expire(currentTickLong); // Sakura - merge cannoning entities
|
||||
worldserver.densityCache.clear(currentTickLong); // Sakura - explosion density cache
|
||||
@@ -124,10 +124,10 @@ index a8008c7550488be34b51f4280f5569170b1ebd1d..2e5a46b9d27b930870c68dbde93d8731
|
||||
public String getDescriptionId() {
|
||||
return this.getOrCreateDescriptionId();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index d10d2581c6dfdaf7518bead4f2340c1b63b4bc44..f4b17c01ee6552df325ea02a2f6da22b14f6e78f 100644
|
||||
index a376d53dba483b1da96bb468877a958f187a8680..f87b7a27c1d735ccb836f13dcb17156cbaac0231 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -262,7 +262,7 @@ public class Explosion {
|
||||
@@ -263,7 +263,7 @@ public class Explosion {
|
||||
BlockState blockState = chunk.getBlockStateFinal(x, y, z);
|
||||
FluidState fluidState = blockState.getFluidState();
|
||||
|
||||
@@ -136,7 +136,7 @@ index d10d2581c6dfdaf7518bead4f2340c1b63b4bc44..f4b17c01ee6552df325ea02a2f6da22b
|
||||
|
||||
ret = new ExplosionBlockCache(
|
||||
key, pos, blockState, fluidState,
|
||||
@@ -276,6 +276,21 @@ public class Explosion {
|
||||
@@ -277,6 +277,21 @@ public class Explosion {
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -176,14 +176,14 @@ index d10d2581c6dfdaf7518bead4f2340c1b63b4bc44..f4b17c01ee6552df325ea02a2f6da22b
|
||||
Entity sourceEntity = this.source == null ? null : this.source;
|
||||
BlockPos sourceBlock = sourceEntity == null ? BlockPos.containing(this.x, this.y, this.z) : null;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index d041ad1e52c78c553da4d92745d2b07fc3eab522..1901081678b25fd50d9eb2b9a51c99672d239ea3 100644
|
||||
index 71f64a9f894ba719581d04c40d8dc13c2c32b9ba..566e65aa124feb2f02e6770729ff49c53f33e34a 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -220,6 +220,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
public final it.unimi.dsi.fastutil.longs.Long2IntMap minimalTNT = new it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap(); // Sakura - visibility api
|
||||
@@ -222,6 +222,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
private ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup entityLookup;
|
||||
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura - cannon entity merging
|
||||
public final me.samsuik.sakura.explosion.density.BlockDensityCache densityCache = new me.samsuik.sakura.explosion.density.BlockDensityCache(); // Sakura - explosion density cache
|
||||
+ public final me.samsuik.sakura.explosion.durable.DurableBlockManager durabilityManager = new me.samsuik.sakura.explosion.durable.DurableBlockManager(); // Sakura - explosion durable blocks
|
||||
|
||||
// Sakura start - add entity retrival methods with search limits
|
||||
public final void getLimitedEntities(Entity except, AABB box, Predicate<? super Entity> predicate, List<Entity> into, int limit, int search) {
|
||||
@Override
|
||||
public final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup moonrise$getEntityLookup() {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Destroy Waterlogged Blocks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 243ac586aad29e3a145eec3c9a85b24901450121..c2edd4021fe2bdf96f58f6d402b767f911801cf6 100644
|
||||
index f87b7a27c1d735ccb836f13dcb17156cbaac0231..210ab5feebd3f1554d8dc7191ab092937b218f5d 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -284,7 +284,11 @@ public class Explosion {
|
||||
@@ -285,7 +285,11 @@ public class Explosion {
|
||||
|
||||
if (material != null && material.resistance() >= 0.0f && (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
|
||||
return Optional.of(material.resistance());
|
||||
@@ -343,10 +343,10 @@ index 0000000000000000000000000000000000000000..4f5af6e241b0194ed982144fd9320315
|
||||
+
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 786a08850dcb31dc1d08b16391e40914bb4c6235..1a6466d655f981b19bbcaa3ff1724a8d99044289 100644
|
||||
index 6ca79a23d7be043166a421aab881c55ef1238a4c..1c875d1ba3ead33fc3f9f369fc89bcbeb82c6844 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -1806,6 +1806,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
@@ -1755,6 +1755,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
||||
worldserver.mergeHistory.expire(currentTickLong); // Sakura - merge cannoning entities
|
||||
worldserver.densityCache.clear(currentTickLong); // Sakura - explosion density cache
|
||||
worldserver.durabilityManager.expire(currentTickLong); // Sakura
|
||||
@@ -355,18 +355,18 @@ index 786a08850dcb31dc1d08b16391e40914bb4c6235..1a6466d655f981b19bbcaa3ff1724a8d
|
||||
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 1901081678b25fd50d9eb2b9a51c99672d239ea3..ef37c34036bc79505786ee38ab5472a45effa4a3 100644
|
||||
index 566e65aa124feb2f02e6770729ff49c53f33e34a..7a079b432092f70bac657520a0c71d0a0b4ccdb0 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -221,6 +221,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -223,6 +223,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura - cannon entity merging
|
||||
public final me.samsuik.sakura.explosion.density.BlockDensityCache densityCache = new me.samsuik.sakura.explosion.density.BlockDensityCache(); // Sakura - explosion density cache
|
||||
public final me.samsuik.sakura.explosion.durable.DurableBlockManager durabilityManager = new me.samsuik.sakura.explosion.durable.DurableBlockManager(); // Sakura - explosion durable blocks
|
||||
+ public final me.samsuik.sakura.redstone.RedstoneTracker redstoneTracker = new me.samsuik.sakura.redstone.RedstoneTracker(this); // Sakura - cache vanilla and eigen redstone
|
||||
|
||||
// Sakura start - add entity retrival methods with search limits
|
||||
public final void getLimitedEntities(Entity except, AABB box, Predicate<? super Entity> predicate, List<Entity> into, int limit, int search) {
|
||||
@@ -994,6 +995,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@Override
|
||||
public final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.EntityLookup moonrise$getEntityLookup() {
|
||||
@@ -1012,6 +1013,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
} else {
|
||||
BlockState iblockdata2 = this.getBlockState(pos);
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Falling Block Stacking Restrictions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index b1193e2d8b43e66cc5a5a03bcc0e77577d98b863..d22c1357006d2785ff2a0e9465a214cf5a262cb1 100644
|
||||
index 3e861f3546fee1dc4129abf3b72cf57a593db91c..abf41ee186fd7d8e0963112b886d833496c2fb1a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -252,7 +252,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -257,7 +257,7 @@ public class FallingBlockEntity extends Entity {
|
||||
boolean flag3 = FallingBlock.isFree(this.level().getBlockState(blockposition.below())) && (!flag || !flag1);
|
||||
boolean flag4 = this.blockState.canSurvive(this.level(), blockposition) && !flag3;
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
|
||||
Date: Sat, 18 Nov 2023 17:24:19 +0000
|
||||
Subject: [PATCH] Reduce living entity sensing
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
index 5a059e1ec232d82e8e891ae78fea962bec2f878e..43a5d969595e8ecb3da3cf2ac949f042a7015578 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/ai/sensing/NearestLivingEntitySensor.java
|
||||
@@ -15,8 +15,21 @@ public class NearestLivingEntitySensor<T extends LivingEntity> extends Sensor<T>
|
||||
@Override
|
||||
protected void doTick(ServerLevel world, T entity) {
|
||||
AABB aABB = entity.getBoundingBox().inflate((double)this.radiusXZ(), (double)this.radiusY(), (double)this.radiusXZ());
|
||||
- List<LivingEntity> list = world.getEntitiesOfClass(LivingEntity.class, aABB, e -> e != entity && e.isAlive());
|
||||
- list.sort(Comparator.comparingDouble(entity::distanceToSqr));
|
||||
+ // Sakura start - reduce nearest living entity sensing
|
||||
+ var distanceMap = new it.unimi.dsi.fastutil.objects.Reference2DoubleOpenHashMap<>();
|
||||
+ distanceMap.defaultReturnValue(Double.MAX_VALUE);
|
||||
+ List<LivingEntity> list = world.getLimitedEntitiesOfClass(LivingEntity.class, aABB, (e) -> {
|
||||
+ if (e == entity || !e.isAlive())
|
||||
+ return false;
|
||||
+ double stored = distanceMap.getDouble(e.getType());
|
||||
+ double distance = e.distanceToSqr(entity);
|
||||
+ if (stored < distance)
|
||||
+ return false;
|
||||
+ distanceMap.put(e.getType(), distance);
|
||||
+ return true;
|
||||
+ }, 12, Integer.MAX_VALUE);
|
||||
+ java.util.Collections.reverse(list);
|
||||
+ // Sakura end - reduce nearest living entity sensing
|
||||
Brain<?> brain = entity.getBrain();
|
||||
brain.setMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES, list);
|
||||
brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_LIVING_ENTITIES, new NearestVisibleLivingEntities(entity, list));
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Added list of ItemEntity's that ignore explosions
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
index 8fd3845c4965843be9c37498760d93f1ebdff541..4e3775f47b6124fd0e3ebc2074c5dc35a05e1249 100644
|
||||
index ea0d9335446b20073b9aafb9de453097355db79c..d3b3194751df29ac5bd12339dc64695d308780d3 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
|
||||
@@ -590,6 +590,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
@@ -591,6 +591,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
|
||||
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add option to disable entity ai
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index e89f9c3e887601d8461eb967ae0bf582b672f631..cf3889188d1e31d121f86b1f01459f3029e8802f 100644
|
||||
index 7b93c6a04cca2ac31d137f06ef83bb08559b10bf..8b432763d382f3134ecbab67850d8acdc0c9ff4f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -955,7 +955,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
|
||||
@@ -910,7 +910,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab
|
||||
protected final void serverAiStep() {
|
||||
++this.noActionTime;
|
||||
// Paper start - Allow nerfed mobs to jump and float
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Consistent Explosion Radius
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 9d9fe71897839d5ee7f3ec7467616021a8791a29..f7e01cb367b5b75f1f267d727b539066845d6e14 100644
|
||||
index 210ab5feebd3f1554d8dc7191ab092937b218f5d..b35a51c8e51103260f9d250e318af8a00c21533f 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -75,6 +75,7 @@ public class Explosion {
|
||||
@@ -76,6 +76,7 @@ public class Explosion {
|
||||
public boolean wasCanceled = false;
|
||||
public float yield;
|
||||
// CraftBukkit end
|
||||
@@ -16,7 +16,7 @@ index 9d9fe71897839d5ee7f3ec7467616021a8791a29..f7e01cb367b5b75f1f267d727b539066
|
||||
|
||||
public static DamageSource getDefaultDamageSource(Level world, @Nullable Entity source) {
|
||||
return world.damageSources().explosion(source, Explosion.getIndirectSourceEntityInternal(source));
|
||||
@@ -112,6 +113,7 @@ public class Explosion {
|
||||
@@ -113,6 +114,7 @@ public class Explosion {
|
||||
this.largeExplosionParticles = emitterParticle;
|
||||
this.explosionSound = soundEvent;
|
||||
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
|
||||
@@ -24,7 +24,7 @@ index 9d9fe71897839d5ee7f3ec7467616021a8791a29..f7e01cb367b5b75f1f267d727b539066
|
||||
}
|
||||
|
||||
// Sakura start - optimise paper explosions
|
||||
@@ -585,7 +587,7 @@ public class Explosion {
|
||||
@@ -586,7 +588,7 @@ public class Explosion {
|
||||
double d2 = CACHED_RAYS[ray + 2];
|
||||
ray += 3;
|
||||
// Paper end - optimise explosions
|
||||
@@ -5,15 +5,15 @@ Subject: [PATCH] Remove spigot max tnt per tick
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index bfe1b2debf94c54f923daf81ad51a7e9ca92d3d1..30443bc74abbe0a557b5d9d9bae0eb48ef1dd7d3 100644
|
||||
index 1bebee482d0a5ca1a56474660888be01d257b231..a5b7f3bf42e43a9b3673e8725c5f20f7a3e7dbe6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -113,7 +113,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -133,7 +133,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
- if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot
|
||||
+ // Sakura - remove max tnt per tick
|
||||
this.handlePortal();
|
||||
this.applyGravity();
|
||||
this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura - optimise simple entity movement
|
||||
// Paper start - Configurable TNT height nerf
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Option to configure entity water sensitivity
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 72e32af2d329a4f27f91932fec0d3a92fae414fb..2fb84d928884050c63cfa598d45dda39a7c2cec4 100644
|
||||
index 1ac872c7cc0330d11d995849513b12a7adbe3126..57929f4c2642d1a66f5158a59a5b905e977b2fa2 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -3503,7 +3503,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3523,7 +3523,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
}
|
||||
}
|
||||
// Paper end - Add EntityMoveEvent
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Configure cannon physics by version
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
index 299237a0c828e48425cc35a14d366020c78daefb..8014ebfb391825c31d9d1b39f5304a7e76b1ee44 100644
|
||||
index f941c4bbf94f80dc3db3153297713a41c6c8ca48..d8d98cd2290f4af61a45a1150f8230a2c6b54352 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
@@ -1457,7 +1457,15 @@ public final class CollisionUtil {
|
||||
@@ -68,7 +68,7 @@ index 299237a0c828e48425cc35a14d366020c78daefb..8014ebfb391825c31d9d1b39f5304a7e
|
||||
if (xSmaller && z != 0.0) {
|
||||
z = performAABBCollisionsZ(axisalignedbb, z, aabbs);
|
||||
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
|
||||
index d15eb10fa203236060b90c5fc1364564dec8753f..d67f9d241f6070a2c391df52146d48434e7e096a 100644
|
||||
index 55bf4424d8e995ea7384f88f43465f90ae3c6704..eaef186a6f8857e442e33087f323ea878f5799b1 100644
|
||||
--- a/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
|
||||
+++ b/src/main/java/me/samsuik/sakura/explosion/special/SpecialisedExplosion.java
|
||||
@@ -172,9 +172,15 @@ public abstract class SpecialisedExplosion<T extends Entity> extends Explosion {
|
||||
@@ -89,7 +89,7 @@ index d15eb10fa203236060b90c5fc1364564dec8753f..d67f9d241f6070a2c391df52146d4843
|
||||
if (distance != 0.0D) {
|
||||
x /= distance;
|
||||
diff --git a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
index 1690428df289ac55a5a6eaf406a7accc3e6143af..3fd2633601baed389ca1f503022ecc14109241d9 100644
|
||||
index 3888c76dc16b76ae214aeb7265e8b0e9d600b863..31700b381d495c1d1273ab45e914fdb788e712c8 100644
|
||||
--- a/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
+++ b/src/main/java/me/samsuik/sakura/explosion/special/TntExplosion.java
|
||||
@@ -37,6 +37,13 @@ public final class TntExplosion extends SpecialisedExplosion<PrimedTnt> {
|
||||
@@ -107,10 +107,10 @@ index 1690428df289ac55a5a6eaf406a7accc3e6143af..3fd2633601baed389ca1f503022ecc14
|
||||
protected void startExplosion() {
|
||||
for (int i = this.calculateExplosionPotential() - 1; i >= 0; --i) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e68a53fd7d 100644
|
||||
index 0946d71f8ef41f42db038c2efd527a319f55e069..2b94b7bf6cc132a54596ad71c8e2fa801e2eba77 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -381,7 +381,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -385,7 +385,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
private final double[] pistonDeltas;
|
||||
private long pistonDeltasGameTime;
|
||||
private EntityDimensions dimensions;
|
||||
@@ -119,7 +119,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
public boolean isInPowderSnow;
|
||||
public boolean wasInPowderSnow;
|
||||
public boolean wasOnFire;
|
||||
@@ -715,6 +715,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -709,6 +709,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
// Sakura end - cannon entity merging
|
||||
public boolean pushedByFluid = true; // Sakura - entity pushed by fluid api
|
||||
@@ -133,7 +133,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -1222,7 +1229,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1216,7 +1223,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
protected void checkSupportingBlock(boolean onGround, @Nullable Vec3 movement) {
|
||||
@@ -142,7 +142,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
AABB axisalignedbb = this.getBoundingBox();
|
||||
AABB axisalignedbb1 = new AABB(axisalignedbb.minX, axisalignedbb.minY - 1.0E-6D, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
|
||||
Optional<BlockPos> optional = this.level.findSupportingBlock(this, axisalignedbb1);
|
||||
@@ -1284,7 +1291,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1253,7 +1260,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (this.noPhysics) {
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
@@ -151,7 +151,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
movement = this.limitPistonMovement(movement);
|
||||
if (movement.equals(Vec3.ZERO)) {
|
||||
return;
|
||||
@@ -1302,10 +1309,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1271,10 +1278,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
Vec3 vec3d1 = this.collideScan(movement);
|
||||
double d0 = vec3d1.lengthSqr();
|
||||
|
||||
@@ -159,12 +159,12 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
+ if (d0 > 1.0E-7D || this.physics.before(1_14_0)) { // Sakura - physics version api
|
||||
// NOTE: if there are any blocks in the future that rely on fall distance make sure this is correct.
|
||||
// The only block I am aware of is powdered snow that has a special case for falling blocks.
|
||||
- if (this.fallDistance != 0.0F && d0 >= 1.0D && !isFallingBlock) {
|
||||
+ if (this.fallDistance != 0.0F && d0 >= 1.0D && !isFallingBlock && this.physics.afterOrEqual(1_18_2)) { // Sakura - physics version api
|
||||
- if (this.fallDistance != 0.0F && d0 >= 1.0D && !this.isFallingBlock) {
|
||||
+ if (this.fallDistance != 0.0F && d0 >= 1.0D && !this.isFallingBlock && this.physics.afterOrEqual(1_18_2)) { // Sakura - physics version api
|
||||
BlockHitResult movingobjectpositionblock = this.level().clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this));
|
||||
|
||||
if (movingobjectpositionblock.getType() != HitResult.Type.MISS) {
|
||||
@@ -1341,6 +1348,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1310,6 +1317,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (this.horizontalCollision) {
|
||||
Vec3 vec3d2 = this.getDeltaMovement();
|
||||
|
||||
@@ -177,7 +177,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
|
||||
}
|
||||
|
||||
@@ -1382,7 +1395,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1341,7 +1354,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
|
||||
} else {
|
||||
this.wasOnFire = this.isOnFire();
|
||||
@@ -186,7 +186,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper
|
||||
this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper
|
||||
movement = this.limitPistonMovement(movement);
|
||||
@@ -1409,8 +1422,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1368,8 +1381,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
Vec3 vec3d1 = this.collide(movement);
|
||||
double d0 = vec3d1.lengthSqr();
|
||||
|
||||
@@ -197,7 +197,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
BlockHitResult movingobjectpositionblock = this.level().clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this));
|
||||
|
||||
if (movingobjectpositionblock.getType() != HitResult.Type.MISS) {
|
||||
@@ -1446,6 +1459,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1405,6 +1418,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (this.horizontalCollision) {
|
||||
Vec3 vec3d2 = this.getDeltaMovement();
|
||||
|
||||
@@ -210,7 +210,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
|
||||
}
|
||||
|
||||
@@ -1760,7 +1779,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1712,7 +1731,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
} else {
|
||||
final AABB bb = currBoundingBox.expandTowards(movement.x, movement.y, movement.z);
|
||||
collectCollisions(bb, potentialCollisionsVoxel, potentialCollisionsBB);
|
||||
@@ -219,7 +219,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1769,7 +1788,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1721,7 +1740,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
double y = movement.y;
|
||||
double z = movement.z;
|
||||
|
||||
@@ -231,7 +231,7 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
|
||||
if (y != 0.0) {
|
||||
y = scanY(currBoundingBox, y, voxelList, bbList);
|
||||
@@ -1885,7 +1907,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -1845,7 +1867,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return movement;
|
||||
}
|
||||
|
||||
@@ -239,8 +239,8 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
+ final Vec3 limitedMoveVector = io.papermc.paper.util.CollisionUtil.performCollisions(movement, currBoundingBox, potentialCollisionsVoxel, potentialCollisionsBB, this.physics); // Sakura - physics version api
|
||||
|
||||
if (stepHeight > 0.0
|
||||
&& (onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0))
|
||||
@@ -2001,8 +2023,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
&& (onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0))
|
||||
@@ -2033,8 +2055,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
|
||||
protected void checkInsideBlocks() {
|
||||
AABB axisalignedbb = this.getBoundingBox();
|
||||
@@ -255,10 +255,10 @@ index 50ae421b40681366523932a2cd445592ec067897..df083dd2f9af19c768b23727852194e6
|
||||
if (this.level().hasChunksAt(blockposition, blockposition1)) {
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 779a6686d491a8c4c95d5b8087fc55ee2f184f38..c01ed76846ad9ab893b0a7cdeadc077ccd829f1a 100644
|
||||
index abf41ee186fd7d8e0963112b886d833496c2fb1a..c1de583f8336e18a591ebf4a0f8bf92ac8c5735f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -90,6 +90,8 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -94,6 +94,8 @@ public class FallingBlockEntity extends Entity {
|
||||
this.yo = y;
|
||||
this.zo = z;
|
||||
this.setStartPos(this.blockPosition());
|
||||
@@ -267,7 +267,7 @@ index 779a6686d491a8c4c95d5b8087fc55ee2f184f38..c01ed76846ad9ab893b0a7cdeadc077c
|
||||
}
|
||||
|
||||
public static FallingBlockEntity fall(Level world, BlockPos pos, BlockState state) {
|
||||
@@ -102,7 +104,11 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -106,7 +108,11 @@ public class FallingBlockEntity extends Entity {
|
||||
FallingBlockEntity entityfallingblock = new FallingBlockEntity(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, iblockdata.hasProperty(BlockStateProperties.WATERLOGGED) ? (BlockState) iblockdata.setValue(BlockStateProperties.WATERLOGGED, false) : iblockdata);
|
||||
if (!CraftEventFactory.callEntityChangeBlockEvent(entityfallingblock, blockposition, iblockdata.getFluidState().createLegacyBlock())) return entityfallingblock; // CraftBukkit
|
||||
|
||||
@@ -280,7 +280,7 @@ index 779a6686d491a8c4c95d5b8087fc55ee2f184f38..c01ed76846ad9ab893b0a7cdeadc077c
|
||||
world.addFreshEntity(entityfallingblock, spawnReason); // CraftBukkit
|
||||
return entityfallingblock;
|
||||
}
|
||||
@@ -190,13 +196,50 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -194,13 +200,50 @@ public class FallingBlockEntity extends Entity {
|
||||
// Sakura start
|
||||
@Override
|
||||
public final double getEyeY() {
|
||||
@@ -333,7 +333,7 @@ index 779a6686d491a8c4c95d5b8087fc55ee2f184f38..c01ed76846ad9ab893b0a7cdeadc077c
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -206,6 +249,11 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -210,6 +253,11 @@ public class FallingBlockEntity extends Entity {
|
||||
} else {
|
||||
Block block = this.blockState.getBlock();
|
||||
|
||||
@@ -345,15 +345,15 @@ index 779a6686d491a8c4c95d5b8087fc55ee2f184f38..c01ed76846ad9ab893b0a7cdeadc077c
|
||||
++this.time;
|
||||
this.applyGravity();
|
||||
this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura - optimise simple entity movement
|
||||
@@ -219,8 +267,15 @@ public class FallingBlockEntity extends Entity {
|
||||
return;
|
||||
@@ -224,8 +272,15 @@ public class FallingBlockEntity extends Entity {
|
||||
}
|
||||
// Paper end - Configurable falling blocks height nerf
|
||||
this.handlePortal();
|
||||
+ // Sakura start - physics version api
|
||||
+ if (this.physics.before(1_12_0)) {
|
||||
+ this.scaleDeltaMovement(0.98F);
|
||||
+ }
|
||||
if (!this.level().isClientSide) {
|
||||
if (!this.level().isClientSide && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) {
|
||||
- BlockPos blockposition = this.blockPosition();
|
||||
+ // Patching the floating point issue on modern versions can break some cannons that rely on it.
|
||||
+ // However, it makes sense for legacy versions pre-1.17 before the world height change.
|
||||
@@ -362,7 +362,7 @@ index 779a6686d491a8c4c95d5b8087fc55ee2f184f38..c01ed76846ad9ab893b0a7cdeadc077c
|
||||
boolean flag = this.blockState.getBlock() instanceof ConcretePowderBlock;
|
||||
boolean flag1 = flag && this.level().getFluidState(blockposition).is(FluidTags.WATER);
|
||||
double d0 = this.getDeltaMovement().lengthSqr();
|
||||
@@ -245,8 +300,11 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -250,8 +305,11 @@ public class FallingBlockEntity extends Entity {
|
||||
} else {
|
||||
BlockState iblockdata = this.level().getBlockState(blockposition);
|
||||
|
||||
@@ -376,7 +376,7 @@ index 779a6686d491a8c4c95d5b8087fc55ee2f184f38..c01ed76846ad9ab893b0a7cdeadc077c
|
||||
if (!this.cancelDrop) {
|
||||
boolean flag2 = iblockdata.canBeReplaced((BlockPlaceContext) (new DirectionalPlaceContext(this.level(), blockposition, Direction.DOWN, ItemStack.EMPTY, Direction.UP)));
|
||||
boolean flag3 = FallingBlock.isFree(this.level().getBlockState(blockposition.below())) && (!flag || !flag1);
|
||||
@@ -313,7 +371,12 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -318,7 +376,12 @@ public class FallingBlockEntity extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -391,10 +391,10 @@ index 779a6686d491a8c4c95d5b8087fc55ee2f184f38..c01ed76846ad9ab893b0a7cdeadc077c
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
index df2a37e57012333a618937e61cb5a99c3ef4a0f9..62d40333c42f673479db5e6312343161aacf7078 100644
|
||||
index a5b7f3bf42e43a9b3673e8725c5f20f7a3e7dbe6..cdba6fd4c79919b9f1dcb41b8df1dca8563a6174 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
|
||||
@@ -58,6 +58,13 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -78,6 +78,13 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
case Y -> multiplyDeltaMovement(0, 1, 0);
|
||||
}
|
||||
// Sakura end
|
||||
@@ -408,7 +408,7 @@ index df2a37e57012333a618937e61cb5a99c3ef4a0f9..62d40333c42f673479db5e6312343161
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -105,10 +112,26 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -125,10 +132,26 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
}
|
||||
}
|
||||
// Sakura end
|
||||
@@ -436,7 +436,7 @@ index df2a37e57012333a618937e61cb5a99c3ef4a0f9..62d40333c42f673479db5e6312343161
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,15 +145,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -143,15 +166,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
return;
|
||||
}
|
||||
// Paper end - Configurable TNT height nerf
|
||||
@@ -459,19 +459,19 @@ index df2a37e57012333a618937e61cb5a99c3ef4a0f9..62d40333c42f673479db5e6312343161
|
||||
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
|
||||
// this.discard();
|
||||
this.respawnMerged(); // Sakura
|
||||
@@ -183,7 +210,10 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -204,7 +231,10 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent((org.bukkit.entity.Explosive)this.getBukkitEntity());
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
- this.level().explode(this, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.TNT);
|
||||
- this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? PrimedTnt.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), this.getY(0.0625D), this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.TNT);
|
||||
+ // Sakura start - physics version api
|
||||
+ double pos = this.physics.before(1_10_0) ? this.getY() + (double) 0.49f : this.getY(0.0625D);
|
||||
+ this.level().explode(this, this.getX(), pos, this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.TNT);
|
||||
+ this.level().explode(this, Explosion.getDefaultDamageSource(this.level(), this), this.usedPortal ? PrimedTnt.USED_PORTAL_DAMAGE_CALCULATOR : null, this.getX(), pos, this.getZ(), event.getRadius(), event.getFire(), Level.ExplosionInteraction.TNT);
|
||||
+ // Sakura end
|
||||
}
|
||||
// CraftBukkit end
|
||||
}
|
||||
@@ -237,7 +267,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
@@ -274,7 +304,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|
||||
// Paper start - Option to prevent TNT from moving in water
|
||||
@Override
|
||||
public boolean isPushedByFluid() {
|
||||
@@ -481,10 +481,10 @@ index df2a37e57012333a618937e61cb5a99c3ef4a0f9..62d40333c42f673479db5e6312343161
|
||||
// Paper end - Option to prevent TNT from moving in water
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494dff866166 100644
|
||||
index b35a51c8e51103260f9d250e318af8a00c21533f..77fcdc8aa11df094e4ac2185bf16d0b1a8b4aacb 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -76,6 +76,7 @@ public class Explosion {
|
||||
@@ -77,6 +77,7 @@ public class Explosion {
|
||||
public float yield;
|
||||
// CraftBukkit end
|
||||
private final boolean consistentRadius; // Sakura - consistent explosion radius
|
||||
@@ -492,7 +492,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
|
||||
public static DamageSource getDefaultDamageSource(Level world, @Nullable Entity source) {
|
||||
return world.damageSources().explosion(source, Explosion.getIndirectSourceEntityInternal(source));
|
||||
@@ -114,6 +115,7 @@ public class Explosion {
|
||||
@@ -115,6 +116,7 @@ public class Explosion {
|
||||
this.explosionSound = soundEvent;
|
||||
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit
|
||||
this.consistentRadius = world.localConfig().config(BlockPos.containing(x, y, z)).consistentRadius; // Sakura - consistent explosion radius
|
||||
@@ -500,7 +500,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
}
|
||||
|
||||
// Sakura start - optimise paper explosions
|
||||
@@ -506,8 +508,12 @@ public class Explosion {
|
||||
@@ -507,8 +509,12 @@ public class Explosion {
|
||||
final float density = entity.level().densityCache.getKnownDensity(vec3d1);
|
||||
if (density != me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
|
||||
hitResult = density != 0.0f ? net.minecraft.world.phys.HitResult.Type.MISS : net.minecraft.world.phys.HitResult.Type.BLOCK;
|
||||
@@ -514,7 +514,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
}
|
||||
if (hitResult == HitResult.Type.MISS) {
|
||||
// Sakura end - replace density cache
|
||||
@@ -612,6 +618,14 @@ public class Explosion {
|
||||
@@ -613,6 +619,14 @@ public class Explosion {
|
||||
}
|
||||
|
||||
if (cachedBlock.outOfWorld) {
|
||||
@@ -546,7 +546,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
|
||||
if (d11 != 0.0D) {
|
||||
d8 /= d11;
|
||||
@@ -1046,7 +1066,7 @@ public class Explosion {
|
||||
@@ -1050,7 +1070,7 @@ public class Explosion {
|
||||
// Sakura start - replace density cache
|
||||
float blockDensity = this.level.densityCache.getDensity(vec3d, entity);
|
||||
if (blockDensity == me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
|
||||
@@ -555,7 +555,7 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
this.level.densityCache.putDensity(vec3d, entity, blockDensity);
|
||||
// Sakura end - replace density cache
|
||||
}
|
||||
@@ -1054,6 +1074,17 @@ public class Explosion {
|
||||
@@ -1058,6 +1078,17 @@ public class Explosion {
|
||||
return blockDensity;
|
||||
}
|
||||
|
||||
@@ -574,13 +574,13 @@ index b75f3527bad174cb309ffb34f6bf73540007cf53..73ccabd524ad24962ba790bb93e8494d
|
||||
private final Level world;
|
||||
private final double posX, posY, posZ;
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index ef37c34036bc79505786ee38ab5472a45effa4a3..6f7aa220d13a1135dde24012544bf3b978af7e50 100644
|
||||
index 7a079b432092f70bac657520a0c71d0a0b4ccdb0..8a8ea38bb3e88e27fcd7e9f9f4c604956120b1d3 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -255,6 +255,205 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
return this.getLimitedEntities(except, box, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS, limit, search);
|
||||
@@ -195,6 +195,205 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
public CraftWorld getWorld() {
|
||||
return this.world;
|
||||
}
|
||||
// Sakura end - add entity retrival methods with search limits
|
||||
+ // Sakura start - physics version api
|
||||
+ public net.minecraft.world.phys.BlockHitResult.Type rayTrace(net.minecraft.world.phys.Vec3 vec3d, net.minecraft.world.phys.Vec3 vec3d1) {
|
||||
+ // May deviate from vanilla here; I remember noticing a bug and there's no fix commit.
|
||||
@@ -781,8 +781,8 @@ index ef37c34036bc79505786ee38ab5472a45effa4a3..6f7aa220d13a1135dde24012544bf3b9
|
||||
+ }
|
||||
+ // Sakura end - physics version api
|
||||
|
||||
protected Level(WritableLevelData worlddatamutable, ResourceKey<Level> resourcekey, RegistryAccess iregistrycustom, Holder<DimensionType> holder, Supplier<ProfilerFiller> supplier, boolean flag, boolean flag1, long i, int j, org.bukkit.generator.ChunkGenerator gen, org.bukkit.generator.BiomeProvider biomeProvider, org.bukkit.World.Environment env, java.util.function.Function<org.spigotmc.SpigotWorldConfig, io.papermc.paper.configuration.WorldConfiguration> paperWorldConfigCreator, Supplier<me.samsuik.sakura.configuration.WorldConfiguration> sakuraWorldConfigCreator, java.util.concurrent.Executor executor) { // Sakura - sakura configuration files // Paper - create paper world config; Async-Anti-Xray: Pass executor
|
||||
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
|
||||
public CraftServer getCraftServer() {
|
||||
return (CraftServer) Bukkit.getServer();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FallingBlock.java b/src/main/java/net/minecraft/world/level/block/FallingBlock.java
|
||||
index 1ea1232a5ba3e48eef3a139d6487c9a190155ebd..71364fe94cfeefa07fac3ee6359f7abd9bb58106 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FallingBlock.java
|
||||
@@ -804,7 +804,7 @@ index 1ea1232a5ba3e48eef3a139d6487c9a190155ebd..71364fe94cfeefa07fac3ee6359f7abd
|
||||
protected void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
if (isFree(world.getBlockState(pos.below())) && pos.getY() >= world.getMinBuildHeight()) {
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java
|
||||
index 79df73d352e7c72efb4b0b3ae567b60d19e2150e..7c434d7c55bec4ba1d6013109ed8fd769e8b12f0 100644
|
||||
index 26ed17e433cbafbbf788231f27f296f08048adfe..1e28d5175bbb4dc2d4c1c3080825e797b574fc06 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/FenceGateBlock.java
|
||||
@@ -180,8 +180,13 @@ public class FenceGateBlock extends HorizontalDirectionalBlock {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Allow water in the nether
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
index 49557d6f22c5725c663a231deab019d4f6fe95fa..22efc53edf421e6db27a0dcee0961399eaaaeb3e 100644
|
||||
index 321188173918d0d60858a258400dfd682ccdb21c..229d71f093f672f323cc2feadf2cd174a62805f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
|
||||
@@ -194,7 +194,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
@@ -196,7 +196,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
|
||||
// CraftBukkit end
|
||||
if (!flag2) {
|
||||
return movingobjectpositionblock != null && this.emptyContents(entityhuman, world, movingobjectpositionblock.getBlockPos().relative(movingobjectpositionblock.getDirection()), (BlockHitResult) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit
|
||||
@@ -18,13 +18,13 @@ index 49557d6f22c5725c663a231deab019d4f6fe95fa..22efc53edf421e6db27a0dcee0961399
|
||||
int j = blockposition.getY();
|
||||
int k = blockposition.getZ();
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/IceBlock.java b/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
||||
index 013302623d3ca3ff88f242d740af935dcf4844a6..f043ce5cfbffeeb9789e2f9592397410845c2ba0 100644
|
||||
index ac775afb265430ac202cfa3900a036d11a308b1e..d5b82bc2932fdb10304c6120dc692769c8288989 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java
|
||||
@@ -41,7 +41,7 @@ public class IceBlock extends HalfTransparentBlock {
|
||||
public void afterDestroy(Level world, BlockPos pos, ItemStack tool) {
|
||||
// Paper end - Improve Block#breakNaturally API
|
||||
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) == 0) {
|
||||
if (!EnchantmentHelper.hasTag(tool, EnchantmentTags.PREVENTS_ICE_MELTING)) {
|
||||
- if (world.dimensionType().ultraWarm()) {
|
||||
+ if (!world.sakuraConfig().environment.allowWaterInTheNether && world.dimensionType().ultraWarm()) { // Sakura
|
||||
world.removeBlock(pos, false);
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configure concrete solidifying in water
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index b0a6d829a9790744a030cd4b230b71a752e546d0..28ba55a756af15683a48c6badb90f0624bf68911 100644
|
||||
index c1de583f8336e18a591ebf4a0f8bf92ac8c5735f..0cf2068d7c817b5ff357f99e4e2baa227120da7f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -276,7 +276,7 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -281,7 +281,7 @@ public class FallingBlockEntity extends Entity {
|
||||
// However, it makes sense for legacy versions pre-1.17 before the world height change.
|
||||
BlockPos blockposition = this.physics.before(1_17_0) ? this.patchedBlockPosition() : this.blockPosition();
|
||||
// Sakura end - physics version api
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Allow explosions to destroy lava
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index c5db31bd92a441eccd0f4c5ea1b8c7f17a00de65..fd53dff917b65b94eceb5796fc80b1a490454cc2 100644
|
||||
index 77fcdc8aa11df094e4ac2185bf16d0b1a8b4aacb..a4997b0de4300d0d4c86f8068e81ec22ecef28f6 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -289,7 +289,7 @@ public class Explosion {
|
||||
@@ -290,7 +290,7 @@ public class Explosion {
|
||||
if (material != null && material.resistance() >= 0.0f && (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt)) {
|
||||
return Optional.of(material.resistance());
|
||||
// Sakura start - destroy water logged blocks
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Treat all collidable blocks as full while moving fast
|
||||
|
||||
|
||||
diff --git a/src/main/java/io/papermc/paper/util/CollisionUtil.java b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
index 8014ebfb391825c31d9d1b39f5304a7e76b1ee44..d58d1fb1148db13c5d24422a1553e0b83677ab3d 100644
|
||||
index d8d98cd2290f4af61a45a1150f8230a2c6b54352..e99375ef42c54341b91a4eefe4299e7babf65ad2 100644
|
||||
--- a/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
+++ b/src/main/java/io/papermc/paper/util/CollisionUtil.java
|
||||
@@ -1592,6 +1592,7 @@ public final class CollisionUtil {
|
||||
@@ -59,10 +59,10 @@ index 8014ebfb391825c31d9d1b39f5304a7e76b1ee44..d58d1fb1148db13c5d24422a1553e0b8
|
||||
AABB singleAABB = blockCollision.getSingleAABBRepresentation();
|
||||
if (singleAABB != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 8c508df03a80d7f8fbb1bc50067f84090457511f..b4977a8b97f5417883cf3ffab5f89d98a6a6079b 100644
|
||||
index 2b94b7bf6cc132a54596ad71c8e2fa801e2eba77..fe1ce43158b84639abae6f7cee3a7ecdfb3d383a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -582,6 +582,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -576,6 +576,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
flags |= io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_LOAD_CHUNKS | io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_ADD_TICKET;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add redstone implementation API
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
index 719bac24f454f19460f7abd253fcc82a15648f8a..337d2c020acf0565401d21bce3ba701c0da0ad99 100644
|
||||
index a6f0ded367341e6b9f9c7b1c4254dd696ead2f8d..e99dcd24d4af8450ceb436b929c9a9ecf75249bc 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
|
||||
@@ -268,7 +268,7 @@ public class RedStoneWireBlock extends Block {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Reduce entity tracker player updates
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
index 34fdb52904a26bc7c4c95eee91882a3924ab037c..e372993dffc7012c6dfadacb99b2a7fc43b2aebd 100644
|
||||
index c46e07638db51bd549e39f0fcbe122d48ead9c31..d779e010ba7c0e99aa3b0ce8462b7e3fa7cced8c 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
|
||||
@@ -1161,6 +1161,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1027,6 +1027,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
try {
|
||||
for (TrackedEntity tracker : this.entityMap.values()) {
|
||||
// update tracker entry
|
||||
@@ -16,7 +16,7 @@ index 34fdb52904a26bc7c4c95eee91882a3924ab037c..e372993dffc7012c6dfadacb99b2a7fc
|
||||
tracker.updatePlayers(tracker.entity.getPlayersInTrackRange());
|
||||
}
|
||||
} finally {
|
||||
@@ -1325,14 +1326,34 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
@@ -1199,14 +1200,34 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
|
||||
private final int range;
|
||||
SectionPos lastSectionPos;
|
||||
public final Set<ServerPlayerConnection> seenBy = new it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet<>(); // Paper - Perf: optimise map impl
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Allow disabling random dispenser item selection
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
index ab63a233f7db352e325fa4498dd35b125fa8fcea..11cb8b32b3891878f4217d27b7051a4f787f5ebf 100644
|
||||
index 431fb6a658c6aac43b6f9dbd1f578b83f261a4e3..92bcba5fc21e39a54aa44d0b17c716acce6cc5bd 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/entity/DispenserBlockEntity.java
|
||||
@@ -74,8 +74,15 @@ public class DispenserBlockEntity extends RandomizableContainerBlockEntity {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add instant mob death animation
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index 2fb84d928884050c63cfa598d45dda39a7c2cec4..c0a0a8808003d7e56c4de4f4ad1c494b15cc41a2 100644
|
||||
index 57929f4c2642d1a66f5158a59a5b905e977b2fa2..5a7f7de0bcdd3d6ed946f0d3e3100e21ff1cbea9 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -1796,6 +1796,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -1778,6 +1778,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
// Paper start
|
||||
if (this.dead) { // Paper
|
||||
@@ -19,5 +19,5 @@ index 2fb84d928884050c63cfa598d45dda39a7c2cec4..c0a0a8808003d7e56c4de4f4ad1c494b
|
||||
+ }
|
||||
+ // Sakura end
|
||||
this.level().broadcastEntityEvent(this, (byte) 3);
|
||||
|
||||
this.setPose(Pose.DYING);
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable explosions hurting players
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index e039212df79a22a46a87b518ced8b01b067e0153..3954be72bfd1ac3242dc5e3f07b6f78de9677b16 100644
|
||||
index 852ceb5aa9dc92981f0d9d012cff04177f88e606..8bed7279377884498fc1c4ed7c44b193bb89c1e7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -951,7 +951,7 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -966,7 +966,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
@Override
|
||||
public boolean isInvulnerableTo(DamageSource damageSource) {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Iron golems take fall damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
index 932fae98c551052cadba4c6fc6e575fc30a25d58..0f0e9a4c8264fcf3786e7c4707f1a24a368baccb 100644
|
||||
index 1807da10d07d1f6e4ddbc0fa1b8da34a688d67c3..0eca342bb4ca5740f69ffc9a57a37308d77375ac 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/animal/IronGolem.java
|
||||
@@ -235,6 +235,20 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
@@ -243,6 +243,20 @@ public class IronGolem extends AbstractGolem implements NeutralMob {
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Add explosions dropping items config
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 4137fe261ae4934e80db2a8f1c0d6fb880839d8f..af71ce8f190e69ce1de758e6a551dbef817491be 100644
|
||||
index a4997b0de4300d0d4c86f8068e81ec22ecef28f6..94df0527699462e29fb76f68194386c50f1f7e04 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -939,6 +939,11 @@ public class Explosion {
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise check inside blocks and fluids
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index b4977a8b97f5417883cf3ffab5f89d98a6a6079b..894604b23d7f3749cbaa767705f63b21beea4fde 100644
|
||||
index fe1ce43158b84639abae6f7cee3a7ecdfb3d383a..92cf9e492d3cd904691a325e0af9b205487e5ab7 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -2037,18 +2037,37 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -2069,18 +2069,37 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
BlockPos blockposition1 = BlockPos.containing(axisalignedbb.maxX - offset, axisalignedbb.maxY - offset, axisalignedbb.maxZ - offset);
|
||||
// Sakura end
|
||||
|
||||
@@ -50,7 +50,7 @@ index b4977a8b97f5417883cf3ffab5f89d98a6a6079b..894604b23d7f3749cbaa767705f63b21
|
||||
|
||||
try {
|
||||
iblockdata.entityInside(this.level(), blockposition_mutableblockposition, this);
|
||||
@@ -4857,7 +4876,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4871,7 +4890,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
}
|
||||
|
||||
public boolean updateFluidHeightAndDoFluidPushing(TagKey<Fluid> tag, double speed) {
|
||||
@@ -59,7 +59,7 @@ index b4977a8b97f5417883cf3ffab5f89d98a6a6079b..894604b23d7f3749cbaa767705f63b21
|
||||
return false;
|
||||
} else {
|
||||
AABB axisalignedbb = this.getBoundingBox().deflate(0.001D);
|
||||
@@ -4874,11 +4893,30 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -4888,11 +4907,30 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
int k1 = 0;
|
||||
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
|
||||
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix paper findSupportingBlock not updating last chunk
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
|
||||
index 6f7aa220d13a1135dde24012544bf3b978af7e50..5eda4a84b51bb0fd9ca3ba4ca1666792b6e23a05 100644
|
||||
index 8a8ea38bb3e88e27fcd7e9f9f4c604956120b1d3..60c84c04651c390df7efb9a8fa840a9d1651cbf8 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Level.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Level.java
|
||||
@@ -881,6 +881,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
|
||||
@@ -901,6 +901,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl
|
||||
|
||||
if (chunkDiff != 0) {
|
||||
lastChunk = chunkProvider.getChunkAtIfLoadedImmediately(newChunkX, newChunkZ);
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Calculate biome noise once per chunk section
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
index 796bbef3544e06b8e7aac7e8ac5f740a2613f4bd..27ba0a6d3439b9b4dfae3b9c49975879c4295443 100644
|
||||
index c7b4c4463b26445964ac1fa51e66e35798ea4c41..10ce2dd78d01524cb43774f13cae6f9a4560ace4 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java
|
||||
@@ -227,12 +227,18 @@ public class LevelChunkSection {
|
||||
@@ -228,12 +228,18 @@ public class LevelChunkSection {
|
||||
|
||||
public void fillBiomesFromNoise(BiomeResolver biomeSupplier, Climate.Sampler sampler, int x, int y, int z) {
|
||||
PalettedContainer<Holder<Biome>> datapaletteblock = this.biomes.recreate();
|
||||
@@ -6,10 +6,10 @@ Subject: [PATCH] Fix doEntityDrops gamerule preventing falling blocks from
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
index 28ba55a756af15683a48c6badb90f0624bf68911..adada6c0237e99a226cb24763902dc7bdbccf493 100644
|
||||
index 0cf2068d7c817b5ff357f99e4e2baa227120da7f..71dcdecbfc2189d3d1229001ad686cd8b41bf89e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
|
||||
@@ -351,10 +351,14 @@ public class FallingBlockEntity extends Entity {
|
||||
@@ -356,10 +356,14 @@ public class FallingBlockEntity extends Entity {
|
||||
tileentity.setChanged();
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add entity travel distance limits
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
index 00259cc930a0b1db38c3abbb5fcf7430d5f50079..8eafe75e69f5b448feea8354edacdb9f02981118 100644
|
||||
index 82ff83fd00b976d41d1d5b30ad34ede9af1a7e5b..f00afd6dca2d8a0d5d8061a2e4e00a344761bff6 100644
|
||||
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
|
||||
@@ -1423,6 +1423,11 @@ public class ServerLevel extends Level implements WorldGenLevel {
|
||||
@@ -1197,6 +1197,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf.
|
||||
if (isActive) { // Paper - EAR 2
|
||||
TimingHistory.activatedEntityTicks++;
|
||||
entity.tick();
|
||||
@@ -21,10 +21,10 @@ index 00259cc930a0b1db38c3abbb5fcf7430d5f50079..8eafe75e69f5b448feea8354edacdb9f
|
||||
} else { entity.inactiveTick(); } // Paper - EAR 2
|
||||
this.getProfiler().pop();
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
index 894604b23d7f3749cbaa767705f63b21beea4fde..24f86d6adbaf295a42a7740ac17b59de95a22431 100644
|
||||
index 92cf9e492d3cd904691a325e0af9b205487e5ab7..5decb8c3791a8b72d1d2df5092cfdad0560fd82b 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -730,6 +730,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -724,6 +724,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
return this.physics;
|
||||
}
|
||||
// Sakura end - physics version api
|
||||
@@ -32,19 +32,19 @@ index 894604b23d7f3749cbaa767705f63b21beea4fde..24f86d6adbaf295a42a7740ac17b59de
|
||||
+ private final double travelDistanceLimit;
|
||||
+
|
||||
+ public final boolean isPastTravelDistanceLimit() {
|
||||
+ if (origin == null) {
|
||||
+ if (this.origin == null) {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ double x = Math.pow(origin.getX() - position.x(), 2);
|
||||
+ double z = Math.pow(origin.getZ() - position.z(), 2);
|
||||
+ return Math.max(x, z) >= travelDistanceLimit;
|
||||
+ double x = Math.pow(this.origin.getX() - this.position.x(), 2);
|
||||
+ double z = Math.pow(this.origin.getZ() - this.position.z(), 2);
|
||||
+ return Math.max(x, z) >= this.travelDistanceLimit;
|
||||
+ }
|
||||
+ // Sakura end - entity travel distance limits
|
||||
|
||||
public Entity(EntityType<?> type, Level world) {
|
||||
this.id = Entity.ENTITY_COUNTER.incrementAndGet();
|
||||
@@ -780,6 +793,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
@@ -774,6 +787,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
this.setPos(0.0D, 0.0D, 0.0D);
|
||||
this.eyeHeight = this.dimensions.eyeHeight();
|
||||
this.mergeLevel = level.sakuraConfig().cannons.mergeLevel; // Sakura
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Configure potion speed and breaking inside entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
index 74c596264d4da551437bd2a23e1c70022cfc73fc..fc0102cbf4b759001f5b76e4c60b403be9b20185 100644
|
||||
index 5f7d152f41eb85f17bcded4bc8099b998e5a338b..81e2161c90001ea941611f1691160df089c1cf97 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/Projectile.java
|
||||
@@ -150,7 +150,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
@@ -156,7 +156,7 @@ public abstract class Projectile extends Entity implements TraceableEntity {
|
||||
super.tick();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ index 74c596264d4da551437bd2a23e1c70022cfc73fc..fc0102cbf4b759001f5b76e4c60b403b
|
||||
|
||||
if (entity != null) {
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java b/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
index 877365a953a0debd14ca8d33073754452ea2f026..5b2728eb9243b0136d77164539f397de406215ca 100644
|
||||
index e43b3b37a3afc903f057d49d34339f8022274d3e..4ee08ec33bca0313e105053266cfe5345e3e324e 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ProjectileUtil.java
|
||||
@@ -51,7 +51,14 @@ public final class ProjectileUtil {
|
||||
@@ -38,10 +38,10 @@ index 877365a953a0debd14ca8d33073754452ea2f026..5b2728eb9243b0136d77164539f397de
|
||||
hitResult = hitResult2;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
index c64e0d623124ad9116cb6c5c7c3320fad7cc1aa3..95c780bbe78370b3426af41c83905ab98b5d3d6b 100644
|
||||
index 86c4b593a97431efd062b8c9d86bf92269c00536..6bab3cad31d230cff33e1fcdba715a698cd5c787 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownPotion.java
|
||||
@@ -62,6 +62,25 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
@@ -64,6 +64,25 @@ public class ThrownPotion extends ThrowableItemProjectile implements ItemSupplie
|
||||
super(EntityType.POTION, x, y, z, world);
|
||||
}
|
||||
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add outline colliison to enderpearls
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
|
||||
index ab777952bda1651796ed41e8a7fc6621f27db9aa..72676ea1458e91e46a62bb6fd88d7a425664d56a 100644
|
||||
index bf4c1883a1257af89428d6580a177f3af3759ee7..426c128805e5d40d4402e2b385d1a39f71b708a1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/ThrowableProjectile.java
|
||||
@@ -44,7 +44,15 @@ public abstract class ThrowableProjectile extends Projectile {
|
||||
@@ -43,7 +43,15 @@ public abstract class ThrowableProjectile extends Projectile {
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
@@ -22,6 +22,6 @@ index ab777952bda1651796ed41e8a7fc6621f27db9aa..72676ea1458e91e46a62bb6fd88d7a42
|
||||
+ }
|
||||
+ HitResult movingobjectposition = ProjectileUtil.getHitResultOnMoveVector(this, this::canHitEntity, type);
|
||||
+ // Sakura end - enderpearls use outline for collision
|
||||
boolean flag = false;
|
||||
|
||||
if (movingobjectposition.getType() == HitResult.Type.BLOCK) {
|
||||
if (movingobjectposition.getType() != HitResult.Type.MISS) {
|
||||
this.preHitTargetOrDeflectSelf(movingobjectposition); // CraftBukkit - projectile hit event
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Disable player poses shrinking collision box
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index b32a2388d800f5930274af4d439a477fe03838f9..70e3c8b1082d16cdbb9a4c179c53dafcc59ac1ed 100644
|
||||
index 8bed7279377884498fc1c4ed7c44b193bb89c1e7..1967a38277d12e09bf39af271eb6c7ed75fe0218 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -2289,7 +2289,13 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -2298,7 +2298,13 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
@Override
|
||||
public EntityDimensions getDefaultDimensions(Pose pose) {
|
||||
@@ -1,19 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Fri, 23 Feb 2024 01:49:20 +0000
|
||||
Subject: [PATCH] Allow disabling sweep attacks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 951fa13dfe333e1e4aa467897d45bbe56d67f6b0..72ce42011eea9b155c161bb03b02ba0a8f142039 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1377,7 +1377,7 @@ public abstract class Player extends LivingEntity {
|
||||
// Paper end - Configurable sprint interruption on attack
|
||||
}
|
||||
|
||||
- if (flag3) {
|
||||
+ if (flag3 && this.level().sakuraConfig().players.combat.allowSweepAttacks) { // Sakura - allow disabling sweep attacks
|
||||
float f4 = 1.0F + EnchantmentHelper.getSweepingDamageRatio(this) * f;
|
||||
List<LivingEntity> list = this.level().getEntitiesOfClass(LivingEntity.class, target.getBoundingBox().inflate(1.0D, 0.25D, 1.0D));
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -64,7 +64,7 @@ index 54781ea0771327f93a7cf672bb4b2945700c47e5..e26a86fb8595705bcbb747872c3d8f73
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
|
||||
index 24c1caa060e7c41eac81c19f873ac9273c6b84c2..6de2496807c1701510d3637d6817f6e9438a2362 100644
|
||||
index 138fd28437fb4923773b8e6ba9bb53c3ce540e0d..ff6776b8c74eedb3414790f7edef8f25fc478d0c 100644
|
||||
--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
|
||||
+++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java
|
||||
@@ -481,6 +481,12 @@ public abstract class VoxelShape {
|
||||
@@ -50,16 +50,16 @@ index 0000000000000000000000000000000000000000..b1c55ef758f61914e6df9b2c8096bce6
|
||||
+ }
|
||||
+}
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index c0a0a8808003d7e56c4de4f4ad1c494b15cc41a2..d0f5ace260a913bc5169ea7ea0481c3e3b4b5616 100644
|
||||
index 5a7f7de0bcdd3d6ed946f0d3e3100e21ff1cbea9..7d451c2924ab944e453c56a02fb02dd0b81381ef 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -287,6 +287,70 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -299,6 +299,79 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
++this.noActionTime; // Above all the floats
|
||||
}
|
||||
// Spigot end
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ private static final UUID LEGACY_COMBAT_MECHANICS_UUID = UUID.fromString("84ef96f8-9f48-4ae4-a26c-e04551324816");
|
||||
+ private static final AttributeModifier LEGACY_ATTACK_SPEED_MODIFIER = new AttributeModifier(LEGACY_COMBAT_MECHANICS_UUID, "Legacy attack speed", 100.0, AttributeModifier.Operation.ADD_VALUE);
|
||||
+ private static final ResourceLocation LEGACY_COMBAT_MODIFIER_ID = ResourceLocation.fromNamespaceAndPath("sakura", "legacy_combat");
|
||||
+ private static final AttributeModifier LEGACY_ATTACK_SPEED_MODIFIER = new AttributeModifier(LEGACY_COMBAT_MODIFIER_ID, 100.0, AttributeModifier.Operation.ADD_VALUE);
|
||||
+
|
||||
+ private void updateAttackSpeedModifier() {
|
||||
+ AttributeInstance attackSpeed = this.getAttribute(Attributes.ATTACK_SPEED);
|
||||
@@ -109,28 +109,37 @@ index c0a0a8808003d7e56c4de4f4ad1c494b15cc41a2..d0f5ace260a913bc5169ea7ea0481c3e
|
||||
+ double attackDifference = (double) legacyAttack - baseAttack;
|
||||
+
|
||||
+ if (baseAttack != 0.0f && legacyAttack != Float.MIN_VALUE) {
|
||||
+ return new AttributeModifier(LEGACY_COMBAT_MECHANICS_UUID, "Legacy attack damage", attackDifference, AttributeModifier.Operation.ADD_VALUE);
|
||||
+ return new AttributeModifier(LEGACY_COMBAT_MODIFIER_ID, attackDifference, AttributeModifier.Operation.ADD_VALUE);
|
||||
+ }
|
||||
+ }
|
||||
+ return null;
|
||||
+ }
|
||||
+
|
||||
+ protected final float calculateLegacySharpnessDamage() {
|
||||
+ ItemStack itemstack = this.getMainHandItem();
|
||||
+ int level = EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.SHARPNESS, itemstack);
|
||||
+ return level * 1.25F - net.minecraft.world.item.enchantment.Enchantments.SHARPNESS.getDamageBonus(level, null);
|
||||
+ protected final float calculateLegacySharpnessDamage(ItemStack itemstack, DamageSource damageSource) {
|
||||
+ net.minecraft.core.RegistryAccess registryAccess = net.minecraft.server.MinecraftServer.getServer().registryAccess();
|
||||
+ net.minecraft.core.HolderLookup.RegistryLookup<Enchantment> enchantments = registryAccess.lookupOrThrow(net.minecraft.core.registries.Registries.ENCHANTMENT);
|
||||
+ Holder<Enchantment> sharpness = enchantments.getOrThrow(net.minecraft.world.item.enchantment.Enchantments.SHARPNESS);
|
||||
+
|
||||
+ int enchantmentLevel = itemstack.getEnchantments().getLevel(sharpness);
|
||||
+ ServerLevel serverLevel = (ServerLevel) this.level();
|
||||
+
|
||||
+ org.apache.commons.lang3.mutable.MutableFloat damage = new org.apache.commons.lang3.mutable.MutableFloat();
|
||||
+ sharpness.value().modifyDamage(serverLevel, enchantmentLevel, itemstack, this, damageSource, damage);
|
||||
+
|
||||
+ // legacy - modern
|
||||
+ return enchantmentLevel * 1.25F - damage.getValue();
|
||||
+ }
|
||||
+ // Sakura end - legacy combat mechanics
|
||||
|
||||
protected LivingEntity(EntityType<? extends LivingEntity> type, Level world) {
|
||||
super(type, world);
|
||||
@@ -2181,7 +2245,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2173,7 +2246,16 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
protected float getDamageAfterArmorAbsorb(DamageSource source, float amount) {
|
||||
if (!source.is(DamageTypeTags.BYPASSES_ARMOR)) {
|
||||
// this.hurtArmor(damagesource, f); // CraftBukkit - Moved into actuallyHurt(DamageSource, float)
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ if (!this.level().sakuraConfig().players.combat.legacyCombatMechanics) {
|
||||
amount = CombatRules.getDamageAfterAbsorb(amount, source, (float) this.getArmorValue(), (float) this.getAttributeValue(Attributes.ARMOR_TOUGHNESS));
|
||||
amount = CombatRules.getDamageAfterAbsorb(this, amount, source, (float) this.getArmorValue(), (float) this.getAttributeValue(Attributes.ARMOR_TOUGHNESS));
|
||||
+ } else {
|
||||
+ // See: applyArmorModifier(DamageSource, float)
|
||||
+ int i = 25 - this.getArmorValue();
|
||||
@@ -141,13 +150,13 @@ index c0a0a8808003d7e56c4de4f4ad1c494b15cc41a2..d0f5ace260a913bc5169ea7ea0481c3e
|
||||
}
|
||||
|
||||
return amount;
|
||||
@@ -3277,6 +3350,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -3297,6 +3379,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
});
|
||||
}
|
||||
+
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
+ if (this instanceof ServerPlayer && enumitemslot == EquipmentSlot.MAINHAND) {
|
||||
+ if (this instanceof ServerPlayer && enumitemslot1 == EquipmentSlot.MAINHAND) {
|
||||
+ this.updateAttackSpeedModifier();
|
||||
+ }
|
||||
+ // Sakura end - legacy combat mechanics
|
||||
@@ -155,16 +164,18 @@ index c0a0a8808003d7e56c4de4f4ad1c494b15cc41a2..d0f5ace260a913bc5169ea7ea0481c3e
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 4e8a41dc9e27244b19e1d45b58ad8363801c5b72..fcc2523e330f1d275f320006374406969cd817fa 100644
|
||||
index 1967a38277d12e09bf39af271eb6c7ed75fe0218..57f891099e7b66e75e9d8eb0f961c4395ed875ff 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1267,12 +1267,18 @@ public abstract class Player extends LivingEntity {
|
||||
@@ -1277,14 +1277,20 @@ public abstract class Player extends LivingEntity {
|
||||
if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
|
||||
{
|
||||
// Paper end - PlayerAttackEntityEvent
|
||||
- float f = (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
||||
+ float f = this.getAttackDamageFromAttributes(); // Sakura - legacy combat mechanics
|
||||
float f1 = EnchantmentHelper.getDamageBonus(this.getMainHandItem(), target.getType());
|
||||
- float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : (float) this.getAttributeValue(Attributes.ATTACK_DAMAGE);
|
||||
+ float f = this.isAutoSpinAttack() ? this.autoSpinAttackDmg : this.getAttackDamageFromAttributes(); // Sakura - legacy combat mechanics
|
||||
ItemStack itemstack = this.getWeaponItem();
|
||||
DamageSource damagesource = this.damageSources().playerAttack(this);
|
||||
float f1 = this.getEnchantedDamage(target, f, damagesource) - f;
|
||||
float f2 = this.getAttackStrengthScale(0.5F);
|
||||
|
||||
+ // Sakura start - legacy combat mechanics
|
||||
@@ -172,18 +183,18 @@ index 4e8a41dc9e27244b19e1d45b58ad8363801c5b72..fcc2523e330f1d275f32000637440696
|
||||
f *= 0.2F + f2 * f2 * 0.8F;
|
||||
f1 *= f2;
|
||||
+ } else if (f1 != 0.0) {
|
||||
+ f1 += this.calculateLegacySharpnessDamage();
|
||||
+ f1 += this.calculateLegacySharpnessDamage(itemstack, damagesource);
|
||||
+ }
|
||||
+ // Sakura end - legacy combat mechanics
|
||||
// this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
|
||||
if (target.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE) && target instanceof Projectile) {
|
||||
Projectile iprojectile = (Projectile) target;
|
||||
@@ -1298,7 +1304,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
@@ -1312,7 +1318,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
|
||||
f += this.getItemInHand(InteractionHand.MAIN_HAND).getItem().getAttackDamageBonus(this, f);
|
||||
- boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting(); // Paper - Add critical damage API; diff on change
|
||||
+ boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && (this.level().sakuraConfig().players.combat.legacyCombatMechanics || !this.isSprinting()); // Sakura - legacy combat mechanics // Paper - Add critical damage API; diff on change
|
||||
f += itemstack.getItem().getAttackDamageBonus(target, f, damagesource);
|
||||
- boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && !this.isSprinting();
|
||||
+ boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround() && !this.onClimbable() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && target instanceof LivingEntity && (this.level().sakuraConfig().players.combat.legacyCombatMechanics || !this.isSprinting()); // Sakura - legacy combat mechanics
|
||||
|
||||
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
|
||||
if (flag2) {
|
||||
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
|
||||
if (flag2) {
|
||||
19
patches/server/0073-Allow-disabling-sweep-attacks.patch
Normal file
19
patches/server/0073-Allow-disabling-sweep-attacks.patch
Normal file
@@ -0,0 +1,19 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Fri, 23 Feb 2024 01:49:20 +0000
|
||||
Subject: [PATCH] Allow disabling sweep attacks
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 57f891099e7b66e75e9d8eb0f961c4395ed875ff..80ffde5ebebaaee1cd8c97cb238126ffee1c7958 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1385,7 +1385,7 @@ public abstract class Player extends LivingEntity {
|
||||
|
||||
LivingEntity entityliving2;
|
||||
|
||||
- if (flag3) {
|
||||
+ if (flag3 && this.level().sakuraConfig().players.combat.allowSweepAttacks) { // Sakura - allow disabling sweep attacks
|
||||
float f6 = 1.0F + (float) this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * f;
|
||||
List<LivingEntity> list = this.level().getEntitiesOfClass(LivingEntity.class, target.getBoundingBox().inflate(1.0D, 0.25D, 1.0D));
|
||||
Iterator iterator = list.iterator();
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Change shields to reduce damage
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index d0f5ace260a913bc5169ea7ea0481c3e3b4b5616..a6f93d020acff05bcda22293a96e4326edc54c22 100644
|
||||
index 7d451c2924ab944e453c56a02fb02dd0b81381ef..3f79e5a83bb85af6ff1a256736394622384cf5b1 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -2321,7 +2321,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -2330,7 +2330,13 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
Function<Double, Double> blocking = new Function<Double, Double>() {
|
||||
@Override
|
||||
public Double apply(Double f) {
|
||||
@@ -5,12 +5,12 @@ Subject: [PATCH] Old enchanted golden apples
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
index a6f93d020acff05bcda22293a96e4326edc54c22..5b5b82955e28162bde34d6d8781a6936c61320c8 100644
|
||||
index 3f79e5a83bb85af6ff1a256736394622384cf5b1..5842543211e415aa1754d7002c9abb7ea65a56e6 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
||||
@@ -4479,6 +4479,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
@@ -4498,6 +4498,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
||||
|
||||
public ItemStack eat(Level world, ItemStack stack) {
|
||||
public final ItemStack eat(Level world, ItemStack stack) {
|
||||
FoodProperties foodinfo = (FoodProperties) stack.get(DataComponents.FOOD);
|
||||
+ // Sakura start - old enchanted golden apple
|
||||
+ if (this.level().sakuraConfig().players.combat.oldEnchantedGoldenApple && foodinfo == net.minecraft.world.food.Foods.ENCHANTED_GOLDEN_APPLE) {
|
||||
@@ -18,13 +18,13 @@ index a6f93d020acff05bcda22293a96e4326edc54c22..5b5b82955e28162bde34d6d8781a6936
|
||||
+ }
|
||||
+ // Sakura end - old enchanted golden apple
|
||||
|
||||
if (foodinfo != null) {
|
||||
world.playSound((net.minecraft.world.entity.player.Player) null, this.getX(), this.getY(), this.getZ(), this.getEatingSound(stack), SoundSource.NEUTRAL, 1.0F, 1.0F + (world.random.nextFloat() - world.random.nextFloat()) * 0.4F);
|
||||
return foodinfo != null ? this.eat(world, stack, foodinfo) : stack;
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/world/food/Foods.java b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
index 60fd0e89552aeaa78b98dda32caa6766097d3108..7ced9d09ad09b53979214dae57a6347620e55569 100644
|
||||
index e13d9ed48431b019b1f68aae315af74cec34fcee..c2e113016b233377f6e8b032336707a4c1b001f5 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/Foods.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/Foods.java
|
||||
@@ -36,6 +36,15 @@ public class Foods {
|
||||
@@ -37,6 +37,15 @@ public class Foods {
|
||||
.effect(new MobEffectInstance(MobEffects.ABSORPTION, 2400, 3), 1.0F)
|
||||
.alwaysEdible()
|
||||
.build();
|
||||
@@ -5,7 +5,7 @@ Subject: [PATCH] Configure fast health regen
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/food/FoodData.java b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
index b89860d451d92ddda64b7e4144542b7fc5fd86f0..bb3e1a81356bda63e64f519cce96659801022925 100644
|
||||
index bd3f78e6453cfe18aa3da38176b04d734d83bb4b..22160241bd421d02f8ecec37899597c0c0afb53e 100644
|
||||
--- a/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
+++ b/src/main/java/net/minecraft/world/food/FoodData.java
|
||||
@@ -83,7 +83,7 @@ public class FoodData {
|
||||
@@ -1,27 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Tue, 11 Jun 2024 13:37:51 +0100
|
||||
Subject: [PATCH] Old combat sounds and particle effects
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 4546df07cdf1d73fcb9c03794efc47c629842e31..a76491cf9bf598ad7e0cbb40cecbeda68c1d822f 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1473,7 +1473,7 @@ public abstract class Player extends LivingEntity {
|
||||
// CraftBukkit end
|
||||
}
|
||||
|
||||
- if (this.level() instanceof ServerLevel && f5 > 2.0F) {
|
||||
+ if (this.level() instanceof ServerLevel && f5 > 2.0F && !this.level().sakuraConfig().players.combat.oldSoundsAndParticleEffects) { // Sakura - old combat sounds and particles
|
||||
int k = (int) ((double) f5 * 0.5D);
|
||||
|
||||
((ServerLevel) this.level()).sendParticles(ParticleTypes.DAMAGE_INDICATOR, target.getX(), target.getY(0.5D), target.getZ(), k, 0.1D, 0.0D, 0.1D, 0.2D);
|
||||
@@ -1903,6 +1903,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
// Paper start - send while respecting visibility
|
||||
private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
|
||||
+ if (fromEntity.level().sakuraConfig().players.combat.oldSoundsAndParticleEffects) return; // Sakura - old combat sounds and particles
|
||||
fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity himself
|
||||
if (fromEntity instanceof ServerPlayer) {
|
||||
((ServerPlayer) fromEntity).connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Add option for fishing hooks pulling entities
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
index d9deb1b47b2430936d74e782cfc4a6ac32a16c91..218b6a72a76b8acfd55952265b34fefafbce3cc3 100644
|
||||
index 43a3ac5858ffb2007e6f63ec0f3bc5a9971dce14..bf8f903bb03b58c53c8307323f3f94779300b7e0 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/projectile/FishingHook.java
|
||||
@@ -615,7 +615,7 @@ public class FishingHook extends Projectile {
|
||||
@@ -616,7 +616,7 @@ public class FishingHook extends Projectile {
|
||||
public void pullEntity(Entity entity) {
|
||||
Entity entity1 = this.getOwner();
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Samsuik <kfian294ma4@gmail.com>
|
||||
Date: Tue, 11 Jun 2024 13:37:51 +0100
|
||||
Subject: [PATCH] Old combat sounds and particle effects
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
index 80ffde5ebebaaee1cd8c97cb238126ffee1c7958..baa35f5ebe7953f0b3cae0381b0391e4d873b562 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
|
||||
@@ -1493,7 +1493,7 @@ public abstract class Player extends LivingEntity {
|
||||
float f8 = f4 - ((LivingEntity) target).getHealth();
|
||||
|
||||
this.awardStat(Stats.DAMAGE_DEALT, Math.round(f8 * 10.0F));
|
||||
- if (this.level() instanceof ServerLevel && f8 > 2.0F) {
|
||||
+ if (this.level() instanceof ServerLevel && f8 > 2.0F && !this.level().sakuraConfig().players.combat.oldSoundsAndParticleEffects) { // Sakura - old combat sounds and particles
|
||||
int i = (int) ((double) f8 * 0.5D);
|
||||
|
||||
((ServerLevel) this.level()).sendParticles(ParticleTypes.DAMAGE_INDICATOR, target.getX(), target.getY(0.5D), target.getZ(), i, 0.1D, 0.0D, 0.1D, 0.2D);
|
||||
@@ -1912,6 +1912,7 @@ public abstract class Player extends LivingEntity {
|
||||
}
|
||||
// Paper start - send while respecting visibility
|
||||
private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
|
||||
+ if (fromEntity.level().sakuraConfig().players.combat.oldSoundsAndParticleEffects) return; // Sakura - old combat sounds and particles
|
||||
fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity itself
|
||||
if (fromEntity instanceof ServerPlayer serverPlayer) {
|
||||
serverPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
|
||||
@@ -5,10 +5,10 @@ Subject: [PATCH] Protect scaffolding from creepers
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
index 22007aa4c85befa80938adf3126bda12b8ff58c9..bf3a05d9787eb64f384b67261ab9e04d7adf343f 100644
|
||||
index 94df0527699462e29fb76f68194386c50f1f7e04..e4e59ee1f59b175205f2bd31d2abe542c5123123 100644
|
||||
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
||||
@@ -285,6 +285,11 @@ public class Explosion {
|
||||
@@ -287,6 +287,11 @@ public class Explosion {
|
||||
Block block = blockState.getBlock();
|
||||
me.samsuik.sakura.explosion.durable.DurableMaterial material = this.level.localConfig().config(pos).durableMaterials.get(block);
|
||||
|
||||
Reference in New Issue
Block a user