调整数值

This commit is contained in:
Atsuihsio 2025-01-13 20:51:32 +08:00
parent d5cdc8082c
commit 358a9b35fe
8 changed files with 103 additions and 76 deletions

View file

@ -7,6 +7,7 @@ import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage; import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
import com.atsuishio.superbwarfare.tools.CustomExplosion; import com.atsuishio.superbwarfare.tools.CustomExplosion;
import com.atsuishio.superbwarfare.tools.ParticleTool; import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.atsuishio.superbwarfare.tools.ProjectileTool;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.protocol.Packet; import net.minecraft.network.protocol.Packet;
@ -29,6 +30,7 @@ import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.network.PacketDistributor;
@ -123,7 +125,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
this.durability -= 2; this.durability -= 2;
if (this.durability <= 0) { if (this.durability <= 0) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
causeExplode(); causeExplode(entityHitResult);
} }
this.discard(); this.discard();
} }
@ -141,7 +143,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
BlockState blockState = this.level().getBlockState(BlockPos.containing(x, y, z)); BlockState blockState = this.level().getBlockState(BlockPos.containing(x, y, z));
if (blockState.is(Blocks.BEDROCK) || blockState.is(Blocks.BARRIER)) { if (blockState.is(Blocks.BEDROCK) || blockState.is(Blocks.BARRIER)) {
this.discard(); this.discard();
causeExplode(); causeExplode(blockHitResult);
return; return;
} }
@ -171,20 +173,19 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
if (this.durability <= 0) { if (this.durability <= 0) {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
causeExplode(); causeExplode(blockHitResult);
this.discard(); this.discard();
} }
} else { } else {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
if (ExplosionDestroyConfig.EXPLOSION_DESTROY.get()) { if (ExplosionDestroyConfig.EXPLOSION_DESTROY.get()) {
BlockPos _pos = BlockPos.containing(x, y, z);
if (this.firstHit) { if (this.firstHit) {
ParticleTool.cannonHitParticles(this.level(), this.position()); ParticleTool.cannonHitParticles(this.level(), this.position());
causeExplode(); causeExplode(blockHitResult);
this.firstHit = false; this.firstHit = false;
this.setNoGravity(true); this.setNoGravity(true);
} else { } else {
apExplode(_pos); apExplode(blockHitResult);
} }
} }
} }
@ -193,7 +194,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
if (this.durability > 0) { if (this.durability > 0) {
ModUtils.queueServerWork(2, () -> { ModUtils.queueServerWork(2, () -> {
if (!this.level().isClientSide()) { if (!this.level().isClientSide()) {
causeExplode(); causeExplode(blockHitResult);
this.discard(); this.discard();
} }
}); });
@ -209,13 +210,15 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
} }
if (this.tickCount > 600 || this.isInWater()) { if (this.tickCount > 600 || this.isInWater()) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
causeExplode(); ProjectileTool.causeCustomExplode(this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
this, this.explosionDamage, this.explosionRadius, 1.25f);
} }
this.discard(); this.discard();
} }
} }
private void causeExplode() { private void causeExplode(HitResult result) {
if (Math.random() > fireProbability) { if (Math.random() > fireProbability) {
fireTime = 0; fireTime = 0;
} }
@ -225,9 +228,9 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
this, this,
this.getOwner()), this.getOwner()),
explosionDamage, explosionDamage,
this.getX(), result.getLocation().x,
this.getY(), result.getLocation().y,
this.getZ(), result.getLocation().z,
explosionRadius, explosionRadius,
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP). ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
setDamageMultiplier(1).setFireTime(fireTime); setDamageMultiplier(1).setFireTime(fireTime);
@ -236,13 +239,13 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
explosion.finalizeExplosion(false); explosion.finalizeExplosion(false);
if (explosionRadius > 7) { if (explosionRadius > 7) {
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position()); ParticleTool.spawnHugeExplosionParticles(this.level(), result.getLocation());
} else { } else {
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position()); ParticleTool.spawnMediumExplosionParticles(this.level(), result.getLocation());
} }
} }
private void apExplode(BlockPos pos) { private void apExplode(HitResult result) {
if (Math.random() > fireProbability) { if (Math.random() > fireProbability) {
fireTime = 0; fireTime = 0;
} }
@ -252,9 +255,9 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
this, this,
this.getOwner()), this.getOwner()),
explosionDamage, explosionDamage,
pos.getX(), result.getLocation().x,
pos.getY(), result.getLocation().y,
pos.getZ(), result.getLocation().z,
explosionRadius, explosionRadius,
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP). ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
setDamageMultiplier(1).setFireTime(fireTime); setDamageMultiplier(1).setFireTime(fireTime);
@ -263,9 +266,9 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt
explosion.finalizeExplosion(false); explosion.finalizeExplosion(false);
if (explosionRadius > 7) { if (explosionRadius > 7) {
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position()); ParticleTool.spawnHugeExplosionParticles(this.level(), result.getLocation());
} else { } else {
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position()); ParticleTool.spawnMediumExplosionParticles(this.level(), result.getLocation());
} }
} }

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.entity.projectile; package com.atsuishio.superbwarfare.entity.projectile;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.entity.AnimatedEntity; import com.atsuishio.superbwarfare.entity.AnimatedEntity;
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModDamageTypes;
@ -8,10 +9,7 @@ import com.atsuishio.superbwarfare.init.ModEntities;
import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage; import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
import com.atsuishio.superbwarfare.tools.EntityFindUtil; import com.atsuishio.superbwarfare.tools.*;
import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.atsuishio.superbwarfare.tools.ProjectileTool;
import com.atsuishio.superbwarfare.tools.SeekTool;
import net.minecraft.commands.arguments.EntityAnchorArgument; import net.minecraft.commands.arguments.EntityAnchorArgument;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.particles.ParticleTypes; import net.minecraft.core.particles.ParticleTypes;
@ -33,11 +31,13 @@ import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
import net.minecraft.world.entity.monster.Monster; import net.minecraft.world.entity.monster.Monster;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile; import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock; import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.network.PacketDistributor;
@ -149,9 +149,7 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
if (this.tickCount > 1) { if (this.tickCount > 1) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
ProjectileTool.causeCustomExplode(this, causeExplode(result);
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
entity, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
} }
} }
@ -175,9 +173,7 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
if (this.tickCount > 1) { if (this.tickCount > 1) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
ProjectileTool.causeCustomExplode(this, causeExplode(blockHitResult);
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
this, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
} }
} }
@ -232,7 +228,7 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y) + Mth.clamp(4 * this.tickCount, 0, 90), this.entityData.get(TARGET_Z))); this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y) + Mth.clamp(4 * this.tickCount, 0, 90), this.entityData.get(TARGET_Z)));
} else { } else {
this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y) + (entity instanceof EnderDragon ? -3 : 0), this.entityData.get(TARGET_Z))); this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y) + (entity instanceof EnderDragon ? -3 : 0), this.entityData.get(TARGET_Z)));
this.setDeltaMovement(this.getDeltaMovement().scale(1.1)); this.setDeltaMovement(this.getDeltaMovement().multiply(1.03, 1.03, 1.03));
} }
} else { } else {
@ -261,6 +257,24 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
} }
} }
private void causeExplode(HitResult result) {
CustomExplosion explosion = new CustomExplosion(this.level(), this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
this,
this.getOwner()),
explosion_damage,
result.getLocation().x,
result.getLocation().y,
result.getLocation().z,
explosion_radius,
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
setDamageMultiplier(this.monsterMultiplier);
explosion.explode();
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
explosion.finalizeExplosion(false);
ParticleTool.spawnSmallExplosionParticles(this.level(), result.getLocation());
}
private void look(EntityAnchorArgument.Anchor pAnchor, Vec3 pTarget) { private void look(EntityAnchorArgument.Anchor pAnchor, Vec3 pTarget) {
Vec3 vec3 = pAnchor.apply(this); Vec3 vec3 = pAnchor.apply(this);
double d0 = (pTarget.x - vec3.x) * 0.2; double d0 = (pTarget.x - vec3.x) * 0.2;

View file

@ -584,7 +584,7 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
protected void explosionBulletBlock(Entity projectile, float damage, int heLevel, float monsterMultiple, Vec3 hitVec) { protected void explosionBulletBlock(Entity projectile, float damage, int heLevel, float monsterMultiple, Vec3 hitVec) {
CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile, CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile,
ModDamageTypes.causeProjectileBoomDamage(projectile.level().registryAccess(), projectile, this.getShooter()), (float) ((0.9 * damage) * (1 + 0.1 * heLevel)), ModDamageTypes.causeProjectileBoomDamage(projectile.level().registryAccess(), projectile, this.getShooter()), (float) ((0.9 * damage) * (1 + 0.1 * heLevel)),
hitVec.x, hitVec.y, hitVec.z, (float) ((1.5 + 0.02 * damage) * (1 + 0.05 * heLevel))).setDamageMultiplier(monsterMultiple); hitVec.x, hitVec.y, hitVec.z, (float) ((1.5 + 0.02 * damage) * (1 + 0.05 * heLevel))).setDamageMultiplier(monsterMultiple).isBulletExplode(true);
explosion.explode(); explosion.explode();
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion); net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion);
explosion.finalizeExplosion(false); explosion.finalizeExplosion(false);

