Corrected Toast icons for fusion computer and centrifuge

Centrifuge one is a bit hacky (we add dummy classes), but better than putting an if into RebornRecipe and faster+safer than correcting the differences between centrifuge and industrial_centrifuge in the code.
This commit is contained in:
Ayutac 2022-02-11 21:40:39 +01:00
parent 3101b9a5b6
commit d200f931f3
4 changed files with 46 additions and 6 deletions

View file

@ -34,15 +34,14 @@ import net.minecraft.recipe.Recipe;
import net.minecraft.recipe.RecipeSerializer;
import net.minecraft.util.Identifier;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.registry.Registry;
import net.minecraft.world.World;
import reborncore.RebornCore;
import reborncore.api.recipe.IRecipeCrafterProvider;
import reborncore.common.crafting.ingredient.RebornIngredient;
import reborncore.common.util.DefaultedListCollector;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.*;
public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
private final RebornRecipeType<?> type;
@ -62,6 +61,16 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
this.time = time;
}
@Override
public ItemStack createIcon() {
Optional<Item> catalyst = Registry.ITEM.getOrEmpty(type.name());
if (catalyst.isPresent())
return new ItemStack(catalyst.get());
else
RebornCore.LOGGER.warn("Missing toast icon for {}!", type.name());
return Recipe.super.createIcon();
}
@Override
public Identifier getId() {
return name;
@ -166,7 +175,7 @@ public class RebornRecipe implements Recipe<Inventory>, CustomOutputRecipe {
// Done to try and stop the table from loading it
@Override
public boolean isIgnoredInRecipeBook() {
return true;
return false;
}
@Override