修复开火条件判断问题

This commit is contained in:
Light_Quanta 2025-07-04 00:30:42 +08:00
parent 53f998d5ae
commit 07a11ba96f
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -232,14 +232,13 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
this.hurt(new DamageSource(level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.EXPLOSION), controller), 0.25f + (float) (2 * lastTickSpeed)); this.hurt(new DamageSource(level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.EXPLOSION), controller), 0.25f + (float) (2 * lastTickSpeed));
} }
if (this.fire) { if (this.fire && this.entityData.get(AMMO) > 0) {
if (this.entityData.get(AMMO) > 0) { if (!this.entityData.get(IS_KAMIKAZE)) {
this.entityData.set(AMMO, this.entityData.get(AMMO) - 1); this.entityData.set(AMMO, this.entityData.get(AMMO) - 1);
if (controller != null && this.level() instanceof ServerLevel) { if (controller != null && this.level() instanceof ServerLevel) {
droneDrop(controller); droneDrop(controller);
} }
} } else {
if (!this.entityData.get(DISPLAY_ENTITY).isEmpty()) {
if (controller != null) { if (controller != null) {
var stack = controller.getMainHandItem(); var stack = controller.getMainHandItem();
if (stack.is(ModItems.MONITOR.get())) { if (stack.is(ModItems.MONITOR.get())) {
@ -249,7 +248,6 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
} }
this.hurt(new DamageSource(level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.EXPLOSION), controller), 10000); this.hurt(new DamageSource(level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.EXPLOSION), controller), 10000);
} }
} }
this.fire = false; this.fire = false;
} }