From 188c87a30c0f56bf8ca720fbbc2cb715443a6d41 Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Thu, 19 Jun 2025 13:12:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=95=87=E6=9A=B4=E5=BC=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/projectile/ProjectileEntity.java | 25 ++++++++++++++++++ .../superbwarfare/init/ModPerks.java | 1 + .../superbwarfare/perk/ammo/RiotBullet.java | 22 +++++++++++++++ .../assets/superbwarfare/lang/en_us.json | 2 ++ .../assets/superbwarfare/lang/zh_cn.json | 2 ++ .../models/item/riot_bullet.json | 6 +++++ .../textures/item/perk/riot_bullet.png | Bin 0 -> 921 bytes .../perk/riot_bullet_perk_crafting.json | 24 +++++++++++++++++ 8 files changed, 82 insertions(+) create mode 100644 src/main/java/com/atsuishio/superbwarfare/perk/ammo/RiotBullet.java create mode 100644 src/main/resources/assets/superbwarfare/models/item/riot_bullet.json create mode 100644 src/main/resources/assets/superbwarfare/textures/item/perk/riot_bullet.png create mode 100644 src/main/resources/data/superbwarfare/recipe/perk/riot_bullet_perk_crafting.json diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java index 404946cce..6ebb96e9d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/ProjectileEntity.java @@ -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 mobEffectInstances) { this.mobEffects.addAll(mobEffectInstances); return this; diff --git a/src/main/java/com/atsuishio/superbwarfare/init/ModPerks.java b/src/main/java/com/atsuishio/superbwarfare/init/ModPerks.java index f2332bd5a..8f3d1157d 100644 --- a/src/main/java/com/atsuishio/superbwarfare/init/ModPerks.java +++ b/src/main/java/com/atsuishio/superbwarfare/init/ModPerks.java @@ -45,6 +45,7 @@ public class ModPerks { public static final DeferredHolder INCENDIARY_BULLET = AMMO_PERKS.register("incendiary_bullet", IncendiaryBullet::new); public static final DeferredHolder MICRO_MISSILE = AMMO_PERKS.register("micro_missile", MicroMissile::new); public static final DeferredHolder CUPID_ARROW = AMMO_PERKS.register("cupid_arrow", CupidArrow::new); + public static final DeferredHolder RIOT_BULLET = AMMO_PERKS.register("riot_bullet", RiotBullet::new); /** * Functional Perks diff --git a/src/main/java/com/atsuishio/superbwarfare/perk/ammo/RiotBullet.java b/src/main/java/com/atsuishio/superbwarfare/perk/ammo/RiotBullet.java new file mode 100644 index 000000000..c5e4f005b --- /dev/null +++ b/src/main/java/com/atsuishio/superbwarfare/perk/ammo/RiotBullet.java @@ -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()); + } +} diff --git a/src/main/resources/assets/superbwarfare/lang/en_us.json b/src/main/resources/assets/superbwarfare/lang/en_us.json index 4a4f0fcfe..4bc650518 100644 --- a/src/main/resources/assets/superbwarfare/lang/en_us.json +++ b/src/main/resources/assets/superbwarfare/lang/en_us.json @@ -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.", diff --git a/src/main/resources/assets/superbwarfare/lang/zh_cn.json b/src/main/resources/assets/superbwarfare/lang/zh_cn.json index f1bc3f714..28c55bb24 100644 --- a/src/main/resources/assets/superbwarfare/lang/zh_cn.json +++ b/src/main/resources/assets/superbwarfare/lang/zh_cn.json @@ -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": "最后一击后短时间内填装,可治疗自身和附近队友", diff --git a/src/main/resources/assets/superbwarfare/models/item/riot_bullet.json b/src/main/resources/assets/superbwarfare/models/item/riot_bullet.json new file mode 100644 index 000000000..54ed9fe6c --- /dev/null +++ b/src/main/resources/assets/superbwarfare/models/item/riot_bullet.json @@ -0,0 +1,6 @@ +{ + "parent": "item/generated", + "textures": { + "layer0": "superbwarfare:item/perk/riot_bullet" + } +} \ No newline at end of file diff --git a/src/main/resources/assets/superbwarfare/textures/item/perk/riot_bullet.png b/src/main/resources/assets/superbwarfare/textures/item/perk/riot_bullet.png new file mode 100644 index 0000000000000000000000000000000000000000..710d9d5a05b627515bd9850bbc5d5ceaf78dad0b GIT binary patch literal 921 zcmV;K17`e*P)9hz(@R%CjneJ1^|HddcE&0NDu6GyWu`G z#&LxG{`z>h3m4a@JOIGK0)}A#0Dzb8?@R-{|N45ko~Fr1s)|@F7Dw%Srk@H}`7e)u zONMKL-#oz$GaUU?kwulm{>naEZzTC<(Y!=r9EgnLc(_@rJSAYM3uxxh;Lp!b zhwEvYhM5JFsl!`BKVKD<6+j zGwr$)!1<~+N~he&8!Q1@U*k;OGKO{hfD#!4SOQL^+DpZhQY2j<#j@n{9s-tFfM)(A z0Xa%&@;FD5g}f#f5KyxH#C^E7CWCm%6rd(RJ1D1wwGfJnpHi75nA0FvrENFMqx>HC z%~76m1$@sVP0scLA3pyw4}yjB41(U{CienX!6vAfLcLZ_s1krzAQz3X^ZTEVggdYD~1)~2y0b} zyAps`l&k(iUoKX}ZSSmtQQZOn=-?OHaa^ECsSS4mIN`B!RA!KruSH5V3*b^0M}pM9 zCYrcF0CoOHReCK^g#ap7bLW6@KPi3ILK6$X%AS%XR3jiRdL*AueP25xmvUA_W&_L6bahOu*5>L zT|i4h=qqh;l~8v(rq=#AN{v41b$ddSfX vtJMnPABD~ch`+oB+*}}BoWs99Z>WGb<6;$Ik}4 literal 0 HcmV?d00001 diff --git a/src/main/resources/data/superbwarfare/recipe/perk/riot_bullet_perk_crafting.json b/src/main/resources/data/superbwarfare/recipe/perk/riot_bullet_perk_crafting.json new file mode 100644 index 000000000..66f150af2 --- /dev/null +++ b/src/main/resources/data/superbwarfare/recipe/perk/riot_bullet_perk_crafting.json @@ -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 + } +} \ No newline at end of file