From ec0ca4a2f2f43842fd35c7da7bc7df4584f0a6da Mon Sep 17 00:00:00 2001 From: fullwall Date: Wed, 29 Jan 2014 21:37:27 +0800 Subject: [PATCH] Add /npc sound --- .../citizensnpcs/commands/NPCCommands.java | 50 +++++++++++++++++-- .../npc/entity/BatController.java | 15 ++++++ .../npc/entity/BlazeController.java | 15 ++++++ .../npc/entity/CaveSpiderController.java | 16 +++++- .../npc/entity/ChickenController.java | 15 ++++++ .../npc/entity/CowController.java | 15 ++++++ .../npc/entity/CreeperController.java | 15 ++++++ .../npc/entity/EnderDragonController.java | 15 ++++++ .../npc/entity/EndermanController.java | 15 ++++++ .../npc/entity/GhastController.java | 15 ++++++ .../npc/entity/GiantController.java | 15 ++++++ .../npc/entity/HorseController.java | 15 ++++++ .../npc/entity/IronGolemController.java | 15 ++++++ .../npc/entity/MagmaCubeController.java | 15 ++++++ .../npc/entity/MushroomCowController.java | 15 ++++++ .../npc/entity/OcelotController.java | 15 ++++++ .../npc/entity/PigController.java | 15 ++++++ .../npc/entity/PigZombieController.java | 15 ++++++ .../npc/entity/SheepController.java | 15 ++++++ .../npc/entity/SilverfishController.java | 15 ++++++ .../npc/entity/SkeletonController.java | 15 ++++++ .../npc/entity/SlimeController.java | 15 ++++++ .../npc/entity/SnowmanController.java | 15 ++++++ .../npc/entity/SpiderController.java | 15 ++++++ .../npc/entity/SquidController.java | 15 ++++++ .../npc/entity/VillagerController.java | 15 ++++++ .../npc/entity/WitchController.java | 15 ++++++ .../npc/entity/WitherController.java | 15 ++++++ .../npc/entity/WolfController.java | 15 ++++++ .../npc/entity/ZombieController.java | 15 ++++++ 30 files changed, 482 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/citizensnpcs/commands/NPCCommands.java b/src/main/java/net/citizensnpcs/commands/NPCCommands.java index 0fced6ab3..5b83090e7 100644 --- a/src/main/java/net/citizensnpcs/commands/NPCCommands.java +++ b/src/main/java/net/citizensnpcs/commands/NPCCommands.java @@ -265,7 +265,7 @@ public class NPCCommands { } CommandSenderCreateNPCEvent event = sender instanceof Player ? new PlayerCreateNPCEvent((Player) sender, copy) - : new CommandSenderCreateNPCEvent(sender, copy); + : new CommandSenderCreateNPCEvent(sender, copy); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { event.getNPC().destroy(); @@ -337,7 +337,7 @@ public class NPCCommands { spawnLoc = args.getSenderLocation(); } CommandSenderCreateNPCEvent event = sender instanceof Player ? new PlayerCreateNPCEvent((Player) sender, npc) - : new CommandSenderCreateNPCEvent(sender, npc); + : new CommandSenderCreateNPCEvent(sender, npc); Bukkit.getPluginManager().callEvent(event); if (event.isCancelled()) { npc.destroy(); @@ -969,7 +969,7 @@ public class NPCCommands { @Requirements(selected = true, ownership = true, types = { EntityType.CREEPER }) public void power(CommandContext args, CommandSender sender, NPC npc) { Messaging - .sendTr(sender, npc.getTrait(Powered.class).toggle() ? Messages.POWERED_SET : Messages.POWERED_STOPPED); + .sendTr(sender, npc.getTrait(Powered.class).toggle() ? Messages.POWERED_SET : Messages.POWERED_STOPPED); } @Command( @@ -1139,6 +1139,50 @@ public class NPCCommands { Messaging.sendTr(sender, Messages.SIZE_SET, npc.getName(), size); } + @Command( + aliases = { "npc" }, + usage = "sound (--death [death sound|d]) (--ambient [ambient sound|d]) (--hurt [hurt sound|d]) (-n(one)) (-d(efault))", + desc = "Sets an NPC's played sounds", + modifiers = { "sound" }, + flags = "dn", + min = 1, + max = 1, + permission = "citizens.npc.sound") + @Requirements(selected = true, ownership = true, livingEntity = true, excludedTypes = { EntityType.PLAYER }) + public void sound(CommandContext args, CommandSender sender, NPC npc) throws CommandException { + String ambientSound = npc.data().get(NPC.AMBIENT_SOUND_METADATA); + String deathSound = npc.data().get(NPC.DEATH_SOUND_METADATA); + String hurtSound = npc.data().get(NPC.HURT_SOUND_METADATA); + if (args.hasFlag('n')) { + ambientSound = deathSound = hurtSound = ""; + } + if (args.hasFlag('d')) { + ambientSound = deathSound = hurtSound = null; + } else { + if (args.hasValueFlag("death")) { + deathSound = args.getFlag("death"); + if (deathSound.equals("d")) { + deathSound = null; + } + } + if (args.hasValueFlag("ambient")) { + ambientSound = args.getFlag("ambient"); + if (ambientSound.equals("d")) { + ambientSound = null; + } + } + if (args.hasValueFlag("hurt")) { + hurtSound = args.getFlag("hurt"); + if (hurtSound.equals("d")) { + hurtSound = null; + } + } + } + npc.data().setPersistent(NPC.DEATH_SOUND_METADATA, deathSound); + npc.data().setPersistent(NPC.HURT_SOUND_METADATA, hurtSound); + npc.data().setPersistent(NPC.AMBIENT_SOUND_METADATA, ambientSound); + } + @Command( aliases = { "npc" }, usage = "spawn (id|name)", diff --git a/src/main/java/net/citizensnpcs/npc/entity/BatController.java b/src/main/java/net/citizensnpcs/npc/entity/BatController.java index 06ccec716..38a575998 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/BatController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/BatController.java @@ -57,6 +57,16 @@ public class BatController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override public boolean bL() { if (npc == null) { @@ -140,5 +150,10 @@ public class BatController extends MobEntityController { public void setFlying(boolean flying) { a(flying); } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } } \ No newline at end of file diff --git a/src/main/java/net/citizensnpcs/npc/entity/BlazeController.java b/src/main/java/net/citizensnpcs/npc/entity/BlazeController.java index 188b7a4a3..50a7ee6c5 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/BlazeController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/BlazeController.java @@ -56,6 +56,16 @@ public class BlazeController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override public boolean bL() { if (npc == null) @@ -127,5 +137,10 @@ public class BlazeController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } } \ No newline at end of file diff --git a/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java b/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java index 81d852760..db6b7419a 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CaveSpiderController.java @@ -53,7 +53,6 @@ public class CaveSpiderController extends MobEntityController { this.npc = (CitizensNPC) npc; if (npc != null) { NMS.clearGoals(goalSelector, targetSelector); - } } @@ -64,6 +63,16 @@ public class CaveSpiderController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -170,5 +179,10 @@ public class CaveSpiderController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } } \ No newline at end of file diff --git a/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java b/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java index 3ad77dc2a..a4c013faf 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/ChickenController.java @@ -63,6 +63,16 @@ public class ChickenController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -155,5 +165,10 @@ public class ChickenController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } } \ No newline at end of file diff --git a/src/main/java/net/citizensnpcs/npc/entity/CowController.java b/src/main/java/net/citizensnpcs/npc/entity/CowController.java index ddf7e7594..dcf7258b6 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CowController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CowController.java @@ -64,6 +64,16 @@ public class CowController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -158,5 +168,10 @@ public class CowController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } } \ No newline at end of file diff --git a/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java b/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java index 3c65cd8f7..6da8356be 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/CreeperController.java @@ -71,6 +71,16 @@ public class CreeperController extends MobEntityController { super.a(entitylightning); } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -168,5 +178,10 @@ public class CreeperController extends MobEntityController { public void setAllowPowered(boolean allowPowered) { this.allowPowered = allowPowered; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } } \ No newline at end of file diff --git a/src/main/java/net/citizensnpcs/npc/entity/EnderDragonController.java b/src/main/java/net/citizensnpcs/npc/entity/EnderDragonController.java index cdd4ad3aa..1949e77a7 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/EnderDragonController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/EnderDragonController.java @@ -56,6 +56,16 @@ public class EnderDragonController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override public boolean bL() { if (npc == null) @@ -148,5 +158,10 @@ public class EnderDragonController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } } \ No newline at end of file diff --git a/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java b/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java index 5f9d86ec3..2fb2cc6cd 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/EndermanController.java @@ -64,6 +64,16 @@ public class EndermanController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -185,6 +195,11 @@ public class EndermanController extends MobEntityController { return false; } + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } + private void updateAIWithMovement() { NMS.updateAI(this); // taken from EntityLiving update method diff --git a/src/main/java/net/citizensnpcs/npc/entity/GhastController.java b/src/main/java/net/citizensnpcs/npc/entity/GhastController.java index a97c7ae8c..411b29c0a 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/GhastController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/GhastController.java @@ -42,6 +42,16 @@ public class GhastController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override public boolean bL() { if (npc == null) @@ -110,6 +120,11 @@ public class GhastController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class GhastNPC extends CraftGhast implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/GiantController.java b/src/main/java/net/citizensnpcs/npc/entity/GiantController.java index f26df9615..f3774d28c 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/GiantController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/GiantController.java @@ -49,6 +49,16 @@ public class GiantController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -144,6 +154,11 @@ public class GiantController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class GiantNPC extends CraftGiant implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/HorseController.java b/src/main/java/net/citizensnpcs/npc/entity/HorseController.java index d0777165e..b7dfa6840 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/HorseController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/HorseController.java @@ -59,6 +59,16 @@ public class HorseController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -157,6 +167,11 @@ public class HorseController extends MobEntityController { return npc == null ? super.isTypeNotPersistent() : false; } + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } + private void updateAIWithMovement() { NMS.updateAI(this); // taken from EntityLiving update method diff --git a/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java b/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java index 643c1692d..8c9386536 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/IronGolemController.java @@ -49,6 +49,16 @@ public class IronGolemController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -141,6 +151,11 @@ public class IronGolemController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class IronGolemNPC extends CraftIronGolem implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java b/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java index fc27ec280..24419ba53 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/MagmaCubeController.java @@ -50,6 +50,16 @@ public class MagmaCubeController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -152,6 +162,11 @@ public class MagmaCubeController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class MagmaCubeNPC extends CraftMagmaCube implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java b/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java index eeef9418a..9f16e9f88 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/MushroomCowController.java @@ -50,6 +50,16 @@ public class MushroomCowController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -142,6 +152,11 @@ public class MushroomCowController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class MushroomCowNPC extends CraftMushroomCow implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java b/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java index 8c63a9307..cd8b7ee9e 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/OcelotController.java @@ -50,6 +50,16 @@ public class OcelotController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -142,6 +152,11 @@ public class OcelotController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class OcelotNPC extends CraftOcelot implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/PigController.java b/src/main/java/net/citizensnpcs/npc/entity/PigController.java index 50dd3dcaf..b6d5063f7 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/PigController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/PigController.java @@ -56,6 +56,16 @@ public class PigController extends MobEntityController { super.a(entitylightning); } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -148,6 +158,11 @@ public class PigController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class PigNPC extends CraftPig implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/PigZombieController.java b/src/main/java/net/citizensnpcs/npc/entity/PigZombieController.java index fd36c929b..4c52cb50f 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/PigZombieController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/PigZombieController.java @@ -50,6 +50,16 @@ public class PigZombieController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -152,6 +162,11 @@ public class PigZombieController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class PigZombieNPC extends CraftPigZombie implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/SheepController.java b/src/main/java/net/citizensnpcs/npc/entity/SheepController.java index 79e3d9c5a..b36003c07 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SheepController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SheepController.java @@ -50,6 +50,16 @@ public class SheepController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -142,6 +152,11 @@ public class SheepController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class SheepNPC extends CraftSheep implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java b/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java index 7764d3adc..81e90fdb7 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SilverfishController.java @@ -49,6 +49,16 @@ public class SilverfishController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -151,6 +161,11 @@ public class SilverfishController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class SilverfishNPC extends CraftSilverfish implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java b/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java index ef2903092..c70093619 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SkeletonController.java @@ -49,6 +49,16 @@ public class SkeletonController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -141,6 +151,11 @@ public class SkeletonController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class SkeletonNPC extends CraftSkeleton implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java b/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java index c04fcadb5..3cfd23faf 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SlimeController.java @@ -51,6 +51,16 @@ public class SlimeController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -153,6 +163,11 @@ public class SlimeController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class SlimeNPC extends CraftSlime implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java b/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java index 6d0a373c8..a761a5b8e 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SnowmanController.java @@ -49,6 +49,16 @@ public class SnowmanController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -141,6 +151,11 @@ public class SnowmanController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class SnowmanNPC extends CraftSnowman implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java b/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java index be63625d5..721531e7d 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SpiderController.java @@ -49,6 +49,16 @@ public class SpiderController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -151,6 +161,11 @@ public class SpiderController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class SpiderNPC extends CraftSpider implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/SquidController.java b/src/main/java/net/citizensnpcs/npc/entity/SquidController.java index 262f47e80..2b68bed9f 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/SquidController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/SquidController.java @@ -49,6 +49,16 @@ public class SquidController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -142,6 +152,11 @@ public class SquidController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class SquidNPC extends CraftSquid implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java b/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java index 5364e0a19..c21d68f8b 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/VillagerController.java @@ -57,6 +57,16 @@ public class VillagerController extends MobEntityController { // trades } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -159,6 +169,11 @@ public class VillagerController extends MobEntityController { public void setBlockTrades(boolean blocked) { this.blockTrades = blocked; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class VillagerNPC extends CraftVillager implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/WitchController.java b/src/main/java/net/citizensnpcs/npc/entity/WitchController.java index e61e3f5b6..04aa98c54 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/WitchController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/WitchController.java @@ -49,6 +49,16 @@ public class WitchController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -141,6 +151,11 @@ public class WitchController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class WitchNPC extends CraftWitch implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/WitherController.java b/src/main/java/net/citizensnpcs/npc/entity/WitherController.java index 01f21cad3..b37d5718c 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/WitherController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/WitherController.java @@ -43,6 +43,16 @@ public class WitherController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override public boolean bL() { if (npc == null) @@ -121,6 +131,11 @@ public class WitherController extends MobEntityController { return npc == null ? super.isTypeNotPersistent() : false; } + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } + private void updateAIWithMovement() { NMS.updateAI(this); // taken from EntityLiving update method diff --git a/src/main/java/net/citizensnpcs/npc/entity/WolfController.java b/src/main/java/net/citizensnpcs/npc/entity/WolfController.java index 3b804c4d1..5c119abcd 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/WolfController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/WolfController.java @@ -49,6 +49,16 @@ public class WolfController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -144,6 +154,11 @@ public class WolfController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class WolfNPC extends CraftWolf implements NPCHolder { diff --git a/src/main/java/net/citizensnpcs/npc/entity/ZombieController.java b/src/main/java/net/citizensnpcs/npc/entity/ZombieController.java index 1c6a5acdf..bbb4d3710 100644 --- a/src/main/java/net/citizensnpcs/npc/entity/ZombieController.java +++ b/src/main/java/net/citizensnpcs/npc/entity/ZombieController.java @@ -49,6 +49,16 @@ public class ZombieController extends MobEntityController { } } + @Override + protected String aT() { + return npc == null ? super.aT() : npc.data().get(NPC.HURT_SOUND_METADATA, super.aT()); + } + + @Override + protected String aU() { + return npc == null ? super.aT() : npc.data().get(NPC.DEATH_SOUND_METADATA, super.aU()); + } + @Override protected void b(float f) { if (npc == null || !npc.isFlyable()) { @@ -142,6 +152,11 @@ public class ZombieController extends MobEntityController { protected boolean isTypeNotPersistent() { return npc == null ? super.isTypeNotPersistent() : false; } + + @Override + protected String t() { + return npc == null ? super.aT() : npc.data().get(NPC.AMBIENT_SOUND_METADATA, super.t()); + } } public static class ZombieNPC extends CraftZombie implements NPCHolder {