Record Class PowerProvider
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.enchantment.theme.power.PowerProvider
- Record Components:
blocks- AHolderSetrepresenting the block(s) or block tag that provide power for the theme.power- The base integer amount of enchanting power this provider grants.bonuses- A list of optionalPowerBonusrules that apply conditional or dynamic modifications to the base power value.
public record PowerProvider(net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block> blocks, int power, List<PowerBonus> bonuses)
extends Record
A data-driven record that defines a rule for how a specific block or group of blocks
contributes enchanting power toward an
EnchantmentTheme
(e.g., a Bookshelf contributing 1 power to the Common theme).
This is the core data unit used by the Enchanting Altar logic to determine available thematic and agnostic power.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<PowerProvider> The codec responsible for serializing and deserializing instances of this record from JSON. -
Constructor Summary
ConstructorsConstructorDescriptionPowerProvider(net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block> blocks, int power, List<PowerBonus> bonuses) Creates an instance of aPowerProviderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.HolderSet<net.minecraft.world.level.block.Block> blocks()Returns the value of theblocksrecord component.bonuses()Returns the value of thebonusesrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intpower()Returns the value of thepowerrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
The codec responsible for serializing and deserializing instances of this record from JSON.Uses
RegistryCodecs.homogeneousList(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<E>>, com.mojang.serialization.Codec<E>)to handle theHolderSetof blocks. Thebonusesfield defaults to an empty list if omitted.
-
-
Constructor Details
-
PowerProvider
public PowerProvider(net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block> blocks, int power, List<PowerBonus> bonuses) Creates an instance of aPowerProviderrecord class.
-
-
Method Details
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
blocks
public net.minecraft.core.HolderSet<net.minecraft.world.level.block.Block> blocks()Returns the value of theblocksrecord component.- Returns:
- the value of the
blocksrecord component
-
power
public int power()Returns the value of thepowerrecord component.- Returns:
- the value of the
powerrecord component
-
bonuses
Returns the value of thebonusesrecord component.- Returns:
- the value of the
bonusesrecord component
-