diff --git a/SubstrateCS/Source/Data.cs b/SubstrateCS/Source/Data.cs index 6dc556b..4a6d4f1 100644 --- a/SubstrateCS/Source/Data.cs +++ b/SubstrateCS/Source/Data.cs @@ -19,6 +19,14 @@ namespace Substrate OAK = 0, SPRUCE = 1, BIRCH = 2, + DARK_OAK = 3, + } + + [Flags] + public enum LeafState + { + PERMANENT = 0x4, + DECAY_CHECK = 0x8, } public enum SaplingType diff --git a/SubstrateCS/Source/Entities/EntityBlaze.cs b/SubstrateCS/Source/Entities/EntityBlaze.cs new file mode 100644 index 0000000..e1c4b2f --- /dev/null +++ b/SubstrateCS/Source/Entities/EntityBlaze.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public class EntityBlaze : EntityMob + { + public static readonly SchemaNodeCompound BlazeSchema = MobSchema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "Blaze"), + }); + + public EntityBlaze () + : base("Blaze") + { + } + + public EntityBlaze (TypedEntity e) + : base(e) + { + } + + + #region INBTObject Members + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, BlazeSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntityBlaze(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntityCow.cs b/SubstrateCS/Source/Entities/EntityCow.cs index eef86ee..9d46d90 100644 --- a/SubstrateCS/Source/Entities/EntityCow.cs +++ b/SubstrateCS/Source/Entities/EntityCow.cs @@ -18,6 +18,11 @@ namespace Substrate.Entities { } + protected EntityCow (string id) + : base(id) + { + } + public EntityCow (TypedEntity e) : base(e) { diff --git a/SubstrateCS/Source/Entities/EntityEnderDragon.cs b/SubstrateCS/Source/Entities/EntityEnderDragon.cs new file mode 100644 index 0000000..2ea69a2 --- /dev/null +++ b/SubstrateCS/Source/Entities/EntityEnderDragon.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public class EntityEnderDragon : EntityMob + { + public static readonly SchemaNodeCompound EnderDragonSchema = MobSchema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "EnderDragon"), + }); + + public EntityEnderDragon () + : base("EnderDragon") + { + } + + public EntityEnderDragon (TypedEntity e) + : base(e) + { + } + + + #region INBTObject Members + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, EnderDragonSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntityEnderDragon(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntityEnderEye.cs b/SubstrateCS/Source/Entities/EntityEnderEye.cs new file mode 100644 index 0000000..b49b676 --- /dev/null +++ b/SubstrateCS/Source/Entities/EntityEnderEye.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public class EntityEnderEye : TypedEntity + { + public static readonly SchemaNodeCompound EnderEyeSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "EyeOfEnderSignal"), + }); + + public EntityEnderEye () + : base("EyeOfEnderSignal") + { + } + + public EntityEnderEye (TypedEntity e) + : base(e) + { + } + + + #region INBTObject Members + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, EnderEyeSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntityEnderEye(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntityEnderPearl.cs b/SubstrateCS/Source/Entities/EntityEnderPearl.cs new file mode 100644 index 0000000..db2e5e2 --- /dev/null +++ b/SubstrateCS/Source/Entities/EntityEnderPearl.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public class EntityEnderPearl : EntityThrowable + { + public static readonly SchemaNodeCompound EnderPearlSchema = ThrowableSchema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "ThrownEnderpearl"), + }); + + public EntityEnderPearl () + : base("ThrownEnderpearl") + { + } + + public EntityEnderPearl (TypedEntity e) + : base(e) + { + } + + + #region INBTObject Members + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, EnderPearlSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntityEnderPearl(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntityFireball.cs b/SubstrateCS/Source/Entities/EntityFireball.cs new file mode 100644 index 0000000..e36837d --- /dev/null +++ b/SubstrateCS/Source/Entities/EntityFireball.cs @@ -0,0 +1,128 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public class EntityFireball : TypedEntity + { + public static readonly SchemaNodeCompound FireballSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "Fireball"), + new SchemaNodeScaler("xTile", TagType.TAG_SHORT), + new SchemaNodeScaler("yTile", TagType.TAG_SHORT), + new SchemaNodeScaler("zTile", TagType.TAG_SHORT), + new SchemaNodeScaler("inTile", TagType.TAG_BYTE), + new SchemaNodeScaler("inGround", TagType.TAG_BYTE), + }); + + private short _xTile; + private short _yTile; + private short _zTile; + private byte _inTile; + private byte _inGround; + + public int XTile + { + get { return _xTile; } + set { _xTile = (short)value; } + } + + public int YTile + { + get { return _yTile; } + set { _yTile = (short)value; } + } + + public int ZTile + { + get { return _zTile; } + set { _zTile = (short)value; } + } + + public int InTile + { + get { return _inTile; } + set { _inTile = (byte)value; } + } + + public bool IsInGround + { + get { return _inGround == 1; } + set { _inGround = (byte)(value ? 1 : 0); } + } + + public EntityFireball () + : base("Fireball") + { + } + + protected EntityFireball (string id) + : base(id) + { + } + + public EntityFireball (TypedEntity e) + : base(e) + { + EntityFireball e2 = e as EntityFireball; + if (e2 != null) { + _xTile = e2._xTile; + _yTile = e2._yTile; + _zTile = e2._zTile; + _inTile = e2._inTile; + _inGround = e2._inGround; + } + } + + + #region INBTObject Members + + public override TypedEntity LoadTree (TagNode tree) + { + TagNodeCompound ctree = tree as TagNodeCompound; + if (ctree == null || base.LoadTree(tree) == null) { + return null; + } + + _xTile = ctree["xTile"].ToTagShort(); + _yTile = ctree["yTile"].ToTagShort(); + _zTile = ctree["zTile"].ToTagShort(); + _inTile = ctree["inTile"].ToTagByte(); + _inGround = ctree["inGround"].ToTagByte(); + + return this; + } + + public override TagNode BuildTree () + { + TagNodeCompound tree = base.BuildTree() as TagNodeCompound; + tree["xTile"] = new TagNodeShort(_xTile); + tree["yTile"] = new TagNodeShort(_yTile); + tree["zTile"] = new TagNodeShort(_zTile); + tree["inTile"] = new TagNodeByte(_inTile); + tree["inGround"] = new TagNodeByte(_inGround); + + return tree; + } + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, FireballSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntityFireball(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntityMagmaCube.cs b/SubstrateCS/Source/Entities/EntityMagmaCube.cs new file mode 100644 index 0000000..24c826e --- /dev/null +++ b/SubstrateCS/Source/Entities/EntityMagmaCube.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public class EntityMagmaCube : EntitySlime + { + public static readonly SchemaNodeCompound MagmaCubeSchema = SlimeSchema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "LavaSlime"), + }); + + public EntityMagmaCube () + : base("LavaSlime") + { + } + + public EntityMagmaCube (TypedEntity e) + : base(e) + { + } + + + #region INBTObject Members + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, MagmaCubeSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntityMagmaCube(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntityMooshroom.cs b/SubstrateCS/Source/Entities/EntityMooshroom.cs new file mode 100644 index 0000000..c7a6901 --- /dev/null +++ b/SubstrateCS/Source/Entities/EntityMooshroom.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public class EntityMooshroom : EntityCow + { + public static readonly SchemaNodeCompound MooshroomSchema = CowSchema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "MushroomCow"), + }); + + public EntityMooshroom () + : base("MushroomCow") + { + } + + public EntityMooshroom (TypedEntity e) + : base(e) + { + } + + + #region INBTObject Members + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, MooshroomSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntityMooshroom(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntitySlime.cs b/SubstrateCS/Source/Entities/EntitySlime.cs index b318913..df4bc10 100644 --- a/SubstrateCS/Source/Entities/EntitySlime.cs +++ b/SubstrateCS/Source/Entities/EntitySlime.cs @@ -27,6 +27,11 @@ namespace Substrate.Entities { } + protected EntitySlime (string id) + : base(id) + { + } + public EntitySlime (TypedEntity e) : base(e) { diff --git a/SubstrateCS/Source/Entities/EntitySmallFireball.cs b/SubstrateCS/Source/Entities/EntitySmallFireball.cs new file mode 100644 index 0000000..a502286 --- /dev/null +++ b/SubstrateCS/Source/Entities/EntitySmallFireball.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public class EntitySmallFireball : EntityFireball + { + public static readonly SchemaNodeCompound SmallFireballSchema = FireballSchema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "SmallFireball"), + }); + + public EntitySmallFireball () + : base("SmallFireball") + { + } + + public EntitySmallFireball (TypedEntity e) + : base(e) + { + } + + + #region INBTObject Members + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, SmallFireballSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntitySmallFireball(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntitySnowman.cs b/SubstrateCS/Source/Entities/EntitySnowman.cs new file mode 100644 index 0000000..fd4e9f0 --- /dev/null +++ b/SubstrateCS/Source/Entities/EntitySnowman.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public class EntitySnowman : EntityMob + { + public static readonly SchemaNodeCompound SnowmanSchema = MobSchema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "SnowMan"), + }); + + public EntitySnowman () + : base("SnowMan") + { + } + + public EntitySnowman (TypedEntity e) + : base(e) + { + } + + + #region INBTObject Members + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, SnowmanSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntitySnowman(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntityVillager.cs b/SubstrateCS/Source/Entities/EntityVillager.cs new file mode 100644 index 0000000..7cd6c19 --- /dev/null +++ b/SubstrateCS/Source/Entities/EntityVillager.cs @@ -0,0 +1,88 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Substrate.Entities +{ + using Substrate.Nbt; + + public enum VillagerProfession + { + Farmer = 0, + Librarian = 1, + Priest = 2, + Smith = 3, + Butcher = 4, + } + + public class EntityVillager : EntityMob + { + public static readonly SchemaNodeCompound VillagerSchema = MobSchema.MergeInto(new SchemaNodeCompound("") + { + new SchemaNodeString("id", "Villager"), + new SchemaNodeScaler("Profession", TagType.TAG_INT), + }); + + private int _profession; + + public VillagerProfession Profession + { + get { return (VillagerProfession)_profession; } + set { _profession = (int)value; } + } + + public EntityVillager () + : base("Villager") + { + } + + public EntityVillager (TypedEntity e) + : base(e) + { + EntityVillager e2 = e as EntityVillager; + if (e2 != null) { + _profession = e2._profession; + } + } + + + #region INBTObject Members + + public override TypedEntity LoadTree (TagNode tree) + { + TagNodeCompound ctree = tree as TagNodeCompound; + if (ctree == null || base.LoadTree(tree) == null) { + return null; + } + + _profession = ctree["Profession"].ToTagInt(); + + return this; + } + + public override TagNode BuildTree () + { + TagNodeCompound tree = base.BuildTree() as TagNodeCompound; + tree["Profession"] = new TagNodeInt(_profession); + + return tree; + } + + public override bool ValidateTree (TagNode tree) + { + return new NbtVerifier(tree, VillagerSchema).Verify(); + } + + #endregion + + + #region ICopyable Members + + public override TypedEntity Copy () + { + return new EntityVillager(this); + } + + #endregion + } +} diff --git a/SubstrateCS/Source/Entities/EntityWolf.cs b/SubstrateCS/Source/Entities/EntityWolf.cs index 7a1e282..332d7d3 100644 --- a/SubstrateCS/Source/Entities/EntityWolf.cs +++ b/SubstrateCS/Source/Entities/EntityWolf.cs @@ -93,7 +93,7 @@ namespace Substrate.Entities public override TypedEntity Copy () { - return new EntityPig(this); + return new EntityWolf(this); } #endregion diff --git a/SubstrateCS/Source/EntityFactory.cs b/SubstrateCS/Source/EntityFactory.cs index b6984bd..b5304c1 100644 --- a/SubstrateCS/Source/EntityFactory.cs +++ b/SubstrateCS/Source/EntityFactory.cs @@ -80,20 +80,26 @@ 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); @@ -102,9 +108,13 @@ namespace Substrate _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); diff --git a/SubstrateCS/Source/ItemInfo.cs b/SubstrateCS/Source/ItemInfo.cs index ea87405..a6344cb 100644 --- a/SubstrateCS/Source/ItemInfo.cs +++ b/SubstrateCS/Source/ItemInfo.cs @@ -125,6 +125,20 @@ namespace Substrate public const int COOKED_CHICKEN = 366; public const int ROTTEN_FLESH = 367; public const int ENDER_PEARL = 368; + public const int BLAZE_ROD = 369; + public const int GHAST_TEAR = 370; + public const int GOLD_NUGGET = 371; + public const int NETHER_WART = 372; + public const int POTION = 373; + public const int GLASS_BOTTLE = 374; + public const int SPIDER_EYE = 375; + public const int FERMENTED_SPIDER_EYE = 376; + public const int BLAZE_POWDER = 377; + public const int MAGMA_CREAM = 378; + public const int BREWING_STAND = 379; + public const int CAULDRON = 380; + public const int EYE_OF_ENDER = 381; + public const int GLISTERING_MELON = 382; public const int GOLD_MUSIC_DISC = 2256; public const int GREEN_MUSIC_DISC = 2257; } @@ -358,6 +372,20 @@ namespace Substrate public static ItemInfo CookedChicken; public static ItemInfo RottenFlesh; public static ItemInfo EnderPearl; + public static ItemInfo BlazeRod; + public static ItemInfo GhastTear; + public static ItemInfo GoldNugget; + public static ItemInfo NetherWart; + public static ItemInfo Potion; + public static ItemInfo GlassBottle; + public static ItemInfo SpiderEye; + public static ItemInfo FermentedSpiderEye; + public static ItemInfo BlazePowder; + public static ItemInfo MagmaCream; + public static ItemInfo BrewingStand; + public static ItemInfo Cauldron; + public static ItemInfo EyeOfEnder; + public static ItemInfo GlisteringMelon; public static ItemInfo GoldMusicDisc; public static ItemInfo GreenMusicDisc; @@ -479,6 +507,20 @@ namespace Substrate CookedChicken = new ItemInfo(366, "Cooked Chicken").SetStackSize(64); RottenFlesh = new ItemInfo(367, "Rotten Flesh").SetStackSize(64); EnderPearl = new ItemInfo(368, "Ender Pearl").SetStackSize(64); + BlazeRod = new ItemInfo(369, "Blaze Rod").SetStackSize(64); + GhastTear = new ItemInfo(370, "Ghast Tear").SetStackSize(64); + GoldNugget = new ItemInfo(371, "Gold Nugget").SetStackSize(64); + NetherWart = new ItemInfo(372, "Nether Wart").SetStackSize(64); + Potion = new ItemInfo(373, "Potion"); + GlassBottle = new ItemInfo(374, "Glass Bottle").SetStackSize(64); + SpiderEye = new ItemInfo(375, "Spider Eye").SetStackSize(64); + FermentedSpiderEye = new ItemInfo(376, "Fermented Spider Eye").SetStackSize(64); + BlazePowder = new ItemInfo(377, "Blaze Powder").SetStackSize(64); + MagmaCream = new ItemInfo(378, "Magma Cream").SetStackSize(64); + BrewingStand = new ItemInfo(379, "Brewing Stand").SetStackSize(64); + Cauldron = new ItemInfo(380, "Cauldron"); + EyeOfEnder = new ItemInfo(381, "Eye of Ender").SetStackSize(64); + GlisteringMelon = new ItemInfo(382, "Glistering Melon").SetStackSize(64); GoldMusicDisc = new ItemInfo(2256, "Gold Music Disc"); GreenMusicDisc = new ItemInfo(2257, "Green Music Disc"); } diff --git a/SubstrateCS/Substrate.csproj b/SubstrateCS/Substrate.csproj index 19301df..a05fa87 100644 --- a/SubstrateCS/Substrate.csproj +++ b/SubstrateCS/Substrate.csproj @@ -70,9 +70,19 @@ + + + + + + + + + +