diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java index af1d9dd15..fb95674ea 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/MelonBombEntity.java @@ -10,7 +10,7 @@ import net.minecraft.world.entity.projectile.ThrowableItemProjectile; import net.minecraft.world.item.Item; import net.minecraft.world.item.Items; import net.minecraft.world.level.Level; -import net.minecraft.world.phys.HitResult; +import net.minecraft.world.phys.BlockHitResult; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PlayMessages; @@ -44,18 +44,10 @@ public class MelonBombEntity extends ThrowableItemProjectile { } @Override - protected void onHit(HitResult result) { - switch (result.getType()) { - case BLOCK: - ProjectileTool.causeCustomExplode(this, 1200, 24, 1.5f); - break; - case ENTITY: - if (tickCount < 2) return; - ProjectileTool.causeCustomExplode(this, 1200, 24, 1.5f); - break; - default: - break; - } + public void onHitBlock(BlockHitResult blockHitResult) { + super.onHitBlock(blockHitResult); + ProjectileTool.causeCustomExplode(this, 1000, 16, 1.5f); + this.discard(); } @Override @@ -64,7 +56,7 @@ public class MelonBombEntity extends ThrowableItemProjectile { if (tickCount > 600) { this.discard(); if (!this.level().isClientSide) { - ProjectileTool.causeCustomExplode(this, 1200, 24, 1.2f); + ProjectileTool.causeCustomExplode(this, 1000, 16, 1.5f); } } @@ -76,6 +68,6 @@ public class MelonBombEntity extends ThrowableItemProjectile { @Override protected float getGravity() { - return 0.06F; + return 0.05F; } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java index 3232c51b7..c86f683e3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Tom6Entity.java @@ -24,10 +24,12 @@ import net.minecraft.world.InteractionResult; 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.player.Player; import net.minecraft.world.item.Items; import net.minecraft.world.level.Explosion; import net.minecraft.world.level.Level; +import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.PlayMessages; import org.jetbrains.annotations.NotNull; @@ -39,6 +41,8 @@ import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache import software.bernie.geckolib.core.animation.AnimatableManager; import software.bernie.geckolib.util.GeckoLibUtil; +import java.util.List; + public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { public static final EntityDataAccessor DELTA_ROT = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor MELON = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.BOOLEAN); @@ -82,6 +86,9 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { @Override public boolean hurt(DamageSource source, float amount) { super.hurt(source, amount); + if (source.is(ModDamageTypes.VEHICLE_STRIKE)) { + amount *= 2f; + } this.level().playSound(null, this.getOnPos(), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1); this.hurt(amount); return true; @@ -154,7 +161,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { this.setXRot(Mth.clamp(this.getXRot() + addX, onGround() ? -10 : -120, onGround() ? 2 : 120)); this.setZRot(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.01f) * diffY * (float) getDeltaMovement().length()); - if (upInputDown && !onGround()) { + if (upInputDown && !onGround() && entityData.get(MELON)) { entityData.set(MELON, false); Matrix4f transform = getVehicleTransform(); @@ -163,6 +170,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { MelonBombEntity melonBomb = new MelonBombEntity(player, player.level()); melonBomb.setPos(worldPosition.x, worldPosition.y, worldPosition.z); + melonBomb.shoot(this.getDeltaMovement().x, this.getDeltaMovement().y, this.getDeltaMovement().z, 0.96f * (float)this.getDeltaMovement().length(), 0); passenger.level().addFreshEntity(melonBomb); this.level().playSound(null, this.getOnPos(), SoundEvents.IRON_DOOR_OPEN, SoundSource.PLAYERS, 1, 1); @@ -193,9 +201,9 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f); this.setDeltaMovement(this.getDeltaMovement().add( - Mth.sin(-this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.14f : 0.16f) * this.entityData.get(POWER), + Mth.sin(-this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.16f : 0.19f) * this.entityData.get(POWER), Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 30)) * Mth.DEG_TO_RAD) * getDeltaMovement().horizontalDistance() * (entityData.get(MELON) ? 0.047f : 0.067f), -0.04, 0.09), - Mth.cos(this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.14f : 0.16f) * this.entityData.get(POWER) + Mth.cos(this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.16f : 0.19f) * this.entityData.get(POWER) )); } @@ -265,15 +273,60 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity { @Override public void destroy() { Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID)); + if (this.crash) { + List passengers = this.getPassengers(); + for (var entity : passengers) { + if (entity instanceof LivingEntity living) { + var tempAttacker = living == attacker ? null : attacker; + + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + } + } + } else { + List passengers = this.getPassengers(); + for (var entity : passengers) { + if (entity instanceof LivingEntity living) { + var tempAttacker = living == attacker ? null : attacker; + + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + living.invulnerableTime = 0; + living.hurt(ModDamageTypes.causeVehicleExplosionDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE); + } + } + } if (level() instanceof ServerLevel) { - CustomExplosion explosion = new CustomExplosion(this.level(), this, - ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 10f, - this.getX(), this.getY(), this.getZ(), 2f, 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.spawnSmallExplosionParticles(this.level(), this.position()); + if (entityData.get(MELON)) { + CustomExplosion explosion = new CustomExplosion(this.level(), this, + ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, attacker), 1100.0f, + this.getX(), this.getY(), this.getZ(), 16f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1); + explosion.explode(); + ForgeEventFactory.onExplosionStart(this.level(), explosion); + explosion.finalizeExplosion(false); + ParticleTool.spawnHugeExplosionParticles(this.level(), this.position()); + } else { + CustomExplosion explosion = new CustomExplosion(this.level(), this, + ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, attacker), 15.0f, + this.getX(), this.getY(), this.getZ(), 2f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1); + explosion.explode(); + ForgeEventFactory.onExplosionStart(this.level(), explosion); + explosion.finalizeExplosion(false); + ParticleTool.spawnMediumExplosionParticles(this.level(), this.position()); + } } this.discard(); diff --git a/src/main/resources/assets/superbwarfare/lang/en_us.json b/src/main/resources/assets/superbwarfare/lang/en_us.json index b0ec6aed6..85b3119cf 100644 --- a/src/main/resources/assets/superbwarfare/lang/en_us.json +++ b/src/main/resources/assets/superbwarfare/lang/en_us.json @@ -396,6 +396,8 @@ "entity.superbwarfare.ah_6": "AH-6 Little Bird", "entity.superbwarfare.lav_150": "LAV-150 Commando", "entity.minecraft.villager.superbwarfare.armory": "Armory", + "entity.superbwarfare.tom_6": "Tom F6F", + "entity.superbwarfare.melon_bomb": "Melon Bomb", "key.categories.superbwarfare": "Superb Warfare", "key.superbwarfare.hold_zoom": "Zoom(Hold)", diff --git a/src/main/resources/assets/superbwarfare/lang/zh_cn.json b/src/main/resources/assets/superbwarfare/lang/zh_cn.json index 2f45dfe47..a64325073 100644 --- a/src/main/resources/assets/superbwarfare/lang/zh_cn.json +++ b/src/main/resources/assets/superbwarfare/lang/zh_cn.json @@ -394,6 +394,8 @@ "entity.superbwarfare.ah_6": "AH-6 小鸟直升机", "entity.superbwarfare.lav_150": "LAV-150 Commando", "entity.minecraft.villager.superbwarfare.armory": "军械师", + "entity.superbwarfare.tom_6": "汤姆 F6F", + "entity.superbwarfare.melon_bomb": "西瓜航弹", "key.categories.superbwarfare": "卓越前线", "key.superbwarfare.hold_zoom": "瞄准(按住)",