添加火炮和爆炸穿透的配置

This commit is contained in:
Atsuihsio 2024-12-03 15:35:53 +08:00
parent 82b50d764d
commit 82bd702553
10 changed files with 132 additions and 28 deletions

View file

@ -2,6 +2,7 @@ package com.atsuishio.superbwarfare.client.screens;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.client.RenderHelper; import com.atsuishio.superbwarfare.client.RenderHelper;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.entity.ICannonEntity; import com.atsuishio.superbwarfare.entity.ICannonEntity;
import com.atsuishio.superbwarfare.entity.Mk42Entity; import com.atsuishio.superbwarfare.entity.Mk42Entity;
import com.atsuishio.superbwarfare.entity.Mle1934Entity; import com.atsuishio.superbwarfare.entity.Mle1934Entity;
@ -109,12 +110,12 @@ public class CannonHudOverlay {
if (cannon instanceof Mk42Entity) { if (cannon instanceof Mk42Entity) {
health = cannon.getEntityData().get(Mk42Entity.HEALTH); health = cannon.getEntityData().get(Mk42Entity.HEALTH);
maxHealth = 700; maxHealth = CannonConfig.MK42_HP.get();
} }
if (cannon instanceof Mle1934Entity) { if (cannon instanceof Mle1934Entity) {
health = cannon.getEntityData().get(Mle1934Entity.HEALTH); health = cannon.getEntityData().get(Mle1934Entity.HEALTH);
maxHealth = 800; maxHealth = CannonConfig.MLE1934_HP.get();
} }
GuiGraphics guiGraphics = event.getGuiGraphics(); GuiGraphics guiGraphics = event.getGuiGraphics();

View file

@ -1,5 +1,7 @@
package com.atsuishio.superbwarfare.config; package com.atsuishio.superbwarfare.config;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.config.server.SpawnConfig; import com.atsuishio.superbwarfare.config.server.SpawnConfig;
import net.minecraftforge.common.ForgeConfigSpec; import net.minecraftforge.common.ForgeConfigSpec;
@ -11,6 +13,8 @@ public class ServerConfig {
SpawnConfig.init(builder); SpawnConfig.init(builder);
ExplosionDestroyConfig.init(builder); ExplosionDestroyConfig.init(builder);
ExplosionConfig.init(builder);
CannonConfig.init(builder);
return builder.build(); return builder.build();
} }

View file

@ -0,0 +1,75 @@
package com.atsuishio.superbwarfare.config.server;
import net.minecraftforge.common.ForgeConfigSpec;
public class CannonConfig {
public static ForgeConfigSpec.IntValue MK42_HP;
public static ForgeConfigSpec.IntValue MK42_AP_DAMAGE;
public static ForgeConfigSpec.IntValue MK42_AP_EXPLOSION_DAMAGE;
public static ForgeConfigSpec.IntValue MK42_AP_EXPLOSION_RADIUS;
public static ForgeConfigSpec.IntValue MK42_HE_DAMAGE;
public static ForgeConfigSpec.IntValue MK42_HE_EXPLOSION_DAMAGE;
public static ForgeConfigSpec.IntValue MK42_HE_EXPLOSION_RADIUS;
public static ForgeConfigSpec.IntValue MLE1934_HP;
public static ForgeConfigSpec.IntValue MLE1934_AP_DAMAGE;
public static ForgeConfigSpec.IntValue MLE1934_AP_EXPLOSION_DAMAGE;
public static ForgeConfigSpec.IntValue MLE1934_AP_EXPLOSION_RADIUS;
public static ForgeConfigSpec.IntValue MLE1934_HE_DAMAGE;
public static ForgeConfigSpec.IntValue MLE1934_HE_EXPLOSION_DAMAGE;
public static ForgeConfigSpec.IntValue MLE1934_HE_EXPLOSION_RADIUS;
public static void init(ForgeConfigSpec.Builder builder) {
builder.push("MK-42");
builder.comment("The HealthPoint of MK-42");
MK42_HP = builder.defineInRange("Mk-42 HP", 500, 1, 10000000);
builder.comment("The AP shell damage of MK-42");
MK42_AP_DAMAGE = builder.defineInRange("Mk-42 AP damage", 300, 1, 10000000);
builder.comment("The AP shell explosion damage of MK-42");
MK42_AP_EXPLOSION_DAMAGE = builder.defineInRange("Mk-42 AP explosion damage", 120, 1, 10000000);
builder.comment("The AP shell explosion radius of MK-42");
MK42_AP_EXPLOSION_RADIUS = builder.defineInRange("Mk-42 AP explosion radius", 3, 1, 50);
builder.comment("The HE shell damage of MK-42");
MK42_HE_DAMAGE = builder.defineInRange("Mk-42 HE damage", 150, 1, 10000000);
builder.comment("The HE shell explosion damage of MK-42");
MK42_HE_EXPLOSION_DAMAGE = builder.defineInRange("Mk-42 HE explosion damage", 200, 1, 10000000);
builder.comment("The HE shell explosion radius of MK-42");
MK42_HE_EXPLOSION_RADIUS = builder.defineInRange("Mk-42 HE explosion radius", 10, 1, 50);
builder.pop();
builder.push("MLE-1934");
builder.comment("The HealthPoint of MLE-1934");
MLE1934_HP = builder.defineInRange("MLE-1934 HP", 600, 1, 10000000);
builder.comment("The AP shell damage of MLE-1934");
MLE1934_AP_DAMAGE = builder.defineInRange("MLE-1934 AP damage", 350, 1, 10000000);
builder.comment("The AP shell explosion damage of MLE-1934");
MLE1934_AP_EXPLOSION_DAMAGE = builder.defineInRange("MLE-1934 AP explosion damage", 150, 1, 10000000);
builder.comment("The AP shell explosion radius of MLE-1934");
MLE1934_AP_EXPLOSION_RADIUS = builder.defineInRange("MLE-1934 AP explosion radius", 4, 1, 50);
builder.comment("The HE shell damage of MLE-1934");
MLE1934_HE_DAMAGE = builder.defineInRange("MLE-1934 HE damage", 180, 1, 10000000);
builder.comment("The HE shell explosion damage of MLE-1934");
MLE1934_HE_EXPLOSION_DAMAGE = builder.defineInRange("MLE-1934 HE explosion damage", 240, 1, 10000000);
builder.comment("The HE shell explosion radius of MLE-1934");
MLE1934_HE_EXPLOSION_RADIUS = builder.defineInRange("MLE-1934 HE explosion radius", 12, 1, 50);
builder.pop();
}
}

