Search in sources :

Example 81 with ZenMethod

use of stanhebben.zenscript.annotations.ZenMethod in project MrCrayfishFurnitureMod by MrCrayfish.

the class MineBay method addTrade.

@ZenMethod
@ZenDoc("Add a trade.")
public static void addTrade(@Nonnull IItemStack item, @Nonnull IItemStack currency) {
    if (item == null)
        throw new IllegalArgumentException("item cannot be null");
    if (currency == null)
        throw new IllegalArgumentException("currency cannot be null");
    final RecipeData data = new RecipeData();
    // MineBay RecipeData uses setInput for the purchasable item
    data.setInput(CraftTweakerMC.getItemStack(item));
    // MineBar RecipeData uses setCurrency for the currency item and setPrice for the amount of that item
    data.setCurrency(CraftTweakerMC.getItemStack(currency.withAmount(1)));
    data.setPrice(currency.getAmount());
    CraftTweakerIntegration.defer("Add trade " + data + " to MineBay", () -> {
        if (data.getPrice() < 1 || data.getPrice() > 64) {
            CraftTweakerAPI.logError("MineBay: Invalid trade price. Must be from 1 to 64.");
            return;
        }
        Recipes.localMineBayRecipes.add(data);
        CraftTweakerAPI.logInfo("MineBay: Added trade " + data);
    });
}
Also used : RecipeData(com.mrcrayfish.furniture.api.RecipeData) ZenDoc(crafttweaker.annotations.ZenDoc) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 82 with ZenMethod

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

the class CokeOvenRecipeBuilder method buildAndRegister.

@ZenMethod
public void buildAndRegister() {
    ValidationResult<CokeOvenRecipe> result = build();
    if (result.getType() == EnumValidationResult.VALID) {
        CokeOvenRecipe recipe = result.getResult();
        RecipeMaps.COKE_OVEN_RECIPES.add(recipe);
    }
}
Also used : CokeOvenRecipe(gregtech.api.recipes.recipes.CokeOvenRecipe) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 83 with ZenMethod

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

the class PBFRecipeBuilder method buildAndRegister.

@ZenMethod
public void buildAndRegister() {
    ValidationResult<PrimitiveBlastFurnaceRecipe> result = build();
    if (result.getType() == EnumValidationResult.VALID) {
        PrimitiveBlastFurnaceRecipe recipe = result.getResult();
        RecipeMaps.PRIMITIVE_BLAST_FURNACE_RECIPES.add(recipe);
    }
}
Also used : PrimitiveBlastFurnaceRecipe(gregtech.api.recipes.recipes.PrimitiveBlastFurnaceRecipe) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 84 with ZenMethod

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

the class ShapeGenerator method generate.

@ZenMethod
@Method(modid = GTValues.MODID_CT)
public void generate(long randomSeed, IWorld world, IBlockPos centerPos, IBlockState blockState) {
    World mcWorld = CraftTweakerMC.getWorld(world);
    net.minecraft.block.state.IBlockState mcBlockState = CraftTweakerMC.getBlockState(blockState);
    BlockPos blockPos = CraftTweakerMC.getBlockPos(centerPos);
    generate(new Random(randomSeed), (x, y, z) -> mcWorld.setBlockState(blockPos, mcBlockState));
}
Also used : Random(java.util.Random) IBlockPos(crafttweaker.api.world.IBlockPos) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) IWorld(crafttweaker.api.world.IWorld) ZenMethod(stanhebben.zenscript.annotations.ZenMethod) Method(net.minecraftforge.fml.common.Optional.Method) ZenMethod(stanhebben.zenscript.annotations.ZenMethod)

Example 85 with ZenMethod

use of stanhebben.zenscript.annotations.ZenMethod in project BetterWithAddons by DaedalusGame.

the class SandNet method add.

@ZenMethod
public static void add(IItemStack[] outputs, @NotNull IIngredient input, int sand) {
    NetRecipe r = new NetRecipe(BlockNettedScreen.SifterType.SAND, InputHelper.toObject(input), sand, InputHelper.toStacks(outputs));
    MineTweakerAPI.apply(new Add("SandNet", SandNetRecipeCategory.UID, CraftingManagerSandNet.getInstance(), r));
}
Also used : NetRecipe(betterwithaddons.crafting.recipes.NetRecipe) 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