Package de.maxbossing.maxapi.Builders
Class ItemStackBuilder.Unsafe
java.lang.Object
de.maxbossing.maxapi.Builders.ItemStackBuilder.Unsafe
- Enclosing class:
ItemStackBuilder
A class containing sensitive NMS code for manipulating NBT data on an item stack.
Use with caution as this code is highly sensitive and can break the ItemStackBuilder if used improperly.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassThis Class contains highly sensitive NMS Code that should not be touched unless you want to break the ItemBuilder -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ItemStackBuilderDo not access using this Fieldprotected final ItemStackBuilder.Unsafe.ReflectionUtilsDo not access using this Field -
Constructor Summary
ConstructorsConstructorDescriptionUnsafe(ItemStackBuilder builder) Initializes the Unsafe class with an ItemStackBuilder. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Returns the ItemStackBuilder instance associated with this Unsafe instance.booleancontainsKey(String key) Returns whether the item has an NBT tag saved under the specified key.booleangetBoolean(String key) Returns the boolean saved under the specified key.doubleReturns the double saved under the specified key.intreturns the Integer under the current KeyReturns the string saved under the specified key.setBoolean(String key, boolean value) Sets a NBT tag boolean into the NBT tag compound of the item.Sets a NBT tag double into the NBT tag compound of the item.Sets a NBT tag integer into the NBT tag compound of the item.Sets a NBT tag string into the NBT tag compound of the item.
-
Field Details
-
utils
Do not access using this Field -
builder
Do not access using this Field
-
-
Constructor Details
-
Unsafe
Initializes the Unsafe class with an ItemStackBuilder.- Parameters:
builder- the ItemStackBuilder to initialize the Unsafe class with
-
-
Method Details
-
setString
Sets a NBT tag string into the NBT tag compound of the item.- Parameters:
key- the name to save the NBT tag undervalue- the value to save- Returns:
- the current Unsafe instance
-
getString
Returns the string saved under the specified key.- Parameters:
key- the key to retrieve the string from- Returns:
- the string saved under the key, or null if not found
-
setInt
Sets a NBT tag integer into the NBT tag compound of the item.- Parameters:
key- the name to save the NBT tag undervalue- the value to save- Returns:
- the current Unsafe instance
-
getInt
returns the Integer under the current Key- Parameters:
key- the nbt tag name- Returns:
- int
-
setDouble
Sets a NBT tag double into the NBT tag compound of the item.- Parameters:
key- the name to save the NBT tag undervalue- the value to save- Returns:
- the current Unsafe instance
-
getDouble
Returns the double saved under the specified key.- Parameters:
key- the key to retrieve the double from- Returns:
- the double saved under the key, or 0 if not found
-
setBoolean
Sets a NBT tag boolean into the NBT tag compound of the item.- Parameters:
key- the name to save the NBT tag undervalue- the value to save- Returns:
- the current Unsafe instance
-
getBoolean
Returns the boolean saved under the specified key.- Parameters:
key- the key to retrieve the boolean from- Returns:
- the boolean saved under the key, or false if not found
-
containsKey
Returns whether the item has an NBT tag saved under the specified key.- Parameters:
key- the key to check- Returns:
- true if the item has an NBT tag saved under the key, false otherwise
-
builder
Returns the ItemStackBuilder instance associated with this Unsafe instance.- Returns:
- the ItemStackBuilder instance
-