Search in sources :

Example 61 with ZenMethod

use of stanhebben.zenscript.annotations.ZenMethod in project GregTech by GregTechCEu.

the class MaterialPropertyExpansion method addFluid.

@ZenMethod
public static void addFluid(Material m, @Optional FluidType fluidType, @Optional boolean hasBlock) {
    if (checkFrozen("add a Fluid to a material"))
        return;
    FluidType type = validateFluidTypeNoPlasma(fluidType == null ? null : fluidType.getName());
    if (m.hasProperty(PropertyKey.FLUID)) {
        m.getProperty(PropertyKey.FLUID).setIsGas(type == FluidTypes.GAS);
        m.getProperty(PropertyKey.FLUID).setHasBlock(hasBlock);
    } else
        m.setProperty(PropertyKey.FLUID, new FluidProperty(type, hasBlock));
}
Also used : FluidType(gregtech.api.fluids.fluidType.FluidType) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 62 with ZenMethod

use of stanhebben.zenscript.annotations.ZenMethod in project GregTech by GregTechCEu.

the class MaterialPropertyExpansion method addFluid.

@ZenMethod
public static void addFluid(Material m, @Optional String fluidTypeName, @Optional boolean hasBlock) {
    if (checkFrozen("add a Fluid to a material"))
        return;
    FluidType type = validateFluidTypeNoPlasma(fluidTypeName);
    if (m.hasProperty(PropertyKey.FLUID)) {
        m.getProperty(PropertyKey.FLUID).setIsGas(type == FluidTypes.GAS);
        m.getProperty(PropertyKey.FLUID).setHasBlock(hasBlock);
    } else
        m.setProperty(PropertyKey.FLUID, new FluidProperty(type, hasBlock));
}
Also used : FluidType(gregtech.api.fluids.fluidType.FluidType) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 63 with ZenMethod

use of stanhebben.zenscript.annotations.ZenMethod in project gugu-utils by ParaParty.

the class RecipePrimerExt method addAspcetInput.

// ----------------------------------------------------------------------------------------------
// aspect
// ----------------------------------------------------------------------------------------------
@ZenMethod
public static RecipePrimer addAspcetInput(RecipePrimer primer, int amount, String aspectTag) {
    Aspect aspect = Aspect.getAspect(aspectTag);
    if (aspect == null) {
        GuGuUtils.logger.warn("Couldn't find aspect " + aspectTag);
    }
    primer.appendComponent(RequirementAspect.createInput(amount, aspect));
    return primer;
}
Also used : Aspect(thaumcraft.api.aspects.Aspect) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 64 with ZenMethod

use of stanhebben.zenscript.annotations.ZenMethod in project gugu-utils by ParaParty.

the class RecipePrimerExt method addAspcetOutput.

@ZenMethod
public static RecipePrimer addAspcetOutput(RecipePrimer primer, int amount, String aspectTag) {
    Aspect aspect = Aspect.getAspect(aspectTag);
    if (aspect == null) {
        GuGuUtils.logger.warn("Couldn't find aspect " + aspectTag);
    }
    primer.appendComponent(new RequirementAspectOutput(amount, aspect));
    return primer;
}
Also used : Aspect(thaumcraft.api.aspects.Aspect) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 65 with ZenMethod

use of stanhebben.zenscript.annotations.ZenMethod in project ExtendedCrafting by BlakeBr0.

the class TableCrafting method addShapedMirrored.

@ZenMethod
public static void addShapedMirrored(int tier, IItemStack output, IIngredient[][] ingredients) {
    if (tier > 4 || tier < 0) {
        CraftTweakerAPI.getLogger().logError("Unable to assign a tier to the Table Recipe for stack " + output.getDisplayName() + ". Tier cannot be greater than 4 or less than 0.");
        tier = 0;
    }
    int height = ingredients.length;
    int width = 0;
    for (IIngredient[] row : ingredients) {
        if (width < row.length) {
            width = row.length;
        }
    }
    NonNullList<Ingredient> input = NonNullList.withSize(height * width, Ingredient.EMPTY);
    Map<Integer, Function<ItemStack, ItemStack>> transformers = new HashMap<>();
    int i = 0;
    for (int a = 0; a < height; a++) {
        for (int b = 0; b < ingredients[a].length; b++) {
            IIngredient iing = ingredients[a][b];
            Ingredient ing = CraftingHelper.getIngredient(toObject(iing));
            if (ing == null) {
                ing = Ingredient.EMPTY;
            }
            i = a * width + b;
            input.set(i, ing);
            if (ing != Ingredient.EMPTY && iing.hasNewTransformers()) {
                transformers.put(i, stack -> {
                    IItemStack istack = iing.applyNewTransform(CraftTweakerMC.getIItemStack(stack));
                    ItemStack transformed = CraftTweakerMC.getItemStack(istack);
                    return transformed;
                });
            }
        }
    }
    CraftTweakerAPI.apply(new Add(new TableRecipeShaped(tier, toStack(output), width, height, input).setMirrored(true).withTransformers(transformers)));
}
Also used : TableRecipeShaped(com.blakebr0.extendedcrafting.crafting.table.TableRecipeShaped) IIngredient(crafttweaker.api.item.IIngredient) HashMap(java.util.HashMap) Function(java.util.function.Function) Ingredient(net.minecraft.item.crafting.Ingredient) IIngredient(crafttweaker.api.item.IIngredient) IItemStack(crafttweaker.api.item.IItemStack) ItemStack(net.minecraft.item.ItemStack) IItemStack(crafttweaker.api.item.IItemStack) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Aggregations

ZenMethod (stanhebben.zenscript.annotations.ZenMethod)147 ItemStack (net.minecraft.item.ItemStack)52 IItemStack (minetweaker.api.item.IItemStack)28 IItemStack (crafttweaker.api.item.IItemStack)23 EntityPlayer (net.minecraft.entity.player.EntityPlayer)16 FluidStack (net.minecraftforge.fluids.FluidStack)10 IDecayCapability (thebetweenlands.api.capability.IDecayCapability)8 PharmacologyEffect (minechem.potion.PharmacologyEffect)6 IIngredient (crafttweaker.api.item.IIngredient)5 RecipeData (com.mrcrayfish.furniture.api.RecipeData)4 IThirst (toughasnails.api.stat.capability.IThirst)4 NetRecipe (betterwithaddons.crafting.recipes.NetRecipe)3 TableRecipeShaped (com.blakebr0.extendedcrafting.crafting.table.TableRecipeShaped)3 ZenDoc (crafttweaker.annotations.ZenDoc)3 HashMap (java.util.HashMap)3 Function (java.util.function.Function)3 PotionChemical (minechem.potion.PotionChemical)3 MineTweakerMC.getItemStack (minetweaker.api.minecraft.MineTweakerMC.getItemStack)3 Ingredient (net.minecraft.item.crafting.Ingredient)3 CherryBoxRecipe (betterwithaddons.crafting.recipes.CherryBoxRecipe)2