添加强制删除激光的方法

This commit is contained in:
17146 2024-12-03 00:23:07 +08:00
parent c2b3f29e7b
commit dd1f63cf05

View file

@ -1,6 +1,8 @@
package com.atsuishio.superbwarfare.event; package com.atsuishio.superbwarfare.event;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.capability.LaserCapability;
import com.atsuishio.superbwarfare.capability.ModCapabilities;
import com.atsuishio.superbwarfare.config.common.GameplayConfig; import com.atsuishio.superbwarfare.config.common.GameplayConfig;
import com.atsuishio.superbwarfare.entity.ICannonEntity; import com.atsuishio.superbwarfare.entity.ICannonEntity;
import com.atsuishio.superbwarfare.entity.TargetEntity; import com.atsuishio.superbwarfare.entity.TargetEntity;
@ -80,6 +82,10 @@ public class LivingEventHandler {
handlePlayerKillEntity(event); handlePlayerKillEntity(event);
handlePlayerDeathDropAmmo(event.getEntity()); handlePlayerDeathDropAmmo(event.getEntity());
giveKillExpToWeapon(event); giveKillExpToWeapon(event);
if (event.getEntity() instanceof Player player) {
handlePlayerBeamReset(player);
}
} }
/** /**
@ -725,4 +731,8 @@ public class LivingEventHandler {
event.setCanceled(true); event.setCanceled(true);
} }
} }
public static void handlePlayerBeamReset(Player player) {
player.getCapability(ModCapabilities.LASER_CAPABILITY).ifPresent(LaserCapability.ILaserCapability::end);
}
} }