View file

@ -1,11 +1,13 @@
package com.atsuishio.superbwarfare.entity.projectile; package com.atsuishio.superbwarfare.entity.projectile;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.init.ModDamageTypes; import com.atsuishio.superbwarfare.init.ModDamageTypes;
import com.atsuishio.superbwarfare.init.ModEntities; import com.atsuishio.superbwarfare.init.ModEntities;
import com.atsuishio.superbwarfare.init.ModItems; import com.atsuishio.superbwarfare.init.ModItems;
import com.atsuishio.superbwarfare.init.ModSounds; import com.atsuishio.superbwarfare.init.ModSounds;
import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage; import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage;
import com.atsuishio.superbwarfare.tools.CustomExplosion;
import com.atsuishio.superbwarfare.tools.ParticleTool; import com.atsuishio.superbwarfare.tools.ParticleTool;
import com.atsuishio.superbwarfare.tools.ProjectileTool; import com.atsuishio.superbwarfare.tools.ProjectileTool;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -20,11 +22,13 @@ import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.projectile.ThrowableItemProjectile; import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.Explosion;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.BellBlock; import net.minecraft.world.level.block.BellBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.EntityHitResult; import net.minecraft.world.phys.EntityHitResult;
import net.minecraft.world.phys.HitResult;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
import net.minecraftforge.network.PacketDistributor; import net.minecraftforge.network.PacketDistributor;
import net.minecraftforge.network.PlayMessages; import net.minecraftforge.network.PlayMessages;
@ -80,7 +84,7 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G
} }
} }
entity.hurt(ModDamageTypes.causeGunFireHeadshotDamage(this.level().registryAccess(), this, this.getOwner()), damage); entity.hurt(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), damage);
if (entity instanceof LivingEntity) { if (entity instanceof LivingEntity) {
entity.invulnerableTime = 0; entity.invulnerableTime = 0;
@ -88,9 +92,7 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G
if (this.tickCount > 1) { if (this.tickCount > 1) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
ProjectileTool.causeCustomExplode(this, causeExplode(result);
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
entity, this.explosionDamage, this.explosionRadius, 1.25f);
} }
} }
this.discard(); this.discard();
@ -104,15 +106,28 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G
if (state.getBlock() instanceof BellBlock bell) { if (state.getBlock() instanceof BellBlock bell) {
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection()); bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
} }
if (this.tickCount > 1) {
if (this.level() instanceof ServerLevel) { if (this.level() instanceof ServerLevel) {
ProjectileTool.causeCustomExplode(this, causeExplode(blockHitResult);
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
this, this.explosionDamage, this.explosionRadius, 1.25f);
} }
this.discard(); this.discard();
} }
private void causeExplode(HitResult result) {
CustomExplosion explosion = new CustomExplosion(this.level(), this,
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(),
this,
this.getOwner()),
explosionDamage,
result.getLocation().x,
result.getLocation().y,
result.getLocation().z,
explosionRadius,
ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).
setDamageMultiplier(1.25f);
explosion.explode();
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
explosion.finalizeExplosion(false);
ParticleTool.spawnSmallExplosionParticles(this.level(), result.getLocation());
} }
@Override @Override

