9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-20 15:29:33 +00:00

Updated Upstream (Paper)

Upstream has released updates that appear to apply and compile correctly
This commit is contained in:
Samsuik
2023-12-07 16:00:45 +00:00
parent 3ea98de6d1
commit ae970e6a71
40 changed files with 400 additions and 395 deletions

View File

@@ -1,8 +1,8 @@
group=me.samsuik.sakura
version=1.20.2-R0.1-SNAPSHOT
version=1.20.3-R0.1-SNAPSHOT
mcVersion=1.20.2
paperRef=96d5e6ca481591842f44d05ab2451f943be6a7c7
mcVersion=1.20.3
paperRef=9223f05a400f63be1cb5700261816960f9cf8391
org.gradle.jvmargs=-Xmx2G

View File

@@ -153,10 +153,10 @@ index 0000000000000000000000000000000000000000..0483f5a19ff3d4e5e6528c3e4be549fd
+
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 9240ea09206461d61cc08d4252e8507555bf41cf..38cdc63ebc775fc8ef0cc098113c8f901366288f 100644
index 962283d336e6d53941cebbc3a995d403ff989f66..8022f89793a557e0c8c03b78b4a1c5b3aa983306 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -53,6 +53,15 @@ import org.jetbrains.annotations.Nullable;
@@ -54,6 +54,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

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] isPushedByFluid API
diff --git a/src/main/java/org/bukkit/entity/Entity.java b/src/main/java/org/bukkit/entity/Entity.java
index d340ddcf6924cc834455de3acbbac91ab9c66e39..7170c875d81a5e234ee952062b6197dab088241f 100644
index 1d0fd7ff8449f815a7d980af0b378181ea8bf8d8..27b7b6c676b514968efefe254dc4afde122438ad 100644
--- a/src/main/java/org/bukkit/entity/Entity.java
+++ b/src/main/java/org/bukkit/entity/Entity.java
@@ -108,6 +108,23 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
@@ -111,6 +111,23 @@ public interface Entity extends Metadatable, CommandSender, Nameable, Persistent
*/
public boolean isInWater();

View File

@@ -153,10 +153,10 @@ index 0000000000000000000000000000000000000000..0f7da96d434cd699470e050898712898
+
+}
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
index 5eb3521f5f91b0684b4beebf4f7ba2c795b41c42..5f0cb37bd3384922c4ae2a238d5549db48f16c16 100644
index 567a36a4887da8994c9170e2885aa8cc357efa0c..b123dcd80955c7e9dc40a7ecb4307c7d977135fd 100644
--- a/src/main/java/org/bukkit/World.java
+++ b/src/main/java/org/bukkit/World.java
@@ -131,6 +131,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
@@ -155,6 +155,10 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
return new Location(this, x, y, z);
}
// Paper end

View File

