Factored out entity type strings into single TypeId property. Found a couple bugs along the way and should prevent future bugs of this type.

This commit is contained in:
Justin Aquadro 2011-11-05 14:17:57 -04:00
parent 401b2c7b68
commit 5997c362fd
43 changed files with 405 additions and 204 deletions

View file

@ -10,11 +10,16 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound ArrowSchema = ThrowableSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Arrow"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("inData", TagType.TAG_BYTE, SchemaOptions.CREATE_ON_MISSING),
new SchemaNodeScaler("player", TagType.TAG_BYTE, SchemaOptions.CREATE_ON_MISSING),
});
public static string TypeId
{
get { return "Arrow"; }
}
private byte _inData;
private byte _player;
@ -30,13 +35,13 @@ namespace Substrate.Entities
set { _player = (byte)(value ? 1 : 0); }
}
public EntityArrow ()
: base("Arrow")
protected EntityArrow (string id)
: base(id)
{
}
protected EntityArrow (string id)
: base(id)
public EntityArrow ()
: this(TypeId)
{
}

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound BlazeSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Blaze"),
new SchemaNodeString("id", TypeId),
});
public EntityBlaze ()
: base("Blaze")
public static string TypeId
{
get { return "Blaze"; }
}
protected EntityBlaze (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityBlaze ()
: this(TypeId)
{
}
public EntityBlaze (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound BoatSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Boat"),
new SchemaNodeString("id", TypeId),
});
public EntityBoat ()
: base("Boat")
public static string TypeId
{
get { return "Boat"; }
}
protected EntityBoat (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityBoat ()
: this(TypeId)
{
}
public EntityBoat (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound CaveSpiderSchema = SpiderSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "CaveSpider"),
new SchemaNodeString("id", TypeId),
});
public EntityCaveSpider ()
: base("CaveSpider")
public static string TypeId
{
get { return "CaveSpider"; }
}
protected EntityCaveSpider (string id)
@ -23,12 +23,16 @@ namespace Substrate.Entities
{
}
public EntityCaveSpider ()
: this(TypeId)
{
}
public EntityCaveSpider (TypedEntity e)
: base(e)
{
}
#region INBTObject<Entity> Members
public override bool ValidateTree (TagNode tree)

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound ChickenSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Chicken"),
new SchemaNodeString("id", TypeId),
});
public EntityChicken ()
: base("Chicken")
public static string TypeId
{
get { return "Chicken"; }
}
protected EntityChicken (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityChicken ()
: this(TypeId)
{
}
public EntityChicken (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound CowSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Cow"),
new SchemaNodeString("id", TypeId),
});
public EntityCow ()
: base("Cow")
public static string TypeId
{
get { return "Cow"; }
}
protected EntityCow (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityCow ()
: this(TypeId)
{
}
public EntityCow (TypedEntity e)
: base(e)
{

View file

@ -10,10 +10,15 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound CreeperSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Creeper"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("powered", TagType.TAG_BYTE, SchemaOptions.OPTIONAL),
});
public static string TypeId
{
get { return "Creeper"; }
}
private bool? _powered;
public bool Powered
@ -22,13 +27,13 @@ namespace Substrate.Entities
set { _powered = value; }
}
public EntityCreeper ()
: base("Creeper")
protected EntityCreeper (string id)
: base(id)
{
}
protected EntityCreeper (string id)
: base(id)
public EntityCreeper ()
: this(TypeId)
{
}

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound EggSchema = ThrowableSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Egg"),
new SchemaNodeString("id", TypeId),
});
public EntityEgg ()
: base("Egg")
public static string TypeId
{
get { return "Egg"; }
}
protected EntityEgg (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityEgg ()
: this(TypeId)
{
}
public EntityEgg (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound EnderDragonSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "EnderDragon"),
new SchemaNodeString("id", TypeId),
});
public EntityEnderDragon ()
: base("EnderDragon")
public static string TypeId
{
get { return "EnderDragon"; }
}
protected EntityEnderDragon (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityEnderDragon ()
: this(TypeId)
{
}
public EntityEnderDragon (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound EnderEyeSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "EyeOfEnderSignal"),
new SchemaNodeString("id", TypeId),
});
public EntityEnderEye ()
: base("EyeOfEnderSignal")
public static string TypeId
{
get { return "EyeOfEnderSignal"; }
}
protected EntityEnderEye (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityEnderEye ()
: this(TypeId)
{
}
public EntityEnderEye (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound EnderPearlSchema = ThrowableSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "ThrownEnderpearl"),
new SchemaNodeString("id", TypeId),
});
public EntityEnderPearl ()
: base("ThrownEnderpearl")
public static string TypeId
{
get { return "ThrownEnderpearl"; }
}
protected EntityEnderPearl (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityEnderPearl ()
: this(TypeId)
{
}
public EntityEnderPearl (TypedEntity e)
: base(e)
{

View file

@ -14,11 +14,16 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound EndermanSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Enderman"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("carried", TagType.TAG_SHORT, SchemaOptions.CREATE_ON_MISSING),
new SchemaNodeScaler("carriedData", TagType.TAG_SHORT, SchemaOptions.CREATE_ON_MISSING),
});
public static string TypeId
{
get { return "Enderman"; }
}
private short _carried;
private short _carryingData;
@ -34,13 +39,13 @@ namespace Substrate.Entities
set { _carryingData = (short)value; }
}
public EntityEnderman ()
: base("Enderman")
protected EntityEnderman (string id)
: base(id)
{
}
protected EntityEnderman (string id)
: base(id)
public EntityEnderman ()
: this(TypeId)
{
}

