Commit ef992b48 authored by primetoxinz's avatar primetoxinz

Fix the fact that vanilla plank recipes were not being removed with HCLumber...

Fix the fact that vanilla plank recipes were not being removed with HCLumber when the axe recipe was moved to always be available so that bark is always craftable. Closes #1210
parent 3339191f
......@@ -15,9 +15,11 @@ import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import net.minecraftforge.registries.ForgeRegistry;
import java.io.File;
import java.io.FileWriter;
......@@ -74,6 +76,11 @@ public final class BWMRecipes {
REMOVE_RECIPE_BY_INPUT.add(Lists.newArrayList(inputs));
}
public static void removeRecipe(IRecipe recipe) {
ForgeRegistry<IRecipe> reg = (ForgeRegistry<IRecipe>) ForgeRegistries.RECIPES;
reg.remove(recipe.getRegistryName());
}
public static void removeRecipe(ItemStack output) {
REMOVE_RECIPE_BY_OUTPUT.add(output);
}
......
......@@ -67,7 +67,7 @@ public class CraftingRecipes extends Feature {
}
private boolean hasLog(IRecipe recipe, ItemStack log) {
public boolean hasLog(IRecipe recipe, ItemStack log) {
NonNullList<Ingredient> ingredients = recipe.getIngredients();
for (Ingredient ingredient : ingredients) {
if (ingredient.getMatchingStacks().length > 0) {
......
package betterwithmods.module.hardcore.crafting;
import betterwithmods.BWMod;
import betterwithmods.api.util.IWood;
import betterwithmods.common.BWMRecipes;
import betterwithmods.common.BWOreDictionary;
import betterwithmods.common.registry.BrokenToolRegistry;
import betterwithmods.common.registry.crafting.ChoppingRecipe;
import betterwithmods.module.Feature;
import betterwithmods.module.gameplay.CraftingRecipes;
import betterwithmods.util.player.PlayerHelper;
import com.google.common.collect.Lists;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
......@@ -49,6 +57,13 @@ public class HCLumber extends Feature {
BrokenToolRegistry.init();
}
@Override
public void postInit(FMLPostInitializationEvent event) {
for (IRecipe recipe : BWOreDictionary.logRecipes) {
BWMRecipes.removeRecipe(recipe);
}
}
@Override
public boolean requiresMinecraftRestartToEnable() {
return true;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment