Ejemplo 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);
        }
Ejemplo n.º 2
0
 public Task <FurnaceFuel> FindFuel(Slot fuel)
 {
     return(Task.FromResult(_recipeMatcher.FindFuel(fuel)));
 }