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
ConstructorsConstructorDescriptionCustomTextureService(io.github.bakedlibs.dough.config.Config config) This creates a newCustomTextureServicefor the providedConfig -
Method Summary
Modifier and TypeMethodDescriptionintgetModelData(String id) This returns the configured custom model data for a given id.booleanisActive()This returns true if any custom model data was configured.voidregister(Collection<SlimefunItem> items, boolean save) This method registers the givenSlimefunItemsto thisCustomTextureService.voidsetTexture(ItemStack item, String id) This method sets the custom model data for thisItemStackto the value configured for the provided item id.voidsetTexture(ItemMeta im, String id) This method sets the custom model data for thisItemMetato the value configured for the provided item id.
-
Constructor Details
-
CustomTextureService
public CustomTextureService(@Nonnull io.github.bakedlibs.dough.config.Config config) This creates a newCustomTextureServicefor the providedConfig- Parameters:
config- TheConfigto read custom model data from
-
-
Method Details
-
register
This method registers the givenSlimefunItemsto thisCustomTextureService. If saving is enabled, it will save them to theConfigfile.- Parameters:
items- TheSlimefunItemsto 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 thisItemStackto the value configured for the provided item id.- Parameters:
item- TheItemStackto 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 thisItemMetato the value configured for the provided item id.- Parameters:
im- TheItemMetato set the custom model data forid- The id for which to get the configured model data
-