Added more 1.3 block, item, and player data.

This commit is contained in:
Justin Aquadro 2012-07-22 00:20:46 -04:00
parent 6bb81f187f
commit 3fa526fcc9
5 changed files with 149 additions and 0 deletions

View file

@ -144,6 +144,16 @@ namespace Substrate
public const int REDSTONE_LAMP_ON = 124; public const int REDSTONE_LAMP_ON = 124;
public const int DOUBLE_WOOD_SLAB = 125; public const int DOUBLE_WOOD_SLAB = 125;
public const int WOOD_SLAB = 126; public const int WOOD_SLAB = 126;
public const int COCOA_PLANT = 127;
public const int SANDSTONE_STAIRS = 128;
public const int EMERALD_ORE = 129;
public const int ENDER_CHEST = 130;
public const int TRIPWIRE_HOOK = 131;
public const int TRIPWIRE = 132;
public const int EMERALD_BLOCK = 133;
public const int SPRUCE_WOOD_STAIRS = 134;
public const int BIRCH_WOOD_STAIRS = 135;
public const int JUNGLE_WOOD_STAIRS = 136;
} }
/// <summary> /// <summary>
@ -641,6 +651,16 @@ namespace Substrate
public static BlockInfo RedstoneLampOn; public static BlockInfo RedstoneLampOn;
public static BlockInfo DoubleWoodSlab; public static BlockInfo DoubleWoodSlab;
public static BlockInfo WoodSlab; public static BlockInfo WoodSlab;
public static BlockInfo CocoaPlant;
public static BlockInfo SandstoneStairs;
public static BlockInfo EmeraldOre;
public static BlockInfoEx EnderChest;
public static BlockInfo TripwireHook;
public static BlockInfo Tripwire;
public static BlockInfo EmeraldBlock;
public static BlockInfo SpruceWoodStairs;
public static BlockInfo BirchWoodStairs;
public static BlockInfo JungleWoodStairs;
static BlockInfo () static BlockInfo ()
{ {
@ -779,6 +799,16 @@ namespace Substrate
RedstoneLampOn = new BlockInfo(124, "Redstone Lamp (On)").SetLuminance(15).SetTick(2); RedstoneLampOn = new BlockInfo(124, "Redstone Lamp (On)").SetLuminance(15).SetTick(2);
DoubleWoodSlab = new BlockInfo(125, "Double Wood Slab"); DoubleWoodSlab = new BlockInfo(125, "Double Wood Slab");
WoodSlab = new BlockInfo(126, "Wood Slab"); WoodSlab = new BlockInfo(126, "Wood Slab");
CocoaPlant = new BlockInfo(127, "Cocoa Plant").SetLuminance(2).SetOpacity(0);
SandstoneStairs = new BlockInfo(128, "Sandstone Stairs").SetOpacity(0);
EmeraldOre = new BlockInfo(129, "Emerald Ore");
EnderChest = (BlockInfoEx)new BlockInfoEx(130, "Ender Chest").SetLuminance(7).SetOpacity(0);
TripwireHook = new BlockInfo(131, "Tripwire Hook").SetOpacity(0).SetState(BlockState.NONSOLID);
Tripwire = new BlockInfo(132, "Tripwire").SetOpacity(0).SetState(BlockState.NONSOLID);
EmeraldBlock = new BlockInfo(133, "Emerald Block");
SpruceWoodStairs = new BlockInfo(134, "Sprice Wood Stairs").SetOpacity(0);
BirchWoodStairs = new BlockInfo(135, "Birch Wood Stairs").SetOpacity(0);
JungleWoodStairs = new BlockInfo(136, "Jungle Wood Stairs").SetOpacity(0);
for (int i = 0; i < MAX_BLOCKS; i++) { for (int i = 0; i < MAX_BLOCKS; i++) {
if (_blockTable[i] == null) { if (_blockTable[i] == null) {
@ -797,6 +827,11 @@ namespace Substrate
BrickStairs.SetLightTransmission(false); BrickStairs.SetLightTransmission(false);
StoneBrickStairs.SetLightTransmission(false); StoneBrickStairs.SetLightTransmission(false);
NetherBrickStairs.SetLightTransmission(false); NetherBrickStairs.SetLightTransmission(false);
WoodSlab.SetLightTransmission(false);
SandstoneStairs.SetLightTransmission(false);
SpruceWoodStairs.SetLightTransmission(false);
BirchWoodStairs.SetLightTransmission(false);
JungleWoodStairs.SetLightTransmission(false);
// Override default fluid blocking rules // Override default fluid blocking rules
@ -818,6 +853,7 @@ namespace Substrate
EnchantmentTable.SetTileEntity("EnchantTable"); EnchantmentTable.SetTileEntity("EnchantTable");
BrewingStand.SetTileEntity("Cauldron"); BrewingStand.SetTileEntity("Cauldron");
EndPortal.SetTileEntity("Airportal"); EndPortal.SetTileEntity("Airportal");
EnderChest.SetTileEntity("EnderChest");
// Set Data Limits // Set Data Limits
@ -876,6 +912,8 @@ namespace Substrate
EndPortalFrame.SetDataLimits(0, 0, 0x7); EndPortalFrame.SetDataLimits(0, 0, 0x7);
WoodSlab.SetDataLimits(0, 5, 0); WoodSlab.SetDataLimits(0, 5, 0);
DoubleWoodSlab.SetDataLimits(0, 5, 0x8); DoubleWoodSlab.SetDataLimits(0, 5, 0x8);
TripwireHook.SetDataLimits(0, 3, 0xC);
Tripwire.SetDataLimits(0, 0, 0x5);
} }
} }

View file

@ -414,6 +414,28 @@ namespace Substrate
EYE_OF_ENDER = 0x4, EYE_OF_ENDER = 0x4,
} }
public enum TripwireHookDirection
{
SOUTH = 0,
WEST = 1,
NORTH = 2,
EAST = 3,
}
[Flags]
public enum TripwireHookState
{
READY = 0x04,
ACTIVATED = 0x08,
}
[Flags]
public enum TripwireState
{
UNDER_OBJECT = 0x01,
ACTIVATED = 0x04,
}
// Item Data // Item Data
public enum CoalType public enum CoalType

