提取成员击杀方法
This commit is contained in:
parent
ea09e165b2
commit
d63d487f9c
12 changed files with 105 additions and 268 deletions
|
@ -12,7 +12,10 @@ import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.*;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -56,7 +59,6 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
|
@ -457,46 +459,9 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
if (this.crash) {
|
|
||||||
List<Entity> 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<Entity> 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) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, attacker), 300.0f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, getAttacker()), 300.0f,
|
||||||
this.getX(), this.getY(), this.getZ(), 8f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 8f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -504,6 +469,11 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
|
||||||
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.crash) {
|
||||||
|
crashPassengers();
|
||||||
|
} else {
|
||||||
|
explodePassengers();
|
||||||
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,6 @@ import software.bernie.geckolib.core.object.PlayState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, CannonEntity {
|
public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, CannonEntity {
|
||||||
|
|
||||||
|
@ -408,11 +407,9 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
|
|
||||||
if (level() instanceof ServerLevel) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 600f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 600f,
|
||||||
this.getX(), this.getY(), this.getZ(), 15f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 15f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -420,24 +417,7 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explodePassengers();
|
||||||
List<Entity> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,10 @@ import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.*;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
@ -30,7 +33,6 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageTypes;
|
import net.minecraft.world.damagesource.DamageTypes;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.MoverType;
|
import net.minecraft.world.entity.MoverType;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -55,7 +57,6 @@ import software.bernie.geckolib.core.object.PlayState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
|
@ -638,11 +639,9 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
|
|
||||||
if (level() instanceof ServerLevel) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 80f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 80f,
|
||||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -650,24 +649,7 @@ public class Bmp2Entity extends ContainerMobileVehicleEntity implements GeoEntit
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explodePassengers();
|
||||||
List<Entity> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,13 +241,14 @@ public class LaserTowerEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
||||||
if (level() instanceof ServerLevel) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 10f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), attacker, attacker), 10f,
|
||||||
this.getX(), this.getY(), this.getZ(), 3f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 3f, Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
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);
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
}
|
}
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,10 @@ import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.*;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
@ -29,7 +32,6 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageTypes;
|
import net.minecraft.world.damagesource.DamageTypes;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.MoverType;
|
import net.minecraft.world.entity.MoverType;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
@ -57,7 +59,6 @@ import software.bernie.geckolib.core.object.PlayState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
|
@ -584,11 +585,9 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
|
|
||||||
if (level() instanceof ServerLevel) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 80f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 80f,
|
||||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -596,24 +595,7 @@ public class Lav150Entity extends ContainerMobileVehicleEntity implements GeoEnt
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explodePassengers();
|
||||||
List<Entity> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
|
||||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
import com.atsuishio.superbwarfare.tools.SoundTool;
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
@ -51,7 +50,6 @@ import software.bernie.geckolib.core.object.PlayState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity {
|
public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity {
|
||||||
|
|
||||||
|
@ -218,11 +216,9 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
|
|
||||||
if (level() instanceof ServerLevel) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 100f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 100f,
|
||||||
this.getX(), this.getY(), this.getZ(), 7f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 7f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -230,26 +226,8 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explodePassengers();
|
||||||
List<Entity> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,7 +11,6 @@ import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
import com.atsuishio.superbwarfare.item.common.ammo.CannonShellItem;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
|
||||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
import com.atsuishio.superbwarfare.tools.SoundTool;
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
|
@ -52,7 +51,6 @@ import software.bernie.geckolib.core.object.PlayState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEntity {
|
public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEntity {
|
||||||
|
|
||||||
|
@ -232,11 +230,9 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
|
|
||||||
if (level() instanceof ServerLevel) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 120f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 120f,
|
||||||
this.getX(), this.getY(), this.getZ(), 6f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 6f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -244,23 +240,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Entity> passengers = this.getPassengers();
|
explodePassengers();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,10 @@ import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.ModVariables;
|
import com.atsuishio.superbwarfare.network.ModVariables;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.*;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import net.minecraft.core.particles.ParticleTypes;
|
import net.minecraft.core.particles.ParticleTypes;
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
|
@ -27,7 +30,6 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageTypes;
|
import net.minecraft.world.damagesource.DamageTypes;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
import net.minecraft.world.level.Explosion;
|
import net.minecraft.world.level.Explosion;
|
||||||
|
@ -48,7 +50,6 @@ import software.bernie.geckolib.core.object.PlayState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
|
@ -412,28 +413,9 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
|
|
||||||
List<Entity> 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) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 80f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 80f,
|
||||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -441,6 +423,7 @@ public class SpeedboatEntity extends ContainerMobileVehicleEntity implements Geo
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explodePassengers();
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
|
||||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -30,7 +29,6 @@ import net.minecraft.world.InteractionHand;
|
||||||
import net.minecraft.world.InteractionResult;
|
import net.minecraft.world.InteractionResult;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Items;
|
import net.minecraft.world.item.Items;
|
||||||
import net.minecraft.world.level.Explosion;
|
import net.minecraft.world.level.Explosion;
|
||||||
|
@ -48,8 +46,6 @@ import software.bernie.geckolib.core.animatable.instance.AnimatableInstanceCache
|
||||||
import software.bernie.geckolib.core.animation.AnimatableManager;
|
import software.bernie.geckolib.core.animation.AnimatableManager;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(Tom6Entity.class, EntityDataSerializers.FLOAT);
|
||||||
|
@ -301,47 +297,10 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
if (this.crash) {
|
|
||||||
List<Entity> 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<Entity> 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) {
|
if (level() instanceof ServerLevel) {
|
||||||
if (entityData.get(MELON)) {
|
if (entityData.get(MELON)) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, attacker), VehicleConfig.TOM_6_BOMB_EXPLOSION_DAMAGE.get(),
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, getAttacker()), VehicleConfig.TOM_6_BOMB_EXPLOSION_DAMAGE.get(),
|
||||||
this.getX(), this.getY(), this.getZ(), VehicleConfig.TOM_6_BOMB_EXPLOSION_RADIUS.get().floatValue(), ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), VehicleConfig.TOM_6_BOMB_EXPLOSION_RADIUS.get().floatValue(), ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -349,7 +308,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
||||||
} else {
|
} else {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, attacker), 15.0f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, getAttacker()), 15.0f,
|
||||||
this.getX(), this.getY(), this.getZ(), 2f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 2f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -358,6 +317,11 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.crash) {
|
||||||
|
crashPassengers();
|
||||||
|
} else {
|
||||||
|
explodePassengers();
|
||||||
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import com.atsuishio.superbwarfare.init.ModDamageTypes;
|
||||||
import com.atsuishio.superbwarfare.init.ModEntities;
|
import com.atsuishio.superbwarfare.init.ModEntities;
|
||||||
import com.atsuishio.superbwarfare.init.ModSounds;
|
import com.atsuishio.superbwarfare.init.ModSounds;
|
||||||
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
import com.atsuishio.superbwarfare.tools.EntityFindUtil;
|
|
||||||
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.core.BlockPos;
|
import net.minecraft.core.BlockPos;
|
||||||
|
@ -267,11 +266,9 @@ public class WheelChairEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
|
|
||||||
if (level() instanceof ServerLevel) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 10f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 10f,
|
||||||
this.getX(), this.getY(), this.getZ(), 2f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 2f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
|
|
@ -11,7 +11,10 @@ import com.atsuishio.superbwarfare.entity.vehicle.base.WeaponVehicleEntity;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
import com.atsuishio.superbwarfare.entity.vehicle.damage.DamageModifier;
|
||||||
import com.atsuishio.superbwarfare.init.*;
|
import com.atsuishio.superbwarfare.init.*;
|
||||||
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
|
||||||
import com.atsuishio.superbwarfare.tools.*;
|
import com.atsuishio.superbwarfare.tools.AmmoType;
|
||||||
|
import com.atsuishio.superbwarfare.tools.CustomExplosion;
|
||||||
|
import com.atsuishio.superbwarfare.tools.ParticleTool;
|
||||||
|
import com.atsuishio.superbwarfare.tools.SoundTool;
|
||||||
import com.mojang.math.Axis;
|
import com.mojang.math.Axis;
|
||||||
import net.minecraft.client.CameraType;
|
import net.minecraft.client.CameraType;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -33,7 +36,6 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageTypes;
|
import net.minecraft.world.damagesource.DamageTypes;
|
||||||
import net.minecraft.world.entity.Entity;
|
import net.minecraft.world.entity.Entity;
|
||||||
import net.minecraft.world.entity.EntityType;
|
import net.minecraft.world.entity.EntityType;
|
||||||
import net.minecraft.world.entity.LivingEntity;
|
|
||||||
import net.minecraft.world.entity.MoverType;
|
import net.minecraft.world.entity.MoverType;
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
|
@ -60,7 +62,6 @@ import software.bernie.geckolib.core.object.PlayState;
|
||||||
import software.bernie.geckolib.util.GeckoLibUtil;
|
import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
import static com.atsuishio.superbwarfare.tools.ParticleTool.sendParticle;
|
||||||
|
|
||||||
|
@ -798,11 +799,9 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
|
||||||
|
|
||||||
if (level() instanceof ServerLevel) {
|
if (level() instanceof ServerLevel) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 80f,
|
ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), getAttacker(), getAttacker()), 80f,
|
||||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 5f, ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
|
@ -810,24 +809,7 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
explodePassengers();
|
||||||
List<Entity> 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -901,15 +883,12 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canShoot(Player player) {
|
public boolean canShoot(Player player) {
|
||||||
if (player == getNthEntity(0)) {
|
return switch (getSeatIndex(player)) {
|
||||||
return this.entityData.get(LOADED_AMMO) > 0;
|
case 0 -> this.entityData.get(LOADED_AMMO) > 0;
|
||||||
}
|
case 1 ->
|
||||||
|
(this.entityData.get(MG_AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) && !cannotFire;
|
||||||
if (player == getNthEntity(1)) {
|
default -> false;
|
||||||
return (this.entityData.get(MG_AMMO) > 0 || player.getInventory().hasAnyMatching(s -> s.is(ModItems.CREATIVE_AMMO_BOX.get()))) && !cannotFire;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -964,18 +943,19 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getWeaponType(int index) {
|
public int getWeaponType(int index) {
|
||||||
if (index == 0) {
|
return switch (index) {
|
||||||
return entityData.get(WEAPON_TYPE);
|
case 0 -> entityData.get(WEAPON_TYPE);
|
||||||
} else if (index == 1) {
|
case 1 -> entityData.get(PASSENGER_WEAPON_TYPE);
|
||||||
return entityData.get(PASSENGER_WEAPON_TYPE);
|
default -> -1;
|
||||||
}
|
};
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setWeaponType(int index, int type) {
|
public void setWeaponType(int index, int type) {
|
||||||
if (index == 0) entityData.set(WEAPON_TYPE, type);
|
switch (index) {
|
||||||
if (index == 1) entityData.set(PASSENGER_WEAPON_TYPE, type);
|
case 0 -> entityData.set(WEAPON_TYPE, type);
|
||||||
|
case 1 -> entityData.set(PASSENGER_WEAPON_TYPE, type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -532,6 +532,46 @@ public abstract class VehicleEntity extends Entity {
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Entity getAttacker() {
|
||||||
|
return EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void crashPassengers() {
|
||||||
|
for (var entity : this.getPassengers()) {
|
||||||
|
if (entity instanceof LivingEntity living) {
|
||||||
|
var tempAttacker = living == getAttacker() ? null : getAttacker();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void explodePassengers() {
|
||||||
|
for (var entity : this.getPassengers()) {
|
||||||
|
if (entity instanceof LivingEntity living) {
|
||||||
|
var tempAttacker = living == getAttacker() ? null : getAttacker();
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void travel() {
|
public void travel() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue