Class ResourceName
java.lang.Object
de.ellpeck.rockbottom.api.util.reg.ResourceName
- All Implemented Interfaces:
Comparable<ResourceName>
A resource name that defines the name of a resource and the domain that it is
created from. A resource name is structured in the following way: The domain,
followed by
Constants.RESOURCE_SEPARATOR, followed by the actual
resource name.
The game's internal resource names use the IGameInstance instance
from RockBottomAPI.getGame() as the domain. Using this in mods is
highly discouraged and, if anything, should only be used to access existing
internal resources, not create new ones.
-
Constructor Summary
ConstructorsConstructorDescriptionResourceName(IMod mod, String resourceName) Creates a resource name with the givenIModas the domain.ResourceName(String combined) Creates a resource name from a combined string. -
Method Summary
Modifier and TypeMethodDescriptionReturns a new resource name with the given prefix added to the front of the resource.Returns a new resource name with the given suffix added to the end of the resource.intbooleanReturns the domain of this resource name.Returns the name of this resourceinthashCode()static ResourceNameCreates an internal resource name that uses theIGameInstanceinstance fromRockBottomAPI.getGame()as the domain.toString()
-
Constructor Details
-
ResourceName
Creates a resource name with the givenIModas the domain.- Parameters:
mod- The mod domainresourceName- The resource name
-
ResourceName
Creates a resource name from a combined string. If the string does not contain theConstants.RESOURCE_SEPARATOR, then it will throw anIllegalArgumentException.- Parameters:
combined- The combined resource string- See Also:
-
-
Method Details
-
intern
Creates an internal resource name that uses theIGameInstanceinstance fromRockBottomAPI.getGame()as the domain. Using this in mods is highly discouraged and, if anything, should only be used to access existing internal resources, not create new ones.- Parameters:
resourceName- The name of the resource- Returns:
- A new internal resource name
-
getDomain
Returns the domain of this resource name.- Returns:
- The domain
- See Also:
-
getResourceName
Returns the name of this resource- Returns:
- The name
- See Also:
-
addPrefix
Returns a new resource name with the given prefix added to the front of the resource. For example, the resource name rockbottom/stone with the prefix dirty_ added to it would result in a new resource name rockbottom/dirty_stone, meaning the domain of the resource name stays unaffected by this action.- Parameters:
prefix- The prefix to add- Returns:
- A new name with the prefix added
-
addSuffix
Returns a new resource name with the given suffix added to the end of the resource. For example, the resource name rockbottom/stone with the suffix _pickaxe added to it would result in a new resource name rockbottom/stone_pickaxe, meaning the domain of the resource name stays unaffected by this action.- Parameters:
suffix- The suffix to add- Returns:
- A new name with the suffix added
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareToin interfaceComparable<ResourceName>
-
toString
-