Including 1.9p5 block types, block data, and tile entities

This commit is contained in:
Justin Aquadro 2011-11-05 00:31:08 -04:00
parent ee60d217a1
commit e639e7daef
7 changed files with 310 additions and 1 deletions

View file

@ -128,6 +128,18 @@ namespace Substrate
public const int FENCE_GATE = 107;
public const int BRICK_STAIRS = 108;
public const int STONE_BRICK_STAIRS = 109;
public const int MYCELIUM = 110;
public const int LILLY_PAD = 111;
public const int NETHER_BRICK = 112;
public const int NETHER_BRICK_FENCE = 113;
public const int NETHER_BRICK_STAIRS = 114;
public const int NETHER_WART = 115;
public const int ENCHANTMENT_TABLE = 116;
public const int BREWING_STAND = 117;
public const int CAULDRON = 118;
public const int END_PORTAL = 119;
public const int END_PORTAL_FRAME = 120;
public const int END_STONE = 121;
}
/// <summary>
@ -585,6 +597,18 @@ namespace Substrate
public static BlockInfo FenceGate;
public static BlockInfo BrickStairs;
public static BlockInfo StoneBrickStairs;
public static BlockInfo Mycelium;
public static BlockInfo LillyPad;
public static BlockInfo NetherBrick;
public static BlockInfo NetherBrickFence;
public static BlockInfo NetherBrickStairs;
public static BlockInfo NetherWart;
public static BlockInfoEx EnchantmentTable;
public static BlockInfoEx BrewingStand;
public static BlockInfo Cauldron;
public static BlockInfoEx EndPortal;
public static BlockInfo EndPortalFrame;
public static BlockInfo EndStone;
static BlockInfo ()
{
@ -706,6 +730,18 @@ namespace Substrate
FenceGate = new BlockInfo(107, "Fence Gate").SetOpacity(0);
BrickStairs = new BlockInfo(108, "Brick Stairs").SetOpacity(0);
StoneBrickStairs = new BlockInfo(109, "Stone Brick Stairs").SetOpacity(0);
Mycelium = new BlockInfo(110, "Mycelium");
LillyPad = new BlockInfo(111, "Lilly Pad").SetOpacity(0).SetState(BlockState.NONSOLID);
NetherBrick = new BlockInfo(112, "Nether Brick");
NetherBrickFence = new BlockInfo(113, "Nether Brick Fence").SetOpacity(0);
NetherBrickStairs = new BlockInfo(114, "Nether Brick Stairs").SetOpacity(0);
NetherWart = new BlockInfo(115, "Nether Wart").SetOpacity(0).SetState(BlockState.NONSOLID);
EnchantmentTable = (BlockInfoEx)new BlockInfoEx(116, "Enchantment Table").SetOpacity(0);
BrewingStand = (BlockInfoEx)new BlockInfoEx(117, "Brewing Stand").SetOpacity(0);
Cauldron = new BlockInfo(118, "Cauldron").SetOpacity(0);
EndPortal = (BlockInfoEx)new BlockInfoEx(119, "End Portal").SetOpacity(0).SetLuminance(MAX_LUMINANCE).SetState(BlockState.NONSOLID);
EndPortalFrame = new BlockInfo(120, "End Portal Frame").SetLuminance(MAX_LUMINANCE);
EndStone = new BlockInfo(121, "End Stone");
for (int i = 0; i < MAX_BLOCKS; i++) {
if (_blockTable[i] == null) {
@ -723,6 +759,7 @@ namespace Substrate
CobbleStairs.SetLightTransmission(false);
BrickStairs.SetLightTransmission(false);
StoneBrickStairs.SetLightTransmission(false);
NetherBrickStairs.SetLightTransmission(false);
// Override default fluid blocking rules
@ -741,6 +778,9 @@ namespace Substrate
BurningFurnace.SetTileEntity("Furnace");
SignPost.SetTileEntity("Sign");
WallSign.SetTileEntity("Sign");
EnchantmentTable.SetTileEntity("EnchantTable");
BrewingStand.SetTileEntity("Cauldron");
EndPortal.SetTileEntity("Airportal");
// Set Data Limits
@ -771,6 +811,7 @@ namespace Substrate
WoodDoor.SetDataLimits(0, 3, 0xC);
IronDoor.SetDataLimits(0, 3, 0xC);
StoneButton.SetDataLimits(1, 4, 0x8);
Snow.SetDataLimits(0, 7, 0);
SignPost.SetDataLimits(0, 15, 0);
WallSign.SetDataLimits(2, 5, 0);
Furnace.SetDataLimits(2, 5, 0);
@ -780,7 +821,7 @@ namespace Substrate
JackOLantern.SetDataLimits(0, 3, 0);
StonePlate.SetDataLimits(0, 0, 0x1);
WoodPlate.SetDataLimits(0, 0, 0x1);
Slab.SetDataLimits(0, 3, 0);
Slab.SetDataLimits(0, 6, 0);
DoubleSlab.SetDataLimits(0, 3, 0);
Cactus.SetDataLimits(0, 5, 0);
Bed.SetDataLimits(0, 3, 0x8);
@ -792,6 +833,10 @@ namespace Substrate
HugeBrownMushroom.SetDataLimits(0, 10, 0);
Vines.SetDataLimits(0, 0, 0xF);
FenceGate.SetDataLimits(0, 3, 0x4);
SilverfishStone.SetDataLimits(0, 2, 0);
BrewingStand.SetDataLimits(0, 0, 0x7);
Cauldron.SetDataLimits(0, 3, 0);
EndPortalFrame.SetDataLimits(0, 0, 0x7);
}
}

View file

@ -231,6 +231,8 @@ namespace Substrate
SANDSTONE = 1,
WOOD = 2,
COBBLESTONE = 3,
BRICK = 4,
STONE_BRICK = 5,
}
public enum BedOrientation
@ -355,6 +357,36 @@ namespace Substrate
OPEN = 0x4,
}
public enum SilverfishBlockType
{
STONE = 0,
COBBLESTONE = 1,
STONE_BRICK = 2,
}
[Flags]
public enum BrewingStandState
{
NONE = 0x0,
SLOT_EAST = 0x1,
SLOT_SOUTHWEST = 0x2,
SLOT_NORTHWEST = 0x4,
}
public enum CauldronLevel
{
EMPTY = 0,
ONE_THIRD = 1,
TWO_THIRDS = 2,
FULL = 3,
}
[Flags]
public enum EndPortalState
{
EYE_OF_ENDER = 0x4,
}
// Item Data
public enum CoalType

