修复beastCharge调用错误

This commit is contained in:
Light_Quanta 2025-05-10 23:27:04 +08:00
parent fb18af97dd
commit d42e79fd91
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959

View file

@ -348,12 +348,10 @@ public class DPSGeneratorEntity extends LivingEntity implements GeoEntity {
public void beastCharge() {
this.entityData.set(LEVEL, 7);
this.getEnergy().ifPresent(cap -> {
if (cap instanceof SyncedEntityEnergyStorage storage) {
storage.setCapacity(this.getMaxEnergy());
storage.setMaxExtract(this.getMaxTransfer());
storage.setEnergy(this.getMaxEnergy());
}
});
if (this.getCapability(Capabilities.EnergyStorage.ENTITY, null) instanceof SyncedEntityEnergyStorage storage) {
storage.setCapacity(this.getMaxEnergy());
storage.setMaxExtract(this.getMaxTransfer());
storage.setEnergy(this.getMaxEnergy());
}
}
}