View file

@ -17,6 +17,9 @@ namespace Substrate
new SchemaNodeScaler("Count", TagType.TAG_BYTE), new SchemaNodeScaler("Count", TagType.TAG_BYTE),
new SchemaNodeCompound("tag", new SchemaNodeCompound("") { new SchemaNodeCompound("tag", new SchemaNodeCompound("") {
new SchemaNodeList("ench", TagType.TAG_COMPOUND, Enchantment.Schema, SchemaOptions.OPTIONAL), new SchemaNodeList("ench", TagType.TAG_COMPOUND, Enchantment.Schema, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("title", TagType.TAG_STRING, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("author", TagType.TAG_STRING, SchemaOptions.OPTIONAL),
new SchemaNodeList("pages", TagType.TAG_STRING, SchemaOptions.OPTIONAL),
}, SchemaOptions.OPTIONAL), }, SchemaOptions.OPTIONAL),
}; };

View file

@ -142,6 +142,7 @@ namespace Substrate
public const int FIRE_CHARGE = 385; public const int FIRE_CHARGE = 385;
public const int BOOK_AND_QUILL = 386; public const int BOOK_AND_QUILL = 386;
public const int WRITTEN_BOOK = 387; public const int WRITTEN_BOOK = 387;
public const int EMERALD = 388;
public const int MUSIC_DISC_13 = 2256; public const int MUSIC_DISC_13 = 2256;
public const int MUSIC_DISC_CAT = 2257; public const int MUSIC_DISC_CAT = 2257;
public const int MUSIC_DISC_BLOCKS = 2258; public const int MUSIC_DISC_BLOCKS = 2258;
@ -403,6 +404,7 @@ namespace Substrate
public static ItemInfo FireCharge; public static ItemInfo FireCharge;
public static ItemInfo BookAndQuill; public static ItemInfo BookAndQuill;
public static ItemInfo WrittenBook; public static ItemInfo WrittenBook;
public static ItemInfo Emerald;
public static ItemInfo MusicDisc13; public static ItemInfo MusicDisc13;
public static ItemInfo MusicDiscCat; public static ItemInfo MusicDiscCat;
public static ItemInfo MusicDiscBlocks; public static ItemInfo MusicDiscBlocks;
@ -552,6 +554,7 @@ namespace Substrate
FireCharge = new ItemInfo(385, "Fire Charge").SetStackSize(64); FireCharge = new ItemInfo(385, "Fire Charge").SetStackSize(64);
BookAndQuill = new ItemInfo(386, "Book and Quill"); BookAndQuill = new ItemInfo(386, "Book and Quill");
WrittenBook = new ItemInfo(387, "Written Book"); WrittenBook = new ItemInfo(387, "Written Book");
Emerald = new ItemInfo(388, "Emerald").SetStackSize(64);
MusicDisc13 = new ItemInfo(2256, "13 Disc"); MusicDisc13 = new ItemInfo(2256, "13 Disc");
MusicDiscCat = new ItemInfo(2257, "Cat Disc"); MusicDiscCat = new ItemInfo(2257, "Cat Disc");
MusicDiscBlocks = new ItemInfo(2258, "Blocks Disc"); MusicDiscBlocks = new ItemInfo(2258, "Blocks Disc");

