9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0098-Fix-falling-block-s-block-location.patch
2025-02-17 17:12:25 +08:00

27 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Fri, 16 Feb 2024 19:50:03 +0800
Subject: [PATCH] Fix falling block's block location
diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java
index 65e916089fba9e2a3908dafa24634f6cc259e595..ceca4c395358f27fea805dec558e10cd2989d891 100644
--- a/net/minecraft/world/entity/Entity.java
+++ b/net/minecraft/world/entity/Entity.java
@@ -4829,6 +4829,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
int floor = Mth.floor(x);
int floor1 = Mth.floor(y);
int floor2 = Mth.floor(z);
+
+ // Leaves start - fix falling block location
+ if (this instanceof net.minecraft.world.entity.item.FallingBlockEntity) {
+ if (y < 0.0 && y + 1e-10 > 0.0) {
+ floor1 = 0;
+ }
+ }
+ // Leaves end - fix falling block location
+
if (floor != this.blockPosition.getX() || floor1 != this.blockPosition.getY() || floor2 != this.blockPosition.getZ()) {
this.blockPosition = new BlockPos(floor, floor1, floor2);
this.inBlockState = null;