View file

@ -0,0 +1,18 @@
package com.atsuishio.superbwarfare.config.server;
import net.minecraftforge.common.ForgeConfigSpec;
public class ExplosionConfig {
public static ForgeConfigSpec.IntValue EXPLOSION_PENETRATION_RATIO;
public static void init(ForgeConfigSpec.Builder builder) {
builder.push("explosion_penetration");
builder.comment("The percentage of explosion damage you take behind cover");
EXPLOSION_PENETRATION_RATIO = builder.defineInRange("explosion_destroy", 15, 0, 100);
builder.pop();
}
}

View file

@ -7,7 +7,7 @@ public class ExplosionDestroyConfig {
public static ForgeConfigSpec.BooleanValue EXPLOSION_DESTROY; public static ForgeConfigSpec.BooleanValue EXPLOSION_DESTROY;
public static void init(ForgeConfigSpec.Builder builder) { public static void init(ForgeConfigSpec.Builder builder) {
builder.push("spawn"); builder.push("explosion");
builder.comment("Set TRUE to allow Explosion to destroy blocks"); builder.comment("Set TRUE to allow Explosion to destroy blocks");
EXPLOSION_DESTROY = builder.define("explosion_destroy", false); EXPLOSION_DESTROY = builder.define("explosion_destroy", false);

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.entity; package com.atsuishio.superbwarfare.entity;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity; import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.init.*;
@ -53,7 +54,7 @@ public class Mk42Entity extends Entity 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);
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Mk42Entity.class, EntityDataSerializers.FLOAT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
public static final float MAX_HEALTH = 700.0f; public static final float MAX_HEALTH = CannonConfig.MK42_HP.get();
protected int interpolationSteps; protected int interpolationSteps;
protected double serverYRot; protected double serverYRot;
protected double serverXRot; protected double serverXRot;
@ -203,27 +204,27 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity {
this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.04, 0.0)); this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.04, 0.0));
} }
if (this.entityData.get(HEALTH) <= 300) { if (this.entityData.get(HEALTH) <= 0.4 * CannonConfig.MK42_HP.get()) {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false);
} }
} }
if (this.entityData.get(HEALTH) <= 200) { if (this.entityData.get(HEALTH) <= 0.25 * CannonConfig.MK42_HP.get()) {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false);
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false);
} }
} }
if (this.entityData.get(HEALTH) <= 150) { if (this.entityData.get(HEALTH) <= 0.15 * CannonConfig.MK42_HP.get()) {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false);
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false);
} }
} }
if (this.entityData.get(HEALTH) <= 100) { if (this.entityData.get(HEALTH) <= 0.1 * CannonConfig.MK42_HP.get()) {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false);
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false);
@ -281,18 +282,18 @@ public class Mk42Entity extends Entity implements GeoEntity, ICannonEntity {
int durability = 0; int durability = 0;
if (stack.is(ModItems.HE_5_INCHES.get())) { if (stack.is(ModItems.HE_5_INCHES.get())) {
hitDamage = 400; hitDamage = CannonConfig.MK42_HE_DAMAGE.get();
explosionRadius = 12; explosionRadius = CannonConfig.MK42_HE_EXPLOSION_RADIUS.get();
explosionDamage = 420; explosionDamage = CannonConfig.MK42_HE_EXPLOSION_DAMAGE.get();
fireProbability = 0.18F; fireProbability = 0.18F;
fireTime = 2; fireTime = 2;
durability = 1; durability = 1;
} }
if (stack.is(ModItems.AP_5_INCHES.get())) { if (stack.is(ModItems.AP_5_INCHES.get())) {
hitDamage = 800; hitDamage = CannonConfig.MK42_AP_DAMAGE.get();
explosionRadius = 3; explosionRadius = CannonConfig.MK42_AP_EXPLOSION_RADIUS.get();
explosionDamage = 200; explosionDamage = CannonConfig.MK42_AP_EXPLOSION_DAMAGE.get();
fireProbability = 0; fireProbability = 0;
fireTime = 0; fireTime = 0;
durability = 60; durability = 60;

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.entity; package com.atsuishio.superbwarfare.entity;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig; import com.atsuishio.superbwarfare.config.server.ExplosionDestroyConfig;
import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity; import com.atsuishio.superbwarfare.entity.projectile.CannonShellEntity;
import com.atsuishio.superbwarfare.init.*; import com.atsuishio.superbwarfare.init.*;
@ -56,7 +57,7 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.FLOAT); public static final EntityDataAccessor<Float> HEALTH = SynchedEntityData.defineId(Mle1934Entity.class, EntityDataSerializers.FLOAT);
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this); private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
public static final float MAX_HEALTH = 800.0f; public static final float MAX_HEALTH = CannonConfig.MLE1934_HP.get();
protected int interpolationSteps; protected int interpolationSteps;
protected double serverYRot; protected double serverYRot;
@ -210,27 +211,27 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.04, 0.0)); this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.04, 0.0));
} }
if (this.entityData.get(HEALTH) <= 300) { if (this.entityData.get(HEALTH) <= 0.4 * CannonConfig.MLE1934_HP.get()) {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false);
} }
} }
if (this.entityData.get(HEALTH) <= 200) { if (this.entityData.get(HEALTH) <= 0.25 * CannonConfig.MLE1934_HP.get()) {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false);
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false);
} }
} }
if (this.entityData.get(HEALTH) <= 150) { if (this.entityData.get(HEALTH) <= 0.15 * CannonConfig.MLE1934_HP.get()) {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false);
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 1, 0.75, 0.5, 0.75, 0.01, false);
} }
} }
if (this.entityData.get(HEALTH) <= 100) { if (this.entityData.get(HEALTH) <= 0.1 * CannonConfig.MLE1934_HP.get()) {
if (this.level() instanceof ServerLevel serverLevel) { if (this.level() instanceof ServerLevel serverLevel) {
ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.LARGE_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false);
ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false); ParticleTool.sendParticle(serverLevel, ParticleTypes.CAMPFIRE_COSY_SMOKE, this.getX(), this.getY() + 2.5, this.getZ(), 2, 0.75, 0.5, 0.75, 0.01, false);
@ -289,9 +290,9 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
boolean salvoShoot = false; boolean salvoShoot = false;
if (stack.is(ModItems.HE_5_INCHES.get())) { if (stack.is(ModItems.HE_5_INCHES.get())) {
hitDamage = 450; hitDamage = CannonConfig.MLE1934_HE_DAMAGE.get();
explosionRadius = 13; explosionRadius = CannonConfig.MLE1934_HE_EXPLOSION_RADIUS.get();
explosionDamage = 480; explosionDamage = CannonConfig.MLE1934_HE_EXPLOSION_DAMAGE.get();
fireProbability = 0.24F; fireProbability = 0.24F;
fireTime = 5; fireTime = 5;
durability = 1; durability = 1;
@ -299,9 +300,9 @@ public class Mle1934Entity extends Entity implements GeoEntity, ICannonEntity {
} }
if (stack.is(ModItems.AP_5_INCHES.get())) { if (stack.is(ModItems.AP_5_INCHES.get())) {
hitDamage = 900; hitDamage = CannonConfig.MLE1934_AP_DAMAGE.get();
explosionRadius = 3.8f; explosionRadius = CannonConfig.MLE1934_AP_EXPLOSION_RADIUS.get();
explosionDamage = 220; explosionDamage = CannonConfig.MLE1934_AP_EXPLOSION_DAMAGE.get();
fireProbability = 0; fireProbability = 0;
fireTime = 0; fireTime = 0;
durability = 70; durability = 70;

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.entity.layer; package com.atsuishio.superbwarfare.entity.layer;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.entity.Mk42Entity; import com.atsuishio.superbwarfare.entity.Mk42Entity;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
@ -24,7 +25,7 @@ public class Mk42DamageLayer extends GeoRenderLayer<Mk42Entity> {
@Override @Override
public void render(PoseStack poseStack, Mk42Entity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) { 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); RenderType glowRenderType = RenderType.entityTranslucent(LAYER);
float heal = Mth.clamp((300 - animatable.getEntityData().get(Mk42Entity.HEALTH)) * 0.0033f, 0.1f, 1); float heal = Mth.clamp((0.3f * CannonConfig.MK42_HP.get() - animatable.getEntityData().get(Mk42Entity.HEALTH)) * 0.000007f * CannonConfig.MK42_HP.get(), 0.1f, 1);
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 1, 1, 1, heal); getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 1, 1, 1, heal);
} }
} }

