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

Updated Upstream (Paper 1.21.6)

Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@a24f9b2 1.21.6 dev
PaperMC/Paper@457a0a6 Bump version string and protocol version to 1.21.6 release
PaperMC/Paper@245b547 Update base to 1.21.6
PaperMC/Paper@b28d77b Update Moonrise to 1.21.6
PaperMC/Paper@8318dcb Update DataConverter to 1.21.6-rc1
PaperMC/Paper@d2b1158 Set correct world access on BSL snapshots
PaperMC/Paper@023e6c2 Ensure waypoints are per world
PaperMC/Paper@40d5d31 Fix recursively converting JSON Text Components
PaperMC/Paper@1fcc416 Implement FeatureHooks#isChunkSent for Moonrise chunk system
PaperMC/Paper@e4d7178 Implement WaypointTransmitter#isChunkVisible
PaperMC/Paper@8980ead Directly walk text component after converting from JSON
PaperMC/Paper@5613ed6 Provide env environment variable and copy spigots sys prop for overriding default repository
PaperMC/Paper@62b7f86 Avoid and discourage use of Maven Central as a CDN (#12689)
PaperMC/Paper@f5534cb [ci skip] Run generators (#12691)
PaperMC/Paper@4781d28 Re-add Log4j Javadocs (#12693)
PaperMC/Paper@74fbcce Check type of Material in get/set stats (#12607)
PaperMC/Paper@4b3f967 Improve Fix MC-44654 (#12703)
PaperMC/Paper@a7dd263 Enable spigot obfuscation support (#12695)
PaperMC/Paper@6a51c44 Cleanup Primed TNT Fix (#12704)
PaperMC/Paper@839c6a1 Fix #11169 (#12706)
PaperMC/Paper@c77d5f9 Fix MC-297591
PaperMC/Paper@219f86e Implement chunk unload delay config option
PaperMC/Paper@e4eb69b Do not allow ticket level decreases to be processed asynchronously
PaperMC/Paper@71b0c76 Adds support for vanilla negative explosions (#12705)
PaperMC/Paper@3750927 [ci skip] Fix PermissionManager#clearPermissions() docs bad wording (#12657)
PaperMC/Paper@d61a51e Add ItemType#getBurnDuration() (#12604)
PaperMC/Paper@29fc853 Allow empty paths in namespaced keys (#12687)
PaperMC/Paper@4419afb fix: Safely handle nanosecond overflow in ClickCallback (#12686)
PaperMC/Paper@5652882 Add `isProxyEnabled` method to ServerConfiguration (#12664)
PaperMC/Paper@c0dda0e Add `isForceDefaultGameMode` method (#12673)
PaperMC/Paper@e714de6 Fix excess slot updates
PaperMC/Paper@6d0821d [ci skip] Fix docs for Spawner class and cleanup (#12710)
PaperMC/Paper@cceffe3 Release ItemType and BlockType (#12708)
PaperMC/Paper@186e9e3 Relocate CommandMap#registerServerAliases() call to after lifecycle events have been run (#12601)
PaperMC/Paper@5edcf6d Cleanup/command dispatching (#12713)
PaperMC/Paper@803baf0 Support hidden entities in Waypoints (#12715)
PaperMC/Paper@1814d8b build: publish to fill (#12717)
PaperMC/Paper@e454fef Add support for private constructors in plugin main classes (#12652)
PaperMC/Paper@d0e808f Move player to correct position in vehicle move packet handler
PaperMC/Paper@46b4b0b Improve keepalive ping system
PaperMC/Paper@38c1ddb Add and use FeatureHooks.getAllEntities
PaperMC/Paper@2f083ac Ensure player entity schedulers are ticked when they are dead
PaperMC/Paper@7c90c7c Optimise EntityScheduler ticking
PaperMC/Paper@aa6ee44 Re-add global region scheduler tick erroneously removed in last commit
PaperMC/Paper@d7510ef Fix #12722 (#12726)
PaperMC/Paper@0caf75f Fix #12721 (#12725)
PaperMC/Paper@bee2879 Adventure 4.23.0 (#12690)
PaperMC/Paper@692e93a Fix MC-299110
PaperMC/Paper@ea10fa4 Don't mutate the position of Items for MC-4 Fix (#12702)
PaperMC/Paper@aa6cd74 Remove unnecesary item check for ServerboundPlayerActionPacket RELEASE_USE_ITEM (#12668)
PaperMC/Paper@c9e89f4 Expose arrow velocity in EntityShootBowEvent for mobs (#12688)
PaperMC/Paper@7ec3174 Jump out of experimental phase
PaperMC/Paper@4e1a255 Update try catch for command handling
This commit is contained in:
Samsuik
2025-06-26 14:47:49 +01:00
parent d6e9d03a3b
commit 991f961f38
61 changed files with 573 additions and 620 deletions

View File

@@ -1,8 +1,8 @@
group=me.samsuik.sakura group=me.samsuik.sakura
version=1.21.5-R0.1-SNAPSHOT version=1.21.6-R0.1-SNAPSHOT
mcVersion=1.21.5 mcVersion=1.21.6
paperRef=a1b30587d9d5a5d9bf1530f7d1e289f2e29991b6 paperRef=4e1a2555be7ff1e6960714ee7fbabc13fa25d4c2
org.gradle.jvmargs=-Xmx2G org.gradle.jvmargs=-Xmx2G
org.gradle.vfs.watch=false org.gradle.vfs.watch=false

View File

@@ -19,6 +19,7 @@ public enum PhysicsVersion {
v1_20("1.20", 1_20_0), v1_20("1.20", 1_20_0),
v1_21_2("1.21.2", 1_21_2), v1_21_2("1.21.2", 1_21_2),
v1_21_5("1.21.5", 1_21_5), v1_21_5("1.21.5", 1_21_5),
v1_21_6("1.21.6", 1_21_6),
LATEST("latest", 9_99_9); // latest version LATEST("latest", 9_99_9); // latest version
private final String friendlyName; private final String friendlyName;

View File

@@ -1,14 +1,14 @@
--- a/paper-server/build.gradle.kts --- a/paper-server/build.gradle.kts
+++ b/paper-server/build.gradle.kts +++ b/paper-server/build.gradle.kts
@@ -13,6 +_,7 @@ @@ -15,6 +_,7 @@
} }
val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/"
+val serverBrand = rootProject.name +val serverBrand = rootProject.name
dependencies { dependencies {
mache("io.papermc:mache:1.21.5+build.2") mache("io.papermc:mache:1.21.6+build.1")
@@ -24,6 +_,17 @@ @@ -26,6 +_,17 @@
minecraftVersion = providers.gradleProperty("mcVersion") minecraftVersion = providers.gradleProperty("mcVersion")
gitFilePatches = false gitFilePatches = false
@@ -23,10 +23,10 @@
+ +
+ activeFork = fork + activeFork = fork
+ +
//updatingMinecraft { spigot {
// oldPaperCommit = "f4f275519f7c1fbe9db173b7144a4fe81440e365" enabled = true
//} buildDataRef = "281ac0de7a76d808753ede97d11b034bc801b63d"
@@ -108,7 +_,20 @@ @@ -107,7 +_,20 @@
} }
} }
@@ -48,7 +48,7 @@
configurations.named(log4jPlugins.compileClasspathConfigurationName) { configurations.named(log4jPlugins.compileClasspathConfigurationName) {
extendsFrom(configurations.compileClasspath.get()) extendsFrom(configurations.compileClasspath.get())
} }
@@ -130,7 +_,7 @@ @@ -129,7 +_,7 @@
} }
dependencies { dependencies {
@@ -57,7 +57,7 @@
implementation("ca.spottedleaf:concurrentutil:0.0.3") implementation("ca.spottedleaf:concurrentutil:0.0.3")
implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+
implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21
@@ -213,7 +_,7 @@ @@ -212,7 +_,7 @@
"Specification-Version" to project.version, "Specification-Version" to project.version,
"Specification-Vendor" to "Paper Team", "Specification-Vendor" to "Paper Team",
"Brand-Id" to "papermc:paper", "Brand-Id" to "papermc:paper",
@@ -66,7 +66,7 @@
"Build-Number" to (build ?: ""), "Build-Number" to (build ?: ""),
"Build-Time" to buildTime.toString(), "Build-Time" to buildTime.toString(),
"Git-Branch" to gitBranch, "Git-Branch" to gitBranch,
@@ -267,7 +_,7 @@ @@ -271,7 +_,7 @@
jvmArgumentProviders.add(provider) jvmArgumentProviders.add(provider)
} }

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Track block changes and level tick scheduler
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index 40c906959d2708bf3e589f8e8d541d47106a8465..b234215e59ac303ef7979031ab1b042ff6692b7a 100644 index c86973892e2af63911eef1a00ea957eb33a96a03..1ade8d6da1a28044a354699293f4cfbda6133008 100644
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -1747,6 +1747,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa @@ -1748,6 +1748,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
profilerFiller.pop(); profilerFiller.pop();
profilerFiller.pop(); profilerFiller.pop();
serverLevel.explosionDensityCache.clear(); // Paper - Optimize explosions serverLevel.explosionDensityCache.clear(); // Paper - Optimize explosions
@@ -17,7 +17,7 @@ index 40c906959d2708bf3e589f8e8d541d47106a8465..b234215e59ac303ef7979031ab1b042f
this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked this.isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 787d7a76af7dfcaaa4b329df2cbe7cfcaa83d572..8aea98378fccb14f3eadab72a38e5661806b96c0 100644 index ad5b75c9efa830823a7c09bcdf4b326c4c583803..7aa8d68800cdec91f24f015f9b2d56e969a7be17 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -824,6 +824,10 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -824,6 +824,10 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -32,10 +32,10 @@ index 787d7a76af7dfcaaa4b329df2cbe7cfcaa83d572..8aea98378fccb14f3eadab72a38e5661
protected Level( protected Level(
WritableLevelData levelData, WritableLevelData levelData,
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index 5d3fc807221392d378fec283bfdefb8747fb8376..cfc125d43cf3702d46c221f4e7b0d66a15c5d690 100644 index 75578e6ed7233a03d9b6cd3c6d3997f1c6148392..a2185062fbb123549be21e37e84541d61ec301c9 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java --- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -127,6 +127,21 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -129,6 +129,21 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
return this.getBlockStateFinal(x, y, z); return this.getBlockStateFinal(x, y, z);
} }
// Paper end - get block chunk optimisation // Paper end - get block chunk optimisation
@@ -57,7 +57,7 @@ index 5d3fc807221392d378fec283bfdefb8747fb8376..cfc125d43cf3702d46c221f4e7b0d66a
public LevelChunk(Level level, ChunkPos pos) { public LevelChunk(Level level, ChunkPos pos) {
this(level, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, null, null, null); this(level, pos, UpgradeData.EMPTY, new LevelChunkTicks<>(), new LevelChunkTicks<>(), 0L, null, null, null);
@@ -164,6 +179,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -166,6 +181,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
this.debug = !empty && this.level.isDebug(); this.debug = !empty && this.level.isDebug();
this.defaultBlockState = empty ? VOID_AIR_BLOCKSTATE : AIR_BLOCKSTATE; this.defaultBlockState = empty ? VOID_AIR_BLOCKSTATE : AIR_BLOCKSTATE;
// Paper end - get block chunk optimisation // Paper end - get block chunk optimisation
@@ -65,7 +65,7 @@ index 5d3fc807221392d378fec283bfdefb8747fb8376..cfc125d43cf3702d46c221f4e7b0d66a
} }
public LevelChunk(ServerLevel level, ProtoChunk chunk, @Nullable LevelChunk.PostLoadProcessor postLoad) { public LevelChunk(ServerLevel level, ProtoChunk chunk, @Nullable LevelChunk.PostLoadProcessor postLoad) {
@@ -412,6 +428,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -414,6 +430,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
if (!section.getBlockState(i, i1, i2).is(block)) { if (!section.getBlockState(i, i1, i2).is(block)) {
return null; return null;
} else { } else {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Client Visibility Settings
diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java
index dff3cc7456fe69ebd735aa950f79ce0dfed7e25e..07d8bb89ed0f9cea6353905939ba9f91c6fb64a5 100644 index df822f0e7c358d74737c749d6ba61ec31846a569..a88184f63f3cb539569942c5c982193973183984 100644
--- a/net/minecraft/server/level/ChunkMap.java --- a/net/minecraft/server/level/ChunkMap.java
+++ b/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java
@@ -173,6 +173,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -173,6 +173,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
@@ -78,10 +78,10 @@ index dff3cc7456fe69ebd735aa950f79ce0dfed7e25e..07d8bb89ed0f9cea6353905939ba9f91
if (flag && !player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) { // Paper - only consider hits if (flag && !player.getBukkitEntity().canSee(this.entity.getBukkitEntity())) { // Paper - only consider hits
flag = false; flag = false;
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 6fa053b317fa51d0bf25a6d3f48addc55452257e..c5fffb6ca4ef4d447e4eb668e8980fe0885d99da 100644 index 03a157f6c96b0f39effa24ae278eeac689c83ee8..5f38281763419123a0611cbb34d9a02a0e0302ea 100644
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -561,6 +561,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -564,6 +564,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.playerTickingChunks.remove((LevelChunk)chunkHolder.getCurrentChunk()); this.playerTickingChunks.remove((LevelChunk)chunkHolder.getCurrentChunk());
} }
// Paper end - chunk tick iteration // Paper end - chunk tick iteration
@@ -103,7 +103,7 @@ index 6fa053b317fa51d0bf25a6d3f48addc55452257e..c5fffb6ca4ef4d447e4eb668e8980fe0
public ServerLevel( public ServerLevel(
MinecraftServer server, MinecraftServer server,
@@ -671,6 +686,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -675,6 +690,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler); this.chunkDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.ChunkDataController((ServerLevel)(Object)this, this.chunkTaskScheduler);
// Paper end - rewrite chunk system // Paper end - rewrite chunk system
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
@@ -111,7 +111,7 @@ index 6fa053b317fa51d0bf25a6d3f48addc55452257e..c5fffb6ca4ef4d447e4eb668e8980fe0
} }
// Paper start // Paper start
@@ -1876,7 +1892,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -1898,7 +1914,18 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
for (ServerPlayer serverPlayer : this.players) { for (ServerPlayer serverPlayer : this.players) {
if (serverPlayer.distanceToSqr(vec3) < 4096.0) { if (serverPlayer.distanceToSqr(vec3) < 4096.0) {
Optional<Vec3> optional = Optional.ofNullable(serverExplosion.getHitPlayers().get(serverPlayer)); Optional<Vec3> optional = Optional.ofNullable(serverExplosion.getHitPlayers().get(serverPlayer));
@@ -132,22 +132,22 @@ index 6fa053b317fa51d0bf25a6d3f48addc55452257e..c5fffb6ca4ef4d447e4eb668e8980fe0
} }
diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java
index 531336f7c09e74ed60f7c697c26a9639a9ea489c..5c7bb1ff36fe9d91958eda88a2631b7d60659fb2 100644 index 94da87a5f468b0b4c80d63054e6184417d2c7b76..d5fdc43302fdbed0a6e83b6033fb05baa8b6445e 100644
--- a/net/minecraft/server/level/ServerPlayer.java --- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java
@@ -451,6 +451,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc @@ -526,6 +526,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc
return this.viewDistanceHolder; }
} }
// Paper end - rewrite chunk system // Paper end - improve keepalives
+ public final me.samsuik.sakura.player.visibility.PlayerVisibilitySettings visibilitySettings = new me.samsuik.sakura.player.visibility.PlayerVisibilitySettings(); // Sakura - client visibility settings + public final me.samsuik.sakura.player.visibility.PlayerVisibilitySettings visibilitySettings = new me.samsuik.sakura.player.visibility.PlayerVisibilitySettings(); // Sakura - client visibility settings
public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) { public ServerPlayer(MinecraftServer server, ServerLevel level, GameProfile gameProfile, ClientInformation clientInformation) {
super(level, level.getSharedSpawnPos(), level.getSharedSpawnAngle(), gameProfile); super(level, gameProfile);
diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 186393485396cfe9b1baef29586198356e2d2600..a06f5a9b577cd9cc2cb948b2801b0aec31db8836 100644 index 43f70a5561d6cc62aaeba6d1e39598ecb382e369..6ccc1cd38ccc4f346caad807db84b83a1c0f55dc 100644
--- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -51,6 +51,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -53,6 +53,21 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
protected static final net.minecraft.resources.ResourceLocation MINECRAFT_BRAND = net.minecraft.resources.ResourceLocation.withDefaultNamespace("brand"); // Paper - Brand support protected static final net.minecraft.resources.ResourceLocation MINECRAFT_BRAND = net.minecraft.resources.ResourceLocation.withDefaultNamespace("brand"); // Paper - Brand support
@@ -169,7 +169,7 @@ index 186393485396cfe9b1baef29586198356e2d2600..a06f5a9b577cd9cc2cb948b2801b0aec
public ServerCommonPacketListenerImpl(MinecraftServer server, Connection connection, CommonListenerCookie cookie, net.minecraft.server.level.ServerPlayer player) { // CraftBukkit public ServerCommonPacketListenerImpl(MinecraftServer server, Connection connection, CommonListenerCookie cookie, net.minecraft.server.level.ServerPlayer player) { // CraftBukkit
this.server = server; this.server = server;
@@ -291,6 +306,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -330,6 +345,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} else if (packet instanceof net.minecraft.network.protocol.game.ClientboundSetDefaultSpawnPositionPacket defaultSpawnPositionPacket) { } else if (packet instanceof net.minecraft.network.protocol.game.ClientboundSetDefaultSpawnPositionPacket defaultSpawnPositionPacket) {
this.player.compassTarget = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(defaultSpawnPositionPacket.getPos(), this.getCraftPlayer().getWorld()); this.player.compassTarget = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(defaultSpawnPositionPacket.getPos(), this.getCraftPlayer().getWorld());
} }
@@ -182,7 +182,7 @@ index 186393485396cfe9b1baef29586198356e2d2600..a06f5a9b577cd9cc2cb948b2801b0aec
// CraftBukkit end // CraftBukkit end
if (packet.isTerminal()) { if (packet.isTerminal()) {
this.close(); this.close();
@@ -303,7 +324,10 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -342,7 +363,10 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} catch (Throwable var7) { } catch (Throwable var7) {
CrashReport crashReport = CrashReport.forThrowable(var7, "Sending packet"); CrashReport crashReport = CrashReport.forThrowable(var7, "Sending packet");
CrashReportCategory crashReportCategory = crashReport.addCategory("Packet being sent"); CrashReportCategory crashReportCategory = crashReport.addCategory("Packet being sent");
@@ -195,10 +195,10 @@ index 186393485396cfe9b1baef29586198356e2d2600..a06f5a9b577cd9cc2cb948b2801b0aec
} }
} }
diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 9041830c19e2899479e1519488faba5c416ccd88..2708d162c24e1d446485cd49f7b47abc0bcd5054 100644 index 625eae18ab13ae27949128f6325b3608a557cf1f..74c11280979d170a635a997c3a3acf489b3eaa6a 100644
--- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -3192,6 +3192,7 @@ public class ServerGamePacketListenerImpl @@ -3204,6 +3204,7 @@ public class ServerGamePacketListenerImpl
event.setCancelled(cancelled); event.setCancelled(cancelled);
net.minecraft.world.inventory.AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224 net.minecraft.world.inventory.AbstractContainerMenu oldContainer = this.player.containerMenu; // SPIGOT-1224
@@ -207,10 +207,10 @@ index 9041830c19e2899479e1519488faba5c416ccd88..2708d162c24e1d446485cd49f7b47abc
if (this.player.containerMenu != oldContainer) { if (this.player.containerMenu != oldContainer) {
return; return;
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index d96d493b3d14cf84a7ecf0d531aa35d41a801601..92fd4bb2b2473a0630cd5edf8d301dc7c60b2998 100644 index 46461fae4d4472bfdae75d12ac9cdaecafef848e..057ed507b8f8d6c45a8a49458d087d892ec29d8a 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -516,6 +516,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -533,6 +533,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
// Paper end - optimise entity tracker // Paper end - optimise entity tracker
public boolean pushedByFluid = true; // Sakura - entity pushed by fluid api public boolean pushedByFluid = true; // Sakura - entity pushed by fluid api
@@ -222,10 +222,10 @@ index d96d493b3d14cf84a7ecf0d531aa35d41a801601..92fd4bb2b2473a0630cd5edf8d301dc7
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
index 5b036edf61c53596528bf722c46673b47c01f51d..6660e6c78303db5585a06d6836b035d0e8582922 100644 index ae1f7a8b9cc6db4dd8dd3d6593a952166d35cc68..f7663d07a71582c332b38871211e648cffcf13c2 100644
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -76,6 +76,7 @@ public class FallingBlockEntity extends Entity { @@ -79,6 +79,7 @@ public class FallingBlockEntity extends Entity {
super(entityType, level); super(entityType, level);
this.dropItem = level.sakuraConfig().cannons.sand.dropItems; // Sakura - configure falling blocks dropping items this.dropItem = level.sakuraConfig().cannons.sand.dropItems; // Sakura - configure falling blocks dropping items
this.heightParity = level.sakuraConfig().cannons.mechanics.fallingBlockParity; // Sakura - configure cannon mechanics this.heightParity = level.sakuraConfig().cannons.mechanics.fallingBlockParity; // Sakura - configure cannon mechanics
@@ -234,10 +234,10 @@ index 5b036edf61c53596528bf722c46673b47c01f51d..6660e6c78303db5585a06d6836b035d0
public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) {
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index deb5e9e4cdd235311ff4e51ffb2f02f35d580645..7e3d7d5b47557e57bf661aa8d3eefcb416cb408b 100644 index dc9c8bdc81dec07a8e457431bbd35a54236b03ef..8755c76b679adcacbdd8e2faec363745fd583e48 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -64,6 +64,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -63,6 +63,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
public PrimedTnt(EntityType<? extends PrimedTnt> entityType, Level level) { public PrimedTnt(EntityType<? extends PrimedTnt> entityType, Level level) {
super(entityType, level); super(entityType, level);
this.blocksBuilding = true; this.blocksBuilding = true;

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Load Chunks on Movement
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
index a97a2a8492f3858e3b622d26768b4d819c9b47a7..44aaaa87d63a2a2287f89feaa431ca0e80da3dab 100644 index 01cd38bba2deb6cf65c82b4e4ec352a2998fd339..548e3dc8e5fee004483b40a59e2502ba8b93e674 100644
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java --- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java +++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
@@ -1885,6 +1885,7 @@ public final class CollisionUtil { @@ -1885,6 +1885,7 @@ public final class CollisionUtil {
@@ -39,10 +39,10 @@ index a97a2a8492f3858e3b622d26768b4d819c9b47a7..44aaaa87d63a2a2287f89feaa431ca0e
// bound y // bound y
diff --git a/net/minecraft/server/level/TicketType.java b/net/minecraft/server/level/TicketType.java diff --git a/net/minecraft/server/level/TicketType.java b/net/minecraft/server/level/TicketType.java
index f91eed907ffc61a4092aabaa0a1b061c2c453673..0159517f425491ce490d982a09e40efd4ce7868c 100644 index 6a7dae136691fb2476633fa12897424daa6bb5b3..7af093dbbcb91ef0e2587f8cd932bcfbca4fc9dc 100644
--- a/net/minecraft/server/level/TicketType.java --- a/net/minecraft/server/level/TicketType.java
+++ b/net/minecraft/server/level/TicketType.java +++ b/net/minecraft/server/level/TicketType.java
@@ -51,6 +51,7 @@ public final class TicketType<T> implements ca.spottedleaf.moonrise.patches.chun @@ -56,6 +56,7 @@ public final class TicketType<T> implements ca.spottedleaf.moonrise.patches.chun
public static final TicketType PLUGIN_TICKET = register("plugin_ticket", TicketType.NO_TIMEOUT, false, TicketType.TicketUse.LOADING_AND_SIMULATION); static { ((TicketType<org.bukkit.plugin.Plugin>)PLUGIN_TICKET).moonrise$setIdentifierComparator((org.bukkit.plugin.Plugin p1, org.bukkit.plugin.Plugin p2) -> p1.getName().compareTo(p2.getName())); } // Paper // Paper - rewrite chunk system public static final TicketType PLUGIN_TICKET = register("plugin_ticket", TicketType.NO_TIMEOUT, false, TicketType.TicketUse.LOADING_AND_SIMULATION); static { ((TicketType<org.bukkit.plugin.Plugin>)PLUGIN_TICKET).moonrise$setIdentifierComparator((org.bukkit.plugin.Plugin p1, org.bukkit.plugin.Plugin p2) -> p1.getName().compareTo(p2.getName())); } // Paper // Paper - rewrite chunk system
public static final TicketType FUTURE_AWAIT = register("future_await", TicketType.NO_TIMEOUT, false, TicketType.TicketUse.LOADING_AND_SIMULATION); // Paper public static final TicketType FUTURE_AWAIT = register("future_await", TicketType.NO_TIMEOUT, false, TicketType.TicketUse.LOADING_AND_SIMULATION); // Paper
public static final TicketType CHUNK_LOAD = register("chunk_load", TicketType.NO_TIMEOUT, false, TicketType.TicketUse.LOADING); // Paper - moonrise public static final TicketType CHUNK_LOAD = register("chunk_load", TicketType.NO_TIMEOUT, false, TicketType.TicketUse.LOADING); // Paper - moonrise
@@ -51,10 +51,10 @@ index f91eed907ffc61a4092aabaa0a1b061c2c453673..0159517f425491ce490d982a09e40efd
public static TicketType register(String name, long timeout, boolean persist, TicketType.TicketUse use) { public static TicketType register(String name, long timeout, boolean persist, TicketType.TicketUse use) {
return Registry.register(BuiltInRegistries.TICKET_TYPE, name, new TicketType(timeout, persist, use)); return Registry.register(BuiltInRegistries.TICKET_TYPE, name, new TicketType(timeout, persist, use));
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 92fd4bb2b2473a0630cd5edf8d301dc7c60b2998..ccd0497ec6587086e6d2f8da0f8d0ae606449d37 100644 index 057ed507b8f8d6c45a8a49458d087d892ec29d8a..dcfe52f72efde7c2e9cbdb611d5e72bf4aaaeb23 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -520,6 +520,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -537,6 +537,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
public boolean isPrimedTNT; public boolean isPrimedTNT;
public boolean isFallingBlock; public boolean isFallingBlock;
// Sakura end - client visibility settings // Sakura end - client visibility settings
@@ -75,7 +75,7 @@ index 92fd4bb2b2473a0630cd5edf8d301dc7c60b2998..ccd0497ec6587086e6d2f8da0f8d0ae6
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
@@ -1491,7 +1505,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1520,7 +1534,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.getCollisionsForBlocksOrWorldBorder( ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.getCollisionsForBlocksOrWorldBorder(
this.level, (Entity)(Object)this, initialCollisionBox, potentialCollisionsVoxel, potentialCollisionsBB, this.level, (Entity)(Object)this, initialCollisionBox, potentialCollisionsVoxel, potentialCollisionsBB,
@@ -84,7 +84,7 @@ index 92fd4bb2b2473a0630cd5edf8d301dc7c60b2998..ccd0497ec6587086e6d2f8da0f8d0ae6
); );
potentialCollisionsBB.addAll(entityAABBs); potentialCollisionsBB.addAll(entityAABBs);
final Vec3 collided = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.performCollisions(movement, currentBox, potentialCollisionsVoxel, potentialCollisionsBB); final Vec3 collided = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.performCollisions(movement, currentBox, potentialCollisionsVoxel, potentialCollisionsBB);
@@ -4952,13 +4966,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -5184,13 +5198,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
@Override @Override
public boolean shouldBeSaved() { public boolean shouldBeSaved() {
return (this.removalReason == null || this.removalReason.shouldSave()) return (this.removalReason == null || this.removalReason.shouldSave())
@@ -101,10 +101,10 @@ index 92fd4bb2b2473a0630cd5edf8d301dc7c60b2998..ccd0497ec6587086e6d2f8da0f8d0ae6
public boolean mayInteract(ServerLevel level, BlockPos pos) { public boolean mayInteract(ServerLevel level, BlockPos pos) {
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
index 6660e6c78303db5585a06d6836b035d0e8582922..b6a2da9d6db99f107fa8d9703b77515cf112a604 100644 index f7663d07a71582c332b38871211e648cffcf13c2..e4dce2b09e8e898166b355373e6a205ebeb53a25 100644
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -77,6 +77,7 @@ public class FallingBlockEntity extends Entity { @@ -80,6 +80,7 @@ public class FallingBlockEntity extends Entity {
this.dropItem = level.sakuraConfig().cannons.sand.dropItems; // Sakura - configure falling blocks dropping items this.dropItem = level.sakuraConfig().cannons.sand.dropItems; // Sakura - configure falling blocks dropping items
this.heightParity = level.sakuraConfig().cannons.mechanics.fallingBlockParity; // Sakura - configure cannon mechanics this.heightParity = level.sakuraConfig().cannons.mechanics.fallingBlockParity; // Sakura - configure cannon mechanics
this.isFallingBlock = true; // Sakura - client visibility settings this.isFallingBlock = true; // Sakura - client visibility settings
@@ -113,10 +113,10 @@ index 6660e6c78303db5585a06d6836b035d0e8582922..b6a2da9d6db99f107fa8d9703b77515c
public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) {
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index 7e3d7d5b47557e57bf661aa8d3eefcb416cb408b..55dbe5baf2df0111d03a43d32208798d7ec670a1 100644 index 8755c76b679adcacbdd8e2faec363745fd583e48..2420999c5399333bed122ee0a1f252ac894adfcb 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -65,6 +65,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -64,6 +64,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
super(entityType, level); super(entityType, level);
this.blocksBuilding = true; this.blocksBuilding = true;
this.isPrimedTNT = true; // Sakura - client visibility settings this.isPrimedTNT = true; // Sakura - client visibility settings
@@ -125,10 +125,10 @@ index 7e3d7d5b47557e57bf661aa8d3eefcb416cb408b..55dbe5baf2df0111d03a43d32208798d
public PrimedTnt(Level level, double x, double y, double z, @Nullable LivingEntity owner) { public PrimedTnt(Level level, double x, double y, double z, @Nullable LivingEntity owner) {
diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java
index 3b7f0d5fe40bdda65ab859a0c22bf0d369dc0f01..dd50e4867b16127355243acdb9ba647a4b50baae 100644 index 182c14b660f8860bed627eed4e01fd4002153e9a..c3074cdbfb584b6d033377d7407177a344f68a3c 100644
--- a/net/minecraft/world/level/chunk/ChunkAccess.java --- a/net/minecraft/world/level/chunk/ChunkAccess.java
+++ b/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java
@@ -138,6 +138,17 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh @@ -139,6 +139,17 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh
private final int minSection; private final int minSection;
private final int maxSection; private final int maxSection;
// Paper end - get block chunk optimisation // Paper end - get block chunk optimisation

View File

@@ -123,7 +123,7 @@ index f1ab0e66e7d464f7f31a7a360528ed97cdda0aa0..4aed59c3038cb4af7e454a0dd8455488
public DataItem(EntityDataAccessor<T> accessor, T value) { public DataItem(EntityDataAccessor<T> accessor, T value) {
this.accessor = accessor; this.accessor = accessor;
diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java
index b118e91f1e0b5a8b8c0b2a4a32faabc5a34a5954..b26b47afe4533d223d0079e4733ef0172121cc9d 100644 index e96d4dee14c05f2fa329bfb1588ec795d4e3d730..ba9393e474ae213316c693d73ef2641e69eae8cc 100644
--- a/net/minecraft/server/level/ServerEntity.java --- a/net/minecraft/server/level/ServerEntity.java
+++ b/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java
@@ -148,7 +148,7 @@ public class ServerEntity { @@ -148,7 +148,7 @@ public class ServerEntity {
@@ -135,7 +135,7 @@ index b118e91f1e0b5a8b8c0b2a4a32faabc5a34a5954..b26b47afe4533d223d0079e4733ef017
byte b = Mth.packDegrees(this.entity.getYRot()); byte b = Mth.packDegrees(this.entity.getYRot());
byte b1 = Mth.packDegrees(this.entity.getXRot()); byte b1 = Mth.packDegrees(this.entity.getXRot());
boolean flag = Math.abs(b - this.lastSentYRot) >= 1 || Math.abs(b1 - this.lastSentXRot) >= 1; boolean flag = Math.abs(b - this.lastSentYRot) >= 1 || Math.abs(b1 - this.lastSentXRot) >= 1;
@@ -417,7 +417,15 @@ public class ServerEntity { @@ -411,7 +411,15 @@ public class ServerEntity {
List<SynchedEntityData.DataValue<?>> list = entityData.packDirty(); List<SynchedEntityData.DataValue<?>> list = entityData.packDirty();
if (list != null) { if (list != null) {
this.trackedDataValues = entityData.getNonDefaultValues(); this.trackedDataValues = entityData.getNonDefaultValues();
@@ -153,10 +153,10 @@ index b118e91f1e0b5a8b8c0b2a4a32faabc5a34a5954..b26b47afe4533d223d0079e4733ef017
if (this.entity instanceof LivingEntity) { if (this.entity instanceof LivingEntity) {
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index ccd0497ec6587086e6d2f8da0f8d0ae606449d37..3c638e9039a037d20c008f22f0c5bace3d3493c6 100644 index dcfe52f72efde7c2e9cbdb611d5e72bf4aaaeb23..ce39193b14b43c215930cde7c311f88f756b0b81 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -3444,7 +3444,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -3639,7 +3639,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID); this.entityData.markDirty(Entity.DATA_AIR_SUPPLY_ID);
return; return;
} }
@@ -166,10 +166,10 @@ index ccd0497ec6587086e6d2f8da0f8d0ae606449d37..3c638e9039a037d20c008f22f0c5bace
} }
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
index b6a2da9d6db99f107fa8d9703b77515cf112a604..45f08a65d8b423fbf69f66d695bb9d67cf0f2f23 100644 index e4dce2b09e8e898166b355373e6a205ebeb53a25..860efa7bf6643ab9f05e97fefec280dffa76ba0e 100644
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -142,7 +142,7 @@ public class FallingBlockEntity extends Entity { @@ -145,7 +145,7 @@ public class FallingBlockEntity extends Entity {
} }
public void setStartPos(BlockPos startPos) { public void setStartPos(BlockPos startPos) {
@@ -179,10 +179,10 @@ index b6a2da9d6db99f107fa8d9703b77515cf112a604..45f08a65d8b423fbf69f66d695bb9d67
public BlockPos getStartPos() { public BlockPos getStartPos() {
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index 55dbe5baf2df0111d03a43d32208798d7ec670a1..0fbac85dd7b624899db3825149a5d2b167ecedaa 100644 index 2420999c5399333bed122ee0a1f252ac894adfcb..2e7f6e3941b34323768e43870541c8e4156c9a8f 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -243,7 +243,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -228,7 +228,11 @@ public class PrimedTnt extends Entity implements TraceableEntity {
} }
public void setFuse(int life) { public void setFuse(int life) {
@@ -196,10 +196,10 @@ index 55dbe5baf2df0111d03a43d32208798d7ec670a1..0fbac85dd7b624899db3825149a5d2b1
public int getFuse() { public int getFuse() {
diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java
index 3e17e814d6469e5498add774220ec8b568d09094..2f67228654ab841f26ffb336420d9c4baaaf2442 100644 index 9b1b7385b823e97a5a6e059c75a68cadc190e967..eca187bf6e3ccb55ce78ee341d4efafc9a728612 100644
--- a/net/minecraft/world/entity/player/Player.java --- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java
@@ -679,7 +679,7 @@ public abstract class Player extends LivingEntity { @@ -689,7 +689,7 @@ public abstract class Player extends LivingEntity {
public void increaseScore(int score) { public void increaseScore(int score) {
int score1 = this.getScore(); int score1 = this.getScore();

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise paper explosions
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
index ba20e87d2105ce53cdaf4049de2388d05fcd1b56..6e3a429bc165d8473ea50ee2ae1548270db599d1 100644 index b2bcfb3557a0326fd7ec1059f95d6da4568dfd80..bd2055bc89c5672b514f1f7b1ad320a2fba7cbe2 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java --- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
@@ -297,6 +297,12 @@ public final class ChunkEntitySlices { @@ -319,6 +319,12 @@ public final class ChunkEntitySlices {
return true; return true;
} }
@@ -21,7 +21,7 @@ index ba20e87d2105ce53cdaf4049de2388d05fcd1b56..6e3a429bc165d8473ea50ee2ae154827
public void getHardCollidingEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) { public void getHardCollidingEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate) {
this.hardCollidingEntities.getEntities(except, box, into, predicate); this.hardCollidingEntities.getEntities(except, box, into, predicate);
} }
@@ -495,6 +501,17 @@ public final class ChunkEntitySlices { @@ -517,6 +523,17 @@ public final class ChunkEntitySlices {
} }
} }
@@ -40,7 +40,7 @@ index ba20e87d2105ce53cdaf4049de2388d05fcd1b56..6e3a429bc165d8473ea50ee2ae154827
if (this.count == 0) { if (this.count == 0) {
return; return;
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c97980fbfa4dc 100644 index 250a46dbfdf3ba751dc081fae5cbf8aa16153f4e..1e9b92454edae054c6c3c50dc844c8fc3689f6f8 100644
--- a/net/minecraft/world/level/ServerExplosion.java --- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java
@@ -86,7 +86,7 @@ public class ServerExplosion implements Explosion { @@ -86,7 +86,7 @@ public class ServerExplosion implements Explosion {
@@ -92,7 +92,7 @@ index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c9798
public ServerExplosion( public ServerExplosion(
ServerLevel level, ServerLevel level,
@@ -395,6 +428,12 @@ public class ServerExplosion implements Explosion { @@ -398,6 +431,12 @@ public class ServerExplosion implements Explosion {
initialCache = this.getOrCacheExplosionBlock(blockX, blockY, blockZ, key, true); initialCache = this.getOrCacheExplosionBlock(blockX, blockY, blockZ, key, true);
} }
@@ -105,7 +105,7 @@ index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c9798
// only ~1/3rd of the loop iterations in vanilla will result in a ray, as it is iterating the perimeter of // only ~1/3rd of the loop iterations in vanilla will result in a ray, as it is iterating the perimeter of
// a 16x16x16 cube // a 16x16x16 cube
// we can cache the rays and their normals as well, so that we eliminate the excess iterations / checks and // we can cache the rays and their normals as well, so that we eliminate the excess iterations / checks and
@@ -473,16 +512,55 @@ public class ServerExplosion implements Explosion { @@ -476,16 +515,55 @@ public class ServerExplosion implements Explosion {
// Paper end - collision optimisations // Paper end - collision optimisations
} }
@@ -165,7 +165,7 @@ index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c9798
if (!entity.ignoreExplosion(this)) { if (!entity.ignoreExplosion(this)) {
double d = Math.sqrt(entity.distanceToSqr(this.center)) / f; double d = Math.sqrt(entity.distanceToSqr(this.center)) / f;
if (d <= 1.0) { if (d <= 1.0) {
@@ -507,15 +585,16 @@ public class ServerExplosion implements Explosion { @@ -510,15 +588,16 @@ public class ServerExplosion implements Explosion {
// - Damaging EnderDragon does nothing // - Damaging EnderDragon does nothing
// - EnderDragon hitbox always covers the other parts and is therefore always present // - EnderDragon hitbox always covers the other parts and is therefore always present
if (entity instanceof EnderDragonPart) { if (entity instanceof EnderDragonPart) {
@@ -184,7 +184,7 @@ index 340d50be3cc94e47affddd4ad916e1c02e620636..5c029776df58976df6791f66618c9798
dragonPart.hurtServer(this.level, this.damageSource, this.damageCalculator.getEntityDamageAmount(this, dragonPart, f1)); dragonPart.hurtServer(this.level, this.damageSource, this.damageCalculator.getEntityDamageAmount(this, dragonPart, f1));
} }
} }
@@ -524,7 +603,7 @@ public class ServerExplosion implements Explosion { @@ -527,7 +606,7 @@ public class ServerExplosion implements Explosion {
} }
if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled if (entity.lastDamageCancelled) { // SPIGOT-5339, SPIGOT-6252, SPIGOT-6777: Skip entity if damage event was cancelled

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Store Entity Data/State
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 3c638e9039a037d20c008f22f0c5bace3d3493c6..cffd3f64b253dba53eacc60c8ae82dd297f98e5b 100644 index ce39193b14b43c215930cde7c311f88f756b0b81..f8b1b6850013b70218aa2eefe9371774a45a6033 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -534,6 +534,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -551,6 +551,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return flags; return flags;
} }
// Sakura end - load chunks on movement // Sakura end - load chunks on movement
@@ -31,7 +31,7 @@ index 3c638e9039a037d20c008f22f0c5bace3d3493c6..cffd3f64b253dba53eacc60c8ae82dd2
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 0e676210ef390e3cce2fc24622f68da119c9a05f..7bf2b9a5a6c0a5c78e8623e158367552eb253fbc 100644 index 7aa8d68800cdec91f24f015f9b2d56e969a7be17..2fa0725a2b41517e1589e540999118f5c355e899 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -1498,6 +1498,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -1498,6 +1498,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Merge Cannon Entities
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index c5fffb6ca4ef4d447e4eb668e8980fe0885d99da..939264c895f452e909cfbff19eced2cfc904ee6a 100644 index 5f38281763419123a0611cbb34d9a02a0e0302ea..5ddfbddbef13b58bf509e4c60bbd72cde2a7f59d 100644
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -687,6 +687,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -691,6 +691,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
// Paper end - rewrite chunk system // Paper end - rewrite chunk system
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
this.levelTickScheduler.registerNewTask(this.explosionPositions::clear, 0); // Sakura - client visibility settings this.levelTickScheduler.registerNewTask(this.explosionPositions::clear, 0); // Sakura - client visibility settings
@@ -16,7 +16,7 @@ index c5fffb6ca4ef4d447e4eb668e8980fe0885d99da..939264c895f452e909cfbff19eced2cf
} }
// Paper start // Paper start
@@ -801,6 +802,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -805,6 +806,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
} }
io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR
@@ -24,7 +24,7 @@ index c5fffb6ca4ef4d447e4eb668e8980fe0885d99da..939264c895f452e909cfbff19eced2cf
this.entityTickList this.entityTickList
.forEach( .forEach(
entity -> { entity -> {
@@ -819,6 +821,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -823,6 +825,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
entity.stopRiding(); entity.stopRiding();
} }
@@ -41,10 +41,10 @@ index c5fffb6ca4ef4d447e4eb668e8980fe0885d99da..939264c895f452e909cfbff19eced2cf
this.guardEntityTick(this::tickNonPassenger, entity); this.guardEntityTick(this::tickNonPassenger, entity);
profilerFiller.pop(); profilerFiller.pop();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index cffd3f64b253dba53eacc60c8ae82dd297f98e5b..68e2b26835a2588a047e9ea175eb8e4912041976 100644 index f8b1b6850013b70218aa2eefe9371774a45a6033..46843fb00310923dc4da31e4554a40696eba57b8 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -549,6 +549,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -566,6 +566,27 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return to.entityState() != null && to.entityState().comparePositionAndMotion(this); return to.entityState() != null && to.entityState().comparePositionAndMotion(this);
} }
// Sakura end - store entity data/state // Sakura end - store entity data/state
@@ -72,7 +72,7 @@ index cffd3f64b253dba53eacc60c8ae82dd297f98e5b..68e2b26835a2588a047e9ea175eb8e49
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
@@ -4951,6 +4972,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -5178,6 +5199,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.removalReason != Entity.RemovalReason.UNLOADED_TO_CHUNK) { this.getPassengers().forEach(Entity::stopRiding); } // Paper - rewrite chunk system if (this.removalReason != Entity.RemovalReason.UNLOADED_TO_CHUNK) { this.getPassengers().forEach(Entity::stopRiding); } // Paper - rewrite chunk system
this.levelCallback.onRemove(removalReason); this.levelCallback.onRemove(removalReason);
this.onRemoval(removalReason); this.onRemoval(removalReason);
@@ -85,10 +85,10 @@ index cffd3f64b253dba53eacc60c8ae82dd297f98e5b..68e2b26835a2588a047e9ea175eb8e49
if (!(this instanceof ServerPlayer) && removalReason != RemovalReason.CHANGED_DIMENSION && !alreadyRemoved) { if (!(this instanceof ServerPlayer) && removalReason != RemovalReason.CHANGED_DIMENSION && !alreadyRemoved) {
// Players need to be special cased, because they are regularly removed from the world // Players need to be special cased, because they are regularly removed from the world
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
index 45f08a65d8b423fbf69f66d695bb9d67cf0f2f23..3af6e04bb4dcd91de2794bbc8d3eff16def9efa8 100644 index 860efa7bf6643ab9f05e97fefec280dffa76ba0e..d65df5f13e038d109870d1f7fba50d2260489d49 100644
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -50,7 +50,7 @@ import net.minecraft.world.phys.HitResult; @@ -53,7 +53,7 @@ import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.slf4j.Logger; import org.slf4j.Logger;
@@ -97,7 +97,7 @@ index 45f08a65d8b423fbf69f66d695bb9d67cf0f2f23..3af6e04bb4dcd91de2794bbc8d3eff16
private static final Logger LOGGER = LogUtils.getLogger(); private static final Logger LOGGER = LogUtils.getLogger();
private static final BlockState DEFAULT_BLOCK_STATE = Blocks.SAND.defaultBlockState(); private static final BlockState DEFAULT_BLOCK_STATE = Blocks.SAND.defaultBlockState();
private static final int DEFAULT_TIME = 0; private static final int DEFAULT_TIME = 0;
@@ -72,12 +72,63 @@ public class FallingBlockEntity extends Entity { @@ -75,12 +75,63 @@ public class FallingBlockEntity extends Entity {
public boolean autoExpire = true; // Paper - Expand FallingBlock API public boolean autoExpire = true; // Paper - Expand FallingBlock API
public boolean heightParity; // Sakura - falling block height parity api public boolean heightParity; // Sakura - falling block height parity api
@@ -161,7 +161,7 @@ index 45f08a65d8b423fbf69f66d695bb9d67cf0f2f23..3af6e04bb4dcd91de2794bbc8d3eff16
} }
public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) {
@@ -237,6 +288,7 @@ public class FallingBlockEntity extends Entity { @@ -240,6 +291,7 @@ public class FallingBlockEntity extends Entity {
return; return;
} }
// CraftBukkit end // CraftBukkit end
@@ -169,27 +169,31 @@ index 45f08a65d8b423fbf69f66d695bb9d67cf0f2f23..3af6e04bb4dcd91de2794bbc8d3eff16
if (this.level().setBlock(blockPos, this.blockState, 3)) { if (this.level().setBlock(blockPos, this.blockState, 3)) {
((ServerLevel)this.level()) ((ServerLevel)this.level())
.getChunkSource() .getChunkSource()
@@ -341,6 +393,7 @@ public class FallingBlockEntity extends Entity { @@ -347,6 +399,11 @@ public class FallingBlockEntity extends Entity {
compound.putBoolean("CancelDrop", this.cancelDrop); output.putBoolean("CancelDrop", this.cancelDrop);
if (!this.autoExpire) compound.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API if (!this.autoExpire) output.putBoolean("Paper.AutoExpire", false); // Paper - Expand FallingBlock API
+ compound.putInt("merge_count", this.mergeData.count); // Sakura - merge cannon entities; save to nbt + // Sakura start - merge cannon entities; save to nbt
+ if (this.mergeData.count != 1) {
+ output.putInt("merge_count", this.mergeData.count);
+ }
+ // Sakura end - merge cannon entities; save to nbt
} }
@Override @Override
@@ -356,6 +409,7 @@ public class FallingBlockEntity extends Entity { @@ -361,6 +418,7 @@ public class FallingBlockEntity extends Entity {
this.blockData = compound.getCompound("TileEntityData").map(blockData -> this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock ? null : blockData).map(CompoundTag::copy).orElse(null); // Paper - Filter bad block entity nbt data from falling blocks this.blockData = input.read("TileEntityData", CompoundTag.CODEC).map(blockData -> this.level().paperConfig().entities.spawning.filterBadTileEntityNbtFromFallingBlocks && this.blockState.getBlock() instanceof net.minecraft.world.level.block.GameMasterBlock ? null : blockData).map(CompoundTag::copy).orElse(null); // Paper - Filter bad block entity nbt data from falling blocks
this.cancelDrop = compound.getBooleanOr("CancelDrop", false); this.cancelDrop = input.getBooleanOr("CancelDrop", false);
this.autoExpire = compound.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API this.autoExpire = input.getBooleanOr("Paper.AutoExpire", true); // Paper - Expand FallingBlock API
+ this.mergeData.count = compound.getIntOr("merge_count", 1); // Sakura - merge cannon entities; load from nbt + this.mergeData.count = input.getIntOr("merge_count", 1); // Sakura - merge cannon entities; load from nbt
} }
public void setHurtsEntities(float fallDamagePerDistance, int fallDamageMax) { public void setHurtsEntities(float fallDamagePerDistance, int fallDamageMax) {
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index 0fbac85dd7b624899db3825149a5d2b167ecedaa..a1cbeb8216edda93ac6043b113314d53e9347fd6 100644 index 2e7f6e3941b34323768e43870541c8e4156c9a8f..0c8343075f5523aa200b58f2afd313d718408ac8 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -35,7 +35,7 @@ import org.bukkit.event.entity.EntityRemoveEvent; @@ -34,7 +34,7 @@ import org.bukkit.event.entity.EntityRemoveEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent;
// CraftBukkit end // CraftBukkit end
@@ -198,7 +202,7 @@ index 0fbac85dd7b624899db3825149a5d2b167ecedaa..a1cbeb8216edda93ac6043b113314d53
private static final EntityDataAccessor<Integer> DATA_FUSE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.INT); private static final EntityDataAccessor<Integer> DATA_FUSE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<BlockState> DATA_BLOCK_STATE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.BLOCK_STATE); private static final EntityDataAccessor<BlockState> DATA_BLOCK_STATE_ID = SynchedEntityData.defineId(PrimedTnt.class, EntityDataSerializers.BLOCK_STATE);
private static final short DEFAULT_FUSE_TIME = 80; private static final short DEFAULT_FUSE_TIME = 80;
@@ -61,11 +61,48 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -60,11 +60,48 @@ public class PrimedTnt extends Entity implements TraceableEntity {
public float explosionPower = 4.0F; public float explosionPower = 4.0F;
public boolean isIncendiary = false; // CraftBukkit public boolean isIncendiary = false; // CraftBukkit
@@ -247,7 +251,7 @@ index 0fbac85dd7b624899db3825149a5d2b167ecedaa..a1cbeb8216edda93ac6043b113314d53
} }
public PrimedTnt(Level level, double x, double y, double z, @Nullable LivingEntity owner) { public PrimedTnt(Level level, double x, double y, double z, @Nullable LivingEntity owner) {
@@ -145,6 +182,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -144,6 +181,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
if (i <= 0) { 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 // 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.discard();
@@ -255,24 +259,28 @@ index 0fbac85dd7b624899db3825149a5d2b167ecedaa..a1cbeb8216edda93ac6043b113314d53
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
this.explode(); this.explode();
} }
@@ -218,6 +256,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -203,6 +241,11 @@ public class PrimedTnt extends Entity implements TraceableEntity {
if (this.explosionPower != 4.0F) {
compound.putFloat("explosion_power", this.explosionPower);
} }
+ compound.putInt("merge_count", this.mergeData.count); // Sakura - merge cannon entities; save to nbt
EntityReference.store(this.owner, output, "owner");
+ // Sakura start - merge cannon entities; save to nbt
+ if (this.mergeData.count != 1) {
+ output.putInt("merge_count", this.mergeData.count);
+ }
+ // Sakura end - merge cannon entities; save to nbt
} }
@Override @Override
@@ -226,6 +265,7 @@ public class PrimedTnt extends Entity implements TraceableEntity { @@ -211,6 +254,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
this.setFuse(compound.getShortOr("fuse", (short)80)); this.setBlockState(input.read("block_state", BlockState.CODEC).orElse(DEFAULT_BLOCK_STATE));
this.setBlockState(compound.read("block_state", BlockState.CODEC, registryOps).orElse(DEFAULT_BLOCK_STATE)); this.explosionPower = Mth.clamp(input.getFloatOr("explosion_power", 4.0F), 0.0F, 128.0F);
this.explosionPower = Mth.clamp(compound.getFloatOr("explosion_power", 4.0F), 0.0F, 128.0F); this.owner = EntityReference.read(input, "owner");
+ this.mergeData.count = compound.getIntOr("merge_count", 1); // Sakura - merge cannon entities; load from nbt + this.mergeData.count = input.getIntOr("merge_count", 1); // Sakura - merge cannon entities; load from nbt
} }
@Nullable @Nullable
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 7bf2b9a5a6c0a5c78e8623e158367552eb253fbc..b5e9a92ddb789344650a0c5c10ffec6db5f90035 100644 index 2fa0725a2b41517e1589e540999118f5c355e899..19788e29f796efd7b1fe79c398c5532eb99add58 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -828,6 +828,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -828,6 +828,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Replace explosion density cache
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index a4428a3c23db6f795b5ff0ead634e2e21468e3a6..ae0b6d506f0344249bdc238fff0f5a3306d05334 100644 index 5ddfbddbef13b58bf509e4c60bbd72cde2a7f59d..39cf9a8af79ce4c3f1d47eaf7cf3205199b35eb6 100644
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -688,6 +688,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -692,6 +692,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit
this.levelTickScheduler.registerNewTask(this.explosionPositions::clear, 0); // Sakura - client visibility settings this.levelTickScheduler.registerNewTask(this.explosionPositions::clear, 0); // Sakura - client visibility settings
this.levelTickScheduler.registerNewTask(this.mergeHandler::expire, 200); // Sakura - merge cannon entities this.levelTickScheduler.registerNewTask(this.mergeHandler::expire, 200); // Sakura - merge cannon entities
@@ -17,7 +17,7 @@ index a4428a3c23db6f795b5ff0ead634e2e21468e3a6..ae0b6d506f0344249bdc238fff0f5a33
// Paper start // Paper start
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 37271a9e9d3d16a01c437629806508accefa1b9c..d111bd5546613cefd8b4070788679901b7e5b8f4 100644 index 19788e29f796efd7b1fe79c398c5532eb99add58..c24f09cf9959310353bd0fc5a5ff7498c6ea47a0 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -829,6 +829,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -829,6 +829,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -29,7 +29,7 @@ index 37271a9e9d3d16a01c437629806508accefa1b9c..d111bd5546613cefd8b4070788679901
protected Level( protected Level(
WritableLevelData levelData, WritableLevelData levelData,
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 71d79a1204d9335c98a63ecda9782755a964b22f..cc337b1656b5bf86da9125a3a1c2da06cc2814ba 100644 index 1e9b92454edae054c6c3c50dc844c8fc3689f6f8..37721d49fbb5c8914866be4a2bde29a64e3f172e 100644
--- a/net/minecraft/world/level/ServerExplosion.java --- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java
@@ -294,7 +294,12 @@ public class ServerExplosion implements Explosion { @@ -294,7 +294,12 @@ public class ServerExplosion implements Explosion {
@@ -46,7 +46,7 @@ index 71d79a1204d9335c98a63ecda9782755a964b22f..cc337b1656b5bf86da9125a3a1c2da06
++missedRays; ++missedRays;
} }
} }
@@ -382,8 +387,16 @@ public class ServerExplosion implements Explosion { @@ -385,8 +390,16 @@ public class ServerExplosion implements Explosion {
double d9 = Mth.lerp(d6, boundingBox.minY, boundingBox.maxY); double d9 = Mth.lerp(d6, boundingBox.minY, boundingBox.maxY);
double d10 = Mth.lerp(d7, boundingBox.minZ, boundingBox.maxZ); double d10 = Mth.lerp(d7, boundingBox.minZ, boundingBox.maxZ);
Vec3 vec3 = new Vec3(d8 + d3, d9, d10 + d4); Vec3 vec3 = new Vec3(d8 + d3, d9, d10 + d4);
@@ -65,7 +65,7 @@ index 71d79a1204d9335c98a63ecda9782755a964b22f..cc337b1656b5bf86da9125a3a1c2da06
i++; i++;
} }
@@ -679,6 +692,11 @@ public class ServerExplosion implements Explosion { @@ -682,6 +695,11 @@ public class ServerExplosion implements Explosion {
return; return;
} }
// CraftBukkit end // CraftBukkit end
@@ -77,7 +77,7 @@ index 71d79a1204d9335c98a63ecda9782755a964b22f..cc337b1656b5bf86da9125a3a1c2da06
for (BlockPos blockPos : blocks) { for (BlockPos blockPos : blocks) {
// CraftBukkit start - TNTPrimeEvent // CraftBukkit start - TNTPrimeEvent
@@ -851,14 +869,12 @@ public class ServerExplosion implements Explosion { @@ -848,14 +866,12 @@ public class ServerExplosion implements Explosion {
// Paper start - Optimize explosions // Paper start - Optimize explosions
protected float getBlockDensity(Vec3 vec3d, Entity entity) { protected float getBlockDensity(Vec3 vec3d, Entity entity) {
@@ -130,7 +130,7 @@ index 8a3a8b0fdf9545a41501dc992c6982d9c8ce7b66..5e2576a8b90de8a829c6136cc384f3fe
notifyNeighbors(block, level, blockPosx, opposite); notifyNeighbors(block, level, blockPosx, opposite);
emitState(level, blockPosx, flag2, flag3, flag, flag1); emitState(level, blockPosx, flag2, flag3, flag, flag1);
diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java
index c22acc8889fbb3c9ee698624189c195ee4b5eefb..b08ab87278023e50c56a381240712cc2e18a0440 100644 index 84f3073444ae9e11e5d11224d6af6474ced925e2..281366d8b256a2414e20872c0cb54c9d08501887 100644
--- a/net/minecraft/world/phys/AABB.java --- a/net/minecraft/world/phys/AABB.java
+++ b/net/minecraft/world/phys/AABB.java +++ b/net/minecraft/world/phys/AABB.java
@@ -19,6 +19,30 @@ public class AABB { @@ -19,6 +19,30 @@ public class AABB {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Optimise explosions in protected regions
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 38657fa606ae34a3bb752fcd01f7aa732fe17c7e..c597226b6a90ab687d176fe63e21c9c2cd71c7e1 100644 index 37721d49fbb5c8914866be4a2bde29a64e3f172e..c1e6e27c8424483d5b7e2bce784463e9293b77a0 100644
--- a/net/minecraft/world/level/ServerExplosion.java --- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java
@@ -342,6 +342,22 @@ public class ServerExplosion implements Explosion { @@ -342,6 +342,22 @@ public class ServerExplosion implements Explosion {
@@ -31,7 +31,7 @@ index 38657fa606ae34a3bb752fcd01f7aa732fe17c7e..c597226b6a90ab687d176fe63e21c9c2
public ServerExplosion( public ServerExplosion(
ServerLevel level, ServerLevel level,
@@ -446,6 +462,11 @@ public class ServerExplosion implements Explosion { @@ -449,6 +465,11 @@ public class ServerExplosion implements Explosion {
return ret; return ret;
} }
// Sakura end - optimise paper explosions // Sakura end - optimise paper explosions

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Specialised Explosions
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index fab973cb02218458f23e59665b4f2deb5d54da8d..aa99771955f069d63b90f34e2962f5e5323e8ca8 100644 index 39cf9a8af79ce4c3f1d47eaf7cf3205199b35eb6..bad69adfbc492d851a3542dc7f77884d9f933c8a 100644
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -1891,7 +1891,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -1913,7 +1913,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
case STANDARD -> Explosion.BlockInteraction.DESTROY; // CraftBukkit - handle custom explosion type case STANDARD -> Explosion.BlockInteraction.DESTROY; // CraftBukkit - handle custom explosion type
}; };
Vec3 vec3 = new Vec3(x, y, z); Vec3 vec3 = new Vec3(x, y, z);
@@ -26,7 +26,7 @@ index fab973cb02218458f23e59665b4f2deb5d54da8d..aa99771955f069d63b90f34e2962f5e5
if (configurator != null) configurator.accept(serverExplosion);// Paper - Allow explosions to damage source if (configurator != null) configurator.accept(serverExplosion);// Paper - Allow explosions to damage source
serverExplosion.explode(); serverExplosion.explode();
// CraftBukkit start // CraftBukkit start
@@ -1899,6 +1908,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -1921,6 +1930,15 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
return serverExplosion; return serverExplosion;
} }
// CraftBukkit end // CraftBukkit end
@@ -42,7 +42,7 @@ index fab973cb02218458f23e59665b4f2deb5d54da8d..aa99771955f069d63b90f34e2962f5e5
ParticleOptions particleOptions = serverExplosion.isSmall() ? smallExplosionParticles : largeExplosionParticles; ParticleOptions particleOptions = serverExplosion.isSmall() ? smallExplosionParticles : largeExplosionParticles;
for (ServerPlayer serverPlayer : this.players) { for (ServerPlayer serverPlayer : this.players) {
@@ -1919,7 +1937,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -1941,7 +1959,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
} }
} }
@@ -52,10 +52,10 @@ index fab973cb02218458f23e59665b4f2deb5d54da8d..aa99771955f069d63b90f34e2962f5e5
private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayGameRule) { private Explosion.BlockInteraction getDestroyType(GameRules.Key<GameRules.BooleanValue> decayGameRule) {
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index a1cbeb8216edda93ac6043b113314d53e9347fd6..3511e852aebabed8d5f40611db4573f55ca21875 100644 index 0c8343075f5523aa200b58f2afd313d718408ac8..8986a9876f9437fd8d65f4d43df3f39a98741210 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -80,20 +80,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -79,20 +79,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak
@Override @Override
public final void respawnEntity(int count) { public final void respawnEntity(int count) {
@@ -78,7 +78,7 @@ index a1cbeb8216edda93ac6043b113314d53e9347fd6..3511e852aebabed8d5f40611db4573f5
// Sakura end - merge cannon entities // Sakura end - merge cannon entities
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index c776277ce455b32f99fe06ab409c1923f9dcd325..9f0dcaf0db44925c35fa46fdb2de83540ee959c4 100644 index c1e6e27c8424483d5b7e2bce784463e9293b77a0..d45582bdfc3fa837c5aa95f499183b60b877b7c2 100644
--- a/net/minecraft/world/level/ServerExplosion.java --- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java
@@ -358,6 +358,38 @@ public class ServerExplosion implements Explosion { @@ -358,6 +358,38 @@ public class ServerExplosion implements Explosion {
@@ -120,7 +120,7 @@ index c776277ce455b32f99fe06ab409c1923f9dcd325..9f0dcaf0db44925c35fa46fdb2de8354
public ServerExplosion( public ServerExplosion(
ServerLevel level, ServerLevel level,
@@ -664,7 +696,10 @@ public class ServerExplosion implements Explosion { @@ -667,7 +699,10 @@ public class ServerExplosion implements Explosion {
// CraftBukkit end // CraftBukkit end
entity.push(vec3); entity.push(vec3);
if (entity instanceof Player player && !player.isSpectator() && (!player.isCreative() || !player.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Option to disable explosion knockback if (entity instanceof Player player && !player.isSpectator() && (!player.isCreative() || !player.getAbilities().flying) && !level.paperConfig().environment.disableExplosionKnockback) { // Paper - Option to disable explosion knockback
@@ -132,10 +132,10 @@ index c776277ce455b32f99fe06ab409c1923f9dcd325..9f0dcaf0db44925c35fa46fdb2de8354
} }
entity.onExplosionHit(this.source); entity.onExplosionHit(this.source);
@@ -774,14 +809,7 @@ public class ServerExplosion implements Explosion { @@ -772,14 +807,7 @@ public class ServerExplosion implements Explosion {
return; }
}
// CraftBukkit end public void explode() {
- // Paper start - collision optimisations - // Paper start - collision optimisations
- this.blockCache = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>(); - this.blockCache = new it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap<>();
- this.chunkPosCache = new long[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH]; - this.chunkPosCache = new long[CHUNK_CACHE_WIDTH * CHUNK_CACHE_WIDTH];
@@ -148,7 +148,7 @@ index c776277ce455b32f99fe06ab409c1923f9dcd325..9f0dcaf0db44925c35fa46fdb2de8354
this.level.gameEvent(this.source, GameEvent.EXPLODE, this.center); this.level.gameEvent(this.source, GameEvent.EXPLODE, this.center);
List<BlockPos> list = this.calculateExplodedPositions(); List<BlockPos> list = this.calculateExplodedPositions();
this.hurtEntities(); this.hurtEntities();
@@ -795,13 +823,7 @@ public class ServerExplosion implements Explosion { @@ -793,13 +821,7 @@ public class ServerExplosion implements Explosion {
if (this.fire) { if (this.fire) {
this.createFire(list); this.createFire(list);
} }

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise cannon entity movement
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 68e2b26835a2588a047e9ea175eb8e4912041976..98107921d7251e1b7fc621103a31afdfd3bb5af7 100644 index 46843fb00310923dc4da31e4554a40696eba57b8..2f80403bb400e88395df9d46a39c4adf69e479d7 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -1169,7 +1169,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1191,7 +1191,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
Vec3 vec3 = this.collide(movement); Vec3 vec3 = this.collide(movement);
double d = vec3.lengthSqr(); double d = vec3.lengthSqr();
if (d > 1.0E-7 || movement.lengthSqr() - d < 1.0E-7) { if (d > 1.0E-7 || movement.lengthSqr() - d < 1.0E-7) {
@@ -17,7 +17,7 @@ index 68e2b26835a2588a047e9ea175eb8e4912041976..98107921d7251e1b7fc621103a31afdf
BlockHitResult blockHitResult = this.level() BlockHitResult blockHitResult = this.level()
.clip( .clip(
new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this) new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this)
@@ -1510,6 +1510,131 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1539,6 +1539,131 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return distance; return distance;
} }
@@ -150,10 +150,10 @@ index 68e2b26835a2588a047e9ea175eb8e4912041976..98107921d7251e1b7fc621103a31afdf
protected Vec3 collide(Vec3 movement) { protected Vec3 collide(Vec3 movement) {
final boolean xZero = movement.x == 0.0; final boolean xZero = movement.x == 0.0;
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
index 3af6e04bb4dcd91de2794bbc8d3eff16def9efa8..e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0 100644 index d65df5f13e038d109870d1f7fba50d2260489d49..0b4cb90a6877c2af4ef1eccd502b50c863bf74b0 100644
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -121,6 +121,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -124,6 +124,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
return itemEntity; return itemEntity;
} }
// Sakura end - merge cannon entities // Sakura end - merge cannon entities
@@ -167,10 +167,10 @@ index 3af6e04bb4dcd91de2794bbc8d3eff16def9efa8..e0cee4cda2fb2d55e1da0cedc71cdc0c
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) { public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index 3511e852aebabed8d5f40611db4573f55ca21875..d523cc4e7089e04d577248d26d7d4e911cd87434 100644 index 8986a9876f9437fd8d65f4d43df3f39a98741210..9a4b9be72e896ad4def7caa89716c707cfb5cc06 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -83,6 +83,12 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -82,6 +82,12 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak
this.mergeData.count = count; // Sakura - specialised explosions this.mergeData.count = count; // Sakura - specialised explosions
} }
// Sakura end - merge cannon entities // Sakura end - merge cannon entities

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add maxSearch to getEntities
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
index 6e3a429bc165d8473ea50ee2ae1548270db599d1..417afe621f559d7fab0798ccf586b630e8878b23 100644 index bd2055bc89c5672b514f1f7b1ad320a2fba7cbe2..7678696aa2fa74358a374a501a6b7f76f4805945 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java --- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
@@ -314,7 +314,14 @@ public final class ChunkEntitySlices { @@ -336,7 +336,14 @@ public final class ChunkEntitySlices {
public boolean getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate, public boolean getEntities(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate,
final int maxCount) { final int maxCount) {
@@ -24,7 +24,7 @@ index 6e3a429bc165d8473ea50ee2ae1548270db599d1..417afe621f559d7fab0798ccf586b630
} }
public <T extends Entity> void getEntities(final EntityType<?> type, final AABB box, final List<? super T> into, public <T extends Entity> void getEntities(final EntityType<?> type, final AABB box, final List<? super T> into,
@@ -552,6 +559,13 @@ public final class ChunkEntitySlices { @@ -574,6 +581,13 @@ public final class ChunkEntitySlices {
public boolean getEntitiesLimited(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate, public boolean getEntitiesLimited(final Entity except, final AABB box, final List<Entity> into, final Predicate<? super Entity> predicate,
final int maxCount) { final int maxCount) {
@@ -38,7 +38,7 @@ index 6e3a429bc165d8473ea50ee2ae1548270db599d1..417afe621f559d7fab0798ccf586b630
if (this.count == 0) { if (this.count == 0) {
return false; return false;
} }
@@ -573,8 +587,14 @@ public final class ChunkEntitySlices { @@ -595,8 +609,14 @@ public final class ChunkEntitySlices {
final Entity[] storage = list.storage; final Entity[] storage = list.storage;
@@ -83,10 +83,10 @@ index 2d24d03bbdb5ee0d862cbfff2219f58afffafe12..1bf06038d51efcc103fad23670686c30
} }
} }
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index d111bd5546613cefd8b4070788679901b7e5b8f4..99571af2e473cb14322625b0287b2f18fcf116d3 100644 index c24f09cf9959310353bd0fc5a5ff7498c6ea47a0..ca5e2ec53590b731aedf33dfd69e728992f52b91 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -1779,10 +1779,18 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -1772,10 +1772,18 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
this.getEntities(entityTypeTest, bounds, predicate, output, Integer.MAX_VALUE); this.getEntities(entityTypeTest, bounds, predicate, output, Integer.MAX_VALUE);
} }
@@ -106,7 +106,7 @@ index d111bd5546613cefd8b4070788679901b7e5b8f4..99571af2e473cb14322625b0287b2f18
Profiler.get().incrementCounter("getEntities"); Profiler.get().incrementCounter("getEntities");
if (entityTypeTest instanceof net.minecraft.world.entity.EntityType<T> byType) { if (entityTypeTest instanceof net.minecraft.world.entity.EntityType<T> byType) {
@@ -1799,7 +1807,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -1792,7 +1800,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
if (entityTypeTest == null) { if (entityTypeTest == null) {
if (maxCount != Integer.MAX_VALUE) { if (maxCount != Integer.MAX_VALUE) {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Use maxEntityCollision limit for entity retrieval
diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java
index 60b6b19ad5c70991afd5152b45ff20ade457bcd1..70f9a4e4d33dc349404e84faa834613a2d9f2e40 100644 index 6a28431c6a586adb6cd3e6d38e419fbaf8cafff7..5d4e0efabd61e848db8e0e309cdfd7adaa38b0ce 100644
--- a/net/minecraft/world/entity/LivingEntity.java --- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java
@@ -3696,7 +3696,17 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -3752,7 +3752,17 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
return; return;
} }
// Paper end - don't run getEntities if we're not going to use its result // Paper end - don't run getEntities if we're not going to use its result

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Explosion Durable Blocks
diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java diff --git a/net/minecraft/world/item/BlockItem.java b/net/minecraft/world/item/BlockItem.java
index cc363ba3bc719d8b93992141d779b4c1d1bbd2fb..cdcaf954cec280970f29ac11db906457f18190c6 100644 index b5b53168755525eccaa0a4361172006522cf4e05..56acdfc2a8d2ecd716065263c59dbcb0ec7135bf 100644
--- a/net/minecraft/world/item/BlockItem.java --- a/net/minecraft/world/item/BlockItem.java
+++ b/net/minecraft/world/item/BlockItem.java +++ b/net/minecraft/world/item/BlockItem.java
@@ -38,8 +38,31 @@ public class BlockItem extends Item { @@ -38,8 +38,31 @@ public class BlockItem extends Item {
@@ -41,7 +41,7 @@ index cc363ba3bc719d8b93992141d779b4c1d1bbd2fb..cdcaf954cec280970f29ac11db906457
return !interactionResult.consumesAction() && context.getItemInHand().has(DataComponents.CONSUMABLE) return !interactionResult.consumesAction() && context.getItemInHand().has(DataComponents.CONSUMABLE)
? super.use(context.getLevel(), context.getPlayer(), context.getHand()) ? super.use(context.getLevel(), context.getPlayer(), context.getHand())
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index c7a5d369e9889353242d8a70772b2c45684a6951..54d97a271e6a500f5e4ca74bcecbb0f8a1fd1ae2 100644 index ca5e2ec53590b731aedf33dfd69e728992f52b91..5aaa3f01b7e8b55742ba46dd614f1eaa233aa5c9 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -830,6 +830,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -830,6 +830,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -53,7 +53,7 @@ index c7a5d369e9889353242d8a70772b2c45684a6951..54d97a271e6a500f5e4ca74bcecbb0f8
protected Level( protected Level(
WritableLevelData levelData, WritableLevelData levelData,
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 9f0dcaf0db44925c35fa46fdb2de83540ee959c4..48d98bac0140cec91fe2c9e7bb72a6f05a70aa49 100644 index d45582bdfc3fa837c5aa95f499183b60b877b7c2..4a6677fbc520d3f5d537f35a92dab9ec69db47a0 100644
--- a/net/minecraft/world/level/ServerExplosion.java --- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java
@@ -131,7 +131,7 @@ public class ServerExplosion implements Explosion { @@ -131,7 +131,7 @@ public class ServerExplosion implements Explosion {
@@ -86,7 +86,7 @@ index 9f0dcaf0db44925c35fa46fdb2de83540ee959c4..48d98bac0140cec91fe2c9e7bb72a6f0
public ServerExplosion( public ServerExplosion(
ServerLevel level, ServerLevel level,
@@ -767,6 +781,14 @@ public class ServerExplosion implements Explosion { @@ -770,6 +784,14 @@ public class ServerExplosion implements Explosion {
} }
} }
// CraftBukkit end // CraftBukkit end

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Configure cannon physics
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
index 44aaaa87d63a2a2287f89feaa431ca0e80da3dab..194db5ff2a473b10fded4491c1173d420f46424d 100644 index 548e3dc8e5fee004483b40a59e2502ba8b93e674..ac78d85e5f9a370eda7c8db8ea02198fb2b50464 100644
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java --- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java +++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
@@ -1774,6 +1774,13 @@ public final class CollisionUtil { @@ -1774,6 +1774,13 @@ public final class CollisionUtil {
@@ -67,10 +67,10 @@ index 44aaaa87d63a2a2287f89feaa431ca0e80da3dab..194db5ff2a473b10fded4491c1173d42
if (xSmaller && z != 0.0) { if (xSmaller && z != 0.0) {
z = performAABBCollisionsZ(axisalignedbb, z, aabbs); z = performAABBCollisionsZ(axisalignedbb, z, aabbs);
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25d13b6bd9 100644 index 2f80403bb400e88395df9d46a39c4adf69e479d7..751f8e3045dbb090f16f099097bf31b638df39d7 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -570,6 +570,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -587,6 +587,42 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
} }
// Sakura end - merge cannon entities // Sakura end - merge cannon entities
@@ -80,11 +80,40 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25
+ public final me.samsuik.sakura.physics.PhysicsVersion physics() { + public final me.samsuik.sakura.physics.PhysicsVersion physics() {
+ return this.physics; + return this.physics;
+ } + }
+
+ private static void changeEntityPosition(final Entity entity, final Vec3 position, final Vec3 relativeMovement,
+ final me.samsuik.sakura.physics.PhysicsVersion physics) {
+ final Vec3 newPosition = position.add(relativeMovement);
+ final Vec3 newEntityPosition;
+ if (physics.is(1_21_5)) {
+ newEntityPosition = manglePosition(position, relativeMovement);
+ } else {
+ newEntityPosition = newPosition;
+ }
+
+ if (physics.afterOrEqual(1_21_5)) {
+ entity.addMovementThisTick(new Entity.Movement(position, newPosition, true));
+ }
+
+ entity.setPos(newEntityPosition);
+ }
+
+ private static Vec3 manglePosition(final Vec3 position, final Vec3 relativeMovement) {
+ Vec3 newPosition = position;
+ for (final Direction.Axis axis : axisStepOrder(relativeMovement)) {
+ final double movement = relativeMovement.get(axis);
+ if (movement != 0.0) {
+ newPosition = newPosition.relative(axis.getPositive(), movement);
+ }
+ }
+
+ return newPosition;
+ }
+ // Sakura end - configure cannon physics + // Sakura end - configure cannon physics
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
@@ -1089,7 +1096,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1111,7 +1147,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
protected void checkSupportingBlock(boolean onGround, @Nullable Vec3 movement) { protected void checkSupportingBlock(boolean onGround, @Nullable Vec3 movement) {
@@ -93,7 +122,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25
AABB boundingBox = this.getBoundingBox(); AABB boundingBox = this.getBoundingBox();
AABB aabb = new AABB(boundingBox.minX, boundingBox.minY - 1.0E-6, boundingBox.minZ, boundingBox.maxX, boundingBox.minY, boundingBox.maxZ); AABB aabb = new AABB(boundingBox.minX, boundingBox.minY - 1.0E-6, boundingBox.minZ, boundingBox.maxX, boundingBox.minY, boundingBox.maxZ);
Optional<BlockPos> optional = this.level.findSupportingBlock(this, aabb); Optional<BlockPos> optional = this.level.findSupportingBlock(this, aabb);
@@ -1139,7 +1146,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1161,7 +1197,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (this.noPhysics) { if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else { } else {
@@ -105,7 +134,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25
// Paper start - EAR 2 // Paper start - EAR 2
this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20);
this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20);
@@ -1168,8 +1178,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1190,8 +1229,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
movement = this.maybeBackOffFromEdge(movement, type); movement = this.maybeBackOffFromEdge(movement, type);
Vec3 vec3 = this.collide(movement); Vec3 vec3 = this.collide(movement);
double d = vec3.lengthSqr(); double d = vec3.lengthSqr();
@@ -118,20 +147,18 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25
BlockHitResult blockHitResult = this.level() BlockHitResult blockHitResult = this.level()
.clip( .clip(
new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this) new ClipContext(this.position(), this.position().add(vec3), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this)
@@ -1191,6 +1203,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1202,9 +1243,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
} }
+ // Sakura start - configure cannon physics Vec3 vec31 = this.position();
+ if (physics.before(1_21_5)) { - Vec3 vec32 = vec31.add(vec3);
+ list.clear(); - this.addMovementThisTick(new Entity.Movement(vec31, vec32, true));
+ vec31 = this.position().add(vec3); - this.setPos(vec32);
+ } + changeEntityPosition(this, vec31, vec3, physics); // Sakura - configure cannon physics
+ // Sakura end - configure cannon physics
this.movementThisTick.add(list);
this.setPos(vec31);
} }
@@ -1223,6 +1241,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
profilerFiller.pop();
@@ -1235,6 +1274,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} else { } else {
if (this.horizontalCollision) { if (this.horizontalCollision) {
Vec3 deltaMovement = this.getDeltaMovement(); Vec3 deltaMovement = this.getDeltaMovement();
@@ -144,7 +171,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25
this.setDeltaMovement(flag ? 0.0 : deltaMovement.x, deltaMovement.y, flag1 ? 0.0 : deltaMovement.z); this.setDeltaMovement(flag ? 0.0 : deltaMovement.x, deltaMovement.y, flag1 ? 0.0 : deltaMovement.z);
} }
@@ -1539,7 +1563,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1568,7 +1613,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
bb = currBoundingBox.expandTowards(movement.x, movement.y, movement.z); bb = currBoundingBox.expandTowards(movement.x, movement.y, movement.z);
} }
this.collectCollisions(bb, voxelList, bbList, ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER); this.collectCollisions(bb, voxelList, bbList, ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER);
@@ -153,7 +180,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25
} }
private Vec3 collideAxisScan(Vec3 movement, AABB currBoundingBox, List<VoxelShape> voxelList, List<AABB> bbList) { private Vec3 collideAxisScan(Vec3 movement, AABB currBoundingBox, List<VoxelShape> voxelList, List<AABB> bbList) {
@@ -1547,7 +1571,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1576,7 +1621,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
double y = movement.y; double y = movement.y;
double z = movement.z; double z = movement.z;
@@ -165,7 +192,7 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25
if (y != 0.0) { if (y != 0.0) {
y = this.scanY(currBoundingBox, y, voxelList, bbList); y = this.scanY(currBoundingBox, y, voxelList, bbList);
@@ -1669,7 +1696,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1698,7 +1746,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), null // Sakura - load chunks on movement ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER | this.getExtraCollisionFlags(), null // Sakura - load chunks on movement
); );
potentialCollisionsBB.addAll(entityAABBs); potentialCollisionsBB.addAll(entityAABBs);
@@ -174,28 +201,28 @@ index 98107921d7251e1b7fc621103a31afdfd3bb5af7..e9f9e7b2fdd0472c50f3f9042e450f25
final boolean collidedX = collided.x != movement.x; final boolean collidedX = collided.x != movement.x;
final boolean collidedY = collided.y != movement.y; final boolean collidedY = collided.y != movement.y;
@@ -1795,11 +1822,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1843,11 +1891,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
for (Entity.Movement movement : movements) { }
Vec3 vec3 = movement.from();
Vec3 vec31 = movement.to(); private void checkInsideBlocks(Vec3 vec3, Vec3 vec31, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector, LongSet set) {
- AABB aabb = this.makeBoundingBox(vec31).deflate(1.0E-5F); - AABB aabb = this.makeBoundingBox(vec31).deflate(1.0E-5F);
+ // Sakura start - configure cannon physics + // Sakura start - configure cannon physics
+ double margin = this.physics.afterOrEqual(1_21_2) ? 1.0E-5f : this.physics.afterOrEqual(1_19_3) ? 1.0E-7 : 0.001; + double margin = this.physics.afterOrEqual(1_21_2) ? 1.0E-5f : this.physics.afterOrEqual(1_19_3) ? 1.0E-7 : 0.001;
+ AABB aabb = this.makeBoundingBox(vec31).deflate(margin); + AABB aabb = this.makeBoundingBox(vec31).deflate(margin);
+ // Sakura end - configure cannon physics + // Sakura end - configure cannon physics
BlockGetter.forEachBlockIntersectedBetween( BlockGetter.forEachBlockIntersectedBetween(
vec3, vec3,
vec31, vec31,
aabb, aabb,
+ this.physics, // Sakura - configure cannon physics + this.physics, // Sakura - configure cannon physics
(pos, step) -> { (pos, index) -> {
if (this.isAlive()) { if (!this.isAlive()) {
BlockState blockState = this.level().getBlockState(pos); return false;
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17318fad6b 100644 index 0b4cb90a6877c2af4ef1eccd502b50c863bf74b0..fb3f28ee3b018462f2274e997d540029560df8d0 100644
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -127,6 +127,43 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -130,6 +130,43 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
return this.sakura_collide(movement); return this.sakura_collide(movement);
} }
// Sakura end - optimise cannon entity movement // Sakura end - optimise cannon entity movement
@@ -239,7 +266,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17
public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) { public FallingBlockEntity(EntityType<? extends FallingBlockEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -147,6 +184,10 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -150,6 +187,10 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
this.yo = y; this.yo = y;
this.zo = z; this.zo = z;
this.setStartPos(this.blockPosition()); this.setStartPos(this.blockPosition());
@@ -250,7 +277,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17
} }
// Sakura start - falling block height parity api // Sakura start - falling block height parity api
@@ -179,7 +220,11 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -182,7 +223,11 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState blockState.hasProperty(BlockStateProperties.WATERLOGGED) ? blockState.setValue(BlockStateProperties.WATERLOGGED, false) : blockState
); );
if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(fallingBlockEntity, pos, blockState.getFluidState().createLegacyBlock())) return fallingBlockEntity; // CraftBukkit if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(fallingBlockEntity, pos, blockState.getFluidState().createLegacyBlock())) return fallingBlockEntity; // CraftBukkit
@@ -263,7 +290,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17
level.addFreshEntity(fallingBlockEntity); level.addFreshEntity(fallingBlockEntity);
return fallingBlockEntity; return fallingBlockEntity;
} }
@@ -223,7 +268,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -226,7 +271,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
@Override @Override
protected double getDefaultGravity() { protected double getDefaultGravity() {
@@ -272,7 +299,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17
} }
@Override @Override
@@ -232,6 +277,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -235,6 +280,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause
} else { } else {
Block block = this.blockState.getBlock(); Block block = this.blockState.getBlock();
@@ -285,7 +312,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17
this.time++; this.time++;
this.applyGravity(); this.applyGravity();
this.move(MoverType.SELF, this.getDeltaMovement()); this.move(MoverType.SELF, this.getDeltaMovement());
@@ -246,8 +297,15 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -249,8 +300,15 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
} }
// Paper end - Configurable falling blocks height nerf // Paper end - Configurable falling blocks height nerf
this.handlePortal(); this.handlePortal();
@@ -302,7 +329,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17
boolean flag = this.level().sakuraConfig().cannons.sand.concreteSolidifyInWater && this.blockState.getBlock() instanceof ConcretePowderBlock; // Sakura - configure concrete solidifying in water boolean flag = this.level().sakuraConfig().cannons.sand.concreteSolidifyInWater && this.blockState.getBlock() instanceof ConcretePowderBlock; // Sakura - configure concrete solidifying in water
boolean flag1 = flag && this.level().getFluidState(blockPos).is(FluidTags.WATER); boolean flag1 = flag && this.level().getFluidState(blockPos).is(FluidTags.WATER);
double d = this.getDeltaMovement().lengthSqr(); double d = this.getDeltaMovement().lengthSqr();
@@ -274,8 +332,11 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -277,8 +335,11 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
} }
} else { } else {
BlockState blockState = this.level().getBlockState(blockPos); BlockState blockState = this.level().getBlockState(blockPos);
@@ -316,7 +343,7 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17
if (!this.cancelDrop) { if (!this.cancelDrop) {
boolean canBeReplaced = blockState.canBeReplaced( boolean canBeReplaced = blockState.canBeReplaced(
new DirectionalPlaceContext(this.level(), blockPos, Direction.DOWN, ItemStack.EMPTY, Direction.UP) new DirectionalPlaceContext(this.level(), blockPos, Direction.DOWN, ItemStack.EMPTY, Direction.UP)
@@ -344,7 +405,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -351,7 +412,12 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
} }
} }
@@ -331,10 +358,10 @@ index e0cee4cda2fb2d55e1da0cedc71cdc0c445108d0..3b83c101fd5583f45fdd6fa20e92bc17
} }
diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java diff --git a/net/minecraft/world/entity/item/PrimedTnt.java b/net/minecraft/world/entity/item/PrimedTnt.java
index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b583675dab608 100644 index 9a4b9be72e896ad4def7caa89716c707cfb5cc06..9d563a447d00b3ef53de48582d55abe4eb954182 100644
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -89,6 +89,22 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -88,6 +88,22 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak
return this.sakura_collide(movement); return this.sakura_collide(movement);
} }
// Sakura end - optimise cannon entity movement // Sakura end - optimise cannon entity movement
@@ -357,7 +384,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836
public PrimedTnt(EntityType<? extends PrimedTnt> entityType, Level level) { public PrimedTnt(EntityType<? extends PrimedTnt> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -114,6 +130,13 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -113,6 +129,13 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak
case Y -> this.setDeltaMovement(this.getDeltaMovement().multiply(0.0, 1.0, 0.0)); case Y -> this.setDeltaMovement(this.getDeltaMovement().multiply(0.0, 1.0, 0.0));
} }
// Sakura end - configure cannon mechanics // Sakura end - configure cannon mechanics
@@ -371,7 +398,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836
} }
// Sakura start - optimise tnt fluid state // Sakura start - optimise tnt fluid state
@@ -149,7 +172,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -148,7 +171,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak
@Override @Override
protected double getDefaultGravity() { protected double getDefaultGravity() {
@@ -380,7 +407,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836
} }
@Override @Override
@@ -165,14 +188,19 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -164,14 +187,19 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak
return; return;
} }
// Paper end - Configurable TNT height nerf // Paper end - Configurable TNT height nerf
@@ -403,7 +430,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event // 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.discard();
this.tryToRespawnEntity(); // Sakura - merge cannon entities this.tryToRespawnEntity(); // Sakura - merge cannon entities
@@ -226,13 +254,14 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -210,13 +238,14 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak
return; return;
} }
// CraftBukkit end // CraftBukkit end
@@ -419,7 +446,7 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836
this.getZ(), this.getZ(),
event.getRadius(), // CraftBukkit event.getRadius(), // CraftBukkit
event.getFire(), // CraftBukkit event.getFire(), // CraftBukkit
@@ -318,7 +347,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak @@ -307,7 +336,7 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak
// Paper start - Option to prevent TNT from moving in water // Paper start - Option to prevent TNT from moving in water
@Override @Override
public boolean isPushedByFluid() { public boolean isPushedByFluid() {
@@ -429,27 +456,27 @@ index d523cc4e7089e04d577248d26d7d4e911cd87434..e37c07ca244ccf02e474632a072b5836
// Paper end - Option to prevent TNT from moving in water // Paper end - Option to prevent TNT from moving in water
} }
diff --git a/net/minecraft/world/level/BlockGetter.java b/net/minecraft/world/level/BlockGetter.java diff --git a/net/minecraft/world/level/BlockGetter.java b/net/minecraft/world/level/BlockGetter.java
index dd7e32b8b176c0f4c13e50aeed33c2c9ccba4b53..673e07e24c0cc0bc8301a15ca028c0bd72a3439c 100644 index 2146efa860d8323a88f3ad365c0cdb66de42154a..67c9393133f4509abf1bd352fbbc8e21dbb116e2 100644
--- a/net/minecraft/world/level/BlockGetter.java --- a/net/minecraft/world/level/BlockGetter.java
+++ b/net/minecraft/world/level/BlockGetter.java +++ b/net/minecraft/world/level/BlockGetter.java
@@ -213,8 +213,14 @@ public interface BlockGetter extends LevelHeightAccessor { @@ -213,8 +213,14 @@ public interface BlockGetter extends LevelHeightAccessor {
} }
static void forEachBlockIntersectedBetween(Vec3 from, Vec3 to, AABB boundingBox, BlockGetter.BlockStepVisitor stepVisitor) { static boolean forEachBlockIntersectedBetween(Vec3 from, Vec3 to, AABB boundingBox, BlockGetter.BlockStepVisitor visitor) {
+ // Sakura start - configure cannon physics + // Sakura start - configure cannon physics
+ forEachBlockIntersectedBetween(from, to, boundingBox, null, stepVisitor); + return forEachBlockIntersectedBetween(from, to, boundingBox, null, visitor);
+ } + }
+ +
+ static void forEachBlockIntersectedBetween(Vec3 from, Vec3 to, AABB boundingBox, me.samsuik.sakura.physics.PhysicsVersion physics, BlockGetter.BlockStepVisitor stepVisitor) { + static boolean forEachBlockIntersectedBetween(Vec3 from, Vec3 to, AABB boundingBox, me.samsuik.sakura.physics.PhysicsVersion physics, BlockGetter.BlockStepVisitor visitor) {
Vec3 vec3 = to.subtract(from); Vec3 vec3 = to.subtract(from);
- if (!(vec3.lengthSqr() < Mth.square(0.99999F))) { - if (vec3.lengthSqr() < Mth.square(0.99999F)) {
+ if ((physics == null || physics.afterOrEqual(1_21_2)) && !(vec3.lengthSqr() < Mth.square(0.99999F))) { + if (physics != null && physics.before(1_21_2) || vec3.lengthSqr() < Mth.square(0.99999F)) {
+ // Sakura end - configure cannon physics + // Sakura end - configure cannon physics
LongSet set = new LongOpenHashSet(); for (BlockPos blockPos : BlockPos.betweenClosed(boundingBox)) {
Vec3 minPosition = boundingBox.getMinPosition(); if (!visitor.visit(blockPos, 0)) {
Vec3 vec31 = minPosition.subtract(vec3); return false;
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb3770451807 100644 index ad27005c70cfb48eba05a2cdc42d45d626774999..82ed7843e415595df83c3fb74876ed81d6e63db4 100644
--- a/net/minecraft/world/level/ServerExplosion.java --- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java
@@ -409,6 +409,7 @@ public class ServerExplosion implements Explosion { @@ -409,6 +409,7 @@ public class ServerExplosion implements Explosion {
@@ -460,15 +487,15 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37
public ServerExplosion( public ServerExplosion(
ServerLevel level, ServerLevel level,
@@ -430,6 +431,7 @@ public class ServerExplosion implements Explosion { @@ -433,6 +434,7 @@ public class ServerExplosion implements Explosion {
this.damageCalculator = damageCalculator == null ? this.makeDamageCalculator(source) : damageCalculator; this.yield = Double.isFinite(this.yield) ? this.yield : 0; // Paper - Don't allow infinite default yields
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit // Paper end - add yield
this.consistentRadius = level.localConfig().config(BlockPos.containing(this.center)).consistentRadius; // Sakura - consistent explosion radius this.consistentRadius = level.localConfig().config(BlockPos.containing(this.center)).consistentRadius; // Sakura - consistent explosion radius
+ this.physics = source != null ? source.physics() : level.localConfig().config(BlockPos.containing(this.center)).physicsVersion; // Sakura - configure cannon physics + this.physics = source != null ? source.physics() : level.localConfig().config(BlockPos.containing(this.center)).physicsVersion; // Sakura - configure cannon physics
} }
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) { private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
@@ -459,8 +461,13 @@ public class ServerExplosion implements Explosion { @@ -462,8 +464,13 @@ public class ServerExplosion implements Explosion {
final float density = entity.level().densityCache.getKnownDensity(vec3); final float density = entity.level().densityCache.getKnownDensity(vec3);
if (density != me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) { if (density != me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
hitResult = density != 0.0f ? net.minecraft.world.phys.HitResult.Type.MISS : net.minecraft.world.phys.HitResult.Type.BLOCK; hitResult = density != 0.0f ? net.minecraft.world.phys.HitResult.Type.MISS : net.minecraft.world.phys.HitResult.Type.BLOCK;
@@ -483,7 +510,7 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37
} }
if (hitResult == HitResult.Type.MISS) { if (hitResult == HitResult.Type.MISS) {
// Sakura end - replace density cache // Sakura end - replace density cache
@@ -558,6 +565,15 @@ public class ServerExplosion implements Explosion { @@ -561,6 +568,15 @@ public class ServerExplosion implements Explosion {
} }
if (cachedBlock.outOfWorld) { if (cachedBlock.outOfWorld) {
@@ -499,7 +526,7 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37
break; break;
} }
final BlockState iblockdata = cachedBlock.blockState; final BlockState iblockdata = cachedBlock.blockState;
@@ -653,6 +669,12 @@ public class ServerExplosion implements Explosion { @@ -656,6 +672,12 @@ public class ServerExplosion implements Explosion {
double d2 = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - this.center.y; double d2 = (entity instanceof PrimedTnt ? entity.getY() : entity.getEyeY()) - this.center.y;
double d3 = entity.getZ() - this.center.z; double d3 = entity.getZ() - this.center.z;
double squareRoot = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3); double squareRoot = Math.sqrt(d1 * d1 + d2 * d2 + d3 * d3);
@@ -512,7 +539,7 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37
if (squareRoot != 0.0) { if (squareRoot != 0.0) {
d1 /= squareRoot; d1 /= squareRoot;
d2 /= squareRoot; d2 /= squareRoot;
@@ -942,7 +964,7 @@ public class ServerExplosion implements Explosion { @@ -939,7 +961,7 @@ public class ServerExplosion implements Explosion {
// Sakura start - replace density cache // Sakura start - replace density cache
float blockDensity = this.level.densityCache.getDensity(vec3d, entity); float blockDensity = this.level.densityCache.getDensity(vec3d, entity);
if (blockDensity == me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) { if (blockDensity == me.samsuik.sakura.explosion.density.BlockDensityCache.UNKNOWN_DENSITY) {
@@ -521,7 +548,7 @@ index 323e91e494aef643ecd6f47c5b149a8e36a59dfb..ccf5470c26dee1431e2bd8fa8a90fb37
this.level.densityCache.putDensity(vec3d, entity, blockDensity); this.level.densityCache.putDensity(vec3d, entity, blockDensity);
// Sakura end - replace density cache // Sakura end - replace density cache
} }
@@ -950,6 +972,16 @@ public class ServerExplosion implements Explosion { @@ -947,6 +969,16 @@ public class ServerExplosion implements Explosion {
return blockDensity; return blockDensity;
} }
@@ -802,10 +829,10 @@ index 6c789e56f21f01252c21786cfeb48d88485b5636..17ecdee7bd6a8369394115d6534c9d7e
} }
diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java diff --git a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d5c5e12a1 100644 index e87b685d4a2bc31a1d7a1a31881152abc37563ba..2d812099459b808bc0205e4108ef856a3dba6bbe 100644
--- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -65,6 +65,150 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -64,6 +64,150 @@ public class PistonMovingBlockEntity extends BlockEntity {
this.isSourcePiston = isSourcePiston; this.isSourcePiston = isSourcePiston;
} }
@@ -956,7 +983,7 @@ index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d
@Override @Override
public CompoundTag getUpdateTag(HolderLookup.Provider registries) { public CompoundTag getUpdateTag(HolderLookup.Provider registries) {
return this.saveCustomOnly(registries); return this.saveCustomOnly(registries);
@@ -169,6 +313,12 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -168,6 +312,12 @@ public class PistonMovingBlockEntity extends BlockEntity {
double d4 = 0.0; double d4 = 0.0;
@@ -969,7 +996,7 @@ index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d
for (AABB aabb1 : list) { for (AABB aabb1 : list) {
AABB movementArea = PistonMath.getMovementArea(moveByPositionAndProgress(pos, aabb1, piston), movementDirection, d); AABB movementArea = PistonMath.getMovementArea(moveByPositionAndProgress(pos, aabb1, piston), movementDirection, d);
AABB boundingBox = entity.getBoundingBox(); AABB boundingBox = entity.getBoundingBox();
@@ -196,6 +346,11 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -195,6 +345,11 @@ public class PistonMovingBlockEntity extends BlockEntity {
NOCLIP.set(noClipDirection); NOCLIP.set(noClipDirection);
Vec3 vec3 = entity.position(); Vec3 vec3 = entity.position();
entity.move(MoverType.PISTON, new Vec3(progress * direction.getStepX(), progress * direction.getStepY(), progress * direction.getStepZ())); entity.move(MoverType.PISTON, new Vec3(progress * direction.getStepX(), progress * direction.getStepY(), progress * direction.getStepZ()));
@@ -979,9 +1006,9 @@ index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d
+ } + }
+ // Sakura end - configure cannon physics + // Sakura end - configure cannon physics
entity.applyEffectsFromBlocks(vec3, entity.position()); entity.applyEffectsFromBlocks(vec3, entity.position());
entity.removeLatestMovementRecordingBatch(); entity.removeLatestMovementRecording();
NOCLIP.set(null); NOCLIP.set(null);
@@ -308,12 +463,21 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -307,12 +462,21 @@ public class PistonMovingBlockEntity extends BlockEntity {
} }
public static void tick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity) { public static void tick(Level level, BlockPos pos, BlockState state, PistonMovingBlockEntity blockEntity) {
@@ -1003,7 +1030,7 @@ index 7277004b03287fdf9f3345d445740af27f02d772..564de0eccc2ab4063ee4de99ffa5554d
level.removeBlockEntity(pos); level.removeBlockEntity(pos);
blockEntity.setRemoved(); blockEntity.setRemoved();
if (level.getBlockState(pos).is(Blocks.MOVING_PISTON)) { if (level.getBlockState(pos).is(Blocks.MOVING_PISTON)) {
@@ -335,12 +499,22 @@ public class PistonMovingBlockEntity extends BlockEntity { @@ -334,12 +498,22 @@ public class PistonMovingBlockEntity extends BlockEntity {
} }
} else { } else {
float f = blockEntity.progress + 0.5F; float f = blockEntity.progress + 0.5F;

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Collide with non-solid blocks
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
index 194db5ff2a473b10fded4491c1173d420f46424d..c09658eb8c2824ac0c887f94771d9b467ecab8b1 100644 index ac78d85e5f9a370eda7c8db8ea02198fb2b50464..0de9f3d0fb5abbb86bcb9bd2546cea198d105d88 100644
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java --- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java +++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
@@ -1908,6 +1908,7 @@ public final class CollisionUtil { @@ -1908,6 +1908,7 @@ public final class CollisionUtil {
@@ -46,10 +46,10 @@ index 194db5ff2a473b10fded4491c1173d420f46424d..c09658eb8c2824ac0c887f94771d9b46
blockCollision = blockData.getCollisionShape(world, mutablePos, collisionShape); blockCollision = blockData.getCollisionShape(world, mutablePos, collisionShape);
} }
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 162062200a4ffa7bc669093779377f0d8d83172e..d61ac5aae3deb9bd145787351fb85051d4ff1aed 100644 index 751f8e3045dbb090f16f099097bf31b638df39d7..f8efa8d7ea4e79a4baac820f0042c2da7259a849 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -531,6 +531,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -548,6 +548,14 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
flags |= ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_ADD_TICKET; flags |= ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_ADD_TICKET;
} }

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Add entity travel distance limits
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index b9806bdd4d49ed3fd8c17125143703b6a792b10e..4b3ee01e9dac634941b6cfb0cab43ba1b9069fc9 100644 index bad69adfbc492d851a3542dc7f77884d9f933c8a..9250806b12171ae4f14d8dbc9dd3d9478bc7b724 100644
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -1295,6 +1295,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -1303,6 +1303,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2 final boolean isActive = io.papermc.paper.entity.activation.ActivationRange.checkIfActive(entity); // Paper - EAR 2
if (isActive) { // Paper - EAR 2 if (isActive) { // Paper - EAR 2
entity.tick(); entity.tick();
@@ -21,11 +21,11 @@ index b9806bdd4d49ed3fd8c17125143703b6a792b10e..4b3ee01e9dac634941b6cfb0cab43ba1
} else {entity.inactiveTick();} // Paper - EAR 2 } else {entity.inactiveTick();} // Paper - EAR 2
profilerFiller.pop(); profilerFiller.pop();
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index d61ac5aae3deb9bd145787351fb85051d4ff1aed..ffe5ad8f3936386fd1fa2b961837fbea5c230407 100644 index f8efa8d7ea4e79a4baac820f0042c2da7259a849..13b7652cd95b4411927d1e041b246d063fa80fae 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -585,6 +585,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -631,6 +631,19 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.physics; return newPosition;
} }
// Sakura end - configure cannon physics // Sakura end - configure cannon physics
+ // Sakura start - entity travel distance limits + // Sakura start - entity travel distance limits
@@ -44,7 +44,7 @@ index d61ac5aae3deb9bd145787351fb85051d4ff1aed..ffe5ad8f3936386fd1fa2b961837fbea
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
@@ -614,6 +627,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -660,6 +673,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.setPos(0.0, 0.0, 0.0); this.setPos(0.0, 0.0, 0.0);
this.eyeHeight = this.dimensions.eyeHeight(); this.eyeHeight = this.dimensions.eyeHeight();
this.despawnTime = level == null || type == EntityType.PLAYER ? -1 : level.paperConfig().entities.spawning.despawnTime.getOrDefault(type, io.papermc.paper.configuration.type.number.IntOr.Disabled.DISABLED).or(-1); // Paper - entity despawn time limit this.despawnTime = level == null || type == EntityType.PLAYER ? -1 : level.paperConfig().entities.spawning.despawnTime.getOrDefault(type, io.papermc.paper.configuration.type.number.IntOr.Disabled.DISABLED).or(-1); // Paper - entity despawn time limit

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Configurable left shooting and adjusting limits
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 8548a41641534fabf44658f014d86df6d27046a0..6cd8e8bae0c62799fde7533f994eb71bf133fe35 100644 index 13b7652cd95b4411927d1e041b246d063fa80fae..ee7da44161fee45ce3de26d7e990eab3a3f5ff6e 100644
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -598,6 +598,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -644,6 +644,46 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return Math.max(x, z) >= this.travelDistanceLimit; return Math.max(x, z) >= this.travelDistanceLimit;
} }
// Sakura end - entity travel distance limits // Sakura end - entity travel distance limits
@@ -55,7 +55,7 @@ index 8548a41641534fabf44658f014d86df6d27046a0..6cd8e8bae0c62799fde7533f994eb71b
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
@@ -1606,6 +1646,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1656,6 +1696,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
if (xSmaller && z != 0.0) { if (xSmaller && z != 0.0) {
@@ -63,7 +63,7 @@ index 8548a41641534fabf44658f014d86df6d27046a0..6cd8e8bae0c62799fde7533f994eb71b
z = this.scanZ(currBoundingBox, z, voxelList, bbList); z = this.scanZ(currBoundingBox, z, voxelList, bbList);
if (z != 0.0) { if (z != 0.0) {
currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetZ(currBoundingBox, z); currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetZ(currBoundingBox, z);
@@ -1613,6 +1654,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -1663,6 +1704,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
} }
if (x != 0.0) { if (x != 0.0) {
@@ -76,10 +76,10 @@ index 8548a41641534fabf44658f014d86df6d27046a0..6cd8e8bae0c62799fde7533f994eb71b
if (x != 0.0) { if (x != 0.0) {
currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetX(currBoundingBox, x); currBoundingBox = ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.offsetX(currBoundingBox, x);
diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java diff --git a/net/minecraft/world/entity/item/FallingBlockEntity.java b/net/minecraft/world/entity/item/FallingBlockEntity.java
index 3b83c101fd5583f45fdd6fa20e92bc17318fad6b..60e1c2acb267eb277ba06903002a8d687fb309d0 100644 index fb3f28ee3b018462f2274e997d540029560df8d0..5a6e3769e3d9349927db1986256b3947ef30962e 100644
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -285,6 +285,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti @@ -288,6 +288,7 @@ public class FallingBlockEntity extends Entity implements me.samsuik.sakura.enti
// Sakura end - configure cannon physics // Sakura end - configure cannon physics
this.time++; this.time++;
this.applyGravity(); this.applyGravity();

View File

@@ -42,7 +42,7 @@ index b382665cc125b8b5c0938e5e55984e4bf91d37ff..0c4358053076416fc2cd3f5c9b7f6d2f
boolean isEmpty(); boolean isEmpty();
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 769887ee6d798d0b11de72e9ffe80c9d358daf17..701a48ba3b0f4515a791684d63b3454dbed317f9 100644 index 5aaa3f01b7e8b55742ba46dd614f1eaa233aa5c9..81378160d021a76d6fddca9c23a1a4691f48e71e 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -1483,7 +1483,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -1483,7 +1483,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -72,10 +72,10 @@ index 46a27f60ba407dacdac190b5e292ab3f1db5a078..ec05bb86803d878867b46e437cc73a39
} }
} }
diff --git a/net/minecraft/world/level/block/entity/BlockEntity.java b/net/minecraft/world/level/block/entity/BlockEntity.java diff --git a/net/minecraft/world/level/block/entity/BlockEntity.java b/net/minecraft/world/level/block/entity/BlockEntity.java
index a1075c26d55cc01219acd94d0138f81aa9d34c48..6aa0624eb99223dc13478a24f74a49654019fba5 100644 index 5986825d6a381eeb445dd424dd127864aa703163..f77a8c45602d9b30c357557e80a6a97abea99eb2 100644
--- a/net/minecraft/world/level/block/entity/BlockEntity.java --- a/net/minecraft/world/level/block/entity/BlockEntity.java
+++ b/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlockEntity.java
@@ -48,6 +48,60 @@ public abstract class BlockEntity { @@ -50,6 +50,60 @@ public abstract class BlockEntity {
private BlockState blockState; private BlockState blockState;
private DataComponentMap components = DataComponentMap.EMPTY; private DataComponentMap components = DataComponentMap.EMPTY;
@@ -136,7 +136,7 @@ index a1075c26d55cc01219acd94d0138f81aa9d34c48..6aa0624eb99223dc13478a24f74a4965
public BlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState blockState) { public BlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState blockState) {
this.type = type; this.type = type;
this.worldPosition = pos.immutable(); this.worldPosition = pos.immutable();
@@ -204,11 +258,22 @@ public abstract class BlockEntity { @@ -229,11 +283,22 @@ public abstract class BlockEntity {
public void setChanged() { public void setChanged() {
if (this.level != null) { if (this.level != null) {
if (ignoreBlockEntityUpdates) return; // Paper - Perf: Optimize Hoppers if (ignoreBlockEntityUpdates) return; // Paper - Perf: Optimize Hoppers
@@ -160,7 +160,7 @@ index a1075c26d55cc01219acd94d0138f81aa9d34c48..6aa0624eb99223dc13478a24f74a4965
level.blockEntityChanged(pos); level.blockEntityChanged(pos);
if (!state.isAir()) { if (!state.isAir()) {
level.updateNeighbourForOutputSignal(pos, state.getBlock()); level.updateNeighbourForOutputSignal(pos, state.getBlock());
@@ -238,6 +303,7 @@ public abstract class BlockEntity { @@ -263,6 +328,7 @@ public abstract class BlockEntity {
public void setRemoved() { public void setRemoved() {
this.remove = true; this.remove = true;
@@ -169,11 +169,11 @@ index a1075c26d55cc01219acd94d0138f81aa9d34c48..6aa0624eb99223dc13478a24f74a4965
public void clearRemoved() { public void clearRemoved() {
diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
index 15d4f60942c0cc612c1468b4c0fda886867a67cb..98856a692b3ae5ac46cb67678642709b4f931ee7 100644 index 800b7e78ae989868ed0b9e060c80dcd002759412..b40c1d20d5823fe63ec34e38a315c7f1bbb5831b 100644
--- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java
+++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java
@@ -28,7 +28,7 @@ import net.minecraft.world.level.block.HopperBlock; @@ -28,7 +28,7 @@ import net.minecraft.world.level.storage.ValueInput;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.storage.ValueOutput;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
-public class HopperBlockEntity extends RandomizableContainerBlockEntity implements Hopper { -public class HopperBlockEntity extends RandomizableContainerBlockEntity implements Hopper {
@@ -287,10 +287,10 @@ index 28e3b73507b988f7234cbf29c4024c88180d0aef..a0d247aa883553708c4b921582324255
+ // Sakura end - optimise hopper ticking + // Sakura end - optimise hopper ticking
} }
diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java
index cfc125d43cf3702d46c221f4e7b0d66a15c5d690..9f1a944b82051ea957a0fe725ca95b8f26491f1d 100644 index a2185062fbb123549be21e37e84541d61ec301c9..d961788584520f5231d65cc63753da4320a48867 100644
--- a/net/minecraft/world/level/chunk/LevelChunk.java --- a/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java
@@ -980,6 +980,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -987,6 +987,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
return BlockEntityType.getKey(this.blockEntity.getType()).toString(); return BlockEntityType.getKey(this.blockEntity.getType()).toString();
} }
@@ -304,7 +304,7 @@ index cfc125d43cf3702d46c221f4e7b0d66a15c5d690..9f1a944b82051ea957a0fe725ca95b8f
@Override @Override
public String toString() { public String toString() {
return "Level ticker for " + this.getType() + "@" + this.getPos(); return "Level ticker for " + this.getType() + "@" + this.getPos();
@@ -1028,6 +1035,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -1035,6 +1042,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p
return this.ticker.getType(); return this.ticker.getType();
} }

View File

@@ -0,0 +1,110 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Fri, 8 Nov 2024 19:35:49 +0000
Subject: [PATCH] Optimise check inside blocks and traverse blocks
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index ee7da44161fee45ce3de26d7e990eab3a3f5ff6e..b804964e620c49130c89d67e0371f06881b95eca 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1936,6 +1936,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private void checkInsideBlocks(List<Entity.Movement> movements, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector) {
if (this.isAffectedByBlocks()) {
LongSet set = this.visitedBlocks;
+ final net.minecraft.world.level.chunk.ChunkAccess[] chunkCache = new net.minecraft.world.level.chunk.ChunkAccess[4]; // Sakura - optimise check inside blocks
for (Entity.Movement movement : movements) {
Vec3 vec3 = movement.from;
@@ -1945,12 +1946,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
double d = vec31.get(axis);
if (d != 0.0) {
Vec3 vec32 = vec3.relative(axis.getPositive(), d);
- this.checkInsideBlocks(vec3, vec32, stepBasedCollector, set);
+ this.checkInsideBlocks(vec3, vec32, stepBasedCollector, set, chunkCache); // Sakura - optimise check inside blocks
vec3 = vec32;
}
}
} else {
- this.checkInsideBlocks(movement.from(), movement.to(), stepBasedCollector, set);
+ this.checkInsideBlocks(movement.from(), movement.to(), stepBasedCollector, set, chunkCache); // Sakura - optimise check inside blocks
}
}
@@ -1958,7 +1959,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
}
}
- private void checkInsideBlocks(Vec3 vec3, Vec3 vec31, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector, LongSet set) {
+ // Sakura start - optimise check inside blocks
+ private void checkInsideBlocks(Vec3 vec3, Vec3 vec31, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector,
+ LongSet set, net.minecraft.world.level.chunk.ChunkAccess[] chunkCache) {
+ // Sakura end - optimise check inside blocks
// Sakura start - configure cannon physics
double margin = this.physics.afterOrEqual(1_21_2) ? 1.0E-5f : this.physics.afterOrEqual(1_19_3) ? 1.0E-7 : 0.001;
AABB aabb = this.makeBoundingBox(vec31).deflate(margin);
@@ -1972,7 +1976,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
if (!this.isAlive()) {
return false;
} else {
- BlockState blockState = this.level().getBlockState(pos);
+ // Sakura start - optimise check inside blocks
+ final int chunkX = pos.getX() >> 4;
+ final int chunkZ = pos.getZ() >> 4;
+ final int chunkKey = ((chunkX << 2) | chunkZ) & 3;
+ net.minecraft.world.level.chunk.ChunkAccess chunk = chunkCache[chunkKey];
+ if (chunk == null || chunk.locX != chunkX || chunk.locZ != chunkZ) {
+ chunk = this.level().getChunkIfLoadedImmediately(chunkX, chunkZ);
+ if (chunk == null) {
+ return true;
+ }
+ chunkCache[chunkKey] = chunk;
+ }
+ final BlockState blockState = chunk.getBlockState(pos);
+ // Sakura end - optimise check inside blocks
if (blockState.isAir()) {
this.debugBlockIntersection(pos, false, false);
return true;
diff --git a/net/minecraft/world/level/BlockGetter.java b/net/minecraft/world/level/BlockGetter.java
index 67c9393133f4509abf1bd352fbbc8e21dbb116e2..9e235b8bec7ed8da7c0cb099c47c3b23fbccb9b4 100644
--- a/net/minecraft/world/level/BlockGetter.java
+++ b/net/minecraft/world/level/BlockGetter.java
@@ -221,7 +221,7 @@ public interface BlockGetter extends LevelHeightAccessor {
Vec3 vec3 = to.subtract(from);
if (physics != null && physics.before(1_21_2) || vec3.lengthSqr() < Mth.square(0.99999F)) {
// Sakura end - configure cannon physics
- for (BlockPos blockPos : BlockPos.betweenClosed(boundingBox)) {
+ for (BlockPos blockPos : me.samsuik.sakura.utils.BlockPosIterator.iterable(boundingBox)) { // Sakura - optimise check inside blocks
if (!visitor.visit(blockPos, 0)) {
return false;
}
@@ -229,6 +229,20 @@ public interface BlockGetter extends LevelHeightAccessor {
return true;
} else {
+ // Sakura start - optimise check inside blocks
+ final boolean xZero = vec3.x() == 0.0;
+ final boolean yZero = vec3.y() == 0.0;
+ final boolean zZero = vec3.z() == 0.0;
+ if (xZero && yZero || yZero && zZero || xZero && zZero) {
+ int blockIndex = 0;
+ for (final BlockPos blockPos : me.samsuik.sakura.utils.BlockPosIterator.traverseArea(vec3, boundingBox)) {
+ if (!visitor.visit(blockPos, blockIndex++)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ // Sakura end - optimise check inside blocks
LongSet set = new LongOpenHashSet();
Vec3 minPosition = boundingBox.getMinPosition();
Vec3 vec31 = minPosition.subtract(vec3);
@@ -236,7 +250,7 @@ public interface BlockGetter extends LevelHeightAccessor {
if (i < 0) {
return false;
} else {
- for (BlockPos blockPos1 : BlockPos.betweenClosed(boundingBox)) {
+ for (BlockPos blockPos1 : me.samsuik.sakura.utils.BlockPosIterator.iterable(boundingBox)) { // Sakura - optimise check inside blocks
if (!set.contains(blockPos1.asLong()) && !visitor.visit(blockPos1, i + 1)) {
return false;
}

View File

@@ -1,72 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Fri, 13 Sep 2024 17:22:51 +0100
Subject: [PATCH] Optimise entity scheduler ticking
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java
index 26207443b1223119c03db478d7e816d9cdf8e618..1664830a49f37825c39fb6b436011d8149196e3a 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/server/ServerEntityLookup.java
@@ -18,6 +18,22 @@ public final class ServerEntityLookup extends EntityLookup {
private final ServerLevel serverWorld;
public final ReferenceList<Entity> trackerEntities = new ReferenceList<>(EMPTY_ENTITY_ARRAY); // Moonrise - entity tracker
+ // Sakura start - optimise entity scheduler ticking
+ public final ReferenceList<org.bukkit.craftbukkit.entity.CraftEntity> scheduledEntities = new ReferenceList<>();
+
+ public void entityStartScheduled(final Entity entity) {
+ org.bukkit.craftbukkit.entity.CraftEntity bukkitEntity = entity.getBukkitEntityRaw();
+ if (bukkitEntity != null && bukkitEntity.taskScheduler.hasTask()) {
+ this.scheduledEntities.add(bukkitEntity);
+ }
+ }
+
+ public void entityEndScheduled(final Entity entity) {
+ if (entity.getBukkitEntityRaw() != null) {
+ this.scheduledEntities.remove(entity.getBukkitEntityRaw());
+ }
+ }
+ // Sakura end - optimise entity scheduler ticking
public ServerEntityLookup(final ServerLevel world, final LevelCallback<Entity> worldCallback) {
super(world, worldCallback);
@@ -89,6 +105,7 @@ public final class ServerEntityLookup extends EntityLookup {
// Moonrise start - entity tracker
this.trackerEntities.add(entity);
// Moonrise end - entity tracker
+ this.entityStartScheduled(entity); // Sakura - optimise entity scheduler ticking
}
@Override
@@ -96,6 +113,7 @@ public final class ServerEntityLookup extends EntityLookup {
// Moonrise start - entity tracker
this.trackerEntities.remove(entity);
// Moonrise end - entity tracker
+ this.entityEndScheduled(entity); // Sakura - optimise entity scheduler ticking
}
@Override
diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java
index b234215e59ac303ef7979031ab1b042ff6692b7a..4898079bb4cceeb1106e1eac08f92417bdb2daf7 100644
--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -1676,7 +1676,17 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
// Paper start - Folia scheduler API
((io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler) org.bukkit.Bukkit.getGlobalRegionScheduler()).tick();
getAllLevels().forEach(level -> {
- for (final net.minecraft.world.entity.Entity entity : level.getEntities().getAll()) {
+ // Sakura start - optimise entity scheduler ticking
+ final ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup entityLookup = (ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup) level.moonrise$getEntityLookup();
+ final java.util.Iterator<org.bukkit.craftbukkit.entity.CraftEntity> entityIterator = entityLookup.scheduledEntities.iterator();
+ while (entityIterator.hasNext()) {
+ final org.bukkit.craftbukkit.entity.CraftEntity scheduledEntity = entityIterator.next();
+ final net.minecraft.world.entity.Entity entity = scheduledEntity.getHandle();
+ if (!scheduledEntity.taskScheduler.hasTask()) {
+ entityIterator.remove();
+ continue;
+ }
+ // Sakura end - optimise entity scheduler ticking
if (entity.isRemoved()) {
continue;
}

View File

@@ -1,77 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Fri, 8 Nov 2024 19:35:49 +0000
Subject: [PATCH] Optimise check inside blocks and traverse blocks
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 6cd8e8bae0c62799fde7533f994eb71bf133fe35..61fc1dafd5af4c3d5a84f8c82b4350f2c311dc96 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -1886,6 +1886,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
private void checkInsideBlocks(List<Entity.Movement> movements, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector) {
if (this.isAffectedByBlocks()) {
LongSet set = this.visitedBlocks;
+ final net.minecraft.world.level.chunk.ChunkAccess[] chunkCache = new net.minecraft.world.level.chunk.ChunkAccess[4]; // Sakura - optimise check inside blocks
for (Entity.Movement movement : movements) {
Vec3 vec3 = movement.from();
@@ -1901,7 +1902,20 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
this.physics, // Sakura - configure cannon physics
(pos, step) -> {
if (this.isAlive()) {
- BlockState blockState = this.level().getBlockState(pos);
+ // Sakura start - optimise check inside blocks
+ final int chunkX = pos.getX() >> 4;
+ final int chunkZ = pos.getZ() >> 4;
+ final int chunkKey = ((chunkX << 2) | chunkZ) & 3;
+ net.minecraft.world.level.chunk.ChunkAccess chunk = chunkCache[chunkKey];
+ if (chunk == null || chunk.locX != chunkX || chunk.locZ != chunkZ) {
+ chunk = this.level().getChunkIfLoadedImmediately(chunkX, chunkZ);
+ if (chunk == null) {
+ return;
+ }
+ chunkCache[chunkKey] = chunk;
+ }
+ final BlockState blockState = chunk.getBlockState(pos);
+ // Sakura end - optimise check inside blocks
if (!blockState.isAir()) {
if (set.add(pos.asLong())) {
VoxelShape entityInsideCollisionShape = blockState.getEntityInsideCollisionShape(this.level(), pos, this);
diff --git a/net/minecraft/world/level/BlockGetter.java b/net/minecraft/world/level/BlockGetter.java
index 673e07e24c0cc0bc8301a15ca028c0bd72a3439c..11f9181e5c829cff7adf4feef9a6e6942b021850 100644
--- a/net/minecraft/world/level/BlockGetter.java
+++ b/net/minecraft/world/level/BlockGetter.java
@@ -221,18 +221,30 @@ public interface BlockGetter extends LevelHeightAccessor {
Vec3 vec3 = to.subtract(from);
if ((physics == null || physics.afterOrEqual(1_21_2)) && !(vec3.lengthSqr() < Mth.square(0.99999F))) {
// Sakura end - configure cannon physics
+ // Sakura start - optimise check inside blocks
+ final boolean xZero = vec3.x() == 0.0;
+ final boolean yZero = vec3.y() == 0.0;
+ final boolean zZero = vec3.z() == 0.0;
+ if (xZero && yZero || yZero && zZero || xZero && zZero) {
+ int blockIndex = 0;
+ for (BlockPos blockPos : me.samsuik.sakura.utils.BlockPosIterator.traverseArea(vec3, boundingBox)) {
+ stepVisitor.visit(blockPos, blockIndex++);
+ }
+ return;
+ }
+ // Sakura end - optimise check inside blocks
LongSet set = new LongOpenHashSet();
Vec3 minPosition = boundingBox.getMinPosition();
Vec3 vec31 = minPosition.subtract(vec3);
int i = addCollisionsAlongTravel(set, vec31, minPosition, boundingBox, stepVisitor);
- for (BlockPos blockPos1 : BlockPos.betweenClosed(boundingBox)) {
+ for (BlockPos blockPos1 : me.samsuik.sakura.utils.BlockPosIterator.iterable(boundingBox)) { // Sakura - optimise check inside blocks
if (!set.contains(blockPos1.asLong())) {
stepVisitor.visit(blockPos1, i + 1);
}
}
} else {
- for (BlockPos blockPos : BlockPos.betweenClosed(boundingBox)) {
+ for (BlockPos blockPos : me.samsuik.sakura.utils.BlockPosIterator.iterable(boundingBox)) { // Sakura - optimise check inside blocks
stepVisitor.visit(blockPos, 0);
}
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] copy EntityList implementation to BasicEntityList
diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
index 417afe621f559d7fab0798ccf586b630e8878b23..512a3b2d09d90e07158684995477d79dff3821b5 100644 index 7678696aa2fa74358a374a501a6b7f76f4805945..1fa98cb7f853a29d2eaa297fc4e6e4c20e8d49e4 100644
--- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java --- a/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
+++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java
@@ -396,6 +396,13 @@ public final class ChunkEntitySlices { @@ -418,6 +418,13 @@ public final class ChunkEntitySlices {
private E[] storage; private E[] storage;
private int size; private int size;
@@ -22,7 +22,7 @@ index 417afe621f559d7fab0798ccf586b630e8878b23..512a3b2d09d90e07158684995477d79d
public BasicEntityList() { public BasicEntityList() {
this(0); this(0);
@@ -416,6 +423,7 @@ public final class ChunkEntitySlices { @@ -438,6 +445,7 @@ public final class ChunkEntitySlices {
private void resize() { private void resize() {
if (this.storage == EMPTY) { if (this.storage == EMPTY) {
this.storage = (E[])new Entity[DEFAULT_CAPACITY]; this.storage = (E[])new Entity[DEFAULT_CAPACITY];
@@ -30,7 +30,7 @@ index 417afe621f559d7fab0798ccf586b630e8878b23..512a3b2d09d90e07158684995477d79d
} else { } else {
this.storage = Arrays.copyOf(this.storage, this.storage.length * 2); this.storage = Arrays.copyOf(this.storage, this.storage.length * 2);
} }
@@ -429,6 +437,7 @@ public final class ChunkEntitySlices { @@ -451,6 +459,7 @@ public final class ChunkEntitySlices {
} else { } else {
this.storage[idx] = entity; this.storage[idx] = entity;
} }
@@ -38,7 +38,7 @@ index 417afe621f559d7fab0798ccf586b630e8878b23..512a3b2d09d90e07158684995477d79d
} }
public int indexOf(final E entity) { public int indexOf(final E entity) {
@@ -444,24 +453,32 @@ public final class ChunkEntitySlices { @@ -466,24 +475,32 @@ public final class ChunkEntitySlices {
} }
public boolean remove(final E entity) { public boolean remove(final E entity) {

View File

@@ -33,10 +33,10 @@ index ff747a1ecdf3c888bca0d69de4f85dcd810b6139..d90f6aa4557b5863eba6a206226f763c
} }
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 8f17606889b767539c19015ae7f1cb7795616b88..529c412890993600d52287e0446757d1598bb45a 100644 index 9250806b12171ae4f14d8dbc9dd3d9478bc7b724..a3306fcdc83bb5f0157e1d9805a4d134403ce5f9 100644
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -689,6 +689,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @@ -693,6 +693,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
this.levelTickScheduler.registerNewTask(this.explosionPositions::clear, 0); // Sakura - client visibility settings this.levelTickScheduler.registerNewTask(this.explosionPositions::clear, 0); // Sakura - client visibility settings
this.levelTickScheduler.registerNewTask(this.mergeHandler::expire, 200); // Sakura - merge cannon entities this.levelTickScheduler.registerNewTask(this.mergeHandler::expire, 200); // Sakura - merge cannon entities
this.levelTickScheduler.registerNewTask(this.densityCache::invalidate, 0); // Sakura - explosion density cache this.levelTickScheduler.registerNewTask(this.densityCache::invalidate, 0); // Sakura - explosion density cache
@@ -45,7 +45,7 @@ index 8f17606889b767539c19015ae7f1cb7795616b88..529c412890993600d52287e0446757d1
// Paper start // Paper start
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 701a48ba3b0f4515a791684d63b3454dbed317f9..8156e920d76a92fd74b90de816aaff0ced480b5f 100644 index 81378160d021a76d6fddca9c23a1a4691f48e71e..e894c404d58f95c8f54987739ad24b6a0b96dfc3 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -831,6 +831,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -831,6 +831,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl
@@ -99,7 +99,7 @@ index 270c405a7384e3290b4eea58e0b231aa6235d85a..a1428aab6923a58c04d206d63babd932
: powerValue; : powerValue;
} }
diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java
index fed11ed5ab97826915710b66395d1bdc926935b0..d6131c5ec6a4229291f7cecb9cec9251d54244ed 100644 index 969488021cfc462b85750f25c1c256ab6709ff89..bfc63f858b229d9ccd1827821b66ba55124d2fda 100644
--- a/net/minecraft/world/level/block/state/BlockBehaviour.java --- a/net/minecraft/world/level/block/state/BlockBehaviour.java
+++ b/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java
@@ -521,6 +521,13 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -521,6 +521,13 @@ public abstract class BlockBehaviour implements FeatureElement {

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Configure breaking blocks outside the world border
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 9a3cf92fd767559484d3bd9f94e1c13facbfa86f..05d288c0f467ca28d28afa944c5ec41952085ec9 100644 index 78b44fc3dda798d54656318b948c55dcb3b03ecb..d86f6f6a43584967b6e256be32c3144fbb2a326f 100644
--- a/net/minecraft/world/level/ServerExplosion.java --- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java
@@ -535,6 +535,11 @@ public class ServerExplosion implements Explosion { @@ -538,6 +538,11 @@ public class ServerExplosion implements Explosion {
return ret; return ret;
} }
// Sakura end - optimise protected explosions // Sakura end - optimise protected explosions

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Optimise block counting for cannon entities
diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java diff --git a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
index c09658eb8c2824ac0c887f94771d9b467ecab8b1..992354bfc3f279946635d3a8f2bc109d4f1c8603 100644 index 0de9f3d0fb5abbb86bcb9bd2546cea198d105d88..92b4914577b500e2114e9160f0af8d46d5096672 100644
--- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java --- a/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
+++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java +++ b/ca/spottedleaf/moonrise/patches/collisions/CollisionUtil.java
@@ -1943,6 +1943,7 @@ public final class CollisionUtil { @@ -1943,6 +1943,7 @@ public final class CollisionUtil {
@@ -42,7 +42,7 @@ index c09658eb8c2824ac0c887f94771d9b467ecab8b1..992354bfc3f279946635d3a8f2bc109d
for (int currY = minYIterate; currY <= maxYIterate; ++currY) { for (int currY = minYIterate; currY <= maxYIterate; ++currY) {
final int blockY = currY | (currChunkY << 4); final int blockY = currY | (currChunkY << 4);
diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java
index 8156e920d76a92fd74b90de816aaff0ced480b5f..32171561b4cd98f1f260bf14e1ac16b0684f325f 100644 index e894c404d58f95c8f54987739ad24b6a0b96dfc3..e77b59f8415c07ddb65a669423eaad9214abe6ab 100644
--- a/net/minecraft/world/level/Level.java --- a/net/minecraft/world/level/Level.java
+++ b/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java
@@ -616,6 +616,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl @@ -616,6 +616,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup<Entity>, AutoCl

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Protect blocks above a configured Y-level from explosions
diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java
index 82fdd92a7a8122a9e409db2491a56df0311cad30..1b48793a6472ab015d0f7d7755d77104cccd18c3 100644 index d86f6f6a43584967b6e256be32c3144fbb2a326f..d0e7347f5d57e77e28fb2145552db67d67e4c25b 100644
--- a/net/minecraft/world/level/ServerExplosion.java --- a/net/minecraft/world/level/ServerExplosion.java
+++ b/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java
@@ -414,6 +414,11 @@ public class ServerExplosion implements Explosion { @@ -414,6 +414,11 @@ public class ServerExplosion implements Explosion {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/MinecraftServer.java --- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java
@@ -299,6 +_,7 @@ @@ -300,6 +_,7 @@
public volatile boolean abnormalExit; // Paper - Improved watchdog support public volatile boolean abnormalExit; // Paper - Improved watchdog support
public volatile Thread shutdownThread; // Paper - Improved watchdog support public volatile Thread shutdownThread; // Paper - Improved watchdog support
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
@@ -8,7 +8,7 @@
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
@@ -317,6 +_,17 @@ @@ -319,6 +_,17 @@
thread.start(); thread.start();
return minecraftServer; return minecraftServer;
} }
@@ -26,7 +26,7 @@
// Paper start - rewrite chunk system // Paper start - rewrite chunk system
private volatile Throwable chunkSystemCrash; private volatile Throwable chunkSystemCrash;
@@ -469,6 +_,10 @@ @@ -471,6 +_,10 @@
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end // CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
@@ -37,7 +37,7 @@
} }
private void readScoreboard(DimensionDataStorage dataStorage) { private void readScoreboard(DimensionDataStorage dataStorage) {
@@ -1219,6 +_,7 @@ @@ -1222,6 +_,7 @@
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) { if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
final long diff = currentTime - tickSection; final long diff = currentTime - tickSection;
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP); final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
@@ -45,7 +45,7 @@
tps1.add(currentTps, diff); tps1.add(currentTps, diff);
tps5.add(currentTps, diff); tps5.add(currentTps, diff);
tps15.add(currentTps, diff); tps15.add(currentTps, diff);
@@ -1256,6 +_,7 @@ @@ -1259,6 +_,7 @@
// Paper end - rewrite chunk system // Paper end - rewrite chunk system
this.tickFrame.end(); this.tickFrame.end();
profilerFiller.popPush("nextTickWait"); profilerFiller.popPush("nextTickWait");

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerLevel.java --- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java
@@ -580,7 +_,7 @@ @@ -583,7 +_,7 @@
org.bukkit.generator.BiomeProvider biomeProvider // CraftBukkit org.bukkit.generator.BiomeProvider biomeProvider // CraftBukkit
) { ) {
// CraftBukkit start // CraftBukkit start

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/server/level/ServerPlayer.java --- a/net/minecraft/server/level/ServerPlayer.java
+++ b/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java
@@ -420,6 +_,7 @@ @@ -431,6 +_,7 @@
public @Nullable com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent public @Nullable com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent
public @Nullable String clientBrandName = null; // Paper - Brand support public @Nullable String clientBrandName = null; // Paper - Brand support
public @Nullable org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event public @Nullable org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - Add API for quit reason; there are a lot of changes to do if we change all methods leading to the event

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Entity.java --- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java
@@ -515,6 +_,7 @@ @@ -532,6 +_,7 @@
} }
} }
// Paper end - optimise entity tracker // Paper end - optimise entity tracker
@@ -8,7 +8,7 @@
public Entity(EntityType<?> entityType, Level level) { public Entity(EntityType<?> entityType, Level level) {
this.type = entityType; this.type = entityType;
@@ -4007,7 +_,7 @@ @@ -4228,7 +_,7 @@
} }
public boolean isPushedByFluid() { public boolean isPushedByFluid() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/LivingEntity.java --- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java
@@ -274,6 +_,43 @@ @@ -287,6 +_,43 @@
public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API public net.kyori.adventure.util.TriState frictionState = net.kyori.adventure.util.TriState.NOT_SET; // Paper - Friction API
public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay; // Paper - Make shield blocking delay configurable public int shieldBlockingDelay = this.level().paperConfig().misc.shieldBlockingDelay; // Paper - Make shield blocking delay configurable
// CraftBukkit end // CraftBukkit end
@@ -44,7 +44,7 @@
protected LivingEntity(EntityType<? extends LivingEntity> entityType, Level level) { protected LivingEntity(EntityType<? extends LivingEntity> entityType, Level level) {
super(entityType, level); super(entityType, level);
@@ -1481,7 +_,7 @@ @@ -1513,7 +_,7 @@
} }
// Paper end - Check distance in entity interactions // Paper end - Check distance in entity interactions
@@ -53,7 +53,7 @@
if (!flag) { if (!flag) {
this.indicateDamage(d, d1); this.indicateDamage(d, d1);
} }
@@ -1583,6 +_,11 @@ @@ -1615,6 +_,11 @@
if (itemBlockingWith == null) { if (itemBlockingWith == null) {
return false; return false;
} else { } else {
@@ -65,7 +65,7 @@
BlocksAttacks blocksAttacks = itemBlockingWith.get(DataComponents.BLOCKS_ATTACKS); BlocksAttacks blocksAttacks = itemBlockingWith.get(DataComponents.BLOCKS_ATTACKS);
if (blocksAttacks != null && !blocksAttacks.bypassedBy().map(damageSource::is).orElse(false)) { if (blocksAttacks != null && !blocksAttacks.bypassedBy().map(damageSource::is).orElse(false)) {
if (damageSource.getDirectEntity() instanceof AbstractArrow abstractArrow && abstractArrow.getPierceLevel() > 0) { if (damageSource.getDirectEntity() instanceof AbstractArrow abstractArrow && abstractArrow.getPierceLevel() > 0) {
@@ -1609,6 +_,12 @@ @@ -1641,6 +_,12 @@
acos = (float) Math.PI; acos = (float) Math.PI;
} }
@@ -78,7 +78,7 @@
BlocksAttacks blocksAttacks = this.getItemBlockingWith().get(DataComponents.BLOCKS_ATTACKS); BlocksAttacks blocksAttacks = this.getItemBlockingWith().get(DataComponents.BLOCKS_ATTACKS);
return blocksAttacks.resolveBlockedDamage(damageSource, damageAmount, acos); return blocksAttacks.resolveBlockedDamage(damageSource, damageAmount, acos);
} }
@@ -1676,7 +_,7 @@ @@ -1708,7 +_,7 @@
} }
protected void blockedByItem(LivingEntity entity) { protected void blockedByItem(LivingEntity entity) {
@@ -87,7 +87,7 @@
} }
private boolean checkTotemDeathProtection(DamageSource damageSource) { private boolean checkTotemDeathProtection(DamageSource damageSource) {
@@ -1833,6 +_,12 @@ @@ -1865,6 +_,12 @@
// Paper start // Paper start
if (this.dead) { // Paper if (this.dead) { // Paper
@@ -100,7 +100,7 @@
this.level().broadcastEntityEvent(this, (byte)3); this.level().broadcastEntityEvent(this, (byte)3);
this.setPose(Pose.DYING); this.setPose(Pose.DYING);
@@ -2006,7 +_,7 @@ @@ -2038,7 +_,7 @@
} }
public void knockback(double strength, double x, double z, @Nullable Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause eventCause) { // Paper - knockback events public void knockback(double strength, double x, double z, @Nullable Entity attacker, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause eventCause) { // Paper - knockback events
@@ -109,7 +109,7 @@
if (true || !(strength <= 0.0)) { // CraftBukkit - Call event even when force is 0 if (true || !(strength <= 0.0)) { // CraftBukkit - Call event even when force is 0
// this.hasImpulse = true; // CraftBukkit - Move down // this.hasImpulse = true; // CraftBukkit - Move down
Vec3 deltaMovement = this.getDeltaMovement(); Vec3 deltaMovement = this.getDeltaMovement();
@@ -2017,10 +_,18 @@ @@ -2049,10 +_,18 @@
} }
Vec3 vec3 = new Vec3(x, 0.0, z).normalize().scale(strength); Vec3 vec3 = new Vec3(x, 0.0, z).normalize().scale(strength);
@@ -129,7 +129,7 @@
deltaMovement.z / 2.0 - vec3.z deltaMovement.z / 2.0 - vec3.z
); );
Vec3 diff = finalVelocity.subtract(deltaMovement); Vec3 diff = finalVelocity.subtract(deltaMovement);
@@ -2165,8 +_,14 @@ @@ -2197,8 +_,14 @@
} }
} }
@@ -145,7 +145,7 @@
return 0; return 0;
} else { } else {
double d = this.calculateFallPower(fallDistance); double d = this.calculateFallPower(fallDistance);
@@ -2224,9 +_,21 @@ @@ -2256,9 +_,21 @@
protected float getDamageAfterArmorAbsorb(DamageSource damageSource, float damageAmount) { protected float getDamageAfterArmorAbsorb(DamageSource damageSource, float damageAmount) {
if (!damageSource.is(DamageTypeTags.BYPASSES_ARMOR)) { if (!damageSource.is(DamageTypeTags.BYPASSES_ARMOR)) {
// this.hurtArmor(damageSource, damageAmount); // CraftBukkit - actuallyHurt(DamageSource, float, EntityDamageEvent) for damage handling // this.hurtArmor(damageSource, damageAmount); // CraftBukkit - actuallyHurt(DamageSource, float, EntityDamageEvent) for damage handling
@@ -167,7 +167,7 @@
} }
return damageAmount; return damageAmount;
@@ -2406,6 +_,12 @@ @@ -2438,6 +_,12 @@
armorDamage += (float) event.getDamage(DamageModifier.BLOCKING); armorDamage += (float) event.getDamage(DamageModifier.BLOCKING);
armorDamage += (float) event.getDamage(DamageModifier.FREEZING); armorDamage += (float) event.getDamage(DamageModifier.FREEZING);
armorDamage += (float) event.getDamage(DamageModifier.HARD_HAT); armorDamage += (float) event.getDamage(DamageModifier.HARD_HAT);
@@ -180,7 +180,7 @@
this.hurtArmor(damageSource, armorDamage); this.hurtArmor(damageSource, armorDamage);
} }
@@ -3332,6 +_,11 @@ @@ -3384,6 +_,11 @@
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
EnchantmentHelper.runLocationChangedEffects(serverLevel, itemBySlot, this, equipmentSlot1); EnchantmentHelper.runLocationChangedEffects(serverLevel, itemBySlot, this, equipmentSlot1);
} }
@@ -192,7 +192,7 @@
} }
} }
@@ -3532,7 +_,7 @@ @@ -3584,7 +_,7 @@
} }
} }
// Paper end - Add EntityMoveEvent // Paper end - Add EntityMoveEvent
@@ -201,7 +201,7 @@
this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F); this.hurtServer(serverLevel, this.damageSources().drown(), 1.0F);
} }
} }
@@ -4107,6 +_,13 @@ @@ -4163,6 +_,13 @@
if (!this.isUsingItem()) { if (!this.isUsingItem()) {
return null; return null;
} else { } else {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/Mob.java --- a/net/minecraft/world/entity/Mob.java
+++ b/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java
@@ -716,7 +_,7 @@ @@ -733,7 +_,7 @@
protected final void serverAiStep() { protected final void serverAiStep() {
this.noActionTime++; this.noActionTime++;
// Paper start - Allow nerfed mobs to jump and float // Paper start - Allow nerfed mobs to jump and float

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/animal/IronGolem.java --- a/net/minecraft/world/entity/animal/IronGolem.java
+++ b/net/minecraft/world/entity/animal/IronGolem.java +++ b/net/minecraft/world/entity/animal/IronGolem.java
@@ -229,6 +_,13 @@ @@ -230,6 +_,13 @@
} }
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/FallingBlockEntity.java --- a/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -70,9 +_,12 @@ @@ -73,9 +_,12 @@
public boolean forceTickAfterTeleportToDuplicate; public boolean forceTickAfterTeleportToDuplicate;
protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS); protected static final EntityDataAccessor<BlockPos> DATA_START_POS = SynchedEntityData.defineId(FallingBlockEntity.class, EntityDataSerializers.BLOCK_POS);
public boolean autoExpire = true; // Paper - Expand FallingBlock API public boolean autoExpire = true; // Paper - Expand FallingBlock API
@@ -13,7 +13,7 @@
} }
public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) { public FallingBlockEntity(Level level, double x, double y, double z, BlockState state) {
@@ -87,6 +_,27 @@ @@ -90,6 +_,27 @@
this.setStartPos(this.blockPosition()); this.setStartPos(this.blockPosition());
} }
@@ -41,7 +41,7 @@
public static FallingBlockEntity fall(Level level, BlockPos pos, BlockState blockState) { public static FallingBlockEntity fall(Level level, BlockPos pos, BlockState blockState) {
FallingBlockEntity fallingBlockEntity = new FallingBlockEntity( FallingBlockEntity fallingBlockEntity = new FallingBlockEntity(
level, level,
@@ -165,7 +_,7 @@ @@ -168,7 +_,7 @@
this.handlePortal(); this.handlePortal();
if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) { if (this.level() instanceof ServerLevel serverLevel && (this.isAlive() || this.forceTickAfterTeleportToDuplicate)) {
BlockPos blockPos = this.blockPosition(); BlockPos blockPos = this.blockPosition();
@@ -50,7 +50,7 @@
boolean flag1 = flag && this.level().getFluidState(blockPos).is(FluidTags.WATER); boolean flag1 = flag && this.level().getFluidState(blockPos).is(FluidTags.WATER);
double d = this.getDeltaMovement().lengthSqr(); double d = this.getDeltaMovement().lengthSqr();
if (flag && d > 1.0) { if (flag && d > 1.0) {
@@ -181,7 +_,7 @@ @@ -184,7 +_,7 @@
} }
} }
@@ -59,7 +59,7 @@
if ((this.time > 100 && autoExpire) && (blockPos.getY() <= this.level().getMinY() || blockPos.getY() > this.level().getMaxY()) || (this.time > 600 && autoExpire)) { // Paper - Expand FallingBlock API if ((this.time > 100 && autoExpire) && (blockPos.getY() <= this.level().getMinY() || blockPos.getY() > this.level().getMaxY()) || (this.time > 600 && autoExpire)) { // Paper - Expand FallingBlock API
if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) { if (this.dropItem && serverLevel.getGameRules().getBoolean(GameRules.RULE_DOENTITYDROPS)) {
this.spawnAtLocation(serverLevel, block); this.spawnAtLocation(serverLevel, block);
@@ -199,7 +_,7 @@ @@ -202,7 +_,7 @@
); );
boolean flag2 = FallingBlock.isFree(this.level().getBlockState(blockPos.below())) && (!flag || !flag1); boolean flag2 = FallingBlock.isFree(this.level().getBlockState(blockPos.below())) && (!flag || !flag1);
boolean flag3 = this.blockState.canSurvive(this.level(), blockPos) && !flag2; boolean flag3 = this.blockState.canSurvive(this.level(), blockPos) && !flag2;
@@ -68,7 +68,7 @@
if (this.blockState.hasProperty(BlockStateProperties.WATERLOGGED) if (this.blockState.hasProperty(BlockStateProperties.WATERLOGGED)
&& this.level().getFluidState(blockPos).getType() == Fluids.WATER) { && this.level().getFluidState(blockPos).getType() == Fluids.WATER) {
this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true); this.blockState = this.blockState.setValue(BlockStateProperties.WATERLOGGED, true);
@@ -240,6 +_,10 @@ @@ -247,6 +_,10 @@
this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DROP); // CraftBukkit - add Bukkit remove cause
this.callOnBrokenAfterFall(block, blockPos); this.callOnBrokenAfterFall(block, blockPos);
this.spawnAtLocation(serverLevel, block); this.spawnAtLocation(serverLevel, block);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/item/ItemEntity.java --- a/net/minecraft/world/entity/item/ItemEntity.java
+++ b/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java
@@ -370,6 +_,13 @@ @@ -368,6 +_,13 @@
@Override @Override
public boolean ignoreExplosion(Explosion explosion) { public boolean ignoreExplosion(Explosion explosion) {

View File

@@ -1,9 +1,9 @@
--- a/net/minecraft/world/entity/item/PrimedTnt.java --- a/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/net/minecraft/world/entity/item/PrimedTnt.java +++ b/net/minecraft/world/entity/item/PrimedTnt.java
@@ -76,7 +_,28 @@ @@ -75,7 +_,28 @@
this.yo = y; this.yo = y;
this.zo = z; this.zo = z;
this.owner = owner; this.owner = owner != null ? new EntityReference<>(owner) : null;
- } - }
+ // Sakura start - configure cannon mechanics + // Sakura start - configure cannon mechanics
+ switch (level.sakuraConfig().cannons.mechanics.tntSpread) { + switch (level.sakuraConfig().cannons.mechanics.tntSpread) {
@@ -30,7 +30,7 @@
@Override @Override
protected void defineSynchedData(SynchedEntityData.Builder builder) { protected void defineSynchedData(SynchedEntityData.Builder builder) {
@@ -101,7 +_,7 @@ @@ -100,7 +_,7 @@
@Override @Override
public void tick() { public void tick() {
@@ -39,7 +39,7 @@
this.handlePortal(); this.handlePortal();
this.applyGravity(); this.applyGravity();
this.move(MoverType.SELF, this.getDeltaMovement()); this.move(MoverType.SELF, this.getDeltaMovement());
@@ -133,6 +_,14 @@ @@ -132,6 +_,14 @@
this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5, this.getZ(), 0.0, 0.0, 0.0); this.level().addParticle(ParticleTypes.SMOKE, this.getX(), this.getY() + 0.5, this.getZ(), 0.0, 0.0, 0.0);
} }
} }
@@ -53,8 +53,8 @@
+ // Sakura end - configure force position updates + // Sakura end - configure force position updates
// Paper start - Option to prevent TNT from moving in water // Paper start - Option to prevent TNT from moving in water
if (!this.isRemoved() && this.wasTouchingWater && this.level().paperConfig().fixes.preventTntFromMovingInWater) { if (!this.isRemoved() && this.wasTouchingWater && this.level().paperConfig().fixes.preventTntFromMovingInWater) {
/* this.hurtMarked = true;
@@ -250,7 +_,7 @@ @@ -235,7 +_,7 @@
// Paper start - Option to prevent TNT from moving in water // Paper start - Option to prevent TNT from moving in water
@Override @Override
public boolean isPushedByFluid() { public boolean isPushedByFluid() {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/monster/Creeper.java --- a/net/minecraft/world/entity/monster/Creeper.java
+++ b/net/minecraft/world/entity/monster/Creeper.java +++ b/net/minecraft/world/entity/monster/Creeper.java
@@ -246,7 +_,12 @@ @@ -247,7 +_,12 @@
if (!event.isCancelled()) { if (!event.isCancelled()) {
// CraftBukkit end // CraftBukkit end
this.dead = true; this.dead = true;

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/player/Player.java --- a/net/minecraft/world/entity/player/Player.java
+++ b/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java
@@ -210,6 +_,7 @@ @@ -219,6 +_,7 @@
private int currentImpulseContextResetGraceTime = 0; private int currentImpulseContextResetGraceTime = 0;
public boolean affectsSpawning = true; // Paper - Affects Spawning API public boolean affectsSpawning = true; // Paper - Affects Spawning API
public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper - flying fall damage
@@ -8,7 +8,7 @@
// CraftBukkit start // CraftBukkit start
public boolean fauxSleeping; public boolean fauxSleeping;
@@ -857,6 +_,10 @@ @@ -866,6 +_,10 @@
public boolean isInvulnerableTo(ServerLevel level, DamageSource damageSource) { public boolean isInvulnerableTo(ServerLevel level, DamageSource damageSource) {
if (super.isInvulnerableTo(level, damageSource)) { if (super.isInvulnerableTo(level, damageSource)) {
return true; return true;
@@ -19,7 +19,7 @@
} else if (damageSource.is(DamageTypeTags.IS_DROWNING)) { } else if (damageSource.is(DamageTypeTags.IS_DROWNING)) {
return !level.getGameRules().getBoolean(GameRules.RULE_DROWNING_DAMAGE); return !level.getGameRules().getBoolean(GameRules.RULE_DROWNING_DAMAGE);
} else if (damageSource.is(DamageTypeTags.IS_FALL)) { } else if (damageSource.is(DamageTypeTags.IS_FALL)) {
@@ -1170,13 +_,19 @@ @@ -1182,13 +_,19 @@
if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable. if (playerAttackEntityEvent.callEvent() && willAttack) { // Logic moved to willAttack local variable.
{ {
// Paper end - PlayerAttackEntityEvent // Paper end - PlayerAttackEntityEvent
@@ -40,7 +40,7 @@
// this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt // this.resetAttackStrengthTicker(); // CraftBukkit - Moved to EntityLiving to reset the cooldown after the damage is dealt
if (target.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE) if (target.getType().is(EntityTypeTags.REDIRECTABLE_PROJECTILE)
&& target instanceof Projectile projectile) { && target instanceof Projectile projectile) {
@@ -1194,7 +_,7 @@ @@ -1206,7 +_,7 @@
if (f > 0.0F || f1 > 0.0F) { if (f > 0.0F || f1 > 0.0F) {
boolean flag = attackStrengthScale > 0.9F; boolean flag = attackStrengthScale > 0.9F;
boolean flag1; boolean flag1;
@@ -49,7 +49,7 @@
this.sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility this.sendSoundEffect(this, this.getX(), this.getY(), this.getZ(), SoundEvents.PLAYER_ATTACK_KNOCKBACK, this.getSoundSource(), 1.0F, 1.0F); // Paper - send while respecting visibility
flag1 = true; flag1 = true;
} else { } else {
@@ -1210,7 +_,7 @@ @@ -1222,7 +_,7 @@
&& !this.hasEffect(MobEffects.BLINDNESS) && !this.hasEffect(MobEffects.BLINDNESS)
&& !this.isPassenger() && !this.isPassenger()
&& target instanceof LivingEntity && target instanceof LivingEntity
@@ -58,7 +58,7 @@
flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits flag2 = flag2 && !this.level().paperConfig().entities.behavior.disablePlayerCrits; // Paper - Toggleable player crits
if (flag2) { if (flag2) {
damageSource = damageSource.critical(); // Paper - critical damage API damageSource = damageSource.critical(); // Paper - critical damage API
@@ -1237,7 +_,21 @@ @@ -1249,7 +_,21 @@
if (flag4) { if (flag4) {
float f4 = this.getKnockback(target, damageSource) + (flag1 ? 1.0F : 0.0F); float f4 = this.getKnockback(target, damageSource) + (flag1 ? 1.0F : 0.0F);
if (f4 > 0.0F) { if (f4 > 0.0F) {
@@ -81,7 +81,7 @@
livingEntity1.knockback( livingEntity1.knockback(
f4 * 0.5F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0)) f4 * 0.5F, Mth.sin(this.getYRot() * (float) (Math.PI / 180.0)), -Mth.cos(this.getYRot() * (float) (Math.PI / 180.0))
, this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK // Paper - knockback events , this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK // Paper - knockback events
@@ -1259,7 +_,7 @@ @@ -1271,7 +_,7 @@
// Paper end - Configurable sprint interruption on attack // Paper end - Configurable sprint interruption on attack
} }
@@ -90,7 +90,7 @@
float f5 = 1.0F + (float)this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * f; float f5 = 1.0F + (float)this.getAttributeValue(Attributes.SWEEPING_DAMAGE_RATIO) * f;
for (LivingEntity livingEntity2 : this.level() for (LivingEntity livingEntity2 : this.level()
@@ -1275,7 +_,7 @@ @@ -1287,7 +_,7 @@
if (this.level() instanceof ServerLevel serverLevel && livingEntity2.hurtServer(serverLevel, damageSource.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK), f6) && !livingEntity2.lastDamageCancelled) { if (this.level() instanceof ServerLevel serverLevel && livingEntity2.hurtServer(serverLevel, damageSource.knownCause(org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK), f6) && !livingEntity2.lastDamageCancelled) {
// Paper end - Only apply knockback if the event is not cancelled // Paper end - Only apply knockback if the event is not cancelled
livingEntity2.knockback( livingEntity2.knockback(
@@ -99,7 +99,7 @@
, this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK // Paper - knockback events , this, io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.SWEEP_ATTACK // Paper - knockback events
); );
EnchantmentHelper.doPostAttackEffects(serverLevel, livingEntity2, damageSource); EnchantmentHelper.doPostAttackEffects(serverLevel, livingEntity2, damageSource);
@@ -1363,7 +_,7 @@ @@ -1375,7 +_,7 @@
if (target instanceof LivingEntity) { if (target instanceof LivingEntity) {
float f7 = f3 - ((LivingEntity)target).getHealth(); float f7 = f3 - ((LivingEntity)target).getHealth();
this.awardStat(Stats.DAMAGE_DEALT, Math.round(f7 * 10.0F)); this.awardStat(Stats.DAMAGE_DEALT, Math.round(f7 * 10.0F));
@@ -108,7 +108,7 @@
int i = (int)(f7 * 0.5); int i = (int)(f7 * 0.5);
((ServerLevel)this.level()) ((ServerLevel)this.level())
.sendParticles(ParticleTypes.DAMAGE_INDICATOR, target.getX(), target.getY(0.5), target.getZ(), i, 0.1, 0.0, 0.1, 0.2); .sendParticles(ParticleTypes.DAMAGE_INDICATOR, target.getX(), target.getY(0.5), target.getZ(), i, 0.1, 0.0, 0.1, 0.2);
@@ -1753,6 +_,7 @@ @@ -1765,6 +_,7 @@
// Paper start - send while respecting visibility // Paper start - send while respecting visibility
private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) { private static void sendSoundEffect(Player fromEntity, double x, double y, double z, SoundEvent soundEffect, SoundSource soundCategory, float volume, float pitch) {
@@ -116,7 +116,7 @@
fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity itself fromEntity.level().playSound(fromEntity, x, y, z, soundEffect, soundCategory, volume, pitch); // This will not send the effect to the entity itself
if (fromEntity instanceof ServerPlayer serverPlayer) { if (fromEntity instanceof ServerPlayer serverPlayer) {
serverPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong())); serverPlayer.connection.send(new net.minecraft.network.protocol.game.ClientboundSoundPacket(net.minecraft.core.registries.BuiltInRegistries.SOUND_EVENT.wrapAsHolder(soundEffect), soundCategory, x, y, z, volume, pitch, fromEntity.random.nextLong()));
@@ -2100,7 +_,13 @@ @@ -2119,7 +_,13 @@
@Override @Override
public EntityDimensions getDefaultDimensions(Pose pose) { public EntityDimensions getDefaultDimensions(Pose pose) {

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java --- a/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
+++ b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java +++ b/net/minecraft/world/entity/projectile/AbstractThrownPotion.java
@@ -42,6 +_,25 @@ @@ -39,6 +_,25 @@
super(entityType, x, y, z, level, item); super(entityType, x, y, z, level, item);
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/FishingHook.java --- a/net/minecraft/world/entity/projectile/FishingHook.java
+++ b/net/minecraft/world/entity/projectile/FishingHook.java +++ b/net/minecraft/world/entity/projectile/FishingHook.java
@@ -287,6 +_,12 @@ @@ -298,6 +_,12 @@
if (!this.level().isClientSide) { if (!this.level().isClientSide) {
this.setHookedEntity(result.getEntity()); this.setHookedEntity(result.getEntity());
} }
@@ -13,7 +13,7 @@
} }
@Override @Override
@@ -588,7 +_,7 @@ @@ -599,7 +_,7 @@
public void pullEntity(Entity entity) { public void pullEntity(Entity entity) {
Entity owner = this.getOwner(); Entity owner = this.getOwner();

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java --- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
+++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java +++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java
@@ -182,6 +_,13 @@ @@ -179,6 +_,13 @@
} }
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/food/FoodData.java --- a/net/minecraft/world/food/FoodData.java
+++ b/net/minecraft/world/food/FoodData.java +++ b/net/minecraft/world/food/FoodData.java
@@ -65,7 +_,7 @@ @@ -66,7 +_,7 @@
} }
boolean _boolean = serverLevel.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION); boolean _boolean = serverLevel.getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION);

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/ItemStack.java --- a/net/minecraft/world/item/ItemStack.java
+++ b/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java
@@ -846,6 +_,15 @@ @@ -826,6 +_,15 @@
} }
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/item/Items.java --- a/net/minecraft/world/item/Items.java
+++ b/net/minecraft/world/item/Items.java +++ b/net/minecraft/world/item/Items.java
@@ -1107,32 +_,32 @@ @@ -1158,32 +_,32 @@
public static final Item GOLD_INGOT = registerItem("gold_ingot", new Item.Properties().trimMaterial(TrimMaterials.GOLD)); public static final Item GOLD_INGOT = registerItem("gold_ingot", new Item.Properties().trimMaterial(TrimMaterials.GOLD));
public static final Item NETHERITE_INGOT = registerItem("netherite_ingot", new Item.Properties().fireResistant().trimMaterial(TrimMaterials.NETHERITE)); public static final Item NETHERITE_INGOT = registerItem("netherite_ingot", new Item.Properties().fireResistant().trimMaterial(TrimMaterials.NETHERITE));
public static final Item NETHERITE_SCRAP = registerItem("netherite_scrap", new Item.Properties().fireResistant()); public static final Item NETHERITE_SCRAP = registerItem("netherite_scrap", new Item.Properties().fireResistant());
@@ -39,7 +39,7 @@
public static final Item NETHERITE_SHOVEL = registerItem( public static final Item NETHERITE_SHOVEL = registerItem(
"netherite_shovel", properties -> new ShovelItem(ToolMaterial.NETHERITE, 1.5F, -3.0F, properties), new Item.Properties().fireResistant() "netherite_shovel", properties -> new ShovelItem(ToolMaterial.NETHERITE, 1.5F, -3.0F, properties), new Item.Properties().fireResistant()
); );
@@ -1210,6 +_,7 @@ @@ -1261,6 +_,7 @@
public static final Item GOLDEN_APPLE = registerItem("golden_apple", new Item.Properties().food(Foods.GOLDEN_APPLE, Consumables.GOLDEN_APPLE)); public static final Item GOLDEN_APPLE = registerItem("golden_apple", new Item.Properties().food(Foods.GOLDEN_APPLE, Consumables.GOLDEN_APPLE));
public static final Item ENCHANTED_GOLDEN_APPLE = registerItem( public static final Item ENCHANTED_GOLDEN_APPLE = registerItem(
"enchanted_golden_apple", "enchanted_golden_apple",
@@ -47,7 +47,7 @@
new Item.Properties() new Item.Properties()
.rarity(Rarity.RARE) .rarity(Rarity.RARE)
.food(Foods.ENCHANTED_GOLDEN_APPLE, Consumables.ENCHANTED_GOLDEN_APPLE) .food(Foods.ENCHANTED_GOLDEN_APPLE, Consumables.ENCHANTED_GOLDEN_APPLE)
@@ -1311,12 +_,12 @@ @@ -1362,12 +_,12 @@
(block, properties) -> new HangingSignItem(block, Blocks.WARPED_WALL_HANGING_SIGN, properties), (block, properties) -> new HangingSignItem(block, Blocks.WARPED_WALL_HANGING_SIGN, properties),
new Item.Properties().stacksTo(16) new Item.Properties().stacksTo(16)
); );
@@ -63,7 +63,7 @@
); );
public static final Item POWDER_SNOW_BUCKET = registerItem( public static final Item POWDER_SNOW_BUCKET = registerItem(
"powder_snow_bucket", "powder_snow_bucket",
@@ -1327,6 +_,7 @@ @@ -1378,6 +_,7 @@
public static final Item LEATHER = registerItem("leather"); public static final Item LEATHER = registerItem("leather");
public static final Item MILK_BUCKET = registerItem( public static final Item MILK_BUCKET = registerItem(
"milk_bucket", "milk_bucket",

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/BaseSpawner.java --- a/net/minecraft/world/level/BaseSpawner.java
+++ b/net/minecraft/world/level/BaseSpawner.java +++ b/net/minecraft/world/level/BaseSpawner.java
@@ -48,12 +_,24 @@ @@ -55,12 +_,24 @@
public int spawnRange = 4; public int spawnRange = 4;
private int tickDelay = 0; // Paper - Configurable mob spawner tick rate private int tickDelay = 0; // Paper - Configurable mob spawner tick rate
@@ -25,52 +25,52 @@
return level.hasNearbyAlivePlayerThatAffectsSpawning(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, this.requiredPlayerRange); // Paper - Affects Spawning API return level.hasNearbyAlivePlayerThatAffectsSpawning(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, this.requiredPlayerRange); // Paper - Affects Spawning API
} }
@@ -122,7 +_,7 @@ @@ -130,7 +_,7 @@
if (!customSpawnRules.isValidPosition(blockPos, serverLevel)) { if (!customSpawnRules.isValidPosition(blockPos, serverLevel)) {
continue;
}
- } else if (!SpawnPlacements.checkSpawnRules(
+ } else if (serverLevel.sakuraConfig().environment.mobSpawner.checkSpawnConditions && !SpawnPlacements.checkSpawnRules( // Sakura - configure mob spawner behaviour
optional.get(), serverLevel, EntitySpawnReason.SPAWNER, blockPos, serverLevel.getRandom()
)) {
continue; continue;
@@ -160,12 +_,19 @@
return;
} }
- } else if (!SpawnPlacements.checkSpawnRules(optional.get(), serverLevel, EntitySpawnReason.SPAWNER, blockPos, serverLevel.getRandom())) {
+ } else if (serverLevel.sakuraConfig().environment.mobSpawner.checkSpawnConditions && !SpawnPlacements.checkSpawnRules(optional.get(), serverLevel, EntitySpawnReason.SPAWNER, blockPos, serverLevel.getRandom())) { // Sakura - configure mob spawner behaviour
continue;
}
@@ -150,12 +_,19 @@ - int size = serverLevel.getEntities(
return; - EntityTypeTest.forExactClass(entity.getClass()),
} - new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange),
- EntitySelector.NO_SPECTATORS
- int size = serverLevel.getEntities( - )
- EntityTypeTest.forExactClass(entity.getClass()), - .size();
- new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange),
- EntitySelector.NO_SPECTATORS
- )
- .size();
+ // Sakura start - configure mob spawner behaviour
+ final int size;
+ if (serverLevel.sakuraConfig().environment.mobSpawner.ignoreEntityLimit) {
+ size = 0;
+ } else {
+ size = serverLevel.getEntities(
+ EntityTypeTest.forExactClass(entity.getClass()),
+ new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange),
+ EntitySelector.NO_SPECTATORS
+ )
+ .size();
+ }
+ // Sakura end - configure mob spawner behaviour
if (size >= this.maxNearbyEntities) {
this.delay(serverLevel, pos);
return;
@@ -164,8 +_,11 @@
entity.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; preserve entity motion from tag
entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F);
if (entity instanceof Mob mob) {
- if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER)
- || !mob.checkSpawnObstruction(serverLevel)) {
+ // Sakura start - configure mob spawner behaviour + // Sakura start - configure mob spawner behaviour
+ if (serverLevel.sakuraConfig().environment.mobSpawner.checkSpawnConditions && + final int size;
+ (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER) + if (serverLevel.sakuraConfig().environment.mobSpawner.ignoreEntityLimit) {
+ || !mob.checkSpawnObstruction(serverLevel))) { + size = 0;
+ // Sakura end - configure mob spawner behaviour + } else {
continue; + size = serverLevel.getEntities(
} + EntityTypeTest.forExactClass(entity.getClass()),
+ new AABB(pos.getX(), pos.getY(), pos.getZ(), pos.getX() + 1, pos.getY() + 1, pos.getZ() + 1).inflate(this.spawnRange),
+ EntitySelector.NO_SPECTATORS
+ )
+ .size();
+ }
+ // Sakura end - configure mob spawner behaviour
if (size >= this.maxNearbyEntities) {
this.delay(serverLevel, pos);
return;
@@ -174,8 +_,11 @@
entity.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported; preserve entity motion from tag
entity.snapTo(entity.getX(), entity.getY(), entity.getZ(), random.nextFloat() * 360.0F, 0.0F);
if (entity instanceof Mob mob) {
- if (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER)
- || !mob.checkSpawnObstruction(serverLevel)) {
+ // Sakura start - configure mob spawner behaviour
+ if (serverLevel.sakuraConfig().environment.mobSpawner.checkSpawnConditions &&
+ (nextSpawnData.getCustomSpawnRules().isEmpty() && !mob.checkSpawnRules(serverLevel, EntitySpawnReason.SPAWNER)
+ || !mob.checkSpawnObstruction(serverLevel))) {
+ // Sakura end - configure mob spawner behaviour
continue;
}

View File

@@ -8,15 +8,15 @@
// Paper start - collisions optimisations // Paper start - collisions optimisations
private static final double[] CACHED_RAYS; private static final double[] CACHED_RAYS;
static { static {
@@ -323,6 +_,7 @@ @@ -326,6 +_,7 @@
this.damageSource = damageSource == null ? level.damageSources().explosion(this) : damageSource; this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F;
this.damageCalculator = damageCalculator == null ? this.makeDamageCalculator(source) : damageCalculator; this.yield = Double.isFinite(this.yield) ? this.yield : 0; // Paper - Don't allow infinite default yields
this.yield = this.blockInteraction == Explosion.BlockInteraction.DESTROY_WITH_DECAY ? 1.0F / this.radius : 1.0F; // CraftBukkit // Paper end - add yield
+ this.consistentRadius = level.localConfig().config(BlockPos.containing(this.center)).consistentRadius; // Sakura - consistent explosion radius + this.consistentRadius = level.localConfig().config(BlockPos.containing(this.center)).consistentRadius; // Sakura - consistent explosion radius
} }
private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) { private ExplosionDamageCalculator makeDamageCalculator(@Nullable Entity entity) {
@@ -411,8 +_,7 @@ @@ -414,8 +_,7 @@
final double incZ = CACHED_RAYS[ray + 2]; final double incZ = CACHED_RAYS[ray + 2];
ray += 3; ray += 3;
@@ -26,7 +26,7 @@
do { do {
final int blockX = Mth.floor(currX); final int blockX = Mth.floor(currX);
@@ -619,7 +_,20 @@ @@ -622,7 +_,20 @@
.onExplosionHit(this.level, blockPos, this, (itemStack, blockPos1) -> addOrAppendStack(list, itemStack, blockPos1)); .onExplosionHit(this.level, blockPos, this, (itemStack, blockPos1) -> addOrAppendStack(list, itemStack, blockPos1));
} }

View File

@@ -1,6 +1,6 @@
--- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java --- a/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
+++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java +++ b/net/minecraft/world/level/block/piston/PistonMovingBlockEntity.java
@@ -47,6 +_,11 @@ @@ -46,6 +_,11 @@
private float progressO = 0.0F; private float progressO = 0.0F;
private long lastTicked; private long lastTicked;
private int deathTicks; private int deathTicks;
@@ -12,7 +12,7 @@
public PistonMovingBlockEntity(BlockPos pos, BlockState blockState) { public PistonMovingBlockEntity(BlockPos pos, BlockState blockState) {
super(BlockEntityType.PISTON, pos, blockState); super(BlockEntityType.PISTON, pos, blockState);
@@ -363,6 +_,18 @@ @@ -360,6 +_,18 @@
} }
public VoxelShape getCollisionShape(BlockGetter level, BlockPos pos) { public VoxelShape getCollisionShape(BlockGetter level, BlockPos pos) {

View File

@@ -5,33 +5,33 @@ Subject: [PATCH] Client Visibility Settings
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 8419ab4504de0a11149d01ca2bc5185af8821b18..9c15d1509252eb288c5265fc7989405544e1e157 100644 index 2cdb2d19eb8a2650dc671d70438cddffd72140f3..a899c10a4d8335c9dad3b9b0abe3e4d63e76324a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2376,6 +2376,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2387,6 +2387,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
handle.expToDrop = data.getIntOr("expToDrop", 0); handle.expToDrop = data.getIntOr("expToDrop", 0);
handle.keepLevel = data.getBooleanOr("keepLevel", false); handle.keepLevel = data.getBooleanOr("keepLevel", false);
}); });
+ // Sakura start - client visibility settings; load from nbt + // Sakura start - client visibility settings; load from nbt
+ CompoundTag sakuraTag = tag.getCompoundOrEmpty("sakura"); + input.child("sakura").ifPresent(sakura -> {
+ this.getHandle().visibilitySettings.loadData(sakuraTag); + this.getHandle().visibilitySettings.loadData(sakura);
+ });
+ // Sakura end - client visibility settings; load from nbt + // Sakura end - client visibility settings; load from nbt
} }
public void setExtraData(CompoundTag tag) { public void setExtraData(ValueOutput output) {
@@ -2405,6 +2409,11 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2408,6 +2413,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
paper.putLong("LastLogin", handle.loginTime); paper.putLong("LastLogin", handle.loginTime);
paper.putLong("LastSeen", System.currentTimeMillis()); paper.putLong("LastSeen", System.currentTimeMillis());
// Paper end // Paper end
+ // Sakura start - client visibility settings; save to nbt + // Sakura start - client visibility settings; save to nbt
+ CompoundTag sakuraTag = tag.getCompoundOrEmpty("sakura"); + final ValueOutput sakura = output.child("sakura");
+ this.getHandle().visibilitySettings.saveData(sakuraTag); + this.getHandle().visibilitySettings.saveData(sakura);
+ tag.put("sakura", sakuraTag);
+ // Sakura end - client visibility settings; save to nbt + // Sakura end - client visibility settings; save to nbt
} }
@Override @Override
@@ -3071,6 +3080,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3074,6 +3083,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.getHandle().allowsListing(); return this.getHandle().allowsListing();
} }

View File

@@ -37,10 +37,10 @@ index e77b06c3ef9b534a8f4f160d077cf4339ee7622d..a33e91a5b35109415b8140721469217c
@Override @Override
public FallingBlockEntity getHandle() { public FallingBlockEntity getHandle() {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
index eea78db7f12f5976077663a9ff0c0e188ffa8849..2e7803bd1f3411e75d8a51e03276b00469496f3b 100644 index 4a62bd61ad3fcd59433e6cb7ddba3af39d714fef..0a5f3c51f2694ca7d05776817b2ddd40d9bc93aa 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java
@@ -12,6 +12,28 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { @@ -13,6 +13,28 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
super(server, entity); super(server, entity);
} }

View File

@@ -1,41 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <kfian294ma4@gmail.com>
Date: Fri, 13 Sep 2024 17:22:51 +0100
Subject: [PATCH] Optimise entity scheduler ticking
diff --git a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
index c03608fec96b51e1867f43d8f42e5aefb1520e46..543251fc4973157dbb239729e656a8820fe88654 100644
--- a/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
+++ b/src/main/java/io/papermc/paper/threadedregions/EntityScheduler.java
@@ -50,6 +50,22 @@ public final class EntityScheduler {
this.entity = Validate.notNull(entity);
}
+ // Sakura start - optimise entity scheduler ticking
+ public boolean hasTask() {
+ return !this.currentlyExecuting.isEmpty() || !this.oneTimeDelayed.isEmpty();
+ }
+
+ private void newScheduledTask() {
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> {
+ Entity handle = this.entity.getHandleRaw();
+ net.minecraft.server.level.ServerLevel level = (net.minecraft.server.level.ServerLevel) handle.level();
+ ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup entityLookup = (ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup) level.moonrise$getEntityLookup();
+
+ entityLookup.entityStartScheduled(handle);
+ });
+ }
+ // Sakura end - optimise entity scheduler ticking
+
/**
* Retires the scheduler, preventing new tasks from being scheduled and invoking the retired callback
* on all currently scheduled tasks.
@@ -128,6 +144,7 @@ public final class EntityScheduler {
return new ArrayList<>();
}).add(task);
}
+ this.newScheduledTask(); // Sakura - optimise entity scheduler ticking
return true;
}

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1073,6 +_,7 @@ @@ -1045,6 +_,7 @@
org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot
this.console.paperConfigurations.reloadConfigs(this.console); this.console.paperConfigurations.reloadConfigs(this.console);
@@ -8,7 +8,7 @@
for (ServerLevel world : this.console.getAllLevels()) { for (ServerLevel world : this.console.getAllLevels()) {
// world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty
world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && config.spawnMonsters); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean))
@@ -1104,6 +_,7 @@ @@ -1076,6 +_,7 @@
this.reloadData(); this.reloadData();
org.spigotmc.SpigotConfig.registerCommands(); // Spigot org.spigotmc.SpigotConfig.registerCommands(); // Spigot
io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java
@@ -283,6 +_,12 @@ @@ -292,6 +_,12 @@
).isValid(); ).isValid();
} }
// Paper end // Paper end

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/Main.java --- a/src/main/java/org/bukkit/craftbukkit/Main.java
+++ b/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java
@@ -165,6 +_,14 @@ @@ -164,6 +_,14 @@
.defaultsTo(new File[] {}) .defaultsTo(new File[] {})
.describedAs("Jar file"); .describedAs("Jar file");
@@ -12,6 +12,6 @@
+ .describedAs("Config directory"); + .describedAs("Config directory");
+ // Sakura end - sakura configuration files + // Sakura end - sakura configuration files
+ +
acceptsAll(asList("server-name"), "Name of the server") this.accepts("server-name", "Name of the server")
.withRequiredArg() .withRequiredArg()
.ofType(String.class) .ofType(String.class)

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -100,6 +_,18 @@ @@ -113,6 +_,18 @@
this.entityType = CraftEntityType.minecraftToBukkit(entity.getType()); this.entityType = CraftEntityType.minecraftToBukkit(entity.getType());
} }

View File

@@ -1,6 +1,6 @@
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -235,6 +_,18 @@ @@ -246,6 +_,18 @@
this.firstPlayed = System.currentTimeMillis(); this.firstPlayed = System.currentTimeMillis();
} }

View File

@@ -15,6 +15,7 @@ import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.function.Consumer; import java.util.function.Consumer;
@@ -43,16 +44,9 @@ public abstract class SpecialisedExplosion<T extends Entity> extends ServerExplo
@Override @Override
public final void explode() { public final void explode() {
if (this.radius() < 0.1F) { this.createBlockCache();
// (radius < 0.1F) in bukkit is assumed to not be able to find any blocks or entities. this.startExplosion(); // search for blocks, impact entities, finalise if necessary
for (int i = this.getExplosionCount() - 1; i >= 0; --i) { this.clearBlockCache();
this.finalizeExplosionAndParticles(List.of());
}
} else {
this.createBlockCache();
this.startExplosion(); // search for blocks, impact entities, finalise if necessary
this.clearBlockCache();
}
} }
protected final boolean requiresImpactEntities(List<BlockPos> blocks, Vec3 center) { protected final boolean requiresImpactEntities(List<BlockPos> blocks, Vec3 center) {
@@ -87,7 +81,7 @@ public abstract class SpecialisedExplosion<T extends Entity> extends ServerExplo
super.blockCache.clear(); super.blockCache.clear();
} }
java.util.Arrays.fill(this.directMappedBlockCache, null); Arrays.fill(this.directMappedBlockCache, null);
} }
protected final void recalculateExplosionPosition() { protected final void recalculateExplosionPosition() {

View File

@@ -2,22 +2,24 @@ package me.samsuik.sakura.player.visibility;
import it.unimi.dsi.fastutil.objects.Reference2ObjectMap; import it.unimi.dsi.fastutil.objects.Reference2ObjectMap;
import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap; import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap;
import net.minecraft.nbt.CompoundTag; import net.minecraft.world.level.storage.ValueInput;
import org.jetbrains.annotations.NotNull; import net.minecraft.world.level.storage.ValueOutput;
import org.jspecify.annotations.NonNull; import org.jspecify.annotations.NonNull;
public final class PlayerVisibilitySettings implements VisibilitySettings { public final class PlayerVisibilitySettings implements VisibilitySettings {
private static final String SETTINGS_COMPOUND_TAG = "clientVisibilitySettings"; private static final String SETTINGS_COMPOUND_TAG = "clientVisibilitySettings";
private final Reference2ObjectMap<VisibilityType, VisibilityState> visibilityStates = new Reference2ObjectOpenHashMap<>(); private final Reference2ObjectMap<VisibilityType, VisibilityState> visibilityStates = new Reference2ObjectOpenHashMap<>();
@NonNull
@Override @Override
public @NonNull VisibilityState get(@NonNull VisibilityType type) { public VisibilityState get(@NonNull VisibilityType type) {
VisibilityState state = this.visibilityStates.get(type); VisibilityState state = this.visibilityStates.get(type);
return state != null ? state : type.getDefault(); return state != null ? state : type.getDefault();
} }
@NonNull
@Override @Override
public @NotNull VisibilityState set(@NonNull VisibilityType type, @NonNull VisibilityState state) { public VisibilityState set(@NonNull VisibilityType type, @NonNull VisibilityState state) {
if (type.isDefault(state)) { if (type.isDefault(state)) {
this.visibilityStates.remove(type); this.visibilityStates.remove(type);
} else { } else {
@@ -26,8 +28,9 @@ public final class PlayerVisibilitySettings implements VisibilitySettings {
return state; return state;
} }
@NonNull
@Override @Override
public @NonNull VisibilityState currentState() { public VisibilityState currentState() {
int modifiedCount = this.visibilityStates.size(); int modifiedCount = this.visibilityStates.size();
if (modifiedCount == 0) { if (modifiedCount == 0) {
return VisibilityState.ON; return VisibilityState.ON;
@@ -43,18 +46,18 @@ public final class PlayerVisibilitySettings implements VisibilitySettings {
return !this.visibilityStates.isEmpty(); return !this.visibilityStates.isEmpty();
} }
public void loadData(@NonNull CompoundTag tag) { public void loadData(@NonNull ValueInput input) {
CompoundTag settingsTag = tag.getCompoundOrEmpty(SETTINGS_COMPOUND_TAG); input.child(SETTINGS_COMPOUND_TAG).ifPresent(settings -> {
for (VisibilityType type : VisibilityTypes.types()) { for (VisibilityType type : VisibilityTypes.types()) {
String typeKey = type.key(); String typeKey = type.key();
String stateName = settingsTag.getStringOr(typeKey, type.getDefault().name()); String stateName = settings.getStringOr(typeKey, type.getDefault().name());
this.set(type, VisibilityState.valueOf(stateName)); this.set(type, VisibilityState.valueOf(stateName));
} }
});
} }
public void saveData(@NonNull CompoundTag tag) { public void saveData(@NonNull ValueOutput output) {
CompoundTag settingsTag = new CompoundTag(); ValueOutput settings = output.child(SETTINGS_COMPOUND_TAG);
this.visibilityStates.forEach((t, s) -> settingsTag.putString(t.key(), s.name())); this.visibilityStates.forEach((type, state) -> settings.putString(type.key(), state.name()));
tag.put(SETTINGS_COMPOUND_TAG, settingsTag);
} }
} }