This mod is an API that provides useful extensions to existing vanilla classes. They are grouped based on the class that is primarily dealt with or returned by the function.
Block.makeItem()
- creates a newBlockItem
based on the block. Optionally takes anItem.Settings
.Block.matches(Identifier)
- checks whether the block is contained in the tag with the given idBlock.matches(String)
- converts the String to anIdentifier
then callsmatches(Identifier)
String.id
- converts the String to anIdentifier
Pair<String,String>.id
- converts the Pair to anIdentifier
Identifier.component1() and .component2()
- allows for destructuring ofIdentifier
sString.validId()
- checks if the String is a validIdentifier
Pair<String,String>.validId()
checks if the Pair is a validIdentifier
Item.stack()
- creates a new ItemStack with the Item. Optionally takes an Int for the count.Item.matches(Tag<Item> or Identifier or String)
- checks if the Item is in the Tag. Same idea asBlock::matches
compooundTag(vararg Pair<String, Tag>)
- creates a newCompoundTag
with the given elementsCompoundTag.set(String, Tag)
- operator forCompoundTag::put
Map<String,Tag>.toCompoundTag()
- creates a newCompoundTag
from the map's elementsAny?.toTag()
- Creates a newTag
from the object. Note: if the object cannot be converted into a tag, this will crash the game.interface NBTSerializable
- Allows you to create the NBT representation for your classes. Not needed forEntity
andBlockEntity
subclasses.
Registry<T>.get(String)
- converts to anIdentifier
and gets the value in the RegistryRegistry<T>.set(Identifier or String, T)
- Registers the value in the Registry usingRegistry.register
Identifier.item() and .block() and .entityType() and .blockEntityType() and .registry()
- gets the value at theIdentifier
in the appropriate Registry
Identifier.tag<T>()
- gets aTag<T>
at theIdentifier
. Only valid for Item, Block, EntityType, and Fluid. Any other type will crash the game.String.tag<T>()
- converts to anIdentifier
and gets theTag<T>
at itTag<T>.isEqual(Tag<T>)
-Tag<T>.equals
is not properly overridden. Use this to compare equality with tags.
World.runOnClient(()->Unit)
- Runs the passed function only on the clientWorld.runOnServer(()->Unit)
- Runs the passed function only on the server