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

增加安全检查

This commit is contained in:
jhqwqmc
2025-09-24 16:32:27 +08:00
parent d522cf105d
commit 154779cdf4

View File

@@ -27,6 +27,7 @@ public class ChimeBlockBehavior extends BukkitBlockBehavior {
@Override
public void onProjectileHit(Object thisBlock, Object[] args, Callable<Object> superMethod) {
if (hitSounds.isEmpty()) return;
Pair<SoundData, Float> hitSound = hitSounds.get(RandomUtils.generateRandomInt(0, hitSounds.size()));
Object blockPos = FastNMS.INSTANCE.field$BlockHitResult$blockPos(args[2]);
Object sound = FastNMS.INSTANCE.constructor$SoundEvent(KeyUtils.toResourceLocation(hitSound.left().id()), Optional.empty());