mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-29 11:49:07 +00:00
46 lines
2.1 KiB
Diff
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 b1ae26d08f12aadea37e44221c44db6430a3a99c..a56517cb6628939e6eed4b26e5e7f8bf6fc1c7af 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
@@ -2256,7 +2256,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 712ac847cf5fbb01133da2630f942afc69c79672..00801a9396e3c128730fe75c287d7b29ad0a00df 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;
|