View file

@ -1,6 +1,8 @@
package com.atsuishio.superbwarfare.entity.layer; package com.atsuishio.superbwarfare.entity.layer;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.CannonConfig;
import com.atsuishio.superbwarfare.entity.Mk42Entity;
import com.atsuishio.superbwarfare.entity.Mle1934Entity; import com.atsuishio.superbwarfare.entity.Mle1934Entity;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer; import com.mojang.blaze3d.vertex.VertexConsumer;
@ -23,7 +25,7 @@ public class Mle1934DamageLayer extends GeoRenderLayer<Mle1934Entity> {
@Override @Override
public void render(PoseStack poseStack, Mle1934Entity animatable, BakedGeoModel bakedModel, RenderType renderType, MultiBufferSource bufferSource, VertexConsumer buffer, float partialTick, int packedLight, int packedOverlay) { 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); RenderType glowRenderType = RenderType.entityTranslucent(LAYER);
float heal = Mth.clamp((300 - animatable.getEntityData().get(Mle1934Entity.HEALTH)) * 0.0033f,0.1f,1); float heal = Mth.clamp((0.3f * CannonConfig.MLE1934_HP.get() - animatable.getEntityData().get(Mk42Entity.HEALTH)) * 0.000007f * CannonConfig.MLE1934_HP.get(), 0.1f, 1);
getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 1, 1, 1, heal); getRenderer().reRender(getDefaultBakedModel(animatable), poseStack, bufferSource, animatable, glowRenderType, bufferSource.getBuffer(glowRenderType), partialTick, packedLight, OverlayTexture.NO_OVERLAY, 1, 1, 1, heal);
} }
} }

