添加镇暴弹
This commit is contained in:
parent
2fc8343b9c
commit
188c87a30c
8 changed files with 82 additions and 0 deletions
|
@ -38,6 +38,8 @@ import net.minecraft.world.entity.EntityType;
|
|||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.ai.attributes.Attributes;
|
||||
import net.minecraft.world.entity.monster.Monster;
|
||||
import net.minecraft.world.entity.monster.Ravager;
|
||||
import net.minecraft.world.entity.monster.Vex;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.entity.projectile.Projectile;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -94,6 +96,8 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
|||
private boolean zoom = false;
|
||||
private float bypassArmorRate = 0.0f;
|
||||
private float undeadMultiple = 1.0f;
|
||||
private float illagerMultiple = 1.0f;
|
||||
private int riotLevel = 0;
|
||||
private int jhpLevel = 0;
|
||||
private int heLevel = 0;
|
||||
private int fireLevel = 0;
|
||||
|
@ -339,6 +343,7 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
|||
this.legShot = tag.getFloat("LegShot");
|
||||
this.bypassArmorRate = tag.getFloat("BypassArmorRate");
|
||||
this.undeadMultiple = tag.getFloat("UndeadMultiple");
|
||||
this.illagerMultiple = tag.getFloat("illagerMultiple");
|
||||
this.knockback = tag.getFloat("Knockback");
|
||||
|
||||
this.beast = tag.getBoolean("Beast");
|
||||
|
@ -357,6 +362,7 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
|||
tag.putFloat("LegShot", this.legShot);
|
||||
tag.putFloat("BypassArmorRate", this.bypassArmorRate);
|
||||
tag.putFloat("UndeadMultiple", this.undeadMultiple);
|
||||
tag.putFloat("illagerMultiple", this.illagerMultiple);
|
||||
tag.putFloat("Knockback", this.knockback);
|
||||
|
||||
tag.putBoolean("Beast", this.beast);
|
||||
|
@ -517,6 +523,15 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
|||
this.damage *= this.undeadMultiple;
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity living && (living.getType().is(EntityTypeTags.ILLAGER) || living instanceof Vex || living instanceof Ravager)) {
|
||||
this.damage *= this.illagerMultiple;
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity living && riotLevel > 0 && !entity.level().isClientSide()) {
|
||||
living.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SLOWDOWN, 20 + riotLevel * 10, (int) (riotLevel * 0.25), false, false), this.shooter);
|
||||
living.addEffect(new MobEffectInstance(MobEffects.WEAKNESS, 20 + riotLevel * 10, (int) (riotLevel * 0.25), false, false), this.shooter);
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity living && jhpLevel > 0) {
|
||||
this.damage *= (1.0f + 0.12f * jhpLevel) * ((float) (10 / (living.getAttributeValue(Attributes.ARMOR) + 10)) + 0.25f);
|
||||
}
|
||||
|
@ -850,6 +865,11 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
|||
return this;
|
||||
}
|
||||
|
||||
public ProjectileEntity riotBullet(int riotLevel) {
|
||||
this.riotLevel = riotLevel;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProjectileEntity jhpBullet(int jhpLevel) {
|
||||
this.jhpLevel = jhpLevel;
|
||||
return this;
|
||||
|
@ -881,6 +901,11 @@ public class ProjectileEntity extends Projectile implements IEntityWithComplexSp
|
|||
return this;
|
||||
}
|
||||
|
||||
public ProjectileEntity illagerMultiple(float illagerMultiple) {
|
||||
this.illagerMultiple = illagerMultiple;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ProjectileEntity effect(ArrayList<MobEffectInstance> mobEffectInstances) {
|
||||
this.mobEffects.addAll(mobEffectInstances);
|
||||
return this;
|
||||
|
|
|
@ -45,6 +45,7 @@ public class ModPerks {
|
|||
public static final DeferredHolder<Perk, IncendiaryBullet> INCENDIARY_BULLET = AMMO_PERKS.register("incendiary_bullet", IncendiaryBullet::new);
|
||||
public static final DeferredHolder<Perk, MicroMissile> MICRO_MISSILE = AMMO_PERKS.register("micro_missile", MicroMissile::new);
|
||||
public static final DeferredHolder<Perk, CupidArrow> CUPID_ARROW = AMMO_PERKS.register("cupid_arrow", CupidArrow::new);
|
||||
public static final DeferredHolder<Perk, RiotBullet> RIOT_BULLET = AMMO_PERKS.register("riot_bullet", RiotBullet::new);
|
||||
|
||||
/**
|
||||
* Functional Perks
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package com.atsuishio.superbwarfare.perk.ammo;
|
||||
|
||||
import com.atsuishio.superbwarfare.data.gun.GunData;
|
||||
import com.atsuishio.superbwarfare.entity.projectile.ProjectileEntity;
|
||||
import com.atsuishio.superbwarfare.perk.AmmoPerk;
|
||||
import com.atsuishio.superbwarfare.perk.PerkInstance;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
|
||||
public class RiotBullet extends AmmoPerk {
|
||||
|
||||
public RiotBullet() {
|
||||
super(new Builder("riot_bullet", Type.AMMO).bypassArmorRate(-0.3f).damageRate(0.9f).speedRate(0.8f).slug(true).rgb(70, 35, 230));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyProjectile(GunData data, PerkInstance instance, Entity entity) {
|
||||
super.modifyProjectile(data, instance, entity);
|
||||
if (!(entity instanceof ProjectileEntity projectile)) return;
|
||||
projectile.riotBullet(instance.level());
|
||||
projectile.illagerMultiple(1.0f + 0.5f * instance.level());
|
||||
}
|
||||
}
|
|
@ -351,6 +351,8 @@
|
|||
"des.superbwarfare.micro_missile": "Fires a high-speed projectile without gravity.",
|
||||
"item.superbwarfare.cupid_arrow": "Cupid's Arrow",
|
||||
"des.superbwarfare.cupid_arrow": "Make the target fall in love after being hit. Deals no damage to living entities.",
|
||||
"item.superbwarfare.riot_bullet": "Riot Bullet",
|
||||
"des.superbwarfare.riot_bullet": "Adds slowness and weakness on the target after hitting, deals extra damage to illager entities.",
|
||||
|
||||
"item.superbwarfare.heal_clip": "Heal Clip",
|
||||
"des.superbwarfare.heal_clip": "Reloading after defeating a mob will heal you and your nearby allies.",
|
||||
|
|
|
@ -351,6 +351,8 @@
|
|||
"des.superbwarfare.micro_missile": "使武器发射无视重力前进的高速弹药",
|
||||
"item.superbwarfare.cupid_arrow": "丘比特之箭",
|
||||
"des.superbwarfare.cupid_arrow": "命中后会使目标坠入爱河,不会对生物造成伤害",
|
||||
"item.superbwarfare.riot_bullet": "镇暴弹",
|
||||
"des.superbwarfare.riot_bullet": "命中后会使目标减速、虚弱,对刁民造成额外伤害",
|
||||
|
||||
"item.superbwarfare.heal_clip": "治疗弹匣",
|
||||
"des.superbwarfare.heal_clip": "最后一击后短时间内填装,可治疗自身和附近队友",
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"parent": "item/generated",
|
||||
"textures": {
|
||||
"layer0": "superbwarfare:item/perk/riot_bullet"
|
||||
}
|
||||
}
|
Binary file not shown.
After Width: | Height: | Size: 921 B |
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "equipment",
|
||||
"pattern": [
|
||||
"cbc",
|
||||
"bab",
|
||||
"cbc"
|
||||
],
|
||||
"key": {
|
||||
"a": {
|
||||
"item": "superbwarfare:empty_perk"
|
||||
},
|
||||
"b": {
|
||||
"item": "minecraft:slime_block"
|
||||
},
|
||||
"c": {
|
||||
"item": "minecraft:cobweb"
|
||||
}
|
||||
},
|
||||
"result": {
|
||||
"id": "superbwarfare:riot_bullet",
|
||||
"count": 1
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue