Added Disguise hurt sounds.

Enabled disguised hurt sounds in DamageManager
This commit is contained in:
Jonathan Williams 2013-09-01 23:28:07 -07:00
parent a49f67b33c
commit 63d2563f92
16 changed files with 121 additions and 7 deletions

View File

@ -1,5 +1,6 @@
package mineplex.core.disguise.disguises; package mineplex.core.disguise.disguises;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity; import org.bukkit.craftbukkit.v1_6_R2.entity.CraftEntity;
import net.minecraft.server.v1_6_R2.DataWatcher; import net.minecraft.server.v1_6_R2.DataWatcher;
@ -40,6 +41,16 @@ public abstract class DisguiseBase
return new Packet40EntityMetadata(Entity.id, DataWatcher, true); return new Packet40EntityMetadata(Entity.id, DataWatcher, true);
} }
public void playHurtSound()
{
Entity.world.makeSound(Entity, getHurtSound(), getVolume(), getPitch());
}
public void playHurtSound(Location location)
{
Entity.world.makeSound(location.getX(), location.getY(), location.getZ(), getHurtSound(), getVolume(), getPitch());
}
public void UpdateEntity(Entity entity) public void UpdateEntity(Entity entity)
{ {
Entity = entity; Entity = entity;
@ -54,4 +65,10 @@ public abstract class DisguiseBase
{ {
return Entity.id; return Entity.id;
} }
protected abstract String getHurtSound();
protected abstract float getVolume();
protected abstract float getPitch();
} }

View File

@ -12,7 +12,21 @@ public class DisguiseBat extends DisguiseAmbient
@Override @Override
public Packet GetSpawnPacket() public Packet GetSpawnPacket()
{ {
// TODO Auto-generated method stub
return null; return null;
} }
public String getHurtSound()
{
return "mob.bat.hurt";
}
protected float getVolume()
{
return 0.1F;
}
protected float getPitch()
{
return super.getPitch() * 0.95F;
}
} }

View File

@ -31,4 +31,9 @@ public class DisguiseBlaze extends DisguiseMonster
DataWatcher.watch(16, Byte.valueOf(b0)); DataWatcher.watch(16, Byte.valueOf(b0));
} }
public String getHurtSound()
{
return "mob.blaze.hit";
}
} }

View File

@ -12,4 +12,9 @@ public class DisguiseChicken extends DisguiseAnimal
{ {
return 93; return 93;
} }
public String getHurtSound()
{
return "mob.chicken.hurt";
}
} }

View File

@ -35,4 +35,9 @@ public class DisguiseCreeper extends DisguiseMonster
{ {
DataWatcher.watch(16, Byte.valueOf((byte)i)); DataWatcher.watch(16, Byte.valueOf((byte)i));
} }
protected String getHurtSound()
{
return "mob.creeper.say";
}
} }

View File

@ -56,4 +56,9 @@ public class DisguiseEnderman extends DisguiseMonster
{ {
return 58; return 58;
} }
protected String getHurtSound()
{
return "mob.endermen.hit";
}
} }

View File

@ -29,4 +29,9 @@ public class DisguiseIronGolem extends DisguiseGolem
else else
DataWatcher.watch(16, Byte.valueOf((byte)(b0 & 0xFFFFFFFE))); DataWatcher.watch(16, Byte.valueOf((byte)(b0 & 0xFFFFFFFE)));
} }
protected String getHurtSound()
{
return "mob.irongolem.hit";
}
} }

View File

@ -1,7 +1,11 @@
package mineplex.core.disguise.disguises; package mineplex.core.disguise.disguises;
import java.util.Random;
public abstract class DisguiseLiving extends DisguiseBase public abstract class DisguiseLiving extends DisguiseBase
{ {
private static Random _random = new Random();
public DisguiseLiving(org.bukkit.entity.Entity entity) public DisguiseLiving(org.bukkit.entity.Entity entity)
{ {
super(entity); super(entity);
@ -16,9 +20,24 @@ public abstract class DisguiseLiving extends DisguiseBase
{ {
super.UpdateDataWatcher(); super.UpdateDataWatcher();
//DataWatcher.watch(6, Entity.getDataWatcher().getFloat(6)); DataWatcher.watch(6, Entity.getDataWatcher().getFloat(6));
//DataWatcher.watch(7, Entity.getDataWatcher().getInt(7)); DataWatcher.watch(7, Entity.getDataWatcher().getInt(7));
//DataWatcher.watch(8, Entity.getDataWatcher().getByte(8)); DataWatcher.watch(8, Entity.getDataWatcher().getByte(8));
//DataWatcher.watch(9, Entity.getDataWatcher().getByte(9)); DataWatcher.watch(9, Entity.getDataWatcher().getByte(9));
} }
protected String getHurtSound()
{
return "damage.hit";
}
protected float getVolume()
{
return 1.0F;
}
protected float getPitch()
{
return (_random.nextFloat() - _random.nextFloat()) * 0.2F + 1.0F;
}
} }

View File

@ -12,4 +12,9 @@ public class DisguisePigZombie extends DisguiseZombie
{ {
return 57; return 57;
} }
protected String getHurtSound()
{
return "mob.zombiepig.zpighurt";
}
} }

View File

@ -26,4 +26,9 @@ public class DisguiseSkeleton extends DisguiseMonster
{ {
return DataWatcher.getByte(13); return DataWatcher.getByte(13);
} }
protected String getHurtSound()
{
return "mob.skeleton.hurt";
}
} }

View File

@ -151,4 +151,14 @@ public class DisguiseSlime extends DisguiseInsentient
} }
} }
} }
protected String getHurtSound()
{
return "mob.slime." + (GetSize() > 1 ? "big" : "small");
}
protected float getVolume()
{
return 0.4F * (float)GetSize();
}
} }

View File

@ -31,4 +31,9 @@ public class DisguiseSpider extends DisguiseMonster
{ {
return 52; return 52;
} }
protected String getHurtSound()
{
return "mob.spider.say";
}
} }

View File

@ -31,4 +31,14 @@ public class DisguiseSquid extends DisguiseMonster
{ {
return 94; return 94;
} }
protected String getHurtSound()
{
return null;
}
protected float getVolume()
{
return 0.4F;
}
} }

View File

@ -38,4 +38,9 @@ public class DisguiseZombie extends DisguiseMonster
{ {
DataWatcher.watch(13, Byte.valueOf((byte)(villager ? 1 : 0))); DataWatcher.watch(13, Byte.valueOf((byte)(villager ? 1 : 0)));
} }
protected String getHurtSound()
{
return "mob.zombie.hurt";
}
} }

View File

@ -367,7 +367,7 @@ public class DamageManager extends MiniPlugin
if (_disguiseManager.isDisguised(damagee)) if (_disguiseManager.isDisguised(damagee))
{ {
//_disguiseManager.getDisguise(damagee).playHurtSound(damagee.getLocation()); _disguiseManager.getDisguise(damagee).playHurtSound();
return; return;
} }

View File

@ -13,7 +13,6 @@ import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;