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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected final ItemStackprotected final List<SlimefunItem>protected final NamespacedKeyprotected int -
Constructor Summary
ConstructorsConstructorDescriptionItemGroup(NamespacedKey key, ItemStack item) Constructs a newItemGroupwith the givenNamespacedKeyas an identifier and the givenItemStackas its display item.ItemGroup(NamespacedKey key, ItemStack item, int tier) Constructs a newItemGroupwith the givenNamespacedKeyas an identifier and the givenItemStackas its display item. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(SlimefunItem item) Adds the givenSlimefunItemto thisItemGroup.booleancontains(SlimefunItem item) This method returns whether a givenSlimefunItemexists in thisItemGroup.final booleanfinal SlimefunAddongetAddon()This returns theSlimefunAddonwhich has registered thisItemGroup.getItems()Returns all instances ofSlimefunItembound to thisItemGroup.final NamespacedKeygetKey()intgetTier()Returns the tier of thisItemGroup.This method makes Walshy happy.final inthashCode()booleanbooleanReturns if items from other addons are allowed to be added to thisItemGroup.booleanDeprecated.booleanThis method returns whether thisItemGrouphas been registered yet.booleanvoidregister(SlimefunAddon addon) Registers thisItemGroup.voidremove(SlimefunItem item) Removes the givenSlimefunItemfrom thisItemGroup.voidsetCrossAddonItemGroup(boolean crossAddonItemGroup) This method will set if thisItemGroupwill allowSlimefunItems from other addons to be added, without a warning, into the group.voidsetTier(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 newItemGroupwith the givenNamespacedKeyas an identifier and the givenItemStackas its display item. The tier is set to a default value of3.- Parameters:
key- TheNamespacedKeythat is used to identify thisItemGroupitem- TheItemStackthat is used to display thisItemGroup
-
ItemGroup
Constructs a newItemGroupwith the givenNamespacedKeyas an identifier and the givenItemStackas its display item.- Parameters:
key- TheNamespacedKeythat is used to identify thisItemGroupitem- TheItemStackthat is used to display thisItemGrouptier- The tier of thisItemGroup, higher tiers will make thisItemGroupappear further down in theSlimefunGuide
-
-
Method Details
-
getKey
-
register
Registers thisItemGroup.By default, an
ItemGroupis automatically registered when aSlimefunItemwas added to it.- Parameters:
addon- TheSlimefunAddonthat wants to register thisItemGroup
-
isRegistered
public boolean isRegistered()This method returns whether thisItemGrouphas been registered yet. More specifically: Whetherregister(SlimefunAddon)was called or not.- Returns:
- Whether this
ItemGrouphas been registered
-
getTier
public int getTier()Returns the tier of thisItemGroup. The tier determines the position of thisItemGroupin 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 thisItemGroupin theSlimefunGuide.- Parameters:
tier- The tier for thisItemGroup
-
getAddon
This returns theSlimefunAddonwhich has registered thisItemGroup. Or null if it has not been registered yet.- Returns:
- The
SlimefunAddonor null if unregistered
-
add
Adds the givenSlimefunItemto thisItemGroup.- Parameters:
item- theSlimefunItemthat should be added to thisItemGroup
-
remove
Removes the givenSlimefunItemfrom thisItemGroup.- Parameters:
item- theSlimefunItemthat should be removed from thisItemGroup
-
getItem
-
getUnlocalizedName
This method makes Walshy happy. It adds a way to get the name of aItemGroupwithout localization nor coloring.- Returns:
- The unlocalized name of this
ItemGroup
-
getDisplayName
This returns the localized display name of thisItemGroupfor the givenPlayer. The method will fall back togetUnlocalizedName()if no translation was found. -
getItems
Returns all instances ofSlimefunItembound to thisItemGroup.- Returns:
- the list of SlimefunItems bound to this
ItemGroup
-
contains
This method returns whether a givenSlimefunItemexists in thisItemGroup.- Parameters:
item- TheSlimefunItemto find- Returns:
- Whether the given
SlimefunItemwas found in thisItemGroup
-
isAccessible
This method returns whether thisItemGroupcan be accessed by the givenPlayer. If anItemGroupis not accessible, it will not show up in theSlimefunGuidenor will items from thisItemGroupshow up in the guide search. -
isVisible
This method returns whether thisItemGroupcan be viewed by the givenPlayer. EmptyItemGroupswill not be visible. This includesItemGroupswhere everySlimefunItemis disabled. If anItemGroupis 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 thisItemGroupwill allowSlimefunItems 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.
-