Hi everyone!
Once me decided create own modpack with industriall mods, include ic2, for skyblock map. Next i wanted add custom cfg for mods. I started using craft tweaker+mod tweaker to do this. Also ic2 has craft tweaker support addon - "ic2 tweaker". After all this when i wanted add custom recipe for scrapbox from ic2 using ic2 tweaker+craft tweaker was get an unexpected result - next was get an unexpected result: the real item drop chance dont match cfg chance line, which was be it setted.
Testing item for this: bedrock, setted chance = 0.1F (weighted item) like diamond in the ic2
My .zs cfg line setted like in the crafttweaker documentation:
Scrap Box - CraftTweaker Documentation (blamejared.com)
original source code of ic2 tweaker (ScrapboxSupport)
package info.tritusk.modpack.crafttweaker.support.ic2;
import crafttweaker.IAction;
import crafttweaker.annotations.ModOnly;
import crafttweaker.annotations.ZenRegister;
import crafttweaker.api.item.IItemStack;
import crafttweaker.api.item.WeightedItemStack;
import crafttweaker.api.minecraft.CraftTweakerMC;
import ic2.api.recipe.Recipes;
import net.minecraft.item.ItemStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ModOnly("ic2")
@ZenClass("mods.ic2.ScrapBox")
@ZenRegister
public final class ScrapBoxSupport {
@ZenMethod
public static void addDrop(WeightedItemStack weightedItem) {
CraftTweakerActions.apply(new AddScrapBoxDropAction(weightedItem));
}
@ZenMethod
public static void addDrop(IItemStack item, float chance) {
CraftTweakerActions.apply(new AddScrapBoxDropAction(item, chance));
}
private static final class AddScrapBoxDropAction implements IAction {
private final float weight;
private final ItemStack item;
AddScrapBoxDropAction(WeightedItemStack weightedItem) {
this(weightedItem.getStack(), weightedItem.getChance());
}
AddScrapBoxDropAction(IItemStack item, float weight) {
this.item = CraftTweakerMC.getItemStack(item);
this.weight = weight;
}
public void apply() {
Recipes.scrapboxDrops.addDrop(this.item, this.weight);
}
public String describe() {
return null;
}
}
}
Display More
I rewrite code for this ScrapBoxSupport action.
package info.tritusk.modpack.crafttweaker.support.ic2;
import crafttweaker.IAction;
import crafttweaker.annotations.ModOnly;
import crafttweaker.annotations.ZenRegister;
import crafttweaker.api.item.IIngredient;
import crafttweaker.api.item.IItemStack;
import crafttweaker.api.minecraft.CraftTweakerMC;
import ic2.api.recipe.IRecipeInput;
import ic2.api.recipe.Recipes;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ModOnly("ic2")
@ZenClass("mods.ic2.ScrapBox")
@ZenRegister
public final class ScrapBoxSupport {
@ZenMethod
public static void addRecipe(IIngredient Input, IItemStack Item, float chance) {
CraftTweakerActions.apply(new AddScrapBoxDropAction(Input, Item, chance));
}
public static final class AddScrapBoxDropAction implements IAction {
public final ItemStack item;
public float iweight;
public final IRecipeInput scrapbox;
AddScrapBoxDropAction(IIngredient Input, IItemStack Item, float chance) {
this.scrapbox = IC2RecipeInputs.of(Input);
this.item = CraftTweakerMC.getItemStack(Item);
this.iweight = chance;
}
public void apply() {
NBTTagCompound nbtweight = new NBTTagCompound();
nbtweight.setFloat("weight", iweight);
Recipes.scrapboxDrops.addRecipe(scrapbox, nbtweight, false, item);
}
public String describe() {
return null;
}
}
}
Display More
At this .zs cfg line setted like now
So, also it worked, nice… But, the situation is not changed - wrong item drop chance from scrapboxes.
Guys, help me to find solution this issue.
Thanks in advance.