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

修复潜在NPE,优化秒破粒子

This commit is contained in:
XiaoMoMi
2025-04-15 04:29:41 +08:00
parent f6e29c5fb0
commit 0129af4ead

View File

@@ -371,11 +371,16 @@ public class BukkitServerPlayer extends Player {
// if it's not an instant break on client side, we should resend level event
if (vanillaBlockState != null && getDestroyProgress(vanillaBlockState.handle(), pos) < 1f) {
Object levelEventPacket = FastNMS.INSTANCE.constructor$ClientboundLevelEventPacket(
WorldEvents.BLOCK_BREAK_EFFECT, LocationUtils.toBlockPos(pos), BlockStateUtils.blockStateToId(this.destroyedState), false);
WorldEvents.BLOCK_BREAK_EFFECT, LocationUtils.toBlockPos(pos), BlockStateUtils.blockStateToId(state), false);
sendPacket(levelEventPacket, false);
}
return;
}
if (!custom && !this.clientSideCanBreak && getDestroyProgress(state, pos) >= 1f) {
Object levelEventPacket = FastNMS.INSTANCE.constructor$ClientboundLevelEventPacket(
WorldEvents.BLOCK_BREAK_EFFECT, LocationUtils.toBlockPos(pos), BlockStateUtils.blockStateToId(state), false);
sendPacket(levelEventPacket, false);
}
// if it's a custom one, we prevent it, otherwise we allow it
setClientSideCanBreakBlock(!custom);
// set some base info