View file

@ -9,12 +9,17 @@ namespace Substrate
/// <summary> /// <summary>
/// Encompases data to specify player abilities, especially mode-dependent abilities. /// Encompases data to specify player abilities, especially mode-dependent abilities.
/// </summary> /// </summary>
/// <remarks>Whether or not any of these values are respected by the game client is dependent upon the active game mode.</remarks>
public class PlayerAbilities : ICopyable<PlayerAbilities> public class PlayerAbilities : ICopyable<PlayerAbilities>
{ {
private bool _flying; private bool _flying;
private bool _instabuild; private bool _instabuild;
private bool _mayfly; private bool _mayfly;
private bool _invulnerable; private bool _invulnerable;
private bool _maybuild;
private float _walkSpeed = 0.1f;
private float _flySpeed = 0.05f;
/// <summary> /// <summary>
/// Gets or sets whether the player is currently flying. /// Gets or sets whether the player is currently flying.
@ -52,6 +57,33 @@ namespace Substrate
set { _invulnerable = value; } set { _invulnerable = value; }
} }
/// <summary>
/// Gets or sets whether the player can create or destroy blocks.
/// </summary>
public bool MayBuild
{
get { return _maybuild; }
set { _maybuild = value; }
}
/// <summary>
/// Gets or sets the player's walking speed. Always 0.1.
/// </summary>
public float FlySpeed
{
get { return _flySpeed; }
set { _flySpeed = value; }
}
/// <summary>
/// Gets or sets the player's flying speed. Always 0.05.
/// </summary>
public float WalkSpeed
{
get { return _walkSpeed; }
set { _walkSpeed = value; }
}
#region ICopyable<PlayerAbilities> Members #region ICopyable<PlayerAbilities> Members
/// <inheritdoc /> /// <inheritdoc />
@ -62,6 +94,9 @@ namespace Substrate
pa._instabuild = _instabuild; pa._instabuild = _instabuild;
pa._mayfly = _mayfly; pa._mayfly = _mayfly;
pa._invulnerable = _invulnerable; pa._invulnerable = _invulnerable;
pa._maybuild = _maybuild;
pa._walkSpeed = _walkSpeed;
pa._flySpeed = _flySpeed;
return pa; return pa;
} }
@ -69,6 +104,13 @@ namespace Substrate
#endregion #endregion
} }
public enum PlayerGameType
{
Survival = 0,
Creative = 1,
Adventure = 2,
}
/// <summary> /// <summary>
/// Represents a Player from either single- or multi-player Minecraft. /// Represents a Player from either single- or multi-player Minecraft.
/// </summary> /// </summary>
@ -84,6 +126,7 @@ namespace Substrate
new SchemaNodeScaler("HurtTime", TagType.TAG_SHORT), new SchemaNodeScaler("HurtTime", TagType.TAG_SHORT),
new SchemaNodeScaler("Dimension", TagType.TAG_INT), new SchemaNodeScaler("Dimension", TagType.TAG_INT),
new SchemaNodeList("Inventory", TagType.TAG_COMPOUND, ItemCollection.Schema), new SchemaNodeList("Inventory", TagType.TAG_COMPOUND, ItemCollection.Schema),
//new SchemaNodeList("EnderItems", TagType.TAG_COMPOUND, ItemCollection.Schema, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("World", TagType.TAG_STRING, SchemaOptions.OPTIONAL), new SchemaNodeScaler("World", TagType.TAG_STRING, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("Sleeping", TagType.TAG_BYTE, SchemaOptions.CREATE_ON_MISSING), new SchemaNodeScaler("Sleeping", TagType.TAG_BYTE, SchemaOptions.CREATE_ON_MISSING),
new SchemaNodeScaler("SleepTimer", TagType.TAG_SHORT, SchemaOptions.CREATE_ON_MISSING), new SchemaNodeScaler("SleepTimer", TagType.TAG_SHORT, SchemaOptions.CREATE_ON_MISSING),
@ -98,15 +141,20 @@ namespace Substrate
new SchemaNodeScaler("XpLevel", TagType.TAG_INT, SchemaOptions.OPTIONAL), new SchemaNodeScaler("XpLevel", TagType.TAG_INT, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("XpTotal", TagType.TAG_INT, SchemaOptions.OPTIONAL), new SchemaNodeScaler("XpTotal", TagType.TAG_INT, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("Score", TagType.TAG_INT, SchemaOptions.OPTIONAL), new SchemaNodeScaler("Score", TagType.TAG_INT, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("PlayerGameType", TagType.TAG_INT, SchemaOptions.OPTIONAL),
new SchemaNodeCompound("abilities", new SchemaNodeCompound("") { new SchemaNodeCompound("abilities", new SchemaNodeCompound("") {
new SchemaNodeScaler("flying", TagType.TAG_BYTE), new SchemaNodeScaler("flying", TagType.TAG_BYTE),
new SchemaNodeScaler("instabuild", TagType.TAG_BYTE), new SchemaNodeScaler("instabuild", TagType.TAG_BYTE),
new SchemaNodeScaler("mayfly", TagType.TAG_BYTE), new SchemaNodeScaler("mayfly", TagType.TAG_BYTE),
new SchemaNodeScaler("invulnerable", TagType.TAG_BYTE), new SchemaNodeScaler("invulnerable", TagType.TAG_BYTE),
new SchemaNodeScaler("mayBuild", TagType.TAG_BYTE, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("walkSpeed", TagType.TAG_FLOAT, SchemaOptions.OPTIONAL),
new SchemaNodeScaler("flySpeed", TagType.TAG_FLOAT, SchemaOptions.OPTIONAL),
}, SchemaOptions.OPTIONAL), }, SchemaOptions.OPTIONAL),
}); });
private const int _CAPACITY = 105; private const int _CAPACITY = 105;
private const int _ENDER_CAPACITY = 27;
private short _attackTime; private short _attackTime;
private short _deathTime; private short _deathTime;
@ -134,8 +182,10 @@ namespace Substrate
private PlayerAbilities _abilities; private PlayerAbilities _abilities;
private PlayerGameType? _gameType;
private ItemCollection _inventory; private ItemCollection _inventory;
private ItemCollection _enderItems;
/// <summary> /// <summary>
/// Gets or sets the number of ticks left in the player's "invincibility shield" after last struck. /// Gets or sets the number of ticks left in the player's "invincibility shield" after last struck.
@ -182,6 +232,12 @@ namespace Substrate
set { _dimension = value; } set { _dimension = value; }
} }
public PlayerGameType GameType
{
get { return _gameType ?? PlayerGameType.Survival; }
set { _gameType = value; }
}
/// <summary> /// <summary>
/// Gets or sets a value indicating whether the player is sleeping in a bed. /// Gets or sets a value indicating whether the player is sleeping in a bed.
/// </summary> /// </summary>
@ -318,6 +374,7 @@ namespace Substrate
: base() : base()
{ {
_inventory = new ItemCollection(_CAPACITY); _inventory = new ItemCollection(_CAPACITY);
_enderItems = new ItemCollection(_ENDER_CAPACITY);
_abilities = new PlayerAbilities(); _abilities = new PlayerAbilities();
// Sane defaults // Sane defaults
@ -343,6 +400,7 @@ namespace Substrate
_hurtTime = p._hurtTime; _hurtTime = p._hurtTime;
_dimension = p._dimension; _dimension = p._dimension;
_gameType = p._gameType;
_sleeping = p._sleeping; _sleeping = p._sleeping;
_sleepTimer = p._sleepTimer; _sleepTimer = p._sleepTimer;
_spawnX = p._spawnX; _spawnX = p._spawnX;
@ -350,6 +408,7 @@ namespace Substrate
_spawnZ = p._spawnZ; _spawnZ = p._spawnZ;
_world = p._world; _world = p._world;
_inventory = p._inventory.Copy(); _inventory = p._inventory.Copy();
_enderItems = p._inventory.Copy();
_foodLevel = p._foodLevel; _foodLevel = p._foodLevel;
_foodTickTimer = p._foodTickTimer; _foodTickTimer = p._foodTickTimer;
@ -458,10 +517,22 @@ namespace Substrate
_abilities.InstantBuild = pb["instabuild"].ToTagByte().Data == 1; _abilities.InstantBuild = pb["instabuild"].ToTagByte().Data == 1;
_abilities.MayFly = pb["mayfly"].ToTagByte().Data == 1; _abilities.MayFly = pb["mayfly"].ToTagByte().Data == 1;
_abilities.Invulnerable = pb["invulnerable"].ToTagByte().Data == 1; _abilities.Invulnerable = pb["invulnerable"].ToTagByte().Data == 1;
_abilities.MayBuild = pb["mayBuild"].ToTagByte().Data == 1;
_abilities.WalkSpeed = pb["walkSpeed"].ToTagFloat();
_abilities.FlySpeed = pb["flySpeed"].ToTagFloat();
}
if (ctree.ContainsKey("PlayerGameType")) {
_gameType = (PlayerGameType)ctree["PlayerGameType"].ToTagInt().Data;
} }
_inventory.LoadTree(ctree["Inventory"].ToTagList()); _inventory.LoadTree(ctree["Inventory"].ToTagList());
if (ctree.ContainsKey("EnderItems")) {
if (ctree["EnderItems"].ToTagList().Count > 0)
_enderItems.LoadTree(ctree["EnderItems"].ToTagList());
}
return this; return this;
} }
@ -527,17 +598,24 @@ namespace Substrate
if (_score != null) if (_score != null)
tree["Score"] = new TagNodeInt(_score ?? 0); tree["Score"] = new TagNodeInt(_score ?? 0);
if (_gameType != null)
tree["PlayerGameType"] = new TagNodeInt((int)(_gameType ?? PlayerGameType.Survival));
if (AbilitiesSet()) { if (AbilitiesSet()) {
TagNodeCompound pb = new TagNodeCompound(); TagNodeCompound pb = new TagNodeCompound();
pb["flying"] = new TagNodeByte(_abilities.Flying ? (byte)1 : (byte)0); pb["flying"] = new TagNodeByte(_abilities.Flying ? (byte)1 : (byte)0);
pb["instabuild"] = new TagNodeByte(_abilities.InstantBuild ? (byte)1 : (byte)0); pb["instabuild"] = new TagNodeByte(_abilities.InstantBuild ? (byte)1 : (byte)0);
pb["mayfly"] = new TagNodeByte(_abilities.MayFly ? (byte)1 : (byte)0); pb["mayfly"] = new TagNodeByte(_abilities.MayFly ? (byte)1 : (byte)0);
pb["invulnerable"] = new TagNodeByte(_abilities.Invulnerable ? (byte)1 : (byte)0); pb["invulnerable"] = new TagNodeByte(_abilities.Invulnerable ? (byte)1 : (byte)0);
pb["mayBuild"] = new TagNodeByte(_abilities.MayBuild ? (byte)1 : (byte)0);
pb["walkSpeed"] = new TagNodeFloat(_abilities.WalkSpeed);
pb["flySpeed"] = new TagNodeFloat(_abilities.FlySpeed);
tree["abilities"] = pb; tree["abilities"] = pb;
} }
tree["Inventory"] = _inventory.BuildTree(); tree["Inventory"] = _inventory.BuildTree();
tree["EnderItems"] = _enderItems.BuildTree();
return tree; return tree;
} }
@ -580,5 +658,10 @@ namespace Substrate
} }
#endregion #endregion
public ItemCollection EnderItems
{
get { return _enderItems; }
}
} }
} }