Added disguise constructors using entitytype

This commit is contained in:
Andrew 2013-08-01 19:57:14 +12:00
parent 0981a0a88a
commit 5375edc14c
2 changed files with 39 additions and 0 deletions

View File

@ -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;

View File

@ -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;