@@ -6,25 +6,25 @@ Subject: [PATCH] Branding changes
From ForkPaper.
diff --git a/build.gradle.kts b/build.gradle.kts
index 79beac737c17412913983614bd478d33e3c6ed58..4d635e7db27966d845f47a4f1ab49766447dc2a4 100644
index 170a915098f09ace226648da342a04c5c7583d11..b71b33dabf3066e4b098c6de7bdb21222da2e304 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,8 +13,12 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
val alsoShade: Configuration by configurations.creating
@@ -27,8 +27,12 @@ repositories {
dependencies {
extraRuntime(platform("net.kyori:adventure-bom:4.15.0-SNAPSHOT"))
- implementation(project(":paper-api"))
- implementation(project(":paper-mojangapi"))
+ // Sakura start
+ implementation(project(":sakura-api"))
+ implementation("io.papermc.paper:paper-mojangapi:1.20.1-R0.1-SNAPSHOT") {
+ implementation("io.papermc.paper:paper-mojangapi:1.20.3-R0.1-SNAPSHOT") {
+ exclude("io.papermc.paper", "paper-api")
+ }
+ // Sakura end
// Paper start
implementation("org.jline:jline-terminal-jansi:3.21.0")
implementation("net.minecrell:terminalconsoleappender:1.3.0")
@@ -70,7 +74,7 @@ tasks.jar {
@@ -84,7 +88,7 @@ tasks.jar {
attributes(
"Main-Class" to "org.bukkit.craftbukkit.Main",
"Implementation-Title" to "CraftBukkit",
@@ -34,10 +34,10 @@ index 79beac737c17412913983614bd478d33e3c6ed58..4d635e7db27966d845f47a4f1ab49766
"Specification-Title" to "Bukkit",
"Specification-Version" to project.version,
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 8f31413c939cc2b0454ad3d9a1b618dbae449d00..a9494fe4ef242eeee02eca2c1d69e46539dfe719 100644
index 34f19ac897a30c0c4e3ab406013fcca1c8b7db93..6e1c140d0d26728d64b827f6f3e5a450a37942c0 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1697,7 +1697,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1866,7 +1866,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@DontObfuscate
public String getServerModName() {
@@ -47,10 +47,10 @@ index 8f31413c939cc2b0454ad3d9a1b618dbae449d00..a9494fe4ef242eeee02eca2c1d69e465
public SystemReport fillSystemReport(SystemReport details) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9c08303de2891de92e06de8a939a618b7a6f7321..1d98df3b60721568f69adc4ff10cc23d5d26504e 100644
index 782bb8ca67517dde5dba8f0a133eb8699353dd01..05afb663ecc4d34b80bd6c66d01cd2677bd75f38 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -269,7 +269,7 @@ import javax.annotation.Nullable; // Paper
@@ -270,7 +270,7 @@ import javax.annotation.Nullable; // Paper
import javax.annotation.Nonnull; // Paper
public final class CraftServer implements Server {

View File

@@ -916,10 +916,10 @@ index 0000000000000000000000000000000000000000..141b15887ca075fef5d36ff15125b3e0
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index a9494fe4ef242eeee02eca2c1d69e46539dfe719..9c5c633587d6781a72d9eb258ba5a4a35e954144 100644
index 6e1c140d0d26728d64b827f6f3e5a450a37942c0..dbd88282420e73df44b7a2ea52a7abcbab7e51c9 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -300,6 +300,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -306,6 +306,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;
@@ -927,7 +927,7 @@ index a9494fe4ef242eeee02eca2c1d69e46539dfe719..9c5c633587d6781a72d9eb258ba5a4a3
public static long currentTickLong = 0L; // Paper
public volatile Thread shutdownThread; // Paper
@@ -405,6 +406,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -414,6 +415,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
@@ -939,7 +939,7 @@ index a9494fe4ef242eeee02eca2c1d69e46539dfe719..9c5c633587d6781a72d9eb258ba5a4a3
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 1c9742ad81f04052d2c3bc18c7636f45b2fc5160..35810dd15db02d8bfed181370fed8f7f2f82e157 100644
index 58536aabf607015939a1326f80207c0a06eed8ff..102c5bb9a1702b06ed6418bfe9e4131993aabec3 100644
--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
+++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java
@@ -221,6 +221,11 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface
@@ -955,10 +955,10 @@ index 1c9742ad81f04052d2c3bc18c7636f45b2fc5160..35810dd15db02d8bfed181370fed8f7f
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 c88d5b9125f6ee43bf2be60fd1745d836f271b78..9d860f15b13a3daa2f3b44c96f9b18e33828dd15 100644
index f4d53d9bfe5b060158f69b5d9e4533a5b9869eed..03fcd3d24b18745c3ddbc20edbb06b92417db341 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -691,7 +691,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -693,7 +693,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
// Holder holder = worlddimension.type(); // CraftBukkit - decompile error
// Objects.requireNonNull(minecraftserver); // CraftBukkit - decompile error
@@ -968,10 +968,10 @@ index c88d5b9125f6ee43bf2be60fd1745d836f271b78..9d860f15b13a3daa2f3b44c96f9b18e3
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 2354a0e5d15e9be633d9fe3a1a9feefe7b9b7782..11ab3a3b8624c36dfde3d42091af67c51340e8f2 100644
index 0b56e5f7f18fc4286992af22d402205b771165a3..be86deb703272d014de14a9789a5c50528184d31 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -174,6 +174,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -177,6 +177,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.paperConfig;
}
// Paper end
@@ -984,7 +984,7 @@ index 2354a0e5d15e9be633d9fe3a1a9feefe7b9b7782..11ab3a3b8624c36dfde3d42091af67c5
public final com.destroystokyo.paper.antixray.ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray
public final co.aikar.timings.WorldTimingsHandler timings; // Paper
@@ -210,9 +216,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -213,9 +219,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract ResourceKey<LevelStem> getTypeKey();
@@ -997,10 +997,10 @@ index 2354a0e5d15e9be633d9fe3a1a9feefe7b9b7782..11ab3a3b8624c36dfde3d42091af67c5
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 1d98df3b60721568f69adc4ff10cc23d5d26504e..9b0e7524f2f223fb0927332879f5602f66696705 100644
index 05afb663ecc4d34b80bd6c66d01cd2677bd75f38..872a30aa8695eaf8784792c84483c417c89dc867 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1041,6 +1041,7 @@ public final class CraftServer implements Server {
@@ -1036,6 +1036,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);
@@ -1008,7 +1008,7 @@ index 1d98df3b60721568f69adc4ff10cc23d5d26504e..9b0e7524f2f223fb0927332879f5602f
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))
@@ -1071,6 +1072,7 @@ public final class CraftServer implements Server {
@@ -1066,6 +1067,7 @@ public final class CraftServer implements Server {
this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper
@@ -1017,10 +1017,10 @@ index 1d98df3b60721568f69adc4ff10cc23d5d26504e..9b0e7524f2f223fb0927332879f5602f
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 2af0068ef338634d1f44532af5db66c2d0b3dd10..65cadd91f2a0932f01bb30b036e249c37d69feec 100644
index 4b457cbfc56e55e0ae0fee5b69e2e75349702aab..7f88e9fb060d0f2c6ad94277072805c9bc69fadf 100644
--- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -173,6 +173,14 @@ public class Main {
@@ -174,6 +174,14 @@ public class Main {
.describedAs("Jar file");
// Paper end

View File

@@ -219,10 +219,10 @@ index 0000000000000000000000000000000000000000..fbd877356594f0cf8934452522cef434
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 9c5c633587d6781a72d9eb258ba5a4a35e954144..63d11c4db7152a7bb5aaf5fc625d8f8e585cafa0 100644
index dbd88282420e73df44b7a2ea52a7abcbab7e51c9..b5e2ae560431cd3ecfc780deb25488016c0ad0e7 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1575,6 +1575,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1744,6 +1744,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.pop();
this.profiler.pop();
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
@@ -231,10 +231,10 @@ index 9c5c633587d6781a72d9eb258ba5a4a35e954144..63d11c4db7152a7bb5aaf5fc625d8f8e
this.isIteratingOverLevels = false; // Paper
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 11ab3a3b8624c36dfde3d42091af67c51340e8f2..cd2d2db3b3024ed40aaeb478d6e52e9c7c168107 100644
index be86deb703272d014de14a9789a5c50528184d31..512088b5457e5afbc29d2937051fc4dcc4c5aed6 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -180,6 +180,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -183,6 +183,13 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.sakuraConfig;
}
// Sakura end
@@ -249,10 +249,10 @@ index 11ab3a3b8624c36dfde3d42091af67c51340e8f2..cd2d2db3b3024ed40aaeb478d6e52e9c
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 c3060d1d4d0caf369c6ab516cb424f45eb851019..871ad0128856ad672dda645769efc90ec437ebd7 100644
index e1fad381b861471a17529c246bb8a4a9c7646420..701bca8a87d3d25cc536ebfed9f8611ca8442baf 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -229,6 +229,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
@@ -238,6 +238,13 @@ public class CraftWorld extends CraftRegionAccessor implements World {
}
// Paper end

View File

@@ -251,10 +251,10 @@ index e3f355c85eb7cc8c1683e3009502c10a5ed32daa..349e56d5caad3fc38e83eac6ffff83e2
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 63d11c4db7152a7bb5aaf5fc625d8f8e585cafa0..681091462217b1c4176f8892563a681a3c8a9c06 100644
index b5e2ae560431cd3ecfc780deb25488016c0ad0e7..73dc4f245039805b635f9e89438104e3b7a93e7b 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1576,6 +1576,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1745,6 +1745,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.profiler.pop();
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
worldserver.localConfig().expire(currentTickLong); // Sakura
@@ -391,23 +391,23 @@ index 35674f92a67f93382103c2766df4b678ba5c862f..83c4639c2bdca4dc4281d9f5eca104af
if (this.entity instanceof LivingEntity) {
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index 9d860f15b13a3daa2f3b44c96f9b18e33828dd15..b48186e142c803d1371cf441542119962862ed07 100644
index 03fcd3d24b18745c3ddbc20edbb06b92417db341..fdff4d661143b31d0331824c7df0978dfeece930 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1932,7 +1932,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1956,7 +1956,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
while (iterator.hasNext()) {
ServerPlayer entityplayer = (ServerPlayer) iterator.next();
- if (entityplayer.distanceToSqr(x, y, z) < 4096.0D) {
+ if (entityplayer.distanceToSqr(x, y, z) < 4096.0D && !entityplayer.visibility.isToggled(me.samsuik.sakura.player.visibility.Visibility.Setting.EXPLOSIONS)) { // Sakura - visibility api
entityplayer.connection.send(new ClientboundExplodePacket(x, y, z, power, explosion.getToBlow(), (Vec3) explosion.getHitPlayers().get(entityplayer)));
entityplayer.connection.send(new ClientboundExplodePacket(x, y, z, power, explosion.getToBlow(), (Vec3) explosion.getHitPlayers().get(entityplayer), explosion.getBlockInteraction(), explosion.getSmallExplosionParticles(), explosion.getLargeExplosionParticles(), explosion.getExplosionSound()));
}
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index f71a4a8307fb092d33545e12d253e0b80c884168..fa2ff114c8c8b344b98b639bbbfb94c39c1e996e 100644
index 8efbbd379244e3ed54d4aba199037cc20ccd096a..3ef738c817c10a9233b930296ce5df6e6dc0a58b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -254,6 +254,7 @@ public class ServerPlayer extends Player {
@@ -261,6 +261,7 @@ public class ServerPlayer extends Player {
public final int[] mobCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper
// Paper end - mob spawning rework
public final int[] mobBackoffCounts = new int[MOBCATEGORY_TOTAL_ENUMS]; // Paper - per player mob count backoff
@@ -415,7 +415,7 @@ index f71a4a8307fb092d33545e12d253e0b80c884168..fa2ff114c8c8b344b98b639bbbfb94c3
// CraftBukkit start
public String displayName;
@@ -560,6 +561,15 @@ public class ServerPlayer extends Player {
@@ -567,6 +568,15 @@ public class ServerPlayer extends Player {
this.respawnDimension = (ResourceKey) dataresult1.resultOrPartial(logger1::error).orElse(Level.OVERWORLD);
}
}
@@ -431,7 +431,7 @@ index f71a4a8307fb092d33545e12d253e0b80c884168..fa2ff114c8c8b344b98b639bbbfb94c3
}
@@ -626,6 +636,13 @@ public class ServerPlayer extends Player {
@@ -633,6 +643,13 @@ public class ServerPlayer extends Player {
});
}
this.getBukkitEntity().setExtraData(nbt); // CraftBukkit
@@ -446,7 +446,7 @@ index f71a4a8307fb092d33545e12d253e0b80c884168..fa2ff114c8c8b344b98b639bbbfb94c3
}
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 598f807f0d0caac98b81e0e2991f1bd497c4534e..a3fb63aac5603e32e822aae14fb02a5df5dd660c 100644
index 77cd2b73e4d499beca16962a6b3d1fefe279cd87..79f02204a800ddd3a4e32a34aaa1636d97ccba04 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -40,6 +40,23 @@ import org.bukkit.craftbukkit.util.Waitable;
@@ -549,10 +549,10 @@ index 598f807f0d0caac98b81e0e2991f1bd497c4534e..a3fb63aac5603e32e822aae14fb02a5d
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 65bb221993147a558995b36fb835f7b82e0eb4bd..5435de311366cb2d7ca9dc298529e5b0ae3e9a5d 100644
index 9a94249834f8b0b8d3f6aeaf0c859ba875079250..3a5657fe93f8f63cbebfd005db0848c221c2a9c2 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3105,6 +3105,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -3113,6 +3113,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
event.setCancelled(cancelled);
AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224
@@ -561,10 +561,10 @@ index 65bb221993147a558995b36fb835f7b82e0eb4bd..5435de311366cb2d7ca9dc298529e5b0
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 c655c6fee393c62ba79301f76baa72f9b1154a9a..9d0c8b665bea9da560800b5f7ee1299280201022 100644
index 9abe817ae202edaa2d88cd59ae5c7db0b1c634be..f3b02609297b663559b82984dcd93db186e645f5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -531,6 +531,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -536,6 +536,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.teleportTo(worldserver, null);
}
// Paper end - make end portalling safe
@@ -574,7 +574,7 @@ index c655c6fee393c62ba79301f76baa72f9b1154a9a..9d0c8b665bea9da560800b5f7ee12992
public boolean isLegacyTrackingEntity = false;
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 e6f75a9cac46c8e3ddba664a9d5b27b665a94cb4..c85d2e98311406ead180ace803aabc17cd05066a 100644
index 45c07733f03b5c11f6d8e820f65dc950c70d9a67..3ec931c9aa9e2857e0c24eeb47c1048ace05f6fe 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -73,6 +73,7 @@ public class FallingBlockEntity extends Entity {
@@ -586,10 +586,10 @@ index e6f75a9cac46c8e3ddba664a9d5b27b665a94cb4..c85d2e98311406ead180ace803aabc17
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 4ce3e69970dd9eb251d0538a2d233ca30e9e5e47..d14a8e2cf748cb3784253d99d1bf3c8f9eb2089c 100644
index c3e47426382296d650fa00ce0bc1a82bf23c7877..62a3cd512d473d5ed673386d5c15091a09426945 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -31,6 +31,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -38,6 +38,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
public PrimedTnt(EntityType<? extends PrimedTnt> type, Level world) {
super(type, world);
this.blocksBuilding = true;
@@ -598,10 +598,10 @@ index 4ce3e69970dd9eb251d0538a2d233ca30e9e5e47..d14a8e2cf748cb3784253d99d1bf3c8f
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 cd2d2db3b3024ed40aaeb478d6e52e9c7c168107..b5b19105f33b27a6ade70e914a2e19c024325b86 100644
index 512088b5457e5afbc29d2937051fc4dcc4c5aed6..8fd4d63fdbff9c454d903f4797ec9281df7266fc 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -223,6 +223,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -226,6 +226,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public abstract ResourceKey<LevelStem> getTypeKey();
@@ -611,10 +611,10 @@ index cd2d2db3b3024ed40aaeb478d6e52e9c7c168107..b5b19105f33b27a6ade70e914a2e19c0
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
this.paperConfig = paperWorldConfigCreator.apply(this.spigotConfig); // Paper
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 83aaf3e6e377d731ce02f779f80b7bf5db46f89f..50d2a2b658fd9ddfcc4b25fa2196493d4dbd8664 100644
index ed41decbf0522c516b3608569d5719687105e25b..3ec169d2ead17d1229c6db1fb2ba05ab91ecba73 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -489,6 +489,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -501,6 +501,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().displayName = name == null ? this.getName() : name;
}

View File

@@ -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 45243249a561440512ef2a620c60b02e159c80e2..54a7678c807e4954e6b56e59e49bab53a88a4860 100644
index c790418ff4584af20db006a3e8770f261bab271e..87897b21c422a6301a08b388a69b3cec650bdfb5 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -281,7 +281,7 @@ public class Explosion {
@@ -295,7 +295,7 @@ public class Explosion {
}
}

View File

@@ -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 9d0c8b665bea9da560800b5f7ee1299280201022..a52530dbcd8a3e48a26f13fb246e8183ee560b07 100644
index f3b02609297b663559b82984dcd93db186e645f5..8e877437f4d27ef210c9bfbbdbe16e2c328b4e54 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1229,7 +1229,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1234,7 +1234,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.tryCheckInsideBlocks();
float f = this.getBlockSpeedFactor();
@@ -17,7 +17,7 @@ index 9d0c8b665bea9da560800b5f7ee1299280201022..a52530dbcd8a3e48a26f13fb246e8183
// Paper start - remove expensive streams from here
boolean noneMatch = true;
AABB fireSearchBox = this.getBoundingBox().deflate(1.0E-6D);
@@ -2049,6 +2049,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2054,6 +2054,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
public void moveTo(double x, double y, double z, float yaw, float pitch) {
// Paper - cancel entity velocity if teleported
if (!preserveMotion) {
@@ -25,7 +25,7 @@ index 9d0c8b665bea9da560800b5f7ee1299280201022..a52530dbcd8a3e48a26f13fb246e8183
this.deltaMovement = Vec3.ZERO;
} else {
this.preserveMotion = false;
@@ -3401,29 +3402,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3456,29 +3457,33 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public void onAboveBubbleCol(boolean drag) {
@@ -67,7 +67,7 @@ index 9d0c8b665bea9da560800b5f7ee1299280201022..a52530dbcd8a3e48a26f13fb246e8183
this.resetFallDistance();
}
@@ -4397,16 +4402,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4465,16 +4470,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
vec3d = vec3d.normalize();
}
@@ -90,7 +90,7 @@ index 9d0c8b665bea9da560800b5f7ee1299280201022..a52530dbcd8a3e48a26f13fb246e8183
}
this.fluidHeight.put(tag, d1);
@@ -4477,11 +4485,53 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4545,11 +4553,53 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return this.chunkPosition;
}
@@ -144,7 +144,7 @@ index 9d0c8b665bea9da560800b5f7ee1299280201022..a52530dbcd8a3e48a26f13fb246e8183
synchronized (this.posLock) { // Paper
this.deltaMovement = velocity;
} // Paper
@@ -4492,7 +4542,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4560,7 +4610,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public void setDeltaMovement(double x, double y, double z) {
@@ -158,7 +158,7 @@ index 9d0c8b665bea9da560800b5f7ee1299280201022..a52530dbcd8a3e48a26f13fb246e8183
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 c85d2e98311406ead180ace803aabc17cd05066a..e2f34595a535582d2722f68dc88b777704ef641a 100644
index 3ec931c9aa9e2857e0c24eeb47c1048ace05f6fe..ec8488a2ab16950052a3bff04be6e3ecc3b44891 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -145,7 +145,7 @@ public class FallingBlockEntity extends Entity {
@@ -189,10 +189,10 @@ index c85d2e98311406ead180ace803aabc17cd05066a..e2f34595a535582d2722f68dc88b7777
}
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 d14a8e2cf748cb3784253d99d1bf3c8f9eb2089c..369cfaeba980d1d98d0dcefffb584dcbbe144b1d 100644
index 62a3cd512d473d5ed673386d5c15091a09426945..12067c0372ad2803ffa2501a8296496a9ce7b292 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -66,7 +66,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -74,7 +74,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
public void tick() {
if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot
if (!this.isNoGravity()) {
@@ -201,7 +201,7 @@ index d14a8e2cf748cb3784253d99d1bf3c8f9eb2089c..369cfaeba980d1d98d0dcefffb584dcb
}
this.move(MoverType.SELF, this.getDeltaMovement());
@@ -76,9 +76,9 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -84,9 +84,9 @@ public class PrimedTnt extends Entity implements TraceableEntity {
return;
}
// Paper end
@@ -214,29 +214,28 @@ index d14a8e2cf748cb3784253d99d1bf3c8f9eb2089c..369cfaeba980d1d98d0dcefffb584dcb
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 54a7678c807e4954e6b56e59e49bab53a88a4860..1b335111bd9eb90bbda87225b740768705f26193 100644
index 87897b21c422a6301a08b388a69b3cec650bdfb5..9fdfc43ea51a326444a04d79976d315aa64050d1 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -600,10 +600,12 @@ public class Explosion {
d8 *= d14;
d9 *= d14;
d10 *= d14;
@@ -619,10 +619,11 @@ public class Explosion {
d8 *= d13;
d9 *= d13;
d10 *= d13;
- Vec3 vec3d1 = new Vec3(d8, d9, d10);
+ // Sakura - moved down
- entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1));
+ // Sakura start - reduce deltamovement allocations
+ entity.addDeltaMovement(d8, d9, d10);
+ entity.addDeltaMovement(d8, d9, d10); // Sakura reduce deltamovement allocations
if (entity instanceof Player) {
+ Vec3 vec3d1 = new Vec3(d8, d9, d10);
+ // Sakura end
+ Vec3 vec3d1 = new Vec3(d8, d9, d10); // Sakura
Player entityhuman = (Player) entity;
if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Disable explosion knockback
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 d4cbff18adb62073a1dceb189043789620af6877..26cc4c10d441a800623fd5b76a9c31a57291cdba 100644
index 4d50dd92a7f3187ee1d8edb926e7c273c8156549..ec24eadbe7dd7e60c023303dc8050e3e784516a1 100644
--- a/src/main/java/net/minecraft/world/level/block/Block.java
+++ b/src/main/java/net/minecraft/world/level/block/Block.java
@@ -453,7 +453,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) {
@@ -244,4 +243,4 @@ index d4cbff18adb62073a1dceb189043789620af6877..26cc4c10d441a800623fd5b76a9c31a5
+ entity.multiplyDeltaMovement(1.0D, 0.0D, 1.0D); // Sakura
}
public ItemStack getCloneItemStack(BlockGetter world, BlockPos pos, BlockState state) {
public ItemStack getCloneItemStack(LevelReader world, BlockPos pos, BlockState state) {

View File

@@ -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 369cfaeba980d1d98d0dcefffb584dcbbe144b1d..5b4e1d56f63935c5b6506dc94d174e8efebd260f 100644
index 12067c0372ad2803ffa2501a8296496a9ce7b292..c187a2714d5580a2d8db54d270999aa618c4c878 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -99,6 +99,14 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -107,6 +107,14 @@ public class PrimedTnt extends Entity implements TraceableEntity {
}
}

View File

@@ -50,10 +50,10 @@ index 658e63ebde81dc14c8ab5850fb246dc0aab25dea..f1ff1a67fee37ee7b241ceaa164fa4ee
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 a52530dbcd8a3e48a26f13fb246e8183ee560b07..f74e590a2f492fd54d3e718bed8b0b0cf5f12cea 100644
index 8e877437f4d27ef210c9bfbbdbe16e2c328b4e54..2336ca9f16d8d570eeeff8cd780fa02c0138be04 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -533,6 +533,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -538,6 +538,19 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
// Paper end - make end portalling safe
public boolean isPrimedTNT; // Sakura
public boolean isFallingBlock; // Sakura
@@ -73,7 +73,7 @@ index a52530dbcd8a3e48a26f13fb246e8183ee560b07..f74e590a2f492fd54d3e718bed8b0b0c
public boolean isLegacyTrackingEntity = false;
@@ -1490,7 +1503,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1495,7 +1508,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
io.papermc.paper.util.CollisionUtil.getCollisions(
world, this, collisionBox, potentialCollisionsVoxel, potentialCollisionsBB,
@@ -82,7 +82,7 @@ index a52530dbcd8a3e48a26f13fb246e8183ee560b07..f74e590a2f492fd54d3e718bed8b0b0c
null, null
);
@@ -4812,7 +4825,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4880,7 +4893,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@Override
public boolean isAlwaysTicking() {
@@ -92,7 +92,7 @@ index a52530dbcd8a3e48a26f13fb246e8183ee560b07..f74e590a2f492fd54d3e718bed8b0b0c
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 e2f34595a535582d2722f68dc88b777704ef641a..354e210a52e5ce7b1b8cf75ce132e59c02f664ab 100644
index ec8488a2ab16950052a3bff04be6e3ecc3b44891..1a018e1d2b6dd93be5e6209a2d52eade0b356f58 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 {
@@ -104,10 +104,10 @@ index e2f34595a535582d2722f68dc88b777704ef641a..354e210a52e5ce7b1b8cf75ce132e59c
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 5b4e1d56f63935c5b6506dc94d174e8efebd260f..4c328a511ff6c0e6b73ef9701c82373e02c12830 100644
index c187a2714d5580a2d8db54d270999aa618c4c878..0be7c39fbb19a0cdca3f5dc779c2690df5f08647 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -32,6 +32,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -39,6 +39,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
super(type, world);
this.blocksBuilding = true;
this.isPrimedTNT = true; // Sakura

View File

@@ -418,10 +418,10 @@ index 0000000000000000000000000000000000000000..8a94b1a2cb1ff57664c97a7b471c99ec
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 681091462217b1c4176f8892563a681a3c8a9c06..e1da429e78ee7445d2243661efbf08e152c8c732 100644
index 73dc4f245039805b635f9e89438104e3b7a93e7b..c8c044f5ffcb4530782c8dbd889c027d1fdbcf6c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1080,6 +1080,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1126,6 +1126,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,27 +429,31 @@ index 681091462217b1c4176f8892563a681a3c8a9c06..e1da429e78ee7445d2243661efbf08e1
// Paper End
// Spigot End
@@ -1136,6 +1137,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
{
@@ -1192,6 +1193,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
curTime = Util.getNanos();
final long diff = curTime - tickSection;
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
tps1.add(currentTps, diff);
tps5.add(currentTps, diff);
tps15.add(currentTps, diff);
@@ -1159,6 +1161,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.startMetricsRecordingTick();
this.profiler.push("tick");
this.tickServer(this::haveTime);
+ tickTracking.tickSample((System.nanoTime() - curTime) / 1_000_000L); // Sakura
@@ -1219,6 +1221,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
this.tickServer(flag ? () -> {
return false;
} : this::haveTime);
+ // Sakura start
+ if (flag) {
+ tickTracking.tickSample((System.nanoTime() - curTime) / 1_000_000L);
+ }
+ // Sakura end
this.profiler.popPush("nextTickWait");
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTime = Math.max(Util.getMillis() + 50L, this.nextTickTime);
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 8c33a12ca879c46893150d6adfb8aa4d397c6b4c..fe8da490f50a74bf6a0327b9c31a258c3d79d8e6 100644
index 6e212f672579a3e08dc362c287be59ca5170d717..bc0f6555e9c3fcccf2d9a3bd47c76e6433dd6bff 100644
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
@@ -76,6 +76,12 @@ public class ServerChunkCache extends ChunkSource {
@@ -74,6 +74,12 @@ public class ServerChunkCache extends ChunkSource {
private final LevelChunk[] lastLoadedChunks = new LevelChunk[4 * 4];
@@ -463,10 +467,10 @@ index 8c33a12ca879c46893150d6adfb8aa4d397c6b4c..fe8da490f50a74bf6a0327b9c31a258c
return x & 3 | ((z & 3) << 2);
}
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index b48186e142c803d1371cf441542119962862ed07..efba8d153b5838ff1dbc68d389b4d1529c951008 100644
index fdff4d661143b31d0331824c7df0978dfeece930..fda15d30321669c3a0bf9bd4e7a9f0c069f040d2 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -192,7 +192,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -194,7 +194,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
public final ServerChunkCache chunkSource;
private final MinecraftServer server;
public final PrimaryLevelData serverLevelData; // CraftBukkit - type

View File

@@ -203,10 +203,10 @@ index 83c4639c2bdca4dc4281d9f5eca104af3063bfa5..f7d8aaededd39ce52a9d0105f66fd759
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 f74e590a2f492fd54d3e718bed8b0b0cf5f12cea..f00a5a68e12f1881857eed7ffaf22a656a9ef2af 100644
index 2336ca9f16d8d570eeeff8cd780fa02c0138be04..d81156d33184ea5a58e3c4e71eaef9f4c5990ea0 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -3345,7 +3345,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -3400,7 +3400,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
return;
}
@@ -216,7 +216,7 @@ index f74e590a2f492fd54d3e718bed8b0b0cf5f12cea..f00a5a68e12f1881857eed7ffaf22a65
}
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 354e210a52e5ce7b1b8cf75ce132e59c02f664ab..24586ae4833b5bf3596b0921273f712c14f1be9c 100644
index 1a018e1d2b6dd93be5e6209a2d52eade0b356f58..0cf39ea76902e62b712057fe1bb80e3af8190fc4 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -110,7 +110,7 @@ public class FallingBlockEntity extends Entity {
@@ -229,10 +229,10 @@ index 354e210a52e5ce7b1b8cf75ce132e59c02f664ab..24586ae4833b5bf3596b0921273f712c
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 4c328a511ff6c0e6b73ef9701c82373e02c12830..fbeb52a49b791f992af19c7d69ba44b820541b09 100644
index 0be7c39fbb19a0cdca3f5dc779c2690df5f08647..cc30c119f519e7cd947ab40beae56e493e977176 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -172,7 +172,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -196,7 +196,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
}
public void setFuse(int fuse) {
@@ -242,10 +242,10 @@ index 4c328a511ff6c0e6b73ef9701c82373e02c12830..fbeb52a49b791f992af19c7d69ba44b8
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 481c3e321cfc0f20bb1c4c6942b8bdbd23c06339..8858aa55d32bda0d16ad602a5de557791c779208 100644
index 7f3466340891b4409d1399ebeb2ca865d77841cd..c3170384afa8d3bc4b1b428ecea04b1276621136 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -649,7 +649,7 @@ public abstract class Player extends LivingEntity {
@@ -644,7 +644,7 @@ public abstract class Player extends LivingEntity {
public void increaseScore(int score) {
int j = this.getScore();

View File

@@ -41,10 +41,10 @@ index 2d79633d86007c7d40eecf5f9271fa3f351b72b5..d917a19c838ed3d74322abd85e1f737e
public void getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
if (this.count == 0) {
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index b5b19105f33b27a6ade70e914a2e19c024325b86..7354a93826cbb977829fae1b2d91de24fcd867c1 100644
index 8fd4d63fdbff9c454d903f4797ec9281df7266fc..9ef1d77dd87793577223402808ff7a6baad42ee4 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -225,6 +225,16 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -228,6 +228,16 @@ 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

View File

@@ -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 f00a5a68e12f1881857eed7ffaf22a656a9ef2af..cbb2853f56c3339826fcaaff20ba93f62e56a761 100644
index d81156d33184ea5a58e3c4e71eaef9f4c5990ea0..89af45a998dd1884bac8ace525b87be9dd291789 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -546,6 +546,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -551,6 +551,34 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return flags;
}
// Sakura end
@@ -91,10 +91,10 @@ index f00a5a68e12f1881857eed7ffaf22a656a9ef2af..cbb2853f56c3339826fcaaff20ba93f6
public boolean isLegacyTrackingEntity = false;
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 7354a93826cbb977829fae1b2d91de24fcd867c1..12c6705d652cf873134aca556e205aa5ec0248fb 100644
index 9ef1d77dd87793577223402808ff7a6baad42ee4..862a56ce8de55bdca99af24fcf3909e820a0598e 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -1332,6 +1332,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1343,6 +1343,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public <T extends Entity> void guardEntityTick(Consumer<T> tickConsumer, T entity) {
try {

View File

@@ -149,10 +149,10 @@ index 0000000000000000000000000000000000000000..7cb3b0d5a284199cdc117038227d3368
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e1da429e78ee7445d2243661efbf08e152c8c732..457ccc9934fc6563a1b260ec9d12f0c875a4bd37 100644
index c8c044f5ffcb4530782c8dbd889c027d1fdbcf6c..d131a64fe26e5ba33ccb1361c015795984fde85a 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1580,6 +1580,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1753,6 +1753,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.explosionDensityCache.clear(); // Paper - Optimize explosions
worldserver.localConfig().expire(currentTickLong); // Sakura
worldserver.minimalTNT.clear(); // Sakura - visibility api
@@ -161,10 +161,10 @@ index e1da429e78ee7445d2243661efbf08e152c8c732..457ccc9934fc6563a1b260ec9d12f0c8
this.isIteratingOverLevels = false; // Paper
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index efba8d153b5838ff1dbc68d389b4d1529c951008..fd25999781d99526b1bc1677aaa3ff742b216ac5 100644
index fda15d30321669c3a0bf9bd4e7a9f0c069f040d2..cccdce1e317e049b0cdb45a66c7f0d2853f00216 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -877,6 +877,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -894,6 +894,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
org.spigotmc.ActivationRange.activateEntities(this); // Spigot
this.timings.entityTick.startTiming(); // Spigot
@@ -172,7 +172,7 @@ index efba8d153b5838ff1dbc68d389b4d1529c951008..fd25999781d99526b1bc1677aaa3ff74
this.entityTickList.forEach((entity) -> {
if (!entity.isRemoved()) {
if (false && this.shouldDiscardEntity(entity)) { // CraftBukkit - We prevent spawning in general, so this butchering is not needed
@@ -896,6 +897,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -913,6 +914,15 @@ public class ServerLevel extends Level implements WorldGenLevel {
entity.stopRiding();
}
@@ -189,10 +189,10 @@ index efba8d153b5838ff1dbc68d389b4d1529c951008..fd25999781d99526b1bc1677aaa3ff74
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 cbb2853f56c3339826fcaaff20ba93f62e56a761..9564477334755756b49fc7bf9f7344912758d47e 100644
index 89af45a998dd1884bac8ace525b87be9dd291789..c9d94d157b4bc52742050d75b3a11b8e2769ec08 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -574,6 +574,105 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -579,6 +579,105 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return BlockPos.asLong(v.getBlockX(), v.getBlockY(), v.getBlockZ());
}
// Sakura end
@@ -298,7 +298,7 @@ index cbb2853f56c3339826fcaaff20ba93f62e56a761..9564477334755756b49fc7bf9f734491
public boolean isLegacyTrackingEntity = false;
@@ -652,6 +751,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -657,6 +756,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.getEntityData().registrationLocked = true; // Spigot
this.setPos(0.0D, 0.0D, 0.0D);
this.eyeHeight = this.getEyeHeight(net.minecraft.world.entity.Pose.STANDING, this.dimensions);
@@ -306,19 +306,19 @@ index cbb2853f56c3339826fcaaff20ba93f62e56a761..9564477334755756b49fc7bf9f734491
}
public boolean isColliding(BlockPos pos, BlockState state) {
@@ -2499,6 +2599,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
nbt.putBoolean("Paper.FreezeLock", true);
@@ -2522,6 +2622,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
nbttagcompound.putBoolean("Paper.FreezeLock", true);
}
// Paper end
+ // Sakura start
+ if (stacked > 0) {
+ nbt.putInt("Sakura.Stacked", stacked);
+ nbttagcompound.putInt("Sakura.Stacked", stacked);
+ }
+ // Sakura end
return nbt;
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2646,6 +2751,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2669,6 +2774,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
}
// Paper end
@@ -330,7 +330,7 @@ index cbb2853f56c3339826fcaaff20ba93f62e56a761..9564477334755756b49fc7bf9f734491
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
@@ -4808,6 +4918,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4876,6 +4986,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return;
}
// Paper end - rewrite chunk system
@@ -343,7 +343,7 @@ index cbb2853f56c3339826fcaaff20ba93f62e56a761..9564477334755756b49fc7bf9f734491
if (this.removalReason == null) {
this.removalReason = reason;
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 24586ae4833b5bf3596b0921273f712c14f1be9c..45e042dc8b875b08f5f09955258913a256371b54 100644
index 0cf39ea76902e62b712057fe1bb80e3af8190fc4..6662d48f691cf6ab515a3eb64642dcb770d1caa0 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -132,6 +132,58 @@ public class FallingBlockEntity extends Entity {
@@ -414,10 +414,10 @@ index 24586ae4833b5bf3596b0921273f712c14f1be9c..45e042dc8b875b08f5f09955258913a2
((Fallable) block).onLand(this.level(), blockposition, this.blockState, iblockdata, this);
}
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 fbeb52a49b791f992af19c7d69ba44b820541b09..02ef6ca32f3de52e921fdcf3f0f572ce7afef318 100644
index cc30c119f519e7cd947ab40beae56e493e977176..826a910a02ae234012d10bb9ca3b677d127a6d13 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -63,6 +63,60 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -71,6 +71,60 @@ public class PrimedTnt extends Entity implements TraceableEntity {
return !this.isRemoved();
}
@@ -478,7 +478,7 @@ index fbeb52a49b791f992af19c7d69ba44b820541b09..02ef6ca32f3de52e921fdcf3f0f572ce
@Override
public void tick() {
if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot
@@ -88,6 +142,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -96,6 +150,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();
@@ -487,10 +487,10 @@ index fbeb52a49b791f992af19c7d69ba44b820541b09..02ef6ca32f3de52e921fdcf3f0f572ce
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 12c6705d652cf873134aca556e205aa5ec0248fb..c7defb4555edd792c83ec001c8dfbf604376b190 100644
index 862a56ce8de55bdca99af24fcf3909e820a0598e..37fbba2f6eb32f2806ae1fec90d7be800ba91d49 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -234,6 +234,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -237,6 +237,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return slices.getSectionEntities(chunkY);
}
// Sakura end

View File

@@ -142,14 +142,16 @@ index 0000000000000000000000000000000000000000..3f6f34cc617efaad420485a7f613cfca
+}
diff --git a/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java b/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java
new file mode 100644
index 0000000000000000000000000000000000000000..a605a56ec780f871362fc9abc9bb315572ef254b
index 0000000000000000000000000000000000000000..90540b3c8c695e24419b0e0460f0c42f949142b0
--- /dev/null
+++ b/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java
@@ -0,0 +1,391 @@
+package me.samsuik.sakura.explosion;
+
+import net.minecraft.core.BlockPos;
+import net.minecraft.core.particles.ParticleOptions;
+import net.minecraft.server.level.ServerLevel;
+import net.minecraft.sounds.SoundEvent;
+import net.minecraft.util.Mth;
+import net.minecraft.world.damagesource.DamageSource;
+import net.minecraft.world.entity.Entity;
@@ -191,8 +193,8 @@ index 0000000000000000000000000000000000000000..a605a56ec780f871362fc9abc9bb3155
+
+ private final Level level;
+
+ public SakuraExplosion(Level world, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, BlockInteraction destructionType) {
+ super(world, entity, damageSource, behavior, x, y, z, power, createFire, destructionType);
+ public SakuraExplosion(Level world, @Nullable Entity entity, @Nullable DamageSource damageSource, @Nullable ExplosionDamageCalculator behavior, double x, double y, double z, float power, boolean createFire, BlockInteraction destructionType, ParticleOptions particle, ParticleOptions emitterParticle, SoundEvent soundEvent) {
+ super(world, entity, damageSource, behavior, x, y, z, power, createFire, destructionType, particle, emitterParticle, soundEvent);
+ this.level = world;
+ }
+
@@ -359,9 +361,7 @@ index 0000000000000000000000000000000000000000..a605a56ec780f871362fc9abc9bb3155
+ Entity entity = entities[i];
+ if (entity == null) break;
+
+ if (entity != source && !entity.ignoreExplosion()
+ && entity.distanceToSqr(center.x, center.y, center.z) <= maxDistanceSqr
+ ) {
+ if (entity != source && !entity.ignoreExplosion(this) && entity.distanceToSqr(center.x, center.y, center.z) <= maxDistanceSqr) {
+ int key = DensityCache.createKey(entity, center);
+ DensityCache.Density data = level.densityCache.retrieveCache(key);
+ Vec3 position = entity.position();
@@ -424,7 +424,7 @@ index 0000000000000000000000000000000000000000..a605a56ec780f871362fc9abc9bb3155
+ Entity entity = entities[i];
+ if (entity == null) break;
+
+ if (entity != source && !entity.ignoreExplosion()) {
+ if (entity != source && !entity.ignoreExplosion(this)) {
+ impactEntityIdle(entity, entities, position, potential, radius, blockPos, blockCache);
+ }
+
@@ -472,62 +472,62 @@ index 0000000000000000000000000000000000000000..a605a56ec780f871362fc9abc9bb3155
+ }
+ }
+
+ private void impactNonLiving(Entity entity, Vec3 pos, Entity[] section, double d8, double d9, double d10, double d13, BlockPos.MutableBlockPos blockPos, ExplosionBlockCache[] blockCache) {
+ // CraftBukkit start
+ private void impactNonLiving(Entity entity, Vec3 pos, Entity[] section, double x, double y, double z, double exposure, BlockPos.MutableBlockPos blockPos, ExplosionBlockCache[] blockCache) {
+ if (this.damageCalculator.shouldDamageEntity(this, entity)) {
+ // CraftBukkit start
+
+ // Special case ender dragon only give knockback if no damage is cancelled
+ // Thinks to note:
+ // - Setting a velocity to a ComplexEntityPart is ignored (and therefore not needed)
+ // - Damaging ComplexEntityPart while forward the damage to EntityEnderDragon
+ // - Damaging EntityEnderDragon does nothing
+ // - EntityEnderDragon hitbock always covers the other parts and is therefore always present
+ if (entity instanceof EnderDragonPart) {
+ return;
+ }
+ // Special case ender dragon only give knockback if no damage is cancelled
+ // Thinks to note:
+ // - Setting a velocity to a ComplexEntityPart is ignored (and therefore not needed)
+ // - Damaging ComplexEntityPart while forward the damage to EntityEnderDragon
+ // - Damaging EntityEnderDragon does nothing
+ // - EntityEnderDragon hitbock always covers the other parts and is therefore always present
+ if (entity instanceof EnderDragonPart) {
+ return;
+ }
+
+ CraftEventFactory.entityDamage = this.source;
+ entity.lastDamageCancelled = false;
+ CraftEventFactory.entityDamage = this.source;
+ entity.lastDamageCancelled = false;
+
+ if (entity instanceof EnderDragon) {
+ for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) {
+ for (Entity ent : section) {
+ if (ent == null) break;
+ // Calculate damage separately for each EntityComplexPart
+ double d7part;
+ if (ent == entityComplexPart && (d7part = Math.sqrt(entityComplexPart.distanceToSqr(pos)) / radius) <= 1.0D) {
+ double d13part = (1.0D - d7part) * this.getSeenFraction(pos, entityComplexPart, null, blockCache, blockPos); // Sakura // Paper - optimise explosions
+ entityComplexPart.hurt(this.getDamageSource(), (float) ((int) ((d13part * d13part + d13part) / 2.0D * 7.0D * (double) radius + 1.0D)));
+ if (entity instanceof EnderDragon) {
+ for (EnderDragonPart entityComplexPart : ((EnderDragon) entity).subEntities) {
+ for (Entity ent : section) {
+ // Calculate damage separately for each EntityComplexPart
+ if (ent == null) break;
+ if (ent == entityComplexPart) {
+ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(pos, entityComplexPart, null, blockCache, blockPos))); // Sakura // Paper - actually optimise explosions
+ }
+ }
+ }
+ } else {
+ entity.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity));
+ }
+ } else {
+ entity.hurt(this.getDamageSource(), (float) ((int) ((d13 * d13 + d13) / 2.0D * 7.0D * radius + 1.0D)));
+
+ CraftEventFactory.entityDamage = null;
+ if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
+ return;
+ }
+ // CraftBukkit end
+ }
+
+ CraftEventFactory.entityDamage = null;
+ if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled
+ return;
+ }
+ // CraftBukkit end
+ double d14;
+ double force;
+
+ if (entity instanceof LivingEntity) {
+ LivingEntity entityliving = (LivingEntity) entity;
+
+ d14 = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, d13); // Paper - disable explosion knockback
+ force = entity instanceof Player && level.paperConfig().environment.disableExplosionKnockback ? 0 : ProtectionEnchantment.getExplosionKnockbackAfterDampener(entityliving, exposure); // Paper - disable explosion knockback
+ } else {
+ d14 = d13;
+ force = exposure;
+ }
+
+ d8 *= d14;
+ d9 *= d14;
+ d10 *= d14;
+ x *= force;
+ y *= force;
+ z *= force;
+ // Sakura - moved down
+
+ // Sakura start - reduce deltamovement allocations
+ entity.addDeltaMovement(d8, d9, d10);
+ entity.addDeltaMovement(x, y, z); // Sakura reduce deltamovement allocations
+ if (entity instanceof Player) {
+ Vec3 vec3d1 = new Vec3(d8, d9, d10);
+ // Sakura end
+ Vec3 vec3d1 = new Vec3(x, y, z); // Sakura
+ Player entityhuman = (Player) entity;
+
+ if (!entityhuman.isSpectator() && (!entityhuman.isCreative() || !entityhuman.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Disable explosion knockback
@@ -608,10 +608,10 @@ index 0000000000000000000000000000000000000000..e0387f16ff49031fdcbc8990613417da
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 457ccc9934fc6563a1b260ec9d12f0c875a4bd37..d2b12606c4bd7edec4061f67e79bdedcee147fca 100644
index d131a64fe26e5ba33ccb1361c015795984fde85a..fa6da05e6d33f74bbae986c6b4db3077be432baa 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1581,6 +1581,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1754,6 +1754,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.localConfig().expire(currentTickLong); // Sakura
worldserver.minimalTNT.clear(); // Sakura - visibility api
worldserver.mergeHistory.expire(currentTickLong); // Sakura - merge cannoning entities
@@ -620,10 +620,10 @@ index 457ccc9934fc6563a1b260ec9d12f0c875a4bd37..d2b12606c4bd7edec4061f67e79bdedc
this.isIteratingOverLevels = false; // Paper
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index fd25999781d99526b1bc1677aaa3ff742b216ac5..239a8ec823876c2a53b68068340b79959b478148 100644
index cccdce1e317e049b0cdb45a66c7f0d2853f00216..ec193e89ac948795e5fb1f6303684df08380ffec 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -1937,6 +1937,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1961,6 +1961,12 @@ public class ServerLevel extends Level implements WorldGenLevel {
explosion.clearToBlow();
}
@@ -636,7 +636,7 @@ index fd25999781d99526b1bc1677aaa3ff742b216ac5..239a8ec823876c2a53b68068340b7995
Iterator iterator = this.players.iterator();
while (iterator.hasNext()) {
@@ -1947,7 +1953,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
@@ -1971,7 +1977,7 @@ public class ServerLevel extends Level implements WorldGenLevel {
}
}
@@ -646,10 +646,10 @@ index fd25999781d99526b1bc1677aaa3ff742b216ac5..239a8ec823876c2a53b68068340b7995
@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 02ef6ca32f3de52e921fdcf3f0f572ce7afef318..919680a42a8362859cd87fb3d87e8ee80e9cd960 100644
index 826a910a02ae234012d10bb9ca3b677d127a6d13..2445bfc0c5604cb0185d240c9448a5c7fefa8784 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -78,6 +78,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -86,6 +86,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
|| tnt.entityState().fallDistance() > 2.5f && fallDistance > 2.5f);
}
@@ -657,7 +657,7 @@ index 02ef6ca32f3de52e921fdcf3f0f572ce7afef318..919680a42a8362859cd87fb3d87e8ee8
@Override
protected void respawn() {
if (stacked <= 1) return;
@@ -115,6 +116,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -123,6 +124,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
tnt.discard();
}
@@ -666,29 +666,33 @@ index 02ef6ca32f3de52e921fdcf3f0f572ce7afef318..919680a42a8362859cd87fb3d87e8ee8
@Override
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2461fca09 100644
index 9fdfc43ea51a326444a04d79976d315aa64050d1..4d052ef2b6d3ebd399e1904d67e973969efc683d 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -56,12 +56,14 @@ public class Explosion {
@@ -55,14 +55,16 @@ public class Explosion {
private final Explosion.BlockInteraction blockInteraction;
private final RandomSource random;
private final Level level;
- private final double x;
- private final double y;
- private final double z;
+ // Sakura start - final private -> protected
+ // Sakura start - expose fields
+ protected double x;
+ protected double y;
+ protected double z;
+ // Sakura end
@Nullable
public final Entity source;
- private final float radius;
+ protected final float radius; // Sakura - private -> protected
private final DamageSource damageSource;
private final ExplosionDamageCalculator damageCalculator;
private final ObjectArrayList<BlockPos> toBlow;
@@ -122,6 +124,12 @@ public class Explosion {
- private final DamageSource damageSource;
- private final ExplosionDamageCalculator damageCalculator;
+ protected final float radius;
+ protected final DamageSource damageSource;
+ protected final ExplosionDamageCalculator damageCalculator;
+ // Sakura end
private final ParticleOptions smallExplosionParticles;
private final ParticleOptions largeExplosionParticles;
private final SoundEvent explosionSound;
@@ -136,6 +138,12 @@ public class Explosion {
}
}
@@ -701,7 +705,7 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
CACHED_RAYS = rayCoords.toDoubleArray();
}
@@ -129,14 +137,14 @@ public class Explosion {
@@ -143,14 +151,14 @@ public class Explosion {
private static final int CHUNK_CACHE_MASK = (1 << CHUNK_CACHE_SHIFT) - 1;
private static final int CHUNK_CACHE_WIDTH = 1 << CHUNK_CACHE_SHIFT;
@@ -719,7 +723,7 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
public static final class ExplosionBlockCache {
@@ -163,7 +171,7 @@ public class Explosion {
@@ -177,7 +185,7 @@ public class Explosion {
private long[] chunkPosCache = null;
private net.minecraft.world.level.chunk.LevelChunk[] chunkCache = null;
@@ -728,18 +732,18 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
final long key, final boolean calculateResistance) {
ExplosionBlockCache ret = this.blockCache.get(key);
if (ret != null) {
@@ -313,7 +321,8 @@ public class Explosion {
@@ -327,7 +335,8 @@ public class Explosion {
}
}
- private float getSeenFraction(final Vec3 source, final Entity target,
+ protected float getSeenFraction(final Vec3 source, final Entity target, // Sakura - protected
+ final @Nullable me.samsuik.sakura.explosion.DensityCache.Density data, // Sakura
final ExplosionBlockCache[] blockCache,
final BlockPos.MutableBlockPos blockPos) {
+ final @Nullable me.samsuik.sakura.explosion.DensityCache.Density data, // Sakura - pass density
final ExplosionBlockCache[] blockCache,
final BlockPos.MutableBlockPos blockPos) {
final AABB boundingBox = target.getBoundingBox();
@@ -351,7 +360,11 @@ public class Explosion {
Math.fma(dz, diffZ, offZ)
@@ -365,7 +374,11 @@ public class Explosion {
Math.fma(dz, diffZ, offZ)
);
- if (!this.clipsAnything(from, source, context, blockCache, blockPos)) {
@@ -751,7 +755,7 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
++missedRays;
}
}
@@ -361,12 +374,72 @@ public class Explosion {
@@ -375,12 +388,70 @@ public class Explosion {
return (float)missedRays / (float)totalRays;
}
// Paper end - optimise collisions
@@ -786,7 +790,7 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
+ blockCache.clear();
+ }
+
+ protected boolean isDestructibleBlock(BlockState state) {
+ protected boolean isDestructibleBlock(@Nullable BlockState state) {
+ if (state == null) {
+ return false;
+ }
@@ -800,16 +804,14 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
+ }
+
+ protected boolean isRegionUnprotected() {
+ // check if there is a plugin cancelling or clearing the block list.
+ // for our use case on factions and cannon servers this is a relatively
+ // sane optimisation, this may not be the case for other servers.
+ // As an optimisation, check if a plugin has cancelled or cleared the blockList.
+ // This is relatively sane on factions and cannon servers, but mileage may vary.
+ if (source != null && level.sakuraConfig().cannons.explosion.optimiseProtectedRegions) {
+ Location location = new Location(level.getWorld(), x, y, z);
+ java.util.ArrayList<org.bukkit.block.Block> blocks = new java.util.ArrayList<>(1);
+ List<org.bukkit.block.Block> blocks = new ObjectArrayList<>(1);
+ blocks.add(location.getBlock());
+ EntityExplodeEvent event = new EntityExplodeEvent(source.getBukkitEntity(), location, blocks, 0.0f);
+ event.callEvent();
+ return !event.isCancelled() && !event.blockList().isEmpty();
+ return event.callEvent() && !event.blockList().isEmpty();
+ }
+
+ return true;
@@ -821,11 +823,11 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
}
- public static float getSeenPercent(Vec3 source, Entity entity) {
+ protected float getSeenPercent(Vec3 source, Entity entity, me.samsuik.sakura.explosion.DensityCache.Density data) { // Sakura - protected
+ protected static float getSeenPercent(Vec3 source, Entity entity, @Nullable me.samsuik.sakura.explosion.DensityCache.Density data) { // Sakura - protected and pass density
AABB axisalignedbb = entity.getBoundingBox();
double d0 = 1.0D / ((axisalignedbb.maxX - axisalignedbb.minX) * 2.0D + 1.0D);
double d1 = 1.0D / ((axisalignedbb.maxY - axisalignedbb.minY) * 2.0D + 1.0D);
@@ -386,7 +459,11 @@ public class Explosion {
@@ -400,7 +471,11 @@ public class Explosion {
double d10 = Mth.lerp(d7, axisalignedbb.minZ, axisalignedbb.maxZ);
Vec3 vec3d1 = new Vec3(d8 + d3, d9, d10 + d4);
@@ -838,12 +840,12 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
++i;
}
@@ -407,7 +484,29 @@ public class Explosion {
@@ -429,7 +504,29 @@ public class Explosion {
return;
}
// CraftBukkit end
+ // Sakura start
+ final ExplosionBlockCache[] blockCache = createBlockCache();
+ ExplosionBlockCache[] blockCache = createBlockCache();
+
+ // block at explosion position
+ int blockX = Mth.floor(x);
@@ -868,7 +870,7 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
Set<BlockPos> set = Sets.newHashSet();
boolean flag = true;
@@ -415,14 +514,7 @@ public class Explosion {
@@ -437,14 +534,7 @@ public class Explosion {
int j;
// Paper start - optimise explosions
@@ -884,7 +886,7 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
// use initial cache value that is most likely to be used: the source position
final ExplosionBlockCache initialCache;
{
@@ -521,10 +613,15 @@ public class Explosion {
@@ -541,10 +631,15 @@ public class Explosion {
}
this.toBlow.addAll(set);
@@ -902,16 +904,16 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
int l = Mth.floor(this.y - (double) f2 - 1.0D);
int i1 = Mth.floor(this.y + (double) f2 + 1.0D);
int j1 = Mth.floor(this.z - (double) f2 - 1.0D);
@@ -574,7 +671,7 @@ public class Explosion {
// Calculate damage separately for each EntityComplexPart
double d7part;
if (list.contains(entityComplexPart) && (d7part = Math.sqrt(entityComplexPart.distanceToSqr(vec3d)) / f2) <= 1.0D) {
- double d13part = (1.0D - d7part) * this.getSeenFraction(vec3d, entityComplexPart, blockCache, blockPos); // Paper - optimise explosions
+ double d13part = (1.0D - d7part) * this.getSeenFraction(vec3d, entityComplexPart, null, blockCache, blockPos); // Sakura // Paper - optimise explosions
entityComplexPart.hurt(this.getDamageSource(), (float) ((int) ((d13part * d13part + d13part) / 2.0D * 7.0D * (double) f2 + 1.0D)));
@@ -591,7 +686,7 @@ 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, getSeenFraction(vec3d, entityComplexPart, blockCache, blockPos))); // Paper - actually optimise explosions
+ entityComplexPart.hurt(this.damageSource, this.damageCalculator.getEntityDamageAmount(this, entity, getSeenFraction(vec3d, entityComplexPart, null, blockCache, blockPos))); // Sakura // Paper - actually optimise explosions
}
}
}
@@ -617,9 +714,7 @@ public class Explosion {
} else {
@@ -635,9 +730,7 @@ public class Explosion {
}
}
@@ -919,23 +921,23 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
- this.chunkPosCache = null; // Paper - optimise explosions
- this.chunkCache = null; // Paper - optimise explosions
+ // Sakura - move up
}
@@ -683,6 +778,12 @@ public class Explosion {
this.toBlow.add(coords);
public void finalizeExplosion(boolean particles) {
@@ -705,6 +798,12 @@ public class Explosion {
if (this.wasCanceled) {
return;
}
+
+ // Sakura start
+ if (!level.paperConfig().environment.optimizeExplosions) {
+ level.densityCache.clear();
+ if (!this.level.paperConfig().environment.optimizeExplosions) {
+ this.level.densityCache.clear();
+ }
+ // Sakura end
+
if (cancelled) {
this.wasCanceled = true;
return;
@@ -850,15 +951,22 @@ public class Explosion {
// CraftBukkit end
objectlistiterator = this.toBlow.iterator();
@@ -851,15 +950,22 @@ public class Explosion {
private BlockInteraction() {}
}
// Paper start - Optimize explosions
@@ -967,29 +969,29 @@ index 1b335111bd9eb90bbda87225b740768705f26193..11ce5591f5f7eb487323e2c828218af2
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 c7defb4555edd792c83ec001c8dfbf604376b190..3e1271d07883f05fff21d0ec6088fe42a579a706 100644
index 37fbba2f6eb32f2806ae1fec90d7be800ba91d49..c63c5c1451d5678ddea0d570ff2628af258490ae 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -235,6 +235,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -238,6 +238,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
// Sakura end
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura
+ public final me.samsuik.sakura.explosion.DensityCache densityCache = new me.samsuik.sakura.explosion.DensityCache();
+ public final me.samsuik.sakura.explosion.DensityCache densityCache = new me.samsuik.sakura.explosion.DensityCache(); // Sakura
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 // Paper - Async-Anti-Xray - Pass executor
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
@@ -1413,7 +1414,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1431,7 +1432,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
}
Explosion.BlockInteraction explosion_effect1 = explosion_effect;
- Explosion explosion = new Explosion(this, entity, damageSource, behavior, x, y, z, power, createFire, explosion_effect1);
- Explosion explosion = new Explosion(this, entity, damageSource, behavior, x, y, z, power, createFire, explosion_effect1, particle, emitterParticle, soundEvent);
+ // Sakura start
+ Explosion explosion;
+
+ if (explosionSourceType == ExplosionInteraction.TNT) {
+ explosion = new me.samsuik.sakura.explosion.SakuraExplosion(this, entity, damageSource, behavior, x, y, z, power, createFire, explosion_effect1);
+ explosion = new me.samsuik.sakura.explosion.SakuraExplosion(this, entity, damageSource, behavior, x, y, z, power, createFire, explosion_effect1, particle, emitterParticle, soundEvent);
+ } else {
+ explosion = new Explosion(this, entity, damageSource, behavior, x, y, z, power, createFire, explosion_effect1);
+ explosion = new Explosion(this, entity, damageSource, behavior, x, y, z, power, createFire, explosion_effect1, particle, emitterParticle, soundEvent);
+ }
+ // Sakura end

View File

@@ -5,10 +5,10 @@ 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 9564477334755756b49fc7bf9f7344912758d47e..ffa4bb17c002a953df4142e353ba9a05b362e3e6 100644
index c9d94d157b4bc52742050d75b3a11b8e2769ec08..dbccada2818004edd0ae220c173c18cc5bc9acd5 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1210,6 +1210,95 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1215,6 +1215,95 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// Paper end - detailed watchdog information
@@ -104,7 +104,7 @@ index 9564477334755756b49fc7bf9f7344912758d47e..ffa4bb17c002a953df4142e353ba9a05
public void move(MoverType movementType, Vec3 movement) {
// Paper start - detailed watchdog information
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
@@ -1587,6 +1676,99 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1592,6 +1681,99 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return offsetFactor;
}
@@ -205,7 +205,7 @@ index 9564477334755756b49fc7bf9f7344912758d47e..ffa4bb17c002a953df4142e353ba9a05
// Paper start - optimise collisions
final boolean xZero = movement.x == 0.0;
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 45e042dc8b875b08f5f09955258913a256371b54..2c1d29c560d1f68456283144ee7342f331705225 100644
index 6662d48f691cf6ab515a3eb64642dcb770d1caa0..2943db8264751920f79ccda40d4bb5a16daa47df 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -201,7 +201,7 @@ public class FallingBlockEntity extends Entity {
@@ -218,10 +218,10 @@ index 45e042dc8b875b08f5f09955258913a256371b54..2c1d29c560d1f68456283144ee7342f3
// Paper start - fix sand duping
if (this.isRemoved()) {
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 919680a42a8362859cd87fb3d87e8ee80e9cd960..f661c6225401dba8bb13edcc72fb919a2c76d675 100644
index 2445bfc0c5604cb0185d240c9448a5c7fefa8784..090f8a5e173f9cafc681ac5c3c2a1ec1371c2245 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -126,7 +126,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -134,7 +134,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
this.addDeltaMovement(0.0D, -0.04D, 0.0D); // Sakura - reduce movement allocations
}

View File

@@ -329,12 +329,12 @@ index d917a19c838ed3d74322abd85e1f737e852b5d7b..1ba10713c85d6f19f075cc267602a04c
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 3e1271d07883f05fff21d0ec6088fe42a579a706..6fca6c3d8200251e24f3df886f17f35179b1f760 100644
index c63c5c1451d5678ddea0d570ff2628af258490ae..a2f8040da7e8baa120e5dcdacb3c5b22f2f2eb46 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -237,6 +237,39 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -240,6 +240,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
public final me.samsuik.sakura.explosion.DensityCache densityCache = new me.samsuik.sakura.explosion.DensityCache();
public final me.samsuik.sakura.explosion.DensityCache densityCache = new me.samsuik.sakura.explosion.DensityCache(); // Sakura
+ // Sakura start - limited get entities
+ public void getLimitedEntities(Entity except, AABB box, Predicate<? super Entity> predicate, List<Entity> into, int limit, int search) {

View File

@@ -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 ffa4bb17c002a953df4142e353ba9a05b362e3e6..a7984107161d74aed3f064df1e2576c39a88c506 100644
index dbccada2818004edd0ae220c173c18cc5bc9acd5..c304338538ee45e2924a630eab10473e95e6c078 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -673,6 +673,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -678,6 +678,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
discard();
}
// Sakura end
@@ -16,7 +16,7 @@ index ffa4bb17c002a953df4142e353ba9a05b362e3e6..a7984107161d74aed3f064df1e2576c3
public boolean isLegacyTrackingEntity = false;
@@ -4178,7 +4179,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -4238,7 +4239,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public boolean isPushedByFluid() {
@@ -26,10 +26,10 @@ index ffa4bb17c002a953df4142e353ba9a05b362e3e6..a7984107161d74aed3f064df1e2576c3
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 9f843b89dc20b91bf7243facee8486d525e4a1b3..0ca488d26b137d553a0b8c96629c1080a1303ca5 100644
index aa4dbf91cf6da329fdcacbde98bb870eb48e8f5c..2732ddfd75ed7cba31ca3def306e68a65e3aaa1e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -548,6 +548,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
@@ -555,6 +555,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return this.entity.isInWater();
}

View File

@@ -5,7 +5,7 @@ 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 2c1d29c560d1f68456283144ee7342f331705225..69f5f03a8e43f1e7370981009fe2376294b7253a 100644
index 2943db8264751920f79ccda40d4bb5a16daa47df..a3ade76d9f7b4355258953bd40d9a36a4dc004fa 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -67,6 +67,7 @@ public class FallingBlockEntity extends Entity {
@@ -38,10 +38,10 @@ index 2c1d29c560d1f68456283144ee7342f331705225..69f5f03a8e43f1e7370981009fe23762
@Override
public void 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 f661c6225401dba8bb13edcc72fb919a2c76d675..3818d07261ce4f276968691ad32a22b88ffe6826 100644
index 090f8a5e173f9cafc681ac5c3c2a1ec1371c2245..7cb8d79e578cc23747e6b89ae4379b7a8daa328e 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -46,6 +46,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -53,6 +53,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
this.yo = y;
this.zo = z;
this.owner = igniter;
@@ -54,7 +54,7 @@ index f661c6225401dba8bb13edcc72fb919a2c76d675..3818d07261ce4f276968691ad32a22b8
}
@Override
@@ -239,7 +245,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -271,7 +277,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
// Paper start - Optional prevent TNT from moving in water
@Override
public boolean isPushedByFluid() {

View File

@@ -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 a7984107161d74aed3f064df1e2576c39a88c506..d4e4b74e153e5445e2319351c5fb8c17d115b26f 100644
index c304338538ee45e2924a630eab10473e95e6c078..4c97c47e00fec68ef2e87bc981ccb811bbff6516 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2180,7 +2180,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -2185,7 +2185,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return this.isInWater() || flag;
}
@@ -18,10 +18,10 @@ index a7984107161d74aed3f064df1e2576c39a88c506..d4e4b74e153e5445e2319351c5fb8c17
if (entity instanceof Boat) {
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 3818d07261ce4f276968691ad32a22b88ffe6826..ae42975b45ab8529de1d67eb74e72e9ef09c4008 100644
index 7cb8d79e578cc23747e6b89ae4379b7a8daa328e..adac2a47b97e8b860e54fbf4fa37bf981c70aadc 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -124,6 +124,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -132,6 +132,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
}
*/
// Sakura end

View File

@@ -5,10 +5,10 @@ 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 a76eb3d051db0229ed088b71c92ff3f131449007..c550014ff6c677a733e98d58dbe9f74fff77dd17 100644
index 45b1a182acf6b2aef40b714d31ca125d8f74619a..b01c09e45bf7452a40a7d9ad4eb1e1da08314d7d 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3547,7 +3547,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3557,7 +3557,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
return;
}
// Paper end - don't run getEntities if we're not going to use its result

View File

@@ -5,10 +5,10 @@ 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 c550014ff6c677a733e98d58dbe9f74fff77dd17..12f8e63e9abc37e24f83662b39265befc8942683 100644
index b01c09e45bf7452a40a7d9ad4eb1e1da08314d7d..558c862f082d4e48c2c0d7ecf900f9354387d32b 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1532,7 +1532,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1539,7 +1539,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
d0 = (Math.random() - Math.random()) * 0.01D;
}
@@ -17,7 +17,7 @@ index c550014ff6c677a733e98d58dbe9f74fff77dd17..12f8e63e9abc37e24f83662b39265bef
if (!flag) {
this.indicateDamage(d0, d1);
}
@@ -1579,7 +1579,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1586,7 +1586,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
protected void blockedByShield(LivingEntity target) {
@@ -26,7 +26,7 @@ index c550014ff6c677a733e98d58dbe9f74fff77dd17..12f8e63e9abc37e24f83662b39265bef
}
private boolean checkTotemDeathProtection(DamageSource source) {
@@ -1898,13 +1898,23 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -1903,13 +1903,23 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
public void knockback(double strength, double x, double z, Entity knockingBackEntity) {
// Paper end - add knockbacking entity parameter
@@ -53,10 +53,10 @@ index c550014ff6c677a733e98d58dbe9f74fff77dd17..12f8e63e9abc37e24f83662b39265bef
Vec3 currentMovement = this.getDeltaMovement();
org.bukkit.util.Vector delta = new org.bukkit.util.Vector(currentMovement.x - vec3d.x, currentMovement.y - vec3d.y, currentMovement.z - vec3d.z);
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 8858aa55d32bda0d16ad602a5de557791c779208..41359c9783e575ead420867f207de55665850004 100644
index c3170384afa8d3bc4b1b428ecea04b1276621136..d0742bbf6f94705e378972e3bc0fab4682f3d78f 100644
--- a/src/main/java/net/minecraft/world/entity/player/Player.java
+++ b/src/main/java/net/minecraft/world/entity/player/Player.java
@@ -188,6 +188,7 @@ public abstract class Player extends LivingEntity {
@@ -183,6 +183,7 @@ public abstract class Player extends LivingEntity {
public boolean affectsSpawning = true;
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET;
// Paper end
@@ -64,7 +64,7 @@ index 8858aa55d32bda0d16ad602a5de557791c779208..41359c9783e575ead420867f207de556
// CraftBukkit start
public boolean fauxSleeping;
@@ -1277,7 +1278,7 @@ public abstract class Player extends LivingEntity {
@@ -1272,7 +1273,7 @@ public abstract class Player extends LivingEntity {
byte b0 = 0;
int i = b0 + EnchantmentHelper.getKnockbackBonus(this);
@@ -73,7 +73,7 @@ index 8858aa55d32bda0d16ad602a5de557791c779208..41359c9783e575ead420867f207de556
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;
@@ -1327,10 +1328,20 @@ public abstract class Player extends LivingEntity {
@@ -1322,10 +1323,20 @@ public abstract class Player extends LivingEntity {
if (flag5) {
if (i > 0) {
@@ -96,7 +96,7 @@ index 8858aa55d32bda0d16ad602a5de557791c779208..41359c9783e575ead420867f207de556
}
this.setDeltaMovement(this.getDeltaMovement().multiply(0.6D, 1.0D, 0.6D));
@@ -1352,7 +1363,7 @@ public abstract class Player extends LivingEntity {
@@ -1347,7 +1358,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

View File

@@ -74,10 +74,10 @@ index 0000000000000000000000000000000000000000..2e11ba36e9e820f17839d696e5d7d876
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index d2b12606c4bd7edec4061f67e79bdedcee147fca..4c2dc25419662c491097a53f2a730b805269da05 100644
index fa6da05e6d33f74bbae986c6b4db3077be432baa..84a0a7ba7340f6379a0db210d7fbffb877d55284 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1582,6 +1582,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1755,6 +1755,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(); // Sakura
@@ -124,10 +124,10 @@ index a8008c7550488be34b51f4280f5569170b1ebd1d..b10cfec6da6dfab89e585c5d4d39ae04
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 11ce5591f5f7eb487323e2c828218af2461fca09..810bbc05dcfaf0e55804ebb86e89f628ad02e478 100644
index 4d052ef2b6d3ebd399e1904d67e973969efc683d..01e1e59db95e1d47cd0dd2c10108934ff54de446 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -198,6 +198,17 @@ public class Explosion {
@@ -212,6 +212,17 @@ public class Explosion {
Optional<Float> resistance = !calculateResistance ? Optional.empty() : this.damageCalculator.getBlockExplosionResistance((Explosion)(Object)this, this.level, pos, blockState, fluidState);
@@ -143,34 +143,34 @@ index 11ce5591f5f7eb487323e2c828218af2461fca09..810bbc05dcfaf0e55804ebb86e89f628
+ // Sakura end
+
ret = new ExplosionBlockCache(
key, pos, blockState, fluidState,
(resistance.orElse(ZERO_RESISTANCE).floatValue() + 0.3f) * 0.3f,
@@ -795,6 +806,16 @@ public class Explosion {
BlockPos blockposition = (BlockPos) objectlistiterator.next();
key, pos, blockState, fluidState,
(resistance.orElse(ZERO_RESISTANCE).floatValue() + 0.3f) * 0.3f,
@@ -812,6 +823,16 @@ public class Explosion {
// CraftBukkit start - TNTPrimeEvent
BlockState iblockdata = this.level.getBlockState(blockposition);
Block block = iblockdata.getBlock();
+ // Sakura start - durable materials
+ if (level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || source instanceof net.minecraft.world.entity.item.PrimedTnt) {
+ me.samsuik.sakura.explosion.durable.DurableMaterial material = level.localConfig().config(blockposition).durableMaterials.get(block);
+ if (this.level.sakuraConfig().cannons.explosion.allowNonTntBreakingDurableBlocks || this.source instanceof net.minecraft.world.entity.item.PrimedTnt) {
+ me.samsuik.sakura.explosion.durable.DurableMaterial material = this.level.localConfig().config(blockposition).durableMaterials.get(block);
+
+ if (material != null && material.durability() >= 0 && !level.durabilityManager.damage(blockposition, material)) {
+ if (material != null && material.durability() >= 0 && !this.level.durabilityManager.damage(blockposition, material)) {
+ objectlistiterator.remove();
+ continue;
+ }
+ }
+ // Sakura end
// CraftBukkit start - TNTPrimeEvent
if (block instanceof net.minecraft.world.level.block.TntBlock) {
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 6fca6c3d8200251e24f3df886f17f35179b1f760..3d133380c70c6ef471dd42280bbd269ef72d2e6d 100644
index a2f8040da7e8baa120e5dcdacb3c5b22f2f2eb46..374d600692975a2e8514e8e99c7fa18599ef8dfc 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -236,6 +236,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -239,6 +239,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
// Sakura end
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura
public final me.samsuik.sakura.explosion.DensityCache densityCache = new me.samsuik.sakura.explosion.DensityCache();
+ public final me.samsuik.sakura.explosion.durable.DurableBlockManager durabilityManager = new me.samsuik.sakura.explosion.durable.DurableBlockManager();
public final me.samsuik.sakura.explosion.DensityCache densityCache = new me.samsuik.sakura.explosion.DensityCache(); // Sakura
+ public final me.samsuik.sakura.explosion.durable.DurableBlockManager durabilityManager = new me.samsuik.sakura.explosion.durable.DurableBlockManager(); // Sakura
// Sakura start - limited get entities
public void getLimitedEntities(Entity except, AABB box, Predicate<? super Entity> predicate, List<Entity> into, int limit, int search) {

View File

@@ -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 4abd9fe2c810057beb9d9d5c732d295325b011d7..45e95e9565b9db018b5d7422189b98517e2daac3 100644
index 01e1e59db95e1d47cd0dd2c10108934ff54de446..eaf260a9661d99f0991fdb5575b79990acfd60f9 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -196,6 +196,12 @@ public class Explosion {
@@ -210,6 +210,12 @@ public class Explosion {
BlockState blockState = chunk.getBlockStateFinal(x, y, z);
FluidState fluidState = blockState.getFluidState();

View File

@@ -341,10 +341,10 @@ index 0000000000000000000000000000000000000000..f9ffc75f3c349c6a1cb614ed925b2e90
+
+}
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index 4c2dc25419662c491097a53f2a730b805269da05..de4a9d68585c767b38f662cf3c06f89e5705d8ec 100644
index 84a0a7ba7340f6379a0db210d7fbffb877d55284..9aeea8521bf209482ac5bda8296e5f25ff35ef49 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -1583,6 +1583,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
@@ -1756,6 +1756,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
worldserver.mergeHistory.expire(currentTickLong); // Sakura - merge cannoning entities
worldserver.densityCache.clear(); // Sakura
worldserver.durabilityManager.expire(currentTickLong); // Sakura
@@ -353,18 +353,18 @@ index 4c2dc25419662c491097a53f2a730b805269da05..de4a9d68585c767b38f662cf3c06f89e
this.isIteratingOverLevels = false; // Paper
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index 3d133380c70c6ef471dd42280bbd269ef72d2e6d..cac37ebd3a73bf3bd53e8de3be06a2b0232c4134 100644
index 374d600692975a2e8514e8e99c7fa18599ef8dfc..09ff77ec8967645df0de253f6e8ee8cb6b998c0d 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -237,6 +237,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -240,6 +240,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
public final me.samsuik.sakura.entity.merge.MergeHistory mergeHistory = new me.samsuik.sakura.entity.merge.MergeHistory(); // Sakura
public final me.samsuik.sakura.explosion.DensityCache densityCache = new me.samsuik.sakura.explosion.DensityCache();
public final me.samsuik.sakura.explosion.durable.DurableBlockManager durabilityManager = new me.samsuik.sakura.explosion.durable.DurableBlockManager();
public final me.samsuik.sakura.explosion.DensityCache densityCache = new me.samsuik.sakura.explosion.DensityCache(); // Sakura
public final me.samsuik.sakura.explosion.durable.DurableBlockManager durabilityManager = new me.samsuik.sakura.explosion.durable.DurableBlockManager(); // Sakura
+ public final me.samsuik.sakura.redstone.RedstoneTracker redstoneTracker = new me.samsuik.sakura.redstone.RedstoneTracker(this); // Sakura
// Sakura start - limited get entities
public void getLimitedEntities(Entity except, AABB box, Predicate<? super Entity> predicate, List<Entity> into, int limit, int search) {
@@ -1018,6 +1019,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -1021,6 +1022,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
} else {
BlockState iblockdata2 = this.getBlockState(pos);
@@ -373,10 +373,10 @@ index 3d133380c70c6ef471dd42280bbd269ef72d2e6d..cac37ebd3a73bf3bd53e8de3be06a2b0
if (iblockdata2 == iblockdata) {
if (iblockdata1 != iblockdata2) {
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 2b054439b7a763d5a3fbb5dbfe197cb9a9a3525c..7eb617150d278f5b40f097cd402d55fd781e0616 100644
index 507be06ad51b7a212e28d3ca6680e0e4b00f4233..82bde0e37971e806b19d17fbf48c663c82399739 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -375,7 +375,15 @@ public class RedStoneWireBlock extends Block {
@@ -382,7 +382,15 @@ public class RedStoneWireBlock extends Block {
}
if (oldPower != i) {
// CraftBukkit end
@@ -392,7 +392,7 @@ index 2b054439b7a763d5a3fbb5dbfe197cb9a9a3525c..7eb617150d278f5b40f097cd402d55fd
world.setBlock(pos, (BlockState) state.setValue(RedStoneWireBlock.POWER, i), 2);
}
@@ -396,8 +404,17 @@ public class RedStoneWireBlock extends Block {
@@ -403,8 +411,17 @@ public class RedStoneWireBlock extends Block {
while (iterator.hasNext()) {
BlockPos blockposition1 = (BlockPos) iterator.next();

View File

@@ -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 eb0351aa12eebcefab1d1d14641fc3c60cbbcab8..92c8cae1709052ec09715b6f27e6b0199762a00e 100644
index a39db702063887cf530f272deaf4f334047cc7d4..bb7a14aa86dfb376a5a83f14cfbd8495eb92cbb4 100644
--- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java
@@ -559,6 +559,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
@@ -578,6 +578,17 @@ public class ItemEntity extends Entity implements TraceableEntity {
}

View File

@@ -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 956d05e2ae59978ea9623ca0e167c0afe0b87306..b6293f2f39520145abbd1bc5f8a4f6f762b19f00 100644
index 5af48151159135b869ec4753bbcf79dd257c1570..0b807081ad85ea91ecf397f6c29c6910010f8638 100644
--- a/src/main/java/net/minecraft/world/entity/Mob.java
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
@@ -896,7 +896,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
@@ -897,7 +897,7 @@ public abstract class Mob extends LivingEntity implements Targeting {
protected final void serverAiStep() {
++this.noActionTime;
// Paper start - Allow nerfed mobs to jump and float

View File

@@ -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 2e787079956c863ffd626acc77323a955e7d9871..6f1f5a03441e156b9c2cfa2c25db0aef6a7db66c 100644
index eaf260a9661d99f0991fdb5575b79990acfd60f9..d13ba91f2c633517d46f59eaa938fd81d441fedb 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -560,7 +560,7 @@ public class Explosion {
@@ -580,7 +580,7 @@ public class Explosion {
double d2 = CACHED_RAYS[ray + 2];
ray += 3;
// Paper end - optimise explosions

View File

@@ -5,10 +5,10 @@ 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 923dd09399cd85cdb31e129a03affb9403feb181..f25b15949f100b01e44a23832bc900d84f6cf1f1 100644
index adac2a47b97e8b860e54fbf4fa37bf981c70aadc..545c15a5bc92450de75e931794c2289da7004617 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -140,7 +140,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -148,7 +148,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@Override
public void tick() {

View File

@@ -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 12f8e63e9abc37e24f83662b39265befc8942683..53f84d80e8436837c5fd0bc79e559caf9154e6ed 100644
index 558c862f082d4e48c2c0d7ecf900f9354387d32b..7728492fd3623670482f4ca89e0934e7bcb972e1 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3492,7 +3492,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3502,7 +3502,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
// Paper end

View File

@@ -36,7 +36,7 @@ index ae2eede559bd9fe7e500ce180f2ac102a95d3856..7ced5ae768cbea9ee0a7bab2365fbaef
if (xSmaller && z != 0.0) {
z = performAABBCollisionsZ(axisalignedbb, z, aabbs);
diff --git a/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java b/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java
index a605a56ec780f871362fc9abc9bb315572ef254b..19713d18421f5bdd20fa362b4cc4eeb68289ff23 100644
index 90540b3c8c695e24419b0e0460f0c42f949142b0..a41a831d0e8340312e7c0abeb5da35bf6a8a9d65 100644
--- a/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java
+++ b/src/main/java/me/samsuik/sakura/explosion/SakuraExplosion.java
@@ -244,10 +244,17 @@ public class SakuraExplosion extends Explosion {
@@ -78,10 +78,10 @@ index a605a56ec780f871362fc9abc9bb315572ef254b..19713d18421f5bdd20fa362b4cc4eeb6
x /= distance;
y /= distance;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd77fedc3d3 100644
index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8146e0169 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -377,7 +377,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -378,7 +378,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
private final double[] pistonDeltas;
private long pistonDeltasGameTime;
private EntityDimensions dimensions;
@@ -90,7 +90,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
public boolean isInPowderSnow;
public boolean wasInPowderSnow;
public boolean wasOnFire;
@@ -674,6 +674,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -679,6 +679,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// Sakura end
public boolean pushedByFluid = true; // Sakura
@@ -104,7 +104,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
public boolean isLegacyTrackingEntity = false;
@@ -1156,7 +1163,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1161,7 +1168,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
protected void checkSupportingBlock(boolean onGround, @Nullable Vec3 movement) {
@@ -113,7 +113,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
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);
@@ -1218,7 +1225,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1223,7 +1230,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
@@ -122,7 +122,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) {
return;
@@ -1236,10 +1243,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1241,10 +1248,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Vec3 vec3d1 = this.collideScan(movement);
double d0 = vec3d1.lengthSqr();
@@ -135,7 +135,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
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) {
@@ -1275,6 +1282,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1280,6 +1287,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (this.horizontalCollision) {
Vec3 vec3d2 = this.getDeltaMovement();
@@ -148,7 +148,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
}
@@ -1315,7 +1328,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1320,7 +1333,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
this.wasOnFire = this.isOnFire();
@@ -157,7 +157,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper
this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper
movement = this.limitPistonMovement(movement);
@@ -1342,8 +1355,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1347,8 +1360,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Vec3 vec3d1 = this.collide(movement);
double d0 = vec3d1.lengthSqr();
@@ -168,7 +168,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
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) {
@@ -1379,6 +1392,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1384,6 +1397,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (this.horizontalCollision) {
Vec3 vec3d2 = this.getDeltaMovement();
@@ -181,7 +181,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
}
@@ -1702,7 +1721,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1707,7 +1726,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
double y = movement.y;
double z = movement.z;
@@ -193,7 +193,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
if (y != 0.0) {
y = scanY(currBoundingBox, y, voxelList, bbList);
@@ -1826,7 +1848,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1831,7 +1853,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return movement;
}
@@ -202,7 +202,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
if (stepHeight > 0.0
&& (onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0))
@@ -1942,8 +1964,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -1947,8 +1969,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
protected void checkInsideBlocks() {
AABB axisalignedbb = this.getBoundingBox();
@@ -217,7 +217,7 @@ index d4e4b74e153e5445e2319351c5fb8c17d115b26f..2530eae662d8f423e62f4b237d23bbd7
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 bf52aafe542ca735181e461d1f9cbc39b8d88220..87ef8f4953c7d9fddfc9ddbdb027e76145b645c8 100644
index 0f1c9eb07c19dd0926521418390855f4bc1bc399..12eed2d1972de15e4d4b953517d47f2b567d3866 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -89,6 +89,8 @@ public class FallingBlockEntity extends Entity {
@@ -366,10 +366,10 @@ index bf52aafe542ca735181e461d1f9cbc39b8d88220..87ef8f4953c7d9fddfc9ddbdb027e761
}
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 16560ef566d3b37e2916be2bf96809556c8893ca..2fbe1da39e9176beededfb5a79e41f1f91bde5cd 100644
index 545c15a5bc92450de75e931794c2289da7004617..5010c994dae5aa189b2c02f9b9fc9715cac3f9a4 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,13 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -59,6 +59,13 @@ public class PrimedTnt extends Entity implements TraceableEntity {
case Y -> multiplyDeltaMovement(0, 1, 0);
}
// Sakura end
@@ -383,7 +383,7 @@ index 16560ef566d3b37e2916be2bf96809556c8893ca..2fbe1da39e9176beededfb5a79e41f1f
}
@Override
@@ -137,12 +144,30 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -145,12 +152,30 @@ public class PrimedTnt extends Entity implements TraceableEntity {
}
}
// Sakura end
@@ -415,7 +415,7 @@ index 16560ef566d3b37e2916be2bf96809556c8893ca..2fbe1da39e9176beededfb5a79e41f1f
}
this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura
@@ -152,15 +177,18 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -160,15 +185,18 @@ public class PrimedTnt extends Entity implements TraceableEntity {
return;
}
// Paper end
@@ -437,7 +437,7 @@ index 16560ef566d3b37e2916be2bf96809556c8893ca..2fbe1da39e9176beededfb5a79e41f1f
// 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.respawn(); // Sakura
@@ -213,7 +241,10 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -221,7 +249,10 @@ public class PrimedTnt extends Entity implements TraceableEntity {
ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent((org.bukkit.entity.Explosive)this.getBukkitEntity());
if (!event.isCancelled()) {
@@ -449,7 +449,7 @@ index 16560ef566d3b37e2916be2bf96809556c8893ca..2fbe1da39e9176beededfb5a79e41f1f
}
// CraftBukkit end
}
@@ -258,7 +289,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -290,7 +321,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
// Paper start - Optional prevent TNT from moving in water
@Override
public boolean isPushedByFluid() {
@@ -459,26 +459,26 @@ index 16560ef566d3b37e2916be2bf96809556c8893ca..2fbe1da39e9176beededfb5a79e41f1f
// Paper end
}
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
index 3f4263d4e118e58e07c992c3128030d255672320..c94e2bf305437b88f82dbb8ab105cfbf5dec01f8 100644
index d13ba91f2c633517d46f59eaa938fd81d441fedb..7bef41c62d6c96062532233c80b96d6e65a523c8 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -69,6 +69,7 @@ public class Explosion {
private final ObjectArrayList<BlockPos> toBlow;
private final Map<Player, Vec3> hitPlayers;
public boolean wasCanceled = false; // CraftBukkit - add field
@@ -74,6 +74,7 @@ public class Explosion {
public boolean wasCanceled = false;
public float yield;
// CraftBukkit end
+ protected final me.samsuik.sakura.physics.PhysicsVersion physics; // Sakura - physics version
public Explosion(Level world, @Nullable Entity entity, double x, double y, double z, float power, List<BlockPos> affectedBlocks) {
this(world, entity, x, y, z, power, false, Explosion.BlockInteraction.DESTROY_WITH_DECAY, affectedBlocks);
@@ -97,6 +98,7 @@ public class Explosion {
this.blockInteraction = destructionType;
this.damageSource = damageSource == null ? world.damageSources().explosion(this) : damageSource;
this.damageCalculator = behavior == null ? this.makeDamageCalculator(entity) : behavior;
public static DamageSource getDefaultDamageSource(Level world, @Nullable Entity source) {
return world.damageSources().explosion(source, Explosion.getIndirectSourceEntityInternal(source));
@@ -111,6 +112,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
+ this.physics = entity != null ? entity.physics() : world.localConfig().config(BlockPos.containing(x, y, z)).physicsVersion; // Sakura
}
// Paper start - optimise collisions
@@ -477,9 +479,17 @@ public class Explosion {
@@ -489,9 +491,17 @@ public class Explosion {
Vec3 vec3d1 = new Vec3(d8 + d3, d9, d10 + d4);
// Sakura start
@@ -488,17 +488,17 @@ index 3f4263d4e118e58e07c992c3128030d255672320..c94e2bf305437b88f82dbb8ab105cfbf
- } else if (entity.level().clip(new ClipContext(vec3d1, source, ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getType() == HitResult.Type.MISS) {
+ hitResult = data.density() == 1.0 ? net.minecraft.world.phys.HitResult.Type.MISS : net.minecraft.world.phys.HitResult.Type.BLOCK;
+ } else {
+ if (this.physics.afterOrEqual(1_14_0)) {
+ if (entity.physics().afterOrEqual(1_14_0)) {
+ hitResult = entity.level().rayTrace(vec3d1, source);
+ } else {
+ hitResult = entity.level().clip(new ClipContext(vec3d1, source, this.physics.afterOrEqual(1_16_0) ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getType();
+ hitResult = entity.level().clip(new ClipContext(vec3d1, source, entity.physics().afterOrEqual(1_16_0) ? ClipContext.Block.COLLIDER : ClipContext.Block.OUTLINE, ClipContext.Fluid.NONE, entity)).getType();
+ }
+ }
+ if (hitResult == net.minecraft.world.phys.HitResult.Type.MISS) {
// Sakura end
++i;
}
@@ -585,6 +595,10 @@ public class Explosion {
@@ -605,6 +615,10 @@ public class Explosion {
}
if (cachedBlock.outOfWorld) {
@@ -509,7 +509,7 @@ index 3f4263d4e118e58e07c992c3128030d255672320..c94e2bf305437b88f82dbb8ab105cfbf
break;
}
@@ -657,10 +671,17 @@ public class Explosion {
@@ -675,10 +689,17 @@ public class Explosion {
if (d7 <= 1.0D) {
double d8 = entity.getX() - this.x;
@@ -528,7 +528,7 @@ index 3f4263d4e118e58e07c992c3128030d255672320..c94e2bf305437b88f82dbb8ab105cfbf
if (d11 != 0.0D) {
d8 /= d11;
d9 /= d11;
@@ -987,7 +1008,14 @@ public class Explosion {
@@ -986,7 +1007,14 @@ public class Explosion {
return data.density();
}
@@ -545,10 +545,10 @@ index 3f4263d4e118e58e07c992c3128030d255672320..c94e2bf305437b88f82dbb8ab105cfbf
if (data == null || !data.isExpandable() && (blockDensity == 0.0f || blockDensity == 1.0f)) {
level.densityCache.createCache(key, entity, vec3d, blockDensity);
diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java
index cac37ebd3a73bf3bd53e8de3be06a2b0232c4134..ebdfe421b8e3ee40350b9b717154b77c3e391a8a 100644
index 09ff77ec8967645df0de253f6e8ee8cb6b998c0d..5afbdbd07afc671c3c6db491a713abfa467fffa3 100644
--- a/src/main/java/net/minecraft/world/level/Level.java
+++ b/src/main/java/net/minecraft/world/level/Level.java
@@ -271,6 +271,205 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
@@ -274,6 +274,205 @@ public abstract class Level implements LevelAccessor, AutoCloseable {
return this.getLimitedEntities(except, box, net.minecraft.world.entity.EntitySelector.NO_SPECTATORS, limit, search);
}
// Sakura end
@@ -755,10 +755,10 @@ index cac37ebd3a73bf3bd53e8de3be06a2b0232c4134..ebdfe421b8e3ee40350b9b717154b77c
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 // Paper - Async-Anti-Xray - Pass executor
this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.PrimaryLevelData) worlddatamutable).getLevelName()); // Spigot
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 631ac128aebcd6388482adb3b1f03673281eaf95..b200e0ea698662d2fab45467bd26bd31c91e18d8 100644
index 1079a99d6a6c9fba36414a863e1454bb2a7f298a..4ee105548df2a730f192d4b511a399d129824df6 100644
--- a/src/main/java/net/minecraft/world/level/block/FallingBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/FallingBlock.java
@@ -31,6 +31,15 @@ public class FallingBlock extends Block implements Fallable {
@@ -35,6 +35,15 @@ public abstract class FallingBlock extends Block implements Fallable {
return super.updateShape(state, direction, neighborState, world, pos, neighborPos);
}
@@ -775,10 +775,10 @@ index 631ac128aebcd6388482adb3b1f03673281eaf95..b200e0ea698662d2fab45467bd26bd31
public 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/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
index 4a1830f85f47014da63e4584f411d13f0f0cd8b3..727a2fc45de4995cafb371bde43db483a760fa6e 100644
index 2bd097203f1e92d3fc343f91dc37220e09dd5066..2fe44dae063eb0cd7d4813fb6b2937830d432e51 100644
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
@@ -160,8 +160,26 @@ public class LiquidBlock extends Block implements BucketPickup {
@@ -192,8 +192,26 @@ public class LiquidBlock extends Block implements BucketPickup {
BlockPos blockposition1 = pos.relative(enumdirection.getOpposite());
if (world.getFluidState(blockposition1).is(FluidTags.WATER)) {
@@ -808,10 +808,10 @@ index 4a1830f85f47014da63e4584f411d13f0f0cd8b3..727a2fc45de4995cafb371bde43db483
if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(world, pos, block.defaultBlockState())) {
this.fizz(world, pos);
diff --git a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java b/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java
index e941a4ce35c1bcc84836d04fb97cb1e7f292ae42..ff53e0e47da66ba99e79d1de0c04437a370577f9 100644
index d3d1ad7901411574b85b0febd1c7ddaa8ad7c9f4..cc2c601032b2a2d94aa74cc3ad7169c202b354ab 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/MovingPistonBlock.java
@@ -103,6 +103,17 @@ public class MovingPistonBlock extends BaseEntityBlock {
@@ -111,6 +111,17 @@ public class MovingPistonBlock extends BaseEntityBlock {
@Override
public VoxelShape getCollisionShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) {
PistonMovingBlockEntity pistonMovingBlockEntity = this.getBlockEntity(world, pos);
@@ -830,10 +830,10 @@ index e941a4ce35c1bcc84836d04fb97cb1e7f292ae42..ff53e0e47da66ba99e79d1de0c04437a
}
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
index cdcf11fb9e4690d74b30fe0ade842d6574464624..0ad6230fc291008a8b34da8623b1a266d8c3b42d 100644
index b9025fcc6a4db9533cdc42034c9e77323d0785fa..fd7563a8b6ab8165c1ba7b4959a3bf9369d20e75 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonBaseBlock.java
@@ -157,6 +157,11 @@ public class PistonBaseBlock extends DirectionalBlock {
@@ -170,6 +170,11 @@ public class PistonBaseBlock extends DirectionalBlock {
// }
// PAIL: checkME - what happened to setTypeAndData?
// CraftBukkit end
@@ -846,10 +846,10 @@ index cdcf11fb9e4690d74b30fe0ade842d6574464624..0ad6230fc291008a8b34da8623b1a266
}
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java b/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java
index 6091e3c3adbcc92c9ca438c301a99f646e3cb549..df6e859688c5b45a541b11f2046395474c083c1b 100644
index 5301095fa3baac1bde3767153ee2343026596688..1ef830d5e34f25c08d53d693db99a6eb641ebbe5 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonHeadBlock.java
@@ -132,6 +132,11 @@ public class PistonHeadBlock extends DirectionalBlock {
@@ -139,6 +139,11 @@ public class PistonHeadBlock extends DirectionalBlock {
@Override
public boolean canSurvive(BlockState state, LevelReader world, BlockPos pos) {
BlockState blockState = world.getBlockState(pos.relative(state.getValue(FACING).getOpposite()));
@@ -861,7 +861,7 @@ index 6091e3c3adbcc92c9ca438c301a99f646e3cb549..df6e859688c5b45a541b11f204639547
return this.isFittingBase(state, blockState) || blockState.is(Blocks.MOVING_PISTON) && blockState.getValue(FACING) == state.getValue(FACING);
}
@@ -139,6 +144,10 @@ public class PistonHeadBlock extends DirectionalBlock {
@@ -146,6 +151,10 @@ public class PistonHeadBlock extends DirectionalBlock {
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
if (state.canSurvive(world, pos)) {
world.neighborChanged(pos.relative(state.getValue(FACING).getOpposite()), sourceBlock, sourcePos);

View File

@@ -5,7 +5,7 @@ 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 277555a26e8281dd1a626e572794b08cf51d00c5..8e48ad2155e7a1e8faa9781e85e2da0a6dc96e6c 100644
index aa0f09a18ea781e027ea70928b30d3e93061120f..3dafde37bcddd81cbe7a7ba938db5b1cbe14a42f 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -195,7 +195,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
@@ -18,10 +18,10 @@ index 277555a26e8281dd1a626e572794b08cf51d00c5..8e48ad2155e7a1e8faa9781e85e2da0a
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 04089e6f7d6e3d532b00585870283922b6be5246..2ed90ce1e309db9cee8e9cd2b170ea0fc194a052 100644
index 4ab6997dad5b112f5105f786a6cee78c6c5667e8..c7dd921ab70ac53559208c58fbf9dec991b1f26b 100644
--- a/src/main/java/net/minecraft/world/level/block/IceBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/IceBlock.java
@@ -33,7 +33,7 @@ public class IceBlock extends HalfTransparentBlock {
@@ -41,7 +41,7 @@ public class IceBlock extends HalfTransparentBlock {
public void afterDestroy(Level world, BlockPos pos, ItemStack tool) {
// Paper end
if (EnchantmentHelper.getItemEnchantmentLevel(Enchantments.SILK_TOUCH, tool) == 0) {
@@ -30,7 +30,7 @@ index 04089e6f7d6e3d532b00585870283922b6be5246..2ed90ce1e309db9cee8e9cd2b170ea0f
world.removeBlock(pos, false);
return;
}
@@ -61,7 +61,7 @@ public class IceBlock extends HalfTransparentBlock {
@@ -69,7 +69,7 @@ public class IceBlock extends HalfTransparentBlock {
return;
}
// CraftBukkit end

View File

@@ -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 c94e2bf305437b88f82dbb8ab105cfbf5dec01f8..f1b260cc62e6c955ad2fa72c779afc3d84b92e6b 100644
index 7bef41c62d6c96062532233c80b96d6e65a523c8..505ccb379c074cfe87a47523ecfe048cbb89b55e 100644
--- a/src/main/java/net/minecraft/world/level/Explosion.java
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
@@ -214,6 +214,10 @@ public class Explosion {
@@ -228,6 +228,10 @@ 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)) {
resistance = Optional.of(material.resistance());
}
@@ -19,7 +19,7 @@ index c94e2bf305437b88f82dbb8ab105cfbf5dec01f8..f1b260cc62e6c955ad2fa72c779afc3d
}
// Sakura end
@@ -429,6 +433,12 @@ public class Explosion {
@@ -443,6 +447,12 @@ public class Explosion {
return false;
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Disable bubble columns affecting cannon entities
diff --git a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
index ed36a378b79f62c3dce3da637a337595415f14ac..16f99b775957101883d91de82700d712f4eaacb9 100644
index 115506fceb9a406e844880fb523d2ff09a66cf7b..c55202aa366869dc34ef11a7786acdc11cef183d 100644
--- a/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/BubbleColumnBlock.java
@@ -41,6 +41,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
@@ -48,6 +48,7 @@ public class BubbleColumnBlock extends Block implements BucketPickup {
@Override
public void entityInside(BlockState state, Level world, BlockPos pos, Entity entity) {
if (!new io.papermc.paper.event.entity.EntityInsideBlockEvent(entity.getBukkitEntity(), org.bukkit.craftbukkit.block.CraftBlock.at(world, pos)).callEvent()) { return; } // Paper

View File

@@ -59,10 +59,10 @@ index 7ced5ae768cbea9ee0a7bab2365fbaef1a37d9bd..310ad76abcb263fbb067270f52200745
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 2530eae662d8f423e62f4b237d23bbd77fedc3d3..eb8c83e336c4672376796fd6cba6436035202d04 100644
index 7e00e47fe01b996bf6a2f16dc4998ab8146e0169..750dbb959a0cf91e364ba52fbc69dce20260b1af 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -543,6 +543,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
@@ -548,6 +548,14 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
flags |= io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_LOAD_CHUNKS | io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_ADD_TICKET;
}

View File

@@ -5,10 +5,10 @@ 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 7eb617150d278f5b40f097cd402d55fd781e0616..73199366579f8816165b57b1ce7bdc95935b8066 100644
index 82bde0e37971e806b19d17fbf48c663c82399739..8a2c9948aea1203c209948bdd3653557b1e57b5c 100644
--- a/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/RedStoneWireBlock.java
@@ -262,7 +262,7 @@ public class RedStoneWireBlock extends Block {
@@ -269,7 +269,7 @@ public class RedStoneWireBlock extends Block {
* Note: Added 'source' argument so as to help determine direction of information flow
*/
private void updateSurroundingRedstone(Level worldIn, BlockPos pos, BlockState state, BlockPos source) {
@@ -17,7 +17,7 @@ index 7eb617150d278f5b40f097cd402d55fd781e0616..73199366579f8816165b57b1ce7bdc95
turbo.updateSurroundingRedstone(worldIn, pos, state, source);
return;
}
@@ -286,7 +286,7 @@ public class RedStoneWireBlock extends Block {
@@ -293,7 +293,7 @@ public class RedStoneWireBlock extends Block {
int k = worldIn.getBestNeighborSignal(pos1);
this.shouldSignal = true;
@@ -26,7 +26,7 @@ index 7eb617150d278f5b40f097cd402d55fd781e0616..73199366579f8816165b57b1ce7bdc95
// This code is totally redundant to if statements just below the loop.
if (k > 0 && k > j - 1) {
j = k;
@@ -300,7 +300,7 @@ public class RedStoneWireBlock extends Block {
@@ -307,7 +307,7 @@ public class RedStoneWireBlock extends Block {
// redstone wire will be set to 'k'. If 'k' is already 15, then nothing inside the
// following loop can affect the power level of the wire. Therefore, the loop is
// skipped if k is already 15.
@@ -35,7 +35,7 @@ index 7eb617150d278f5b40f097cd402d55fd781e0616..73199366579f8816165b57b1ce7bdc95
for (Direction enumfacing : Direction.Plane.HORIZONTAL) {
BlockPos blockpos = pos1.relative(enumfacing);
boolean flag = blockpos.getX() != pos2.getX() || blockpos.getZ() != pos2.getZ();
@@ -319,7 +319,7 @@ public class RedStoneWireBlock extends Block {
@@ -326,7 +326,7 @@ public class RedStoneWireBlock extends Block {
}
}
@@ -44,7 +44,7 @@ index 7eb617150d278f5b40f097cd402d55fd781e0616..73199366579f8816165b57b1ce7bdc95
// The old code would decrement the wire value only by 1 at a time.
if (l > j) {
j = l - 1;
@@ -472,7 +472,7 @@ public class RedStoneWireBlock extends Block {
@@ -479,7 +479,7 @@ public class RedStoneWireBlock extends Block {
public void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) {
if (!oldState.is(state.getBlock()) && !world.isClientSide) {
// Paper start - optimize redstone - replace call to updatePowerStrength
@@ -53,7 +53,7 @@ index 7eb617150d278f5b40f097cd402d55fd781e0616..73199366579f8816165b57b1ce7bdc95
world.getWireHandler().onWireAdded(pos); // Alternate Current
} else {
this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
@@ -505,7 +505,7 @@ public class RedStoneWireBlock extends Block {
@@ -512,7 +512,7 @@ public class RedStoneWireBlock extends Block {
}
// Paper start - optimize redstone - replace call to updatePowerStrength
@@ -62,7 +62,7 @@ index 7eb617150d278f5b40f097cd402d55fd781e0616..73199366579f8816165b57b1ce7bdc95
world.getWireHandler().onWireRemoved(pos, state); // Alternate Current
} else {
this.updateSurroundingRedstone(world, pos, state, null); // vanilla/Eigencraft
@@ -546,7 +546,7 @@ public class RedStoneWireBlock extends Block {
@@ -553,7 +553,7 @@ public class RedStoneWireBlock extends Block {
if (!world.isClientSide) {
// Paper start - optimize redstone (Alternate Current)
// Alternate Current handles breaking of redstone wires in the WireHandler.

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add option for legacy lava block formation
diff --git a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
index 727a2fc45de4995cafb371bde43db483a760fa6e..f17bdbb56461f3adb409bc121d73b461227004dd 100644
index 2fe44dae063eb0cd7d4813fb6b2937830d432e51..aaac136acbef15a1925b4b6e8da7bfc4f75360de 100644
--- a/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
+++ b/src/main/java/net/minecraft/world/level/block/LiquidBlock.java
@@ -167,7 +167,15 @@ public class LiquidBlock extends Block implements BucketPickup {
@@ -199,7 +199,15 @@ public class LiquidBlock extends Block implements BucketPickup {
if (fluidState.isSource()) {
block = Blocks.OBSIDIAN;
} else {