添加dps发电机和beast的适配
This commit is contained in:
parent
8874ab857a
commit
809da4ca8d
2 changed files with 20 additions and 1 deletions
|
@ -345,4 +345,15 @@ public class DPSGeneratorEntity extends LivingEntity implements GeoEntity {
|
||||||
public int getMaxTransfer() {
|
public int getMaxTransfer() {
|
||||||
return getMaxEnergy() / 2;
|
return getMaxEnergy() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.atsuishio.superbwarfare.block.BarbedWireBlock;
|
||||||
import com.atsuishio.superbwarfare.component.ModDataComponents;
|
import com.atsuishio.superbwarfare.component.ModDataComponents;
|
||||||
import com.atsuishio.superbwarfare.config.server.MiscConfig;
|
import com.atsuishio.superbwarfare.config.server.MiscConfig;
|
||||||
import com.atsuishio.superbwarfare.config.server.ProjectileConfig;
|
import com.atsuishio.superbwarfare.config.server.ProjectileConfig;
|
||||||
|
import com.atsuishio.superbwarfare.entity.DPSGeneratorEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
|
import com.atsuishio.superbwarfare.entity.ICustomKnockback;
|
||||||
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
import com.atsuishio.superbwarfare.entity.TargetEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
import com.atsuishio.superbwarfare.entity.vehicle.base.VehicleEntity;
|
||||||
|
@ -132,6 +133,8 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
||||||
if (entity.equals(this.shooter.getVehicle())) continue;
|
if (entity.equals(this.shooter.getVehicle())) continue;
|
||||||
|
|
||||||
if (entity instanceof TargetEntity && entity.getEntityData().get(TargetEntity.DOWN_TIME) > 0) continue;
|
if (entity instanceof TargetEntity && entity.getEntityData().get(TargetEntity.DOWN_TIME) > 0) continue;
|
||||||
|
if (entity instanceof DPSGeneratorEntity && entity.getEntityData().get(DPSGeneratorEntity.DOWN_TIME) > 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
EntityResult result = this.getHitResult(entity, startVec, endVec);
|
EntityResult result = this.getHitResult(entity, startVec, endVec);
|
||||||
if (result == null) continue;
|
if (result == null) continue;
|
||||||
|
@ -270,7 +273,8 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
||||||
if (!this.beast) {
|
if (!this.beast) {
|
||||||
this.bypassArmorRate -= 0.2F;
|
this.bypassArmorRate -= 0.2F;
|
||||||
if (this.bypassArmorRate < 0.8F) {
|
if (this.bypassArmorRate < 0.8F) {
|
||||||
if (result != null && !(((EntityHitResult) result).getEntity() instanceof TargetEntity target && target.getEntityData().get(TargetEntity.DOWN_TIME) > 0)) {
|
if (result != null && !(((EntityHitResult) result).getEntity() instanceof TargetEntity target && target.getEntityData().get(TargetEntity.DOWN_TIME) > 0)
|
||||||
|
&& !(((EntityHitResult) result).getEntity() instanceof DPSGeneratorEntity dpsGeneratorEntity && dpsGeneratorEntity.getEntityData().get(DPSGeneratorEntity.DOWN_TIME) > 0)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -483,6 +487,10 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
||||||
if (beast && entity instanceof LivingEntity living) {
|
if (beast && entity instanceof LivingEntity living) {
|
||||||
if (living.isDeadOrDying()) return;
|
if (living.isDeadOrDying()) return;
|
||||||
if (living instanceof TargetEntity) return;
|
if (living instanceof TargetEntity) return;
|
||||||
|
if (living instanceof DPSGeneratorEntity dpsGeneratorEntity) {
|
||||||
|
dpsGeneratorEntity.beastCharge();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (this.shooter instanceof ServerPlayer player) {
|
if (this.shooter instanceof ServerPlayer player) {
|
||||||
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));
|
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));
|
||||||
|
|
Loading…
Add table
Reference in a new issue