From 5375edc14c71fa843680496ef5aa32458c2785c2 Mon Sep 17 00:00:00 2001 From: Andrew Date: Thu, 1 Aug 2013 19:57:14 +1200 Subject: [PATCH] Added disguise constructors using entitytype --- .../disguise/DisguiseTypes/MiscDisguise.java | 24 +++++++++++++++++++ .../disguise/DisguiseTypes/MobDisguise.java | 15 ++++++++++++ 2 files changed, 39 insertions(+) diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java index 6af422a6..97ca7268 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/MiscDisguise.java @@ -1,5 +1,7 @@ package me.libraryaddict.disguise.DisguiseTypes; +import org.bukkit.entity.EntityType; + public class MiscDisguise extends Disguise { private int data = -1; private int id = -1; @@ -26,6 +28,28 @@ public class MiscDisguise extends Disguise { this(disguiseType, true, id, data); } + public MiscDisguise(EntityType entityType) { + this(entityType, true, -1, -1); + } + + public MiscDisguise(EntityType entityType, boolean replaceSounds) { + this(entityType, replaceSounds, -1, -1); + } + + public MiscDisguise(EntityType entityType, boolean replaceSounds, int id, int data) { + super(DisguiseType.getType(entityType), replaceSounds); + if (id == -1) + id = DisguiseType.getType(entityType).getDefaultId(); + if (data == -1) + data = DisguiseType.getType(entityType).getDefaultData(); + this.id = id; + this.data = data; + } + + public MiscDisguise(EntityType disguiseType, int id, int data) { + this(disguiseType, true, id, data); + } + public MiscDisguise clone() { MiscDisguise disguise = new MiscDisguise(getType(), replaceSounds(), getId(), getData()); return disguise; diff --git a/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java b/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java index 6e0d8ed6..af0c7876 100644 --- a/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java +++ b/src/me/libraryaddict/disguise/DisguiseTypes/MobDisguise.java @@ -1,5 +1,7 @@ package me.libraryaddict.disguise.DisguiseTypes; +import org.bukkit.entity.EntityType; + import me.libraryaddict.disguise.DisguiseTypes.Watchers.AgeableWatcher; import me.libraryaddict.disguise.DisguiseTypes.Watchers.ZombieWatcher; @@ -20,6 +22,19 @@ public class MobDisguise extends Disguise { this.isAdult = isAdult; } + public MobDisguise(EntityType entityType) { + this(entityType, true); + } + + public MobDisguise(EntityType entityType, boolean isAdult) { + this(entityType, isAdult, true); + } + + public MobDisguise(EntityType entityType, boolean isAdult, boolean replaceSounds) { + super(DisguiseType.getType(entityType), replaceSounds); + this.isAdult = isAdult; + } + public MobDisguise clone() { MobDisguise disguise = new MobDisguise(getType(), isAdult(), replaceSounds()); return disguise;