Class EnchantTableConfigurationBuilder
java.lang.Object
io.artificial.enchantments.internal.enchanttable.EnchantTableConfigurationBuilder
- All Implemented Interfaces:
EnchantTableConfiguration.Builder
public final class EnchantTableConfigurationBuilder
extends Object
implements EnchantTableConfiguration.Builder
Builder implementation for
EnchantTableConfiguration.
This builder allows configuring all aspects of how an enchantment appears in the enchantment table:
- Weight multiplier - affects selection probability relative to rarity
- Bookshelf range - min/max bookshelves required to appear
- Cost multiplier - scales the lapis/level cost
- Multiple offers - whether this enchantment can appear in multiple slots
- Level clamping - min/max levels that can be offered
- Treasure flag - whether this is a treasure-only enchantment
Default values follow vanilla behavior:
- Weight multiplier: 1.0 (no adjustment)
- Bookshelves: 0-15 (available at all power levels)
- Cost multiplier: 1.0 (vanilla scaling)
- Single offer per enchantment
- Level range: 1 to enchantment max level
- Non-treasure (discoverable)
- Since:
- 0.2.0
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new enchantment table configuration builder. -
Method Summary
Modifier and TypeMethodDescriptionallowMultiple(boolean allow) Sets whether multiple offers are allowed.@NotNull EnchantTableConfigurationbuild()Builds and returns the table configuration.costMultiplier(double multiplier) Sets the cost multiplier.maxBookshelves(int max) Sets the maximum bookshelves allowed.minBookshelves(int min) Sets the minimum bookshelves required.tableMaxLevel(int level) Sets the maximum enchantment level for table offers.tableMinLevel(int level) Sets the minimum enchantment level for table offers.treasure(boolean treasure) Sets whether this is a treasure enchantment.weightMultiplier(double multiplier) Sets the weight multiplier for this enchantment.
-
Constructor Details
-
EnchantTableConfigurationBuilder
public EnchantTableConfigurationBuilder()Creates a new enchantment table configuration builder.- Since:
- 0.2.0
-
-
Method Details
-
weightMultiplier
Sets the weight multiplier for this enchantment.- Specified by:
weightMultiplierin interfaceEnchantTableConfiguration.Builder- Parameters:
multiplier- the weight multiplier (must be > 0)- Returns:
- this builder for chaining
-
minBookshelves
Sets the minimum bookshelves required.- Specified by:
minBookshelvesin interfaceEnchantTableConfiguration.Builder- Parameters:
min- the minimum bookshelves (must be >= 0)- Returns:
- this builder for chaining
-
maxBookshelves
Sets the maximum bookshelves allowed.- Specified by:
maxBookshelvesin interfaceEnchantTableConfiguration.Builder- Parameters:
max- the maximum bookshelves (must be >= min)- Returns:
- this builder for chaining
-
costMultiplier
Sets the cost multiplier.- Specified by:
costMultiplierin interfaceEnchantTableConfiguration.Builder- Parameters:
multiplier- the cost multiplier (must be > 0)- Returns:
- this builder for chaining
-
allowMultiple
Sets whether multiple offers are allowed.- Specified by:
allowMultiplein interfaceEnchantTableConfiguration.Builder- Parameters:
allow- true to allow multiple offers- Returns:
- this builder for chaining
-
tableMinLevel
Sets the minimum enchantment level for table offers.- Specified by:
tableMinLevelin interfaceEnchantTableConfiguration.Builder- Parameters:
level- the minimum level (must be >= 1)- Returns:
- this builder for chaining
-
tableMaxLevel
Sets the maximum enchantment level for table offers.- Specified by:
tableMaxLevelin interfaceEnchantTableConfiguration.Builder- Parameters:
level- the maximum level (must be >= min)- Returns:
- this builder for chaining
-
treasure
Sets whether this is a treasure enchantment.- Specified by:
treasurein interfaceEnchantTableConfiguration.Builder- Parameters:
treasure- true for treasure behavior- Returns:
- this builder for chaining
-
build
Builds and returns the table configuration.Validates constraints before building:
- minBookshelves must not exceed maxBookshelves
- tableMinLevel must not exceed tableMaxLevel
- Specified by:
buildin interfaceEnchantTableConfiguration.Builder- Returns:
- the completed configuration
- Throws:
IllegalStateException- if constraints are violated
-