9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-22 16:29:16 +00:00

Clean up merge cannon entities respawn logic

This commit is contained in:
Samsuik
2023-12-13 20:16:04 +00:00
parent f8dabbe3f2
commit 8061aefe7e
8 changed files with 91 additions and 105 deletions

View File

@@ -189,10 +189,10 @@ index f48eaebb0f9a10fb77e85619b2d2a4996e461195..a507605a04af7f576548129517029192
this.guardEntityTick(this::tickNonPassenger, entity);
gameprofilerfiller.pop();
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 89af45a998dd1884bac8ace525b87be9dd291789..c9d94d157b4bc52742050d75b3a11b8e2769ec08 100644
index 89af45a998dd1884bac8ace525b87be9dd291789..6e2defee2a8523d7025a8341b41488192618dd1a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -579,6 +579,105 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -579,6 +579,107 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return BlockPos.asLong(v.getBlockX(), v.getBlockY(), v.getBlockZ());
}
// Sakura end
@@ -272,7 +272,9 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..c9d94d157b4bc52742050d75b3a11b8e
+ return false;
+ }
+
+ protected void respawn() {}
+ protected boolean respawnMerged() {
+ return false;
+ }
+
+ protected boolean isSafeToMergeInto(Entity entity) {
+ return false;
@@ -298,7 +300,7 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..c9d94d157b4bc52742050d75b3a11b8e
public boolean isLegacyTrackingEntity = false;
@@ -657,6 +756,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -657,6 +758,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.getEntityData().registrationLocked = true; // Spigot
this.setPos(0.0D, 0.0D, 0.0D);
this.eyeHeight = this.getEyeHeight(net.minecraft.world.entity.Pose.STANDING, this.dimensions);
@@ -306,7 +308,7 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..c9d94d157b4bc52742050d75b3a11b8e
}
public boolean isColliding(BlockPos pos, BlockState state) {
@@ -2522,6 +2622,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2522,6 +2624,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
nbttagcompound.putBoolean("Paper.FreezeLock", true);
}
// Paper end
@@ -318,7 +320,7 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..c9d94d157b4bc52742050d75b3a11b8e
return nbttagcompound;
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Saving entity NBT");
@@ -2669,6 +2774,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2669,6 +2776,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
freezeLocked = nbt.getBoolean("Paper.FreezeLock");
}
// Paper end
@@ -330,7 +332,7 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..c9d94d157b4bc52742050d75b3a11b8e
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.forThrowable(throwable, "Loading entity NBT");
@@ -4876,6 +4986,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4876,6 +4988,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return;
}
// Paper end - rewrite chunk system
@@ -343,7 +345,7 @@ index 89af45a998dd1884bac8ace525b87be9dd291789..c9d94d157b4bc52742050d75b3a11b8e
if (this.removalReason == null) {
this.removalReason = reason;
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 0cf39ea76902e62b712057fe1bb80e3af8190fc4..6662d48f691cf6ab515a3eb64642dcb770d1caa0 100644
index 0cf39ea76902e62b712057fe1bb80e3af8190fc4..3a0d82cd7a0d7ec20138effd6d84eee60ffab788 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -132,6 +132,58 @@ public class FallingBlockEntity extends Entity {
@@ -364,40 +366,40 @@ index 0cf39ea76902e62b712057fe1bb80e3af8190fc4..6662d48f691cf6ab515a3eb64642dcb7
+ }
+
+ @Override
+ protected void respawn() {
+ while (stacked-- > 1) {
+ // create a temporary falling block entity
+ var fallingBlock = new FallingBlockEntity(EntityType.FALLING_BLOCK, level());
+ protected boolean respawnMerged() {
+ if (stacked <= 1) return false;
+
+ // use our the previous state
+ entityState().apply(fallingBlock);
+ while (stacked-- >= 1) {
+ // Unlike PrimedTnt we have to try respawn each stacked entity
+ FallingBlockEntity fallingBlock = new FallingBlockEntity(EntityType.FALLING_BLOCK, level());
+
+ // Try to stack the falling block
+ this.entityState().apply(fallingBlock);
+ fallingBlock.time = time - 1;
+
+ // and tick
+ fallingBlock.tick();
+
+ // Well, this can actually happen.
+ // If you horizontal or rectangle stack sand into a b36 this condition will be met.
+ // This could break some suspicious render queuing setups relying on horizontal stacking
+ // and keeping sand in b36 using pistons pushing back and forth.
+ // If you horizontal stack into a moving piston block this condition will be met.
+ if (!fallingBlock.isRemoved()) {
+ fallingBlock.stacked = stacked;
+ level().addFreshEntity(fallingBlock);
+ stacked++;
+ fallingBlock.storeEntityState();
+ fallingBlock.entityState().apply(this);
+ break;
+ } else if (stacked == 0) {
+ this.discard();
+ }
+ }
+
+ return true;
+ }
+
+ @Nullable
+ public ItemEntity spawnAtLocation(ItemLike item) {
+ // This is to prevent sand continuing to respawn incase it broke.
+ ItemEntity itemEntity = null;
+
+ for (int i = 0; i < stacked; ++i) {
+ while (stacked-- >= 1) {
+ itemEntity = super.spawnAtLocation(item);
+ }
+
+ stacked = 1;
+ return itemEntity;
+ }
+ // Sakura end
@@ -405,19 +407,19 @@ index 0cf39ea76902e62b712057fe1bb80e3af8190fc4..6662d48f691cf6ab515a3eb64642dcb7
@Override
public void tick() {
// Paper start - fix sand duping
@@ -214,6 +266,7 @@ public class FallingBlockEntity extends Entity {
@@ -211,6 +263,7 @@ public class FallingBlockEntity extends Entity {
return;
}
// CraftBukkit end
+ if (this.respawnMerged()) return; // Sakura
if (this.level().setBlock(blockposition, this.blockState, 3)) {
((ServerLevel) this.level()).getChunkSource().chunkMap.broadcast(this, new ClientboundBlockUpdatePacket(blockposition, this.level().getBlockState(blockposition)));
this.discard();
+ this.respawn(); // Sakura
if (block instanceof Fallable) {
((Fallable) block).onLand(this.level(), blockposition, this.blockState, iblockdata, this);
}
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 cc30c119f519e7cd947ab40beae56e493e977176..826a910a02ae234012d10bb9ca3b677d127a6d13 100644
index cc30c119f519e7cd947ab40beae56e493e977176..811a5224a02bb3badb1b8d6de370b7166d9f877c 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -71,6 +71,60 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -71,6 +71,44 @@ public class PrimedTnt extends Entity implements TraceableEntity {
return !this.isRemoved();
}
@@ -437,52 +439,36 @@ index cc30c119f519e7cd947ab40beae56e493e977176..826a910a02ae234012d10bb9ca3b677d
+ }
+
+ @Override
+ protected void respawn() {
+ if (stacked <= 1) return;
+ protected boolean respawnMerged() {
+ if (stacked <= 1) return false;
+
+ // we create a temporary entity that will be affected by each explosion
+ // this allows us to only keep one entity in the world in an attempt to
+ // minimise complexity of stacked tnt explosions.
+ var tnt = new PrimedTnt(level(), 0, 0, 0, owner);
+ PrimedTnt tnt = new PrimedTnt(EntityType.TNT, level());
+
+ // Copy our pre-tick state to the temporary entity
+ entityState().apply(tnt);
+ while (stacked-- > 1) {
+ this.setFuse(100); // Prevent unwanted explosions while ticking
+
+ // add the entity to the world and chunk
+ level().addFreshEntity(tnt);
+ // Cause an explosion to affect this entity
+ tnt.setPos(this.position());
+ tnt.setDeltaMovement(this.getDeltaMovement());
+ this.entityState().apply(this);
+ tnt.explode();
+ this.storeEntityState();
+
+ // Some bad plugins may change tnt momentum while we are respawning
+ // ex: a plugin that sets tnt momentum to 0 upon spawning
+ tnt.setDeltaMovement(entityState().momentum());
+
+ for (int i = stacked - 1; i >= 1; --i) {
+ // make sure this entity cannot explode unexpectedly
+ setFuse(100);
+ stacked = 0;
+
+ // explode!
+ explode();
+
+ // clone state from temporary entity
+ tnt.storeEntityState();
+ tnt.entityState().apply(this);
+
+ // tick, this is only to move the entity and apply physics.
+ tick();
+ this.tick();
+ }
+
+ tnt.discard();
+ return true;
+ }
+ // Sakura end
+
@Override
public void tick() {
if (this.level().spigotConfig.maxTntTicksPerTick > 0 && ++this.level().spigotConfig.currentPrimedTnt > this.level().spigotConfig.maxTntTicksPerTick) { return; } // Spigot
@@ -96,6 +150,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -96,6 +134,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
if (i <= 0) {
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
// this.discard();
+ this.respawn(); // Sakura
+ this.respawnMerged(); // Sakura
if (!this.level().isClientSide) {
this.explode();
}

View File

@@ -646,7 +646,7 @@ index a507605a04af7f576548129517029192309fd9e7..65fe46780a9f9687d328afb5cca176ab
@Override
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 826a910a02ae234012d10bb9ca3b677d127a6d13..2445bfc0c5604cb0185d240c9448a5c7fefa8784 100644
index 811a5224a02bb3badb1b8d6de370b7166d9f877c..1b8d43cf54999c9a005459bc59d7b5a50bb9c1ee 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -86,6 +86,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -655,11 +655,11 @@ index 826a910a02ae234012d10bb9ca3b677d127a6d13..2445bfc0c5604cb0185d240c9448a5c7
+ /*
@Override
protected void respawn() {
if (stacked <= 1) return;
@@ -123,6 +124,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
protected boolean respawnMerged() {
if (stacked <= 1) return false;
@@ -107,6 +108,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
tnt.discard();
return true;
}
+ */
// Sakura end

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Optimise Fast Movement
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index c9d94d157b4bc52742050d75b3a11b8e2769ec08..dbccada2818004edd0ae220c173c18cc5bc9acd5 100644
index 6e2defee2a8523d7025a8341b41488192618dd1a..8d43914e515bbdd58cbc546101af643e6ba6d018 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -1215,6 +1215,95 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1217,6 +1217,95 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// Paper end - detailed watchdog information
@@ -104,7 +104,7 @@ index c9d94d157b4bc52742050d75b3a11b8e2769ec08..dbccada2818004edd0ae220c173c18cc
public void move(MoverType movementType, Vec3 movement) {
// Paper start - detailed watchdog information
io.papermc.paper.util.TickThread.ensureTickThread("Cannot move an entity off-main");
@@ -1592,6 +1681,99 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1594,6 +1683,99 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return offsetFactor;
}
@@ -205,7 +205,7 @@ index c9d94d157b4bc52742050d75b3a11b8e2769ec08..dbccada2818004edd0ae220c173c18cc
// Paper start - optimise collisions
final boolean xZero = movement.x == 0.0;
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 6662d48f691cf6ab515a3eb64642dcb770d1caa0..2943db8264751920f79ccda40d4bb5a16daa47df 100644
index 3a0d82cd7a0d7ec20138effd6d84eee60ffab788..b7f9c8a6de4c07f230f99b6bfa1332166e696b49 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -201,7 +201,7 @@ public class FallingBlockEntity extends Entity {
@@ -218,10 +218,10 @@ index 6662d48f691cf6ab515a3eb64642dcb770d1caa0..2943db8264751920f79ccda40d4bb5a1
// Paper start - fix sand duping
if (this.isRemoved()) {
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 2445bfc0c5604cb0185d240c9448a5c7fefa8784..090f8a5e173f9cafc681ac5c3c2a1ec1371c2245 100644
index 1b8d43cf54999c9a005459bc59d7b5a50bb9c1ee..ebfd24f9fb90071288f0c872c0e3fbd58bb3f2b9 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -134,7 +134,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -118,7 +118,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
this.addDeltaMovement(0.0D, -0.04D, 0.0D); // Sakura - reduce movement allocations
}

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] isPushedByFluid API
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index dbccada2818004edd0ae220c173c18cc5bc9acd5..c304338538ee45e2924a630eab10473e95e6c078 100644
index 8d43914e515bbdd58cbc546101af643e6ba6d018..b6254947092f15b039d2af442ac36274920731a1 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -678,6 +678,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -680,6 +680,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
discard();
}
// Sakura end
@@ -16,7 +16,7 @@ index dbccada2818004edd0ae220c173c18cc5bc9acd5..c304338538ee45e2924a630eab10473e
public boolean isLegacyTrackingEntity = false;
@@ -4238,7 +4239,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -4240,7 +4241,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
public boolean isPushedByFluid() {

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Cannon Mechanics
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 2943db8264751920f79ccda40d4bb5a16daa47df..a3ade76d9f7b4355258953bd40d9a36a4dc004fa 100644
index b7f9c8a6de4c07f230f99b6bfa1332166e696b49..7de6f027fc8a9e7d44ae1e5fa99690dcb04a89c7 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -67,6 +67,7 @@ public class FallingBlockEntity extends Entity {
@@ -38,7 +38,7 @@ index 2943db8264751920f79ccda40d4bb5a16daa47df..a3ade76d9f7b4355258953bd40d9a36a
@Override
public void tick() {
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 090f8a5e173f9cafc681ac5c3c2a1ec1371c2245..7cb8d79e578cc23747e6b89ae4379b7a8daa328e 100644
index ebfd24f9fb90071288f0c872c0e3fbd58bb3f2b9..d534bc3ff8d5995ced0f9f89261cdcf1835698f4 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -53,6 +53,12 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -54,7 +54,7 @@ index 090f8a5e173f9cafc681ac5c3c2a1ec1371c2245..7cb8d79e578cc23747e6b89ae4379b7a
}
@Override
@@ -271,7 +277,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -255,7 +261,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
// Paper start - Optional prevent TNT from moving in water
@Override
public boolean isPushedByFluid() {

View File

@@ -5,10 +5,10 @@ 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 c304338538ee45e2924a630eab10473e95e6c078..4c97c47e00fec68ef2e87bc981ccb811bbff6516 100644
index b6254947092f15b039d2af442ac36274920731a1..e5df563f4d3806d72236f302391a69e4b06e6447 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2185,7 +2185,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -2187,7 +2187,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return this.isInWater() || flag;
}
@@ -18,10 +18,10 @@ index c304338538ee45e2924a630eab10473e95e6c078..4c97c47e00fec68ef2e87bc981ccb811
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 7cb8d79e578cc23747e6b89ae4379b7a8daa328e..adac2a47b97e8b860e54fbf4fa37bf981c70aadc 100644
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
@@ -132,6 +132,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -116,6 +116,19 @@ public class PrimedTnt extends Entity implements TraceableEntity {
}
*/
// Sakura end

View File

@@ -5,10 +5,10 @@ Subject: [PATCH] Remove spigot max tnt per tick
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 adac2a47b97e8b860e54fbf4fa37bf981c70aadc..545c15a5bc92450de75e931794c2289da7004617 100644
index dcb28daa8daf8fc2af020a7a94e3c9e51a2df63e..8ee03ac1c824fd2476339202c073239292ef62a2 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -148,7 +148,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -132,7 +132,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@Override
public void tick() {

View File

@@ -78,7 +78,7 @@ index 4f9880d35347dd008aa2ee6e67f35301ff37a4c0..79d5cd8f90fda2390a64c2d1e0cfca6b
x /= distance;
y /= distance;
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8146e0169 100644
index e5df563f4d3806d72236f302391a69e4b06e6447..fe53e065ccec4954aa48eace372898c62bc7959a 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -378,7 +378,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -90,7 +90,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
public boolean isInPowderSnow;
public boolean wasInPowderSnow;
public boolean wasOnFire;
@@ -679,6 +679,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -681,6 +681,13 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
// Sakura end
public boolean pushedByFluid = true; // Sakura
@@ -104,7 +104,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
public boolean isLegacyTrackingEntity = false;
@@ -1161,7 +1168,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1163,7 +1170,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
}
protected void checkSupportingBlock(boolean onGround, @Nullable Vec3 movement) {
@@ -113,7 +113,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
AABB axisalignedbb = this.getBoundingBox();
AABB axisalignedbb1 = new AABB(axisalignedbb.minX, axisalignedbb.minY - 1.0E-6D, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.minY, axisalignedbb.maxZ);
Optional<BlockPos> optional = this.level.findSupportingBlock(this, axisalignedbb1);
@@ -1223,7 +1230,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1225,7 +1232,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (this.noPhysics) {
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
@@ -122,7 +122,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
movement = this.limitPistonMovement(movement);
if (movement.equals(Vec3.ZERO)) {
return;
@@ -1241,10 +1248,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1243,10 +1250,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Vec3 vec3d1 = this.collideScan(movement);
double d0 = vec3d1.lengthSqr();
@@ -135,7 +135,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
BlockHitResult movingobjectpositionblock = this.level().clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this));
if (movingobjectpositionblock.getType() != HitResult.Type.MISS) {
@@ -1280,6 +1287,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1282,6 +1289,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (this.horizontalCollision) {
Vec3 vec3d2 = this.getDeltaMovement();
@@ -148,7 +148,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
}
@@ -1320,7 +1333,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1322,7 +1335,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z);
} else {
this.wasOnFire = this.isOnFire();
@@ -157,7 +157,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
this.activatedTick = Math.max(this.activatedTick, MinecraftServer.currentTick + 20); // Paper
this.activatedImmunityTick = Math.max(this.activatedImmunityTick, MinecraftServer.currentTick + 20); // Paper
movement = this.limitPistonMovement(movement);
@@ -1347,8 +1360,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1349,8 +1362,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
Vec3 vec3d1 = this.collide(movement);
double d0 = vec3d1.lengthSqr();
@@ -168,7 +168,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
BlockHitResult movingobjectpositionblock = this.level().clip(new ClipContext(this.position(), this.position().add(vec3d1), ClipContext.Block.FALLDAMAGE_RESETTING, ClipContext.Fluid.WATER, this));
if (movingobjectpositionblock.getType() != HitResult.Type.MISS) {
@@ -1384,6 +1397,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1386,6 +1399,12 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
if (this.horizontalCollision) {
Vec3 vec3d2 = this.getDeltaMovement();
@@ -181,7 +181,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
this.setDeltaMovement(flag ? 0.0D : vec3d2.x, vec3d2.y, flag1 ? 0.0D : vec3d2.z);
}
@@ -1707,7 +1726,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1709,7 +1728,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
double y = movement.y;
double z = movement.z;
@@ -193,7 +193,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
if (y != 0.0) {
y = scanY(currBoundingBox, y, voxelList, bbList);
@@ -1831,7 +1853,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1833,7 +1855,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
return movement;
}
@@ -202,7 +202,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
if (stepHeight > 0.0
&& (onGround || (limitedMoveVector.y != movement.y && movement.y < 0.0))
@@ -1947,8 +1969,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
@@ -1949,8 +1971,11 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
protected void checkInsideBlocks() {
AABB axisalignedbb = this.getBoundingBox();
@@ -217,7 +217,7 @@ index 4c97c47e00fec68ef2e87bc981ccb811bbff6516..7e00e47fe01b996bf6a2f16dc4998ab8
if (this.level().hasChunksAt(blockposition, blockposition1)) {
BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos();
diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
index 0f1c9eb07c19dd0926521418390855f4bc1bc399..99887ed1044cff244074a4584729df50239e9e9a 100644
index 6274c005f4f53f3cec0c94b7d40cdb7070b190e0..343aa327978f13d10769eced56de9caa0e9a883a 100644
--- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
+++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java
@@ -89,6 +89,8 @@ public class FallingBlockEntity extends Entity {
@@ -353,7 +353,7 @@ index 0f1c9eb07c19dd0926521418390855f4bc1bc399..99887ed1044cff244074a4584729df50
}
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 545c15a5bc92450de75e931794c2289da7004617..5010c994dae5aa189b2c02f9b9fc9715cac3f9a4 100644
index 8ee03ac1c824fd2476339202c073239292ef62a2..5e588332f5916355293553012c73a647b1f4bd89 100644
--- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
+++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java
@@ -59,6 +59,13 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -370,7 +370,7 @@ index 545c15a5bc92450de75e931794c2289da7004617..5010c994dae5aa189b2c02f9b9fc9715
}
@Override
@@ -145,12 +152,30 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -129,12 +136,30 @@ public class PrimedTnt extends Entity implements TraceableEntity {
}
}
// Sakura end
@@ -402,7 +402,7 @@ index 545c15a5bc92450de75e931794c2289da7004617..5010c994dae5aa189b2c02f9b9fc9715
}
this.moveBasic(MoverType.SELF, this.getDeltaMovement()); // Sakura
@@ -160,15 +185,18 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -144,15 +169,18 @@ public class PrimedTnt extends Entity implements TraceableEntity {
return;
}
// Paper end
@@ -423,8 +423,8 @@ index 545c15a5bc92450de75e931794c2289da7004617..5010c994dae5aa189b2c02f9b9fc9715
+ if (this.physics.before(1_9_0) ? (i < 0) : (i <= 0)) { // Sakura - physics version api
// CraftBukkit start - Need to reverse the order of the explosion and the entity death so we have a location for the event
// this.discard();
this.respawn(); // Sakura
@@ -221,7 +249,10 @@ public class PrimedTnt extends Entity implements TraceableEntity {
this.respawnMerged(); // Sakura
@@ -205,7 +233,10 @@ public class PrimedTnt extends Entity implements TraceableEntity {
ExplosionPrimeEvent event = CraftEventFactory.callExplosionPrimeEvent((org.bukkit.entity.Explosive)this.getBukkitEntity());
if (!event.isCancelled()) {
@@ -436,7 +436,7 @@ index 545c15a5bc92450de75e931794c2289da7004617..5010c994dae5aa189b2c02f9b9fc9715
}
// CraftBukkit end
}
@@ -290,7 +321,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
@@ -274,7 +305,7 @@ public class PrimedTnt extends Entity implements TraceableEntity {
// Paper start - Optional prevent TNT from moving in water
@Override
public boolean isPushedByFluid() {