Exemplo n.º 1
0
        public async Task TestFurnaceRecipeMatcher()
        {
            var loader = new FurnaceRecipeLoader();

            using (var sr = new StreamReader(File.OpenRead(Path.Combine(RootDir, "furnace.txt"))))
            {
                await loader.LoadRecipes(sr);
            }

            var matcher = new FurnaceRecipeMatcher(loader.Recipes, loader.Fuels);
            var recipe  = matcher.FindRecipe(
                new Slot {
                BlockId = (short)BlockStates.Wood().Id, ItemCount = 1
            });
            var fuel = matcher.FindFuel(
                new Slot {
                BlockId = (short)BlockStates.Wood().Id, ItemCount = 1
            });

            Assert.NotNull(recipe);
            Assert.Equal(ItemStates.Coal(CoalType.Charcoal), new ItemState {
                Id = (uint)recipe.Output.BlockId, MetaValue = (uint)recipe.Output.ItemDamage
            });
            Assert.Equal((short)BlockStates.Wood().Id, fuel.Slot.BlockId);
        }
Exemplo n.º 2
0
 public Task <FurnaceRecipe> FindRecipe(Slot input)
 {
     return(Task.FromResult(_recipeMatcher.FindRecipe(input)));
 }