修改投射物的爆炸逻辑
This commit is contained in:
parent
500125b807
commit
cde0d249dc
2 changed files with 11 additions and 9 deletions
|
@ -37,8 +37,8 @@ import software.bernie.geckolib.util.GeckoLibUtil;
|
||||||
public class GunGrenadeEntity extends ThrowableItemProjectile implements GeoEntity {
|
public class GunGrenadeEntity extends ThrowableItemProjectile implements GeoEntity {
|
||||||
private float monsterMultiplier = 0.0f;
|
private float monsterMultiplier = 0.0f;
|
||||||
private float damage = 40.0f;
|
private float damage = 40.0f;
|
||||||
private float explosion_damage = 80f;
|
private float explosionDamage = 80f;
|
||||||
private float explosion_radius = 5f;
|
private float explosionRadius = 5f;
|
||||||
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
private final AnimatableInstanceCache cache = GeckoLibUtil.createInstanceCache(this);
|
||||||
|
|
||||||
public GunGrenadeEntity(EntityType<? extends GunGrenadeEntity> type, Level world) {
|
public GunGrenadeEntity(EntityType<? extends GunGrenadeEntity> type, Level world) {
|
||||||
|
@ -46,11 +46,11 @@ public class GunGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
|
||||||
this.noCulling = true;
|
this.noCulling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GunGrenadeEntity(LivingEntity entity, Level level, float damage, float explosion_damage, float explosion_radius) {
|
public GunGrenadeEntity(LivingEntity entity, Level level, float damage, float explosionDamage, float explosionRadius) {
|
||||||
super(ModEntities.GUN_GRENADE.get(), entity, level);
|
super(ModEntities.GUN_GRENADE.get(), entity, level);
|
||||||
this.damage = damage;
|
this.damage = damage;
|
||||||
this.explosion_damage = explosion_damage;
|
this.explosionDamage = explosionDamage;
|
||||||
this.explosion_radius = explosion_radius;
|
this.explosionRadius = explosionRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GunGrenadeEntity(PlayMessages.SpawnEntity spawnEntity, Level level) {
|
public GunGrenadeEntity(PlayMessages.SpawnEntity spawnEntity, Level level) {
|
||||||
|
@ -105,7 +105,7 @@ public class GunGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
ProjectileTool.causeCustomExplode(this,
|
ProjectileTool.causeCustomExplode(this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
||||||
entity, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
|
entity, this.explosionDamage, this.explosionRadius, this.monsterMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ public class GunGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
ProjectileTool.causeCustomExplode(this,
|
ProjectileTool.causeCustomExplode(this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
||||||
this, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
|
this, this.explosionDamage, this.explosionRadius, this.monsterMultiplier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ public class GunGrenadeEntity extends ThrowableItemProjectile implements GeoEnti
|
||||||
if (this.level() instanceof ServerLevel) {
|
if (this.level() instanceof ServerLevel) {
|
||||||
ProjectileTool.causeCustomExplode(this,
|
ProjectileTool.causeCustomExplode(this,
|
||||||
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
ModDamageTypes.causeProjectileBoomDamage(this.level().registryAccess(), this, this.getOwner()),
|
||||||
this, this.explosion_damage, this.explosion_radius, this.monsterMultiplier);
|
this, this.explosionDamage, this.explosionRadius, this.monsterMultiplier);
|
||||||
}
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,8 +120,10 @@ public class MortarShellEntity extends ThrowableItemProjectile implements GeoEnt
|
||||||
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
|
bell.attemptToRing(this.level(), resultPos, blockHitResult.getDirection());
|
||||||
}
|
}
|
||||||
if (!this.level().isClientSide() && this.level() instanceof ServerLevel) {
|
if (!this.level().isClientSide() && this.level() instanceof ServerLevel) {
|
||||||
|
if (this.tickCount > 1) {
|
||||||
ProjectileTool.causeCustomExplode(this, this.damage, this.radius);
|
ProjectileTool.causeCustomExplode(this, this.damage, this.radius);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.discard();
|
this.discard();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue