优化无人机神风模式判断
This commit is contained in:
parent
87b82ca209
commit
a3ba4acc05
3 changed files with 41 additions and 30 deletions
|
@ -40,6 +40,7 @@ public class DroneModel extends GeoModel<DroneEntity> {
|
||||||
CoreGeoBone ammo5 = getAnimationProcessor().getBone("ammo5");
|
CoreGeoBone ammo5 = getAnimationProcessor().getBone("ammo5");
|
||||||
CoreGeoBone ammo6 = getAnimationProcessor().getBone("ammo6");
|
CoreGeoBone ammo6 = getAnimationProcessor().getBone("ammo6");
|
||||||
CoreGeoBone shell = getAnimationProcessor().getBone("shell");
|
CoreGeoBone shell = getAnimationProcessor().getBone("shell");
|
||||||
|
// TODO 适配C4模型
|
||||||
|
|
||||||
ammo6.setHidden(animatable.getEntityData().get(AMMO) <= 5);
|
ammo6.setHidden(animatable.getEntityData().get(AMMO) <= 5);
|
||||||
ammo5.setHidden(animatable.getEntityData().get(AMMO) <= 4);
|
ammo5.setHidden(animatable.getEntityData().get(AMMO) <= 4);
|
||||||
|
@ -47,7 +48,7 @@ public class DroneModel extends GeoModel<DroneEntity> {
|
||||||
ammo3.setHidden(animatable.getEntityData().get(AMMO) <= 2);
|
ammo3.setHidden(animatable.getEntityData().get(AMMO) <= 2);
|
||||||
ammo2.setHidden(animatable.getEntityData().get(AMMO) <= 1);
|
ammo2.setHidden(animatable.getEntityData().get(AMMO) <= 1);
|
||||||
ammo1.setHidden(animatable.getEntityData().get(AMMO) <= 0);
|
ammo1.setHidden(animatable.getEntityData().get(AMMO) <= 0);
|
||||||
shell.setHidden(!animatable.getEntityData().get(KAMIKAZE));
|
shell.setHidden(animatable.getEntityData().get(KAMIKAZE_MODE) != 1);
|
||||||
|
|
||||||
CoreGeoBone weapon = getAnimationProcessor().getBone("Weapon");
|
CoreGeoBone weapon = getAnimationProcessor().getBone("Weapon");
|
||||||
String id = animatable.getEntityData().get(CONTROLLER);
|
String id = animatable.getEntityData().get(CONTROLLER);
|
||||||
|
|
|
@ -32,8 +32,7 @@ import java.text.DecimalFormat;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
import static com.atsuishio.superbwarfare.client.RenderHelper.preciseBlit;
|
||||||
import static com.atsuishio.superbwarfare.entity.DroneEntity.AMMO;
|
import static com.atsuishio.superbwarfare.entity.DroneEntity.*;
|
||||||
import static com.atsuishio.superbwarfare.entity.DroneEntity.KAMIKAZE;
|
|
||||||
|
|
||||||
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
@Mod.EventBusSubscriber(value = Dist.CLIENT)
|
||||||
public class DroneUIOverlay {
|
public class DroneUIOverlay {
|
||||||
|
@ -92,33 +91,40 @@ public class DroneUIOverlay {
|
||||||
|
|
||||||
int color = -1;
|
int color = -1;
|
||||||
|
|
||||||
|
// 超出距离警告
|
||||||
if (distance > MAX_DISTANCE - 48) {
|
if (distance > MAX_DISTANCE - 48) {
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.warning"),
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.warning"),
|
||||||
w / 2 - 18, h / 2 - 47, -65536, false);
|
w / 2 - 18, h / 2 - 47, -65536, false);
|
||||||
color = -65536;
|
color = -65536;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 距离
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.distance")
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.distance")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(distance) + "M")),
|
.append(Component.literal(new DecimalFormat("##.#").format(distance) + "M")),
|
||||||
w / 2 + 10, h / 2 + 33, color, false);
|
w / 2 + 10, h / 2 + 33, color, false);
|
||||||
|
|
||||||
|
// 血量
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.health")
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.health")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(entity.getHealth()) + "/" + new DecimalFormat("##.#").format(entity.getMaxHealth()))),
|
.append(Component.literal(new DecimalFormat("##.#").format(entity.getHealth()) + "/" + new DecimalFormat("##.#").format(entity.getMaxHealth()))),
|
||||||
w / 2 - 77, h / 2 + 33, -1, false);
|
w / 2 - 77, h / 2 + 33, -1, false);
|
||||||
if (!entity.getEntityData().get(KAMIKAZE)) {
|
if (entity.getEntityData().get(KAMIKAZE_MODE) == 0) {
|
||||||
|
// 弹药
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.ammo")
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.ammo")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(entity.getEntityData().get(AMMO)) + " / 6")),
|
.append(Component.literal(new DecimalFormat("##.#").format(entity.getEntityData().get(AMMO)) + " / 6")),
|
||||||
w / 2 + 12, h / 2 - 37, -1, false);
|
w / 2 + 12, h / 2 - 37, -1, false);
|
||||||
} else {
|
} else {
|
||||||
|
// 神风
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.kamikaze"),
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.kamikaze"),
|
||||||
w / 2 + 12, h / 2 - 37, -65536, false);
|
w / 2 + 12, h / 2 - 37, -65536, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lookAtEntity) {
|
if (lookAtEntity) {
|
||||||
|
// 实体距离
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.range")
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.range")
|
||||||
.append(Component.literal(new DecimalFormat("##.#").format(entityRange) + "M " + lookingEntity.getDisplayName().getString())),
|
.append(Component.literal(new DecimalFormat("##.#").format(entityRange) + "M " + lookingEntity.getDisplayName().getString())),
|
||||||
w / 2 + 12, h / 2 - 28, color, false);
|
w / 2 + 12, h / 2 - 28, color, false);
|
||||||
} else {
|
} else {
|
||||||
|
// 方块距离
|
||||||
if (blockRange > 512) {
|
if (blockRange > 512) {
|
||||||
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.range")
|
guiGraphics.drawString(mc.font, Component.translatable("tips.superbwarfare.drone.range")
|
||||||
.append(Component.literal("---M")), w / 2 + 12, h / 2 - 28, color, false);
|
.append(Component.literal("---M")), w / 2 + 12, h / 2 - 28, color, false);
|
||||||
|
|
|
@ -60,7 +60,6 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
public static final EntityDataAccessor<Boolean> LINKED = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.BOOLEAN);
|
public static final EntityDataAccessor<Boolean> LINKED = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.BOOLEAN);
|
||||||
public static final EntityDataAccessor<String> CONTROLLER = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.STRING);
|
public static final EntityDataAccessor<String> CONTROLLER = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.STRING);
|
||||||
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> AMMO = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Boolean> KAMIKAZE = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.BOOLEAN);
|
|
||||||
public static final EntityDataAccessor<Integer> KAMIKAZE_MODE = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.INT);
|
public static final EntityDataAccessor<Integer> KAMIKAZE_MODE = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.INT);
|
||||||
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_ROT = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT);
|
||||||
public static final EntityDataAccessor<Float> DELTA_X_ROT = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT);
|
public static final EntityDataAccessor<Float> DELTA_X_ROT = SynchedEntityData.defineId(DroneEntity.class, EntityDataSerializers.FLOAT);
|
||||||
|
@ -124,7 +123,6 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
this.entityData.define(CONTROLLER, "undefined");
|
this.entityData.define(CONTROLLER, "undefined");
|
||||||
this.entityData.define(LINKED, false);
|
this.entityData.define(LINKED, false);
|
||||||
this.entityData.define(AMMO, 0);
|
this.entityData.define(AMMO, 0);
|
||||||
this.entityData.define(KAMIKAZE, false);
|
|
||||||
this.entityData.define(KAMIKAZE_MODE, 0);
|
this.entityData.define(KAMIKAZE_MODE, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +142,6 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
compound.putBoolean("Linked", this.entityData.get(LINKED));
|
compound.putBoolean("Linked", this.entityData.get(LINKED));
|
||||||
compound.putString("Controller", this.entityData.get(CONTROLLER));
|
compound.putString("Controller", this.entityData.get(CONTROLLER));
|
||||||
compound.putInt("Ammo", this.entityData.get(AMMO));
|
compound.putInt("Ammo", this.entityData.get(AMMO));
|
||||||
compound.putBoolean("Kamikaze", this.entityData.get(KAMIKAZE));
|
|
||||||
compound.putInt("KamikazeMode", this.entityData.get(KAMIKAZE_MODE));
|
compound.putInt("KamikazeMode", this.entityData.get(KAMIKAZE_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +154,6 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
this.entityData.set(CONTROLLER, compound.getString("Controller"));
|
this.entityData.set(CONTROLLER, compound.getString("Controller"));
|
||||||
if (compound.contains("Ammo"))
|
if (compound.contains("Ammo"))
|
||||||
this.entityData.set(AMMO, compound.getInt("Ammo"));
|
this.entityData.set(AMMO, compound.getInt("Ammo"));
|
||||||
if (compound.contains("Kamikaze"))
|
|
||||||
this.entityData.set(KAMIKAZE, compound.getBoolean("Kamikaze"));
|
|
||||||
if (compound.contains("KamikazeMode"))
|
if (compound.contains("KamikazeMode"))
|
||||||
this.entityData.set(KAMIKAZE_MODE, compound.getInt("KamikazeMode"));
|
this.entityData.set(KAMIKAZE_MODE, compound.getInt("KamikazeMode"));
|
||||||
}
|
}
|
||||||
|
@ -227,7 +222,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
droneDrop(controller);
|
droneDrop(controller);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (this.entityData.get(KAMIKAZE)) {
|
if (this.entityData.get(KAMIKAZE_MODE) != 0) {
|
||||||
if (controller != null) {
|
if (controller != null) {
|
||||||
if (controller.getMainHandItem().is(ModItems.MONITOR.get())) {
|
if (controller.getMainHandItem().is(ModItems.MONITOR.get())) {
|
||||||
Monitor.disLink(controller.getMainHandItem(), controller);
|
Monitor.disLink(controller.getMainHandItem(), controller);
|
||||||
|
@ -321,14 +316,19 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (stack.isEmpty() && player.isCrouching()) {
|
} else if (stack.isEmpty() && player.isCrouching()) {
|
||||||
|
// 返还物品
|
||||||
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.DRONE.get()));
|
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.DRONE.get()));
|
||||||
|
|
||||||
|
// 返还普通弹药
|
||||||
for (int index0 = 0; index0 < this.entityData.get(AMMO); index0++) {
|
for (int index0 = 0; index0 < this.entityData.get(AMMO); index0++) {
|
||||||
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.RGO_GRENADE.get()));
|
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.RGO_GRENADE.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.entityData.get(KAMIKAZE)) {
|
// 返还神风弹药
|
||||||
|
if (this.entityData.get(KAMIKAZE_MODE) == 1) {
|
||||||
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.MORTAR_SHELLS.get()));
|
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.MORTAR_SHELLS.get()));
|
||||||
|
} else if (this.entityData.get(KAMIKAZE_MODE) == 2) {
|
||||||
|
ItemHandlerHelper.giveItemToPlayer(player, new ItemStack(ModItems.EXPLOSIVE_MINE.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
player.getInventory().items.stream().filter(stack_ -> stack_.getItem() == ModItems.MONITOR.get())
|
player.getInventory().items.stream().filter(stack_ -> stack_.getItem() == ModItems.MONITOR.get())
|
||||||
|
@ -339,7 +339,8 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!this.level().isClientSide()) this.discard();
|
if (!this.level().isClientSide()) this.discard();
|
||||||
} else if (stack.getItem() == ModItems.RGO_GRENADE.get() && !this.entityData.get(KAMIKAZE)) {
|
} else if (stack.getItem() == ModItems.RGO_GRENADE.get() && this.entityData.get(KAMIKAZE_MODE) == 0) {
|
||||||
|
// 装载普通弹药
|
||||||
if (this.entityData.get(AMMO) < 6) {
|
if (this.entityData.get(AMMO) < 6) {
|
||||||
this.entityData.set(AMMO, this.entityData.get(AMMO) + 1);
|
this.entityData.set(AMMO, this.entityData.get(AMMO) + 1);
|
||||||
if (!player.isCreative()) {
|
if (!player.isCreative()) {
|
||||||
|
@ -349,20 +350,21 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.BULLET_SUPPLY.get(), SoundSource.PLAYERS, 0.5F, 1);
|
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.BULLET_SUPPLY.get(), SoundSource.PLAYERS, 0.5F, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (stack.getItem() == ModItems.MORTAR_SHELLS.get() && this.entityData.get(AMMO) == 0 && !this.entityData.get(KAMIKAZE)) {
|
} else if (stack.getItem() == ModItems.MORTAR_SHELLS.get() && this.entityData.get(AMMO) == 0 && this.entityData.get(KAMIKAZE_MODE) == 0) {
|
||||||
|
// 迫击炮神风
|
||||||
if (!player.isCreative()) {
|
if (!player.isCreative()) {
|
||||||
stack.shrink(1);
|
stack.shrink(1);
|
||||||
}
|
}
|
||||||
this.entityData.set(KAMIKAZE, true);
|
this.entityData.set(KAMIKAZE_MODE, 1);
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
if (player instanceof ServerPlayer serverPlayer) {
|
||||||
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.BULLET_SUPPLY.get(), SoundSource.PLAYERS, 0.5F, 1);
|
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.BULLET_SUPPLY.get(), SoundSource.PLAYERS, 0.5F, 1);
|
||||||
}
|
}
|
||||||
} else if (stack.getItem() == ModItems.EXPLOSIVE_MINE.get() && this.entityData.get(AMMO) == 0 && !this.entityData.get(KAMIKAZE)) {
|
} else if (stack.getItem() == ModItems.EXPLOSIVE_MINE.get() && this.entityData.get(AMMO) == 0 && this.entityData.get(KAMIKAZE_MODE) == 0) {
|
||||||
|
// C4神风
|
||||||
if (!player.isCreative()) {
|
if (!player.isCreative()) {
|
||||||
stack.shrink(1);
|
stack.shrink(1);
|
||||||
}
|
}
|
||||||
this.entityData.set(KAMIKAZE, true);
|
this.entityData.set(KAMIKAZE_MODE, 2);
|
||||||
this.entityData.set(KAMIKAZE_MODE, 1);
|
|
||||||
if (player instanceof ServerPlayer serverPlayer) {
|
if (player instanceof ServerPlayer serverPlayer) {
|
||||||
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.BULLET_SUPPLY.get(), SoundSource.PLAYERS, 0.5F, 1);
|
serverPlayer.level().playSound(null, serverPlayer.getOnPos(), ModSounds.BULLET_SUPPLY.get(), SoundSource.PLAYERS, 0.5F, 1);
|
||||||
}
|
}
|
||||||
|
@ -465,7 +467,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
public void hitEntityCrash(Player controller, Entity target) {
|
public void hitEntityCrash(Player controller, Entity target) {
|
||||||
if (lastTickSpeed > 0.12) {
|
if (lastTickSpeed > 0.12) {
|
||||||
if (this.entityData.get(KAMIKAZE) && 20 * lastTickSpeed > this.getHealth()) {
|
if (this.entityData.get(KAMIKAZE_MODE) != 0 && 20 * lastTickSpeed > this.getHealth()) {
|
||||||
target.hurt(ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, controller), ExplosionConfig.DRONE_KAMIKAZE_HIT_DAMAGE.get());
|
target.hurt(ModDamageTypes.causeCustomExplosionDamage(this.level().registryAccess(), this, controller), ExplosionConfig.DRONE_KAMIKAZE_HIT_DAMAGE.get());
|
||||||
if (controller != null && controller.getMainHandItem().is(ModItems.MONITOR.get())) {
|
if (controller != null && controller.getMainHandItem().is(ModItems.MONITOR.get())) {
|
||||||
Monitor.disLink(controller.getMainHandItem(), controller);
|
Monitor.disLink(controller.getMainHandItem(), controller);
|
||||||
|
@ -473,7 +475,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
}
|
}
|
||||||
target.hurt(ModDamageTypes.causeDroneHitDamage(this.level().registryAccess(), this, controller), (float) (5 * lastTickSpeed));
|
target.hurt(ModDamageTypes.causeDroneHitDamage(this.level().registryAccess(), this, controller), (float) (5 * lastTickSpeed));
|
||||||
|
|
||||||
this.hurt(new DamageSource(level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.EXPLOSION), Objects.requireNonNullElse(controller, this)), (float) ((this.entityData.get(KAMIKAZE) ? 20 : 4) * lastTickSpeed));
|
this.hurt(new DamageSource(level().registryAccess().registryOrThrow(Registries.DAMAGE_TYPE).getHolderOrThrow(DamageTypes.EXPLOSION), Objects.requireNonNullElse(controller, this)), (float) (((this.entityData.get(KAMIKAZE_MODE) != 0) ? 20 : 4) * lastTickSpeed));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -515,7 +517,7 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.entityData.get(KAMIKAZE)) {
|
if (this.entityData.get(KAMIKAZE_MODE) != 0) {
|
||||||
kamikazeExplosion(this.entityData.get(KAMIKAZE_MODE));
|
kamikazeExplosion(this.entityData.get(KAMIKAZE_MODE));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,18 +547,20 @@ public class DroneEntity extends MobileVehicleEntity implements GeoEntity {
|
||||||
|
|
||||||
private void kamikazeExplosion(int mode) {
|
private void kamikazeExplosion(int mode) {
|
||||||
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
Entity attacker = EntityFindUtil.findEntity(this.level(), this.entityData.get(LAST_ATTACKER_UUID));
|
||||||
CustomExplosion explosion;
|
CustomExplosion explosion = switch (mode) {
|
||||||
switch(mode) {
|
case 1 -> new CustomExplosion(this.level(), this,
|
||||||
case 1:
|
|
||||||
explosion = new CustomExplosion(this.level(), this,
|
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), ExplosionConfig.C4_EXPLOSION_DAMAGE.get(),
|
|
||||||
this.getX(), this.getY(), this.getZ(), ExplosionConfig.C4_EXPLOSION_RADIUS.get(), ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
explosion = new CustomExplosion(this.level(), this,
|
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), ExplosionConfig.DRONE_KAMIKAZE_EXPLOSION_DAMAGE.get(),
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), ExplosionConfig.DRONE_KAMIKAZE_EXPLOSION_DAMAGE.get(),
|
||||||
this.getX(), this.getY(), this.getZ(), ExplosionConfig.DRONE_KAMIKAZE_EXPLOSION_RADIUS.get(), ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
this.getX(), this.getY(), this.getZ(), ExplosionConfig.DRONE_KAMIKAZE_EXPLOSION_RADIUS.get(), ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
}
|
|
||||||
|
case 2 -> new CustomExplosion(this.level(), this,
|
||||||
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), attacker, attacker), ExplosionConfig.C4_EXPLOSION_DAMAGE.get(),
|
||||||
|
this.getX(), this.getY(), this.getZ(), ExplosionConfig.C4_EXPLOSION_RADIUS.get(), ExplosionDestroyConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP).setDamageMultiplier(1);
|
||||||
|
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (explosion == null) return;
|
||||||
|
|
||||||
explosion.explode();
|
explosion.explode();
|
||||||
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
ForgeEventFactory.onExplosionStart(this.level(), explosion);
|
||||||
explosion.finalizeExplosion(false);
|
explosion.finalizeExplosion(false);
|
||||||
|
|
Loading…
Add table
Reference in a new issue