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("") 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("inData", TagType.TAG_BYTE, SchemaOptions.CREATE_ON_MISSING),
new SchemaNodeScaler("player", 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 _inData;
private byte _player; private byte _player;
@ -30,13 +35,13 @@ namespace Substrate.Entities
set { _player = (byte)(value ? 1 : 0); } set { _player = (byte)(value ? 1 : 0); }
} }
public EntityArrow () protected EntityArrow (string id)
: base("Arrow") : base(id)
{ {
} }
protected EntityArrow (string id) public EntityArrow ()
: base(id) : this(TypeId)
{ {
} }

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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