View file

@ -10,10 +10,15 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound FallingSandSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "FallingSand"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Tile", TagType.TAG_BYTE),
});
public static string TypeId
{
get { return "FallingSand"; }
}
private byte _tile;
public int Tile
@ -22,13 +27,13 @@ namespace Substrate.Entities
set { _tile = (byte)value; }
}
public EntityFallingSand ()
: base("FallingSand")
protected EntityFallingSand (string id)
: base(id)
{
}
protected EntityFallingSand (string id)
: base(id)
public EntityFallingSand ()
: this(TypeId)
{
}

View file

@ -10,7 +10,7 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound FireballSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Fireball"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("xTile", TagType.TAG_SHORT),
new SchemaNodeScaler("yTile", TagType.TAG_SHORT),
new SchemaNodeScaler("zTile", TagType.TAG_SHORT),
@ -18,6 +18,11 @@ namespace Substrate.Entities
new SchemaNodeScaler("inGround", TagType.TAG_BYTE),
});
public static string TypeId
{
get { return "Fireball"; }
}
private short _xTile;
private short _yTile;
private short _zTile;
@ -54,13 +59,13 @@ namespace Substrate.Entities
set { _inGround = (byte)(value ? 1 : 0); }
}
public EntityFireball ()
: base("Fireball")
protected EntityFireball (string id)
: base(id)
{
}
protected EntityFireball (string id)
: base(id)
public EntityFireball ()
: this(TypeId)
{
}

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound GhastSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Ghast"),
new SchemaNodeString("id", TypeId),
});
public EntityGhast ()
: base("Ghast")
public static string TypeId
{
get { return "Ghast"; }
}
protected EntityGhast (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityGhast ()
: this(TypeId)
{
}
public EntityGhast (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound GiantSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Giant"),
new SchemaNodeString("id", TypeId),
});
public EntityGiant ()
: base("Giant")
public static string TypeId
{
get { return "Giant"; }
}
protected EntityGiant (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityGiant ()
: this(TypeId)
{
}
public EntityGiant (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,17 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound ItemSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Item"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Health", TagType.TAG_SHORT),
new SchemaNodeScaler("Age", TagType.TAG_SHORT),
new SchemaNodeCompound("Item", Item.Schema),
});
public static string TypeId
{
get { return "Item"; }
}
private short _health;
private short _age;
@ -39,13 +44,13 @@ namespace Substrate.Entities
set { _item = value; }
}
public EntityItem ()
: base("Item")
protected EntityItem (string id)
: base(id)
{
}
protected EntityItem (string id)
: base(id)
public EntityItem ()
: this(TypeId)
{
}

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound MagmaCubeSchema = SlimeSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "LavaSlime"),
new SchemaNodeString("id", TypeId),
});
public EntityMagmaCube ()
: base("LavaSlime")
public static string TypeId
{
get { return "LavaSlime"; }
}
protected EntityMagmaCube (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityMagmaCube ()
: this(TypeId)
{
}
public EntityMagmaCube (TypedEntity e)
: base(e)
{

View file

@ -17,10 +17,15 @@ namespace Substrate.Entities
public static readonly SchemaNodeCompound MinecartSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Minecart"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Type", TagType.TAG_INT),
});
public static string TypeId
{
get { return "Minecart"; }
}
private CartType _type;
public CartType Type
@ -28,13 +33,13 @@ namespace Substrate.Entities
get { return _type; }
}
public EntityMinecart ()
: base("Minecart")
protected EntityMinecart (string id)
: base(id)
{
}
protected EntityMinecart (string id)
: base(id)
public EntityMinecart ()
: this(TypeId)
{
}

View file

@ -12,21 +12,27 @@ namespace Substrate.Entities
new SchemaNodeList("Items", TagType.TAG_COMPOUND, ItemCollection.Schema),
});
public static string TypeId
{
get { return EntityMinecart.TypeId; }
}
private static int _CAPACITY = 27;
private ItemCollection _items;
protected EntityMinecartChest (string id)
: base(id)
{
_items = new ItemCollection(_CAPACITY);
}
public EntityMinecartChest ()
: base()
{
_items = new ItemCollection(_CAPACITY);
}
protected EntityMinecartChest (string id)
: base(id)
{
}
public EntityMinecartChest (TypedEntity e)
: base(e)
{

View file

@ -15,6 +15,11 @@ namespace Substrate.Entities
new SchemaNodeScaler("Fuel", TagType.TAG_SHORT),
});
public static string TypeId
{
get { return EntityMinecart.TypeId; }
}
private double _pushX;
private double _pushZ;
private short _fuel;
@ -37,13 +42,13 @@ namespace Substrate.Entities
set { _fuel = (short)value; }
}
public EntityMinecartFurnace ()
: base()
protected EntityMinecartFurnace (string id)
: base(id)
{
}
protected EntityMinecartFurnace (string id)
: base(id)
public EntityMinecartFurnace ()
: base()
{
}

View file

@ -38,7 +38,7 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound MobSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Mob"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("AttackTime", TagType.TAG_SHORT),
new SchemaNodeScaler("DeathTime", TagType.TAG_SHORT),
new SchemaNodeScaler("Health", TagType.TAG_SHORT),
@ -51,6 +51,11 @@ namespace Substrate.Entities
},
});
public static string TypeId
{
get { return "Mob"; }
}
private short _attackTime;
private short _deathTime;
private short _health;
@ -88,13 +93,13 @@ namespace Substrate.Entities
set { _activeEffects = value; }
}
public EntityMob ()
: base("Mob")
protected EntityMob (string id)
: base(id)
{
}
protected EntityMob (string id)
: base(id)
public EntityMob ()
: this(TypeId)
{
}

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound MonsterSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Monster"),
new SchemaNodeString("id", TypeId),
});
public EntityMonster ()
: base("Monster")
public static string TypeId
{
get { return "Monster"; }
}
protected EntityMonster (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityMonster ()
: this(TypeId)
{
}
public EntityMonster (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound MooshroomSchema = CowSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "MushroomCow"),
new SchemaNodeString("id", TypeId),
});
public EntityMooshroom ()
: base("MushroomCow")
public static string TypeId
{
get { return "MushroomCow"; }
}
protected EntityMooshroom (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityMooshroom ()
: this(TypeId)
{
}
public EntityMooshroom (TypedEntity e)
: base(e)
{

View file

@ -18,7 +18,7 @@ namespace Substrate.Entities
public static readonly SchemaNodeCompound PaintingSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Painting"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Dir", TagType.TAG_BYTE),
new SchemaNodeScaler("TileX", TagType.TAG_INT),
new SchemaNodeScaler("TileY", TagType.TAG_INT),
@ -26,6 +26,11 @@ namespace Substrate.Entities
new SchemaNodeScaler("Motive", TagType.TAG_STRING),
});
public static string TypeId
{
get { return "Painting"; }
}
private DirectionType _dir;
private string _motive;
private int _xTile;
@ -62,13 +67,13 @@ namespace Substrate.Entities
set { _zTile = value; }
}
public EntityPainting ()
: base("Painting")
protected EntityPainting (string id)
: base(id)
{
}
protected EntityPainting (string id)
: base(id)
public EntityPainting ()
: this(TypeId)
{
}

View file

@ -10,10 +10,15 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound PigSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Pig"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Saddle", TagType.TAG_BYTE),
});
public static string TypeId
{
get { return "Pig"; }
}
private bool _saddle;
public bool HasSaddle
@ -22,13 +27,13 @@ namespace Substrate.Entities
set { _saddle = value; }
}
public EntityPig ()
: base("Pig")
protected EntityPig (string id)
: base(id)
{
}
protected EntityPig (string id)
: base(id)
public EntityPig ()
: this(TypeId)
{
}

View file

@ -10,10 +10,15 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound PigZombieSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "PigZombie"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Anger", TagType.TAG_SHORT),
});
public static string TypeId
{
get { return "PigZombie"; }
}
private short _anger;
public int Anger
@ -22,13 +27,13 @@ namespace Substrate.Entities
set { _anger = (short)value; }
}
public EntityPigZombie ()
: base("PigZombie")
protected EntityPigZombie (string id)
: base(id)
{
}
protected EntityPigZombie (string id)
: base(id)
public EntityPigZombie ()
: this(TypeId)
{
}

View file

@ -10,10 +10,15 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound PrimedTntSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "PrimedTnt"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Fuse", TagType.TAG_BYTE),
});
public static string TypeId
{
get { return "PrimedTnt"; }
}
private byte _fuse;
public int Fuse
@ -22,13 +27,13 @@ namespace Substrate.Entities
set { _fuse = (byte)value; }
}
public EntityPrimedTnt ()
: base("PrimedTnt")
protected EntityPrimedTnt (string id)
: base(id)
{
}
protected EntityPrimedTnt (string id)
: base(id)
public EntityPrimedTnt ()
: this(TypeId)
{
}

View file

@ -10,11 +10,16 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound SheepSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Sheep"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Sheared", TagType.TAG_BYTE),
new SchemaNodeScaler("Color", TagType.TAG_BYTE, SchemaOptions.CREATE_ON_MISSING),
});
public static string TypeId
{
get { return "Sheep"; }
}
private bool _sheared;
private byte _color;
@ -30,13 +35,13 @@ namespace Substrate.Entities
set { _color = (byte)value; }
}
public EntitySheep ()
: base("Sheep")
protected EntitySheep (string id)
: base(id)
{
}
protected EntitySheep (string id)
: base(id)
public EntitySheep ()
: this(TypeId)
{
}

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound SilverfishSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Silverfish"),
new SchemaNodeString("id", TypeId),
});
public EntitySilverfish ()
: base("Silverfish")
public static string TypeId
{
get { return "Silverfish"; }
}
protected EntitySilverfish (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntitySilverfish ()
: this(TypeId)
{
}
public EntitySilverfish (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound SkeletonSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Skeleton"),
new SchemaNodeString("id", TypeId),
});
public EntitySkeleton ()
: base("Skeleton")
public static string TypeId
{
get { return "Skeleton"; }
}
protected EntitySkeleton (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntitySkeleton ()
: this(TypeId)
{
}
public EntitySkeleton (TypedEntity e)
: base(e)
{

View file

@ -10,10 +10,15 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound SlimeSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Slime"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Size", TagType.TAG_INT),
});
public static string TypeId
{
get { return "Slime"; }
}
private int _size;
public int Size
@ -22,13 +27,13 @@ namespace Substrate.Entities
set { _size = value; }
}
public EntitySlime ()
: base("Slime")
protected EntitySlime (string id)
: base(id)
{
}
protected EntitySlime (string id)
: base(id)
public EntitySlime ()
: this(TypeId)
{
}

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound SmallFireballSchema = FireballSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "SmallFireball"),
new SchemaNodeString("id", TypeId),
});
public EntitySmallFireball ()
: base("SmallFireball")
public static string TypeId
{
get { return "SmallFireball"; }
}
protected EntitySmallFireball (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntitySmallFireball ()
: this(TypeId)
{
}
public EntitySmallFireball (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound SnowballSchema = ThrowableSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Snowball"),
new SchemaNodeString("id", TypeId),
});
public EntitySnowball ()
: base("Snowball")
public static string TypeId
{
get { return "Snowball"; }
}
protected EntitySnowball (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntitySnowball ()
: this(TypeId)
{
}
public EntitySnowball (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound SnowmanSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "SnowMan"),
new SchemaNodeString("id", TypeId),
});
public EntitySnowman ()
: base("SnowMan")
public static string TypeId
{
get { return "SnowMan"; }
}
protected EntitySnowman (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntitySnowman ()
: this(TypeId)
{
}
public EntitySnowman (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound SpiderSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Spider"),
new SchemaNodeString("id", TypeId),
});
public EntitySpider ()
: base("Spider")
public static string TypeId
{
get { return "Spider"; }
}
protected EntitySpider (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntitySpider ()
: this(TypeId)
{
}
public EntitySpider (TypedEntity e)
: base(e)
{

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound SquidSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Squid"),
new SchemaNodeString("id", TypeId),
});
public EntitySquid ()
: base("Squid")
public static string TypeId
{
get { return "Squid"; }
}
protected EntitySquid (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntitySquid ()
: this(TypeId)
{
}
public EntitySquid (TypedEntity e)
: base(e)
{

View file

@ -61,11 +61,6 @@ namespace Substrate.Entities
set { _inGround = (byte)(value ? 1 : 0); }
}
public EntityThrowable (string id)
: base(id)
{
}
protected EntityThrowable (string id)
: base(id)
{

View file

@ -19,10 +19,15 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound VillagerSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Villager"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Profession", TagType.TAG_INT),
});
public static string TypeId
{
get { return "Villager"; }
}
private int _profession;
public VillagerProfession Profession
@ -31,13 +36,13 @@ namespace Substrate.Entities
set { _profession = (int)value; }
}
public EntityVillager ()
: base("Villager")
protected EntityVillager (string id)
: base(id)
{
}
protected EntityVillager (string id)
: base(id)
public EntityVillager ()
: this(TypeId)
{
}

