From 5d584e0f389da7f2efb0b56e23d4969624988fc4 Mon Sep 17 00:00:00 2001 From: Gugle Date: Fri, 20 Dec 2024 17:01:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B9=BB=E7=81=B5=E9=93=81?= =?UTF-8?q?=E7=A0=A7=E4=B8=8B=E8=90=BD=E5=88=A4=E5=AE=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/FallingSpectralBlockEntity.java | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/main/java/dev/dubhe/anvilcraft/entity/FallingSpectralBlockEntity.java b/src/main/java/dev/dubhe/anvilcraft/entity/FallingSpectralBlockEntity.java index 38d30e0c4..d42d4407c 100644 --- a/src/main/java/dev/dubhe/anvilcraft/entity/FallingSpectralBlockEntity.java +++ b/src/main/java/dev/dubhe/anvilcraft/entity/FallingSpectralBlockEntity.java @@ -87,13 +87,10 @@ public void tick() { fallDistance -= (float) this.getDeltaMovement().y; if (this.level().isClientSide) return; BlockPos current = this.blockPosition(); - Vec3 pos = this.position(); - Vec3 belowPos = pos.subtract(0.0D, 0.335D, 0.0D); - BlockPos below = new BlockPos((int) Math.floor(belowPos.x()), (int) Math.floor(belowPos.y()), (int) Math.floor(belowPos.z())); + BlockPos pos = this.blockPosition(); + BlockPos below = pos.below(); BlockState blockStateDown = this.level().getBlockState(below); - if (pos.y() < -160) { - discard(); - } + if (pos.getY() < -160) this.discard(); if (!shouldIgnoreBlockInMovement(blockStateDown)) { this.discard(); if (!isGhostEntity) { @@ -118,11 +115,7 @@ public void tick() { LivingEntity.class, new AABB(current), predicate - ).forEach(it -> it.hurt( - level().damageSources().anvil(this), - Math.min(40f, fallDistance * 2) - ) - ); + ).forEach(it -> it.hurt(level().damageSources().anvil(this), Math.min(40f, fallDistance * 2))); NeoForge.EVENT_BUS.post(new AnvilFallOnLandEvent(level(), current, this, fallDistance)); } this.setDeltaMovement(this.getDeltaMovement().scale(0.98));