Changed a string to a class as I'm likely to forget to update it. Also added in warnings for myself for updating.

This commit is contained in:
Andrew 2013-11-18 04:16:17 +13:00
parent d83c5bcd2c
commit 04df1cd162
2 changed files with 6 additions and 2 deletions

View File

@ -16,6 +16,7 @@ import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
import net.minecraft.server.v1_6_R3.ChatMessage;
import net.minecraft.server.v1_6_R3.ChunkCoordinates;
import net.minecraft.server.v1_6_R3.Entity;
import net.minecraft.server.v1_6_R3.EntityHuman;
import net.minecraft.server.v1_6_R3.EntityLiving;
import net.minecraft.server.v1_6_R3.GenericAttributes;
@ -201,7 +202,7 @@ public class LibsDisguises extends JavaPlugin {
entityClass = EntityHuman.class;
entity = new DisguiseHuman(world);
} else {
entityClass = Class.forName("net.minecraft.server.v1_6_R3.Entity" + name);
entityClass = Class.forName(Entity.class.getName() + name);
entity = (net.minecraft.server.v1_6_R3.Entity) entityClass.getConstructor(World.class).newInstance(world);
}
Values value = new Values(disguiseType, entityClass, entity.at);
@ -216,6 +217,7 @@ public class LibsDisguises extends JavaPlugin {
DisguiseSound sound = DisguiseSound.getType(disguiseType.name());
if (sound != null) {
Method soundStrength = EntityLiving.class.getDeclaredMethod("ba");
// TODO Update this each update!
soundStrength.setAccessible(true);
sound.setDamageSoundVolume((Float) soundStrength.invoke(entity));
}

View File

@ -41,7 +41,9 @@ public enum DisguiseSound {
GIANT(Sound.HURT_FLESH, Sound.STEP_GRASS),
HORSE(Sound.HORSE_HIT, Sound.STEP_GRASS, "mob.horse.death", Sound.HORSE_IDLE, Sound.HORSE_GALLOP, Sound.HORSE_ANGRY,
Sound.HORSE_ARMOR, Sound.HORSE_JUMP, Sound.HORSE_LAND, Sound.HORSE_SADDLE, Sound.HORSE_SOFT, Sound.HORSE_WOOD),
Sound.HORSE_ARMOR, Sound.HORSE_JUMP, Sound.HORSE_LAND, Sound.HORSE_SADDLE, Sound.HORSE_SOFT, Sound.HORSE_WOOD,
"mob.horse.leather"), // TODO I really should finish adding all the sounds. Lazy bukkit didn't add all of them either.
// -.-
IRON_GOLEM(Sound.IRONGOLEM_HIT, Sound.IRONGOLEM_WALK, Sound.IRONGOLEM_DEATH, Sound.IRONGOLEM_THROW),