From 3f1568e1ba6b95f140585e5868db3acbb100cfaf Mon Sep 17 00:00:00 2001 From: harry-xi Date: Thu, 26 Dec 2024 21:08:38 +0800 Subject: [PATCH 1/2] fix: Door-related bug Incorrectly dropping drops when destroying the upper part of a door in creation mode --- .../block/component/door/BlockDoorBaseComponentImpl.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/server/src/main/java/org/allaymc/server/block/component/door/BlockDoorBaseComponentImpl.java b/server/src/main/java/org/allaymc/server/block/component/door/BlockDoorBaseComponentImpl.java index 186206752..94084e8b8 100644 --- a/server/src/main/java/org/allaymc/server/block/component/door/BlockDoorBaseComponentImpl.java +++ b/server/src/main/java/org/allaymc/server/block/component/door/BlockDoorBaseComponentImpl.java @@ -123,6 +123,14 @@ public boolean onInteract(ItemStack itemStack, Dimension dimension, PlayerIntera return true; } + @Override + public void onBreak(BlockStateWithPos blockState, ItemStack usedItem, Entity entity) { + if(blockState.blockState().getPropertyValue(UPPER_BLOCK_BIT)){ + blockState.pos().dimension().breakBlock(((Vector3i) blockState.pos()).sub(0,1,0),null, entity); + } + super.onBreak(blockState, usedItem, entity); + } + @Override public Set getDrops(BlockStateWithPos blockState, ItemStack usedItem, Entity entity) { return blockState.blockState().getPropertyValue(UPPER_BLOCK_BIT) ? Utils.EMPTY_ITEM_STACK_SET : super.getDrops(blockState, usedItem, entity); From 0230234de4f2ec8aca7f0a10f6d2246bbe3288df Mon Sep 17 00:00:00 2001 From: harry-xi Date: Thu, 26 Dec 2024 23:25:16 +0800 Subject: [PATCH 2/2] style: format the code and update the CHANGELOG.md --- CHANGELOG.md | 1 + .../block/component/door/BlockDoorBaseComponentImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c32458659..04e9a2871 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ Unless otherwise specified, any version comparison below is the comparison of se - Fixed visual flashes when eating chorus fruits. - Fixed incorrect comparison of `Position3x#dimension`. - Fixed a number of falling block related bugs. +- Fixed incorrectly dropping drops when destroying the upper part of a door in creation mode. ## [0.1.0](https://github.com/AllayMC/Allay/releases/tag/0.1.0) (API 0.1.0) - 2024-12-22 diff --git a/server/src/main/java/org/allaymc/server/block/component/door/BlockDoorBaseComponentImpl.java b/server/src/main/java/org/allaymc/server/block/component/door/BlockDoorBaseComponentImpl.java index 94084e8b8..2f8e4ca26 100644 --- a/server/src/main/java/org/allaymc/server/block/component/door/BlockDoorBaseComponentImpl.java +++ b/server/src/main/java/org/allaymc/server/block/component/door/BlockDoorBaseComponentImpl.java @@ -125,8 +125,8 @@ public boolean onInteract(ItemStack itemStack, Dimension dimension, PlayerIntera @Override public void onBreak(BlockStateWithPos blockState, ItemStack usedItem, Entity entity) { - if(blockState.blockState().getPropertyValue(UPPER_BLOCK_BIT)){ - blockState.pos().dimension().breakBlock(((Vector3i) blockState.pos()).sub(0,1,0),null, entity); + if (blockState.blockState().getPropertyValue(UPPER_BLOCK_BIT)) { + blockState.pos().dimension().breakBlock(((Vector3i) blockState.pos()).sub(0, 1, 0), null, entity); } super.onBreak(blockState, usedItem, entity); }