Class PowerItemComponent
java.lang.Object
valorless.rarespawns.builders.components.PowerItemComponent
Configuration component describing how a Power Item behaves.
Holds flags and parameters controlling where and how a power item can be used (consumable behavior, allowed blocks/worlds, drop/ominous rules, per-use delay, permission, and optional sound cues). Unless stated otherwise, null means "use plugin defaults".
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new component for the given power item type. -
Method Summary
Modifier and TypeMethodDescriptionGets the allow-list of blocks the item can interact with.Indicates whether the item is consumed on use.getDrops()Whether broken blocks should drop items when using this item.Whether an "ominous" state is required for breaking/interaction to work.Gets the permission node required to use the item.getSound()Gets the optional sound to play when this power item is activated.Gets the delay between uses (in milliseconds) for trowel interactions.Gets the durability cost per use for trowel interactions.getType()Gets the power item type this component represents.Gets the allow-list of worlds where the item can be used.voidSets the allow-list of blocks the item can interact with.voidsetConsumable(Boolean consumable) Sets whether the item is consumed on use.voidSets whether broken blocks should drop items when using this item.voidsetOminous(Boolean ominous) Sets whether an "ominous" state is required for breaking/interaction to work.voidsetPermission(String permission) Sets the permission node required to use the item.voidSets the activation sound from a compact string definition.voidSets the activation sound.voidsetTrowelDelay(Integer trowelDelay) Sets the delay between uses (in milliseconds) for trowel interactions.voidsetTrowelDurabilityCost(Integer trowelDurabilityCost) Sets the durability cost per use for trowel interactions.voidSets the allow-list of worlds where the item can be used.
-
Constructor Details
-
PowerItemComponent
Creates a new component for the given power item type.- Parameters:
type- the power item category this configuration applies to
-
-
Method Details
-
getType
Gets the power item type this component represents.- Returns:
- the power item type
-
getConsumable
Indicates whether the item is consumed on use.- Returns:
- true if consumed; false if not; null to use default
-
setConsumable
Sets whether the item is consumed on use.- Parameters:
consumable- true to consume; false to keep; null to use default
-
getBlocks
Gets the allow-list of blocks the item can interact with.- Returns:
- string list of materials, or null to allow plugin default
-
setBlocks
Sets the allow-list of blocks the item can interact with.- Parameters:
blocks- string list of materials; null for default behavior
-
getDrops
Whether broken blocks should drop items when using this item.- Returns:
- true to drop; false to suppress; null to use default
-
setDrops
Sets whether broken blocks should drop items when using this item.- Parameters:
drops- true to drop; false to suppress; null to use default
-
getOminous
Whether an "ominous" state is required for breaking/interaction to work.- Returns:
- true if required; false if not; null to use default
-
setOminous
Sets whether an "ominous" state is required for breaking/interaction to work.- Parameters:
ominous- true if required; false if not; null to use default
-
getTrowelDelay
Gets the delay between uses (in milliseconds) for trowel interactions.- Returns:
- delay in milliseconds; null to use default
-
setTrowelDelay
Sets the delay between uses (in milliseconds) for trowel interactions.- Parameters:
trowelDelay- delay in milliseconds; null for default
-
getTrowelDurabilityCost
Gets the durability cost per use for trowel interactions.- Returns:
- durability cost; null to use default
-
setTrowelDurabilityCost
Sets the durability cost per use for trowel interactions.- Parameters:
trowelDurabilityCost- durability cost; null for default
-
getWorlds
Gets the allow-list of worlds where the item can be used.- Returns:
- list of world names; null or empty may mean allowed everywhere
-
setWorlds
Sets the allow-list of worlds where the item can be used.- Parameters:
worlds- world names; null/empty to allow in all worlds (unless configured otherwise)
-
getPermission
Gets the permission node required to use the item.- Returns:
- permission string; null if no permission required
-
setPermission
Sets the permission node required to use the item.- Parameters:
permission- permission string; null if no permission required
-
getSound
Gets the optional sound to play when this power item is activated.- Returns:
- the configured sound, or null if none
-
setSound
Sets the activation sound from a compact string definition.Expected formats follow
Sound.parse(String)semantics, for example: "minecraft:entity.player.levelup:1.0:1.0" or "ENTITY_PLAYER_LEVELUP:0.8:1.2". Passing null clears the sound.- Parameters:
sound- the sound definition string; null to disable
-
setSound
Sets the activation sound.Passing null clears the sound.
- Parameters:
sound- the sound; null to disable
-