├── .gitignore ├── LICENSE.txt ├── README.txt ├── Substrate.Tests ├── BlockTests.cs ├── Data │ ├── 1_6_4-survival │ │ ├── data │ │ │ ├── Mineshaft.dat │ │ │ └── villages.dat │ │ ├── level.dat │ │ ├── level.dat_mcr │ │ ├── level.dat_old │ │ ├── region │ │ │ └── r.0.0.mca │ │ └── session.lock │ ├── 1_7_10-creative │ │ ├── data │ │ │ ├── Mineshaft.dat │ │ │ └── villages.dat │ │ ├── level.dat │ │ ├── level.dat_mcr │ │ ├── level.dat_old │ │ ├── region │ │ │ └── r.0.0.mca │ │ └── session.lock │ ├── 1_7_10-hardcore │ │ ├── data │ │ │ ├── Mineshaft.dat │ │ │ ├── Stronghold.dat │ │ │ └── villages.dat │ │ ├── level.dat │ │ ├── level.dat_mcr │ │ ├── level.dat_old │ │ ├── region │ │ │ └── r.0.0.mca │ │ └── session.lock │ ├── 1_7_10-survival │ │ ├── data │ │ │ ├── Mineshaft.dat │ │ │ └── villages.dat │ │ ├── level.dat │ │ ├── level.dat_mcr │ │ ├── level.dat_old │ │ ├── region │ │ │ └── r.0.0.mca │ │ └── session.lock │ ├── 1_7_2-survival │ │ ├── data │ │ │ ├── Mineshaft.dat │ │ │ ├── Temple.dat │ │ │ └── villages.dat │ │ ├── level.dat │ │ ├── level.dat_mcr │ │ ├── level.dat_old │ │ ├── region │ │ │ └── r.0.0.mca │ │ └── session.lock │ ├── 1_8_3-debug │ │ ├── data │ │ │ ├── villages.dat │ │ │ ├── villages_end.dat │ │ │ └── villages_nether.dat │ │ ├── level.dat │ │ ├── level.dat_mcr │ │ ├── level.dat_old │ │ ├── region │ │ │ ├── r.-1.-1.mca │ │ │ ├── r.-1.0.mca │ │ │ ├── r.0.-1.mca │ │ │ └── r.0.0.mca │ │ └── session.lock │ ├── 1_8_3-survival │ │ ├── data │ │ │ ├── Mineshaft.dat │ │ │ ├── villages.dat │ │ │ ├── villages_end.dat │ │ │ └── villages_nether.dat │ │ ├── level.dat │ │ ├── level.dat_mcr │ │ ├── level.dat_old │ │ ├── region │ │ │ └── r.0.0.mca │ │ └── session.lock │ ├── 1_8_7-debug │ │ ├── data │ │ │ ├── villages.dat │ │ │ ├── villages_end.dat │ │ │ └── villages_nether.dat │ │ ├── level.dat │ │ ├── level.dat_mcr │ │ ├── level.dat_old │ │ ├── region │ │ │ ├── r.-1.-1.mca │ │ │ ├── r.-1.0.mca │ │ │ ├── r.0.-1.mca │ │ │ └── r.0.0.mca │ │ └── session.lock │ ├── 1_8_7-survival │ │ ├── data │ │ │ ├── Mineshaft.dat │ │ │ ├── villages.dat │ │ │ ├── villages_end.dat │ │ │ └── villages_nether.dat │ │ ├── level.dat │ │ ├── level.dat_mcr │ │ ├── level.dat_old │ │ ├── region │ │ │ ├── r.-1.0.mca │ │ │ ├── r.-1.1.mca │ │ │ ├── r.0.0.mca │ │ │ └── r.0.1.mca │ │ └── session.lock │ └── 1_9_2-debug │ │ ├── data │ │ ├── villages.dat │ │ ├── villages_end.dat │ │ └── villages_nether.dat │ │ ├── icon.png │ │ ├── level.dat │ │ ├── level.dat_old │ │ ├── region │ │ ├── r.-1.-1.mca │ │ ├── r.-1.0.mca │ │ ├── r.0.-1.mca │ │ └── r.0.0.mca │ │ └── session.lock ├── LevelTests.cs ├── Properties │ └── AssemblyInfo.cs ├── Substrate.Tests.csproj └── WorldTests.cs ├── SubstrateCPPCLI └── BlockReplace │ ├── BlockReplace.sln │ └── BlockReplace │ ├── BlockReplace.vcxproj │ ├── BlockReplace.vcxproj.filters │ └── Program.cpp ├── SubstrateCS ├── Examples │ ├── BlockReplace │ │ ├── BlockReplace.csproj │ │ ├── Program.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── Convert │ │ ├── Convert.csproj │ │ ├── Program.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── CustomBlocks │ │ ├── CustomBlocks.csproj │ │ ├── Program.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── Examples.sln │ ├── FlatMap │ │ ├── FlatMap.csproj │ │ ├── Program.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── GiveItem │ │ ├── GiveItem.csproj │ │ ├── Program.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── GoodyChest │ │ ├── GoodyChest.csproj │ │ ├── Program.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── Maze │ │ ├── Maze.csproj │ │ ├── Program.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── MoveSpawn │ │ ├── MoveSpawn.csproj │ │ ├── Program.cs │ │ └── Properties │ │ │ └── AssemblyInfo.cs │ ├── PurgeEntities │ │ ├── Program.cs │ │ ├── Properties │ │ │ └── AssemblyInfo.cs │ │ └── PurgeEntities.csproj │ └── Relight │ │ ├── Program.cs │ │ ├── Properties │ │ └── AssemblyInfo.cs │ │ └── Relight.csproj ├── Help │ └── Substrate.shfbproj ├── Properties │ └── AssemblyInfo.cs ├── Source │ ├── AlphaBlock.cs │ ├── AlphaBlockCollection.cs │ ├── AlphaBlockRef.cs │ ├── AlphaChunk.cs │ ├── AlphaChunkManager.cs │ ├── AlphaWorld.cs │ ├── AnvilBiomeCollection.cs │ ├── AnvilChunk.cs │ ├── AnvilRegion.cs │ ├── AnvilRegionManager.cs │ ├── AnvilSection.cs │ ├── AnvilWorld.cs │ ├── BetaRegion.cs │ ├── BetaRegionManager.cs │ ├── BetaWorld.cs │ ├── BiomeInfo.cs │ ├── BlockInfo.cs │ ├── BlockManager.cs │ ├── CacheTable.cs │ ├── ChunkRef.cs │ ├── Core │ │ ├── Base.cs │ │ ├── BlockFluid.cs │ │ ├── BlockInterface.cs │ │ ├── BlockKey.cs │ │ ├── BlockLight.cs │ │ ├── BlockTileEntities.cs │ │ ├── BlockTileTicks.cs │ │ ├── BoundedBlockInterface.cs │ │ ├── ByteArray.cs │ │ ├── ChunkCache.cs │ │ ├── ChunkFile.cs │ │ ├── ChunkInterface.cs │ │ ├── ChunkKey.cs │ │ ├── CompositeDataArray.cs │ │ ├── FusedDataArray.cs │ │ ├── IndexedLinkedList.cs │ │ ├── Interface.cs │ │ ├── ItemInterface.cs │ │ ├── LRUCache.cs │ │ ├── NBTFile.cs │ │ ├── NibbleArray.cs │ │ ├── OpenWorldEvent.cs │ │ ├── PlayerFile.cs │ │ ├── PlayerManagerInterface.cs │ │ ├── Region.cs │ │ ├── RegionFile.cs │ │ ├── RegionInterface.cs │ │ ├── RegionKey.cs │ │ ├── RegionManager.cs │ │ └── UnboundedBlockInterface.cs │ ├── Data.cs │ ├── Data │ │ ├── BetaDataManager.cs │ │ ├── DataExceptions.cs │ │ ├── DataManager.cs │ │ ├── Map.cs │ │ ├── MapConverter.cs │ │ ├── MapFile.cs │ │ ├── MapManager.cs │ │ └── MapManagerInterface.cs │ ├── Enchantment.cs │ ├── EnchantmentInfo.cs │ ├── Entities │ │ ├── EntityAnimal.cs │ │ ├── EntityArrow.cs │ │ ├── EntityBlaze.cs │ │ ├── EntityBoat.cs │ │ ├── EntityCaveSpider.cs │ │ ├── EntityChicken.cs │ │ ├── EntityCow.cs │ │ ├── EntityCreeper.cs │ │ ├── EntityEgg.cs │ │ ├── EntityEnderDragon.cs │ │ ├── EntityEnderEye.cs │ │ ├── EntityEnderPearl.cs │ │ ├── EntityEnderman.cs │ │ ├── EntityFallingSand.cs │ │ ├── EntityFireball.cs │ │ ├── EntityGhast.cs │ │ ├── EntityGiant.cs │ │ ├── EntityItem.cs │ │ ├── EntityMagmaCube.cs │ │ ├── EntityMinecart.cs │ │ ├── EntityMinecartChest.cs │ │ ├── EntityMinecartFurnace.cs │ │ ├── EntityMob.cs │ │ ├── EntityMonster.cs │ │ ├── EntityMooshroom.cs │ │ ├── EntityPainting.cs │ │ ├── EntityPig.cs │ │ ├── EntityPigZombie.cs │ │ ├── EntityPrimedTnt.cs │ │ ├── EntitySheep.cs │ │ ├── EntitySilverfish.cs │ │ ├── EntitySkeleton.cs │ │ ├── EntitySlime.cs │ │ ├── EntitySmallFireball.cs │ │ ├── EntitySnowball.cs │ │ ├── EntitySnowman.cs │ │ ├── EntitySpider.cs │ │ ├── EntitySquid.cs │ │ ├── EntityThrowable.cs │ │ ├── EntityVillager.cs │ │ ├── EntityWolf.cs │ │ ├── EntityXPOrb.cs │ │ └── EntityZombie.cs │ ├── Entity.cs │ ├── EntityCollection.cs │ ├── EntityFactory.cs │ ├── ImportExport │ │ └── Schematic.cs │ ├── Item.cs │ ├── ItemCollection.cs │ ├── ItemInfo.cs │ ├── Level.cs │ ├── LevelIOException.cs │ ├── Nbt │ │ ├── INbtObject.cs │ │ ├── JSONSerializer.cs │ │ ├── NbtIOException.cs │ │ ├── NbtTree.cs │ │ ├── NbtVerifier.cs │ │ ├── SchemaNode.cs │ │ ├── SchemaNodeArray.cs │ │ ├── SchemaNodeCompound.cs │ │ ├── SchemaNodeIntArray.cs │ │ ├── SchemaNodeList.cs │ │ ├── SchemaNodeLongArray.cs │ │ ├── SchemaNodeScaler.cs │ │ ├── SchemaNodeShortArray.cs │ │ ├── SchemaNodeString.cs │ │ ├── SchemaOptions.cs │ │ ├── TagNode.cs │ │ ├── TagNodeByte.cs │ │ ├── TagNodeByteArray.cs │ │ ├── TagNodeCompound.cs │ │ ├── TagNodeDouble.cs │ │ ├── TagNodeFloat.cs │ │ ├── TagNodeInt.cs │ │ ├── TagNodeIntArray.cs │ │ ├── TagNodeList.cs │ │ ├── TagNodeLong.cs │ │ ├── TagNodeLongArray.cs │ │ ├── TagNodeNull.cs │ │ ├── TagNodeShort.cs │ │ ├── TagNodeShortArray.cs │ │ ├── TagNodeString.cs │ │ ├── TagType.cs │ │ └── VerifierLogger.cs │ ├── NbtWorld.cs │ ├── Orientation.cs │ ├── Player.cs │ ├── PlayerIOException.cs │ ├── PlayerManager.cs │ ├── RegionChunkManager.cs │ ├── SpawnPoint.cs │ ├── SubstrateException.cs │ ├── TileEntities │ │ ├── TileEntityBeacon.cs │ │ ├── TileEntityBrewingStand.cs │ │ ├── TileEntityChest.cs │ │ ├── TileEntityControl.cs │ │ ├── TileEntityEnchantmentTable.cs │ │ ├── TileEntityEndPortal.cs │ │ ├── TileEntityFurnace.cs │ │ ├── TileEntityMobSpawner.cs │ │ ├── TileEntityMusic.cs │ │ ├── TileEntityPiston.cs │ │ ├── TileEntityRecordPlayer.cs │ │ ├── TileEntitySign.cs │ │ └── TileEntityTrap.cs │ ├── TileEntity.cs │ ├── TileEntityFactory.cs │ ├── TileTick.cs │ ├── Vector.cs │ └── World.cs ├── Substrate (NET2).csproj ├── Substrate (NET4).csproj ├── Substrate.sln └── Vendor │ └── DotNetZip │ └── Zlib │ ├── Crc32.cs │ ├── Deflate.cs │ ├── DeflateStream.cs │ ├── GZipStream.cs │ ├── InfTree.cs │ ├── Inflate.cs │ ├── LICENSE.txt │ ├── ParallelDeflateOutputStream.cs │ ├── Tree.cs │ ├── Zlib.cs │ ├── ZlibBaseStream.cs │ ├── ZlibCodec.cs │ ├── ZlibConstants.cs │ └── ZlibStream.cs └── SubstrateVBNET └── Examples ├── BlockReplace ├── BlockReplace.vbproj ├── Module1.vb └── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── Convert ├── Convert.vbproj ├── Module1.vb └── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── Examples.sln ├── FlatMap ├── FlatMap.vbproj ├── Module1.vb └── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── GiveItem ├── GiveItem.vbproj ├── Module1.vb └── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── GoodyChest ├── GoodyChest.vbproj ├── Module1.vb └── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── Maze ├── Maze.vbproj ├── Module1.vb └── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── MoveSpawn ├── Module1.vb ├── MoveSpawn.vbproj └── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings ├── PurgeEntities ├── Module1.vb ├── My Project │ ├── Application.Designer.vb │ ├── Application.myapp │ ├── AssemblyInfo.vb │ ├── Resources.Designer.vb │ ├── Resources.resx │ ├── Settings.Designer.vb │ └── Settings.settings └── PurgeEntities.vbproj └── Relight ├── Module1.vb ├── My Project ├── Application.Designer.vb ├── Application.myapp ├── AssemblyInfo.vb ├── Resources.Designer.vb ├── Resources.resx ├── Settings.Designer.vb └── Settings.settings └── Relight.vbproj /.gitignore: -------------------------------------------------------------------------------- 1 | **/Debug/* 2 | **/bin/* 3 | **/obj/* 4 | *.suo 5 | SubstrateCS/Release/ 6 | *.sdf 7 | *.user 8 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2011 by Justin Aquadro 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | Substrate 2 | Copyright (C) 2011 Justin Aquadro 3 | 4 | LICENSE: 5 | 6 | Substrate is licensed under the MIT License. See LICENSE.txt. 7 | 8 | ABOUT: 9 | 10 | Substrate is a fully-developed .NET SDK for editing Minecraft worlds. Substrate 11 | provides high- and low-level APIs for manipulating Alpha and Beta-compatible 12 | maps and player data. Substrate is developed in C# as a CLS-compliant assembly, 13 | and example code is provided for both C# and VB.NET. A brief list of 14 | Substrate's capabilities are: 15 | 16 | * Alpha and Beta map compatibility 17 | * Separate block, chunk, and region views 18 | * Global and local coordinate systems 19 | * Automatic and manual light recalculation 20 | * Automatic and manual fluid recalculation 21 | * Automatic chunk cache management 22 | * Automatic TileEntity? and Heightmap consistency 23 | * Entity editing support 24 | * Player editing support 25 | * Level data editing support 26 | * Edit existing worlds or create new ones 27 | * Schematic import and export 28 | * Low-level APIs for NBT reading, writing, and validation 29 | 30 | Most of the Substrate APIs are fully documented, including a compiled API 31 | reference document and XML documentation for Intellisense. A number of 32 | different example projects are provided in C# and VB.NET. 33 | 34 | Substrate is compatible with .NET Framework 2.0 or higher and Mono, and should 35 | be compatible with any CLI language. All feedback is welcome: open an Issue or 36 | respond in our Minecraft Forums thread. -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_6_4-survival/data/Mineshaft.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_6_4-survival/data/Mineshaft.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_6_4-survival/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_6_4-survival/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_6_4-survival/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_6_4-survival/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_6_4-survival/level.dat_mcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_6_4-survival/level.dat_mcr -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_6_4-survival/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_6_4-survival/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_6_4-survival/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_6_4-survival/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_6_4-survival/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_6_4-survival/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-creative/data/Mineshaft.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-creative/data/Mineshaft.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-creative/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-creative/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-creative/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-creative/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-creative/level.dat_mcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-creative/level.dat_mcr -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-creative/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-creative/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-creative/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-creative/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-creative/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-creative/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-hardcore/data/Mineshaft.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-hardcore/data/Mineshaft.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-hardcore/data/Stronghold.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-hardcore/data/Stronghold.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-hardcore/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-hardcore/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-hardcore/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-hardcore/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-hardcore/level.dat_mcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-hardcore/level.dat_mcr -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-hardcore/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-hardcore/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-hardcore/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-hardcore/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-hardcore/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-hardcore/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-survival/data/Mineshaft.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-survival/data/Mineshaft.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-survival/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-survival/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-survival/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-survival/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-survival/level.dat_mcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-survival/level.dat_mcr -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-survival/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-survival/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-survival/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-survival/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_10-survival/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_10-survival/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_2-survival/data/Mineshaft.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_2-survival/data/Mineshaft.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_2-survival/data/Temple.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_2-survival/data/Temple.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_2-survival/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_2-survival/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_2-survival/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_2-survival/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_2-survival/level.dat_mcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_2-survival/level.dat_mcr -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_2-survival/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_2-survival/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_2-survival/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_2-survival/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_7_2-survival/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_7_2-survival/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/data/villages_end.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/data/villages_end.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/data/villages_nether.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/data/villages_nether.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/level.dat_mcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/level.dat_mcr -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/region/r.-1.-1.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/region/r.-1.-1.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/region/r.-1.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/region/r.-1.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/region/r.0.-1.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/region/r.0.-1.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-debug/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-debug/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-survival/data/Mineshaft.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-survival/data/Mineshaft.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-survival/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-survival/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-survival/data/villages_end.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-survival/data/villages_end.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-survival/data/villages_nether.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-survival/data/villages_nether.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-survival/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-survival/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-survival/level.dat_mcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-survival/level.dat_mcr -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-survival/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-survival/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-survival/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-survival/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_3-survival/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_3-survival/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/data/villages_end.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/data/villages_end.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/data/villages_nether.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/data/villages_nether.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/level.dat_mcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/level.dat_mcr -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/region/r.-1.-1.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/region/r.-1.-1.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/region/r.-1.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/region/r.-1.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/region/r.0.-1.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/region/r.0.-1.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-debug/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-debug/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/data/Mineshaft.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/data/Mineshaft.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/data/villages_end.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/data/villages_end.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/data/villages_nether.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/data/villages_nether.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/level.dat_mcr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/level.dat_mcr -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/region/r.-1.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/region/r.-1.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/region/r.-1.1.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/region/r.-1.1.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/region/r.0.1.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/region/r.0.1.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_8_7-survival/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_8_7-survival/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/data/villages.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/data/villages.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/data/villages_end.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/data/villages_end.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/data/villages_nether.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/data/villages_nether.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/icon.png -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/level.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/level.dat -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/level.dat_old: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/level.dat_old -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/region/r.-1.-1.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/region/r.-1.-1.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/region/r.-1.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/region/r.-1.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/region/r.0.-1.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/region/r.0.-1.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/region/r.0.0.mca: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/region/r.0.0.mca -------------------------------------------------------------------------------- /Substrate.Tests/Data/1_9_2-debug/session.lock: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/minecraft-dotnet/Substrate/d8438bc3bc2540ad0551a48bd710b58ba2ebe375/Substrate.Tests/Data/1_9_2-debug/session.lock -------------------------------------------------------------------------------- /Substrate.Tests/LevelTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Substrate; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | using System.IO; 7 | using Substrate.Nbt; 8 | using Substrate.Core; 9 | 10 | namespace Substrate.Tests 11 | { 12 | [TestClass] 13 | public class LevelTests 14 | { 15 | NbtTree LoadLevelTree(string path) 16 | { 17 | NBTFile nf = new NBTFile(path); 18 | NbtTree tree = null; 19 | 20 | using (Stream nbtstr = nf.GetDataInputStream()) 21 | { 22 | if (nbtstr == null) 23 | { 24 | return null; 25 | } 26 | 27 | tree = new NbtTree(nbtstr); 28 | } 29 | 30 | return tree; 31 | } 32 | 33 | [TestMethod] 34 | public void LoadTreeTest_1_6_4_survival() 35 | { 36 | NbtTree levelTree = LoadLevelTree(@"..\..\Data\1_6_4-survival\level.dat"); 37 | 38 | Level level = new Level(null); 39 | level = level.LoadTreeSafe(levelTree.Root); 40 | Assert.IsNotNull(level); 41 | } 42 | 43 | [TestMethod] 44 | public void LoadTreeTest_1_7_2_survival() 45 | { 46 | NbtTree levelTree = LoadLevelTree(@"..\..\Data\1_7_2-survival\level.dat"); 47 | 48 | Level level = new Level(null); 49 | level = level.LoadTreeSafe(levelTree.Root); 50 | Assert.IsNotNull(level); 51 | } 52 | 53 | [TestMethod] 54 | public void LoadTreeTest_1_7_10_survival() 55 | { 56 | NbtTree levelTree = LoadLevelTree(@"..\..\Data\1_7_10-survival\level.dat"); 57 | 58 | Level level = new Level(null); 59 | level = level.LoadTreeSafe(levelTree.Root); 60 | Assert.IsNotNull(level); 61 | } 62 | 63 | [TestMethod] 64 | public void LoadTreeTest_1_8_3_survival() 65 | { 66 | NbtTree levelTree = LoadLevelTree(@"..\..\Data\1_8_3-survival\level.dat"); 67 | 68 | Level level = new Level(null); 69 | level = level.LoadTreeSafe(levelTree.Root); 70 | Assert.IsNotNull(level); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /Substrate.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Substrate.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("Substrate.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("76bab255-3775-4a8f-a18a-8485a417833c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("2.0.0.0")] 36 | [assembly: AssemblyFileVersion("2.0.0.0")] 37 | -------------------------------------------------------------------------------- /Substrate.Tests/WorldTests.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Substrate; 5 | using Microsoft.VisualStudio.TestTools.UnitTesting; 6 | namespace Substrate.Tests 7 | { 8 | [TestClass] 9 | public class WorldTests 10 | { 11 | [TestMethod] 12 | public void OpenTest_1_6_4_survival() 13 | { 14 | NbtWorld world = NbtWorld.Open(@"..\..\Data\1_6_4-survival\"); 15 | Assert.IsNotNull(world); 16 | } 17 | 18 | [TestMethod] 19 | public void OpenTest_1_7_2_survival() 20 | { 21 | NbtWorld world = NbtWorld.Open(@"..\..\Data\1_7_2-survival\"); 22 | Assert.IsNotNull(world); 23 | } 24 | 25 | [TestMethod] 26 | public void OpenTest_1_7_10_survival() 27 | { 28 | NbtWorld world = NbtWorld.Open(@"..\..\Data\1_7_10-survival\"); 29 | Assert.IsNotNull(world); 30 | } 31 | 32 | [TestMethod] 33 | public void OpenTest_1_8_3_survival() 34 | { 35 | NbtWorld world = NbtWorld.Open(@"..\..\Data\1_8_3-survival\"); 36 | Assert.IsNotNull(world); 37 | } 38 | 39 | [TestMethod] 40 | public void OpenTest_1_8_3_debug() 41 | { 42 | NbtWorld world = NbtWorld.Open(@"..\..\Data\1_8_3-debug\"); 43 | Assert.IsNotNull(world); 44 | } 45 | 46 | [TestMethod] 47 | public void OpenTest_1_8_7_debug() 48 | { 49 | NbtWorld world = NbtWorld.Open(@"..\..\Data\1_8_7-debug\"); 50 | Assert.IsNotNull(world); 51 | } 52 | 53 | [TestMethod] 54 | public void OpenTest_1_8_7_survival() 55 | { 56 | NbtWorld world = NbtWorld.Open(@"..\..\Data\1_8_7-survival\"); 57 | Assert.IsNotNull(world); 58 | } 59 | 60 | [TestMethod] 61 | public void OpenTest_1_9_2_debug() 62 | { 63 | NbtWorld world = NbtWorld.Open(@"..\..\Data\1_9_2-debug\"); 64 | Assert.IsNotNull(world); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /SubstrateCPPCLI/BlockReplace/BlockReplace.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual C++ Express 2010 4 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BlockReplace", "BlockReplace\BlockReplace.vcxproj", "{17FC8A42-7A3B-412F-882D-7D0B60D64959}" 5 | EndProject 6 | Global 7 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 8 | Debug|Win32 = Debug|Win32 9 | Release|Win32 = Release|Win32 10 | EndGlobalSection 11 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 12 | {17FC8A42-7A3B-412F-882D-7D0B60D64959}.Debug|Win32.ActiveCfg = Debug|Win32 13 | {17FC8A42-7A3B-412F-882D-7D0B60D64959}.Debug|Win32.Build.0 = Debug|Win32 14 | {17FC8A42-7A3B-412F-882D-7D0B60D64959}.Release|Win32.ActiveCfg = Release|Win32 15 | {17FC8A42-7A3B-412F-882D-7D0B60D64959}.Release|Win32.Build.0 = Release|Win32 16 | EndGlobalSection 17 | GlobalSection(SolutionProperties) = preSolution 18 | HideSolutionNode = FALSE 19 | EndGlobalSection 20 | EndGlobal 21 | -------------------------------------------------------------------------------- /SubstrateCPPCLI/BlockReplace/BlockReplace/BlockReplace.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF} 6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx 7 | 8 | 9 | {93995380-89BD-4b04-88EB-625FBE52EBFB} 10 | h;hpp;hxx;hm;inl;inc;xsd 11 | 12 | 13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} 14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms 15 | 16 | 17 | 18 | 19 | Source Files 20 | 21 | 22 | -------------------------------------------------------------------------------- /SubstrateCPPCLI/BlockReplace/BlockReplace/Program.cpp: -------------------------------------------------------------------------------- 1 | #using 2 | 3 | using namespace Substrate; 4 | using namespace Substrate::Core; 5 | 6 | // This example replaces all instances of one block ID with another in a world. 7 | // Substrate will handle all of the lower-level headaches that can pop up, such 8 | // as maintaining correct lighting or replacing TileEntity records for blocks 9 | // that need them. 10 | 11 | // For a more advanced Block Replace example, see replace.cs in NBToolkit. 12 | 13 | int main (array^ args) 14 | { 15 | if (args->Length != 3) { 16 | System::Console::WriteLine("Usage: BlockReplace "); 17 | return 0; 18 | } 19 | 20 | System::String^ dest = args[0]; 21 | int before = System::Convert::ToInt32(args[1]); 22 | int after = System::Convert::ToInt32(args[2]); 23 | 24 | // Open our world 25 | NbtWorld^ world = NbtWorld::Open(dest); 26 | 27 | // The chunk manager is more efficient than the block manager for 28 | // this purpose, since we'll inspect every block 29 | IChunkManager^ cm = world->GetChunkManager(); 30 | 31 | for each (ChunkRef^ chunk in cm) { 32 | // You could hardcode your dimensions, but maybe some day they 33 | // won't always be 16. Also the CLR is a bit stupid and has 34 | // trouble optimizing repeated calls to Chunk.Blocks.xx, so we 35 | // cache them in locals 36 | int xdim = chunk->Blocks->XDim; 37 | int ydim = chunk->Blocks->YDim; 38 | int zdim = chunk->Blocks->ZDim; 39 | 40 | // x, z, y is the most efficient order to scan blocks (not that 41 | // you should care about internal detail) 42 | for (int x = 0; x < xdim; x++) { 43 | for (int z = 0; z < zdim; z++) { 44 | for (int y = 0; y < ydim; y++) { 45 | 46 | // Replace the block with after if it matches before 47 | if (chunk->Blocks->GetID(x, y, z) == before) { 48 | chunk->Blocks->SetData(x, y, z, 0); 49 | chunk->Blocks->SetID(x, y, z, after); 50 | } 51 | } 52 | } 53 | } 54 | 55 | // Save the chunk 56 | cm->Save(); 57 | 58 | System::Console::WriteLine("Processed Chunk {0},{1}", chunk->X, chunk->Z); 59 | } 60 | 61 | return 0; 62 | } -------------------------------------------------------------------------------- /SubstrateCS/Examples/BlockReplace/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BlockReplace")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("BlockReplace")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("672d767f-c56e-42eb-8583-a835bcf7d4a0")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/Convert/Convert.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 9.0.30729 7 | 2.0 8 | {5BD42656-9BCF-4C55-8272-A5D3507EFDF3} 9 | Exe 10 | Properties 11 | Example 12 | Convert 13 | v4.0 14 | 512 15 | 16 | 17 | 18 | 19 | 3.5 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | ..\..\bin\Release\NET2\Substrate.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/Convert/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Substrate; 3 | using Substrate.Core; 4 | using Substrate.Nbt; 5 | using System.IO; 6 | 7 | // This example will convert worlds between alpha and beta format. 8 | // This will convert chunks to and from region format, and copy level.dat 9 | // Other data, like players and other dims, will not be handled. 10 | 11 | namespace Convert 12 | { 13 | class Program 14 | { 15 | static void Main (string[] args) 16 | { 17 | if (args.Length != 3) { 18 | Console.WriteLine("Usage: Convert "); 19 | return; 20 | } 21 | 22 | string src = args[0]; 23 | string dst = args[1]; 24 | string srctype = args[2]; 25 | 26 | if (!Directory.Exists(dst)) 27 | Directory.CreateDirectory(dst); 28 | 29 | // Open source and destrination worlds depending on conversion type 30 | NbtWorld srcWorld = NbtWorld.Open(src); 31 | NbtWorld dstWorld; 32 | switch (srctype) { 33 | case "alpha": dstWorld = AlphaWorld.Create(dst); break; 34 | case "beta": dstWorld = BetaWorld.Create(dst); break; 35 | case "anvil": dstWorld = AnvilWorld.Create(dst); break; 36 | default: throw new Exception("Invalid conversion type"); 37 | } 38 | 39 | // Grab chunk managers to copy chunks 40 | IChunkManager cmsrc = srcWorld.GetChunkManager(); 41 | IChunkManager cmdst = dstWorld.GetChunkManager(); 42 | 43 | // Copy each chunk from source to dest 44 | foreach (ChunkRef chunk in cmsrc) { 45 | cmdst.SetChunk(chunk.X, chunk.Z, chunk.GetChunkRef()); 46 | Console.WriteLine("Copying chunk: {0}, {1}", chunk.X, chunk.Z); 47 | } 48 | 49 | // Copy level data from source to dest 50 | dstWorld.Level.LoadTreeSafe(srcWorld.Level.BuildTree()); 51 | 52 | // Save level.dat 53 | dstWorld.Level.Save(); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/Convert/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Example")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Example")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("18bbf372-f1a7-41d3-b43f-f9d04cdf41eb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/CustomBlocks/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CustomBlocks")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("CustomBlocks")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5b6300c0-2930-47df-9281-31cf7885044e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/FlatMap/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FlatMap")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("FlatMap")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("588c8d46-5ffb-4593-b48a-9529cf6fcede")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/GiveItem/GiveItem.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 9.0.30729 7 | 2.0 8 | {426B01F4-B0C0-488E-8A5A-5531C8DFA98C} 9 | Exe 10 | Properties 11 | GiveItem 12 | GiveItem 13 | v4.0 14 | 512 15 | 16 | 17 | 18 | 19 | 3.5 20 | 21 | 22 | true 23 | full 24 | false 25 | bin\Debug\ 26 | DEBUG;TRACE 27 | prompt 28 | 4 29 | 30 | 31 | pdbonly 32 | true 33 | bin\Release\ 34 | TRACE 35 | prompt 36 | 4 37 | 38 | 39 | 40 | ..\..\bin\Release\NET2\Substrate.dll 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 56 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/GiveItem/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Substrate; 3 | using Substrate.Core; 4 | 5 | // This example will insert x amount of an item into a player's 6 | // inventory in an SMP server (where there is a player directory) 7 | 8 | namespace GiveItem 9 | { 10 | class Program 11 | { 12 | static void Main (string[] args) 13 | { 14 | if (args.Length != 4) { 15 | Console.WriteLine("Usage: GiveItem "); 16 | return; 17 | } 18 | 19 | string dest = args[0]; 20 | string player = args[1]; 21 | int itemid = Convert.ToInt32(args[2]); 22 | int count = Convert.ToInt32(args[3]); 23 | 24 | // Open the world and grab its player manager 25 | NbtWorld world = NbtWorld.Open(dest); 26 | IPlayerManager pm = world.GetPlayerManager(); 27 | 28 | // Check that the named player exists 29 | if (!pm.PlayerExists(player)) { 30 | Console.WriteLine("No such player {0}!", player); 31 | return; 32 | } 33 | 34 | // Get player (returned object is independent of the playermanager) 35 | Player p = pm.GetPlayer(player); 36 | 37 | // Find first slot to place item 38 | for (int i = 0; i < p.Items.Capacity; i++) { 39 | if (!p.Items.ItemExists(i)) { 40 | // Create the item and set its stack count 41 | Item item = new Item(itemid); 42 | item.Count = count; 43 | p.Items[i] = item; 44 | 45 | // Don't keep adding items 46 | break; 47 | } 48 | } 49 | 50 | // Save the player 51 | pm.SetPlayer(player, p); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/GiveItem/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("GiveItem")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("GiveItem")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f1f9e364-dc96-4cce-b23d-42bc1234322d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/GoodyChest/GoodyChest.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {6A998912-C939-4029-9F1D-D5C2A5E9C804} 9 | Exe 10 | Properties 11 | GoodyChest 12 | GoodyChest 13 | v4.0 14 | Client 15 | 512 16 | 17 | 18 | x86 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | x86 29 | pdbonly 30 | true 31 | bin\Release\ 32 | TRACE 33 | prompt 34 | 4 35 | 36 | 37 | 38 | ..\..\bin\Release\NET2\Substrate.dll 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 54 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/GoodyChest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("GoodyChest")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("GoodyChest")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c8a1b29d-5ba9-4a5a-891c-82627eb4b915")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/Maze/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Maze")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Maze")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1f8659a6-81aa-4f18-abb6-7e56f8ba9d34")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/MoveSpawn/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Substrate; 3 | 4 | // MoveSpawn changes the location of the world spawn location 5 | // (which is separate from individual player spawn locations) 6 | 7 | namespace MoveSpawn 8 | { 9 | class Program 10 | { 11 | static void Main (string[] args) 12 | { 13 | if (args.Length != 4) { 14 | Console.WriteLine("Usage: MoveSpawn "); 15 | return; 16 | } 17 | 18 | string dest = args[0]; 19 | int x = Convert.ToInt32(args[1]); 20 | int y = Convert.ToInt32(args[2]); 21 | int z = Convert.ToInt32(args[3]); 22 | 23 | // Open our world 24 | NbtWorld world = NbtWorld.Open(dest); 25 | 26 | // Set the level's spawn 27 | // Note: Players do not have separate spawns by default 28 | // If you wanted to change a player's spawn, you must set all 29 | // 3 coordinates for it to stick. It will not take the level's defaults. 30 | world.Level.Spawn = new SpawnPoint(x, y, z); 31 | 32 | // Save the changes 33 | world.Save(); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/MoveSpawn/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("MoveSpawn")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("MoveSpawn")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("4925446f-56ff-454c-bca2-054e0294dd2e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/PurgeEntities/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Substrate; 4 | using Substrate.Core; 5 | 6 | // This example is a tool to delete all entities of a given type (e.g., "pig") 7 | // on a map. It optionally can be restricted to boxed region in block coords. 8 | // Only 10% of the effort is actually spend purging anything. 9 | 10 | namespace PurgeEntities 11 | { 12 | class Program 13 | { 14 | static void Main (string[] args) 15 | { 16 | // Process arguments 17 | if (args.Length != 2 && args.Length != 6) { 18 | Console.WriteLine("Usage: PurgeEntities [ ]"); 19 | return; 20 | } 21 | string dest = args[0]; 22 | string eid = args[1]; 23 | 24 | // Our initial bounding box is "infinite" 25 | int x1 = BlockManager.MIN_X; 26 | int x2 = BlockManager.MAX_X; 27 | int z1 = BlockManager.MIN_Z; 28 | int z2 = BlockManager.MAX_Z; 29 | 30 | // If we have all coordinate parameters, set the bounding box 31 | if (args.Length == 6) { 32 | x1 = Convert.ToInt32(args[2]); 33 | z1 = Convert.ToInt32(args[3]); 34 | x2 = Convert.ToInt32(args[4]); 35 | z2 = Convert.ToInt32(args[5]); 36 | } 37 | 38 | // Load world 39 | NbtWorld world = NbtWorld.Open(dest); 40 | IChunkManager cm = world.GetChunkManager(); 41 | 42 | // Remove entities 43 | foreach (ChunkRef chunk in cm) { 44 | // Skip chunks that don't cover our selected area 45 | if (((chunk.X + 1) * chunk.Blocks.XDim < x1) || 46 | (chunk.X * chunk.Blocks.XDim >= x2) || 47 | ((chunk.Z + 1) * chunk.Blocks.ZDim < z1) || 48 | (chunk.Z * chunk.Blocks.ZDim >= z2)) { 49 | continue; 50 | } 51 | 52 | // Delete the specified entities 53 | chunk.Entities.RemoveAll(eid); 54 | cm.Save(); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/PurgeEntities/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PurgeEntities")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("PurgeEntities")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("d464b8c1-6bcc-46b9-9ade-ec5d1464dd4d")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Examples/Relight/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("Relight")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("Relight")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("b21635dd-f744-4740-842a-f86781787961")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /SubstrateCS/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Reflection; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | 6 | // General Information about an assembly is controlled through the following 7 | // set of attributes. Change these attribute values to modify the information 8 | // associated with an assembly. 9 | [assembly: AssemblyTitle("Substrate")] 10 | [assembly: AssemblyDescription("SDK for loading and modifying Minecraft worlds")] 11 | [assembly: AssemblyConfiguration("")] 12 | [assembly: AssemblyCompany("")] 13 | [assembly: AssemblyProduct("Substrate")] 14 | [assembly: AssemblyCopyright("2011-2012 Justin Aquadro")] 15 | [assembly: AssemblyTrademark("")] 16 | [assembly: AssemblyCulture("")] 17 | 18 | // Setting ComVisible to false makes the types in this assembly not visible 19 | // to COM components. If you need to access a type in this assembly from 20 | // COM, set the ComVisible attribute to true on that type. 21 | [assembly: ComVisible(false)] 22 | 23 | // The following GUID is for the ID of the typelib if this project is exposed to COM 24 | [assembly: Guid("0e6cc672-bcea-401f-a5f3-30e8ef39c673")] 25 | 26 | // Version information for an assembly consists of the following four values: 27 | // 28 | // Major Version 29 | // Minor Version 30 | // Build Number 31 | // Revision 32 | // 33 | [assembly: AssemblyVersion("1.3.9.0")] 34 | [assembly: AssemblyFileVersion("1.3.9.0")] 35 | 36 | // This library is compatible with all CLS-compliant .NET programming languages. 37 | [assembly: CLSCompliant(true)] -------------------------------------------------------------------------------- /SubstrateCS/Source/AnvilBiomeCollection.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Substrate.Core; 4 | using Substrate.Nbt; 5 | 6 | namespace Substrate 7 | { 8 | public class AnvilBiomeCollection 9 | { 10 | public const int OCEAN = 0; 11 | public const int PLAINS = 1; 12 | public const int DESERT = 2; 13 | public const int EXTREME_HILLS = 3; 14 | public const int FOREST = 4; 15 | public const int TAIGA = 5; 16 | public const int SWAMPLAND = 6; 17 | public const int RIVER = 7; 18 | public const int HELL = 8; 19 | public const int SKY = 9; 20 | public const int FROZEN_OCEAN = 10; 21 | public const int FROZEN_RIVER = 11; 22 | public const int ICE_PLAINS = 12; 23 | public const int ICE_MOUNTAINS = 13; 24 | public const int MUSHROOM_ISLAND = 14; 25 | public const int MUSHROOM_ISLAND_SHORE = 15; 26 | public const int BEACH = 16; 27 | public const int DESERT_HILLS = 17; 28 | public const int FOREST_HILLS = 18; 29 | public const int TAIGA_HILLS = 19; 30 | public const int EXTREME_HILLS_EDGE = 20; 31 | public const int JUNGLE = 21; 32 | public const int JUNGLE_HILLS = 22; 33 | 34 | private readonly int _xdim; 35 | private readonly int _zdim; 36 | 37 | private IDataArray2 _biomeMap; 38 | 39 | public AnvilBiomeCollection(IDataArray2 biomeMap) 40 | { 41 | _biomeMap = biomeMap; 42 | 43 | _xdim = _biomeMap.XDim; 44 | _zdim = _biomeMap.ZDim; 45 | } 46 | 47 | public int GetBiome(int x, int z) 48 | { 49 | return _biomeMap[x, z]; 50 | } 51 | 52 | public void SetBiome(int x, int z, int newBiome) 53 | { 54 | _biomeMap[x, z] = newBiome; 55 | } 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /SubstrateCS/Source/AnvilRegionManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Substrate.Core; 4 | 5 | namespace Substrate 6 | { 7 | public class AnvilRegionManager : RegionManager 8 | { 9 | public AnvilRegionManager (string regionDir, ChunkCache cache) 10 | : base(regionDir, cache) 11 | { 12 | } 13 | 14 | protected override IRegion CreateRegionCore (int rx, int rz) 15 | { 16 | return new AnvilRegion(this, _chunkCache, rx, rz); 17 | } 18 | 19 | protected override RegionFile CreateRegionFileCore (int rx, int rz) 20 | { 21 | string fp = "r." + rx + "." + rz + ".mca"; 22 | return new RegionFile(Path.Combine(_regionPath, fp)); 23 | } 24 | 25 | protected override void DeleteRegionCore (IRegion region) 26 | { 27 | AnvilRegion r = region as AnvilRegion; 28 | if (r != null) { 29 | r.Dispose(); 30 | } 31 | } 32 | 33 | public override IRegion GetRegion (string filename) 34 | { 35 | int rx, rz; 36 | if (!AnvilRegion.ParseFileName(filename, out rx, out rz)) { 37 | throw new ArgumentException("Malformed region file name: " + filename, "filename"); 38 | } 39 | 40 | return GetRegion(rx, rz); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SubstrateCS/Source/BetaRegionManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using Substrate.Core; 4 | 5 | namespace Substrate 6 | { 7 | public class BetaRegionManager : RegionManager 8 | { 9 | public BetaRegionManager (string regionDir, ChunkCache cache) 10 | : base(regionDir, cache) 11 | { 12 | } 13 | 14 | protected override IRegion CreateRegionCore (int rx, int rz) 15 | { 16 | return new BetaRegion(this, _chunkCache, rx, rz); 17 | } 18 | 19 | protected override RegionFile CreateRegionFileCore (int rx, int rz) 20 | { 21 | string fp = "r." + rx + "." + rz + ".mcr"; 22 | return new RegionFile(Path.Combine(_regionPath, fp)); 23 | } 24 | 25 | protected override void DeleteRegionCore (IRegion region) 26 | { 27 | BetaRegion r = region as BetaRegion; 28 | if (r != null) { 29 | r.Dispose(); 30 | } 31 | } 32 | 33 | public override IRegion GetRegion (string filename) 34 | { 35 | int rx, rz; 36 | if (!BetaRegion.ParseFileName(filename, out rx, out rz)) { 37 | throw new ArgumentException("Malformed region file name: " + filename, "filename"); 38 | } 39 | 40 | return GetRegion(rx, rz); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /SubstrateCS/Source/BiomeInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate 6 | { 7 | public class BiomeType 8 | { 9 | public const int Ocean = 0; 10 | public const int Plains = 1; 11 | public const int Desert = 2; 12 | public const int ExtremeHills = 3; 13 | public const int Forest = 4; 14 | public const int Taiga = 5; 15 | public const int Swampland = 6; 16 | public const int River = 7; 17 | public const int Hell = 8; 18 | public const int Sky = 9; 19 | public const int FrozenOcean = 10; 20 | public const int FrozenRiver = 11; 21 | public const int IcePlains = 12; 22 | public const int IceMountains = 13; 23 | public const int MushroomIsland = 14; 24 | public const int MushroomIslandShore = 15; 25 | public const int Beach = 16; 26 | public const int DesertHills = 17; 27 | public const int ForestHills = 18; 28 | public const int TaigaHills = 19; 29 | public const int ExtremeHillsEdge = 20; 30 | public const int Jungle = 21; 31 | public const int JungleHills = 22; 32 | 33 | public const int Default = 255; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /SubstrateCS/Source/CacheTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Substrate 5 | { 6 | /// 7 | /// Provides read-only indexed access to an underlying resource. 8 | /// 9 | /// The type of the underlying resource. 10 | public interface ICacheTable : IEnumerable 11 | { 12 | /// 13 | /// Gets the value at the given index. 14 | /// 15 | /// The index to fetch. 16 | T this[int index] { get; } 17 | } 18 | 19 | /*internal class CacheTableArray : ICacheTable 20 | { 21 | private T[] _cache; 22 | 23 | public T this[int index] 24 | { 25 | get { return _cache[index]; } 26 | } 27 | 28 | public CacheTableArray (T[] cache) 29 | { 30 | _cache = cache; 31 | } 32 | } 33 | 34 | internal class CacheTableDictionary : ICacheTable 35 | { 36 | private Dictionary _cache; 37 | private static Random _rand = new Random(); 38 | 39 | public T this[int index] 40 | { 41 | get 42 | { 43 | T val; 44 | if (_cache.TryGetValue(index, out val)) { 45 | return val; 46 | } 47 | return default(T); 48 | } 49 | } 50 | 51 | public CacheTableDictionary (Dictionary cache) 52 | { 53 | _cache = cache; 54 | } 55 | } 56 | 57 | /// 58 | /// Provides read-only indexed access to an underlying resource. 59 | /// 60 | /// The type of the underlying resource. 61 | public class CacheTable 62 | { 63 | ICacheTable _cache; 64 | 65 | /// 66 | /// Gets the value at the given index. 67 | /// 68 | /// 69 | public T this[int index] 70 | { 71 | get { return _cache[index]; } 72 | } 73 | 74 | internal CacheTable (T[] cache) 75 | { 76 | _cache = new CacheTableArray(cache); 77 | } 78 | 79 | internal CacheTable (Dictionary cache) 80 | { 81 | _cache = new CacheTableDictionary(cache); 82 | } 83 | }*/ 84 | } 85 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Core/BlockKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Substrate.Core 4 | { 5 | public struct BlockKey : IEquatable 6 | { 7 | public readonly int x; 8 | public readonly int y; 9 | public readonly int z; 10 | 11 | public BlockKey (int _x, int _y, int _z) 12 | { 13 | x = _x; 14 | y = _y; 15 | z = _z; 16 | } 17 | 18 | public bool Equals (BlockKey bk) 19 | { 20 | return this.x == bk.x && this.y == bk.y && this.z == bk.z; 21 | } 22 | 23 | public override bool Equals (Object o) 24 | { 25 | try { 26 | return this == (BlockKey)o; 27 | } 28 | catch { 29 | return false; 30 | } 31 | } 32 | 33 | public override int GetHashCode () 34 | { 35 | int hash = 23; 36 | hash = hash * 37 + x; 37 | hash = hash * 37 + y; 38 | hash = hash * 37 + z; 39 | return hash; 40 | } 41 | 42 | public static bool operator == (BlockKey k1, BlockKey k2) 43 | { 44 | return k1.x == k2.x && k1.y == k2.y && k1.z == k2.z; 45 | } 46 | 47 | public static bool operator != (BlockKey k1, BlockKey k2) 48 | { 49 | return k1.x != k2.x || k1.y != k2.y || k1.z != k2.z; 50 | } 51 | 52 | public override string ToString () 53 | { 54 | return "(" + x + ", " + y + ", " + z + ")"; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Core/ChunkFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | using Ionic.Zlib; 6 | 7 | namespace Substrate.Core 8 | { 9 | public class ChunkFile : NBTFile 10 | { 11 | public ChunkFile (string path) 12 | : base(path) 13 | { 14 | } 15 | 16 | public ChunkFile (string path, int cx, int cz) 17 | : base("") 18 | { 19 | string cx64 = Base36.Encode(cx); 20 | string cz64 = Base36.Encode(cz); 21 | string file = "c." + cx64 + "." + cz64 + ".dat"; 22 | 23 | while (cx < 0) { 24 | cx += (64 * 64); 25 | } 26 | while (cz < 0) { 27 | cz += (64 * 64); 28 | } 29 | 30 | string dir1 = Base36.Encode(cx % 64); 31 | string dir2 = Base36.Encode(cz % 64); 32 | 33 | FileName = Path.Combine(path, dir1); 34 | if (!Directory.Exists(FileName)) { 35 | Directory.CreateDirectory(FileName); 36 | } 37 | 38 | FileName = Path.Combine(FileName, dir2); 39 | if (!Directory.Exists(FileName)) { 40 | Directory.CreateDirectory(FileName); 41 | } 42 | 43 | FileName = Path.Combine(FileName, file); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Core/ChunkKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Core 6 | { 7 | public struct ChunkKey : IEquatable 8 | { 9 | public readonly int cx; 10 | public readonly int cz; 11 | 12 | public ChunkKey (int _cx, int _cz) 13 | { 14 | cx = _cx; 15 | cz = _cz; 16 | } 17 | 18 | public bool Equals (ChunkKey ck) 19 | { 20 | return this.cx == ck.cx && this.cz == ck.cz; 21 | } 22 | 23 | public override bool Equals (Object o) 24 | { 25 | try { 26 | return this == (ChunkKey)o; 27 | } 28 | catch { 29 | return false; 30 | } 31 | } 32 | 33 | public override int GetHashCode () 34 | { 35 | int hash = 23; 36 | hash = hash * 37 + cx; 37 | hash = hash * 37 + cz; 38 | return hash; 39 | } 40 | 41 | public static bool operator == (ChunkKey k1, ChunkKey k2) 42 | { 43 | return k1.cx == k2.cx && k1.cz == k2.cz; 44 | } 45 | 46 | public static bool operator != (ChunkKey k1, ChunkKey k2) 47 | { 48 | return k1.cx != k2.cx || k1.cz != k2.cz; 49 | } 50 | 51 | public override string ToString () 52 | { 53 | return "(" + cx + ", " + cz + ")"; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Core/Interface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Core 6 | { 7 | /// 8 | /// Provides a virtual deep copy capability to implementors. 9 | /// 10 | /// 11 | public interface ICopyable 12 | { 13 | /// 14 | /// Performs a virtual deep copy of the object instance. 15 | /// 16 | /// An independent copy of the object instance. 17 | T Copy (); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Core/ItemInterface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Substrate.Core 4 | { 5 | /// 6 | /// An interface that exposes an for the object. 7 | /// 8 | public interface IItemContainer 9 | { 10 | /// 11 | /// Gets an associated with the object. 12 | /// 13 | ItemCollection Items { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Core/OpenWorldEvent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Substrate.Core 5 | { 6 | /// 7 | /// A callback function to open a world and return it as an instance of a concrete derivative of . 8 | /// 9 | /// The path to the directory of the world to open. 10 | /// An instance of a concrete derivative of . 11 | public delegate NbtWorld OpenWorldCallback (string path); 12 | 13 | /// 14 | /// Event arugments and response data for any handlers trying to determine if they can open a given world. 15 | /// 16 | public class OpenWorldEventArgs : EventArgs 17 | { 18 | private List _handlers; 19 | private string _path; 20 | 21 | /// 22 | /// Create a new instance of event arguments. 23 | /// 24 | /// The path to the directory of a world. 25 | public OpenWorldEventArgs (string path) 26 | : base() 27 | { 28 | _path = path; 29 | _handlers = new List(); 30 | } 31 | 32 | /// 33 | /// Gets the path to the directory of a world being investigated. 34 | /// 35 | public string Path 36 | { 37 | get { return _path; } 38 | } 39 | 40 | /// 41 | /// Adds an delegate that can open a world and return a corresponding object. 42 | /// 43 | /// The delegate to return to the code that raised the event. 44 | public void AddHandler (OpenWorldCallback callback) 45 | { 46 | _handlers.Add(callback); 47 | } 48 | 49 | internal int HandlerCount 50 | { 51 | get { return _handlers.Count; } 52 | } 53 | 54 | internal ICollection Handlers 55 | { 56 | get { return _handlers; } 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Core/PlayerFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | using Ionic.Zlib; 6 | 7 | namespace Substrate.Core 8 | { 9 | public class PlayerFile : NBTFile 10 | { 11 | public PlayerFile (string path) 12 | : base(path) 13 | { 14 | } 15 | 16 | public PlayerFile (string path, string name) 17 | : base("") 18 | { 19 | if (!Directory.Exists(path)) { 20 | Directory.CreateDirectory(path); 21 | } 22 | 23 | string file = name + ".dat"; 24 | FileName = Path.Combine(path, file); 25 | } 26 | 27 | public static string NameFromFilename (string filename) 28 | { 29 | if (filename.EndsWith(".dat")) { 30 | return filename.Remove(filename.Length - 4); 31 | } 32 | 33 | return filename; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Core/PlayerManagerInterface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Core 6 | { 7 | /// 8 | /// An interface of basic manipulations on an abstract data store for player data. 9 | /// 10 | public interface IPlayerManager 11 | { 12 | /// 13 | /// Gets a object for the given player from the underlying data store. 14 | /// 15 | /// The name of the player to fetch. 16 | /// A object for the given player, or null if the player could not be found. 17 | Player GetPlayer (string name); 18 | 19 | /// 20 | /// Saves a object's data back to the underlying data store for the given player. 21 | /// 22 | /// The name of the player to write back data for. 23 | /// The object containing data to write back. 24 | void SetPlayer (string name, Player player); 25 | 26 | /// 27 | /// Checks if a player exists in the underlying data store. 28 | /// 29 | /// The name of the player to look up. 30 | /// True if player data was found; false otherwise. 31 | bool PlayerExists (string name); 32 | 33 | /// 34 | /// Deletes a player with the given name from the underlying data store. 35 | /// 36 | /// The name of the player to delete. 37 | void DeletePlayer (string name); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Core/RegionKey.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Core 6 | { 7 | public struct RegionKey : IEquatable 8 | { 9 | public static RegionKey InvalidRegion = new RegionKey(int.MinValue, int.MinValue); 10 | 11 | readonly int rx; 12 | readonly int rz; 13 | 14 | public int X 15 | { 16 | get { return rx; } 17 | } 18 | 19 | public int Z 20 | { 21 | get { return rz; } 22 | } 23 | 24 | public RegionKey (int _rx, int _rz) 25 | { 26 | rx = _rx; 27 | rz = _rz; 28 | } 29 | 30 | public bool Equals (RegionKey ck) 31 | { 32 | return this.rx == ck.rx && this.rz == ck.rz; 33 | } 34 | 35 | public override bool Equals (Object o) 36 | { 37 | try { 38 | return this == (RegionKey)o; 39 | } 40 | catch { 41 | return false; 42 | } 43 | } 44 | 45 | public override int GetHashCode () 46 | { 47 | int hash = 23; 48 | hash = hash * 37 + rx; 49 | hash = hash * 37 + rz; 50 | return hash; 51 | } 52 | 53 | public static bool operator == (RegionKey k1, RegionKey k2) 54 | { 55 | return k1.rx == k2.rx && k1.rz == k2.rz; 56 | } 57 | 58 | public static bool operator != (RegionKey k1, RegionKey k2) 59 | { 60 | return k1.rx != k2.rx || k1.rz != k2.rz; 61 | } 62 | 63 | public override string ToString () 64 | { 65 | return "(" + rx + ", " + rz + ")"; 66 | } 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Data/DataExceptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Substrate.Data 5 | { 6 | /// 7 | /// The exception that is thrown when IO errors occur during high-level data resource management operations. 8 | /// 9 | [Serializable] 10 | public class DataIOException : SubstrateException 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public DataIOException () 16 | : base() 17 | { } 18 | 19 | /// 20 | /// Initializes a new instance of the class with a custom error message. 21 | /// 22 | /// A custom error message. 23 | public DataIOException (string message) 24 | : base(message) 25 | { } 26 | 27 | /// 28 | /// Initializes a new instance of the class with a custom error message and a reference to 29 | /// an InnerException representing the original cause of the exception. 30 | /// 31 | /// A custom error message. 32 | /// A reference to the original exception that caused the error. 33 | public DataIOException (string message, Exception innerException) 34 | : base(message, innerException) 35 | { } 36 | 37 | /// 38 | /// Initializes a new instance of the class with serialized data. 39 | /// 40 | /// The object that holds the serialized object data. 41 | /// The contextual information about the source or destination. 42 | protected DataIOException (SerializationInfo info, StreamingContext context) 43 | : base(info, context) 44 | { } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Data/DataManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Substrate.Data 5 | { 6 | /// 7 | /// Provides a common interface for managing additional data resources in a world. 8 | /// 9 | public abstract class DataManager 10 | { 11 | /// 12 | /// Gets or sets the id of the next map to be created. 13 | /// 14 | public virtual int CurrentMapId 15 | { 16 | get { throw new NotImplementedException(); } 17 | set { throw new NotImplementedException(); } 18 | } 19 | 20 | /// 21 | /// Gets an for managing data resources. 22 | /// 23 | public IMapManager Maps 24 | { 25 | get { return GetMapManager(); } 26 | } 27 | 28 | /// 29 | /// Gets an for managing data resources. 30 | /// 31 | /// An instance appropriate for the concrete instance. 32 | protected virtual IMapManager GetMapManager () 33 | { 34 | return null; 35 | } 36 | 37 | /// 38 | /// Saves any metadata required by the world for managing data resources. 39 | /// 40 | /// true on success, or false if data could not be saved. 41 | public virtual bool Save () 42 | { 43 | return true; 44 | } 45 | } 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Data/MapFile.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | using Ionic.Zlib; 6 | using Substrate.Core; 7 | 8 | namespace Substrate.Data 9 | { 10 | public class MapFile : NBTFile 11 | { 12 | public MapFile (string path) 13 | : base(path) 14 | { 15 | } 16 | 17 | public MapFile (string path, int id) 18 | : base("") 19 | { 20 | if (!Directory.Exists(path)) { 21 | Directory.CreateDirectory(path); 22 | } 23 | 24 | string file = "map_" + id + ".dat"; 25 | FileName = Path.Combine(path, file); 26 | } 27 | 28 | public static int IdFromFilename (string filename) 29 | { 30 | if (filename.EndsWith(".dat")) { 31 | return Convert.ToInt32(filename.Substring(4).Remove(filename.Length - 4)); 32 | } 33 | 34 | throw new FormatException("Filename '" + filename + "' is not a .dat file"); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Data/MapManagerInterface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Substrate.Data 4 | { 5 | /// 6 | /// An interface of basic manipulations on an abstract data store for map data. 7 | /// 8 | public interface IMapManager 9 | { 10 | /// 11 | /// Gets a object for the given map id from the underlying data store. 12 | /// 13 | /// The id of a map data resource. 14 | /// A object for the given map id, or null if the map doesn't exist. 15 | Map GetMap (int id); 16 | 17 | /// 18 | /// Saves a object's data back to the underlying data store for the given map id. 19 | /// 20 | /// The id of the map to write back data for. 21 | /// The object containing data to write back. 22 | void SetMap (int id, Map map); 23 | 24 | /// 25 | /// Checks if a map exists in the underlying data store. 26 | /// 27 | /// The id of the map to look up. 28 | /// True if map data was found; false otherwise. 29 | bool MapExists (int id); 30 | 31 | /// 32 | /// Deletes a map with the given id from the underlying data store. 33 | /// 34 | /// The id of the map to delete. 35 | void DeleteMap (int id); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityBlaze.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityBlaze : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound BlazeSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Blaze"; } 19 | } 20 | 21 | protected EntityBlaze (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityBlaze () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityBlaze (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, BlazeSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityBlaze(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityBoat.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityBoat : TypedEntity 10 | { 11 | public static readonly SchemaNodeCompound BoatSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static string TypeId 17 | { 18 | get { return "Boat"; } 19 | } 20 | 21 | protected EntityBoat (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityBoat () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityBoat (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, BoatSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityBoat(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityCaveSpider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityCaveSpider : EntitySpider 10 | { 11 | public static readonly SchemaNodeCompound CaveSpiderSchema = SpiderSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "CaveSpider"; } 19 | } 20 | 21 | protected EntityCaveSpider (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityCaveSpider () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityCaveSpider (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | #region INBTObject Members 37 | 38 | public override bool ValidateTree (TagNode tree) 39 | { 40 | return new NbtVerifier(tree, CaveSpiderSchema).Verify(); 41 | } 42 | 43 | #endregion 44 | 45 | 46 | #region ICopyable Members 47 | 48 | public override TypedEntity Copy () 49 | { 50 | return new EntityCaveSpider(this); 51 | } 52 | 53 | #endregion 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityChicken.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityChicken : EntityAnimal 10 | { 11 | public static readonly SchemaNodeCompound ChickenSchema = AnimalSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Chicken"; } 19 | } 20 | 21 | protected EntityChicken (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityChicken () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityChicken (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, ChickenSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityChicken(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityCow.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityCow : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound CowSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Cow"; } 19 | } 20 | 21 | protected EntityCow (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityCow () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityCow (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, CowSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityCow(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityEgg.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityEgg : EntityThrowable 10 | { 11 | public static readonly SchemaNodeCompound EggSchema = ThrowableSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static string TypeId 17 | { 18 | get { return "Egg"; } 19 | } 20 | 21 | protected EntityEgg (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityEgg () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityEgg (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, EggSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityEgg(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityEnderDragon.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityEnderDragon : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound EnderDragonSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "EnderDragon"; } 19 | } 20 | 21 | protected EntityEnderDragon (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityEnderDragon () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityEnderDragon (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, EnderDragonSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityEnderDragon(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityEnderEye.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityEnderEye : TypedEntity 10 | { 11 | public static readonly SchemaNodeCompound EnderEyeSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static string TypeId 17 | { 18 | get { return "EyeOfEnderSignal"; } 19 | } 20 | 21 | protected EntityEnderEye (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityEnderEye () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityEnderEye (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, EnderEyeSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityEnderEye(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityEnderPearl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityEnderPearl : EntityThrowable 10 | { 11 | public static readonly SchemaNodeCompound EnderPearlSchema = ThrowableSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static string TypeId 17 | { 18 | get { return "ThrownEnderpearl"; } 19 | } 20 | 21 | protected EntityEnderPearl (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityEnderPearl () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityEnderPearl (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, EnderPearlSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityEnderPearl(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityFallingSand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityFallingSand : TypedEntity 10 | { 11 | public static readonly SchemaNodeCompound FallingSandSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | new SchemaNodeScaler("Tile", TagType.TAG_BYTE), 15 | }); 16 | 17 | public static string TypeId 18 | { 19 | get { return "FallingSand"; } 20 | } 21 | 22 | private byte _tile; 23 | 24 | public int Tile 25 | { 26 | get { return _tile; } 27 | set { _tile = (byte)value; } 28 | } 29 | 30 | protected EntityFallingSand (string id) 31 | : base(id) 32 | { 33 | } 34 | 35 | public EntityFallingSand () 36 | : this(TypeId) 37 | { 38 | } 39 | 40 | public EntityFallingSand (TypedEntity e) 41 | : base(e) 42 | { 43 | EntityFallingSand e2 = e as EntityFallingSand; 44 | if (e2 != null) { 45 | _tile = e2._tile; 46 | } 47 | } 48 | 49 | 50 | #region INBTObject Members 51 | 52 | public override TypedEntity LoadTree (TagNode tree) 53 | { 54 | TagNodeCompound ctree = tree as TagNodeCompound; 55 | if (ctree == null || base.LoadTree(tree) == null) { 56 | return null; 57 | } 58 | 59 | _tile = ctree["Tile"].ToTagByte(); 60 | 61 | return this; 62 | } 63 | 64 | public override TagNode BuildTree () 65 | { 66 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 67 | tree["Tile"] = new TagNodeByte(_tile); 68 | 69 | return tree; 70 | } 71 | 72 | public override bool ValidateTree (TagNode tree) 73 | { 74 | return new NbtVerifier(tree, FallingSandSchema).Verify(); 75 | } 76 | 77 | #endregion 78 | 79 | 80 | #region ICopyable Members 81 | 82 | public override TypedEntity Copy () 83 | { 84 | return new EntityFallingSand(this); 85 | } 86 | 87 | #endregion 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityGhast.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityGhast : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound GhastSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Ghast"; } 19 | } 20 | 21 | protected EntityGhast (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityGhast () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityGhast (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, GhastSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityGhast(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityGiant.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityGiant : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound GiantSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Giant"; } 19 | } 20 | 21 | protected EntityGiant (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityGiant () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityGiant (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, GiantSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityGiant(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityMagmaCube.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityMagmaCube : EntitySlime 10 | { 11 | public static readonly SchemaNodeCompound MagmaCubeSchema = SlimeSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "LavaSlime"; } 19 | } 20 | 21 | protected EntityMagmaCube (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityMagmaCube () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityMagmaCube (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, MagmaCubeSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityMagmaCube(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityMonster.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityMonster : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound MonsterSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Monster"; } 19 | } 20 | 21 | protected EntityMonster (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityMonster () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityMonster (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, MonsterSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityMonster(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityMooshroom.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityMooshroom : EntityCow 10 | { 11 | public static readonly SchemaNodeCompound MooshroomSchema = CowSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "MushroomCow"; } 19 | } 20 | 21 | protected EntityMooshroom (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityMooshroom () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityMooshroom (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, MooshroomSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityMooshroom(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityPig.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityPig : EntityAnimal 10 | { 11 | public static readonly SchemaNodeCompound PigSchema = AnimalSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | new SchemaNodeScaler("Saddle", TagType.TAG_BYTE), 15 | }); 16 | 17 | public static new string TypeId 18 | { 19 | get { return "Pig"; } 20 | } 21 | 22 | private bool _saddle; 23 | 24 | public bool HasSaddle 25 | { 26 | get { return _saddle; } 27 | set { _saddle = value; } 28 | } 29 | 30 | protected EntityPig (string id) 31 | : base(id) 32 | { 33 | } 34 | 35 | public EntityPig () 36 | : this(TypeId) 37 | { 38 | } 39 | 40 | public EntityPig (TypedEntity e) 41 | : base(e) 42 | { 43 | EntityPig e2 = e as EntityPig; 44 | if (e2 != null) { 45 | _saddle = e2._saddle; 46 | } 47 | } 48 | 49 | 50 | #region INBTObject Members 51 | 52 | public override TypedEntity LoadTree (TagNode tree) 53 | { 54 | TagNodeCompound ctree = tree as TagNodeCompound; 55 | if (ctree == null || base.LoadTree(tree) == null) { 56 | return null; 57 | } 58 | 59 | _saddle = ctree["Saddle"].ToTagByte() == 1; 60 | 61 | return this; 62 | } 63 | 64 | public override TagNode BuildTree () 65 | { 66 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 67 | tree["Saddle"] = new TagNodeByte((byte)(_saddle ? 1 : 0)); 68 | 69 | return tree; 70 | } 71 | 72 | public override bool ValidateTree (TagNode tree) 73 | { 74 | return new NbtVerifier(tree, PigSchema).Verify(); 75 | } 76 | 77 | #endregion 78 | 79 | 80 | #region ICopyable Members 81 | 82 | public override TypedEntity Copy () 83 | { 84 | return new EntityPig(this); 85 | } 86 | 87 | #endregion 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityPigZombie.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityPigZombie : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound PigZombieSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | new SchemaNodeScaler("Anger", TagType.TAG_SHORT), 15 | }); 16 | 17 | public static new string TypeId 18 | { 19 | get { return "PigZombie"; } 20 | } 21 | 22 | private short _anger; 23 | 24 | public int Anger 25 | { 26 | get { return _anger; } 27 | set { _anger = (short)value; } 28 | } 29 | 30 | protected EntityPigZombie (string id) 31 | : base(id) 32 | { 33 | } 34 | 35 | public EntityPigZombie () 36 | : this(TypeId) 37 | { 38 | } 39 | 40 | public EntityPigZombie (TypedEntity e) 41 | : base(e) 42 | { 43 | EntityPigZombie e2 = e as EntityPigZombie; 44 | if (e2 != null) { 45 | _anger = e2._anger; 46 | } 47 | } 48 | 49 | 50 | #region INBTObject Members 51 | 52 | public override TypedEntity LoadTree (TagNode tree) 53 | { 54 | TagNodeCompound ctree = tree as TagNodeCompound; 55 | if (ctree == null || base.LoadTree(tree) == null) { 56 | return null; 57 | } 58 | 59 | _anger = ctree["Anger"].ToTagShort(); 60 | 61 | return this; 62 | } 63 | 64 | public override TagNode BuildTree () 65 | { 66 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 67 | tree["Anger"] = new TagNodeShort(_anger); 68 | 69 | return tree; 70 | } 71 | 72 | public override bool ValidateTree (TagNode tree) 73 | { 74 | return new NbtVerifier(tree, PigZombieSchema).Verify(); 75 | } 76 | 77 | #endregion 78 | 79 | 80 | #region ICopyable Members 81 | 82 | public override TypedEntity Copy () 83 | { 84 | return new EntityPigZombie(this); 85 | } 86 | 87 | #endregion 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityPrimedTnt.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityPrimedTnt : TypedEntity 10 | { 11 | public static readonly SchemaNodeCompound PrimedTntSchema = TypedEntity.Schema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | new SchemaNodeScaler("Fuse", TagType.TAG_BYTE), 15 | }); 16 | 17 | public static string TypeId 18 | { 19 | get { return "PrimedTnt"; } 20 | } 21 | 22 | private byte _fuse; 23 | 24 | public int Fuse 25 | { 26 | get { return _fuse; } 27 | set { _fuse = (byte)value; } 28 | } 29 | 30 | protected EntityPrimedTnt (string id) 31 | : base(id) 32 | { 33 | } 34 | 35 | public EntityPrimedTnt () 36 | : this(TypeId) 37 | { 38 | } 39 | 40 | public EntityPrimedTnt (TypedEntity e) 41 | : base(e) 42 | { 43 | EntityPrimedTnt e2 = e as EntityPrimedTnt; 44 | if (e2 != null) { 45 | _fuse = e2._fuse; 46 | } 47 | } 48 | 49 | 50 | #region INBTObject Members 51 | 52 | public override TypedEntity LoadTree (TagNode tree) 53 | { 54 | TagNodeCompound ctree = tree as TagNodeCompound; 55 | if (ctree == null || base.LoadTree(tree) == null) { 56 | return null; 57 | } 58 | 59 | _fuse = ctree["Fuse"].ToTagByte(); 60 | 61 | return this; 62 | } 63 | 64 | public override TagNode BuildTree () 65 | { 66 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 67 | tree["Fuse"] = new TagNodeByte(_fuse); 68 | 69 | return tree; 70 | } 71 | 72 | public override bool ValidateTree (TagNode tree) 73 | { 74 | return new NbtVerifier(tree, PrimedTntSchema).Verify(); 75 | } 76 | 77 | #endregion 78 | 79 | 80 | #region ICopyable Members 81 | 82 | public override TypedEntity Copy () 83 | { 84 | return new EntityPrimedTnt(this); 85 | } 86 | 87 | #endregion 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntitySilverfish.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntitySilverfish : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound SilverfishSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Silverfish"; } 19 | } 20 | 21 | protected EntitySilverfish (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntitySilverfish () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntitySilverfish (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override TypedEntity LoadTree (TagNode tree) 40 | { 41 | TagNodeCompound ctree = tree as TagNodeCompound; 42 | if (ctree == null || base.LoadTree(tree) == null) { 43 | return null; 44 | } 45 | 46 | return this; 47 | } 48 | 49 | public override TagNode BuildTree () 50 | { 51 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 52 | 53 | return tree; 54 | } 55 | 56 | public override bool ValidateTree (TagNode tree) 57 | { 58 | return new NbtVerifier(tree, SilverfishSchema).Verify(); 59 | } 60 | 61 | #endregion 62 | 63 | 64 | #region ICopyable Members 65 | 66 | public override TypedEntity Copy () 67 | { 68 | return new EntitySilverfish(this); 69 | } 70 | 71 | #endregion 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntitySkeleton.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntitySkeleton : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound SkeletonSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Skeleton"; } 19 | } 20 | 21 | protected EntitySkeleton (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntitySkeleton () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntitySkeleton (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, SkeletonSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntitySkeleton(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntitySlime.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntitySlime : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound SlimeSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | new SchemaNodeScaler("Size", TagType.TAG_INT), 15 | }); 16 | 17 | public static new string TypeId 18 | { 19 | get { return "Slime"; } 20 | } 21 | 22 | private int _size; 23 | 24 | public int Size 25 | { 26 | get { return _size; } 27 | set { _size = value; } 28 | } 29 | 30 | protected EntitySlime (string id) 31 | : base(id) 32 | { 33 | } 34 | 35 | public EntitySlime () 36 | : this(TypeId) 37 | { 38 | } 39 | 40 | public EntitySlime (TypedEntity e) 41 | : base(e) 42 | { 43 | EntitySlime e2 = e as EntitySlime; 44 | if (e2 != null) { 45 | _size = e2._size; 46 | } 47 | } 48 | 49 | 50 | #region INBTObject Members 51 | 52 | public override TypedEntity LoadTree (TagNode tree) 53 | { 54 | TagNodeCompound ctree = tree as TagNodeCompound; 55 | if (ctree == null || base.LoadTree(tree) == null) { 56 | return null; 57 | } 58 | 59 | _size = ctree["Size"].ToTagInt(); 60 | 61 | return this; 62 | } 63 | 64 | public override TagNode BuildTree () 65 | { 66 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 67 | tree["Size"] = new TagNodeInt(_size); 68 | 69 | return tree; 70 | } 71 | 72 | public override bool ValidateTree (TagNode tree) 73 | { 74 | return new NbtVerifier(tree, SlimeSchema).Verify(); 75 | } 76 | 77 | #endregion 78 | 79 | 80 | #region ICopyable Members 81 | 82 | public override TypedEntity Copy () 83 | { 84 | return new EntitySlime(this); 85 | } 86 | 87 | #endregion 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntitySmallFireball.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntitySmallFireball : EntityFireball 10 | { 11 | public static readonly SchemaNodeCompound SmallFireballSchema = FireballSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "SmallFireball"; } 19 | } 20 | 21 | protected EntitySmallFireball (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntitySmallFireball () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntitySmallFireball (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, SmallFireballSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntitySmallFireball(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntitySnowball.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntitySnowball : EntityThrowable 10 | { 11 | public static readonly SchemaNodeCompound SnowballSchema = ThrowableSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static string TypeId 17 | { 18 | get { return "Snowball"; } 19 | } 20 | 21 | protected EntitySnowball (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntitySnowball () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntitySnowball (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, SnowballSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntitySnowball(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntitySnowman.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntitySnowman : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound SnowmanSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "SnowMan"; } 19 | } 20 | 21 | protected EntitySnowman (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntitySnowman () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntitySnowman (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, SnowmanSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntitySnowman(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntitySpider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntitySpider : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound SpiderSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Spider"; } 19 | } 20 | 21 | protected EntitySpider (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntitySpider () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntitySpider (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, SpiderSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntitySpider(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntitySquid.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntitySquid : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound SquidSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Squid"; } 19 | } 20 | 21 | protected EntitySquid (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntitySquid () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntitySquid (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, SquidSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntitySquid(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Entities/EntityZombie.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Entities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class EntityZombie : EntityMob 10 | { 11 | public static readonly SchemaNodeCompound ZombieSchema = MobSchema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static new string TypeId 17 | { 18 | get { return "Zombie"; } 19 | } 20 | 21 | protected EntityZombie (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public EntityZombie () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public EntityZombie (TypedEntity e) 32 | : base(e) 33 | { 34 | } 35 | 36 | 37 | #region INBTObject Members 38 | 39 | public override bool ValidateTree (TagNode tree) 40 | { 41 | return new NbtVerifier(tree, ZombieSchema).Verify(); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region ICopyable Members 48 | 49 | public override TypedEntity Copy () 50 | { 51 | return new EntityZombie(this); 52 | } 53 | 54 | #endregion 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /SubstrateCS/Source/LevelIOException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Substrate 5 | { 6 | /// 7 | /// The exception that is thrown when IO errors occur during level management operations. 8 | /// 9 | [Serializable] 10 | public class LevelIOException : SubstrateException 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public LevelIOException () 16 | : base() 17 | { } 18 | 19 | /// 20 | /// Initializes a new instance of the class with a custom error message. 21 | /// 22 | /// A custom error message. 23 | public LevelIOException (string message) 24 | : base(message) 25 | { } 26 | 27 | /// 28 | /// Initializes a new instance of the class with a custom error message and a reference to 29 | /// an InnerException representing the original cause of the exception. 30 | /// 31 | /// A custom error message. 32 | /// A reference to the original exception that caused the error. 33 | public LevelIOException (string message, Exception innerException) 34 | : base(message, innerException) 35 | { } 36 | 37 | /// 38 | /// Initializes a new instance of the class with serialized data. 39 | /// 40 | /// The object that holds the serialized object data. 41 | /// The contextual information about the source or destination. 42 | protected LevelIOException (SerializationInfo info, StreamingContext context) 43 | : base(info, context) 44 | { } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Nbt/INbtObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Substrate.Nbt 4 | { 5 | /// 6 | /// Defines methods for loading or extracting an NBT tree. 7 | /// 8 | /// Object type that supports this interface. 9 | public interface INbtObject 10 | { 11 | /// 12 | /// Attempt to load an NBT tree into the object without validation. 13 | /// 14 | /// The root node of an NBT tree. 15 | /// The object returns itself on success, or null if the tree was unparsable. 16 | T LoadTree (TagNode tree); 17 | 18 | /// 19 | /// Attempt to load an NBT tree into the object with validation. 20 | /// 21 | /// The root node of an NBT tree. 22 | /// The object returns itself on success, or null if the tree failed validation. 23 | T LoadTreeSafe (TagNode tree); 24 | 25 | /// 26 | /// Builds an NBT tree from the object's data. 27 | /// 28 | /// The root node of an NBT tree representing the object's data. 29 | TagNode BuildTree (); 30 | 31 | /// 32 | /// Validate an NBT tree, usually against an object-supplied schema. 33 | /// 34 | /// The root node of an NBT tree. 35 | /// Status indicating whether the tree was valid for this object. 36 | bool ValidateTree (TagNode tree); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Nbt/NbtIOException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Substrate.Nbt 5 | { 6 | /// 7 | /// The exception that is thrown when errors occur during Nbt IO operations. 8 | /// 9 | /// In most cases, the property will contain more detailed information on the 10 | /// error that occurred. 11 | [Serializable] 12 | public class NbtIOException : SubstrateException 13 | { 14 | /// 15 | /// Initializes a new instance of the class. 16 | /// 17 | public NbtIOException () 18 | : base() 19 | { } 20 | 21 | /// 22 | /// Initializes a new instance of the class with a custom error message. 23 | /// 24 | /// A custom error message. 25 | public NbtIOException (string message) 26 | : base(message) 27 | { } 28 | 29 | /// 30 | /// Initializes a new instance of the class with a custom error message and a reference to 31 | /// an InnerException representing the original cause of the exception. 32 | /// 33 | /// A custom error message. 34 | /// A reference to the original exception that caused the error. 35 | public NbtIOException (string message, Exception innerException) 36 | : base(message, innerException) 37 | { } 38 | 39 | /// 40 | /// Initializes a new instance of the class with serialized data. 41 | /// 42 | /// The object that holds the serialized object data. 43 | /// The contextual information about the source or destination. 44 | protected NbtIOException (SerializationInfo info, StreamingContext context) 45 | : base(info, context) 46 | { } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Nbt/SchemaNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.Nbt 6 | { 7 | /// 8 | /// A node in an NBT schema definition, used to define what values are considered valid for a given NBT node. 9 | /// 10 | public abstract class SchemaNode 11 | { 12 | private string _name; 13 | private SchemaOptions _options; 14 | 15 | /// 16 | /// Gets the name of an expected NBT node. 17 | /// 18 | public string Name 19 | { 20 | get { return _name; } 21 | } 22 | 23 | /// 24 | /// Gets additional schema options defined for this node. 25 | /// 26 | public SchemaOptions Options 27 | { 28 | get { return _options; } 29 | } 30 | 31 | /// 32 | /// Constructs a new representing a named . 33 | /// 34 | /// The name of the corresponding . 35 | protected SchemaNode (string name) 36 | { 37 | _name = name; 38 | } 39 | 40 | /// 41 | /// Constructs a new with additional options. 42 | /// 43 | /// The name of the corresponding . 44 | /// One or more option flags modifying the processing of this node. 45 | protected SchemaNode (string name, SchemaOptions options) 46 | { 47 | _name = name; 48 | _options = options; 49 | } 50 | 51 | /// 52 | /// Construct a sensible default NBT tree representative of this schema node. 53 | /// 54 | /// A that is valid for this schema node. 55 | public virtual TagNode BuildDefaultTree () 56 | { 57 | return null; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Nbt/SchemaOptions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Substrate.Nbt 4 | { 5 | /// 6 | /// Additional options that modify the processing of a . 7 | /// 8 | [Flags] 9 | public enum SchemaOptions 10 | { 11 | /// 12 | /// Any with this option will not throw an error if the corresponding is missing. 13 | /// 14 | OPTIONAL = 0x1, 15 | 16 | /// 17 | /// If a cannot be found for a marked with this option, a sensible default will be created and inserted into the tree. 18 | /// 19 | CREATE_ON_MISSING = 0x2, 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Nbt/TagNodeNull.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Substrate.Nbt 4 | { 5 | /// 6 | /// An NBT node representing a null tag type. 7 | /// 8 | public sealed class TagNodeNull : TagNode 9 | { 10 | /// 11 | /// Converts the node to itself. 12 | /// 13 | /// A reference to itself. 14 | public override TagNodeNull ToTagNull () 15 | { 16 | return this; 17 | } 18 | 19 | /// 20 | /// Gets the tag type of the node. 21 | /// 22 | /// The TAG_END tag type. 23 | public override TagType GetTagType () 24 | { 25 | return TagType.TAG_END; 26 | } 27 | 28 | /// 29 | /// Makes a deep copy of the node. 30 | /// 31 | /// A new null node. 32 | public override TagNode Copy () 33 | { 34 | return new TagNodeNull(); 35 | } 36 | } 37 | } -------------------------------------------------------------------------------- /SubstrateCS/Source/Nbt/VerifierLogger.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Substrate.Core; 3 | 4 | namespace Substrate.Nbt 5 | { 6 | /// 7 | /// A collection of static methods that can be hooked into events for logging NBT errors to the console. 8 | /// 9 | public static class VerifierLogger 10 | { 11 | /// 12 | /// Logs an occurance of a missing tag error, and advances to the next event in the event chain. 13 | /// 14 | /// Data about the NBT node being verified. 15 | /// A indicating whether event processing should pass, fail, or advance. 16 | public static TagEventCode MissingTagHandler (TagEventArgs e) 17 | { 18 | Console.WriteLine("Missing Tag Error: '{0}'", e.TagName); 19 | 20 | return TagEventCode.NEXT; 21 | } 22 | 23 | /// 24 | /// Logs an occurance of an invalid tag type error, and advances to the next event in the event chain. 25 | /// 26 | /// Data about the NBT node being verified. 27 | /// A indicating whether event processing should pass, fail, or advance. 28 | public static TagEventCode InvalidTagTypeHandler (TagEventArgs e) 29 | { 30 | Console.WriteLine("Invalid Tag Type Error: '{0}' has type '{1}', expected '{2}'", e.TagName, e.Tag.GetTagType(), e.Schema.ToString()); 31 | 32 | return TagEventCode.NEXT; 33 | } 34 | 35 | /// 36 | /// Logs an occurance of an invalid tag value error, and advances to the next event in the event chain. 37 | /// 38 | /// Data about the NBT node being verified. 39 | /// A indicating whether event processing should pass, fail, or advance. 40 | public static TagEventCode InvalidTagValueHandler (TagEventArgs e) 41 | { 42 | Console.WriteLine("Invalid Tag Value Error: '{0}' of type '{1}' is set to invalid value '{2}'", e.TagName, e.Tag.GetTagType(), e.Tag.ToString()); 43 | 44 | return TagEventCode.NEXT; 45 | } 46 | } 47 | } -------------------------------------------------------------------------------- /SubstrateCS/Source/Orientation.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Substrate 4 | { 5 | public class Orientation 6 | { 7 | public double Pitch { get; set; } 8 | public double Yaw { get; set; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /SubstrateCS/Source/PlayerIOException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Substrate 5 | { 6 | /// 7 | /// The exception that is thrown when IO errors occur during high-level player management operations. 8 | /// 9 | [Serializable] 10 | public class PlayerIOException : SubstrateException 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public PlayerIOException () 16 | : base() 17 | { } 18 | 19 | /// 20 | /// Initializes a new instance of the class with a custom error message. 21 | /// 22 | /// A custom error message. 23 | public PlayerIOException (string message) 24 | : base(message) 25 | { } 26 | 27 | /// 28 | /// Initializes a new instance of the class with a custom error message and a reference to 29 | /// an InnerException representing the original cause of the exception. 30 | /// 31 | /// A custom error message. 32 | /// A reference to the original exception that caused the error. 33 | public PlayerIOException (string message, Exception innerException) 34 | : base(message, innerException) 35 | { } 36 | 37 | /// 38 | /// Initializes a new instance of the class with serialized data. 39 | /// 40 | /// The object that holds the serialized object data. 41 | /// The contextual information about the source or destination. 42 | protected PlayerIOException (SerializationInfo info, StreamingContext context) 43 | : base(info, context) 44 | { } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SubstrateCS/Source/SubstrateException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Runtime.Serialization; 3 | 4 | namespace Substrate 5 | { 6 | /// 7 | /// A base class for all Substrate-related exception classes. 8 | /// 9 | [Serializable] 10 | public class SubstrateException : Exception 11 | { 12 | /// 13 | /// Initializes a new instance of the class. 14 | /// 15 | public SubstrateException () 16 | : base() 17 | { } 18 | 19 | /// 20 | /// Initializes a new instance of the class with a custom error message. 21 | /// 22 | /// A custom error message. 23 | public SubstrateException (string message) 24 | : base(message) 25 | { } 26 | 27 | /// 28 | /// Initializes a new instance of the class with a custom error message and a reference to 29 | /// an InnerException representing the original cause of the exception. 30 | /// 31 | /// A custom error message. 32 | /// A reference to the original exception that caused the error. 33 | public SubstrateException (string message, Exception innerException) 34 | : base(message, innerException) 35 | { } 36 | 37 | /// 38 | /// Initializes a new instance of the class with serialized data. 39 | /// 40 | /// The object that holds the serialized object data. 41 | /// The contextual information about the source or destination. 42 | protected SubstrateException (SerializationInfo info, StreamingContext context) 43 | : base(info, context) 44 | { } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /SubstrateCS/Source/TileEntities/TileEntityControl.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.TileEntities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class TileEntityControl : TileEntity 10 | { 11 | public static readonly SchemaNodeCompound ControlSchema = TileEntity.Schema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | new SchemaNodeScaler("Command", TagType.TAG_STRING), 15 | }); 16 | 17 | public static string TypeId 18 | { 19 | get { return "Control"; } 20 | } 21 | 22 | private string _command; 23 | 24 | public string Command 25 | { 26 | get { return _command; } 27 | set { _command = value; } 28 | } 29 | 30 | protected TileEntityControl (string id) 31 | : base(id) 32 | { 33 | } 34 | 35 | public TileEntityControl () 36 | : this(TypeId) 37 | { 38 | } 39 | 40 | public TileEntityControl (TileEntity te) 41 | : base(te) 42 | { 43 | TileEntityControl tes = te as TileEntityControl; 44 | if (tes != null) { 45 | _command = tes._command; 46 | } 47 | } 48 | 49 | 50 | #region ICopyable Members 51 | 52 | public override TileEntity Copy () 53 | { 54 | return new TileEntityControl(this); 55 | } 56 | 57 | #endregion 58 | 59 | 60 | #region INBTObject Members 61 | 62 | public override TileEntity LoadTree (TagNode tree) 63 | { 64 | TagNodeCompound ctree = tree as TagNodeCompound; 65 | if (ctree == null || base.LoadTree(tree) == null) { 66 | return null; 67 | } 68 | 69 | _command = ctree["Command"].ToTagString(); 70 | 71 | return this; 72 | } 73 | 74 | public override TagNode BuildTree () 75 | { 76 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 77 | tree["Command"] = new TagNodeString(_command); 78 | 79 | return tree; 80 | } 81 | 82 | public override bool ValidateTree (TagNode tree) 83 | { 84 | return new NbtVerifier(tree, ControlSchema).Verify(); 85 | } 86 | 87 | #endregion 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SubstrateCS/Source/TileEntities/TileEntityEnchantmentTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.TileEntities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class TileEntityEnchantmentTable : TileEntity 10 | { 11 | public static readonly SchemaNodeCompound EnchantTableSchema = TileEntity.Schema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static string TypeId 17 | { 18 | get { return "EnchantTable"; } 19 | } 20 | 21 | protected TileEntityEnchantmentTable (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public TileEntityEnchantmentTable () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public TileEntityEnchantmentTable (TileEntity te) 32 | : base(te) 33 | { 34 | } 35 | 36 | 37 | #region ICopyable Members 38 | 39 | public override TileEntity Copy () 40 | { 41 | return new TileEntityEnchantmentTable(this); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region INBTObject Members 48 | 49 | public override TileEntity LoadTree (TagNode tree) 50 | { 51 | TagNodeCompound ctree = tree as TagNodeCompound; 52 | if (ctree == null || base.LoadTree(tree) == null) { 53 | return null; 54 | } 55 | 56 | return this; 57 | } 58 | 59 | public override TagNode BuildTree () 60 | { 61 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 62 | 63 | return tree; 64 | } 65 | 66 | public override bool ValidateTree (TagNode tree) 67 | { 68 | return new NbtVerifier(tree, EnchantTableSchema).Verify(); 69 | } 70 | 71 | #endregion 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SubstrateCS/Source/TileEntities/TileEntityEndPortal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.TileEntities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class TileEntityEndPortal : TileEntity 10 | { 11 | public static readonly SchemaNodeCompound EndPortalSchema = TileEntity.Schema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | }); 15 | 16 | public static string TypeId 17 | { 18 | get { return "Airportal"; } 19 | } 20 | 21 | protected TileEntityEndPortal (string id) 22 | : base(id) 23 | { 24 | } 25 | 26 | public TileEntityEndPortal () 27 | : this(TypeId) 28 | { 29 | } 30 | 31 | public TileEntityEndPortal (TileEntity te) 32 | : base(te) 33 | { 34 | } 35 | 36 | 37 | #region ICopyable Members 38 | 39 | public override TileEntity Copy () 40 | { 41 | return new TileEntityEndPortal(this); 42 | } 43 | 44 | #endregion 45 | 46 | 47 | #region INBTObject Members 48 | 49 | public override TileEntity LoadTree (TagNode tree) 50 | { 51 | TagNodeCompound ctree = tree as TagNodeCompound; 52 | if (ctree == null || base.LoadTree(tree) == null) { 53 | return null; 54 | } 55 | 56 | return this; 57 | } 58 | 59 | public override TagNode BuildTree () 60 | { 61 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 62 | 63 | return tree; 64 | } 65 | 66 | public override bool ValidateTree (TagNode tree) 67 | { 68 | return new NbtVerifier(tree, EndPortalSchema).Verify(); 69 | } 70 | 71 | #endregion 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /SubstrateCS/Source/TileEntities/TileEntityMusic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace Substrate.TileEntities 6 | { 7 | using Substrate.Nbt; 8 | 9 | public class TileEntityMusic : TileEntity 10 | { 11 | public static readonly SchemaNodeCompound MusicSchema = TileEntity.Schema.MergeInto(new SchemaNodeCompound("") 12 | { 13 | new SchemaNodeString("id", TypeId), 14 | new SchemaNodeScaler("note", TagType.TAG_BYTE), 15 | }); 16 | 17 | public static string TypeId 18 | { 19 | get { return "Music"; } 20 | } 21 | 22 | private byte _note; 23 | 24 | public int Note 25 | { 26 | get { return _note; } 27 | set { _note = (byte)value; } 28 | } 29 | 30 | protected TileEntityMusic (string id) 31 | : base(id) 32 | { 33 | } 34 | 35 | public TileEntityMusic () 36 | : this(TypeId) 37 | { 38 | } 39 | 40 | public TileEntityMusic (TileEntity te) 41 | : base(te) 42 | { 43 | TileEntityMusic tes = te as TileEntityMusic; 44 | if (tes != null) { 45 | _note = tes._note; 46 | } 47 | } 48 | 49 | 50 | #region ICopyable Members 51 | 52 | public override TileEntity Copy () 53 | { 54 | return new TileEntityMusic(this); 55 | } 56 | 57 | #endregion 58 | 59 | 60 | #region INBTObject Members 61 | 62 | public override TileEntity LoadTree (TagNode tree) 63 | { 64 | TagNodeCompound ctree = tree as TagNodeCompound; 65 | if (ctree == null || base.LoadTree(tree) == null) { 66 | return null; 67 | } 68 | 69 | _note = ctree["note"].ToTagByte(); 70 | 71 | return this; 72 | } 73 | 74 | public override TagNode BuildTree () 75 | { 76 | TagNodeCompound tree = base.BuildTree() as TagNodeCompound; 77 | tree["note"] = new TagNodeByte(_note); 78 | 79 | return tree; 80 | } 81 | 82 | public override bool ValidateTree (TagNode tree) 83 | { 84 | return new NbtVerifier(tree, MusicSchema).Verify(); 85 | } 86 | 87 | #endregion 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /SubstrateCS/Source/Vector.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace Substrate 4 | { 5 | public class Vector3 6 | { 7 | public double X { get; set; } 8 | public double Y { get; set; } 9 | public double Z { get; set; } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /SubstrateCS/Source/World.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | using Substrate.Core; 6 | using Substrate.Nbt; 7 | 8 | namespace Substrate 9 | { 10 | /// 11 | /// A collection of constants to specify different Minecraft world dimensions. 12 | /// 13 | public static class Dimension 14 | { 15 | /// 16 | /// Specifies the Nether dimension. 17 | /// 18 | public const int NETHER = -1; 19 | 20 | /// 21 | /// Specifies the default overworld. 22 | /// 23 | public const int DEFAULT = 0; 24 | 25 | /// 26 | /// Specifies the Enderman dimension, The End. 27 | /// 28 | public const int THE_END = 1; 29 | } 30 | 31 | public class DimensionNotFoundException : Exception { } 32 | } 33 | -------------------------------------------------------------------------------- /SubstrateCS/Substrate.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.25123.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Substrate (NET2)", "Substrate (NET2).csproj", "{AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Substrate (NET4)", "Substrate (NET4).csproj", "{7264A1C4-AB4A-4437-B252-7379B98B5509}" 9 | EndProject 10 | Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3E89D2F4-E9AF-4DBC-AB0B-8BED3C607012}" 11 | EndProject 12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Substrate.Tests", "..\Substrate.Tests\Substrate.Tests.csproj", "{5D875E2D-AD97-43DB-9180-DBA3F26DC569}" 13 | EndProject 14 | Global 15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 16 | Debug|Any CPU = Debug|Any CPU 17 | Release|Any CPU = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 20 | {AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {AFE30E14-3F2F-4461-9F7D-147AB4DCA4C3}.Release|Any CPU.Build.0 = Release|Any CPU 24 | {7264A1C4-AB4A-4437-B252-7379B98B5509}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 25 | {7264A1C4-AB4A-4437-B252-7379B98B5509}.Debug|Any CPU.Build.0 = Debug|Any CPU 26 | {7264A1C4-AB4A-4437-B252-7379B98B5509}.Release|Any CPU.ActiveCfg = Release|Any CPU 27 | {7264A1C4-AB4A-4437-B252-7379B98B5509}.Release|Any CPU.Build.0 = Release|Any CPU 28 | {5D875E2D-AD97-43DB-9180-DBA3F26DC569}.Debug|Any CPU.ActiveCfg = net40-client-Debug|Any CPU 29 | {5D875E2D-AD97-43DB-9180-DBA3F26DC569}.Debug|Any CPU.Build.0 = net40-client-Debug|Any CPU 30 | {5D875E2D-AD97-43DB-9180-DBA3F26DC569}.Release|Any CPU.ActiveCfg = net40-client-Release|Any CPU 31 | {5D875E2D-AD97-43DB-9180-DBA3F26DC569}.Release|Any CPU.Build.0 = net40-client-Release|Any CPU 32 | EndGlobalSection 33 | GlobalSection(SolutionProperties) = preSolution 34 | HideSolutionNode = FALSE 35 | EndGlobalSection 36 | EndGlobal 37 | -------------------------------------------------------------------------------- /SubstrateCS/Vendor/DotNetZip/Zlib/LICENSE.txt: -------------------------------------------------------------------------------- 1 | JZlib 0.0.* were released under the GNU LGPL license. Later, we have switched 2 | over to a BSD-style license. 3 | 4 | ------------------------------------------------------------------------------ 5 | Copyright (c) 2000,2001,2002,2003 ymnk, JCraft,Inc. All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in 15 | the documentation and/or other materials provided with the distribution. 16 | 17 | 3. The names of the authors may not be used to endorse or promote products 18 | derived from this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, 21 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 22 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT, 23 | INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, 24 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 25 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, 26 | OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 27 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 28 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 29 | EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/BlockReplace/Module1.vb: -------------------------------------------------------------------------------- 1 | Imports Substrate 2 | 3 | ' This example replaces all instances of one block ID with another in a world. 4 | ' Substrate will handle all of the lower-level headaches that can pop up, such 5 | ' as maintaining correct lighting or replacing TileEntity records for blocks 6 | ' that need them. 7 | 8 | ' For a more advanced Block Replace example, see replace.cs in NBToolkit. 9 | 10 | Module Module1 11 | 12 | Sub Main(args As String()) 13 | If args.Length <> 3 Then 14 | Console.WriteLine("Usage: BlockReplace ") 15 | Return 16 | End If 17 | 18 | Dim dest As String = args(0) 19 | Dim before As Integer = Convert.ToInt32(args(1)) 20 | Dim after As Integer = Convert.ToInt32(args(2)) 21 | 22 | ' Open our world 23 | Dim world As BetaWorld = BetaWorld.Open(dest) 24 | 25 | ' The chunk manager is more efficient than the block manager for 26 | ' this purpose, since we'll inspect every block 27 | Dim cm As BetaChunkManager = world.GetChunkManager() 28 | 29 | For Each chunk As ChunkRef In cm 30 | ' You could hardcode your dimensions, but maybe some day they 31 | ' won't always be 16. Also the CLR is a bit stupid and has 32 | ' trouble optimizing repeated calls to Chunk.Blocks.xx, so we 33 | ' cache them in locals 34 | Dim xdim As Integer = chunk.Blocks.XDim 35 | Dim ydim As Integer = chunk.Blocks.YDim 36 | Dim zdim As Integer = chunk.Blocks.ZDim 37 | 38 | chunk.Blocks.AutoFluid = True 39 | 40 | ' x, z, y is the most efficient order to scan blocks (not that 41 | ' you should care about internal detail) 42 | For x As Integer = 0 To xdim - 1 43 | For z As Integer = 0 To zdim - 1 44 | For y As Integer = 0 To ydim - 1 45 | 46 | ' Replace the block with after if it matches before 47 | If chunk.Blocks.GetID(x, y, z) = before Then 48 | chunk.Blocks.SetData(x, y, z, 0) 49 | chunk.Blocks.SetID(x, y, z, after) 50 | End If 51 | Next 52 | Next 53 | Next 54 | 55 | ' Save the chunk 56 | cm.Save() 57 | Next 58 | End Sub 59 | 60 | End Module 61 | 62 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/BlockReplace/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.225 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/BlockReplace/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/BlockReplace/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/BlockReplace/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Convert/Module1.vb: -------------------------------------------------------------------------------- 1 | Imports Substrate 2 | Imports Substrate.Core 3 | Imports Substrate.Nbt 4 | 5 | ' This example will convert worlds between alpha and beta format. 6 | ' This will convert chunks to and from region format, and copy level.dat 7 | ' Other data, like players and other dims, will not be handled. 8 | 9 | Module Module1 10 | 11 | Sub Main(args As String()) 12 | If args.Length <> 3 Then 13 | Console.WriteLine("Usage: Convert ") 14 | Return 15 | End If 16 | 17 | Dim src As String = args(0) 18 | Dim dst As String = args(1) 19 | Dim srctype As String = args(2) 20 | 21 | ' Open source and destrination worlds depending on conversion type 22 | Dim srcWorld As NbtWorld 23 | Dim dstWorld As NbtWorld 24 | If srctype = "a" Then 25 | srcWorld = AlphaWorld.Open(src) 26 | dstWorld = BetaWorld.Create(dst) 27 | Else 28 | srcWorld = BetaWorld.Open(src) 29 | dstWorld = AlphaWorld.Create(dst) 30 | End If 31 | 32 | ' Grab chunk managers to copy chunks 33 | Dim cmsrc As IChunkManager = srcWorld.GetChunkManager() 34 | Dim cmdst As IChunkManager = dstWorld.GetChunkManager() 35 | 36 | ' Copy each chunk from source to dest 37 | For Each chunk As ChunkRef In cmsrc 38 | cmdst.SetChunk(chunk.X, chunk.Z, chunk.GetChunkRef()) 39 | Next 40 | 41 | ' Copy level data from source to dest 42 | dstWorld.Level.LoadTreeSafe(srcWorld.Level.BuildTree()) 43 | 44 | ' If we're creating an alpha world, get rid of the version field 45 | If srctype = "b" Then 46 | dstWorld.Level.Version = 0 47 | End If 48 | 49 | ' Save level.dat 50 | dstWorld.Level.Save() 51 | End Sub 52 | 53 | End Module 54 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Convert/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.225 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Convert/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Convert/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Convert/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/FlatMap/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.225 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/FlatMap/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/FlatMap/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/FlatMap/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/GiveItem/Module1.vb: -------------------------------------------------------------------------------- 1 | Imports Substrate 2 | 3 | ' This example will insert x amount of an item into a player's 4 | ' inventory in an SMP server (where there is a player directory) 5 | 6 | Module Module1 7 | 8 | Sub Main(args As String()) 9 | If args.Length <> 4 Then 10 | Console.WriteLine("Usage: GiveItem ") 11 | Return 12 | End If 13 | 14 | Dim dest As String = args(0) 15 | Dim player As String = args(1) 16 | Dim itemid As Integer = Convert.ToInt32(args(2)) 17 | Dim count As Integer = Convert.ToInt32(args(3)) 18 | 19 | ' Open the world and grab its player manager 20 | Dim world As BetaWorld = BetaWorld.Open(dest) 21 | Dim pm As PlayerManager = world.GetPlayerManager() 22 | 23 | ' Check that the named player exists 24 | If Not pm.PlayerExists(player) Then 25 | Console.WriteLine("No such player {0}!", player) 26 | Return 27 | End If 28 | 29 | ' Get player (returned object is independent of the playermanager) 30 | Dim p As Player = pm.GetPlayer(player) 31 | 32 | ' Find first slot to place item 33 | For i As Integer = 0 To p.Items.Capacity - 1 34 | If Not p.Items.ItemExists(i) Then 35 | ' Create the item and set its stack count 36 | Dim item As New Item(itemid) 37 | item.Count = count 38 | p.Items(i) = item 39 | 40 | ' Don't keep adding items 41 | Exit For 42 | End If 43 | Next 44 | 45 | ' Save the player 46 | pm.SetPlayer(player, p) 47 | End Sub 48 | 49 | End Module 50 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/GiveItem/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.225 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/GiveItem/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/GiveItem/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/GiveItem/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/GoodyChest/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.225 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/GoodyChest/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/GoodyChest/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/GoodyChest/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Maze/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.225 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Maze/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Maze/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Maze/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/MoveSpawn/Module1.vb: -------------------------------------------------------------------------------- 1 | Imports Substrate 2 | 3 | ' MoveSpawn changes the location of the world spawn location 4 | ' (which is separate from individual player spawn locations) 5 | 6 | Module Module1 7 | 8 | Sub Main(args As String()) 9 | If args.Length <> 4 Then 10 | Console.WriteLine("Usage: MoveSpawn ") 11 | Return 12 | End If 13 | 14 | Dim dest As String = args(0) 15 | Dim x As Integer = Convert.ToInt32(args(1)) 16 | Dim y As Integer = Convert.ToInt32(args(2)) 17 | Dim z As Integer = Convert.ToInt32(args(3)) 18 | 19 | ' Open our world 20 | Dim world As BetaWorld = BetaWorld.Open(dest) 21 | 22 | ' Set the level's spawn 23 | ' Note: Players do not have separate spawns by default 24 | ' If you wanted to change a player's spawn, you must set all 25 | ' 3 coordinates for it to stick. It will not take the level's defaults. 26 | world.Level.Spawn = New SpawnPoint(x, y, z) 27 | 28 | ' Save the changes 29 | world.Save() 30 | End Sub 31 | 32 | End Module 33 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/MoveSpawn/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.225 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/MoveSpawn/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/MoveSpawn/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/MoveSpawn/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/PurgeEntities/Module1.vb: -------------------------------------------------------------------------------- 1 | Imports System.Collections.Generic 2 | Imports Substrate 3 | 4 | ' This example is a tool to delete all entities of a given type (e.g., "pig") 5 | ' on a map. It optionally can be restricted to boxed region in block coords. 6 | ' Only 10% of the effort is actually spend purging anything. 7 | 8 | Module Module1 9 | 10 | Sub Main(args As String()) 11 | ' Process arguments 12 | If args.Length <> 2 AndAlso args.Length <> 6 Then 13 | Console.WriteLine("Usage: PurgeEntities [ ]") 14 | Return 15 | End If 16 | Dim dest As String = args(0) 17 | Dim eid As String = args(1) 18 | 19 | ' Our initial bounding box is "infinite" 20 | Dim x1 As Integer = BlockManager.MIN_X 21 | Dim x2 As Integer = BlockManager.MAX_X 22 | Dim z1 As Integer = BlockManager.MIN_Z 23 | Dim z2 As Integer = BlockManager.MAX_Z 24 | 25 | ' If we have all coordinate parameters, set the bounding box 26 | If args.Length = 6 Then 27 | x1 = Convert.ToInt32(args(2)) 28 | z1 = Convert.ToInt32(args(3)) 29 | x2 = Convert.ToInt32(args(4)) 30 | z2 = Convert.ToInt32(args(5)) 31 | End If 32 | 33 | ' Load world 34 | Dim world As BetaWorld = BetaWorld.Open(dest) 35 | Dim cm As BetaChunkManager = world.GetChunkManager() 36 | 37 | ' Remove entities 38 | For Each chunk As ChunkRef In cm 39 | ' Skip chunks that don't cover our selected area 40 | If ((chunk.X + 1) * chunk.Blocks.XDim < x1) OrElse (chunk.X * chunk.Blocks.XDim >= x2) OrElse ((chunk.Z + 1) * chunk.Blocks.ZDim < z1) OrElse (chunk.Z * chunk.Blocks.ZDim >= z2) Then 41 | Continue For 42 | End If 43 | 44 | ' Delete the specified entities 45 | chunk.Entities.RemoveAll(eid) 46 | cm.Save() 47 | Next 48 | End Sub 49 | 50 | End Module 51 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/PurgeEntities/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.225 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/PurgeEntities/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/PurgeEntities/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/PurgeEntities/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Relight/Module1.vb: -------------------------------------------------------------------------------- 1 | Imports Substrate 2 | Imports Substrate.Core 3 | 4 | ' This example will reset and rebuild the lighting (heightmap, block light, 5 | ' skylight) for all chunks in a map. 6 | 7 | ' Note: If it looks silly to reset the lighting, loading and saving 8 | ' all the chunks, just to load and save them again later: it's not. 9 | ' If the world lighting is not correct, it must be completely reset 10 | ' before rebuilding the light in any chunks. That's just how the 11 | ' algorithms work, in order to limit the number of chunks that must 12 | ' be loaded at any given time. 13 | 14 | Module Module1 15 | 16 | Sub Main(args As String()) 17 | If args.Length < 1 Then 18 | Console.WriteLine("You must specify a target directory") 19 | Return 20 | End If 21 | Dim dest As String = args(0) 22 | 23 | ' Opening an NbtWorld will try to autodetect if a world is Alpha-style or Beta-style 24 | Dim world As NbtWorld = NbtWorld.Open(dest) 25 | 26 | ' Grab a generic chunk manager reference 27 | Dim cm As IChunkManager = world.GetChunkManager() 28 | 29 | ' First blank out all of the lighting in all of the chunks 30 | For Each chunk As ChunkRef In cm 31 | chunk.Blocks.RebuildHeightMap() 32 | chunk.Blocks.ResetBlockLight() 33 | chunk.Blocks.ResetSkyLight() 34 | 35 | cm.Save() 36 | 37 | Console.WriteLine("Reset Chunk {0},{1}", chunk.X, chunk.Z) 38 | Next 39 | 40 | ' In a separate pass, reconstruct the light 41 | For Each chunk As ChunkRef In cm 42 | chunk.Blocks.RebuildBlockLight() 43 | chunk.Blocks.RebuildSkyLight() 44 | 45 | ' Save the chunk to disk so it doesn't hang around in RAM 46 | cm.Save() 47 | 48 | Console.WriteLine("Lit Chunk {0},{1}", chunk.X, chunk.Z) 49 | Next 50 | End Sub 51 | 52 | End Module 53 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Relight/My Project/Application.Designer.vb: -------------------------------------------------------------------------------- 1 | '------------------------------------------------------------------------------ 2 | ' 3 | ' This code was generated by a tool. 4 | ' Runtime Version:4.0.30319.225 5 | ' 6 | ' Changes to this file may cause incorrect behavior and will be lost if 7 | ' the code is regenerated. 8 | ' 9 | '------------------------------------------------------------------------------ 10 | 11 | Option Strict On 12 | Option Explicit On 13 | 14 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Relight/My Project/Application.myapp: -------------------------------------------------------------------------------- 1 |  2 | 3 | false 4 | false 5 | 0 6 | true 7 | 0 8 | 2 9 | true 10 | 11 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Relight/My Project/AssemblyInfo.vb: -------------------------------------------------------------------------------- 1 | Imports System 2 | Imports System.Reflection 3 | Imports System.Runtime.InteropServices 4 | 5 | ' General Information about an assembly is controlled through the following 6 | ' set of attributes. Change these attribute values to modify the information 7 | ' associated with an assembly. 8 | 9 | ' Review the values of the assembly attributes 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM 21 | 22 | 23 | ' Version information for an assembly consists of the following four values: 24 | ' 25 | ' Major Version 26 | ' Minor Version 27 | ' Build Number 28 | ' Revision 29 | ' 30 | ' You can specify all the values or you can default the Build and Revision Numbers 31 | ' by using the '*' as shown below: 32 | ' 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /SubstrateVBNET/Examples/Relight/My Project/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | --------------------------------------------------------------------------------