添加载具被击毁伤害类型,删除炮的被熏黑图层
This commit is contained in:
parent
fedf2734e5
commit
45f0a9f971
24 changed files with 213 additions and 121 deletions
|
@ -1,30 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.client.layer;
|
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Mk42Entity;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
|
||||||
import software.bernie.geckolib.renderer.GeoRenderer;
|
|
||||||
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
|
||||||
|
|
||||||
public class Mk42DamageLayer extends GeoRenderLayer<Mk42Entity> {
|
|
||||||
|
|
||||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/sherman_damage.png");
|
|
||||||
|
|
||||||
public Mk42DamageLayer(GeoRenderer<Mk42Entity> entityRenderer) {
|
|
||||||
super(entityRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(PoseStack poseStack, Mk42Entity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
|
||||||
RenderType glowRenderType = RenderType.entityTranslucent(LAYER);
|
|
||||||
float heal = Mth.clamp((0.3f * animatable.getMaxHealth() - animatable.getHealth()) * 0.00001f * animatable.getMaxHealth(), 0, 1);
|
|
||||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 1, 1, 1, heal);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,30 +0,0 @@
|
||||||
package com.atsuishio.superbwarfare.client.layer;
|
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.ModUtils;
|
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Mle1934Entity;
|
|
||||||
import com.mojang.blaze3d.vertex.PoseStack;
|
|
||||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
|
||||||
import net.minecraft.client.renderer.MultiBufferSource;
|
|
||||||
import net.minecraft.client.renderer.RenderType;
|
|
||||||
import net.minecraft.client.renderer.texture.OverlayTexture;
|
|
||||||
import net.minecraft.resources.ResourceLocation;
|
|
||||||
import net.minecraft.util.Mth;
|
|
||||||
import software.bernie.geckolib.cache.object.BakedGeoModel;
|
|
||||||
import software.bernie.geckolib.renderer.GeoRenderer;
|
|
||||||
import software.bernie.geckolib.renderer.layer.GeoRenderLayer;
|
|
||||||
|
|
||||||
public class Mle1934DamageLayer extends GeoRenderLayer<Mle1934Entity> {
|
|
||||||
|
|
||||||
private static final ResourceLocation LAYER = ModUtils.loc("textures/entity/mle1934_damage.png");
|
|
||||||
|
|
||||||
public Mle1934DamageLayer(GeoRenderer<Mle1934Entity> entityRenderer) {
|
|
||||||
super(entityRenderer);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void render(PoseStack poseStack, Mle1934Entity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) {
|
|
||||||
RenderType glowRenderType = RenderType.entityTranslucent(LAYER);
|
|
||||||
float heal = Mth.clamp((0.3f * animatable.getMaxHealth() - animatable.getHealth()) * 0.00001f * animatable.getMaxHealth(), 0, 1);
|
|
||||||
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 1, 1, 1, heal);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.client.layer.Mk42DamageLayer;
|
|
||||||
import com.atsuishio.superbwarfare.client.layer.Mk42Layer;
|
import com.atsuishio.superbwarfare.client.layer.Mk42Layer;
|
||||||
import com.atsuishio.superbwarfare.client.model.entity.Mk42Model;
|
import com.atsuishio.superbwarfare.client.model.entity.Mk42Model;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Mk42Entity;
|
import com.atsuishio.superbwarfare.entity.vehicle.Mk42Entity;
|
||||||
|
@ -21,7 +20,6 @@ public class Mk42Renderer extends GeoEntityRenderer<Mk42Entity> {
|
||||||
super(renderManager, new Mk42Model());
|
super(renderManager, new Mk42Model());
|
||||||
this.shadowRadius = 2f;
|
this.shadowRadius = 2f;
|
||||||
this.addRenderLayer(new Mk42Layer(this));
|
this.addRenderLayer(new Mk42Layer(this));
|
||||||
this.addRenderLayer(new Mk42DamageLayer(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.atsuishio.superbwarfare.client.renderer.entity;
|
package com.atsuishio.superbwarfare.client.renderer.entity;
|
||||||
|
|
||||||
import com.atsuishio.superbwarfare.client.layer.Mle1934DamageLayer;
|
|
||||||
import com.atsuishio.superbwarfare.client.layer.Mle1934Layer;
|
import com.atsuishio.superbwarfare.client.layer.Mle1934Layer;
|
||||||
import com.atsuishio.superbwarfare.client.model.entity.Mle1934Model;
|
import com.atsuishio.superbwarfare.client.model.entity.Mle1934Model;
|
||||||
import com.atsuishio.superbwarfare.entity.vehicle.Mle1934Entity;
|
import com.atsuishio.superbwarfare.entity.vehicle.Mle1934Entity;
|
||||||
|
@ -21,7 +20,6 @@ public class Mle1934Renderer extends GeoEntityRenderer<Mle1934Entity> {
|
||||||
super(renderManager, new Mle1934Model());
|
super(renderManager, new Mle1934Model());
|
||||||
this.shadowRadius = 2f;
|
this.shadowRadius = 2f;
|
||||||
this.addRenderLayer(new Mle1934Layer(this));
|
this.addRenderLayer(new Mle1934Layer(this));
|
||||||
this.addRenderLayer(new Mle1934DamageLayer(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class SmallCannonShellEntity extends ThrowableItemProjectile implements G
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entity.hurt(ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()), damage);
|
entity.hurt(ModDamageTypes.causeCannonFireDamage(this.level().registryAccess(), this, this.getOwner()), damage);
|
||||||
|
|
||||||
if (entity instanceof LivingEntity) {
|
if (entity instanceof LivingEntity) {
|
||||||
entity.invulnerableTime = 0;
|
entity.invulnerableTime = 0;
|
||||||
|
|
|
@ -418,10 +418,31 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE);
|
living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE);
|
||||||
living.invulnerableTime = 0;
|
living.invulnerableTime = 0;
|
||||||
living.hurt(ModDamageTypes.causeAirCrashDamage(this.level().registryAccess(), null, tempAttacker), Integer.MAX_VALUE);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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, attacker), 300.0f,
|
||||||
|
@ -430,8 +451,9 @@ public class Ah6Entity extends ContainerMobileEntity implements GeoEntity, IHeli
|
||||||
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
||||||
this.discard();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -50,6 +50,7 @@ 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, ICannonEntity {
|
public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity, ICannonEntity {
|
||||||
|
|
||||||
|
@ -305,17 +306,37 @@ public class AnnihilatorEntity extends EnergyVehicleEntity implements GeoEntity,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
if (level() instanceof ServerLevel) {
|
|
||||||
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) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 200f,
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 600f,
|
||||||
this.getX(), this.getY(), this.getZ(), 10f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 15f, ExplosionDestroyConfig.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);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnHugeExplosionParticles(this.level(), this.position());
|
||||||
this.discard();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,6 +28,7 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
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;
|
||||||
|
@ -55,6 +56,7 @@ 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;
|
||||||
|
|
||||||
|
@ -489,13 +491,35 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
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) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 75f,
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 80f,
|
||||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 5f, ExplosionDestroyConfig.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);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ 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, ICannonEntity {
|
public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntity {
|
||||||
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> COOL_DOWN = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.INT);
|
||||||
|
@ -136,22 +137,45 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, ICannonEntit
|
||||||
this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.04, 0.0));
|
this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.04, 0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
lowHealthWarning();
|
||||||
|
|
||||||
this.refreshDimensions();
|
this.refreshDimensions();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
if (level() instanceof ServerLevel) {
|
|
||||||
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) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 150f,
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 100f,
|
||||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 7f, ExplosionDestroyConfig.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);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
this.discard();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -45,6 +45,7 @@ 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, ICannonEntity {
|
public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEntity {
|
||||||
|
|
||||||
|
@ -158,17 +159,36 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, ICannonEn
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
if (level() instanceof ServerLevel) {
|
|
||||||
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) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 150f,
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 120f,
|
||||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 6f, ExplosionDestroyConfig.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);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
this.discard();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -27,6 +27,7 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
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;
|
||||||
|
@ -51,6 +52,7 @@ 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;
|
||||||
|
|
||||||
|
@ -405,13 +407,34 @@ public class SpeedboatEntity extends ContainerMobileEntity implements GeoEntity,
|
||||||
@Override
|
@Override
|
||||||
public void destroy() {
|
public void destroy() {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
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) {
|
||||||
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 75f,
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 80f,
|
||||||
this.getX(), this.getY(), this.getZ(), 5f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), 5f, ExplosionDestroyConfig.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);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
ParticleTool.spawnMediumExplosionParticles(this.level(), this.position());
|
||||||
|
}
|
||||||
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -270,30 +270,30 @@ public class VehicleEntity extends Entity {
|
||||||
public void lowHealthWarning() {
|
public void lowHealthWarning() {
|
||||||
if (this.getHealth() <= 0.4 * this.getMaxHealth()) {
|
if (this.getHealth() <= 0.4 * this.getMaxHealth()) {
|
||||||
if (this.level() instanceof ServerLevel serverLevel) {
|
if (this.level() instanceof ServerLevel serverLevel) {
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 2, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, false);
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 2, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getHealth() <= 0.25 * this.getMaxHealth()) {
|
if (this.getHealth() <= 0.25 * this.getMaxHealth()) {
|
||||||
if (this.level() instanceof ServerLevel serverLevel) {
|
if (this.level() instanceof ServerLevel serverLevel) {
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 1, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, false);
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 1, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, true);
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 1, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, false);
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 1, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getHealth() <= 0.15 * this.getMaxHealth()) {
|
if (this.getHealth() <= 0.15 * this.getMaxHealth()) {
|
||||||
if (this.level() instanceof ServerLevel serverLevel) {
|
if (this.level() instanceof ServerLevel serverLevel) {
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 1, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, false);
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 1, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, true);
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 1, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, false);
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 1, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.getHealth() <= 0.1 * this.getMaxHealth()) {
|
if (this.getHealth() <= 0.1 * this.getMaxHealth()) {
|
||||||
if (this.level() instanceof ServerLevel serverLevel) {
|
if (this.level() instanceof ServerLevel serverLevel) {
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 2, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, false);
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 2, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, true);
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 2, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, false);
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 0.7f * getBbHeight(), this.getZ(), 2, 0.35 * this.getBbWidth(), 0.15 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.01, true);
|
||||||
ParticleTool.sendParticle(serverLevel, ParticleTypes.FLAME, this.getX(), this.getY() + 0.85f * getBbHeight(), this.getZ(), 4, 0.35 * this.getBbWidth(), 0.12 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.05, false);
|
ParticleTool.sendParticle(serverLevel, ParticleTypes.FLAME, this.getX(), this.getY() + 0.85f * getBbHeight(), this.getZ(), 4, 0.35 * this.getBbWidth(), 0.12 * this.getBbHeight(), 0.35 * this.getBbWidth(), 0.05, true);
|
||||||
ParticleTool.sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 0.85f * getBbHeight(), this.getZ(), 4, 0.1 * this.getBbWidth(), 0.05 * this.getBbHeight(), 0.1 * this.getBbWidth(), 0.4, false);
|
ParticleTool.sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), this.getX(), this.getY() + 0.85f * getBbHeight(), this.getZ(), 4, 0.1 * this.getBbWidth(), 0.05 * this.getBbHeight(), 0.1 * this.getBbWidth(), 0.4, true);
|
||||||
}
|
}
|
||||||
if (this.tickCount % 15 == 0) {
|
if (this.tickCount % 15 == 0) {
|
||||||
this.level().playSound(null, this.getOnPos(), SoundEvents.FIRE_AMBIENT, SoundSource.PLAYERS, 1, 1);
|
this.level().playSound(null, this.getOnPos(), SoundEvents.FIRE_AMBIENT, SoundSource.PLAYERS, 1, 1);
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package com.atsuishio.superbwarfare.entity.vehicle;
|
package com.atsuishio.superbwarfare.entity.vehicle;
|
||||||
|
|
||||||
|
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
|
||||||
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
import com.atsuishio.superbwarfare.entity.MortarEntity;
|
||||||
|
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.item.ContainerBlockItem;
|
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.particles.ParticleTypes;
|
|
||||||
import net.minecraft.nbt.CompoundTag;
|
import net.minecraft.nbt.CompoundTag;
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
import net.minecraft.network.protocol.game.ClientGamePacketListener;
|
||||||
|
@ -20,9 +21,8 @@ import net.minecraft.util.Mth;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
import net.minecraft.world.entity.*;
|
import net.minecraft.world.entity.*;
|
||||||
import net.minecraft.world.entity.animal.WaterAnimal;
|
import net.minecraft.world.entity.animal.WaterAnimal;
|
||||||
import net.minecraft.world.entity.item.ItemEntity;
|
|
||||||
import net.minecraft.world.entity.player.Player;
|
import net.minecraft.world.entity.player.Player;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.level.Explosion;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
import net.minecraftforge.network.NetworkHooks;
|
import net.minecraftforge.network.NetworkHooks;
|
||||||
|
@ -262,20 +262,20 @@ 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) {
|
||||||
ParticleTool.sendParticle((ServerLevel) this.level(), ParticleTypes.EXPLOSION, this.getX(), this.getY() + 1, this.getZ(), 10, 0.5, 0.5, 0.5, 1, false);
|
CustomExplosion explosion = new CustomExplosion(this.level(), this,
|
||||||
this.level().playSound(null, BlockPos.containing(this.position()), SoundEvents.GENERIC_EXPLODE, SoundSource.BLOCKS, 2.0F, (1.0F + (this.random.nextFloat() - this.random.nextFloat()) * 0.2F) * 0.7F);
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), 10f,
|
||||||
this.setHealth(this.getMaxHealth());
|
this.getX(), this.getY(), this.getZ(), 2f, ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
ItemStack container = ContainerBlockItem.createInstance(this);
|
explosion.explode();
|
||||||
if (this.level() instanceof ServerLevel level) {
|
net.minecraftforge.event.ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
ItemEntity itemEntity = new ItemEntity(level, this.getX(), this.getY(), this.getZ(), container);
|
explosion.finalizeExplosion(false);
|
||||||
itemEntity.setPickUpDelay(10);
|
ParticleTool.spawnSmallExplosionParticles(this.level(), this.position());
|
||||||
level.addFreshEntity(itemEntity);
|
|
||||||
}
|
}
|
||||||
this.remove(RemovalReason.DISCARDED);
|
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float ignoreExplosionHorizontalKnockBack() {
|
public float ignoreExplosionHorizontalKnockBack() {
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class LivingEventHandler {
|
||||||
|
|
||||||
@SubscribeEvent
|
@SubscribeEvent
|
||||||
public static void onEntityAttacked(LivingAttackEvent event) {
|
public static void onEntityAttacked(LivingAttackEvent event) {
|
||||||
if (event.getEntity().getVehicle() instanceof ICannonEntity || event.getEntity().getVehicle() instanceof Lav150Entity) {
|
if (!event.getSource().is(ModDamageTypes.VEHICLE_EXPLOSION) && (event.getEntity().getVehicle() instanceof ICannonEntity || event.getEntity().getVehicle() instanceof Lav150Entity)) {
|
||||||
event.setCanceled(true);
|
event.setCanceled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,9 @@ public class LivingEventHandler {
|
||||||
var vehicle = event.getEntity().getVehicle();
|
var vehicle = event.getEntity().getVehicle();
|
||||||
if (vehicle != null) {
|
if (vehicle != null) {
|
||||||
if (vehicle instanceof ICannonEntity || vehicle instanceof Lav150Entity) {
|
if (vehicle instanceof ICannonEntity || vehicle instanceof Lav150Entity) {
|
||||||
|
if (!event.getSource().is(ModDamageTypes.VEHICLE_EXPLOSION)) {
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ public class ModDamageTypes {
|
||||||
public static final ResourceKey<DamageType> VEHICLE_STRIKE = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("vehicle_strike"));
|
public static final ResourceKey<DamageType> VEHICLE_STRIKE = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("vehicle_strike"));
|
||||||
public static final ResourceKey<DamageType> AIR_CRASH = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("air_crash"));
|
public static final ResourceKey<DamageType> AIR_CRASH = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("air_crash"));
|
||||||
public static final ResourceKey<DamageType> LUNGE_MINE = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("lunge_mine"));
|
public static final ResourceKey<DamageType> LUNGE_MINE = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("lunge_mine"));
|
||||||
|
public static final ResourceKey<DamageType> VEHICLE_EXPLOSION = ResourceKey.create(Registries.DAMAGE_TYPE, ModUtils.loc("vehicle_explosion"));
|
||||||
|
|
||||||
public static DamageSource causeGunFireDamage(RegistryAccess registryAccess, @Nullable Entity directEntity, @Nullable Entity attacker) {
|
public static DamageSource causeGunFireDamage(RegistryAccess registryAccess, @Nullable Entity directEntity, @Nullable Entity attacker) {
|
||||||
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(GUN_FIRE), directEntity, attacker);
|
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(GUN_FIRE), directEntity, attacker);
|
||||||
|
@ -98,6 +99,10 @@ public class ModDamageTypes {
|
||||||
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(LUNGE_MINE), directEntity, attacker);
|
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(LUNGE_MINE), directEntity, attacker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static DamageSource causeVehicleExplosionDamage(RegistryAccess registryAccess, @Nullable Entity directEntity, @Nullable Entity attacker) {
|
||||||
|
return new DamageMessages(registryAccess.registry(Registries.DAMAGE_TYPE).get().getHolderOrThrow(VEHICLE_EXPLOSION), directEntity, attacker);
|
||||||
|
}
|
||||||
|
|
||||||
private static class DamageMessages extends DamageSource {
|
private static class DamageMessages extends DamageSource {
|
||||||
|
|
||||||
public DamageMessages(Holder.Reference<DamageType> typeReference) {
|
public DamageMessages(Holder.Reference<DamageType> typeReference) {
|
||||||
|
|
|
@ -366,6 +366,9 @@
|
||||||
"death.attack.lunge_mine": "%1$s被突刺爆雷戳到了屁股",
|
"death.attack.lunge_mine": "%1$s被突刺爆雷戳到了屁股",
|
||||||
"death.attack.lunge_mine.entity": "%1$s被%2$s用突刺爆雷戳到了屁股",
|
"death.attack.lunge_mine.entity": "%1$s被%2$s用突刺爆雷戳到了屁股",
|
||||||
"death.attack.lunge_mine.item": "%1$s被%2$s用%3$s型突刺爆雷戳到了屁股",
|
"death.attack.lunge_mine.item": "%1$s被%2$s用%3$s型突刺爆雷戳到了屁股",
|
||||||
|
"death.attack.vehicle_explosion": "%1$s的载具被击毁了",
|
||||||
|
"death.attack.vehicle_explosion.entity": "%1$s的载具被%2$s击毁了",
|
||||||
|
"death.attack.vehicle_explosion.item": "%1$s的载具被%2$s用%3$s击毁了",
|
||||||
|
|
||||||
"entity.superbwarfare.projectile": "Bullet",
|
"entity.superbwarfare.projectile": "Bullet",
|
||||||
"entity.superbwarfare.projectile_mortar_shell": "Mortar Shell",
|
"entity.superbwarfare.projectile_mortar_shell": "Mortar Shell",
|
||||||
|
|
|
@ -357,13 +357,16 @@
|
||||||
"death.attack.laser_headshot.item": "%1$s的脑子被%2$s用%3$s发射的激光洞穿了",
|
"death.attack.laser_headshot.item": "%1$s的脑子被%2$s用%3$s发射的激光洞穿了",
|
||||||
"death.attack.vehicle_strike": "%1$s被创死了",
|
"death.attack.vehicle_strike": "%1$s被创死了",
|
||||||
"death.attack.vehicle_strike.entity": "%1$s被%2$s创死了",
|
"death.attack.vehicle_strike.entity": "%1$s被%2$s创死了",
|
||||||
"death.attack.vehicle_strike.item": "%1$s的被%2$s用%3$s创死了",
|
"death.attack.vehicle_strike.item": "%1$s被%2$s用%3$s创死了",
|
||||||
"death.attack.air_crash": "%1$s坠机了",
|
"death.attack.air_crash": "%1$s坠机了",
|
||||||
"death.attack.air_crash.entity": "%1$s坠机了,凶手是%2$s",
|
"death.attack.air_crash.entity": "%1$s坠机了,凶手是%2$s",
|
||||||
"death.attack.air_crash.item": "%1$s坠机了,凶手是%2$s",
|
"death.attack.air_crash.item": "%1$s坠机了,凶手是%2$s",
|
||||||
"death.attack.lunge_mine": "%1$s被突刺爆雷戳到了屁股",
|
"death.attack.lunge_mine": "%1$s被突刺爆雷戳到了屁股",
|
||||||
"death.attack.lunge_mine.entity": "%1$s被%2$s用突刺爆雷戳到了屁股",
|
"death.attack.lunge_mine.entity": "%1$s被%2$s用突刺爆雷戳到了屁股",
|
||||||
"death.attack.lunge_mine.item": "%1$s被%2$s用%3$s型突刺爆雷戳到了屁股",
|
"death.attack.lunge_mine.item": "%1$s被%2$s用%3$s型突刺爆雷戳到了屁股",
|
||||||
|
"death.attack.vehicle_explosion": "%1$s的载具被击毁了",
|
||||||
|
"death.attack.vehicle_explosion.entity": "%1$s的载具被%2$s击毁了",
|
||||||
|
"death.attack.vehicle_explosion.item": "%1$s的载具被%2$s用%3$s击毁了",
|
||||||
|
|
||||||
"entity.superbwarfare.projectile": "子弹",
|
"entity.superbwarfare.projectile": "子弹",
|
||||||
"entity.superbwarfare.projectile_mortar_shell": "迫击炮弹",
|
"entity.superbwarfare.projectile_mortar_shell": "迫击炮弹",
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 35 KiB |
Binary file not shown.
Before Width: | Height: | Size: 6.4 KiB |
|
@ -8,6 +8,7 @@
|
||||||
"superbwarfare:laser",
|
"superbwarfare:laser",
|
||||||
"superbwarfare:laser_headshot",
|
"superbwarfare:laser_headshot",
|
||||||
"superbwarfare:vehicle_strike",
|
"superbwarfare:vehicle_strike",
|
||||||
|
"superbwarfare:vehicle_explosion",
|
||||||
"superbwarfare:air_crash"
|
"superbwarfare:air_crash"
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -9,5 +9,6 @@
|
||||||
"superbwarfare:laser_headshot",
|
"superbwarfare:laser_headshot",
|
||||||
"superbwarfare:vehicle_strike",
|
"superbwarfare:vehicle_strike",
|
||||||
"superbwarfare:air_crash"
|
"superbwarfare:air_crash"
|
||||||
|
"superbwarfare:vehicle_explosion",
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -9,5 +9,6 @@
|
||||||
"superbwarfare:laser_headshot",
|
"superbwarfare:laser_headshot",
|
||||||
"superbwarfare:vehicle_strike",
|
"superbwarfare:vehicle_strike",
|
||||||
"superbwarfare:air_crash"
|
"superbwarfare:air_crash"
|
||||||
|
"superbwarfare:vehicle_explosion",
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -9,5 +9,6 @@
|
||||||
"superbwarfare:laser_headshot",
|
"superbwarfare:laser_headshot",
|
||||||
"superbwarfare:vehicle_strike",
|
"superbwarfare:vehicle_strike",
|
||||||
"superbwarfare:air_crash"
|
"superbwarfare:air_crash"
|
||||||
|
"superbwarfare:vehicle_explosion",
|
||||||
]
|
]
|
||||||
}
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"exhaustion": 0,
|
||||||
|
"message_id": "vehicle_explosion",
|
||||||
|
"scaling": "never"
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue