Fixed BWM removal. Closes #542
This commit is contained in:
parent
7ff5ae09c4
commit
4f061aa2d1
1 changed files with 16 additions and 5 deletions
|
@ -2,9 +2,13 @@ package com.blamejared.compat.betterwithmods.util;
|
|||
|
||||
import betterwithmods.common.registry.blockmeta.managers.BlockMetaManager;
|
||||
import betterwithmods.common.registry.blockmeta.recipe.BlockMetaRecipe;
|
||||
import com.blamejared.mtlib.helpers.LogHelper;
|
||||
import com.blamejared.mtlib.utils.BaseUndoable;
|
||||
import crafttweaker.api.minecraft.CraftTweakerMC;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class BMRemove extends BaseUndoable {
|
||||
|
||||
private final BlockMetaManager recipes;
|
||||
|
@ -15,13 +19,20 @@ public class BMRemove extends BaseUndoable {
|
|||
this.recipes = recipes;
|
||||
this.input = input;
|
||||
}
|
||||
|
||||
protected String getRecipeInfo(BlockMetaRecipe recipe) {
|
||||
return recipe.getStack().getDisplayName();
|
||||
|
||||
@Override
|
||||
protected String getRecipeInfo() {
|
||||
return LogHelper.getStackDescription(input);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void apply() {
|
||||
recipes.removeRecipes(input);
|
||||
List<BlockMetaRecipe> removed = new ArrayList<>();
|
||||
for(BlockMetaRecipe o : (List<BlockMetaRecipe>) recipes.getRecipes()) {
|
||||
if(CraftTweakerMC.getIItemStack(input).matches(CraftTweakerMC.getIItemStack(o.getStack()))){
|
||||
removed.add(o);
|
||||
}
|
||||
}
|
||||
recipes.getRecipes().removeAll(removed);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue