介绍
介绍由机器翻译自 CurseForge 原页面,仅供参考。
CraftCoreLIB
CraftCoreLib 是一个为开发者打造的跨平台前置库,可简化多加载器环境下的注册流程,并提供更多实用功能!
注册
此库提供了用于简易注册方块、物品、创造模式物品栏标签,以及配方类型、配方序列化器、菜单等内容的核心代码,更多功能即将推出!!
使用示例
public class ModBlocks {
// Simple Block registration
public static final ObjectRegistries<Block> MY_BLOCK = ObjectRegistries.registerBlock(
ResourceLocation.fromNamespaceAndPath("yourmoid", "my_block"),
()-> new Block(BlockBehaviour.Properties.of()));
// It must stay empty, call it on related Init class(for fabric the one implementing ModInitializer for neoforge the class with the @Mod annotation)
public static void init() {}
}
在初始化时注册所有内容:
– Fabric -> ModInitializer 类
– NeoForge -> @Mod 注解类
// Placeholder
public void init() {
ModBlocks.init();
}
then if Neoforge do this:
private void onRegister(RegisterEvent event) {
ObjectRegistries.createAll("yourmoid", event.getRegistry());
}
if Fabric inside ModInitializer, after all your init add this:
ObjectRegistries.createAll("yourmoid");
配置
CraftCoreLIB 还提供了专用的配置系统和自定义配置界面,并兼容其他模组!!
使用示例:
public class ModConfigs {
//Defining all your configs, ConfigValue<> accept all type of configs, Integer, Boolean, Enum, String even your custom one
public static final ConfigValue<Boolean> check;
public static final ConfigValue<Integer> i;
//The config Builder where we build our configs, the constructur needs the modid and the env type: CLIENT, SERVER or COMMON
public static final ConfigBuilder BUILDER = new ConfigBuilder("mod_id", ConfigType.CLIENT);
//Inside a static method we register our configs
static {
//Category 1 creantion, we call start to start a category and end to close it, everything behind them is register into the first category
BUILDER.strart("category1");
//All the configs you desire to insert onto the 1° category should go there.
//The define method accept Integer, Boolean, Enum, String even you custom one!
this.check = BUILDER.comment("allows to check something")
.defineBoolean("check", false);
BUILDER.end();
//Category 2 creation or how many you want
BUILDER.strart("category2");
this.i = BUILDER.comment("allows to check something")
.defineInt("i",MINVALUE 0, MAXVALUE 10, DEFAULT VALUE 5);
BUILDER.end();
//It's also possible to create a main category with each sub category
BUILDER.start("main");
BUILDER.start("category3");
this.check = BUILDER.comment("allows to check something")
.defineBoolean("check", false);
this.i = BUILDER.comment("allows to check something")
.defineInt("i",MINVALUE 0, MAXVALUE 10, DEFAULT VALUE 5);
BUILDER.end();
BUILDER.end();
}
public static void init() {
BUILDER.build();
}
}
网络构建器
功能包括:
– 创建和处理自定义数据包
– 创建网络
– 注册网络
了解更多,请查看 GitHub 信息
我的其他项目
常见问题
CraftCoreLIB 支持哪些 Minecraft 版本?
CraftCoreLIB 支持 Minecraft Java 版 1.21.1–26.3,共 4 个版本,可用的加载器:Fabric / NeoForge。下载时注意选择和你游戏版本一致的文件。
CraftCoreLIB 怎么安装?
先用 PCL2 或 HMCL 启动器安装对应版本的 Fabric / NeoForge,再把下载的 .jar 文件放进游戏目录的 mods 文件夹,重新启动游戏即可。开启了版本隔离的,mods 文件夹在 versions/版本名 下面。
Tier1234 的其他作品
查看全部 →
Toggleable Enchantments
by LIUKRAST, Tier1234
可切换启用或禁用附魔效果。
6.5万
1 个月前
Modrinth · CurseForge
BetterDeco: Vanilla Furniture Mod
by Tier1234
时尚且贴近原版的装饰
4.1万
3 天前
Modrinth · CurseForge
Wilderness Bound Backport
by Tier1234
将 Minecraft 26.3 版本的功能移植到较新版本
3万
5 天前
Modrinth · CurseForge
MinecraftAdditions
by Tier1234
这个模组新增了一些矿石、盔甲和模板。制作模组百科来发现所有秘密!此外还加入了新的功能、标签、变量、生物群系等内容。 下载体验这个模组带来的新内容!我计划将模组移植到 1.21.5。
1.3万
1 年前
Modrinth · CurseForge



评论
登录后评论和评分