9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-28 11:19:08 +00:00
Files
SakuraMC/patches/server/0024-Optimise-TNT-fluid-state.patch
Samsuik f9b0d14637 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@f4741f2 Expose particle status client option (#11573)
PaperMC/Paper@7e789e8 Prevent duplicate/superfluous BlockPhysicsEvent (#11609)
PaperMC/Paper@afb5b13 Replace SimpleRandom with (Simple)ThreadUnsafeRandom
PaperMC/Paper@d38624b Do not call modifyEntityTrackingRange on own range
2024-11-27 21:56:07 +00:00

46 lines
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Samsuik <40902469+Samsuik@users.noreply.github.com>
Date: Mon, 16 Oct 2023 22:57:55 +0100
Subject: [PATCH] Optimise TNT fluid state
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index cc31ee0d9ab13fd08dc33b6757173682883a2ac5..687eb620c0ee3fc19472f830b6296862a7dcf01c 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2233,7 +2233,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
return this.isInWater() || flag;
}
- void updateInWaterStateAndDoWaterCurrentPushing() {
+ protected void updateInWaterStateAndDoWaterCurrentPushing() { // Sakura
Entity entity = this.getVehicle();
if (entity instanceof AbstractBoat abstractboat) {
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 93cf290b25d569820dd1bf9b4b5fb255abdbd8cd..f2206e57c04d29ed470ae2083b25ab502144ccb1 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -126,6 +126,21 @@ public class PrimedTnt extends Entity implements TraceableEntity, me.samsuik.sak
return !this.isRemoved();
}
+ // Sakura start - optimise tnt fluid state
+ @Override
+ protected boolean updateInWaterStateAndDoFluidPushing() {
+ if (this.isPushedByFluid()) {
+ return super.updateInWaterStateAndDoFluidPushing();
+ } else {
+ // super method also handles lava fluid pushing
+ // we only need to search for water to negate fall distance
+ this.fluidHeight.clear();
+ this.updateInWaterStateAndDoWaterCurrentPushing();
+ return this.isInWater();
+ }
+ }
+ // Sakura end - optimise tnt fluid state
+
@Override
protected double getDefaultGravity() {
return 0.04D;