Made Straw totem use new Extended Recipe builder. Created ModRecipes and registering new TOTEM_RECIPE serializer. Removed old events from Registration and added RECIPE_SERIALIZERS. Created new TotemRecipe for totem items.

This commit is contained in:
2022-01-16 16:48:07 +00:00
parent 6e761cae67
commit 0ee99282e4
4 changed files with 67 additions and 7 deletions

View File

@ -0,0 +1,36 @@
package dev.micle.totemofreviving.item.crafting;
import dev.micle.totemofreviving.config.Config;
import dev.micle.totemofreviving.item.StrawTotemItem;
import dev.micle.totemofreviving.setup.ModRecipes;
import net.minecraft.inventory.CraftingInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.ShapedRecipe;
import net.minecraft.world.World;
public class TotemRecipe extends ExtendedShapedRecipe {
public TotemRecipe(ShapedRecipe recipe) {
super(recipe);
}
@Override
public IRecipeSerializer<?> getSerializer() {
return ModRecipes.TOTEM_RECIPE.get();
}
@Override
public boolean matches(CraftingInventory inventory, World world) {
if (!Config.Server.getStrawTotemConfig().getIsEnabled()) {
if (getResultItem().getItem() instanceof StrawTotemItem) {
return false;
}
}
return getBaseRecipe().matches(inventory, world);
}
@Override
public ItemStack assemble(CraftingInventory inventory) {
return getResultItem();
}
}