介绍
中文介绍正在准备中,下面暂时显示原文。
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 newBlockItembased 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 anIdentifierthen callsmatches(Identifier)
Identifier Extensions
String.id– converts the String to anIdentifierPair.id– converts the Pair to anIdentifierIdentifier.component1() and .component2()– allows for destructuring ofIdentifiersString.validId()– checks if the String is a validIdentifierPair.validId()checks if the Pair is a validIdentifier
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 asBlock::matches
NBT Tag Extensions
compooundTag(vararg Pair)– creates a newCompoundTagwith the given elementsCompoundTag.set(String, Tag)– operator forCompoundTag::putMap.toCompoundTag()– creates a newCompoundTagfrom the map’s elementsAny?.toTag()– Creates a newTagfrom 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 forEntityandBlockEntitysubclasses.
Registry Extensions
Registry.get(String)– converts to anIdentifierand gets the value in the RegistryRegistry.set(Identifier or String, T)– Registers the value in the Registry usingRegistry.registerIdentifier.item() and .block() and .entityType() and .blockEntityType() and .registry()– gets the value
at theIdentifierin the appropriate Registry
Tag Extensions
Identifier.tag()– gets aTagat theIdentifier. Only valid for Item, Block, EntityType, and Fluid.
Any other type will crash the game.String.tag()– converts to anIdentifierand gets theTagat itTag.isEqual(Tag)–Tag.equalsis not properly overridden. Use this to compare equality with tags.
World Extensions
World.runOnClient(()-Unit)– Runs the passed function only on the clientWorld.runOnServer(()-Unit)– Runs the passed function only on the server
常见问题
Kotlin Extensions [Fabric] 支持哪些 Minecraft 版本?
Kotlin Extensions [Fabric] 支持 Minecraft Java 版 1.15.2,可用的加载器:Fabric。下载时注意选择和你游戏版本一致的文件。
Kotlin Extensions [Fabric] 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
评论
登录后评论和评分