注册面包弹
This commit is contained in:
parent
432421d8a2
commit
e35aaa5b64
5 changed files with 54 additions and 15 deletions
|
@ -100,11 +100,12 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
private boolean fireBullet = false;
|
||||
private int fireLevel = 0;
|
||||
private boolean dragonBreath = false;
|
||||
private double knockback = 0.05;
|
||||
private float knockback = 0.05f;
|
||||
private boolean forceKnockback = false;
|
||||
private final ArrayList<MobEffectInstance> mobEffects = new ArrayList<>();
|
||||
|
||||
public ProjectileEntity(EntityType<? extends ProjectileEntity> p_i50159_1_, Level p_i50159_2_) {
|
||||
super(p_i50159_1_, p_i50159_2_);
|
||||
public ProjectileEntity(EntityType<? extends ProjectileEntity> entityType, Level level) {
|
||||
super(entityType, level);
|
||||
this.noCulling = true;
|
||||
}
|
||||
|
||||
|
@ -112,8 +113,8 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
super(ModEntities.PROJECTILE.get(), level);
|
||||
}
|
||||
|
||||
public ProjectileEntity(PlayMessages.SpawnEntity packet, Level world) {
|
||||
super(ModEntities.PROJECTILE.get(), world);
|
||||
public ProjectileEntity(PlayMessages.SpawnEntity packet, Level level) {
|
||||
super(ModEntities.PROJECTILE.get(), level);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
@ -244,7 +245,6 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
public void tick() {
|
||||
super.tick();
|
||||
this.updateHeading();
|
||||
this.onProjectileTick();
|
||||
|
||||
Vec3 vec = this.getDeltaMovement();
|
||||
|
||||
|
@ -308,14 +308,31 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
}
|
||||
|
||||
@Override
|
||||
protected void readAdditionalSaveData(CompoundTag compoundTag) {
|
||||
protected void readAdditionalSaveData(CompoundTag tag) {
|
||||
this.damage = tag.getFloat("Damage");
|
||||
this.headShot = tag.getFloat("HeadShot");
|
||||
this.monsterMultiple = tag.getFloat("MonsterMultiple");
|
||||
this.legShot = tag.getFloat("LegShot");
|
||||
this.bypassArmorRate = tag.getFloat("BypassArmorRate");
|
||||
this.undeadMultiple = tag.getFloat("UndeadMultiple");
|
||||
this.knockback = tag.getFloat("Knockback");
|
||||
|
||||
this.beast = tag.getBoolean("Beast");
|
||||
this.forceKnockback = tag.getBoolean("ForceKnockback");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addAdditionalSaveData(CompoundTag compoundTag) {
|
||||
}
|
||||
protected void addAdditionalSaveData(CompoundTag tag) {
|
||||
tag.putFloat("Damage", this.damage);
|
||||
tag.putFloat("HeadShot", this.headShot);
|
||||
tag.putFloat("MonsterMultiple", this.monsterMultiple);
|
||||
tag.putFloat("LegShot", this.legShot);
|
||||
tag.putFloat("BypassArmorRate", this.bypassArmorRate);
|
||||
tag.putFloat("UndeadMultiple", this.undeadMultiple);
|
||||
tag.putFloat("Knockback", this.knockback);
|
||||
|
||||
protected void onProjectileTick() {
|
||||
tag.putBoolean("Beast", this.beast);
|
||||
tag.putBoolean("ForceKnockback", this.forceKnockback);
|
||||
}
|
||||
|
||||
private void onHit(HitResult result) {
|
||||
|
@ -549,10 +566,16 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
|
||||
public void performOnHit(Entity entity, float damage, boolean headshot, double knockback) {
|
||||
if (entity instanceof LivingEntity living) {
|
||||
ICustomKnockback iCustomKnockback = ICustomKnockback.getInstance(living);
|
||||
iCustomKnockback.superbWarfare$setKnockbackStrength(knockback);
|
||||
performDamage(entity, damage, headshot);
|
||||
iCustomKnockback.superbWarfare$resetKnockbackStrength();
|
||||
if (this.forceKnockback) {
|
||||
Vec3 vec3 = this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D).normalize();
|
||||
living.addDeltaMovement(vec3.scale(knockback));
|
||||
performDamage(entity, damage, headshot);
|
||||
} else {
|
||||
ICustomKnockback iCustomKnockback = ICustomKnockback.getInstance(living);
|
||||
iCustomKnockback.superbWarfare$setKnockbackStrength(knockback);
|
||||
performDamage(entity, damage, headshot);
|
||||
iCustomKnockback.superbWarfare$resetKnockbackStrength();
|
||||
}
|
||||
} else {
|
||||
performDamage(entity, damage, headshot);
|
||||
}
|
||||
|
@ -864,8 +887,13 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
this.entityData.set(COLOR_B, rgb[2]);
|
||||
}
|
||||
|
||||
public ProjectileEntity knockback(double knockback) {
|
||||
public ProjectileEntity knockback(float knockback) {
|
||||
this.knockback = knockback;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProjectileEntity forceKnockback() {
|
||||
this.forceKnockback = true;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -225,6 +225,11 @@ public class GunEventHandler {
|
|||
}
|
||||
projectile.effect(mobEffectInstances);
|
||||
}
|
||||
|
||||
if (perk.descriptionId.equals("bread_bullet")) {
|
||||
projectile.knockback(level * 0.3f);
|
||||
projectile.forceKnockback();
|
||||
}
|
||||
}
|
||||
|
||||
bypassArmorRate = Math.max(bypassArmorRate, 0);
|
||||
|
|
|
@ -77,6 +77,8 @@ public class ModPerks {
|
|||
if (ModList.get().isLoaded(CompatHolder.DMV)) {
|
||||
AMMO_PERKS.register("blade_bullet", () -> new AmmoPerk(new AmmoPerk.Builder("blade_bullet", Perk.Type.AMMO)
|
||||
.bypassArmorRate(-0.2f).damageRate(0.7f).speedRate(0.8f).rgb(0xB4, 0x4B, 0x88).mobEffect(() -> CompatHolder.DMV_BLEEDING)));
|
||||
AMMO_PERKS.register("bread_bullet", () -> new AmmoPerk(new AmmoPerk.Builder("bread_bullet", Perk.Type.AMMO)
|
||||
.bypassArmorRate(1.0f).damageRate(0.5f).speedRate(0.6f).rgb(0xde, 0xab, 0x82).mobEffect(() -> MobEffects.MOVEMENT_SLOWDOWN)));
|
||||
}
|
||||
if (ModList.get().isLoaded(CompatHolder.VRC)) {
|
||||
AMMO_PERKS.register("curse_flame_bullet", () -> new AmmoPerk(new AmmoPerk.Builder("curse_flame_bullet", Perk.Type.AMMO)
|
||||
|
|
|
@ -271,6 +271,8 @@
|
|||
"des.superbwarfare.incendiary_bullet": "The bullet will ignites the target after hitting the target",
|
||||
"item.superbwarfare.butterfly_bullet": "Butterfly Bullet",
|
||||
"des.superbwarfare.butterfly_bullet": "Replace the bullet with Rain Shower Butterfly",
|
||||
"item.superbwarfare.bread_bullet": "Bread Bullet",
|
||||
"des.superbwarfare.bread_bullet": "命中后会使目标移速下降,并造成强大的击退",
|
||||
|
||||
"item.superbwarfare.heal_clip": "Heal Clip",
|
||||
"des.superbwarfare.heal_clip": "Reloading after dealing a final blow will heal you and your nearby allies",
|
||||
|
|
|
@ -270,6 +270,8 @@
|
|||
"des.superbwarfare.incendiary_bullet": "子弹在命中后点燃目标",
|
||||
"item.superbwarfare.butterfly_bullet": "蝴蝶弹",
|
||||
"des.superbwarfare.butterfly_bullet": "将子弹替换成骤雨之蝶",
|
||||
"item.superbwarfare.bread_bullet": "面包弹",
|
||||
"des.superbwarfare.bread_bullet": "命中后会使目标移速下降,并造成强大的击退",
|
||||
|
||||
"item.superbwarfare.heal_clip": "治疗弹匣",
|
||||
"des.superbwarfare.heal_clip": "最后一击后短时间内填装,可治疗自身和附近队友",
|
||||
|
|
Loading…
Add table
Reference in a new issue