9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-30 12:19:08 +00:00
Files
SakuraMC/patches/server/0026-Optimise-TNT-fluid-state-and-pushing.patch
2023-12-13 20:16:04 +00:00

44 lines
1.9 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 and pushing
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index b6254947092f15b039d2af442ac36274920731a1..e5df563f4d3806d72236f302391a69e4b06e6447 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2187,7 +2187,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return this.isInWater() || flag;
}
- void updateInWaterStateAndDoWaterCurrentPushing() {
+ protected void updateInWaterStateAndDoWaterCurrentPushing() { // Sakura
Entity entity = this.getVehicle();
if (entity instanceof Boat) {
diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
index d534bc3ff8d5995ced0f9f89261cdcf1835698f4..dcb28daa8daf8fc2af020a7a94e3c9e51a2df63e 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -116,6 +116,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
}
*/
// Sakura end
+ // Sakura start
+ 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
@Override
public void tick() {