添加空尖弹
This commit is contained in:
parent
01bb152447
commit
b87ed700cc
7 changed files with 33 additions and 0 deletions
|
@ -34,6 +34,7 @@ import net.minecraft.world.entity.Entity;
|
|||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.MobType;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -95,6 +96,8 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
private boolean zoom = false;
|
||||
private float bypassArmorRate = 0.0f;
|
||||
private float undeadMultiple = 1.0f;
|
||||
private boolean jhpBullet = false;
|
||||
private float jhpLevel = 0f;
|
||||
private Supplier<MobEffectInstance> mobEffect = () -> null;
|
||||
|
||||
public ProjectileEntity(EntityType<? extends ProjectileEntity> p_i50159_1_, Level p_i50159_2_) {
|
||||
|
@ -475,6 +478,10 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
this.damage *= this.undeadMultiple;
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity living && jhpBullet) {
|
||||
this.damage *= (1.0f + 0.12f * jhpLevel) * ((float)(10 / (living.getAttributeValue(Attributes.ARMOR) + 10)) + 0.25f);
|
||||
}
|
||||
|
||||
if (headshot) {
|
||||
if (!this.shooter.level().isClientSide() && this.shooter instanceof ServerPlayer player) {
|
||||
var holder = Holder.direct(ModSounds.HEADSHOT.get());
|
||||
|
@ -755,6 +762,16 @@ public class ProjectileEntity extends Entity implements IEntityAdditionalSpawnDa
|
|||
return this;
|
||||
}
|
||||
|
||||
public ProjectileEntity jhpBullet() {
|
||||
this.jhpBullet = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProjectileEntity jhpLevel(float jhpLevel) {
|
||||
this.jhpLevel = jhpLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProjectileEntity zoom(boolean zoom) {
|
||||
this.zoom = zoom;
|
||||
return this;
|
||||
|
|
|
@ -232,6 +232,10 @@ public class GunEventHandler {
|
|||
projectile.undeadMultiple(1.0f + 0.5f * level);
|
||||
} else if (perk == ModPerks.BEAST_BULLET.get()) {
|
||||
projectile.beast();
|
||||
} else if (perk == ModPerks.JHP_BULLET.get()) {
|
||||
int level = PerkHelper.getItemPerkLevel(perk, heldItem);
|
||||
projectile.jhpBullet();
|
||||
projectile.jhpLevel(level);
|
||||
}
|
||||
|
||||
var dmgPerk = PerkHelper.getPerkByType(heldItem, Perk.Type.DAMAGE);
|
||||
|
|
|
@ -30,6 +30,8 @@ public class ModPerks {
|
|||
|
||||
public static final RegistryObject<Perk> AP_BULLET = AMMO_PERKS.register("ap_bullet",
|
||||
() -> new AmmoPerk(new AmmoPerk.Builder("ap_bullet", Perk.Type.AMMO).bypassArmorRate(0.4f).rgb(230, 0, 0)));
|
||||
public static final RegistryObject<Perk> JHP_BULLET = AMMO_PERKS.register("jhp_bullet",
|
||||
() -> new AmmoPerk(new AmmoPerk.Builder("jhp_bullet", Perk.Type.AMMO).bypassArmorRate(-0.2f).rgb(230, 131, 65)));
|
||||
public static final RegistryObject<Perk> SILVER_BULLET = AMMO_PERKS.register("silver_bullet",
|
||||
() -> new AmmoPerk(new AmmoPerk.Builder("silver_bullet", Perk.Type.AMMO).bypassArmorRate(0.05f).rgb(87, 166, 219)));
|
||||
public static final RegistryObject<Perk> POISONOUS_BULLET = AMMO_PERKS.register("poisonous_bullet",
|
||||
|
|
|
@ -219,6 +219,8 @@
|
|||
"des.superbwarfare.curse_flame_bullet": "命中后会使目标受到咒火效果",
|
||||
"item.superbwarfare.longer_wire": "Longer Wire",
|
||||
"des.superbwarfare.longer_wire": "Increases the range of Taser Gun",
|
||||
"item.superbwarfare.jhp_bullet": "JHP Bullet",
|
||||
"des.superbwarfare.jhp_bullet": "增加对低护甲目标的伤害",
|
||||
|
||||
"item.superbwarfare.heal_clip": "Heal Clip",
|
||||
"des.superbwarfare.heal_clip": "Reloading after dealing a final blow will heal you and your nearby allies",
|
||||
|
|
|
@ -219,6 +219,8 @@
|
|||
"des.superbwarfare.curse_flame_bullet": "命中后会使目标受到咒火效果",
|
||||
"item.superbwarfare.longer_wire": "延长导线",
|
||||
"des.superbwarfare.longer_wire": "增加泰瑟枪的射程",
|
||||
"item.superbwarfare.jhp_bullet": "空尖弹",
|
||||
"des.superbwarfare.jhp_bullet": "增加对低护甲目标的伤害",
|
||||
|
||||
"item.superbwarfare.heal_clip": "治疗弹匣",
|
||||
"des.superbwarfare.heal_clip": "最后一击后短时间内填装,可治疗自身和附近队友",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/perk/jhp_bullet"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Add table
Reference in a new issue