优化爆炸,调整药水炮弹效果云,削弱SVD爆头倍率
This commit is contained in:
parent
dc8b74f804
commit
0940186599
7 changed files with 39 additions and 76 deletions
|
@ -241,7 +241,7 @@ public class MortarShellEntity extends ThrowableItemProjectile implements GeoEnt
|
|||
private void createAreaCloud(Level level) {
|
||||
if (this.potion == Potions.EMPTY) return;
|
||||
|
||||
AreaEffectCloud cloud = new AreaEffectCloud(level, this.getX(), this.getY(), this.getZ());
|
||||
AreaEffectCloud cloud = new AreaEffectCloud(level, this.getX() + 0.75 * getDeltaMovement().x, this.getY() + 0.5 * getBbHeight() + 0.75 * getDeltaMovement().y, this.getZ() + 0.75 * getDeltaMovement().z);
|
||||
cloud.setPotion(this.potion);
|
||||
cloud.setDuration((int) this.damage);
|
||||
cloud.setRadius(this.radius);
|
||||
|
|
|
@ -3,12 +3,10 @@ package com.atsuishio.superbwarfare.entity.projectile;
|
|||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.entity.vehicle.DroneEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
|
||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||
import com.atsuishio.superbwarfare.tools.ProjectileTool;
|
||||
import net.minecraft.core.BlockPos;
|
||||
|
@ -19,13 +17,11 @@ import net.minecraft.server.level.ServerLevel;
|
|||
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.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.BellBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -41,8 +37,6 @@ import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache
|
|||
import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RgoGrenadeEntity extends ThrowableItemProjectile implements GeoEntity {
|
||||
private int fuse = 80;
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
@ -78,46 +72,36 @@ public class RgoGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
|
|||
|
||||
@Override
|
||||
protected void onHit(HitResult result) {
|
||||
switch (result.getType()) {
|
||||
case BLOCK:
|
||||
BlockHitResult blockResult = (BlockHitResult) result;
|
||||
BlockPos resultPos = blockResult.getBlockPos();
|
||||
BlockState state = this.level().getBlockState(resultPos);
|
||||
if (state.getBlock() instanceof BellBlock bell) {
|
||||
bell.attemptToRing(this.level(), resultPos, blockResult.getDirection());
|
||||
}
|
||||
ProjectileTool.causeCustomExplode(this, ExplosionConfig.RGO_GRENADE_EXPLOSION_DAMAGE.get(), ExplosionConfig.RGO_GRENADE_EXPLOSION_RADIUS.get(), 1.2f);
|
||||
|
||||
break;
|
||||
case ENTITY:
|
||||
EntityHitResult entityResult = (EntityHitResult) result;
|
||||
Entity entity = entityResult.getEntity();
|
||||
if (this.getOwner() instanceof LivingEntity living) {
|
||||
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
||||
living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1);
|
||||
|
||||
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new ClientIndicatorMessage(0, 5));
|
||||
if (level() instanceof ServerLevel) {
|
||||
switch (result.getType()) {
|
||||
case BLOCK:
|
||||
BlockHitResult blockResult = (BlockHitResult) result;
|
||||
BlockPos resultPos = blockResult.getBlockPos();
|
||||
BlockState state = this.level().getBlockState(resultPos);
|
||||
if (state.getBlock() instanceof BellBlock bell) {
|
||||
bell.attemptToRing(this.level(), resultPos, blockResult.getDirection());
|
||||
}
|
||||
}
|
||||
if (!(entity instanceof DroneEntity)) {
|
||||
causeRgoExplode(this,
|
||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
||||
entity, ExplosionConfig.RGO_GRENADE_EXPLOSION_DAMAGE.get(), ExplosionConfig.RGO_GRENADE_EXPLOSION_RADIUS.get(), 1.2f);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ProjectileTool.causeCustomExplode(this, ExplosionConfig.RGO_GRENADE_EXPLOSION_DAMAGE.get(), ExplosionConfig.RGO_GRENADE_EXPLOSION_RADIUS.get(), 1.2f);
|
||||
|
||||
public static void causeRgoExplode(ThrowableItemProjectile projectile, @Nullable DamageSource source, Entity entity, float damage, float radius, float damageMultiplier) {
|
||||
CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile, source, damage,
|
||||
projectile.getX(), projectile.getY(), projectile.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(damageMultiplier);
|
||||
explosion.explode();
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
ParticleTool.spawnMediumExplosionParticles(projectile.level(), projectile.position());
|
||||
projectile.discard();
|
||||
break;
|
||||
case ENTITY:
|
||||
EntityHitResult entityResult = (EntityHitResult) result;
|
||||
Entity entity = entityResult.getEntity();
|
||||
if (this.getOwner() instanceof LivingEntity living) {
|
||||
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
|
||||
living.level().playSound(null, living.blockPosition(), ModSounds.INDICATION.get(), SoundSource.VOICE, 1, 1);
|
||||
|
||||
ModUtils.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> player), new ClientIndicatorMessage(0, 5));
|
||||
}
|
||||
}
|
||||
if (!(entity instanceof DroneEntity)) {
|
||||
ProjectileTool.causeCustomExplode(this, ExplosionConfig.RGO_GRENADE_EXPLOSION_DAMAGE.get(), ExplosionConfig.RGO_GRENADE_EXPLOSION_RADIUS.get(), 1.2f);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,15 +1,14 @@
|
|||
package com.atsuishio.superbwarfare.entity.projectile;
|
||||
|
||||
import com.atsuishio.superbwarfare.ModUtils;
|
||||
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
|
||||
import com.atsuishio.superbwarfare.entity.AnimatedEntity;
|
||||
import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||
import com.atsuishio.superbwarfare.init.ModItems;
|
||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
|
||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||
import com.atsuishio.superbwarfare.tools.ProjectileTool;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.network.protocol.Packet;
|
||||
|
@ -20,14 +19,12 @@ import net.minecraft.network.syncher.SynchedEntityData;
|
|||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.Explosion;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.BellBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -45,8 +42,6 @@ import software.bernie.geckolib.core.animation.RawAnimation;
|
|||
import software.bernie.geckolib.core.object.PlayState;
|
||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
public class RpgRocketEntity extends ThrowableItemProjectile implements GeoEntity, AnimatedEntity {
|
||||
public static final EntityDataAccessor<String> ANIMATION = SynchedEntityData.defineId(RpgRocketEntity.class, EntityDataSerializers.STRING);
|
||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||
|
@ -118,9 +113,7 @@ public class RpgRocketEntity extends ThrowableItemProjectile implements GeoEntit
|
|||
|
||||
if (this.tickCount > 1) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
causeRpgExplode(this,
|
||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
||||
entity, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
|
||||
ProjectileTool.causeCustomExplode(this, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,9 +132,7 @@ public class RpgRocketEntity extends ThrowableItemProjectile implements GeoEntit
|
|||
|
||||
if (this.tickCount > 1) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
causeRpgExplode(this,
|
||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
||||
this, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
|
||||
ProjectileTool.causeCustomExplode(this, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -168,24 +159,12 @@ public class RpgRocketEntity extends ThrowableItemProjectile implements GeoEntit
|
|||
|
||||
if (this.tickCount > 100 || this.isInWater()) {
|
||||
if (this.level() instanceof ServerLevel) {
|
||||
causeRpgExplode(this,
|
||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
||||
this, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
|
||||
ProjectileTool.causeCustomExplode(this, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
|
||||
}
|
||||
this.discard();
|
||||
}
|
||||
}
|
||||
|
||||
public static void causeRpgExplode(ThrowableItemProjectile projectile, @Nullable DamageSource source, Entity target, float damage, float radius, float damageMultiplier) {
|
||||
CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile, source, damage,
|
||||
projectile.getX(), projectile.getY(), projectile.getZ(), radius, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(damageMultiplier);
|
||||
explosion.explode();
|
||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
ParticleTool.spawnHugeExplosionParticles(projectile.level(), projectile.position());
|
||||
projectile.discard();
|
||||
}
|
||||
|
||||
private PlayState movementPredicate(AnimationState<RpgRocketEntity> event) {
|
||||
return event.setAndContinue(RawAnimation.begin().thenLoop("animation.rpg.idle"));
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ public class VehicleEntity extends Entity {
|
|||
|
||||
// 显示火花粒子效果
|
||||
if (this.sendFireStarParticleOnHurt() && this.level() instanceof ServerLevel serverLevel) {
|
||||
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() + 0.5 * getBbHeight(), this.getZ(), 2, 0.4, 0.4, 0.4, 0.2, false);
|
||||
}
|
||||
// 播放受击音效
|
||||
if (this.playHitSoundOnHurt()) {
|
||||
|
|
|
@ -21,11 +21,11 @@ public class ProjectileTool {
|
|||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion);
|
||||
explosion.finalizeExplosion(false);
|
||||
if (radius <= 5) {
|
||||
ParticleTool.spawnSmallExplosionParticles(projectile.level(), projectile.position());
|
||||
ParticleTool.spawnSmallExplosionParticles(projectile.level(), projectile.position().add(projectile.getDeltaMovement().scale(0.5)));
|
||||
} else if (radius > 5 && radius < 10) {
|
||||
ParticleTool.spawnMediumExplosionParticles(projectile.level(), projectile.position());
|
||||
ParticleTool.spawnMediumExplosionParticles(projectile.level(), projectile.position().add(projectile.getDeltaMovement().scale(0.5)));
|
||||
} else {
|
||||
ParticleTool.spawnHugeExplosionParticles(projectile.level(), projectile.position());
|
||||
ParticleTool.spawnHugeExplosionParticles(projectile.level(), projectile.position().add(projectile.getDeltaMovement().scale(0.5)));
|
||||
}
|
||||
|
||||
projectile.discard();
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
"RecoilY": 0.018,
|
||||
"Damage": 270,
|
||||
"ExplosionDamage": 130,
|
||||
"ExplosionRadius": 7,
|
||||
"ExplosionRadius": 10,
|
||||
"Velocity": 4,
|
||||
"Magazine": 1,
|
||||
"Weight": 7,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"RecoilX": 0.004,
|
||||
"RecoilY": 0.009,
|
||||
"Damage": 18,
|
||||
"Headshot": 3,
|
||||
"Headshot": 2.5,
|
||||
"Velocity": 42,
|
||||
"Magazine": 10,
|
||||
"Weight": 5,
|
||||
|
|
Loading…
Add table
Reference in a new issue