View file

@ -1,6 +1,7 @@
package com.atsuishio.superbwarfare.tools; package com.atsuishio.superbwarfare.tools;
import com.atsuishio.superbwarfare.ModUtils; import com.atsuishio.superbwarfare.ModUtils;
import com.atsuishio.superbwarfare.config.server.ExplosionConfig;
import com.atsuishio.superbwarfare.network.message.ShakeClientMessage; import com.atsuishio.superbwarfare.network.message.ShakeClientMessage;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
@ -170,7 +171,7 @@ public class CustomExplosion extends Explosion {
xDistance /= distance; xDistance /= distance;
yDistance /= distance; yDistance /= distance;
zDistance /= distance; zDistance /= distance;
double seenPercent = Mth.clamp(getSeenPercent(position, entity), 0.125, Double.POSITIVE_INFINITY); double seenPercent = Mth.clamp(getSeenPercent(position, entity), 0.01 * ExplosionConfig.EXPLOSION_PENETRATION_RATIO.get(), Double.POSITIVE_INFINITY);
double damagePercent = (1.0D - distanceRate) * seenPercent; double damagePercent = (1.0D - distanceRate) * seenPercent;
double damageFinal = (damagePercent * damagePercent + damagePercent) / 2.0D * damage; double damageFinal = (damagePercent * damagePercent + damagePercent) / 2.0D * damage;