Package net.minecraft.resource
Class ResourcePackProfile
java.lang.Object
net.minecraft.resource.ResourcePackProfile
- All Implemented Interfaces:
AutoCloseable
public class ResourcePackProfile extends Object implements AutoCloseable
Represents a resource pack in a
ResourcePackManager.
Compared to a single-use ResourcePack, a profile is persistent
and serves as a factory for the single-use
packs. It also contains user-friendly information about resource packs.
The profiles are registered by ResourcePackProviders.
Closing the profile doesn't have any effect.
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceResourcePackProfile.Factorystatic classResourcePackProfile.InsertionPosition -
Field Summary
Fields Modifier and Type Field Description private booleanalwaysEnabledprivate static PackResourceMetadataBROKEN_PACK_METAprivate ResourcePackCompatibilitycompatibilityprivate Textdescriptionprivate TextdisplayNameprivate static LoggerLOGGERprivate Stringnameprivate Supplier<ResourcePack>packFactoryprivate booleanpinnedprivate ResourcePackProfile.InsertionPositionpositionprivate ResourcePackSourcesource -
Constructor Summary
Constructors Constructor Description ResourcePackProfile(String name, boolean alwaysEnabled, Supplier<ResourcePack> packFactory, ResourcePack pack, PackResourceMetadata metadata, ResourcePackProfile.InsertionPosition direction, ResourcePackSource source)ResourcePackProfile(String name, boolean alwaysEnabled, Supplier<ResourcePack> packFactory, Text displayName, Text description, ResourcePackCompatibility compatibility, ResourcePackProfile.InsertionPosition direction, boolean pinned, ResourcePackSource source) -
Method Summary
Modifier and Type Method Description voidclose()ResourcePackcreateResourcePack()booleanequals(Object o)ResourcePackCompatibilitygetCompatibility()TextgetDescription()TextgetDisplayName()TextgetInformationText(boolean enabled)ResourcePackProfile.InsertionPositiongetInitialPosition()StringgetName()ResourcePackSourcegetSource()inthashCode()booleanisAlwaysEnabled()booleanisPinned()static ResourcePackProfileof(String name, boolean alwaysEnabled, Supplier<ResourcePack> packFactory, ResourcePackProfile.Factory profileFactory, ResourcePackProfile.InsertionPosition insertionPosition, ResourcePackSource packSource)Creates a resource pack profile from the given parameters.
-
Field Details
-
LOGGER
-
BROKEN_PACK_META
-
name
-
packFactory
-
displayName
-
description
-
compatibility
-
position
-
alwaysEnabled
private final boolean alwaysEnabled -
pinned
private final boolean pinned -
source
-
-
Constructor Details
-
ResourcePackProfile
public ResourcePackProfile(String name, boolean alwaysEnabled, Supplier<ResourcePack> packFactory, Text displayName, Text description, ResourcePackCompatibility compatibility, ResourcePackProfile.InsertionPosition direction, boolean pinned, ResourcePackSource source) -
ResourcePackProfile
public ResourcePackProfile(String name, boolean alwaysEnabled, Supplier<ResourcePack> packFactory, ResourcePack pack, PackResourceMetadata metadata, ResourcePackProfile.InsertionPosition direction, ResourcePackSource source)
-
-
Method Details
-
of
@Nullable public static ResourcePackProfile of(String name, boolean alwaysEnabled, Supplier<ResourcePack> packFactory, ResourcePackProfile.Factory profileFactory, ResourcePackProfile.InsertionPosition insertionPosition, ResourcePackSource packSource)Creates a resource pack profile from the given parameters.Compared to calling the factory directly, this utility method obtains the pack's metadata information from the pack created by the
packFactory. If the created pack doesn't have metadata information, this method returnsnull.- Returns:
- the created profile, or
nullif missing metadata
-
getDisplayName
-
getDescription
-
getInformationText
-
getCompatibility
-
createResourcePack
-
getName
-
isAlwaysEnabled
public boolean isAlwaysEnabled() -
isPinned
public boolean isPinned() -
getInitialPosition
-
getSource
-
equals
-
hashCode
public int hashCode() -
close
public void close()- Specified by:
closein interfaceAutoCloseable
-