补全配置
This commit is contained in:
parent
47ffcd5c01
commit
3b183649a9
5 changed files with 38 additions and 30 deletions
|
@ -53,6 +53,10 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
|||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.FLOAT);
|
||||
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.STRING);
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
||||
private float damage = ExplosionConfig.AGM_65_DAMAGE.get();
|
||||
private float explosionDamage = ExplosionConfig.AGM_65_EXPLOSION_DAMAGE.get();
|
||||
private float explosionRadius = ExplosionConfig.AGM_65_EXPLOSION_RADIUS.get().floatValue();
|
||||
private boolean distracted = false;
|
||||
|
||||
public Agm65Entity(EntityType<? extends Agm65Entity> type, Level world) {
|
||||
|
@ -70,7 +74,7 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
|||
|
||||
@Override
|
||||
protected @NotNull Item getDefaultItem() {
|
||||
return ModItems.JAVELIN_MISSILE.get();
|
||||
return ModItems.AGM.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -140,7 +144,7 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
|||
}
|
||||
}
|
||||
|
||||
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), ExplosionConfig.AGM_65_DAMAGE.get());
|
||||
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage);
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
entity.invulnerableTime = 0;
|
||||
|
@ -226,7 +230,7 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
|||
if (this.level() instanceof ServerLevel) {
|
||||
ProjectileTool.causeCustomExplode(this,
|
||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
||||
this, ExplosionConfig.AGM_65_EXPLOSION_DAMAGE.get(), ExplosionConfig.AGM_65_EXPLOSION_RADIUS.get().floatValue(), 1);
|
||||
this, this.explosionDamage, this.explosionRadius, 1);
|
||||
}
|
||||
this.discard();
|
||||
}
|
||||
|
@ -241,11 +245,11 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
|||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
||||
this,
|
||||
this.getOwner()),
|
||||
ExplosionConfig.AGM_65_EXPLOSION_DAMAGE.get(),
|
||||
this.explosionDamage,
|
||||
this.getX(),
|
||||
this.getEyeY(),
|
||||
this.getZ(),
|
||||
ExplosionConfig.AGM_65_EXPLOSION_RADIUS.get().floatValue(),
|
||||
this.explosionRadius,
|
||||
ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP, true).
|
||||
setDamageMultiplier(1);
|
||||
explosion.explode();
|
||||
|
@ -296,16 +300,16 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
|||
// TODO setter
|
||||
@Override
|
||||
public void setDamage(float damage) {
|
||||
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionDamage(float explosionDamage) {
|
||||
|
||||
this.explosionDamage = explosionDamage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionRadius(float radius) {
|
||||
|
||||
this.explosionRadius = radius;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,9 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
|||
|
||||
public class HandGrenadeEntity extends FastThrowableProjectile implements GeoEntity, ExplosiveProjectile {
|
||||
|
||||
private float damage = 1f;
|
||||
private float explosionDamage = ExplosionConfig.M67_GRENADE_EXPLOSION_DAMAGE.get();
|
||||
private float explosionRadius = ExplosionConfig.M67_GRENADE_EXPLOSION_RADIUS.get();
|
||||
private int fuse = 100;
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
||||
|
@ -93,7 +96,7 @@ public class HandGrenadeEntity extends FastThrowableProjectile implements GeoEnt
|
|||
PacketDistributor.sendToPlayer(player, new ClientIndicatorMessage(0, 5));
|
||||
}
|
||||
}
|
||||
entity.hurt(entity.damageSources().thrown(this, this.getOwner()), 1.0F);
|
||||
entity.hurt(entity.damageSources().thrown(this, this.getOwner()), this.damage);
|
||||
}
|
||||
this.bounce(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite());
|
||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.25, 1.0, 0.25));
|
||||
|
@ -128,7 +131,7 @@ public class HandGrenadeEntity extends FastThrowableProjectile implements GeoEnt
|
|||
if (this.fuse <= 0) {
|
||||
this.discard();
|
||||
if (!this.level().isClientSide) {
|
||||
ProjectileTool.causeCustomExplode(this, ExplosionConfig.M67_GRENADE_EXPLOSION_DAMAGE.get(), ExplosionConfig.M67_GRENADE_EXPLOSION_RADIUS.get(), 1.2f);
|
||||
ProjectileTool.causeCustomExplode(this, this.explosionDamage, this.explosionRadius, 1.2f);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,19 +155,18 @@ public class HandGrenadeEntity extends FastThrowableProjectile implements GeoEnt
|
|||
return 0.07F;
|
||||
}
|
||||
|
||||
// TODO setter
|
||||
@Override
|
||||
public void setDamage(float damage) {
|
||||
|
||||
this.damage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionDamage(float explosionDamage) {
|
||||
|
||||
this.explosionDamage = explosionDamage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionRadius(float radius) {
|
||||
|
||||
this.explosionRadius = radius;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.atsuishio.superbwarfare.entity.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.tools.ProjectileTool;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -19,10 +18,13 @@ import net.minecraft.world.level.Level;
|
|||
import net.minecraft.world.phys.BlockHitResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
// TODO 配置文件
|
||||
public class MelonBombEntity extends FastThrowableProjectile implements DestroyableProjectileEntity, AerialBombEntity {
|
||||
|
||||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(MelonBombEntity.class, EntityDataSerializers.FLOAT);
|
||||
|
||||
private float explosionDamage = 500;
|
||||
private float explosionRadius = 10;
|
||||
|
||||
public MelonBombEntity(EntityType<? extends MelonBombEntity> type, Level world) {
|
||||
super(type, world);
|
||||
this.noCulling = true;
|
||||
|
@ -90,7 +92,7 @@ public class MelonBombEntity extends FastThrowableProjectile implements Destroya
|
|||
@Override
|
||||
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
||||
super.onHitBlock(blockHitResult);
|
||||
ProjectileTool.causeCustomExplode(this, VehicleConfig.TOM_6_BOMB_EXPLOSION_DAMAGE.get(), VehicleConfig.TOM_6_BOMB_EXPLOSION_RADIUS.get().floatValue(), 1.5f);
|
||||
ProjectileTool.causeCustomExplode(this, this.explosionDamage, this.explosionRadius, 1.5f);
|
||||
this.discard();
|
||||
}
|
||||
|
||||
|
@ -100,7 +102,7 @@ public class MelonBombEntity extends FastThrowableProjectile implements Destroya
|
|||
if (tickCount > 600 || this.entityData.get(HEALTH) <= 0) {
|
||||
this.discard();
|
||||
if (!this.level().isClientSide) {
|
||||
ProjectileTool.causeCustomExplode(this, VehicleConfig.TOM_6_BOMB_EXPLOSION_DAMAGE.get(), VehicleConfig.TOM_6_BOMB_EXPLOSION_RADIUS.get().floatValue(), 1.5f);
|
||||
ProjectileTool.causeCustomExplode(this, this.explosionDamage, this.explosionRadius, 1.5f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,16 +114,15 @@ public class MelonBombEntity extends FastThrowableProjectile implements Destroya
|
|||
|
||||
@Override
|
||||
public void setDamage(float damage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionDamage(float damage) {
|
||||
|
||||
this.explosionDamage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionRadius(float radius) {
|
||||
|
||||
this.explosionRadius = radius;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
|||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Mk82Entity.class, EntityDataSerializers.FLOAT);
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
||||
private float explosionDamage = ExplosionConfig.MK_82_EXPLOSION_DAMAGE.get();
|
||||
private float explosionRadius = ExplosionConfig.MK_82_EXPLOSION_RADIUS.get().floatValue();
|
||||
|
||||
public Mk82Entity(EntityType<? extends Mk82Entity> type, Level world) {
|
||||
super(type, world);
|
||||
this.noCulling = true;
|
||||
|
@ -47,7 +50,7 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
|||
|
||||
@Override
|
||||
protected @NotNull Item getDefaultItem() {
|
||||
return ModItems.JAVELIN_MISSILE.get();
|
||||
return ModItems.MEDIUM_AERIAL_BOMB.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -106,7 +109,7 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
|||
@Override
|
||||
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
||||
super.onHitBlock(blockHitResult);
|
||||
ProjectileTool.causeCustomExplode(this, ExplosionConfig.MK_82_EXPLOSION_DAMAGE.get(), ExplosionConfig.MK_82_EXPLOSION_RADIUS.get().floatValue(), 1.2f);
|
||||
ProjectileTool.causeCustomExplode(this, this.explosionDamage, this.explosionRadius, 1.2f);
|
||||
this.discard();
|
||||
}
|
||||
|
||||
|
@ -114,11 +117,9 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
|||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
// this.setDeltaMovement(this.getDeltaMovement().multiply(0.98, 0.98, 0.98));
|
||||
|
||||
if (tickCount > 600 || this.entityData.get(HEALTH) <= 0) {
|
||||
if (!this.level().isClientSide) {
|
||||
ProjectileTool.causeCustomExplode(this, ExplosionConfig.MK_82_EXPLOSION_DAMAGE.get(), ExplosionConfig.MK_82_EXPLOSION_RADIUS.get().floatValue(), 1.2f);
|
||||
ProjectileTool.causeCustomExplode(this, this.explosionDamage, this.explosionRadius, 1.2f);
|
||||
}
|
||||
this.discard();
|
||||
}
|
||||
|
@ -163,19 +164,17 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
|||
return true;
|
||||
}
|
||||
|
||||
// TODO setter
|
||||
@Override
|
||||
public void setDamage(float damage) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionDamage(float damage) {
|
||||
|
||||
this.explosionDamage = damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExplosionRadius(float radius) {
|
||||
|
||||
this.explosionRadius = radius;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,6 +201,8 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
|||
worldPosition = transformPosition(transform, 0, -0.2f, 0);
|
||||
|
||||
MelonBombEntity melonBomb = new MelonBombEntity(player, player.level());
|
||||
melonBomb.setExplosionDamage(VehicleConfig.TOM_6_BOMB_EXPLOSION_DAMAGE.get());
|
||||
melonBomb.setExplosionRadius(VehicleConfig.TOM_6_BOMB_EXPLOSION_RADIUS.get().floatValue());
|
||||
melonBomb.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
melonBomb.shoot(getDeltaMovement().x, getDeltaMovement().y, getDeltaMovement().z, (float) getDeltaMovement().length(), 0);
|
||||
passenger.level().addFreshEntity(melonBomb);
|
||||
|
|
Loading…
Add table
Reference in a new issue