Class CustomTextureService
java.lang.Object
io.github.thebusybiscuit.slimefun4.core.services.CustomTextureService
This Service is responsible for applying custom model data to any
SlimefunItemStack
if a Server Owner configured Slimefun to use those.
We simply use ItemMeta.setCustomModelData(Integer)
for this.- Author:
- TheBusyBiscuit
-
Constructor Summary
ConstructorDescriptionCustomTextureService
(io.github.bakedlibs.dough.config.Config config) This creates a newCustomTextureService
for the providedConfig
-
Method Summary
Modifier and TypeMethodDescriptionint
getModelData
(String id) This returns the configured custom model data for a given id.boolean
isActive()
This returns true if any custom model data was configured.void
register
(Collection<SlimefunItem> items, boolean save) This method registers the givenSlimefunItems
to thisCustomTextureService
.void
setTexture
(ItemStack item, String id) This method sets the custom model data for thisItemStack
to the value configured for the provided item id.void
setTexture
(ItemMeta im, String id) This method sets the custom model data for thisItemMeta
to the value configured for the provided item id.
-
Constructor Details
-
CustomTextureService
public CustomTextureService(@Nonnull io.github.bakedlibs.dough.config.Config config) This creates a newCustomTextureService
for the providedConfig
- Parameters:
config
- TheConfig
to read custom model data from
-
-
Method Details
-
register
This method registers the givenSlimefunItems
to thisCustomTextureService
. If saving is enabled, it will save them to theConfig
file.- Parameters:
items
- TheSlimefunItems
to registersave
- Whether to save this file
-
getVersion
-
isActive
public boolean isActive()This returns true if any custom model data was configured. If every item id has no configured custom model data, it will return false.- Returns:
- Whether any custom model data was configured
-
getModelData
This returns the configured custom model data for a given id.- Parameters:
id
- The id to get the data for- Returns:
- The configured custom model data
-
setTexture
This method sets the custom model data for thisItemStack
to the value configured for the provided item id.- Parameters:
item
- TheItemStack
to set the custom model data forid
- The id for which to get the configured model data
-
setTexture
This method sets the custom model data for thisItemMeta
to the value configured for the provided item id.- Parameters:
im
- TheItemMeta
to set the custom model data forid
- The id for which to get the configured model data
-