View file

@ -65,7 +65,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor<Integer> HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT);
public static final float MAX_HEALTH = VehicleConfig.SPEEDBOAT_HP.get(); public static final float MAX_HEALTH = 850;
public static final int MAX_ENERGY = VehicleConfig.SPEEDBOAT_MAX_ENERGY.get(); public static final int MAX_ENERGY = VehicleConfig.SPEEDBOAT_MAX_ENERGY.get();
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
@ -127,13 +127,13 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
amount *= 3f; amount *= 3f;
} }
if (source.is(ModDamageTypes.GUN_FIRE)) { if (source.is(ModDamageTypes.GUN_FIRE)) {
amount *= 0.2f;
}
if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) {
amount *= 0.4f; amount *= 0.4f;
} }
if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) {
amount *= 0.7f;
}
this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1); this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
this.hurt(0.5f * Math.max(amount - 40, 0)); this.hurt(0.5f * Math.max(amount - 25, 0));
return true; return true;
} }
@ -246,29 +246,14 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
float z = 3f; float z = 3f;
Vector4f worldPosition = transformPosition(transform, x, y, z); Vector4f worldPosition = transformPosition(transform, x, y, z);
// ProjectileEntity projectile = new ProjectileEntity(player.level())
// .shooter(player)
// .damage(80)
// .headShot(3f)
// .zoom(false);
//
// projectile.heBullet(true, 5);
// projectile.bypassArmorRate(1);
// projectile.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
// projectile.shoot(player, getBarrelVector(1).x, getBarrelVector(1).y + 0.002f, getBarrelVector(1).z, 20,
// (float) 0.4);
// this.level().addFreshEntity(projectile);
SmallCannonShellEntity smallCannonShell = new SmallCannonShellEntity(player, this.level(), SmallCannonShellEntity smallCannonShell = new SmallCannonShellEntity(player, this.level(),
50, 58,
40, 22,
4.5f); 3.5f);
smallCannonShell.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z); smallCannonShell.setPos(worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z);
smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 15, smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 22,
0.5f); 0.25f);
this.level().addFreshEntity(smallCannonShell); this.level().addFreshEntity(smallCannonShell);
sendParticle((ServerLevel) this.level(), ParticleTypes.LARGE_SMOKE, worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z, 1, 0.02, 0.02, 0.02, 0, false); sendParticle((ServerLevel) this.level(), ParticleTypes.LARGE_SMOKE, worldPosition.x - 1.1 * this.getDeltaMovement().x, worldPosition.y, worldPosition.z - 1.1 * this.getDeltaMovement().z, 1, 0.02, 0.02, 0.02, 0, false);
@ -292,7 +277,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
} }
} }
this.entityData.set(HEAT, this.entityData.get(HEAT) + 6); this.entityData.set(HEAT, this.entityData.get(HEAT) + 10);
this.entityData.set(FIRE_ANIM, 3); this.entityData.set(FIRE_ANIM, 3);
this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).findFirst().ifPresent(stack -> stack.shrink(1)); this.getItemStacks().stream().filter(stack -> stack.is(ModItems.HEAVY_AMMO.get())).findFirst().ifPresent(stack -> stack.shrink(1));
} }
@ -390,7 +375,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
float diffY; float diffY;
float diffX; float diffX;
diffY = Mth.wrapDegrees(gunAngle - getTurretYRot()); diffY = Mth.wrapDegrees(gunAngle - getTurretYRot() + 0.1f);
diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot()); diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot());
@ -535,7 +520,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
@Override @Override
public float ignoreExplosionHorizontalKnockBack() { public float ignoreExplosionHorizontalKnockBack() {
return -0.5f; return -0.9f;
} }
@Override @Override

