diff --git a/TrueCraft.API/Logic/IBlockProvider.cs b/TrueCraft.API/Logic/IBlockProvider.cs index 7a56cb7..e09db25 100644 --- a/TrueCraft.API/Logic/IBlockProvider.cs +++ b/TrueCraft.API/Logic/IBlockProvider.cs @@ -19,7 +19,7 @@ namespace TrueCraft.API.Logic string DisplayName { get; } BoundingBox? BoundingBox { get; } // NOTE: Will this eventually need to be metadata-aware? Tuple GetTextureMap(byte metadata); - void GenerateDropEntity(BlockDescriptor descriptor, IWorld world, IMultiplayerServer server); + void GenerateDropEntity(BlockDescriptor descriptor, IWorld world, IMultiplayerServer server, ItemStack heldItem); void BlockLeftClicked(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user); bool BlockRightClicked(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user); void BlockPlaced(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user); diff --git a/TrueCraft.Core/Logic/BlockProvider.cs b/TrueCraft.Core/Logic/BlockProvider.cs index aa7b707..772f767 100644 --- a/TrueCraft.Core/Logic/BlockProvider.cs +++ b/TrueCraft.Core/Logic/BlockProvider.cs @@ -17,6 +17,9 @@ namespace TrueCraft.Core.Logic /// public abstract class BlockProvider : IItemProvider, IBlockProvider { + public static IBlockRepository BlockRepository { get; set; } + public static IItemRepository ItemRepository { get; set; } + public virtual void BlockLeftClicked(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user) { // This space intentionally left blank @@ -34,18 +37,18 @@ namespace TrueCraft.Core.Logic public virtual void BlockMined(BlockDescriptor descriptor, BlockFace face, IWorld world, IRemoteClient user) { - GenerateDropEntity(descriptor, world, user.Server); + GenerateDropEntity(descriptor, world, user.Server, user.SelectedItem); world.SetBlockID(descriptor.Coordinates, 0); } - public void GenerateDropEntity(BlockDescriptor descriptor, IWorld world, IMultiplayerServer server) + public void GenerateDropEntity(BlockDescriptor descriptor, IWorld world, IMultiplayerServer server, ItemStack item) { var entityManager = server.GetEntityManagerForWorld(world); - var items = GetDrop(descriptor); - foreach (var item in items) + var items = GetDrop(descriptor, item); + foreach (var i in items) { - if (item.Empty) continue; - var entity = new ItemEntity(new Vector3(descriptor.Coordinates) + new Vector3(0.5), item); + if (i.Empty) continue; + var entity = new ItemEntity(new Vector3(descriptor.Coordinates) + new Vector3(0.5), i); entityManager.SpawnEntity(entity); } } @@ -66,7 +69,7 @@ namespace TrueCraft.Core.Logic { if (!IsSupported(descriptor, server, world)) { - GenerateDropEntity(descriptor, world, server); + GenerateDropEntity(descriptor, world, server, ItemStack.EmptyStack); world.SetBlockID(descriptor.Coordinates, 0); } } @@ -76,7 +79,7 @@ namespace TrueCraft.Core.Logic // This space intentionally left blank } - protected virtual ItemStack[] GetDrop(BlockDescriptor descriptor) // TODO: Include tools + protected virtual ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { short meta = 0; if (this is ICraftingRecipe) diff --git a/TrueCraft.Core/Logic/Blocks/AirBlock.cs b/TrueCraft.Core/Logic/Blocks/AirBlock.cs index 874f008..edfa5ed 100644 --- a/TrueCraft.Core/Logic/Blocks/AirBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/AirBlock.cs @@ -27,7 +27,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(0, 0); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new ItemStack[0]; } diff --git a/TrueCraft.Core/Logic/Blocks/BedBlock.cs b/TrueCraft.Core/Logic/Blocks/BedBlock.cs index b4ca601..4f74ac6 100644 --- a/TrueCraft.Core/Logic/Blocks/BedBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/BedBlock.cs @@ -44,7 +44,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(6, 8); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(BedItem.ItemID) }; } diff --git a/TrueCraft.Core/Logic/Blocks/ClayBlock.cs b/TrueCraft.Core/Logic/Blocks/ClayBlock.cs index 869a387..daf590d 100644 --- a/TrueCraft.Core/Logic/Blocks/ClayBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/ClayBlock.cs @@ -25,7 +25,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(8, 4); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(ClayItem.ItemID, 4) }; } diff --git a/TrueCraft.Core/Logic/Blocks/CoalOreBlock.cs b/TrueCraft.Core/Logic/Blocks/CoalOreBlock.cs index 7df3d36..a06d5b2 100644 --- a/TrueCraft.Core/Logic/Blocks/CoalOreBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/CoalOreBlock.cs @@ -24,7 +24,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(2, 2); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(CoalItem.ItemID, 1, descriptor.Metadata) }; } diff --git a/TrueCraft.Core/Logic/Blocks/CobwebBlock.cs b/TrueCraft.Core/Logic/Blocks/CobwebBlock.cs index 8b98918..3153c98 100644 --- a/TrueCraft.Core/Logic/Blocks/CobwebBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/CobwebBlock.cs @@ -28,9 +28,13 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(11, 0); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { - return new[] { new ItemStack(StringItem.ItemID, 1, descriptor.Metadata) }; + var provider = ItemRepository.GetItemProvider(item.ID); + if (provider is SwordItem) + return new[] { new ItemStack(StringItem.ItemID, 1, descriptor.Metadata) }; + else + return new ItemStack[0]; } } } \ No newline at end of file diff --git a/TrueCraft.Core/Logic/Blocks/CropsBlock.cs b/TrueCraft.Core/Logic/Blocks/CropsBlock.cs index 2ac2713..9571ee7 100644 --- a/TrueCraft.Core/Logic/Blocks/CropsBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/CropsBlock.cs @@ -31,7 +31,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(8, 5); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { if (descriptor.Metadata >= 7) return new[] { new ItemStack(WheatItem.ItemID), new ItemStack(SeedsItem.ItemID, (sbyte)MathHelper.Random.Next(3)) }; @@ -57,7 +57,7 @@ namespace TrueCraft.Core.Logic.Blocks { if (world.GetBlockID(descriptor.Coordinates + Coordinates3D.Down) != FarmlandBlock.BlockID) { - GenerateDropEntity(descriptor, world, server); + GenerateDropEntity(descriptor, world, server, ItemStack.EmptyStack); world.SetBlockID(descriptor.Coordinates, 0); } } diff --git a/TrueCraft.Core/Logic/Blocks/DiamondOreBlock.cs b/TrueCraft.Core/Logic/Blocks/DiamondOreBlock.cs index 8984885..f38af48 100644 --- a/TrueCraft.Core/Logic/Blocks/DiamondOreBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/DiamondOreBlock.cs @@ -24,7 +24,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(2, 3); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(DiamondItem.ItemID, 1, descriptor.Metadata) }; } diff --git a/TrueCraft.Core/Logic/Blocks/DoorBlock.cs b/TrueCraft.Core/Logic/Blocks/DoorBlock.cs index da625f6..8603696 100644 --- a/TrueCraft.Core/Logic/Blocks/DoorBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/DoorBlock.cs @@ -20,7 +20,7 @@ namespace TrueCraft.Core.Logic.Blocks world.SetBlockID(descriptor.Coordinates, 0); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(ItemID) }; } diff --git a/TrueCraft.Core/Logic/Blocks/FarmlandBlock.cs b/TrueCraft.Core/Logic/Blocks/FarmlandBlock.cs index d6d1a67..89eea44 100644 --- a/TrueCraft.Core/Logic/Blocks/FarmlandBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/FarmlandBlock.cs @@ -36,7 +36,7 @@ namespace TrueCraft.Core.Logic.Blocks public override string DisplayName { get { return "Farmland"; } } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(DirtBlock.BlockID) }; } diff --git a/TrueCraft.Core/Logic/Blocks/FluidBlock.cs b/TrueCraft.Core/Logic/Blocks/FluidBlock.cs index 0b37d5f..8b4f792 100644 --- a/TrueCraft.Core/Logic/Blocks/FluidBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/FluidBlock.cs @@ -26,7 +26,7 @@ namespace TrueCraft.Core.Logic.Blocks } } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new ItemStack[0]; } @@ -151,7 +151,7 @@ namespace TrueCraft.Core.Logic.Blocks { // For each block we can flow into, generate an item entity if appropriate var provider = world.BlockRepository.GetBlockProvider(world.GetBlockID(target.TargetBlock)); - provider.GenerateDropEntity(new BlockDescriptor { Coordinates = target.TargetBlock, ID = provider.ID }, world, server); + provider.GenerateDropEntity(new BlockDescriptor { Coordinates = target.TargetBlock, ID = provider.ID }, world, server, ItemStack.EmptyStack); // And overwrite the block with a new fluid block. world.SetBlockID(target.TargetBlock, FlowingID); world.SetMetadata(target.TargetBlock, target.Level); diff --git a/TrueCraft.Core/Logic/Blocks/GlassBlock.cs b/TrueCraft.Core/Logic/Blocks/GlassBlock.cs index 687ef75..3ded4e8 100644 --- a/TrueCraft.Core/Logic/Blocks/GlassBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/GlassBlock.cs @@ -27,7 +27,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(1, 3); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new ItemStack[0]; } diff --git a/TrueCraft.Core/Logic/Blocks/GlowstoneBlock.cs b/TrueCraft.Core/Logic/Blocks/GlowstoneBlock.cs index 14e9207..6bd5ee1 100644 --- a/TrueCraft.Core/Logic/Blocks/GlowstoneBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/GlowstoneBlock.cs @@ -26,7 +26,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(9, 6); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(GlowstoneDustItem.ItemID, (sbyte)new Random().Next(2, 4), descriptor.Metadata) }; } diff --git a/TrueCraft.Core/Logic/Blocks/GrassBlock.cs b/TrueCraft.Core/Logic/Blocks/GrassBlock.cs index ac82eb7..a1520a3 100644 --- a/TrueCraft.Core/Logic/Blocks/GrassBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/GrassBlock.cs @@ -24,7 +24,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(0, 0); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(DirtBlock.BlockID, 1) }; } diff --git a/TrueCraft.Core/Logic/Blocks/GravelBlock.cs b/TrueCraft.Core/Logic/Blocks/GravelBlock.cs index f84a0f3..32152a3 100644 --- a/TrueCraft.Core/Logic/Blocks/GravelBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/GravelBlock.cs @@ -28,7 +28,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(3, 1); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { //Gravel has a 10% chance of dropping flint. if (MathHelper.Random.Next(10) == 0) diff --git a/TrueCraft.Core/Logic/Blocks/LapisLazuliOreBlock.cs b/TrueCraft.Core/Logic/Blocks/LapisLazuliOreBlock.cs index b4f2451..e66bde0 100644 --- a/TrueCraft.Core/Logic/Blocks/LapisLazuliOreBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/LapisLazuliOreBlock.cs @@ -24,7 +24,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(0, 10); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(DyeItem.ItemID, (sbyte)new Random().Next(4, 8), (short)DyeItem.DyeType.LapisLazuli) }; } diff --git a/TrueCraft.Core/Logic/Blocks/LeavesBlock.cs b/TrueCraft.Core/Logic/Blocks/LeavesBlock.cs index 58b8014..f7bedaf 100644 --- a/TrueCraft.Core/Logic/Blocks/LeavesBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/LeavesBlock.cs @@ -2,6 +2,7 @@ using System; using TrueCraft.API.Logic; using TrueCraft.API; using TrueCraft.API.World; +using TrueCraft.Core.Logic.Items; namespace TrueCraft.Core.Logic.Blocks { @@ -28,12 +29,18 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(4, 3); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { - if (MathHelper.Random.Next(20) == 0) // 5% chance - return new[] { new ItemStack(SaplingBlock.BlockID, 1, descriptor.Metadata) }; + var provider = ItemRepository.GetItemProvider(item.ID); + if (provider is ShearsItem) + return base.GetDrop(descriptor, item); else - return new ItemStack[0]; + { + if (MathHelper.Random.Next(20) == 0) // 5% chance + return new[] { new ItemStack(SaplingBlock.BlockID, 1, descriptor.Metadata) }; + else + return new ItemStack[0]; + } } } } \ No newline at end of file diff --git a/TrueCraft.Core/Logic/Blocks/MonsterSpawnerBlock.cs b/TrueCraft.Core/Logic/Blocks/MonsterSpawnerBlock.cs index cf1906a..153fa34 100644 --- a/TrueCraft.Core/Logic/Blocks/MonsterSpawnerBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/MonsterSpawnerBlock.cs @@ -25,7 +25,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(1, 4); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new ItemStack[0]; } diff --git a/TrueCraft.Core/Logic/Blocks/RedstoneDustBlock.cs b/TrueCraft.Core/Logic/Blocks/RedstoneDustBlock.cs index dfe0308..b8e55b5 100644 --- a/TrueCraft.Core/Logic/Blocks/RedstoneDustBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/RedstoneDustBlock.cs @@ -26,7 +26,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(4, 10); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(RedstoneItem.ItemID, 1, descriptor.Metadata) }; } diff --git a/TrueCraft.Core/Logic/Blocks/RedstoneOreBlock.cs b/TrueCraft.Core/Logic/Blocks/RedstoneOreBlock.cs index 3acfdba..572206a 100644 --- a/TrueCraft.Core/Logic/Blocks/RedstoneOreBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/RedstoneOreBlock.cs @@ -24,7 +24,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(3, 3); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(RedstoneItem.ItemID, (sbyte)new Random().Next(4, 5), descriptor.Metadata) }; } diff --git a/TrueCraft.Core/Logic/Blocks/SnowBlock.cs b/TrueCraft.Core/Logic/Blocks/SnowBlock.cs index f82b7fd..6ef1c0c 100644 --- a/TrueCraft.Core/Logic/Blocks/SnowBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/SnowBlock.cs @@ -78,9 +78,13 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(2, 4); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { - return new[] { new ItemStack(SnowballItem.ItemID) }; + var provider = ItemRepository.GetItemProvider(item.ID); + if (provider is ShovelItem) + return new[] { new ItemStack(SnowballItem.ItemID) }; + else + return new ItemStack[0]; } } } diff --git a/TrueCraft.Core/Logic/Blocks/StoneBlock.cs b/TrueCraft.Core/Logic/Blocks/StoneBlock.cs index afc672e..2e03599 100644 --- a/TrueCraft.Core/Logic/Blocks/StoneBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/StoneBlock.cs @@ -1,6 +1,7 @@ using System; using TrueCraft.API.Logic; using TrueCraft.API; +using TrueCraft.Core.Logic.Items; namespace TrueCraft.Core.Logic.Blocks { @@ -23,9 +24,13 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(1, 0); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { - return new[] { new ItemStack(CobblestoneBlock.BlockID, 1, descriptor.Metadata) }; + var provider = ItemRepository.GetItemProvider(item.ID); + if (provider is PickaxeItem) + return new[] { new ItemStack(CobblestoneBlock.BlockID, 1, descriptor.Metadata) }; + else + return new ItemStack[0]; } } } \ No newline at end of file diff --git a/TrueCraft.Core/Logic/Blocks/SugarcaneBlock.cs b/TrueCraft.Core/Logic/Blocks/SugarcaneBlock.cs index 9a12ca8..c9721d9 100644 --- a/TrueCraft.Core/Logic/Blocks/SugarcaneBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/SugarcaneBlock.cs @@ -40,7 +40,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(9, 4); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(SugarCanesItem.ItemID) }; } @@ -80,7 +80,7 @@ namespace TrueCraft.Core.Logic.Blocks { // Destroy self world.SetBlockID(descriptor.Coordinates, 0); - GenerateDropEntity(descriptor, world, server); + GenerateDropEntity(descriptor, world, server, ItemStack.EmptyStack); } } diff --git a/TrueCraft.Core/Logic/Blocks/TallGrassBlock.cs b/TrueCraft.Core/Logic/Blocks/TallGrassBlock.cs index cd7d943..3597095 100644 --- a/TrueCraft.Core/Logic/Blocks/TallGrassBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/TallGrassBlock.cs @@ -35,7 +35,7 @@ namespace TrueCraft.Core.Logic.Blocks return new Tuple(7, 2); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(SeedsItem.ItemID, (sbyte)MathHelper.Random.Next(2)) }; } diff --git a/TrueCraft.Core/Logic/Blocks/TrapdoorBlock.cs b/TrueCraft.Core/Logic/Blocks/TrapdoorBlock.cs index e3fe4f1..c1e5da3 100644 --- a/TrueCraft.Core/Logic/Blocks/TrapdoorBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/TrapdoorBlock.cs @@ -85,7 +85,7 @@ namespace TrueCraft.Core.Logic.Blocks base.ItemUsedOnBlock(coordinates, item, face, world, user); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(ID) }; } diff --git a/TrueCraft.Core/Logic/Blocks/UprightSignBlock.cs b/TrueCraft.Core/Logic/Blocks/UprightSignBlock.cs index c2d6634..a5a1b9b 100644 --- a/TrueCraft.Core/Logic/Blocks/UprightSignBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/UprightSignBlock.cs @@ -41,7 +41,7 @@ namespace TrueCraft.Core.Logic.Blocks world.SetMetadata(descriptor.Coordinates, (byte)(rotation / 22.5)); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(SignItem.ItemID) }; } diff --git a/TrueCraft.Core/Logic/Blocks/WallSignBlock.cs b/TrueCraft.Core/Logic/Blocks/WallSignBlock.cs index 8ffddcb..65e6080 100644 --- a/TrueCraft.Core/Logic/Blocks/WallSignBlock.cs +++ b/TrueCraft.Core/Logic/Blocks/WallSignBlock.cs @@ -37,7 +37,7 @@ namespace TrueCraft.Core.Logic.Blocks world.SetMetadata(descriptor.Coordinates, (byte)MathHelper.DirectionByRotationFlat(user.Entity.Yaw, true)); } - protected override ItemStack[] GetDrop(BlockDescriptor descriptor) + protected override ItemStack[] GetDrop(BlockDescriptor descriptor, ItemStack item) { return new[] { new ItemStack(SignItem.ItemID) }; } diff --git a/TrueCraft/MultiplayerServer.cs b/TrueCraft/MultiplayerServer.cs index d7d01fa..5d9f80f 100644 --- a/TrueCraft/MultiplayerServer.cs +++ b/TrueCraft/MultiplayerServer.cs @@ -91,6 +91,8 @@ namespace TrueCraft var itemRepository = new ItemRepository(); itemRepository.DiscoverItemProviders(); ItemRepository = itemRepository; + BlockProvider.ItemRepository = ItemRepository; + BlockProvider.BlockRepository = BlockRepository; var craftingRepository = new CraftingRepository(); craftingRepository.DiscoverRecipes(); CraftingRepository = craftingRepository; diff --git a/TrueCraft/Program.cs b/TrueCraft/Program.cs index ae327f4..6772979 100644 --- a/TrueCraft/Program.cs +++ b/TrueCraft/Program.cs @@ -51,8 +51,7 @@ namespace TrueCraft } catch { - //world = new World("default", new StandardGenerator()); - world = new World("default", new FlatlandGenerator()); + world = new World("default", new StandardGenerator()); world.BlockRepository = Server.BlockRepository; world.Save("world"); Server.AddWorld(world);