Add the new disguises

This commit is contained in:
libraryaddict 2016-06-13 06:05:45 +12:00
parent daab2c9606
commit 26c560e8e8
4 changed files with 62 additions and 60 deletions

View File

@ -122,11 +122,23 @@ public abstract class Disguise
if (getType() == DisguiseType.WITHER_SKELETON)
{
((SkeletonWatcher) getWatcher()).setType(SkeletonType.WITHER);
}
else if (getType() == DisguiseType.STRAY)
{
((SkeletonWatcher) getWatcher()).setType(SkeletonType.STRAY);
} // Else if its a zombie, but the disguise type is a zombie villager. Set the value.
else if (getType() == DisguiseType.ZOMBIE_VILLAGER)
{
((ZombieWatcher) getWatcher())
.setProfession(Profession.values()[DisguiseUtilities.random.nextInt(Profession.values().length)]);
Profession profession = null;
while (profession == null || profession == Profession.NORMAL || profession == Profession.HUSK)
profession = Profession.values()[DisguiseUtilities.random.nextInt(Profession.values().length)];
((ZombieWatcher) getWatcher()).setProfession(profession);
}
else if (getType() == DisguiseType.HUSK)
{
((ZombieWatcher) getWatcher()).setProfession(Profession.HUSK);
}
else if (getType() == DisguiseType.ELDER_GUARDIAN)
{

View File

@ -71,6 +71,8 @@ public enum DisguiseType
HORSE,
HUSK,
IRON_GOLEM,
ITEM_FRAME(71),
@ -107,6 +109,8 @@ public enum DisguiseType
PLAYER,
POLAR_BEAR,
PRIMED_TNT(50),
RABBIT,
@ -139,12 +143,16 @@ public enum DisguiseType
SQUID,
TIPPED_ARROW(92),
STRAY,
THROWN_EXP_BOTTLE(75),
TIPPED_ARROW(92),
UNDEAD_HORSE,
UNKNOWN,
VILLAGER,
WITCH,
@ -159,9 +167,7 @@ public enum DisguiseType
ZOMBIE,
ZOMBIE_VILLAGER,
UNKNOWN;
ZOMBIE_VILLAGER;
static
{
@ -269,10 +275,10 @@ public enum DisguiseType
}
}
private int objectId = -1, defaultData = 0;
private EntityType entityType;
private int objectId = -1, defaultData = 0;
private Class<? extends FlagWatcher> watcherClass;
DisguiseType(int... ints)
@ -317,16 +323,6 @@ public enum DisguiseType
return entityType;
}
/**
* The TYPE id of this entity. Different from the Object Id send in spawn packets when spawning miscs.
*
* @return
*/
public int getTypeId()
{
return (int) getEntityType().getTypeId();
}
/**
* The object type send in packets when spawning a misc entity. Otherwise, -1.
*
@ -337,6 +333,16 @@ public enum DisguiseType
return objectId;
}
/**
* The TYPE id of this entity. Different from the Object Id send in spawn packets when spawning miscs.
*
* @return
*/
public int getTypeId()
{
return (int) getEntityType().getTypeId();
}
public Class<? extends FlagWatcher> getWatcherClass()
{
return watcherClass;

View File

@ -15,48 +15,7 @@ import org.bukkit.util.Vector;
import com.comphenix.protocol.wrappers.BlockPosition;
import com.google.common.base.Optional;
import me.libraryaddict.disguise.disguisetypes.watchers.AgeableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.AreaEffectCloudWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ArmorStandWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ArrowWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.BatWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.BlazeWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.BoatWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.CreeperWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.DroppedItemWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EnderCrystalWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EnderDragonWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.EndermanWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.FallingBlockWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.FireworkWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.FishingHookWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.GhastWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.GuardianWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.HorseWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.InsentientWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.IronGolemWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ItemFrameWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.LivingWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.MinecartWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.OcelotWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PigWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.PlayerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.RabbitWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SheepWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ShulkerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SkeletonWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SlimeWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SnowmanWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SpiderWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.SplashPotionWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.TNTWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.TameableWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.VillagerWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WitchWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WitherSkullWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WitherWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.WolfWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.ZombieWatcher;
import me.libraryaddict.disguise.disguisetypes.watchers.*;
public class FlagType<Y>
{
@ -209,6 +168,8 @@ public class FlagType<Y>
public static FlagType<Byte> PLAYER_SKIN = new FlagType<Byte>(PlayerWatcher.class, 2, (byte) 0);
public static FlagType<Boolean> POLAR_BEAR_STANDING = new FlagType<Boolean>(PolarBearWatcher.class, 0, false);
public static FlagType<Integer> RABBIT_TYPE = new FlagType<Integer>(RabbitWatcher.class, 0, 0);
public static FlagType<Byte> SHEEP_WOOL = new FlagType<Byte>(SheepWatcher.class, 0, (byte) 0);

View File

@ -0,0 +1,23 @@
package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.FlagType;
public class PolarBearWatcher extends AgeableWatcher
{
public PolarBearWatcher(Disguise disguise)
{
super(disguise);
}
public void setStanding(boolean standing)
{
setValue(FlagType.POLAR_BEAR_STANDING, standing);
sendData(FlagType.POLAR_BEAR_STANDING);
}
public boolean isStanding()
{
return getValue(FlagType.POLAR_BEAR_STANDING);
}
}