View file

@ -1246,6 +1246,11 @@ public class ClientEventHandler {
return; return;
} }
if (player.getVehicle() instanceof Lav150Entity && zoom) {
event.setFOV(event.getFOV() / 3);
return;
}
if (stack.is(ModTags.Items.GUN)) { if (stack.is(ModTags.Items.GUN)) {
if (!event.usedConfiguredFov()) { if (!event.usedConfiguredFov()) {
return; return;

View file

@ -9,6 +9,7 @@ import com.atsuishio.superbwarfare.entity.TargetEntity;
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity; import com.atsuishio.superbwarfare.entity.vehicle.ICannonEntity;
import com.atsuishio.superbwarfare.entity.vehicle.Lav150Entity;
import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity;
import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.init.*;
import com.atsuishio.superbwarfare.item.gun.GunItem; import com.atsuishio.superbwarfare.item.gun.GunItem;
@ -56,7 +57,7 @@ public class LivingEventHandler {
@SubscribeEvent @SubscribeEvent
public static void onEntityAttacked(LivingAttackEvent event) { public static void onEntityAttacked(LivingAttackEvent event) {
if (event.getEntity().getVehicle() != null && event.getEntity().getVehicle() instanceof ICannonEntity) { if (event.getEntity().getVehicle() instanceof ICannonEntity || event.getEntity().getVehicle() instanceof Lav150Entity) {
event.setCanceled(true); event.setCanceled(true);
} }
} }
@ -95,7 +96,7 @@ public class LivingEventHandler {
private static void handleVehicleHurt(LivingHurtEvent event) { private static void handleVehicleHurt(LivingHurtEvent event) {
var vehicle = event.getEntity().getVehicle(); var vehicle = event.getEntity().getVehicle();
if (vehicle != null) { if (vehicle != null) {
if (vehicle instanceof ICannonEntity) { if (vehicle instanceof ICannonEntity || vehicle instanceof Lav150Entity) {
event.setCanceled(true); event.setCanceled(true);
} else if (vehicle instanceof IArmedVehicleEntity) { } else if (vehicle instanceof IArmedVehicleEntity) {
event.setAmount(0.3f * event.getAmount()); event.setAmount(0.3f * event.getAmount());

View file

@ -55,8 +55,12 @@ public class MouseHandlerMixin {
return 0.24; return 0.24;
} }
if (player.getVehicle() instanceof Lav150Entity lav150 && lav150.getFirstPassenger() == player) { if (player.getVehicle() instanceof Lav150Entity) {
return 0.32; if (ClientEventHandler.zoom) {
return 0.22;
} else {
return 0.31;
}
} }
if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) { if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {