From 353d90a00a9a7041aaad922249392a4370bfec00 Mon Sep 17 00:00:00 2001 From: Kam Date: Wed, 19 Mar 2025 17:46:12 -0400 Subject: [PATCH] Add Item Burning to Fire Attacks --- src/main/java/noppes/npcs/DataStats.java | 10 +++++++--- .../noppes/npcs/client/gui/SubGuiNpcProjectiles.java | 12 ++++++++++-- .../java/noppes/npcs/entity/EntityProjectile.java | 5 +++-- src/main/resources/assets/customnpcs/lang/en_US.lang | 1 + 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main/java/noppes/npcs/DataStats.java b/src/main/java/noppes/npcs/DataStats.java index 78cdacf50..d1e9c8df6 100644 --- a/src/main/java/noppes/npcs/DataStats.java +++ b/src/main/java/noppes/npcs/DataStats.java @@ -43,7 +43,7 @@ public class DataStats { public float pDamage = 4; public int pImpact = 0, pSize = 5, pSpeed = 10, pArea = 0, pDur = 5; public boolean pPhysics = true, pXlr8 = false, pGlows = false, pExplode = false; - public boolean pRender3D = false, pSpin = false, pStick = false; + public boolean pRender3D = false, pSpin = false, pStick = false, pBurnItem = false; public EnumPotionType pEffect = EnumPotionType.None; public EnumParticleType pTrail = EnumParticleType.None; public ScriptParticle pCustom = new ScriptParticle(""); @@ -114,6 +114,8 @@ public class DataStats { compound.setBoolean("ProjectilesKeepTerrain", projectilesKeepTerrain); if(pTrail == EnumParticleType.Custom) compound.setTag("pCustom", pCustom.writeToNBT()); + if(pEffect == EnumPotionType.Fire) + compound.setBoolean("pBurnItem", pBurnItem); compound.setBoolean("ImmuneToFire", immuneToFire); compound.setBoolean("PotionImmune", potionImmune); @@ -178,9 +180,11 @@ public class DataStats { fireSound = compound.getString("FiringSound"); aimType = compound.getByte("AimType"); projectilesKeepTerrain = compound.getBoolean("ProjectilesKeepTerrain"); - if(pTrail == EnumParticleType.Custom){ + if(pTrail == EnumParticleType.Custom) pCustom = ScriptParticle.fromNBT(compound.getCompoundTag("pCustom")); - } + if(pEffect == EnumPotionType.Fire) + pBurnItem = compound.getBoolean("pBurnItem"); + immuneToFire = compound.getBoolean("ImmuneToFire"); potionImmune = compound.getBoolean("PotionImmune"); drowningType = compound.getInteger("DrowningType"); diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcProjectiles.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcProjectiles.java index 40b8afe72..791400238 100644 --- a/src/main/java/noppes/npcs/client/gui/SubGuiNpcProjectiles.java +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcProjectiles.java @@ -74,13 +74,17 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL if (stats.pEffect != EnumPotionType.None) { int internalY = y + 30; addLabel(new GuiNpcLabel(50, "gui.time", guiLeft + 210, internalY + 5)); - addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 280, internalY, 40, 20, stats.potionDuration + "")); + addTextField(new GuiNpcTextField(5, this, fontRendererObj, guiLeft + 330, internalY, 52, 20, stats.potionDuration + "")); getTextField(5).integersOnly = true; getTextField(5).setMinMaxDefault(1, Integer.MAX_VALUE, 5); - if (stats.potionType != EnumPotionType.Fire) { + if (stats.pEffect != EnumPotionType.Fire) { internalY += 30; addLabel(new GuiNpcLabel(70, "stats.amplify", guiLeft + 210, internalY + 5)); addButton(new GuiButtonBiDirectional(10, guiLeft + 280, internalY, 52, 20, new String[]{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}, stats.pEffAmp)); + } else { + internalY += 30; + addLabel(new GuiNpcLabel(100, "stats.burnItem", guiLeft + 210, internalY + 5)); + addButton(new GuiNpcButtonYesNo(100, guiLeft + 330, internalY, 52, 20, stats.pBurnItem)); } } @@ -161,6 +165,10 @@ public class SubGuiNpcProjectiles extends SubGuiInterface implements ITextfieldL if (button.id == 10) { stats.pEffAmp = button.getValue(); } + if (button.id == 100) { + stats.pBurnItem = (button.getValue() == 1); + initGui(); + } if (button.id == 66) { close(); } diff --git a/src/main/java/noppes/npcs/entity/EntityProjectile.java b/src/main/java/noppes/npcs/entity/EntityProjectile.java index 29449e404..648448040 100644 --- a/src/main/java/noppes/npcs/entity/EntityProjectile.java +++ b/src/main/java/noppes/npcs/entity/EntityProjectile.java @@ -90,6 +90,7 @@ public class EntityProjectile extends EntityThrowable { public boolean destroyTerrain = true; public int explosiveRadius = 0; public EnumPotionType effect = EnumPotionType.None; + public boolean burnItem = true; public int duration = 5; public int amplify = 0; public int accuracy = 60; @@ -235,10 +236,9 @@ public class EntityProjectile extends EntityThrowable { this.rotationPitch -= 20; } } - if (this.effect == EnumPotionType.Fire && !this.inGround) + if (this.effect == EnumPotionType.Fire && !this.inGround && this.burnItem) this.setFire(1); - Block block = this.worldObj.getBlock(this.xTile, this.yTile, this.zTile); if ((this.isArrow() || this.sticksToWalls()) && block != null) { @@ -801,6 +801,7 @@ public class EntityProjectile extends EntityThrowable { this.explosive = stats.pExplode; this.explosiveRadius = stats.pArea; this.effect = stats.pEffect; + this.burnItem = stats.pBurnItem; this.duration = stats.pDur; this.amplify = stats.pEffAmp; this.setParticleEffect(stats.pTrail); diff --git a/src/main/resources/assets/customnpcs/lang/en_US.lang b/src/main/resources/assets/customnpcs/lang/en_US.lang index a8d264953..c4d02bfff 100644 --- a/src/main/resources/assets/customnpcs/lang/en_US.lang +++ b/src/main/resources/assets/customnpcs/lang/en_US.lang @@ -471,6 +471,7 @@ stats.regular=No Amp stats.amplified=Amp stats.explosion=Explosion stats.onShot=On Shot +stats.burnItem=Burn Item ai.standing=Standing ai.wandering=Wandering