Mineuniverse
Log in Register
Mods

Kotlin Extensions [Fabric]

Kotlin Extensions for various Minecraft classes
by MarioAndWeegee3
Claim this project
356 downloads
0 likes
Updated Jun 30, 2026
0 hypes

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 Extensions

  • Block.makeItem() - creates a new BlockItem based on the block. Optionally takes an Item.Settings.
  • Block.matches(Identifier) - checks whether the block is contained in the tag with the given id
  • Block.matches(String) - converts the String to an Identifier then calls matches(Identifier)

Identifier Extensions

  • String.id - converts the String to an Identifier
  • Pair.id - converts the Pair to an Identifier
  • Identifier.component1() and .component2() - allows for destructuring of Identifiers
  • String.validId() - checks if the String is a valid Identifier
  • Pair.validId() checks if the Pair is a valid Identifier

Item Extensions

  • Item.stack() - creates a new ItemStack with the Item. Optionally takes an Int for the count.
  • Item.matches(Tag or Identifier or String) - checks if the Item is in the Tag. Same idea as Block::matches

NBT Tag Extensions

  • compooundTag(vararg Pair) - creates a new CompoundTag with the given elements
  • CompoundTag.set(String, Tag) - operator for CompoundTag::put
  • Map.toCompoundTag() - creates a new CompoundTag from the map's elements
  • Any?.toTag() - Creates a new Tag 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 for Entity and BlockEntity subclasses.

Registry Extensions

  • Registry.get(String) - converts to an Identifier and gets the value in the Registry
  • Registry.set(Identifier or String, T) - Registers the value in the Registry using Registry.register
  • Identifier.item() and .block() and .entityType() and .blockEntityType() and .registry() - gets the value at the Identifier in the appropriate Registry

Tag Extensions

  • Identifier.tag() - gets a Tag at the Identifier. Only valid for Item, Block, EntityType, and Fluid. Any other type will crash the game.
  • String.tag() - converts to an Identifier and gets the Tag at it
  • Tag.isEqual(Tag) - Tag.equals is not properly overridden. Use this to compare equality with tags.

World Extensions

  • World.runOnClient(()-Unit) - Runs the passed function only on the client
  • World.runOnServer(()-Unit) - Runs the passed function only on the server

No files available for download.

More from MarioAndWeegee3

Unlimiter
9,790
Resource Loader [Fabric]
93,959
Dirt to Path
6,352
Chicken Feathers
5,925
Lite Conversion
4,415
Tiny Fuel
29,933

You Might Also Like

Fragmentum [NeoForge Edition]
The lightweight framework for the Obscuria Collection multi-loader mods
992,307
Iguana Lib
An iguana lib core for my mods.
992,164
Potentials
Library to allow mod developers to use cross platform capabilities
981,373
SDM Engine Core
The game engine in Minecraft!
980,484
Vivecraft
A Minecraft VR mod on a loader of your choice!
9,988,339
Athena
A crossplatform (Forge/Fabric) solution to connected block textures for 1.19.4+
99,799,527