继续修复开火条件判断问题(恼)

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

View file

@ -369,6 +369,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
if (ammo == 1) { if (ammo == 1) {
this.entityData.set(DISPLAY_ENTITY, ""); this.entityData.set(DISPLAY_ENTITY, "");
this.entityData.set(MAX_AMMO, 1); this.entityData.set(MAX_AMMO, 1);
this.entityData.set(IS_KAMIKAZE, false);
this.currentItem = ItemStack.EMPTY; this.currentItem = ItemStack.EMPTY;
} }
} }
@ -397,6 +398,8 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
this.currentItem = stack.copyWithCount(1); this.currentItem = stack.copyWithCount(1);
this.entityData.set(DISPLAY_ENTITY, attachmentData.displayEntity()); this.entityData.set(DISPLAY_ENTITY, attachmentData.displayEntity());
this.entityData.set(AMMO, this.entityData.get(AMMO) + 1); this.entityData.set(AMMO, this.entityData.get(AMMO) + 1);
this.entityData.set(IS_KAMIKAZE, attachmentData.isKamikaze);
this.entityData.set(MAX_AMMO, attachmentData.count());
if (!player.isCreative()) { if (!player.isCreative()) {
stack.shrink(1); stack.shrink(1);
@ -420,7 +423,6 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
attachmentData.xLength, attachmentData.zLength, attachmentData.xLength, attachmentData.zLength,
(float) attachmentData.tickCount (float) attachmentData.tickCount
)); ));
this.entityData.set(MAX_AMMO, attachmentData.count());
} }
} }
@ -667,9 +669,9 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
var data = CustomData.DRONE_ATTACHMENT.get(getItemId(this.currentItem)); var data = CustomData.DRONE_ATTACHMENT.get(getItemId(this.currentItem));
if (data == null) return; if (data == null) return;
var bomb = EntityType.byString(attachedEntity).map(entityType -> var bomb = EntityType.byString(attachedEntity)
entityType.create(this.level()) .map(entityType -> entityType.create(this.level()))
).orElse(null); .orElse(null);
if (bomb == null) return; if (bomb == null) return;
explosion = new CustomExplosion(this.level(), this, explosion = new CustomExplosion(this.level(), this,