use of crafttweaker.IAction in project Charset by CharsetMC.
the class MaterialRegistry method registerRelation.
@ZenMethod
public static boolean registerRelation(IItemStack from, String what, IItemStack to) {
ItemStack mcStackFrom = CraftTweakerMC.getItemStack(from);
ItemStack mcStackTo = CraftTweakerMC.getItemStack(to);
if (mcStackFrom.isEmpty() || mcStackTo.isEmpty()) {
return false;
}
CraftTweakerAPI.apply(new IAction() {
@Override
public void apply() {
ItemMaterialRegistry.INSTANCE.registerRelation(ItemMaterialRegistry.INSTANCE.getOrCreateMaterial(mcStackFrom), ItemMaterialRegistry.INSTANCE.getOrCreateMaterial(mcStackTo), what);
}
@Override
public String describe() {
return "Registering material relation (" + from + " --[" + what + "]-> " + to + ")";
}
});
return true;
}
use of crafttweaker.IAction in project Charset by CharsetMC.
the class MaterialRegistry method registerTypes.
@ZenMethod
public static boolean registerTypes(IItemStack stack, String... tags) {
ItemStack mcStack = CraftTweakerMC.getItemStack(stack);
if (mcStack.isEmpty()) {
return false;
}
CraftTweakerAPI.apply(new IAction() {
@Override
public void apply() {
ItemMaterial material = ItemMaterialRegistry.INSTANCE.getOrCreateMaterial(mcStack);
ItemMaterialRegistry.INSTANCE.registerTypes(material, tags);
}
@Override
public String describe() {
return "Registering stack " + stack + " as material with types " + JOINER.join(tags);
}
});
return true;
}
Aggregations