diff --git a/Substrate/SubstrateCS/Source/BlockInfo.cs b/Substrate/SubstrateCS/Source/BlockInfo.cs index 6ff9c31..49b73a0 100644 --- a/Substrate/SubstrateCS/Source/BlockInfo.cs +++ b/Substrate/SubstrateCS/Source/BlockInfo.cs @@ -106,6 +106,19 @@ namespace Substrate public const int REDSTONE_REPEATER_OFF = 94; public const int LOCKED_CHEST = 95; public const int TRAPDOOR = 96; + public const int SILVERFISH_STONE = 97; + public const int STONE_BRICK = 98; + public const int HUGE_RED_MUSHROOM = 99; + public const int HUGE_BROWN_MUSHROOM = 100; + public const int IRON_BARS = 101; + public const int GLASS_PANE = 102; + public const int MELON = 103; + public const int PUMPKIN_STEM = 104; + public const int MELON_STEP = 105; + public const int VINES = 106; + public const int FENCE_GATE = 107; + public const int BRICK_STAIRS = 108; + public const int STONE_BRICK_STAIRS = 109; } /// @@ -550,6 +563,19 @@ namespace Substrate public static BlockInfo RedstoneRepeaterOn; public static BlockInfoEx LockedChest; public static BlockInfo Trapdoor; + public static BlockInfo SilverfishStone; + public static BlockInfo StoneBrick; + public static BlockInfo HugeRedMushroom; + public static BlockInfo HugeBrownMushroom; + public static BlockInfo IronBars; + public static BlockInfo GlassPane; + public static BlockInfo Melon; + public static BlockInfo PumpkinStem; + public static BlockInfo MelonStem; + public static BlockInfo Vines; + public static BlockInfo FenceGate; + public static BlockInfo BrickStairs; + public static BlockInfo StoneBrickStairs; static BlockInfo () { @@ -658,6 +684,19 @@ namespace Substrate RedstoneRepeaterOn = new BlockInfo(94, "Redstone Repeater (On)").SetOpacity(0).SetLuminance(7); LockedChest = (BlockInfoEx)new BlockInfoEx(95, "Locked Chest").SetLuminance(MAX_LUMINANCE); Trapdoor = new BlockInfo(96, "Trapdoor").SetOpacity(0); + SilverfishStone = new BlockInfo(97, "Stone with Silverfish"); + StoneBrick = new BlockInfo(98, "Stone Brick"); + HugeRedMushroom = new BlockInfo(99, "Huge Red Mushroom"); + HugeBrownMushroom = new BlockInfo(100, "Huge Brown Mushroom"); + IronBars = new BlockInfo(101, "Iron Bars").SetOpacity(0); + GlassPane = new BlockInfo(102, "Glass Pane").SetOpacity(0); + Melon = new BlockInfo(103, "Melon"); + PumpkinStem = new BlockInfo(104, "Pumpkin Stem").SetOpacity(0).SetState(BlockState.NONSOLID); + MelonStem = new BlockInfo(105, "Melon Stem").SetOpacity(0).SetState(BlockState.NONSOLID); + Vines = new BlockInfo(106, "Vines").SetOpacity(0).SetState(BlockState.NONSOLID); + 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); for (int i = 0; i < MAX_BLOCKS; i++) { if (_blockTable[i] == null) { @@ -673,6 +712,8 @@ namespace Substrate WoodStairs.SetLightTransmission(false); Farmland.SetLightTransmission(false); CobbleStairs.SetLightTransmission(false); + BrickStairs.SetLightTransmission(false); + StoneBrickStairs.SetLightTransmission(false); // Override default fluid blocking rules @@ -737,6 +778,11 @@ namespace Substrate RedstoneRepeater.SetDataLimits(0, 0, 0xF); RedstoneRepeaterOn.SetDataLimits(0, 0, 0xF); Trapdoor.SetDataLimits(0, 3, 0x4); + StoneBrick.SetDataLimits(0, 2, 0); + HugeRedMushroom.SetDataLimits(0, 10, 0); + HugeBrownMushroom.SetDataLimits(0, 10, 0); + Vines.SetDataLimits(0, 0, 0xF); + FenceGate.SetDataLimits(0, 3, 0x4); } } diff --git a/Substrate/SubstrateCS/Source/BlockManager.cs b/Substrate/SubstrateCS/Source/BlockManager.cs index ea49014..b53ed66 100644 --- a/Substrate/SubstrateCS/Source/BlockManager.cs +++ b/Substrate/SubstrateCS/Source/BlockManager.cs @@ -134,7 +134,7 @@ namespace Substrate /// Global Y-coordinate of a block. /// Global Z-coordinate of a block. /// A to a single chunk containing the given block. - protected ChunkRef GetChunk (int x, int y, int z) + public ChunkRef GetChunk (int x, int y, int z) { x >>= chunkXLog; z >>= chunkZLog; diff --git a/Substrate/SubstrateCS/Source/Data.cs b/Substrate/SubstrateCS/Source/Data.cs index 514d39d..d1530a9 100644 --- a/Substrate/SubstrateCS/Source/Data.cs +++ b/Substrate/SubstrateCS/Source/Data.cs @@ -309,6 +309,52 @@ namespace Substrate STICKY = 0x08, } + public enum StoneBrickType + { + NORMAL = 0, + MOSSY = 1, + CRACKED = 2, + } + + public enum HugeMushroomType + { + FLESHY = 0, + CAP_CORNER_NORTHEAST = 1, + CAP_SIDE_EAST = 2, + CAP_CORNER_SOUTHEAST = 3, + CAP_SIDE_NORTH = 4, + CAP_TOP = 5, + CAP_SIDE_SOUTH = 6, + CAP_CORNER_NORTHWEST = 7, + CAP_SIDE_WEST = 8, + CAP_CORNER_SOUTHWEST = 9, + STEM = 10, + } + + [Flags] + public enum VineCoverageState + { + TOP = 0x0, + WEST = 0x1, + NORTH = 0x2, + EAST = 0x4, + SOUTH = 0x8, + } + + public enum FenceGateOrientation + { + WEST = 0, + NORTH = 1, + EAST = 2, + SOUTH = 3, + } + + [Flags] + public enum FenceGateState + { + OPEN = 0x4, + } + // Item Data public enum CoalType diff --git a/Substrate/SubstrateCS/Source/ItemInfo.cs b/Substrate/SubstrateCS/Source/ItemInfo.cs index 2d4714a..1ea5ac9 100644 --- a/Substrate/SubstrateCS/Source/ItemInfo.cs +++ b/Substrate/SubstrateCS/Source/ItemInfo.cs @@ -113,6 +113,15 @@ namespace Substrate public const int COOKIE = 357; public const int MAP = 358; public const int SHEARS = 359; + public const int MELON_SLICE = 360; + public const int PUMPKIN_SEEDS = 361; + public const int MELON_SEEDS = 262; + public const int RAW_BEEF = 363; + public const int STEAK = 364; + public const int RAW_CHICKEN = 365; + public const int COOKED_CHICKEN = 366; + public const int ROTTEN_FLESH = 367; + public const int ENDER_PEARL = 368; public const int GOLD_MUSIC_DISC = 2256; public const int GREEN_MUSIC_DISC = 2257; } @@ -337,6 +346,15 @@ namespace Substrate public static ItemInfo Cookie; public static ItemInfo Map; public static ItemInfo Shears; + public static ItemInfo MelonSlice; + public static ItemInfo PumpkinSeeds; + public static ItemInfo MelonSeeds; + public static ItemInfo RawBeef; + public static ItemInfo Steak; + public static ItemInfo RawChicken; + public static ItemInfo CookedChicken; + public static ItemInfo RottenFlesh; + public static ItemInfo EnderPearl; public static ItemInfo GoldMusicDisc; public static ItemInfo GreenMusicDisc; @@ -386,7 +404,7 @@ namespace Substrate GoldHoe = new ItemInfo(294, "Gold Hoe"); Seeds = new ItemInfo(295, "Seeds").SetStackSize(64); Wheat = new ItemInfo(296, "Wheat").SetStackSize(64); - Bread = new ItemInfo(297, "Bread"); + Bread = new ItemInfo(297, "Bread").SetStackSize(64); LeatherCap = new ItemInfo(298, "Leather Cap"); LeatherTunic = new ItemInfo(299, "Leather Tunic"); LeatherPants = new ItemInfo(300, "Leather Pants"); @@ -408,10 +426,10 @@ namespace Substrate GoldLeggings = new ItemInfo(316, "Gold Leggings"); GoldBoots = new ItemInfo(317, "Gold Boots"); Flint = new ItemInfo(318, "Flint").SetStackSize(64); - RawPorkchop = new ItemInfo(319, "Raw Porkchop"); - CookedPorkchop = new ItemInfo(320, "Cooked Porkchop"); + RawPorkchop = new ItemInfo(319, "Raw Porkchop").SetStackSize(64); + CookedPorkchop = new ItemInfo(320, "Cooked Porkchop").SetStackSize(64); Painting = new ItemInfo(321, "Painting").SetStackSize(64); - GoldenApple = new ItemInfo(322, "Golden Apple"); + GoldenApple = new ItemInfo(322, "Golden Apple").SetStackSize(64); Sign = new ItemInfo(323, "Sign"); WoodenDoor = new ItemInfo(324, "Door"); Bucket = new ItemInfo(325, "Bucket"); @@ -438,8 +456,8 @@ namespace Substrate FishingRod = new ItemInfo(346, "Fishing Rod"); Clock = new ItemInfo(347, "Clock"); GlowstoneDust = new ItemInfo(348, "Glowstone Dust").SetStackSize(64); - RawFish = new ItemInfo(349, "Raw Fish"); - CookedFish = new ItemInfo(350, "Cooked Fish"); + RawFish = new ItemInfo(349, "Raw Fish").SetStackSize(64); + CookedFish = new ItemInfo(350, "Cooked Fish").SetStackSize(64); Dye = new ItemInfo(351, "Dye").SetStackSize(64); Bone = new ItemInfo(352, "Bone").SetStackSize(64); Sugar = new ItemInfo(353, "Sugar").SetStackSize(64); @@ -449,6 +467,15 @@ namespace Substrate Cookie = new ItemInfo(357, "Cookie").SetStackSize(8); Map = new ItemInfo(358, "Map"); Shears = new ItemInfo(359, "Shears"); + MelonSlice = new ItemInfo(360, "Melon Slice").SetStackSize(64); + PumpkinSeeds = new ItemInfo(361, "Pumpkin Seeds").SetStackSize(64); + MelonSeeds = new ItemInfo(362, "Melon Seeds").SetStackSize(64); + RawBeef = new ItemInfo(363, "Raw Beef").SetStackSize(64); + Steak = new ItemInfo(364, "Steak").SetStackSize(64); + RawChicken = new ItemInfo(365, "Raw Chicken").SetStackSize(64); + CookedChicken = new ItemInfo(366, "Cooked Chicken").SetStackSize(64); + RottenFlesh = new ItemInfo(367, "Rotten Flesh").SetStackSize(64); + EnderPearl = new ItemInfo(368, "Ender Pearl").SetStackSize(64); GoldMusicDisc = new ItemInfo(2256, "Gold Music Disc"); GreenMusicDisc = new ItemInfo(2257, "Green Music Disc"); } diff --git a/Substrate/SubstrateCS/Source/Level.cs b/Substrate/SubstrateCS/Source/Level.cs index f11fb8d..f0fb4c4 100644 --- a/Substrate/SubstrateCS/Source/Level.cs +++ b/Substrate/SubstrateCS/Source/Level.cs @@ -5,6 +5,22 @@ using Substrate.Nbt; namespace Substrate { + /// + /// Specifies the type of gameplay associated with a world. + /// + public enum GameType + { + /// + /// The world will be played in Survival mode. + /// + SURVIVAL = 0, + + /// + /// The world will be played in Creative mode. + /// + CREATIVE = 1, + } + /// /// Represents general data and metadata of a single world. /// @@ -28,6 +44,8 @@ namespace Substrate new SchemaNodeScaler("thundering", TagType.TAG_BYTE, SchemaOptions.OPTIONAL), new SchemaNodeScaler("rainTime", TagType.TAG_INT, SchemaOptions.OPTIONAL), new SchemaNodeScaler("thunderTime", TagType.TAG_INT, SchemaOptions.OPTIONAL), + new SchemaNodeScaler("GameType", TagType.TAG_INT, SchemaOptions.OPTIONAL), + new SchemaNodeScaler("MapFeatures", TagType.TAG_BYTE, SchemaOptions.OPTIONAL), }, }; @@ -52,6 +70,9 @@ namespace Substrate private int? _rainTime; private int? _thunderTime; + private int? _gameType; + private byte? _mapFeatures; + /// /// Gets or sets the creation time of the world as a long timestamp. /// @@ -176,6 +197,24 @@ namespace Substrate set { _thunderTime = value; } } + /// + /// Gets or sets the game type associated with this world. + /// + public GameType GameType + { + get { return (GameType)(_gameType ?? 0); } + set { _gameType = (int)value; } + } + + /// + /// Gets or sets a value indicating that structures (dungeons, villages, ...) will be generated. + /// + public bool UseMapFeatures + { + get { return (_mapFeatures ?? 0) == 1; } + set { _mapFeatures = value ? (byte)1 : (byte)0; } + } + /// /// Gets a representing the schema of a level. /// @@ -202,6 +241,9 @@ namespace Substrate _randomSeed = new Random().Next(); _version = 19132; _name = "Untitled"; + + GameType = GameType.SURVIVAL; + UseMapFeatures = true; } /// @@ -227,6 +269,9 @@ namespace Substrate _rainTime = p._rainTime; _thunderTime = p._thunderTime; + _gameType = p._gameType; + _mapFeatures = p._mapFeatures; + if (p._player != null) { _player = p._player.Copy(); } @@ -297,6 +342,8 @@ namespace Substrate _rainTime = null; _thundering = null; _thunderTime = null; + _gameType = null; + _mapFeatures = null; TagNodeCompound ctree = dtree["Data"].ToTagCompound(); @@ -334,6 +381,13 @@ namespace Substrate _thunderTime = ctree["thunderTime"].ToTagInt(); } + if (ctree.ContainsKey("GameType")) { + _gameType = ctree["GameType"].ToTagInt(); + } + if (ctree.ContainsKey("MapFeatures")) { + _mapFeatures = ctree["MapFeatures"].ToTagByte(); + } + return this; } @@ -392,6 +446,13 @@ namespace Substrate data["thunderTime"] = new TagNodeInt(_thunderTime ?? 0); } + if (_gameType != null) { + data["GameType"] = new TagNodeInt(_gameType ?? 0); + } + if (_mapFeatures != null) { + data["MapFeatures"] = new TagNodeByte(_mapFeatures ?? 0); + } + TagNodeCompound tree = new TagNodeCompound(); tree.Add("Data", data);