Skip to content

Releases: Traqueur-dev/RecipesAPI

3.1.1

31 Oct 16:10
a0c4bbc

Choose a tag to compare

What's Changed

Full Changelog: 3.1.0...3.1.1

3.1.0

24 Oct 08:32

Choose a tag to compare

Changelog - RecipesAPI v3.1.0

Major Features

  • Recipe Priority System: Added priority-based recipe registration to handle conflicting recipes
    • New optional priority field in YAML recipes (default: 0)
    • Higher priority recipes are registered first, taking precedence in Bukkit's recipe matching
    • Recipes automatically sorted by priority in RecipeLoader before registration
    • Programmatic support via RecipeBuilder.setPriority(int)
    • Solves issues with similar recipes (e.g., compressed items with overlapping patterns)
  • Enhanced Ingredient System: Redesigned ingredient type prefixes for clarity and flexibility
    • item:MATERIAL_NAME - Creates ItemStack from Material with metadata support (NEW)
    • base64:BASE64_STRING - Loads serialized ItemStack from Base64 (renamed from item:)
    • material:MATERIAL_NAME - Simple Material ingredient (unchanged)
    • tag:TAG_NAME - Minecraft tag support (unchanged)
    • Plugin hooks: itemsadder:, oraxen:, custom plugins (unchanged)
    • Better separation between simple materials and metadata-supporting ItemStacks
  • Strict Ingredient Matching: Added granular control over ingredient comparison
    • New strict: true flag in YAML ingredient definitions
    • Normal mode (default): Checks only metadata present in recipe ingredient (flexible)
    • Strict mode: Requires exact match using ItemStack.isSimilar() (precise)
    • Programmatic support via addIngredient(ItemStack, sign, boolean strict)
    • Essential for recipes with custom items that need exact metadata matching
  • Public Ingredient Parser API: Exposed ingredient parsing for external use
    • New Util.parseIngredient(String itemString, Character sign, boolean strict) method
    • Supports all ingredient formats: materials, items, base64, tags, plugin hooks
    • Overloaded methods for common use cases (with/without sign, with/without strict)
    • Enables dynamic recipe creation from configuration or external sources
    • Fully documented with examples in README

API Enhancements

  • ItemRecipe: Added priority field to recipe record
    • New parameter in constructor: ItemRecipe(..., int priority)
    • Getter method: priority()
  • RecipeConfiguration: Enhanced YAML recipe parsing
    • Reads optional priority field from YAML (default: 0)
    • Uses Util.parseIngredient() for cleaner ingredient parsing
    • Removed duplicate tag lookup logic (now in Util)
  • RecipeBuilder: Added priority support for programmatic recipes
    • New method: setPriority(int priority)
    • Fluent API: .setPriority(10).build()
  • RecipeLoader: Intelligent recipe ordering
    • Automatically sorts recipes by priority before registration
    • Higher priority (e.g., 10) registered before lower priority (e.g., 0)
    • Ensures correct recipe precedence without relying on file name order
  • Recipe Interface: Updated getItemRecipe() signature to include priority parameter

Breaking Changes

  • ItemRecipe Constructor: Added priority parameter as last argument
    • Old: ItemRecipe(name, group, category, type, result, amount, ingredients, pattern, cookingTime, experience)
    • New: ItemRecipe(name, group, category, type, result, amount, ingredients, pattern, cookingTime, experience, priority)
    • Migration: Add 0 as last parameter to existing constructor calls
  • Recipe.getItemRecipe(): Added priority parameter
    • Old: getItemRecipe(..., float experience)
    • New: getItemRecipe(..., float experience, int priority)
    • Affects custom Recipe interface implementations
  • Ingredient Type Prefix Change: item: prefix behavior changed
    • Old: item:BASE64_STRING loaded Base64 serialized items
    • New: item:MATERIAL_NAME creates ItemStack from Material
    • Migration: Replace item:BASE64 with base64:BASE64 in YAML files
    • Backward compatibility: Both item: and base64: prefixes work for Base64 in result items (deprecated)

Bug Fixes

  • Ingredient Parsing: Fixed split limit to prevent issues with colons in Base64 strings
    • Changed split(":") to split(":", 2) to only split on first colon

