diff --git a/src/main/java/noppes/npcs/DataStats.java b/src/main/java/noppes/npcs/DataStats.java index d1e9c8df6..e860694ea 100644 --- a/src/main/java/noppes/npcs/DataStats.java +++ b/src/main/java/noppes/npcs/DataStats.java @@ -49,9 +49,12 @@ public class DataStats { public ScriptParticle pCustom = new ScriptParticle(""); public int pEffAmp = 0; public String fireSound = "random.bow"; + public boolean onSoundBegin = false; + public boolean playBurstSound = true; // Internal Only public byte aimType = 0; public boolean projectilesKeepTerrain = false; + public EnumCreatureAttribute creatureType = EnumCreatureAttribute.UNDEFINED; private EntityNPCInterface npc; @@ -110,6 +113,7 @@ public class DataStats { compound.setInteger("pTrail", pTrail.ordinal()); compound.setInteger("pEffAmp", pEffAmp); compound.setString("FiringSound", fireSound); + compound.setBoolean("FiringSoundBegin", onSoundBegin); compound.setByte("AimType", aimType); compound.setBoolean("ProjectilesKeepTerrain", projectilesKeepTerrain); if(pTrail == EnumParticleType.Custom) @@ -178,6 +182,7 @@ public class DataStats { pTrail = EnumParticleType.values()[compound.getInteger("pTrail") % EnumParticleType.values().length]; pEffAmp = compound.getInteger("pEffAmp"); fireSound = compound.getString("FiringSound"); + onSoundBegin = compound.getBoolean("FiringSoundBegin"); aimType = compound.getByte("AimType"); projectilesKeepTerrain = compound.getBoolean("ProjectilesKeepTerrain"); if(pTrail == EnumParticleType.Custom) diff --git a/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java b/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java index 00c2eaaac..97cdc1df2 100644 --- a/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java +++ b/src/main/java/noppes/npcs/ai/EntityAIRangedAttack.java @@ -112,6 +112,9 @@ public class EntityAIRangedAttack extends EntityAIBase { if (this.rangedAttackTime <= 0) { if (var1 <= (double) field_82642_h && (this.entityHost.getEntitySenses().canSee(this.attackTarget) || this.entityHost.ais.canFireIndirect == 2)) { + if (this.field_70846_g == 0) { + this.entityHost.stats.playBurstSound = true; + } if (this.field_70846_g++ <= this.entityHost.stats.burstCount) { this.rangedAttackTime = this.entityHost.stats.fireRate; this.isShooting = true; diff --git a/src/main/java/noppes/npcs/client/gui/SubGuiNpcRangeProperties.java b/src/main/java/noppes/npcs/client/gui/SubGuiNpcRangeProperties.java index bfe68f168..52bcda535 100644 --- a/src/main/java/noppes/npcs/client/gui/SubGuiNpcRangeProperties.java +++ b/src/main/java/noppes/npcs/client/gui/SubGuiNpcRangeProperties.java @@ -61,6 +61,9 @@ public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfi addLabel(new GuiNpcLabel(7, "stats.firesound:", guiLeft + 5, y + 5)); addButton(new GuiNpcButton(7, guiLeft + 187, y, 60, 20, "gui.select")); + addButton(new GuiNpcButton(10, guiLeft + 100, y += 22, 70, 20, new String[]{"stats.onShot", "stats.onStart"}, stats.onSoundBegin ? 1 : 0)); + addLabel(new GuiNpcLabel(10, "stats.firesound:", guiLeft + 5, y + 5)); + addButton(new GuiNpcButton(9, guiLeft + 100, y += 22, 70, 20, new String[]{"gui.no", "gui.yes", "stats.onShot"}, stats.aimType)); addLabel(new GuiNpcLabel(9, "stats.aimWhileShooting", guiLeft + 5, y + 5)); @@ -104,6 +107,9 @@ public class SubGuiNpcRangeProperties extends SubGuiInterface implements ITextfi soundSelected = getTextField(7); setSubGui(new GuiSoundSelection(soundSelected.getText())); } + if(id == 10){ + stats.onSoundBegin = ((GuiNpcButton) guibutton).getValue() == 1; + } if (id == 66) { close(); } else if (id == 9) { diff --git a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java index 09853272a..12f526f51 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCInterface.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCInterface.java @@ -682,7 +682,11 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti EntityProjectile projectile = shoot(entity, stats.accuracy, proj, f == 1); projectile.damage = event.getDamage(); } - this.playSound(this.stats.fireSound, 2.0F, 1.0f); + + if (this.stats.playBurstSound || !this.stats.onSoundBegin) { + this.playSound(this.stats.fireSound, 1.5F, 1.0f); + this.stats.playBurstSound = false; + } } } diff --git a/src/main/resources/assets/customnpcs/lang/en_US.lang b/src/main/resources/assets/customnpcs/lang/en_US.lang index c4d02bfff..d54546377 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.onStart=On Start stats.burnItem=Burn Item ai.standing=Standing