9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2026-01-04 15:31:43 +00:00
Files
SakuraMC/patches/server/0024-Optimise-TNT-fluid-state.patch
2024-10-31 12:37:40 +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 33027663cd43f2a56b9cf09f280a277149aad427..c1c1737bc7f57b7112567fe22a31c964cf4d10f7 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2162,7 +2162,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 Boat entityboat) {
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index 12983f598ffbd395b718878ac3865c0c5e5104fb..89d297bbec6034630fe0dbb84c079023611194a3 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -120,6 +120,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;