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);
});
}
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);
}
}
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);
}
}
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));
}
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));
}
Aggregations