Added 1.9pre5 items, data, and entities. Fixed a couple entity bugs.

This commit is contained in:
Justin Aquadro 2011-11-05 12:55:47 -04:00
parent e639e7daef
commit d12f8e4dae
17 changed files with 665 additions and 1 deletions

View file

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

View file

@ -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<Entity> Members
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, BlazeSchema).Verify();
}
#endregion
#region ICopyable<Entity> Members
public override TypedEntity Copy ()
{
return new EntityBlaze(this);
}
#endregion
}
}

View file

@ -18,6 +18,11 @@ namespace Substrate.Entities
{
}
protected EntityCow (string id)
: base(id)
{
}
public EntityCow (TypedEntity e)
: base(e)
{

View file

@ -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<Entity> Members
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, EnderDragonSchema).Verify();
}
#endregion
#region ICopyable<Entity> Members
public override TypedEntity Copy ()
{
return new EntityEnderDragon(this);
}
#endregion
}
}

View file

@ -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<Entity> Members
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, EnderEyeSchema).Verify();
}
#endregion
#region ICopyable<Entity> Members
public override TypedEntity Copy ()
{
return new EntityEnderEye(this);
}
#endregion
}
}

View file

@ -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<Entity> Members
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, EnderPearlSchema).Verify();
}
#endregion
#region ICopyable<Entity> Members
public override TypedEntity Copy ()
{
return new EntityEnderPearl(this);
}
#endregion
}
}

View file

@ -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<Entity> 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<Entity> Members
public override TypedEntity Copy ()
{
return new EntityFireball(this);
}
#endregion
}
}

View file

@ -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<Entity> Members
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, MagmaCubeSchema).Verify();
}
#endregion
#region ICopyable<Entity> Members
public override TypedEntity Copy ()
{
return new EntityMagmaCube(this);
}
#endregion
}
}

View file

@ -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<Entity> Members
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, MooshroomSchema).Verify();
}
#endregion
#region ICopyable<Entity> Members
public override TypedEntity Copy ()
{
return new EntityMooshroom(this);
}
#endregion
}
}

View file

@ -27,6 +27,11 @@ namespace Substrate.Entities
{
}
protected EntitySlime (string id)
: base(id)
{
}
public EntitySlime (TypedEntity e)
: base(e)
{

View file

@ -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<Entity> Members
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, SmallFireballSchema).Verify();
}
#endregion
#region ICopyable<Entity> Members
public override TypedEntity Copy ()
{
return new EntitySmallFireball(this);
}
#endregion
}
}

View file

@ -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<Entity> Members
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, SnowmanSchema).Verify();
}
#endregion
#region ICopyable<Entity> Members
public override TypedEntity Copy ()
{
return new EntitySnowman(this);
}
#endregion
}
}

View file

@ -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<Entity> 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<Entity> Members
public override TypedEntity Copy ()
{
return new EntityVillager(this);
}
#endregion
}
}

View file

@ -93,7 +93,7 @@ namespace Substrate.Entities
public override TypedEntity Copy ()
{
return new EntityPig(this);
return new EntityWolf(this);
}
#endregion

View file

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

View file

@ -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");
}

View file

@ -70,9 +70,19 @@
<Compile Include="Source\Core\OpenWorldEvent.cs" />
<Compile Include="Source\Core\RegionInterface.cs" />
<Compile Include="Source\Core\UnboundedBlockInterface.cs" />
<Compile Include="Source\Entities\EntityBlaze.cs" />
<Compile Include="Source\Entities\EntityCaveSpider.cs" />
<Compile Include="Source\Entities\EntityEnderDragon.cs" />
<Compile Include="Source\Entities\EntityEnderEye.cs" />
<Compile Include="Source\Entities\EntityEnderman.cs" />
<Compile Include="Source\Entities\EntityEnderPearl.cs" />
<Compile Include="Source\Entities\EntityFireball.cs" />
<Compile Include="Source\Entities\EntityMagmaCube.cs" />
<Compile Include="Source\Entities\EntityMooshroom.cs" />
<Compile Include="Source\Entities\EntitySilverfish.cs" />
<Compile Include="Source\Entities\EntitySmallFireball.cs" />
<Compile Include="Source\Entities\EntitySnowman.cs" />
<Compile Include="Source\Entities\EntityVillager.cs" />
<Compile Include="Source\Entities\EntityXPOrb.cs" />
<Compile Include="Source\ImportExport\Schematic.cs" />
<Compile Include="Source\LevelIOException.cs" />