This commit is contained in:
Monty Marz 2021-04-20 02:45:33 +02:00
parent 86445af09c
commit abacdfc719
2 changed files with 13 additions and 13 deletions

View File

@ -993,9 +993,10 @@ impl Client {
recipe: &str,
craft_sprite: Option<(Vec3<i32>, SpriteKind)>,
) -> bool {
if self.can_craft_recipe(recipe).map_or(false, |cs| {
let can_craft = self.can_craft_recipe(recipe).map_or(false, |cs| {
cs.map_or(true, |cs| Some(cs) == craft_sprite.map(|(_, s)| s))
}) {
});
if can_craft {
self.send_msg(ClientGeneral::ControlEvent(ControlEvent::InventoryEvent(
InventoryEvent::CraftRecipe {
recipe: recipe.to_string(),

View File

@ -438,23 +438,22 @@ impl<'a> Widget for Crafting<'a> {
.unwrap_or(false)
})
});
let state =
if self
.client
let show_craft_sprite =
self.client
.available_recipes()
.get(name.as_str())
.map_or(false, |cs| {
cs.map_or(true, |cs| {
Some(cs) == self.show.craft_sprite.map(|(_, s)| s)
})
})
{
RecipeIngredientQuantity::All
} else if at_least_some_ingredients {
RecipeIngredientQuantity::Some
} else {
RecipeIngredientQuantity::None
};
});
let state = if show_craft_sprite {
RecipeIngredientQuantity::All
} else if at_least_some_ingredients {
RecipeIngredientQuantity::Some
} else {
RecipeIngredientQuantity::None
};
(name, recipe, state)
})
.collect();