diff --git a/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java index 8c568466d..6a5c4ae5c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java +++ b/src/main/java/com/atsuishio/superbwarfare/config/server/VehicleConfig.java @@ -63,10 +63,10 @@ public class VehicleConfig { builder.push("mk_42"); builder.comment("The HealthPoint of MK-42"); - MK42_HP = builder.defineInRange("mk_42_hp", 200, 1, 10000000); + MK42_HP = builder.defineInRange("mk_42_hp", 350, 1, 10000000); builder.comment("The AP shell damage of MK-42"); - MK42_AP_DAMAGE = builder.defineInRange("mk_42_ap_damage", 300, 1, 10000000); + MK42_AP_DAMAGE = builder.defineInRange("mk_42_ap_damage", 450, 1, 10000000); builder.comment("The AP shell explosion damage of MK-42"); MK42_AP_EXPLOSION_DAMAGE = builder.defineInRange("mk_42_ap_explosion_damage", 120, 1, 10000000); @@ -88,10 +88,10 @@ public class VehicleConfig { builder.push("mle_1934"); builder.comment("The HealthPoint of MLE-1934"); - MLE1934_HP = builder.defineInRange("mle_1934_hp", 200, 1, 10000000); + MLE1934_HP = builder.defineInRange("mle_1934_hp", 350, 1, 10000000); builder.comment("The AP shell damage of MLE-1934"); - MLE1934_AP_DAMAGE = builder.defineInRange("mle_1934_ap_damage", 350, 1, 10000000); + MLE1934_AP_DAMAGE = builder.defineInRange("mle_1934_ap_damage", 500, 1, 10000000); builder.comment("The AP shell explosion damage of MLE-1934"); MLE1934_AP_EXPLOSION_DAMAGE = builder.defineInRange("mle_1934_ap_explosion_damage", 150, 1, 10000000); @@ -113,7 +113,7 @@ public class VehicleConfig { builder.push("annihilator"); builder.comment("The HealthPoint of Annihilator"); - ANNIHILATOR_HP = builder.defineInRange("annihilator_hp", 800, 1, 10000000); + ANNIHILATOR_HP = builder.defineInRange("annihilator_hp", 1200, 1, 10000000); builder.comment("The energy cost of Annihilator per shoot"); ANNIHILATOR_SHOOT_COST = builder.defineInRange("annihilator_shoot_cost", 2000000, 0, 2147483647); @@ -201,10 +201,10 @@ public class VehicleConfig { TOM_6_MAX_ENERGY = builder.defineInRange("tom_6_max_energy", 160000, 0, 2147483647); builder.comment("The Melon Bomb explosion damage of Tom_6"); - TOM_6_BOMB_EXPLOSION_DAMAGE = builder.defineInRange("tom_6_bomb_explosion_damage", 1000, 1, 10000000); + TOM_6_BOMB_EXPLOSION_DAMAGE = builder.defineInRange("tom_6_bomb_explosion_damage", 500, 1, 10000000); builder.comment("The Melon Bomb explosion radius of Tom_6"); - TOM_6_BOMB_EXPLOSION_RADIUS = builder.defineInRange("tom_6_bomb_explosion_radius", 16d, 1d, 10000000d); + TOM_6_BOMB_EXPLOSION_RADIUS = builder.defineInRange("tom_6_bomb_explosion_radius", 10d, 1d, 10000000d); builder.pop(); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java index 4eff8e0c4..b9f259edd 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java @@ -294,9 +294,9 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt this, this.getOwner()), explosionDamage, - result.getLocation().x, - result.getLocation().y, - result.getLocation().z, + this.getX(), + this.getEyeY(), + this.getZ(), radius, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP). setDamageMultiplier(1).setFireTime(fireTime); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/HeliRocketEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/HeliRocketEntity.java index 4c68395fa..80ca3bfb6 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/HeliRocketEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/HeliRocketEntity.java @@ -150,7 +150,7 @@ public class HeliRocketEntity extends ThrowableItemProjectile implements GeoEnti public static void causeRocketExplode(ThrowableItemProjectile projectile, @Nullable DamageSource source, Entity target, float damage, float radius, float damageMultiplier) { CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile, source, damage, - target.getX(), target.getY(), target.getZ(), radius, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(damageMultiplier); + projectile.getX(), projectile.getY(), projectile.getZ(), radius, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(damageMultiplier); explosion.explode(); net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion); explosion.finalizeExplosion(false); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java index 4b5ba6ef1..0af92f5b6 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/AnnihilatorEntity.java @@ -3,10 +3,7 @@ package com.atsuishio.superbwarfare.entity.vehicle; import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; import com.atsuishio.superbwarfare.config.server.VehicleConfig; -import com.atsuishio.superbwarfare.init.ModDamageTypes; -import com.atsuishio.superbwarfare.init.ModEntities; -import com.atsuishio.superbwarfare.init.ModParticleTypes; -import com.atsuishio.superbwarfare.init.ModSounds; +import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.network.message.ShakeClientMessage; import com.atsuishio.superbwarfare.tools.*; import net.minecraft.ChatFormatting; @@ -24,6 +21,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.LivingEntity; @@ -52,6 +50,8 @@ import software.bernie.geckolib.util.GeckoLibUtil; import java.util.Comparator; import java.util.List; +import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; + public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, ICannonEntity { public static final EntityDataAccessor COOL_DOWN = SynchedEntityData.defineId(AnnihilatorEntity.class, EntityDataSerializers.INT); @@ -120,25 +120,61 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, public boolean hurt(DamageSource source, float amount) { super.hurt(source, amount); if (this.level() instanceof ServerLevel serverLevel) { - ParticleTool.sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false); + sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false); } - if (source.is(ModDamageTypes.PROJECTILE_BOOM)) { + if (source.is(DamageTypes.ARROW)) { + amount *= 0f; + } + if (source.is(DamageTypes.TRIDENT)) { + amount *= 0f; + } + if (source.is(DamageTypes.MOB_ATTACK)) { + amount *= 0f; + } + if (source.is(DamageTypes.MOB_ATTACK_NO_AGGRO)) { + amount *= 0f; + } + if (source.is(DamageTypes.MOB_PROJECTILE)) { + amount *= 0f; + } + if (source.is(DamageTypes.PLAYER_ATTACK)) { + amount *= 0f; + } + if (source.is(DamageTypes.EXPLOSION)) { amount *= 0.5f; } - if (source.is(ModDamageTypes.CANNON_FIRE)) { - amount *= 1.4f; + if (source.is(DamageTypes.PLAYER_EXPLOSION)) { + amount *= 0.5f; } - if (source.is(ModDamageTypes.GUN_FIRE)) { - amount = 0; + + if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) { + amount *= 0.2f; } - if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) { + if (source.is(ModDamageTypes.PROJECTILE_BOOM)) { + amount *= 0.2f; + } + if (source.is(ModDamageTypes.MINE)) { amount *= 0.1f; } + if (source.is(ModDamageTypes.LUNGE_MINE)) { + amount *= 0.1f; + } + if (source.is(ModDamageTypes.CANNON_FIRE)) { + amount *= 0.2f; + } + if (source.is(ModTags.DamageTypes.PROJECTILE)) { + amount *= 0f; + } + if (source.is(ModTags.DamageTypes.PROJECTILE_ABSOLUTE)) { + amount *= 0.15f; + } + if (source.is(ModDamageTypes.VEHICLE_STRIKE)) { + amount *= 0f; + } this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1); - this.hurt(0.5f * Math.max(amount - 40, 0)); - + this.hurt(Math.max(amount - 16, 0)); return true; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java index 5dedd1ebf..eadb124b2 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mk42Entity.java @@ -26,6 +26,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -49,6 +50,8 @@ import software.bernie.geckolib.util.GeckoLibUtil; import java.util.Comparator; import java.util.List; +import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; + public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntity { public static final EntityDataAccessor COOL_DOWN = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT); @@ -104,24 +107,66 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntit public boolean hurt(DamageSource source, float amount) { super.hurt(source, amount); if (this.level() instanceof ServerLevel serverLevel) { - ParticleTool.sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false); + sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false); } - if (source.is(ModDamageTypes.PROJECTILE_BOOM)) { - amount *= 0.5f; - } - if (source.is(ModDamageTypes.CANNON_FIRE)) { - amount *= 1.4f; - } - if (source.is(ModDamageTypes.GUN_FIRE)) { + if (source.is(DamageTypes.ARROW)) { amount *= 0.1f; } - if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) { - amount *= 0.5f; + if (source.is(DamageTypes.TRIDENT)) { + amount *= 0.1f; + } + if (source.is(DamageTypes.MOB_ATTACK)) { + amount *= 0.3f; + } + if (source.is(DamageTypes.MOB_ATTACK_NO_AGGRO)) { + amount *= 0.15f; + } + if (source.is(DamageTypes.MOB_PROJECTILE)) { + amount *= 0.15f; + } + if (source.is(DamageTypes.PLAYER_ATTACK)) { + amount *= 0.1f; + + } + if (source.is(DamageTypes.LAVA)) { + amount *= 2.5f; + } + if (source.is(DamageTypes.EXPLOSION)) { + amount *= 2f; + } + + if (source.is(DamageTypes.PLAYER_EXPLOSION)) { + amount *= 2f; + } + + if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) { + amount *= 0.4f; + } + if (source.is(ModDamageTypes.PROJECTILE_BOOM)) { + amount *= 0.4f; + } + if (source.is(ModDamageTypes.MINE)) { + amount *= 0.14f; + } + if (source.is(ModDamageTypes.LUNGE_MINE)) { + amount *= 0.14f; + } + if (source.is(ModDamageTypes.CANNON_FIRE)) { + amount *= 0.3f; + } + if (source.is(ModTags.DamageTypes.PROJECTILE)) { + amount *= 0.02f; + } + if (source.is(ModTags.DamageTypes.PROJECTILE_ABSOLUTE)) { + amount *= 0.14f; + } + if (source.is(ModDamageTypes.VEHICLE_STRIKE)) { + amount *= 1.7f; } this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1); - this.hurt(0.5f * Math.max(amount - 5, 0)); + this.hurt(Math.max(amount - 8, 0)); return true; } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java index 1ed441df0..60c6226b2 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Mle1934Entity.java @@ -23,6 +23,7 @@ import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundSource; import net.minecraft.util.Mth; import net.minecraft.world.damagesource.DamageSource; +import net.minecraft.world.damagesource.DamageTypes; import net.minecraft.world.entity.*; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.ItemStack; @@ -47,6 +48,8 @@ import software.bernie.geckolib.util.GeckoLibUtil; import java.util.Comparator; import java.util.List; +import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle; + public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEntity { public static final EntityDataAccessor COOL_DOWN = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.INT); @@ -111,24 +114,66 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn public boolean hurt(DamageSource source, float amount) { super.hurt(source, amount); if (this.level() instanceof ServerLevel serverLevel) { - ParticleTool.sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false); + sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 2.5, this.getZ(), 4, 0.2, 0.2, 0.2, 0.2, false); } - if (source.is(ModDamageTypes.PROJECTILE_BOOM)) { - amount *= 0.5f; - } - if (source.is(ModDamageTypes.CANNON_FIRE)) { - amount *= 1.4f; - } - if (source.is(ModDamageTypes.GUN_FIRE)) { + if (source.is(DamageTypes.ARROW)) { amount *= 0.1f; } - if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) { - amount *= 0.5f; + if (source.is(DamageTypes.TRIDENT)) { + amount *= 0.1f; + } + if (source.is(DamageTypes.MOB_ATTACK)) { + amount *= 0.3f; + } + if (source.is(DamageTypes.MOB_ATTACK_NO_AGGRO)) { + amount *= 0.15f; + } + if (source.is(DamageTypes.MOB_PROJECTILE)) { + amount *= 0.15f; + } + if (source.is(DamageTypes.PLAYER_ATTACK)) { + amount *= 0.1f; + + } + if (source.is(DamageTypes.LAVA)) { + amount *= 2.5f; + } + if (source.is(DamageTypes.EXPLOSION)) { + amount *= 2f; + } + + if (source.is(DamageTypes.PLAYER_EXPLOSION)) { + amount *= 2f; + } + + if (source.is(ModDamageTypes.CUSTOM_EXPLOSION)) { + amount *= 0.4f; + } + if (source.is(ModDamageTypes.PROJECTILE_BOOM)) { + amount *= 0.4f; + } + if (source.is(ModDamageTypes.MINE)) { + amount *= 0.14f; + } + if (source.is(ModDamageTypes.LUNGE_MINE)) { + amount *= 0.14f; + } + if (source.is(ModDamageTypes.CANNON_FIRE)) { + amount *= 0.3f; + } + if (source.is(ModTags.DamageTypes.PROJECTILE)) { + amount *= 0.02f; + } + if (source.is(ModTags.DamageTypes.PROJECTILE_ABSOLUTE)) { + amount *= 0.14f; + } + if (source.is(ModDamageTypes.VEHICLE_STRIKE)) { + amount *= 1.7f; } this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1); - this.hurt(0.5f * Math.max(amount - 5, 0)); + this.hurt(Math.max(amount - 8, 0)); return true; }