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

修复缺少玩家参数问题

This commit is contained in:
XiaoMoMi
2025-09-03 05:16:14 +08:00
parent 0d9177505e
commit b04ae5caf0
2 changed files with 3 additions and 2 deletions

View File

@@ -55,7 +55,6 @@ public class BukkitVanillaLootManager extends AbstractVanillaLootManager impleme
HandlerList.unregisterAll(this);
}
@SuppressWarnings("UnstableApiUsage")
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onEntityDeath(EntityDeathEvent event) {
Entity entity = event.getEntity();

View File

@@ -121,8 +121,10 @@ public final class BlockStateGenerator {
if (!item.isEmpty()) {
lootBuilder.withParameter(DirectContextParameters.ITEM_IN_HAND, item);
}
BukkitServerPlayer player = optionalPlayer != null ? BukkitCraftEngine.instance().adapt(FastNMS.INSTANCE.method$ServerPlayer$getBukkitEntity(optionalPlayer)) : null;
if (player != null) {
lootBuilder.withParameter(DirectContextParameters.PLAYER, player);
}
Float radius = (Float) FastNMS.INSTANCE.method$LootParams$Builder$getOptionalParameter(builder, MLootContextParams.EXPLOSION_RADIUS);
if (radius != null) {
lootBuilder.withParameter(DirectContextParameters.EXPLOSION_RADIUS, radius);