From bbabcb8d36d1f78ad57e5cfd13302c169b08dd23 Mon Sep 17 00:00:00 2001 From: daoge_cmd <3523206925@qq.com> Date: Mon, 13 Jan 2025 21:32:16 +0800 Subject: [PATCH] refactor: use BlockType#copyPropertyValuesFrom() --- .../furnace/BlockEntityFurnaceBaseComponentImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/org/allaymc/server/blockentity/component/furnace/BlockEntityFurnaceBaseComponentImpl.java b/server/src/main/java/org/allaymc/server/blockentity/component/furnace/BlockEntityFurnaceBaseComponentImpl.java index 9c57dfe72..9ca04708c 100644 --- a/server/src/main/java/org/allaymc/server/blockentity/component/furnace/BlockEntityFurnaceBaseComponentImpl.java +++ b/server/src/main/java/org/allaymc/server/blockentity/component/furnace/BlockEntityFurnaceBaseComponentImpl.java @@ -3,7 +3,6 @@ import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; -import org.allaymc.api.block.property.type.BlockPropertyType; import org.allaymc.api.block.type.BlockType; import org.allaymc.api.block.type.BlockTypes; import org.allaymc.api.blockentity.component.BlockEntityContainerHolderComponent; @@ -130,11 +129,12 @@ public void loadNBT(NbtMap nbt) { public void setLit(boolean lit) { var currentBlockState = getDimension().getBlockState(position); var newBlockType = lit ? getLitBlockType() : getUnlitBlockType(); - if (currentBlockState.getBlockType() == newBlockType) return; + if (currentBlockState.getBlockType() == newBlockType) { + return; + } - var propertyValues = currentBlockState.getPropertyValues().values().toArray(BlockPropertyType.BlockPropertyValue[]::new); getDimension().setBlockState( - position, newBlockType.ofState(propertyValues), + position, newBlockType.copyPropertyValuesFrom(currentBlockState), 0, true, true, false ); }