9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-30 12:29:15 +00:00

修复tick破坏掉落物

This commit is contained in:
XiaoMoMi
2025-06-28 03:38:26 +08:00
parent 7da8d75dad
commit 72238b376b
2 changed files with 2 additions and 3 deletions

View File

@@ -32,11 +32,10 @@ public abstract class AbstractCanSurviveBlockBehavior extends BukkitBlockBehavio
if (!canSurvive(thisBlock, args, () -> true)) {
BlockStateUtils.getOptionalCustomBlockState(blockState).ifPresent(customState -> {
if (!customState.isEmpty() && customState.owner().value() == this.customBlock) {
FastNMS.INSTANCE.method$Level$removeBlock(level, blockPos, false);
net.momirealms.craftengine.core.world.World world = new BukkitWorld(FastNMS.INSTANCE.method$Level$getCraftWorld(level));
WorldPosition position = new WorldPosition(world, Vec3d.atCenterOf(LocationUtils.fromBlockPos(blockPos)));
world.playBlockSound(position, customState.sounds().breakSound());
FastNMS.INSTANCE.method$Level$levelEvent(level, WorldEvents.BLOCK_BREAK_EFFECT, blockPos, customState.customBlockState().registryId());
FastNMS.INSTANCE.method$Level$destroyBlock(level, blockPos, true);
}
});
}