Return the skin object assigned to the player. Returns default if nothing assigned
Check if allowed and assign the skin for the player without visual updates. The "skin" parameter could be the skin key or the skin object Returns false if skin is not valid or applicable to player
Update selected skin visuals on player
Function for external usage on skin selection. This function assign the skin, call the skin:set_skin(player) hook to update dynamic skins, then update the visuals
Returns the skin format version ("1.0" or "1.8"). File is an open file handle to the texture file
Obsolete - use get_skinlist_for_player() or get_skinlist_with_meta() instead
Get all allowed skins for player. All public and all player's private skins. If playername not given only public skins returned
Get all skins with metadata key is set to value. Example: skins.get_skinlist_with_meta("playername", playername) - Get all private skins (w.o. public) for playername
Registers a new skin based on the texture file path specified by path
and filename
.
path
(string): points to the parent directory of the texturefilename
. Generally, this should be in the formatmymod.modpath .. "/textures"
.filename
(string): full file name, without any path specifications. The file name must adhere to one of the accepted naming formats.
Note: this function takes the following files into consideration:
<path>/<filename>
(required)- Main skin texture
<path>/<filenamestem><separator>preview.png
(optional)- Pre-generated preview image
<path>/../meta/<filenamestem>.txt
(optional)- Metadata regarding the skin
Return values:
- On failure:
false, reason
reason
(string): human readable reason string (similar toio.open
errors)
- On success:
true, key
key
: unique skins key for use with e.g.skins.get(key)
for subsequent fine-tuning of the skin registration.
Create and register a new skin object for given key
- key: Unique skins key, like "character_1"
- object: Optional. Could be a prepared object with redefinitions
Get existing skin object
HINT: During build-up phase maybe the next statement is usefull
local skin = skins.get(name) or skins.new(name)
Get the unique skin key
Set the skin texture - usually at the init time only
Get the skin texture for any reason. Note to apply them the skin:set_skin() should be used
Could be redefined for dynamic texture generation
Set the hand node to be used with this skin
Register and set hand node based on skin texture. Uses different model depending on get_meta("format") ("1.0" or "1.8") Only works on mod load
Get hand node. Returns ItemStack
Set the skin preview - usually at the init time only
Get the skin preview
Could be redefined for dynamic preview texture generation
Hook for dynamic skins updates on select. Is called in skins.set_player_skin() In skinsdb the default implementation for this function is empty.
Apply the skin to the player. Called in skins.update_player_skin() to update visuals
Add a meta information to the skin object
Note: the information is not stored, therefore should be filled each time during skins registration
The next metadata keys are filled or/and used interally in skinsdb framework
- name - A name for the skin
- author - The skin author
- license - THe skin texture license
- assignment - (obsolete) is "player:playername" in case the skin is assigned to be private for a player
- playername - Player assignment for private skin. Set false for skins not usable by all players (like NPC-Skins), true or nothing for all player skins
- in_inventory_list - If set to false the skin is not visible in inventory skins selection but can be still applied to the player
- _sort_id - Thi skins lists are sorted by this field for output (internal key)
Same as get_meta() but does return "" instead of nil if the meta key does not exists
Returns whether this skin is applicable for player "playername" or not, like private skins