调整爆炸物数值,修复炮弹击中基岩/屏障消失的bug

This commit is contained in:
Atsuihsio 2024-11-23 17:19:40 +08:00
parent d73dd83a7a
commit 54414280cc
12 changed files with 43 additions and 34 deletions

View file

@ -7,6 +7,7 @@ import net.minecraft.network.chat.Component;
import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.TooltipFlag;
import net.minecraft.world.item.context.BlockPlaceContext;
@ -91,7 +92,9 @@ public class BarbedWireBlock extends Block {
public void entityInside(BlockState blockstate, Level world, BlockPos pos, Entity entity) {
super.entityInside(blockstate, world, pos, entity);
entity.makeStuckInBlock(Blocks.AIR.defaultBlockState(), new Vec3(0.25, 0.05, 0.25));
entity.hurt(new DamageSource(world.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.CACTUS)), 1);
if (entity instanceof LivingEntity living) {
living.makeStuckInBlock(Blocks.AIR.defaultBlockState(), new Vec3(0.25, 0.05, 0.25));
living.hurt(new DamageSource(world.registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.CACTUS)), 1);
}
}
}

View file

@ -111,12 +111,12 @@ public class CannonHudOverlay {
if (cannon instanceof Mk42Entity) {
health = cannon.getEntityData().get(net.mcreator.superbwarfare.entity.Mk42Entity.HEALTH);
maxHealth = 1000;
maxHealth = 700;
}
if (cannon instanceof Mle1934Entity) {
health = cannon.getEntityData().get(net.mcreator.superbwarfare.entity.Mle1934Entity.HEALTH);
maxHealth = 1200;
maxHealth = 800;
}
GuiGraphics guiGraphics = event.getGuiGraphics();

View file

@ -9,7 +9,6 @@ import net.mcreator.superbwarfare.init.ModSounds;
import net.mcreator.superbwarfare.item.Monitor;
import net.mcreator.superbwarfare.tools.CustomExplosion;
import net.mcreator.superbwarfare.tools.EntityFindUtil;
import net.mcreator.superbwarfare.tools.ParticleTool;
import net.mcreator.superbwarfare.tools.SoundTool;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
@ -435,13 +434,20 @@ public class DroneEntity extends LivingEntity implements GeoEntity {
}
private void kamikazeExplosion(Entity source) {
CustomExplosion explosionCore = new CustomExplosion(this.level(), this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), source, source), 1000,
this.getX(), this.getY(), this.getZ(), 4f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
explosionCore.explode();
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosionCore);
explosionCore.finalizeExplosion(false);
CustomExplosion explosion = new CustomExplosion(this.level(), this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), source, source), 150,
this.getX(), this.getY(), this.getZ(), 12.5f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
explosion.explode();
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
explosion.finalizeExplosion(false);
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
}
@Override

View file

@ -137,7 +137,7 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity {
if (source.is(DamageTypes.WITHER_SKULL))
return false;
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
amount *= 0.25f;
amount *= 0.5f;
}
if (source.is(ModDamageTypes.CANNON_FIRE)) {
amount *= 1.4f;

View file

@ -143,7 +143,7 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
if (source.is(DamageTypes.WITHER_SKULL))
return false;
if (source.is(ModDamageTypes.PROJECTILE_BOOM)) {
amount *= 0.25f;
amount *= 0.5f;
}
if (source.is(ModDamageTypes.CANNON_FIRE)) {
amount *= 1.4f;

View file

@ -96,7 +96,10 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
public void onHitEntity(EntityHitResult entityHitResult) {
Entity entity = entityHitResult.getEntity();
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage);
entity.invulnerableTime = 0;
if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0;
}
if (this.getOwner() instanceof LivingEntity living) {
if (!living.level().isClientSide() && living instanceof ServerPlayer player) {
@ -106,10 +109,6 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
}
}
// if (this.level() instanceof ServerLevel) {
// causeExplode();
// }
ParticleTool.cannonHitParticles(this.level(), this.position());
Vec3 vec = this.getDeltaMovement();
@ -140,6 +139,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
BlockState blockState = this.level().getBlockState(BlockPos.containing(x, y, z));
if (blockState.is(Blocks.BEDROCK) || blockState.is(Blocks.BARRIER)) {
this.discard();
causeExplode();
return;
}

View file

@ -78,21 +78,21 @@ public class GunGrenadeEntity extends ThrowableItemProjectile {
}
}
if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0;
if (entity instanceof Monster monster) {
monster.hurt(ModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), 1.5f * this.damage * damageMultiplier);
} else {
entity.hurt(ModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), 1.5f * this.damage);
}
if (entity instanceof Monster monster) {
monster.hurt(ModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), 1.6f * this.damage * damageMultiplier);
} else {
entity.hurt(ModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), 1.6f * this.damage);
if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0;
}
if (this.tickCount > 0) {
if (this.level() instanceof ServerLevel) {
ProjectileTool.causeCustomExplode(this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
entity, this.damage * 1.4f, 7.5f, this.monsterMultiplier);
entity, this.damage * 1.2f, 4.5f, this.monsterMultiplier);
}
}

View file

@ -128,7 +128,7 @@ public class HandGrenadeEntity extends ThrowableItemProjectile {
if (this.fuse <= 0) {
this.discard();
if (!this.level().isClientSide) {
ProjectileTool.causeCustomExplode(this, 175f, 7.25f, 1.2f);
ProjectileTool.causeCustomExplode(this, 125f, 5f, 1.2f);
}
}

View file

@ -115,16 +115,16 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
}
}
if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0;
}
if (entity instanceof Monster monster) {
monster.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage * damageMultiplier);
} else {
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage);
}
if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0;
}
if (this.tickCount > 1) {
if (this.level() instanceof ServerLevel) {
ProjectileTool.causeCustomExplode(this,

View file

@ -26,9 +26,9 @@ import net.minecraftforge.network.PlayMessages;
public class MortarShellEntity extends ThrowableItemProjectile {
private float damage = 250f;
private float damage = 175f;
private int life = 600;
private float radius = 12.5f;
private float radius = 8f;
public MortarShellEntity(EntityType<? extends MortarShellEntity> type, Level world) {
super(type, world);

View file

@ -86,7 +86,7 @@ public class RgoGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
bell.attemptToRing(this.level(), resultPos, blockResult.getDirection());
}
if (this.tickCount > 2) {
ProjectileTool.causeCustomExplode(this, 135f, 6.75f, 1.2f);
ProjectileTool.causeCustomExplode(this, 100f, 4f, 1.2f);
}
break;
@ -101,7 +101,7 @@ public class RgoGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
}
}
if (this.tickCount > 2 && !(entity instanceof DroneEntity)) {
ProjectileTool.causeCustomExplode(this, 150f, 4.75f, 1.2f);
ProjectileTool.causeCustomExplode(this, 100f, 4f, 1.2f);
}
break;
default:
@ -117,7 +117,7 @@ public class RgoGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
if (this.fuse <= 0) {
this.discard();
if (!this.level().isClientSide) {
ProjectileTool.causeCustomExplode(this, 135f, 6.75f, 1.5f);
ProjectileTool.causeCustomExplode(this, 100f, 4f, 1.2f);
}
}

View file

@ -100,16 +100,16 @@ public class RpgRocketEntity extends ThrowableItemProjectile implements GeoEntit
}
}
if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0;
}
if (entity instanceof Monster monster) {
monster.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), 1.4f * this.damage * damageMultiplier);
} else {
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), this.damage);
}
if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0;
}
if (this.tickCount > 1) {
if (this.level() instanceof ServerLevel) {
causeRpgExplode(this,