Improvements

  • Code Organization: Refactored ingredient parsing logic
    • Centralized parsing in Util.parseIngredient() from RecipeConfiguration
    • Removed code duplication between YAML loading and programmatic creation
    • Cleaner imports in RecipeConfiguration (removed unused ingredient classes)
  • Type Safety: Added utility class protection
    • Util constructor now throws UnsupportedOperationException to prevent instantiation
    • Added JavaDoc noting Util is a utility class
  • Tag Support: Made getTag() method static and private in Util
    • Improved encapsulation of tag lookup logic
    • Supports both block and item registries

Documentation

  • Comprehensive README Update: Major documentation overhaul
    • New section: "Recipe Priority System" with detailed explanation and examples
    • New section: "Parsing Ingredients Programmatically" for Util.parseIngredient()
    • New section: "Ingredient Matching Modes" explaining normal vs strict modes
    • Expanded "Ingredient Types in YAML" with all supported formats
    • Added priority field to recipe fields reference
    • Updated code examples with .setPriority() and strict mode
    • Real-world example: Compressed cobblestone recipe conflict resolution
    • Added method signatures and usage examples for all new APIs
  • Enhanced Examples: Improved code examples in README
    • Added recipe3strict example demonstrating strict mode
    • Priority usage in compressed item recipes
    • Ingredient parsing examples for all supported types
  • Features Section: Updated feature list
    • Added "Recipe Priority System" feature
    • Added "Strict Ingredient Matching" feature

Internal Improvements

  • Ingredient Type Handling: Clearer distinction between materials and ItemStacks
    • material: and simple names for Material-only ingredients
    • item: for ItemStacks that can have metadata
    • base64: explicitly for serialized items
  • RecipeLoader Behavior: Enhanced recipe loading workflow
    • Collects all recipes into a list first
    • Sorts by priority in descending order
    • Registers sorted recipes sequentially
    • Ensures deterministic recipe order regardless of file system

Migration Guide (v3.0.0 → v3.1.0):

  1. Update ItemRecipe constructor calls (if creating recipes programmatically):
    // Old (v3.0.0)
    new ItemRecipe(name, group, category, type, result, amount,
    ingredients, pattern, cookingTime, experience);

// New (v3.1.0)
new ItemRecipe(name, group, category, type, result, amount,
ingredients, pattern, cookingTime, experience, 0);
2. Update YAML ingredient Base64 references:

Old (v3.0.0)

ingredients:
- item: base64:YOUR_BASE64_HERE

New (v3.1.0) - recommended

ingredients:
- item: base64:YOUR_BASE64_HERE

Note: Both work, but base64: is clearer

  1. Add priority to conflicting recipes (optional but recommended):

More specific recipe - higher priority

type: CRAFTING_SHAPED
priority: 10
ingredients:
- item: item:CUSTOM_MATERIAL
strict: true

Generic recipe - lower priority

type: CRAFTING_SHAPED
priority: 0
ingredients:
- item: material:STONE
4. Use strict mode for custom items (recommended):
ingredients:
- item: item:YOUR_CUSTOM_ITEM
sign: 'C'
strict: true # Ensures exact metadata match

Use Cases for New Features:

  • Priority System: Solve recipe conflicts in compressed blocks, custom tool tiers, or upgraded items
  • Strict Mode: Prevent players from using renamed items or items with extra metadata
  • item: vs base64:: Use item:MATERIAL for simple custom items, base64: for complex serialized items
  • Util.parseIngredient(): Load recipes from databases, web APIs, or custom configuration formats

Full Changelog: 3.0.0...3.1.0

3.0.0

01 Oct 19:58
68445e9

Choose a tag to compare

Changelog - RecipesAPI v3.0.0

Major Features

  • RecipeLoader System: Added new RecipeLoader class for flexible recipe loading with fluent API
    • Load recipes from multiple folders recursively with addFolder()
    • Load individual recipe files with addFile()
    • Automatic extraction of default recipes from plugin JAR when folders don't exist
    • Runtime recipe reloading with reload() method
    • Access via recipesAPI.createLoader()
  • Comprehensive YAML Support: Full documentation and validation for YAML recipe configuration
    • Pattern validation for shaped recipes (max 3x3, validates ingredient signs)
    • Support for all vanilla recipe types (smelting, blasting, smoking, campfire, stonecutting, smithing)
    • Recipe categories and groups for recipe book organization

Breaking Changes

  • Automatic Recipe Loading Removed: Recipes are no longer automatically loaded from recipes/ folder on initialization
    • Users must now explicitly use RecipeLoader to load YAML recipes
    • Constructor no longer accepts enableYmlSupport parameter
  • Base64 Class Removed: Custom Base64 utility class deleted - now uses Java's built-in Base64.getDecoder()

