Class ItemGroup
java.lang.Object
io.github.thebusybiscuit.slimefun4.api.items.ItemGroup
- All Implemented Interfaces:
Keyed
- Direct Known Subclasses:
FlexItemGroup
,LockedItemGroup
,SeasonalItemGroup
,SubItemGroup
Represents an item group, which structure
multiple
SlimefunItem
in the SlimefunGuide
.- Author:
- TheBusyBiscuit
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
protected final ItemStack
protected final List<SlimefunItem>
protected final NamespacedKey
protected int
-
Constructor Summary
ConstructorDescriptionItemGroup
(NamespacedKey key, ItemStack item) Constructs a newItemGroup
with the givenNamespacedKey
as an identifier and the givenItemStack
as its display item.ItemGroup
(NamespacedKey key, ItemStack item, int tier) Constructs a newItemGroup
with the givenNamespacedKey
as an identifier and the givenItemStack
as its display item. -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(SlimefunItem item) Adds the givenSlimefunItem
to thisItemGroup
.boolean
contains
(SlimefunItem item) This method returns whether a givenSlimefunItem
exists in thisItemGroup
.final boolean
final SlimefunAddon
getAddon()
This returns theSlimefunAddon
which has registered thisItemGroup
.getItems()
Returns all instances ofSlimefunItem
bound to thisItemGroup
.final NamespacedKey
getKey()
int
getTier()
Returns the tier of thisItemGroup
.This method makes Walshy happy.final int
hashCode()
boolean
boolean
Returns if items from other addons are allowed to be added to thisItemGroup
.boolean
Deprecated.boolean
This method returns whether thisItemGroup
has been registered yet.boolean
void
register
(SlimefunAddon addon) Registers thisItemGroup
.void
remove
(SlimefunItem item) Removes the givenSlimefunItem
from thisItemGroup
.void
setCrossAddonItemGroup
(boolean crossAddonItemGroup) This method will set if thisItemGroup
will allowSlimefunItem
s from other addons to be added, without a warning, into the group.void
setTier
(int tier) This sets the tier of thisItemGroup
.toString()
-
Field Details
-
items
-
key
-
item
-
tier
protected int tier -
crossAddonItemGroup
protected boolean crossAddonItemGroup
-
-
Constructor Details
-
ItemGroup
Constructs a newItemGroup
with the givenNamespacedKey
as an identifier and the givenItemStack
as its display item. The tier is set to a default value of3
.- Parameters:
key
- TheNamespacedKey
that is used to identify thisItemGroup
item
- TheItemStack
that is used to display thisItemGroup
-
ItemGroup
Constructs a newItemGroup
with the givenNamespacedKey
as an identifier and the givenItemStack
as its display item.- Parameters:
key
- TheNamespacedKey
that is used to identify thisItemGroup
item
- TheItemStack
that is used to display thisItemGroup
tier
- The tier of thisItemGroup
, higher tiers will make thisItemGroup
appear further down in theSlimefunGuide
-
-
Method Details
-
getKey
-
register
Registers thisItemGroup
.By default, an
ItemGroup
is automatically registered when aSlimefunItem
was added to it.- Parameters:
addon
- TheSlimefunAddon
that wants to register thisItemGroup
-
isRegistered
public boolean isRegistered()This method returns whether thisItemGroup
has been registered yet. More specifically: Whetherregister(SlimefunAddon)
was called or not.- Returns:
- Whether this
ItemGroup
has been registered
-
getTier
public int getTier()Returns the tier of thisItemGroup
. The tier determines the position of thisItemGroup
in theSlimefunGuide
.- Returns:
- the tier of this
ItemGroup
-
setTier
public void setTier(int tier) This sets the tier of thisItemGroup
. The tier determines the position of thisItemGroup
in theSlimefunGuide
.- Parameters:
tier
- The tier for thisItemGroup
-
getAddon
This returns theSlimefunAddon
which has registered thisItemGroup
. Or null if it has not been registered yet.- Returns:
- The
SlimefunAddon
or null if unregistered
-
add
Adds the givenSlimefunItem
to thisItemGroup
.- Parameters:
item
- theSlimefunItem
that should be added to thisItemGroup
-
remove
Removes the givenSlimefunItem
from thisItemGroup
.- Parameters:
item
- theSlimefunItem
that should be removed from thisItemGroup
-
getItem
-
getUnlocalizedName
This method makes Walshy happy. It adds a way to get the name of aItemGroup
without localization nor coloring.- Returns:
- The unlocalized name of this
ItemGroup
-
getDisplayName
This returns the localized display name of thisItemGroup
for the givenPlayer
. The method will fall back togetUnlocalizedName()
if no translation was found. -
getItems
Returns all instances ofSlimefunItem
bound to thisItemGroup
.- Returns:
- the list of SlimefunItems bound to this
ItemGroup
-
contains
This method returns whether a givenSlimefunItem
exists in thisItemGroup
.- Parameters:
item
- TheSlimefunItem
to find- Returns:
- Whether the given
SlimefunItem
was found in thisItemGroup
-
isAccessible
This method returns whether thisItemGroup
can be accessed by the givenPlayer
. If anItemGroup
is not accessible, it will not show up in theSlimefunGuide
nor will items from thisItemGroup
show up in the guide search. -
isVisible
This method returns whether thisItemGroup
can be viewed by the givenPlayer
. EmptyItemGroups
will not be visible. This includesItemGroups
where everySlimefunItem
is disabled. If anItemGroup
is not accessible by thePlayer
, seeisAccessible(Player)
, this method will also return false. -
isCrossAddonItemGroup
public boolean isCrossAddonItemGroup()Returns if items from other addons are allowed to be added to thisItemGroup
.- Returns:
- true if items from other addons are allowed to be added to this
ItemGroup
.
-
setCrossAddonItemGroup
public void setCrossAddonItemGroup(boolean crossAddonItemGroup) This method will set if thisItemGroup
will allowSlimefunItem
s from other addons to be added, without a warning, into the group. False by default. If set to true, Slimefun will not warn about items being added.- Parameters:
crossAddonItemGroup
- Whether items from another addon are allowable
-
equals
-
hashCode
public final int hashCode() -
toString
-
isHidden
Deprecated.
-