View file

@ -10,12 +10,17 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound WolfSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Wolf"),
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Owner", TagType.TAG_STRING),
new SchemaNodeScaler("Sitting", TagType.TAG_BYTE),
new SchemaNodeScaler("Angry", TagType.TAG_BYTE),
});
public static string TypeId
{
get { return "Wolf"; }
}
private string _owner;
private bool _sitting;
private bool _angry;
@ -38,13 +43,13 @@ namespace Substrate.Entities
set { _angry = value; }
}
public EntityWolf ()
: base("Wolf")
protected EntityWolf (string id)
: base(id)
{
}
protected EntityWolf (string id)
: base(id)
public EntityWolf ()
: this(TypeId)
{
}

View file

@ -10,11 +10,17 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound XPOrbSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", TypeId),
new SchemaNodeScaler("Health", TagType.TAG_SHORT),
new SchemaNodeScaler("Age", TagType.TAG_SHORT),
new SchemaNodeScaler("Value", TagType.TAG_SHORT),
});
public static string TypeId
{
get { return "XPOrb"; }
}
private short _health;
private short _age;
private short _value;
@ -37,13 +43,13 @@ namespace Substrate.Entities
set { _value = (short)value; }
}
public EntityXPOrb ()
: base("XPOrb")
protected EntityXPOrb (string id)
: base(id)
{
}
protected EntityXPOrb (string id)
: base(id)
public EntityXPOrb ()
: this(TypeId)
{
}

View file