View file

@ -0,0 +1,100 @@
using System;
using System.Collections.Generic;
using Substrate.Core;
using Substrate.Nbt;
namespace Substrate.TileEntities
{
public class TileEntityBrewingStand : TileEntity, IItemContainer
{
public static readonly SchemaNodeCompound BrewingStandSchema = TileEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Cauldron"),
new SchemaNodeList("Items", TagType.TAG_COMPOUND, ItemCollection.Schema),
new SchemaNodeScaler("BrewTime", TagType.TAG_SHORT),
});
private const int _CAPACITY = 4;
private ItemCollection _items;
private short _brewTime;
public TileEntityBrewingStand ()
: base("Cauldron")
{
_items = new ItemCollection(_CAPACITY);
}
public TileEntityBrewingStand (TileEntity te)
: base(te)
{
TileEntityBrewingStand tec = te as TileEntityBrewingStand;
if (tec != null) {
_items = tec._items.Copy();
_brewTime = tec._brewTime;
}
else {
_items = new ItemCollection(_CAPACITY);
}
}
public int BrewTime
{
get { return _brewTime; }
set { _brewTime = (short)value; }
}
#region ICopyable<TileEntity> Members
public override TileEntity Copy ()
{
return new TileEntityBrewingStand(this);
}
#endregion
#region IItemContainer Members
public ItemCollection Items
{
get { return _items; }
}
#endregion
#region INBTObject<TileEntity> Members
public override TileEntity LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
return null;
}
TagNodeList items = ctree["Items"].ToTagList();
_items = new ItemCollection(_CAPACITY).LoadTree(items);
_brewTime = ctree["BrewTime"].ToTagShort();
return this;
}
public override TagNode BuildTree ()
{
TagNodeCompound tree = base.BuildTree() as TagNodeCompound;
tree["Items"] = _items.BuildTree();
tree["BrewTime"] = new TagNodeShort(_brewTime);
return tree;
}
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, BrewingStandSchema).Verify();
}
#endregion
}
}

