From 358a9b35fea05c2237ab2e4be14da1ef59812c30 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Mon, 13 Jan 2025 20:51:32 +0800 Subject: [PATCH] =?UTF-8?q?=20=E8=B0=83=E6=95=B4=E6=95=B0=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/projectile/CannonShellEntity.java | 43 ++++++++++--------- .../projectile/JavelinMissileEntity.java | 36 +++++++++++----- .../entity/projectile/ProjectileEntity.java | 2 +- .../projectile/SmallCannonShellEntity.java | 39 +++++++++++------ .../entity/vehicle/Lav150Entity.java | 41 ++++++------------ .../event/ClientEventHandler.java | 5 +++ .../event/LivingEventHandler.java | 5 ++- .../mixins/MouseHandlerMixin.java | 8 +++- 8 files changed, 103 insertions(+), 76 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java index be5e578fb..f4550dd69 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/CannonShellEntity.java @@ -7,6 +7,7 @@ import com.atsuishio.superbwarfare.init.*; 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; @@ -29,6 +30,7 @@ import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PacketDistributor; @@ -123,7 +125,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt this.durability -= 2; if (this.durability <= 0) { if (!this.level().isClientSide()) { - causeExplode(); + causeExplode(entityHitResult); } this.discard(); } @@ -141,7 +143,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(); + causeExplode(blockHitResult); return; } @@ -171,20 +173,19 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt if (this.durability <= 0) { if (!this.level().isClientSide()) { - causeExplode(); + causeExplode(blockHitResult); this.discard(); } } else { if (!this.level().isClientSide()) { if (ExplosionDestroyConfig.EXPLOSION_DESTROY.get()) { - BlockPos _pos = BlockPos.containing(x, y, z); if (this.firstHit) { ParticleTool.cannonHitParticles(this.level(), this.position()); - causeExplode(); + causeExplode(blockHitResult); this.firstHit = false; this.setNoGravity(true); } else { - apExplode(_pos); + apExplode(blockHitResult); } } } @@ -193,7 +194,7 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt if (this.durability > 0) { ModUtils.queueServerWork(2, () -> { if (!this.level().isClientSide()) { - causeExplode(); + causeExplode(blockHitResult); this.discard(); } }); @@ -209,13 +210,15 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt } if (this.tickCount > 600 || this.isInWater()) { 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(); } } - private void causeExplode() { + private void causeExplode(HitResult result) { if (Math.random() > fireProbability) { fireTime = 0; } @@ -225,9 +228,9 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt this, this.getOwner()), explosionDamage, - this.getX(), - this.getY(), - this.getZ(), + result.getLocation().x, + result.getLocation().y, + result.getLocation().z, explosionRadius, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP). setDamageMultiplier(1).setFireTime(fireTime); @@ -236,13 +239,13 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt explosion.finalizeExplosion(false); if (explosionRadius > 7) { - ParticleTool.spawnHugeExplosionParticles(this.level(), this.position()); + ParticleTool.spawnHugeExplosionParticles(this.level(), result.getLocation()); } 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) { fireTime = 0; } @@ -252,9 +255,9 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt this, this.getOwner()), explosionDamage, - pos.getX(), - pos.getY(), - pos.getZ(), + result.getLocation().x, + result.getLocation().y, + result.getLocation().z, explosionRadius, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP). setDamageMultiplier(1).setFireTime(fireTime); @@ -263,9 +266,9 @@ public class CannonShellEntity extends ThrowableItemProjectile implements GeoEnt explosion.finalizeExplosion(false); if (explosionRadius > 7) { - ParticleTool.spawnHugeExplosionParticles(this.level(), this.position()); + ParticleTool.spawnHugeExplosionParticles(this.level(), result.getLocation()); } else { - ParticleTool.spawnMediumExplosionParticles(this.level(), this.position()); + ParticleTool.spawnMediumExplosionParticles(this.level(), result.getLocation()); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java index 885c17af8..23c99620c 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/JavelinMissileEntity.java @@ -1,6 +1,7 @@ package com.atsuishio.superbwarfare.entity.projectile; import com.atsuishio.superbwarfare.ModUtils; +import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; import com.atsuishio.superbwarfare.entity.AnimatedEntity; import com.atsuishio.superbwarfare.entity.vehicle.VehicleEntity; 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.ModSounds; import com.atsuishio.superbwarfare.network.message.ClientIndicatorMessage; -import com.atsuishio.superbwarfare.tools.EntityFindUtil; -import com.atsuishio.superbwarfare.tools.ParticleTool; -import com.atsuishio.superbwarfare.tools.ProjectileTool; -import com.atsuishio.superbwarfare.tools.SeekTool; +import com.atsuishio.superbwarfare.tools.*; import net.minecraft.commands.arguments.EntityAnchorArgument; import net.minecraft.core.BlockPos; 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.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; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; import net.minecraft.world.phys.Vec3; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PacketDistributor; @@ -149,9 +149,7 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo if (this.tickCount > 1) { if (this.level() instanceof ServerLevel) { - ProjectileTool.causeCustomExplode(this, - ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - entity, this.explosion_damage, this.explosion_radius, this.monsterMultiplier); + causeExplode(result); } } @@ -175,9 +173,7 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo if (this.tickCount > 1) { if (this.level() instanceof ServerLevel) { - ProjectileTool.causeCustomExplode(this, - ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - this, this.explosion_damage, this.explosion_radius, this.monsterMultiplier); + causeExplode(blockHitResult); } } @@ -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))); } 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.setDeltaMovement(this.getDeltaMovement().scale(1.1)); + this.setDeltaMovement(this.getDeltaMovement().multiply(1.03, 1.03, 1.03)); } } 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) { Vec3 vec3 = pAnchor.apply(this); double d0 = (pTarget.x - vec3.x) * 0.2; diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java index ca4a1b006..79f67c5e2 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java @@ -584,7 +584,7 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa protected void explosionBulletBlock(Entity projectile, float damage, int heLevel, float monsterMultiple, Vec3 hitVec) { CustomExplosion explosion = new CustomExplosion(projectile.level(), projectile, 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(); net.minecraftforge.event.ForgeEventFactory.onExplosionStart(projectile.level(), explosion); explosion.finalizeExplosion(false); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java index ebd1439f7..80180b649 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java @@ -1,11 +1,13 @@ package com.atsuishio.superbwarfare.entity.projectile; import com.atsuishio.superbwarfare.ModUtils; +import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; 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; @@ -20,11 +22,13 @@ 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; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.EntityHitResult; +import net.minecraft.world.phys.HitResult; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PacketDistributor; 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) { entity.invulnerableTime = 0; @@ -88,9 +92,7 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G if (this.tickCount > 1) { if (this.level() instanceof ServerLevel) { - ProjectileTool.causeCustomExplode(this, - ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - entity, this.explosionDamage, this.explosionRadius, 1.25f); + causeExplode(result); } } this.discard(); @@ -104,15 +106,28 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G if (state.getBlock() instanceof BellBlock bell) { bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection()); } - - if (this.tickCount > 1) { - if (this.level() instanceof ServerLevel) { - ProjectileTool.causeCustomExplode(this, - ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), - this, this.explosionDamage, this.explosionRadius, 1.25f); - } - this.discard(); + if (this.level() instanceof ServerLevel) { + causeExplode(blockHitResult); } + 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 diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java index c83549cce..f1de7bc85 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java @@ -65,7 +65,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC public static final EntityDataAccessor HEAT = SynchedEntityData.defineId(Lav150Entity.class, EntityDataSerializers.INT); public static final EntityDataAccessor 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(); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); @@ -127,13 +127,13 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC amount *= 3f; } if (source.is(ModDamageTypes.GUN_FIRE)) { - amount *= 0.2f; - } - if (source.is(ModDamageTypes.GUN_FIRE_ABSOLUTE)) { 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.hurt(0.5f * Math.max(amount - 40, 0)); + this.hurt(0.5f * Math.max(amount - 25, 0)); return true; } @@ -246,29 +246,14 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC float z = 3f; 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(), - 50, - 40, - 4.5f); - + 58, + 22, + 3.5f); 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, - 0.5f); + smallCannonShell.shoot(getBarrelVector(1).x, getBarrelVector(1).y + 0.005f, getBarrelVector(1).z, 22, + 0.25f); 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); @@ -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.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 diffX; - diffY = Mth.wrapDegrees(gunAngle - getTurretYRot()); + diffY = Mth.wrapDegrees(gunAngle - getTurretYRot() + 0.1f); diffX = Mth.wrapDegrees(driver.getXRot() - this.getTurretXRot()); @@ -535,7 +520,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC @Override public float ignoreExplosionHorizontalKnockBack() { - return -0.5f; + return -0.9f; } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java index 852b53360..e7c043424 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/ClientEventHandler.java @@ -1246,6 +1246,11 @@ public class ClientEventHandler { return; } + if (player.getVehicle() instanceof Lav150Entity && zoom) { + event.setFOV(event.getFOV() / 3); + return; + } + if (stack.is(ModTags.Items.GUN)) { if (!event.usedConfiguredFov()) { return; diff --git a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java index 78de89a09..df9adc28b 100644 --- a/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java +++ b/src/main/java/com/atsuishio/superbwarfare/event/LivingEventHandler.java @@ -9,6 +9,7 @@ import com.atsuishio.superbwarfare.entity.TargetEntity; import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity; import com.atsuishio.superbwarfare.entity.vehicle.IArmedVehicleEntity; 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.init.*; import com.atsuishio.superbwarfare.item.gun.GunItem; @@ -56,7 +57,7 @@ public class LivingEventHandler { @SubscribeEvent 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); } } @@ -95,7 +96,7 @@ public class LivingEventHandler { private static void handleVehicleHurt(LivingHurtEvent event) { var vehicle = event.getEntity().getVehicle(); if (vehicle != null) { - if (vehicle instanceof ICannonEntity) { + if (vehicle instanceof ICannonEntity || vehicle instanceof Lav150Entity) { event.setCanceled(true); } else if (vehicle instanceof IArmedVehicleEntity) { event.setAmount(0.3f * event.getAmount()); diff --git a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java index 57cd6299a..12aa60775 100644 --- a/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java +++ b/src/main/java/com/atsuishio/superbwarfare/mixins/MouseHandlerMixin.java @@ -55,8 +55,12 @@ public class MouseHandlerMixin { return 0.24; } - if (player.getVehicle() instanceof Lav150Entity lav150 && lav150.getFirstPassenger() == player) { - return 0.32; + if (player.getVehicle() instanceof Lav150Entity) { + if (ClientEventHandler.zoom) { + return 0.22; + } else { + return 0.31; + } } if (stack.is(ModItems.MONITOR.get()) && stack.getOrCreateTag().getBoolean("Using") && stack.getOrCreateTag().getBoolean("Linked")) {