CraftCoreLIB
CraftCoreLib 是一个跨平台库,专为开发者打造,旨在简化多加载器环境下的注册流程并提供更多功能!
注册表 (Registries)
本库为核心注册表提供了基础代码,支持方块、物品、创造模式标签页等简单注册,以及配方类型、配方序列化器、菜单等更多即将推出的内容。
使用示例
public class ModBlocks {
// 简单的方块注册
public static final ObjectRegistries<Block> MY_BLOCK = ObjectRegistries.registerBlock(
ResourceLocation.fromNamespaceAndPath("yourmoid", "my_block"),
() -> new Block(BlockBehaviour.Properties.of()));
// 此方法必须保持为空,并在相关的初始化类中调用(对于 Fabric 是实现了 ModInitializer 的类,对于 NeoForge 是带有 @Mod 注解的类)
public static void init() {}
}
并在我们的设置中初始化所有注册表:
- Fabric -> ModInitializer 类
- NeoForge -> @Mod 注解类
// 占位符
public void init() {
ModBlocks.init();
}
// 如果是 NeoForge,请执行以下操作:
private void onRegister(RegisterEvent event) {
ObjectRegistries.createAll("yourmoid", event.getRegistry());
}
// 如果在 Fabric 的 ModInitializer 内部,请在所有初始化完成后添加以下内容:
ObjectRegistries.createAll("yourmoid");
配置文件 (Configs)
CraftCoreLIB 还提供了一个专用的配置系统,拥有与其他模组兼容的自定义配置界面!
使用示例
public class ModConfigs {
// 定义所有配置项,ConfigValue<> 接受所有类型的配置,包括 Integer、Boolean、Enum、String 甚至自定义类型
public static final ConfigValue<Boolean> check;
public static final ConfigValue<Integer> i;
// 配置构建器,用于构建我们的配置,构造函数需要 modid 和环境类型:CLIENT(客户端)、SERVER(服务器)或 COMMON(通用)
public static final ConfigBuilder BUILDER = new ConfigBuilder("mod_id", ConfigType.CLIENT);
// 在静态方法中注册我们的配置
static {
// 类别 1 创建,我们调用 start 开始一个类别,end 关闭它,它们之后的所有内容都注册到第一个类别中
BUILDER.strart("category1");
// 您希望插入到第 1° 类别中的所有配置都应放在这里。
// define 方法接受 Integer、Boolean、Enum、String 甚至自定义类型!
this.check = BUILDER.comment("allows to check something")
.defineBoolean("check", false);
BUILDER.end();
// 类别 2 创建,或者您可以创建任意数量的类别
BUILDER.strart("category2");
this.i = BUILDER.comment("allows to check something")
.defineInt("i",MINVALUE 0, MAXVALUE 10, DEFAULT VALUE 5);
BUILDER.end();
// 也可以创建一个主类别,其中包含每个子类别
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();
}
}
配置界面
它具有一个易于访问的专用配置界面。 它还会获取所有具有配置的可用模组,这不是模组列表菜单,它仅显示具有配置的模组!!

网络构建器 (Network Builder)
具备以下功能:
- 自定义数据包创建与处理
- 网络创建
- 网络注册
更多信息请访问 GitHub
在 Discord 或 GitHub Issues 报告问题
我的其他项目
CraftCoreLIB
CraftCoreLib is a cross-plaftorm library built for developers for simplify registries on multiloader and many more features!
Registries
This lib provides core code for simple registries like blocks, items, creativetabs to recipetypes, recipe serializers menu and more coming!!
Usage Example
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() {}
}
And initialize all our registris on our setup:
- Fabric -> ModInitializer class
- NeoForge -> @Mod annotation class
// 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");
Configs
CraftCoreLIB also provides a dedicated config system with a custom config screen compatible with other mods!!
Usage Example
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();
}
}
Config Screen
It features a dedicated Config Screen easy to access. It also fetch for all the available mod with config, IT'S NOT A MODLIST MENU, IT ONLY SHOWS MOD WITH CONFIGS!!

Network Builder
It features:
- Custom Packet creation and handling
- Network Creation
- Network Registration
Chek more on GitHub
Report issues on Discord GitHub Issues
My Other Projects
下载 CraftCoreLIB
下载 CraftCoreLIB
下载 CraftCoreLIB
下载 CraftCoreLIB
下载 CraftCoreLIB
下载 CraftCoreLIB
下载 CraftCoreLIB
下载 CraftCoreLIB
下载 CraftCoreLIB
下载 CraftCoreLIB
暂无更新日志
关于这个资源的讨论、问题反馈与使用心得
还没有讨论,来发第一帖吧
你是这个资源的作者?登录后可认领此资源。
相似资源
模组
一个用于收集生物掉落物的多区块模组。
模组
显示你正在注视的方块的信息。(适用于 Minecraft 1.16+ 的 Hwyla/Waila 分支)
模组
查看物品与配方
模组
在游戏画面角落显示附近世界地形、玩家、生物和实体的地图。可创建路径点,帮助你找到标记过的位置。
模组
使用 JavaScript 编辑配方、添加自定义物品、编写世界事件!
模组
适用于 MC 1.18+ 的 Effekseer 加载器
评论 0
登录后参与评分
还没有评论,来抢沙发吧