View file

@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Substrate.TileEntities
{
using Substrate.Nbt;
public class TileEntityEnchantmentTable : TileEntity
{
public static readonly SchemaNodeCompound EnchantTableSchema = TileEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "EnchantTable"),
});
public TileEntityEnchantmentTable ()
: base("EnchantTable")
{
}
public TileEntityEnchantmentTable (TileEntity te)
: base(te)
{
}
#region ICopyable<TileEntity> Members
public override TileEntity Copy ()
{
return new TileEntityEnchantmentTable(this);
}
#endregion
#region INBTObject<TileEntity> Members
public override TileEntity LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
return null;
}
return this;
}
public override TagNode BuildTree ()
{
TagNodeCompound tree = base.BuildTree() as TagNodeCompound;
return tree;
}
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, EnchantTableSchema).Verify();
}
#endregion
}
}

View file

@ -0,0 +1,63 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace Substrate.TileEntities
{
using Substrate.Nbt;
public class TileEntityEndPortal : TileEntity
{
public static readonly SchemaNodeCompound EndPortalSchema = TileEntity.Schema.MergeInto(new SchemaNodeCompound("")
{
new SchemaNodeString("id", "Airportal"),
});
public TileEntityEndPortal ()
: base("Airportal")
{
}
public TileEntityEndPortal (TileEntity te)
: base(te)
{
}
#region ICopyable<TileEntity> Members
public override TileEntity Copy ()
{
return new TileEntityEndPortal(this);
}
#endregion
#region INBTObject<TileEntity> Members
public override TileEntity LoadTree (TagNode tree)
{
TagNodeCompound ctree = tree as TagNodeCompound;
if (ctree == null || base.LoadTree(tree) == null) {
return null;
}
return this;
}
public override TagNode BuildTree ()
{
TagNodeCompound tree = base.BuildTree() as TagNodeCompound;
return tree;
}
public override bool ValidateTree (TagNode tree)
{
return new NbtVerifier(tree, EndPortalSchema).Verify();
}
#endregion
}
}

View file

@ -77,7 +77,10 @@ namespace Substrate
static TileEntityFactory ()
{
_registry["Airportal"] = typeof(TileEntityEndPortal);
_registry["Cauldron"] = typeof(TileEntityBrewingStand);
_registry["Chest"] = typeof(TileEntityChest);
_registry["EnchantTable"] = typeof(TileEntityEnchantmentTable);
_registry["Furnace"] = typeof(TileEntityFurnace);
_registry["MobSpawner"] = typeof(TileEntityMobSpawner);
_registry["Music"] = typeof(TileEntityMusic);

View file

@ -174,7 +174,10 @@
<Compile Include="Source\RegionManager.cs" />
<Compile Include="Source\SpawnPoint.cs" />
<Compile Include="Source\SubstrateException.cs" />
<Compile Include="Source\TileEntities\TileEntityBrewingStand.cs" />
<Compile Include="Source\TileEntities\TileEntityChest.cs" />
<Compile Include="Source\TileEntities\TileEntityEnchantmentTable.cs" />
<Compile Include="Source\TileEntities\TileEntityEndPortal.cs" />
<Compile Include="Source\TileEntities\TileEntityFurnace.cs" />
<Compile Include="Source\TileEntities\TileEntityMobSpawner.cs" />
<Compile Include="Source\TileEntities\TileEntityPiston.cs" />