diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java index bdc24e9b3..a627221cd 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/KillMessageOverlay.java @@ -321,7 +321,7 @@ public class KillMessageOverlay { icon = BURN; } else if (record.damageType == ModDamageTypes.DRONE_HIT) { icon = DRONE; - } else if (record.damageType == ModDamageTypes.LASER || record.damageType == ModDamageTypes.LASER_HEADSHOT) { + } else if (record.damageType == ModDamageTypes.LASER || record.damageType == ModDamageTypes.LASER_HEADSHOT || record.damageType == ModDamageTypes.LASER_STATIC) { icon = LASER; } else if (record.damageType == ModDamageTypes.VEHICLE_STRIKE) { icon = VEHICLE; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java index e94af8f69..b9d1ef209 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/LaserTowerEntity.java @@ -6,6 +6,7 @@ import com.atsuishio.superbwarfare.tools.CustomExplosion; import com.atsuishio.superbwarfare.tools.EntityFindUtil; import com.atsuishio.superbwarfare.tools.ParticleTool; import com.atsuishio.superbwarfare.tools.VectorTool; +import net.minecraft.core.particles.ParticleTypes; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.game.ClientGamePacketListener; @@ -287,10 +288,12 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity, this.setRot(this.getYRot(), this.getXRot()); if (this.entityData.get(COOL_DOWN) == 0 && VectorTool.calculateAngle(getViewVector(1), targetVec) < 1) { - if (level() instanceof ServerLevel) { - this.level().playSound(this, getOnPos(), ModSounds.CHARGE_RIFLE_FIRE_BOOM_3P.get(), SoundSource.PLAYERS, 2, 1); + if (level() instanceof ServerLevel serverLevel) { + this.level().playSound(this, getOnPos(), ModSounds.LASER_TOWER_SHOOT.get(), SoundSource.PLAYERS, 2, 1); + sendParticle(serverLevel, ParticleTypes.END_ROD, naerestEntity.getX(), naerestEntity.getEyeY(), naerestEntity.getZ(), 12, 0, 0, 0, 0.05, true); + sendParticle(serverLevel, ParticleTypes.LAVA, naerestEntity.getX(), naerestEntity.getEyeY(), naerestEntity.getZ(), 4, 0, 0, 0, 0.15, true); } - naerestEntity.hurt(ModDamageTypes.causeLaserDamage(this.level().registryAccess(), getOwner(), getOwner()), (float) 25); + naerestEntity.hurt(ModDamageTypes.causeLaserStaticDamage(this.level().registryAccess(), getOwner(), getOwner()), (float) 25); naerestEntity.invulnerableTime = 0; entityData.set(LASER_LENGTH, distanceTo(naerestEntity)); this.entityData.set(COOL_DOWN, 20); diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index 64c3191dc..0780a700f 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -765,7 +765,7 @@ public class LivingEventHandler { return; } - if (stack.is(ModTags.Items.GUN) && PerkHelper.getItemPerkLevel(ModPerks.POWERFUL_ATTRACTION.get(), stack) > 0) { + if (stack.is(ModTags.Items.GUN) && PerkHelper.getItemPerkLevel(ModPerks.POWERFUL_ATTRACTION.get(), stack) > 0 && (DamageTypeTool.isGunDamage(source) || DamageTypeTool.isExplosionDamage(source))) { var drops = event.getDrops(); drops.forEach(itemEntity -> { ItemStack item = itemEntity.getItem(); diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModDamageTypes.java b/src/main/java/com/atsuishio/superbwarfare/init/ModDamageTypes.java index 38ec98115..e7c115d0a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModDamageTypes.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModDamageTypes.java @@ -30,6 +30,7 @@ public class ModDamageTypes { public static final ResourceKey DRONE_HIT = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("drone_hit")); public static final ResourceKey LASER = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("laser")); public static final ResourceKey LASER_HEADSHOT = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("laser_headshot")); + public static final ResourceKey LASER_STATIC = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("laser_static")); public static final ResourceKey VEHICLE_STRIKE = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("vehicle_strike")); public static final ResourceKey AIR_CRASH = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("air_crash")); public static final ResourceKey LUNGE_MINE = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("lunge_mine")); @@ -83,6 +84,10 @@ public class ModDamageTypes { return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(LASER), directEntity, attacker); } + public static DamageSource causeLaserStaticDamage(RegistryAccess registryAccess, @Nullable Entity directEntity, @Nullable Entity attacker) { + return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(LASER_STATIC), directEntity, attacker); + } + public static DamageSource causeLaserHeadshotDamage(RegistryAccess registryAccess, @Nullable Entity directEntity, @Nullable Entity attacker) { return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(LASER_HEADSHOT), directEntity, attacker); } diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java b/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java index 80ae7b2d6..81d60a612 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModSounds.java @@ -413,5 +413,6 @@ public class ModSounds { public static final RegistryObject BMP_MISSILE_RELOAD = REGISTRY.register("bmp_missile_reload", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("bmp_missile_reload"))); public static final RegistryObject BMP_STEP = REGISTRY.register("bmp_step", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("bmp_step"))); public static final RegistryObject WHEEL_STEP = REGISTRY.register("wheel_step", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("wheel_step"))); + public static final RegistryObject LASER_TOWER_SHOOT = REGISTRY.register("laser_tower_shoot", () -> SoundEvent.createVariableRangeEvent(ModUtils.loc("laser_tower_shoot"))); } diff --git a/src/main/java/com/atsuishio/superbwarfare/tools/DamageTypeTool.java b/src/main/java/com/atsuishio/superbwarfare/tools/DamageTypeTool.java index 3dc92fd01..7c44eaae4 100644 --- a/src/main/java/com/atsuishio/superbwarfare/tools/DamageTypeTool.java +++ b/src/main/java/com/atsuishio/superbwarfare/tools/DamageTypeTool.java @@ -19,6 +19,10 @@ public class DamageTypeTool { || damageType == ModDamageTypes.GUN_FIRE_ABSOLUTE || damageType == ModDamageTypes.GUN_FIRE_HEADSHOT_ABSOLUTE; } + public static boolean isExplosionDamage(DamageSource source) { + return source.is(ModDamageTypes.CUSTOM_EXPLOSION) || source.is(ModDamageTypes.PROJECTILE_BOOM); + } + public static boolean isHeadshotDamage(DamageSource source) { return source.is(ModDamageTypes.GUN_FIRE_HEADSHOT) || source.is(ModDamageTypes.GUN_FIRE_HEADSHOT_ABSOLUTE); } diff --git a/src/main/resources/assets/superbwarfare/sounds.json b/src/main/resources/assets/superbwarfare/sounds.json index b1fca0b3b..fa57f9e97 100644 --- a/src/main/resources/assets/superbwarfare/sounds.json +++ b/src/main/resources/assets/superbwarfare/sounds.json @@ -2835,5 +2835,13 @@ "stream": false } ] + }, + "laser_tower_shoot": { + "sounds": [ + { + "name": "superbwarfare:laser_tower_shoot", + "stream": false + } + ] } } \ No newline at end of file diff --git a/src/main/resources/assets/superbwarfare/sounds/laser_tower_shoot.ogg b/src/main/resources/assets/superbwarfare/sounds/laser_tower_shoot.ogg new file mode 100644 index 000000000..6ad27d07a Binary files /dev/null and b/src/main/resources/assets/superbwarfare/sounds/laser_tower_shoot.ogg differ diff --git a/src/main/resources/data/minecraft/tags/damage_type/always_hurts_ender_dragons.json b/src/main/resources/data/minecraft/tags/damage_type/always_hurts_ender_dragons.json index 57f2a1f9d..6a139e606 100644 --- a/src/main/resources/data/minecraft/tags/damage_type/always_hurts_ender_dragons.json +++ b/src/main/resources/data/minecraft/tags/damage_type/always_hurts_ender_dragons.json @@ -5,6 +5,7 @@ "superbwarfare:custom_explosion", "superbwarfare:cannon_fire", "superbwarfare:laser", - "superbwarfare:laser_headshot" + "superbwarfare:laser_headshot", + "superbwarfare:laser_static" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json b/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json index 919981b91..a27494e02 100644 --- a/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json +++ b/src/main/resources/data/minecraft/tags/damage_type/bypasses_armor.json @@ -9,6 +9,7 @@ "superbwarfare:laser_headshot", "superbwarfare:vehicle_strike", "superbwarfare:vehicle_explosion", - "superbwarfare:air_crash" + "superbwarfare:air_crash", + "superbwarfare:laser_static" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/damage_type/bypasses_effects.json b/src/main/resources/data/minecraft/tags/damage_type/bypasses_effects.json index ae10d3fe0..408df7e44 100644 --- a/src/main/resources/data/minecraft/tags/damage_type/bypasses_effects.json +++ b/src/main/resources/data/minecraft/tags/damage_type/bypasses_effects.json @@ -9,6 +9,7 @@ "superbwarfare:laser_headshot", "superbwarfare:vehicle_strike", "superbwarfare:air_crash", - "superbwarfare:vehicle_explosion" + "superbwarfare:vehicle_explosion", + "superbwarfare:laser_static" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/damage_type/bypasses_enchantments.json b/src/main/resources/data/minecraft/tags/damage_type/bypasses_enchantments.json index ae10d3fe0..408df7e44 100644 --- a/src/main/resources/data/minecraft/tags/damage_type/bypasses_enchantments.json +++ b/src/main/resources/data/minecraft/tags/damage_type/bypasses_enchantments.json @@ -9,6 +9,7 @@ "superbwarfare:laser_headshot", "superbwarfare:vehicle_strike", "superbwarfare:air_crash", - "superbwarfare:vehicle_explosion" + "superbwarfare:vehicle_explosion", + "superbwarfare:laser_static" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/damage_type/bypasses_resistance.json b/src/main/resources/data/minecraft/tags/damage_type/bypasses_resistance.json index ae10d3fe0..408df7e44 100644 --- a/src/main/resources/data/minecraft/tags/damage_type/bypasses_resistance.json +++ b/src/main/resources/data/minecraft/tags/damage_type/bypasses_resistance.json @@ -9,6 +9,7 @@ "superbwarfare:laser_headshot", "superbwarfare:vehicle_strike", "superbwarfare:air_crash", - "superbwarfare:vehicle_explosion" + "superbwarfare:vehicle_explosion", + "superbwarfare:laser_static" ] } \ No newline at end of file diff --git a/src/main/resources/data/minecraft/tags/damage_type/no_knockback.json b/src/main/resources/data/minecraft/tags/damage_type/no_knockback.json index 169f45a5a..d8424febb 100644 --- a/src/main/resources/data/minecraft/tags/damage_type/no_knockback.json +++ b/src/main/resources/data/minecraft/tags/damage_type/no_knockback.json @@ -4,6 +4,7 @@ "superbwarfare:projectile_boom", "superbwarfare:custom_explosion", "superbwarfare:laser", - "superbwarfare:laser_headshot" + "superbwarfare:laser_headshot", + "superbwarfare:laser_static" ] } \ No newline at end of file diff --git a/src/main/resources/data/superbwarfare/damage_type/laser_static.json b/src/main/resources/data/superbwarfare/damage_type/laser_static.json new file mode 100644 index 000000000..27bf8b5cb --- /dev/null +++ b/src/main/resources/data/superbwarfare/damage_type/laser_static.json @@ -0,0 +1,5 @@ +{ + "exhaustion": 0, + "message_id": "laser", + "scaling": "never" +} \ No newline at end of file