@ -10,12 +10,12 @@ namespace Substrate.Entities
{
public static readonly SchemaNodeCompound ZombieSchema = MobSchema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Zombie"),
new SchemaNodeString("id", TypeId),
});
public EntityZombie ()
: base("Zombie")
public static string TypeId
{
get { return "Zombie"; }
}
protected EntityZombie (string id)
@ -23,6 +23,11 @@ namespace Substrate.Entities
{
}
public EntityZombie ()
: this(TypeId)
{
}
public EntityZombie (TypedEntity e)
: base(e)
{

View file

@ -79,45 +79,45 @@ namespace Substrate
static EntityFactory ()
{
_registry["Arrow"] = typeof(EntityArrow);
_registry["Blaze"] = typeof(EntityBlaze);
_registry["Boat"] = typeof(EntityBoat);
_registry["CaveSpider"] = typeof(EntityCaveSpider);
_registry["Chicken"] = typeof(EntityChicken);
_registry["Cow"] = typeof(EntityCow);
_registry["Creeper"] = typeof(EntityCreeper);
_registry["Egg"] = typeof(EntityEgg);
_registry["EnderDragon"] = typeof(EntityEnderDragon);
_registry["Enderman"] = typeof(EntityEnderman);
_registry["EyeOfEnderSignal"] = typeof(EntityEnderEye);
_registry["FallingSand"] = typeof(EntityFallingSand);
_registry["Fireball"] = typeof(EntityFireball);
_registry["Ghast"] = typeof(EntityGhast);
_registry["Giant"] = typeof(EntityGiant);
_registry["Item"] = typeof(EntityItem);
_registry["LavaSlime"] = typeof(EntityMagmaCube);
_registry["Minecart"] = typeof(EntityMinecart);
_registry["Mob"] = typeof(EntityMob);
_registry["Monster"] = typeof(EntityMonster);
_registry["MushroomCow"] = typeof(EntityMooshroom);
_registry["Painting"] = typeof(EntityPainting);
_registry["Pig"] = typeof(EntityPig);
_registry["PigZombie"] = typeof(EntityPigZombie);
_registry["PrimedTnt"] = typeof(EntityPrimedTnt);
_registry["Sheep"] = typeof(EntitySheep);
_registry["Silverfish"] = typeof(EntitySilverfish);
_registry["Skeleton"] = typeof(EntitySkeleton);
_registry["Slime"] = typeof(EntitySlime);
_registry["SmallFireball"] = typeof(EntitySmallFireball);
_registry["Snowball"] = typeof(EntitySnowball);
_registry["SnowMan"] = typeof(EntitySnowman);
_registry["Spider"] = typeof(EntitySpider);
_registry["Squid"] = typeof(EntitySquid);
_registry["ThrownEnderpearl"] = typeof(EntityEnderPearl);
_registry["Villager"] = typeof(EntityVillager);
_registry["Wolf"] = typeof(EntityWolf);
_registry["XPOrb"] = typeof(EntityXPOrb);
_registry["Zombie"] = typeof(EntityZombie);
_registry[EntityArrow.TypeId] = typeof(EntityArrow);
_registry[EntityBlaze.TypeId] = typeof(EntityBlaze);
_registry[EntityBoat.TypeId] = typeof(EntityBoat);
_registry[EntityCaveSpider.TypeId] = typeof(EntityCaveSpider);
_registry[EntityChicken.TypeId] = typeof(EntityChicken);
_registry[EntityCow.TypeId] = typeof(EntityCow);
_registry[EntityCreeper.TypeId] = typeof(EntityCreeper);
_registry[EntityEgg.TypeId] = typeof(EntityEgg);
_registry[EntityEnderDragon.TypeId] = typeof(EntityEnderDragon);
_registry[EntityEnderman.TypeId] = typeof(EntityEnderman);
_registry[EntityEnderEye.TypeId] = typeof(EntityEnderEye);
_registry[EntityFallingSand.TypeId] = typeof(EntityFallingSand);
_registry[EntityFireball.TypeId] = typeof(EntityFireball);
_registry[EntityGhast.TypeId] = typeof(EntityGhast);
_registry[EntityGiant.TypeId] = typeof(EntityGiant);
_registry[EntityItem.TypeId] = typeof(EntityItem);
_registry[EntityMagmaCube.TypeId] = typeof(EntityMagmaCube);
_registry[EntityMinecart.TypeId] = typeof(EntityMinecart);
_registry[EntityMob.TypeId] = typeof(EntityMob);
_registry[EntityMonster.TypeId] = typeof(EntityMonster);
_registry[EntityMooshroom.TypeId] = typeof(EntityMooshroom);
_registry[EntityPainting.TypeId] = typeof(EntityPainting);
_registry[EntityPig.TypeId] = typeof(EntityPig);
_registry[EntityPigZombie.TypeId] = typeof(EntityPigZombie);
_registry[EntityPrimedTnt.TypeId] = typeof(EntityPrimedTnt);
_registry[EntitySheep.TypeId] = typeof(EntitySheep);
_registry[EntitySilverfish.TypeId] = typeof(EntitySilverfish);
_registry[EntitySkeleton.TypeId] = typeof(EntitySkeleton);
_registry[EntitySlime.TypeId] = typeof(EntitySlime);
_registry[EntitySmallFireball.TypeId] = typeof(EntitySmallFireball);
_registry[EntitySnowball.TypeId] = typeof(EntitySnowball);
_registry[EntitySnowman.TypeId] = typeof(EntitySnowman);
_registry[EntitySpider.TypeId] = typeof(EntitySpider);
_registry[EntitySquid.TypeId] = typeof(EntitySquid);
_registry[EntityEnderPearl.TypeId] = typeof(EntityEnderPearl);
_registry[EntityVillager.TypeId] = typeof(EntityVillager);
_registry[EntityWolf.TypeId] = typeof(EntityWolf);
_registry[EntityXPOrb.TypeId] = typeof(EntityXPOrb);
_registry[EntityZombie.TypeId] = typeof(EntityZombie);
}
}
}