Package api.item.tag
Record Class TagInstance
java.lang.Object
java.lang.Record
api.item.tag.TagInstance
- All Implemented Interfaces:
TagOrStack
Wrapper for tags, with an included stack size
-
Constructor Summary
ConstructorsConstructorDescriptionTagInstance(Tag tag, int stackSize) Creates an instance of aTagInstancerecord class. -
Method Summary
Modifier and TypeMethodDescriptioncopy()final booleanIndicates whether some other object is "equal to" this one.intfinal inthashCode()Returns a hash code value for this object.booleanisEqual(TagOrStack tagOrStack, boolean checkIfWildcard) booleanmatches(TagOrStack inputToCheck, boolean checkIfWildcard) static TagInstancestatic TagInstancesetStackSize(int newStackSize) intReturns the value of thestackSizerecord component.tag()Returns the value of thetagrecord component.toString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface api.item.tag.TagOrStack
getItemIds
-
Constructor Details
-
TagInstance
Creates an instance of aTagInstancerecord class.- Parameters:
tag- the value for thetagrecord componentstackSize- the value for thestackSizerecord component
-
-
Method Details
-
copy
- Specified by:
copyin interfaceTagOrStack- Returns:
- A new instance of this
-
of
-
of
-
matches
- Specified by:
matchesin interfaceTagOrStack
-
isEqual
- Specified by:
isEqualin interfaceTagOrStack- Parameters:
tagOrStack- Tag or stack to check against this tag or stackcheckIfWildcard- If
-
getStackSize
public int getStackSize()- Specified by:
getStackSizein interfaceTagOrStack
-
setStackSize
- Specified by:
setStackSizein interfaceTagOrStack- Returns:
- This instance if it is an itemstack, or a new instance if it is a tag.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
tag
Returns the value of thetagrecord component.- Returns:
- the value of the
tagrecord component
-
stackSize
public int stackSize()Returns the value of thestackSizerecord component.- Returns:
- the value of the
stackSizerecord component
-