调整手雷的伤害和碰撞音效

This commit is contained in:
Atsuihsio 2024-07-30 03:30:11 +08:00
parent 151fbc2446
commit a5443ca9ac
2 changed files with 3 additions and 3 deletions

View file

@ -65,7 +65,7 @@ public class HandGrenadeEntity extends ThrowableItemProjectile {
BlockHitResult blockResult = (BlockHitResult) result; BlockHitResult blockResult = (BlockHitResult) result;
BlockPos resultPos = blockResult.getBlockPos(); BlockPos resultPos = blockResult.getBlockPos();
BlockState state = this.level().getBlockState(resultPos); BlockState state = this.level().getBlockState(resultPos);
SoundEvent event = state.getBlock().getSoundType(state, this.level(), resultPos, this).getStepSound(); SoundEvent event = state.getBlock().getSoundType(state, this.level(), resultPos, this).getBreakSound();
double speed = this.getDeltaMovement().length(); double speed = this.getDeltaMovement().length();
if (speed > 0.1) { if (speed > 0.1) {
this.level().playSound(null, result.getLocation().x, result.getLocation().y, result.getLocation().z, event, SoundSource.AMBIENT, 1.0F, 1.0F); this.level().playSound(null, result.getLocation().x, result.getLocation().y, result.getLocation().z, event, SoundSource.AMBIENT, 1.0F, 1.0F);
@ -127,7 +127,7 @@ public class HandGrenadeEntity extends ThrowableItemProjectile {
private void causeExplode() { private void causeExplode() {
CustomExplosion explosion = new CustomExplosion(this.level(), this, CustomExplosion explosion = new CustomExplosion(this.level(), this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 90, ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), 90,
this.getX(), this.getY(), this.getZ(), 6.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(2); this.getX(), this.getY(), this.getZ(), 6.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f);
explosion.explode(); explosion.explode();
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion); net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
explosion.finalizeExplosion(false); explosion.finalizeExplosion(false);

View file

@ -69,7 +69,7 @@ public class HandGrenade extends Item {
if (!pLevel.isClientSide) { if (!pLevel.isClientSide) {
CustomExplosion explosion = new CustomExplosion(pLevel, null, CustomExplosion explosion = new CustomExplosion(pLevel, null,
ModDamageTypes.causeProjectileBoomDamage(pLevel.registryAccess(), pLivingEntity, pLivingEntity), 90, ModDamageTypes.causeProjectileBoomDamage(pLevel.registryAccess(), pLivingEntity, pLivingEntity), 90,
pLivingEntity.getX(), pLivingEntity.getY(), pLivingEntity.getZ(), 6.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(2); pLivingEntity.getX(), pLivingEntity.getY(), pLivingEntity.getZ(), 6.5f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1.25f);
explosion.explode(); explosion.explode();
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(pLevel, explosion); net.minecraftforge.event.ForgeEventFactory.onExplosionStart(pLevel, explosion);
explosion.finalizeExplosion(false); explosion.finalizeExplosion(false);