From 2077ebf086543587c4fc7ca9b125809609f749b9 Mon Sep 17 00:00:00 2001 From: shedaniel Date: Fri, 3 Jan 2020 23:20:31 +0800 Subject: Compact the design and add cooking xp details --- .../rei/plugin/cooking/DefaultCookingDisplay.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingDisplay.java') diff --git a/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingDisplay.java b/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingDisplay.java index f1c33dd81..6c12064ec 100644 --- a/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingDisplay.java +++ b/src/main/java/me/shedaniel/rei/plugin/cooking/DefaultCookingDisplay.java @@ -27,7 +27,13 @@ import java.util.stream.Collectors; public abstract class DefaultCookingDisplay implements TransferRecipeDisplay { private AbstractCookingRecipe recipe; private List> input; + private static List fuel; private List output; + private float xp; + + static { + fuel = FurnaceBlockEntity.createFuelTimeMap().keySet().stream().map(Item::getStackForRender).map(EntryStack::create).map(e -> e.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(Formatting.YELLOW.toString() + I18n.translate("category.rei.smelting.fuel")))).collect(Collectors.toList()); + } public DefaultCookingDisplay(AbstractCookingRecipe recipe) { this.recipe = recipe; @@ -38,8 +44,9 @@ public abstract class DefaultCookingDisplay implements TransferRecipeDisplay { } return entries; }).collect(Collectors.toList()); - this.input.add(FurnaceBlockEntity.createFuelTimeMap().keySet().stream().map(Item::getStackForRender).map(EntryStack::create).map(e -> e.setting(EntryStack.Settings.TOOLTIP_APPEND_EXTRA, stack -> Collections.singletonList(Formatting.YELLOW.toString() + I18n.translate("category.rei.smelting.fuel")))).collect(Collectors.toList())); + this.input.add(fuel); this.output = Collections.singletonList(EntryStack.create(recipe.getOutput())); + xp = recipe.getExperience(); } @Override @@ -57,15 +64,15 @@ public abstract class DefaultCookingDisplay implements TransferRecipeDisplay { return output; } - public List getFuel() { - return input.get(1); - } - @Override public List> getRequiredEntries() { return input; } + public float getXp() { + return xp; + } + @Deprecated public Optional getOptionalRecipe() { return Optional.ofNullable(recipe); -- cgit