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:
@ -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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user