Bug Fixes

  • Shaped Recipe Validation: Fixed critical crafting grid validation to properly handle empty spaces and air blocks in patterns
  • Shapeless Recipe Matching: Improved ingredient validation to correctly count items and prevent false positives
  • ItemStack Ingredient Comparison: Fixed metadata checking logic - now correctly validates that ingredient requirements are present in source item (previously checked backwards)
  • Null Safety: Added null checks for ItemStack comparison in ItemStackIngredient.isSimilar()
  • Typo Fix: Corrected "withou" to "without" in error message

Improvements

  • Enhanced Pattern Validation: Added comprehensive validation for shaped recipe patterns
    • Validates pattern dimensions (max 3 rows, max 3 characters per row)
    • Ensures all pattern characters have corresponding ingredients
    • Prevents empty pattern rows
  • Better Error Messages: More descriptive debug messages for shaped recipe validation
    • Reports specific position of mismatches
    • Distinguishes between missing ingredients, wrong items, and air block issues
  • Metadata Handling: Refined metadata comparison to only check properties that exist in ingredient definition
    • Lore checked only if ingredient has lore
    • Custom model data checked only if ingredient has custom model data
    • PDC keys validated from ingredient to source (not bidirectional)
  • YAML Ingredient Types: Expanded support for ingredient formats
    • Material references: material:NAME
    • Minecraft tags: tag:NAME
    • Base64 encoded items: item:BASE64 or base64:BASE64
    • Plugin items: itemsadder:ID, oraxen:ID
    • Strict matching mode with strict: true

Dependency Updates

  • ItemsAdder: Updated from com.github.LoneDev6:API-ItemsAdder:3.6.1 to dev.lone:api-itemsadder:4.0.10
  • Maven Repository: Changed from JitPack to maven.devs.beer
  • Resource File: Renamed version.properties back to recipeapi.properties

Documentation

  • Expanded README: Added extensive documentation including:
    • Recipe loader usage examples with folder and file loading
    • Complete YAML configuration reference with examples
    • Plugin hooks documentation (ItemsAdder, Oraxen, custom hooks)
    • Custom ingredient types and strict mode explanation
    • Pattern validation rules
    • All supported recipe types
  • API Usage: Clarified constructor parameters and added RecipeLoader creation method
  • Code Examples: Updated with numbered recipe examples and improved comments

Internal Improvements

  • Recipe Validation: Strengthened shaped recipe pattern-to-ingredient matching
  • Category Validation: Improved checkCategory() method with explicit enum checking
  • Error Handling: Better exception messages for Base64 decoding failures and configuration errors

Migration Guide (v2.0.2 → v3.0.0):

  • Replace automatic recipe loading with explicit RecipeLoader:
    // Old (v2.0.2) - automatic loading
    recipesAPI = new RecipesAPI(this, true);
    
    // New (v3.0.0) - manual loading
    recipesAPI = new RecipesAPI(this, true);
    RecipeLoader loader = recipesAPI.createLoader()
        .addFolder("recipes/")
        .load();

Full Changelog: 2.0.3...3.0.0

2.0.3

26 Jul 07:36

Choose a tag to compare

What's Changed

Full Changelog: 2.0.2...2.0.3

2.0.2

25 Jul 15:02

Choose a tag to compare

What's Changed

Full Changelog: 2.0.1...2.0.2

2.0.1

14 Apr 19:28

Choose a tag to compare

Changelog - RecipesAPI v2.0.1

Bug Resolution

  • IA: Fix ItemsAdder hook
  • Shapeless: fix shapeless check

2.0.0

27 Feb 13:21

Choose a tag to compare

Changelog - RecipesAPI v2.0.0

Bug Resolution

  • Disable: Remove bug spamming when plugin disable

Improvement

  • Scheduler Remove all code based on usage of scheduler (BREAKING version)
  • Recipe Improve adding system of recipe to manage if recipe with same key exists
  • YML Support Add auto loading with the api of recipes in the plugin resource stream

1.4.4

24 Nov 13:07

Choose a tag to compare

Changelog - RecipesAPI v1.4.4

Bug Resolution

  • Recipe Listener: fix space problem again

1.4.3

23 Nov 17:51

Choose a tag to compare

Changelog - RecipesAPI v1.4.3

Bug Resolution

  • Recipe Listener: fix space problem

1.4.2

23 Nov 17:28

Choose a tag to compare

Changelog - RecipesAPI v1.4.2

Bug Resolution

  • Recipe Configuration: fix pattern get from config