补全配置
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<Float> HEALTH = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> TARGET_UUID = SynchedEntityData.defineId(Agm65Entity.class, EntityDataSerializers.STRING);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
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;
|
private boolean distracted = false;
|
||||||
|
|
||||||
public Agm65Entity(EntityType<? extends Agm65Entity> type, Level world) {
|
public Agm65Entity(EntityType<? extends Agm65Entity> type, Level world) {
|
||||||
|
@ -70,7 +74,7 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected @NotNull Item getDefaultItem() {
|
protected @NotNull Item getDefaultItem() {
|
||||||
return ModItems.JAVELIN_MISSILE.get();
|
return ModItems.AGM.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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) {
|
if (entity instanceof LivingEntity) {
|
||||||
entity.invulnerableTime = 0;
|
entity.invulnerableTime = 0;
|
||||||
|
@ -226,7 +230,7 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
ProjectileTool.causeCustomExplode(this,
|
ProjectileTool.causeCustomExplode(this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
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();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
@ -241,11 +245,11 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
|
||||||
this,
|
this,
|
||||||
this.getOwner()),
|
this.getOwner()),
|
||||||
ExplosionConfig.AGM_65_EXPLOSION_DAMAGE.get(),
|
this.explosionDamage,
|
||||||
this.getX(),
|
this.getX(),
|
||||||
this.getEyeY(),
|
this.getEyeY(),
|
||||||
this.getZ(),
|
this.getZ(),
|
||||||
ExplosionConfig.AGM_65_EXPLOSION_RADIUS.get().floatValue(),
|
this.explosionRadius,
|
||||||
ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP, true).
|
ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP, true).
|
||||||
setDamageMultiplier(1);
|
setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
|
@ -296,16 +300,16 @@ public class Agm65Entity extends FastThrowableProjectile implements GeoEntity, D
|
||||||
// TODO setter
|
// TODO setter
|
||||||
@Override
|
@Override
|
||||||
public void setDamage(float damage) {
|
public void setDamage(float damage) {
|
||||||
|
this.damage = damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExplosionDamage(float explosionDamage) {
|
public void setExplosionDamage(float explosionDamage) {
|
||||||
|
this.explosionDamage = explosionDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExplosionRadius(float radius) {
|
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 {
|
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 int fuse = 100;
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
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));
|
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.bounce(Direction.getNearest(this.getDeltaMovement().x(), this.getDeltaMovement().y(), this.getDeltaMovement().z()).getOpposite());
|
||||||
this.setDeltaMovement(this.getDeltaMovement().multiply(0.25, 1.0, 0.25));
|
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) {
|
if (this.fuse <= 0) {
|
||||||
this.discard();
|
this.discard();
|
||||||
if (!this.level().isClientSide) {
|
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;
|
return 0.07F;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO setter
|
|
||||||
@Override
|
@Override
|
||||||
public void setDamage(float damage) {
|
public void setDamage(float damage) {
|
||||||
|
this.damage = damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExplosionDamage(float explosionDamage) {
|
public void setExplosionDamage(float explosionDamage) {
|
||||||
|
this.explosionDamage = explosionDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExplosionRadius(float radius) {
|
public void setExplosionRadius(float radius) {
|
||||||
|
this.explosionRadius = radius;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.atsuishio.superbwarfare.entity.projectile;
|
package com.atsuishio.superbwarfare.entity.projectile;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.config.server.VehicleConfig;
|
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.tools.ProjectileTool;
|
import com.atsuishio.superbwarfare.tools.ProjectileTool;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
|
@ -19,10 +18,13 @@ import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.BlockHitResult;
|
import net.minecraft.world.phys.BlockHitResult;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
// TODO 配置文件
|
|
||||||
public class MelonBombEntity extends FastThrowableProjectile implements DestroyableProjectileEntity, AerialBombEntity {
|
public class MelonBombEntity extends FastThrowableProjectile implements DestroyableProjectileEntity, AerialBombEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(MelonBombEntity.class, EntityDataSerializers.FLOAT);
|
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) {
|
public MelonBombEntity(EntityType<? extends MelonBombEntity> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
this.noCulling = true;
|
this.noCulling = true;
|
||||||
|
@ -90,7 +92,7 @@ public class MelonBombEntity extends FastThrowableProjectile implements Destroya
|
||||||
@Override
|
@Override
|
||||||
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
||||||
super.onHitBlock(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();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +102,7 @@ public class MelonBombEntity extends FastThrowableProjectile implements Destroya
|
||||||
if (tickCount > 600 || this.entityData.get(HEALTH) <= 0) {
|
if (tickCount > 600 || this.entityData.get(HEALTH) <= 0) {
|
||||||
this.discard();
|
this.discard();
|
||||||
if (!this.level().isClientSide) {
|
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
|
@Override
|
||||||
public void setDamage(float damage) {
|
public void setDamage(float damage) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExplosionDamage(float damage) {
|
public void setExplosionDamage(float damage) {
|
||||||
|
this.explosionDamage = damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExplosionRadius(float radius) {
|
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);
|
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Mk82Entity.class, EntityDataSerializers.FLOAT);
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
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) {
|
public Mk82Entity(EntityType<? extends Mk82Entity> type, Level world) {
|
||||||
super(type, world);
|
super(type, world);
|
||||||
this.noCulling = true;
|
this.noCulling = true;
|
||||||
|
@ -47,7 +50,7 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected @NotNull Item getDefaultItem() {
|
protected @NotNull Item getDefaultItem() {
|
||||||
return ModItems.JAVELIN_MISSILE.get();
|
return ModItems.MEDIUM_AERIAL_BOMB.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -106,7 +109,7 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
||||||
@Override
|
@Override
|
||||||
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
public void onHitBlock(@NotNull BlockHitResult blockHitResult) {
|
||||||
super.onHitBlock(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();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -114,11 +117,9 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
// this.setDeltaMovement(this.getDeltaMovement().multiply(0.98, 0.98, 0.98));
|
|
||||||
|
|
||||||
if (tickCount > 600 || this.entityData.get(HEALTH) <= 0) {
|
if (tickCount > 600 || this.entityData.get(HEALTH) <= 0) {
|
||||||
if (!this.level().isClientSide) {
|
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();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
@ -163,19 +164,17 @@ public class Mk82Entity extends FastThrowableProjectile implements GeoEntity, De
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO setter
|
|
||||||
@Override
|
@Override
|
||||||
public void setDamage(float damage) {
|
public void setDamage(float damage) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExplosionDamage(float damage) {
|
public void setExplosionDamage(float damage) {
|
||||||
|
this.explosionDamage = damage;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setExplosionRadius(float radius) {
|
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);
|
worldPosition = transformPosition(transform, 0, -0.2f, 0);
|
||||||
|
|
||||||
MelonBombEntity melonBomb = new MelonBombEntity(player, player.level());
|
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.setPos(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||||
melonBomb.shoot(getDeltaMovement().x, getDeltaMovement().y, getDeltaMovement().z, (float) getDeltaMovement().length(), 0);
|
melonBomb.shoot(getDeltaMovement().x, getDeltaMovement().y, getDeltaMovement().z, (float) getDeltaMovement().length(), 0);
|
||||||
passenger.level().addFreshEntity(melonBomb);
|
passenger.level().addFreshEntity(melonBomb);
|
||||||
|
|
Loading…
Add table
Reference in a new issue