9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2026-01-04 15:31:43 +00:00
Files
SakuraMC/patches/server/0026-Optimise-TNT-fluid-state-and-pushing.patch
2023-11-24 13:27:40 +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 9feef1fd078cd0ca59f4cc6a7346d8eaa24a15e1..eab1b1043f27c3f996e820b3b50e2689c84e8822 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2168,7 +2168,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource {
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 3818d07261ce4f276968691ad32a22b88ffe6826..ae42975b45ab8529de1d67eb74e72e9ef09c4008 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -124,6 +124,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
}
*/
// 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() {