Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,31 @@ jobs:
signing_key: ${{ secrets.SIGNING_KEY }}
signing_public_key: ${{ secrets.SIGNING_PUBLIC_KEY }}
signing_password: ${{ secrets.SIGNING_PASSWORD }}
network:
uses: ./.github/workflows/build_and_test.yml
with:
module: network
module_id: anvillib-network
mod_id: anvillib_network
ci_build: true
pr_build: false
secrets:
maven_url: ${{ secrets.MAVEN_URL }}
maven_user: ${{ secrets.MAVEN_USER }}
maven_pass: ${{ secrets.MAVEN_PASS }}
network-maven-central-deploy:
uses: ./.github/workflows/publish_maven_central.yml
needs:
- network
with:
module: network
module_id: anvillib-network
secrets:
maven_central_username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
maven_central_password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
signing_key: ${{ secrets.SIGNING_KEY }}
signing_public_key: ${{ secrets.SIGNING_PUBLIC_KEY }}
signing_password: ${{ secrets.SIGNING_PASSWORD }}
recipe:
needs:
- config
Expand Down Expand Up @@ -146,6 +171,7 @@ jobs:
- config
- integration
- moveable-entity-block
- network
- recipe
- registrum
uses: ./.github/workflows/build_and_test.yml
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,24 @@ jobs:
signing_public_key: ${{ secrets.SIGNING_PUBLIC_KEY }}
signing_password: ${{ secrets.SIGNING_PASSWORD }}

network:
uses: ./.github/workflows/build_and_test.yml
with:
module: network
module_id: anvillib-network
mod_id: anvillib_network
ci_build: true
pr_build: true
secrets:
maven_url: ${{ secrets.MAVEN_URL }}
maven_user: ${{ secrets.MAVEN_USER }}
maven_pass: ${{ secrets.MAVEN_PASS }}
maven_central_username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
maven_central_password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
signing_key: ${{ secrets.SIGNING_KEY }}
signing_public_key: ${{ secrets.SIGNING_PUBLIC_KEY }}
signing_password: ${{ secrets.SIGNING_PASSWORD }}

recipe:
needs:
- config
Expand Down Expand Up @@ -110,6 +128,7 @@ jobs:
- config
- integration
- moveable-entity-block
- network
- recipe
- registrum
uses: ./.github/workflows/build_and_test.yml
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,31 @@ jobs:
signing_key: ${{ secrets.SIGNING_KEY }}
signing_public_key: ${{ secrets.SIGNING_PUBLIC_KEY }}
signing_password: ${{ secrets.SIGNING_PASSWORD }}
network:
uses: ./.github/workflows/build_and_test.yml
with:
module: network
module_id: anvillib-network
mod_id: anvillib_network
ci_build: false
pr_build: false
secrets:
maven_url: ${{ secrets.MAVEN_URL }}
maven_user: ${{ secrets.MAVEN_USER }}
maven_pass: ${{ secrets.MAVEN_PASS }}
network-maven-central-deploy:
uses: ./.github/workflows/publish_maven_central.yml
needs:
- network
with:
module: network
module_id: anvillib-network
secrets:
maven_central_username: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
maven_central_password: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
signing_key: ${{ secrets.SIGNING_KEY }}
signing_public_key: ${{ secrets.SIGNING_PUBLIC_KEY }}
signing_password: ${{ secrets.SIGNING_PASSWORD }}
recipe:
needs:
- config
Expand Down Expand Up @@ -146,6 +171,7 @@ jobs:
- config
- integration
- moveable-entity-block
- network
- recipe
- registrum
uses: ./.github/workflows/build_and_test.yml
Expand Down
74 changes: 61 additions & 13 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,24 @@
[![Minecraft](https://img.shields.io/badge/Minecraft-1.21.1-green.svg)](https://minecraft.net/)
[![Maven Central](https://img.shields.io/maven-central/v/dev.anvilcraft.lib/anvillib-neoforge-1.21.1)](https://central.sonatype.com/search?q=anvillib)
[![NeoForge](https://img.shields.io/badge/NeoForge-21.1.x-orange.svg)](https://neoforged.net/)
[![License](https://img.shields.io/badge/License-MIT%20License-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)
[![License](https://img.shields.io/badge/License-MIT%20License-blue.svg)](https://opensource.org/licenses/MIT)

**AnvilLib** is a NeoForge mod library developed by [Anvil Dev](https://github.com/Anvil-Dev), providing Minecraft mod developers with a series of practical tools and frameworks.
**AnvilLib** is a NeoForge mod library developed by [Anvil Dev](https://github.com/Anvil-Dev), providing Minecraft mod developers with a
series of practical tools and frameworks.

## Features

AnvilLib adopts a modular design and includes the following functional modules:

| Module | Description |
|---------------------------|---------------|
| **Config** | Annotation-based configuration system |
| **Integration** | Mod compatibility integration framework |
| **Recipe** | In-world recipe system |
| **Moveable Entity Block** | Support for block entities movable by pistons |
| **Registrum** | Simplified registration system |
| Module | Description |
|---------------------------|---------------------------------------------------|
| **Config** | Annotation-based configuration system |
| **Integration** | Mod compatibility integration framework |
| **Network** | Networking API with automatic packet registration |
| **Recipe** | In-world recipe system |
| **Moveable Entity Block** | Support for block entities movable by pistons |
| **Registrum** | Simplified registration system |
| **Main** | Aggregated module that bundles all submodules |

## Module Introduction

Expand All @@ -36,7 +39,8 @@ Provides an annotation-based configuration management system to simplify the def
**Usage Example:**

```java
@Config(name = "my_mod", typebirdsprite_ModConfig.Type.COMMON)

@Config(name = "my_mod", type = ModConfig.Type.COMMON)
public class MyModConfig {
@Comment("Enable debug mode")
public boolean debugMode = false;
Expand All @@ -63,6 +67,7 @@ Provides a framework for mod integrations, supporting automatic loading of integ
**Usage Example:**

```java

@Integration(value = "jei", version = "[19.0,)")
public class JEIIntegration {
public void init() {
Expand All @@ -71,6 +76,27 @@ public class JEIIntegration {
}
```

### Network Module

Provides a NeoForge networking abstraction with package-based packet auto-registration.

**Key Features:**

- Define packet direction using `IClientboundPacket` / `IServerboundPacket` / `IInsensitiveBiPacket`
- Automatically register packet classes in a package via `NetworkRegistrar.register(...)`
- Supports `PLAY`, `CONFIGURATION`, and `COMMON` protocols

**Usage Example:**

```java

@SubscribeEvent
public static void onRegisterPayload(RegisterPayloadHandlersEvent event) {
PayloadRegistrar registrar = event.registrar("1");
NetworkRegistrar.register(registrar, "my_mod");
}
```

### Recipe Module

Provides an in-world recipe system, allowing recipes to be executed in the world (rather than in crafting tables).
Expand Down Expand Up @@ -117,7 +143,8 @@ public class MyBlock extends Block implements IMoveableEntityBlock {

### Registrum Module

A registration system based on [Registrate](https://github.com/IThundxr/Registrate), simplifying the registration process for items, blocks, entities, etc.
A registration system based on [Registrate](https://github.com/IThundxr/Registrate), simplifying the registration process for items, blocks,
entities, etc.

**Key Features:**

Expand All @@ -137,6 +164,17 @@ public static final RegistryEntry<Item> MY_ITEM = REGISTRUM
.register();
```

### Main Module

`anvillib-neoforge-1.21.1` is the aggregate artifact. It bundles and re-exports:

- `config`
- `integration`
- `network`
- `recipe`
- `moveable-entity-block`
- `registrum`

## Dependency Integration

### Gradle (Groovy DSL)
Expand All @@ -153,6 +191,7 @@ dependencies {
// Or import individual modules as needed
implementation "dev.anvilcraft.lib:anvillib-config-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-integration-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-network-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-recipe-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-moveable-entity-block-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-registrum-neoforge-1.21.1:2.0.0"
Expand All @@ -168,18 +207,26 @@ repositories {

dependencies {
implementation("dev.anvilcraft.lib:anvillib-neoforge-1.21.1:2.0.0")

// Optional single-module example
implementation("dev.anvilcraft.lib:anvillib-network-neoforge-1.21.1:2.0.0")
}
```

> Keep the dependency version aligned with release tags (current project property is `mod_version=2.0.0`).

## Building the Project

```bash
# Clone repository
git clone https://github.com/Anvil-Dev/AnvilLib.git
cd AnvilLib

# Build
# Build on macOS / Linux
./gradlew build

# Build on Windows (PowerShell / CMD)
gradlew.bat build
```

## Requirements
Expand All @@ -192,7 +239,8 @@ cd AnvilLib

This project is licensed under the [MIT License](https://www.opensource.org/licenses/MIT).

Part of the Registrum module code is based on [Registrate](https://github.com/IThundxr/Registrate) and follows the Mozilla Public License 2.0.
Part of the Registrum module code is based on [Registrate](https://github.com/IThundxr/Registrate) and follows the Mozilla Public License
2.0.

## Author

Expand Down
63 changes: 54 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
[![Minecraft](https://img.shields.io/badge/Minecraft-1.21.1-green.svg)](https://minecraft.net/)
[![Maven Central](https://img.shields.io/maven-central/v/dev.anvilcraft.lib/anvillib-neoforge-1.21.1)](https://central.sonatype.com/search?q=anvillib)
[![NeoForge](https://img.shields.io/badge/NeoForge-21.1.x-orange.svg)](https://neoforged.net/)
[![License](https://img.shields.io/badge/License-MIT%20License-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)
[![License](https://img.shields.io/badge/License-MIT%20License-blue.svg)](https://opensource.org/licenses/MIT)

**AnvilLib** 是一个由 [Anvil Dev](https://github.com/Anvil-Dev) 开发的 NeoForge 模组库,为 Minecraft 模组开发者提供一系列实用的工具和框架。

## 特性

AnvilLib 采用模块化设计,包含以下功能模块:

| 模块 | 说明 |
|---------------------------|---------------|
| **Config** | 基于注解的配置系统 |
| **Integration** | 模组兼容性集成框架 |
| **Recipe** | 世界内配方系统 |
| **Moveable Entity Block** | 可被活塞推动的方块实体支持 |
| **Registrum** | 简化的注册系统 |
| 模块 | 说明 |
|---------------------------|----------------|
| **Config** | 基于注解的配置系统 |
| **Integration** | 模组兼容性集成框架 |
| **Network** | 网络通信与数据包自动注册框架 |
| **Recipe** | 世界内配方系统 |
| **Moveable Entity Block** | 可被活塞推动的方块实体支持 |
| **Registrum** | 简化的注册系统 |
| **Main** | 聚合模块(包含全部子模块) |

## 模块介绍

Expand All @@ -36,6 +38,7 @@ AnvilLib 采用模块化设计,包含以下功能模块:
**使用示例:**

```java

@Config(name = "my_mod", type = ModConfig.Type.COMMON)
public class MyModConfig {
@Comment("启用调试模式")
Expand Down Expand Up @@ -63,6 +66,7 @@ MyModConfig config = ConfigManager.register("my_mod", MyModConfig::new);
**使用示例:**

```java

@Integration(value = "jei", version = "[19.0,)")
public class JEIIntegration {
public void init() {
Expand All @@ -71,6 +75,27 @@ public class JEIIntegration {
}
```

### Network 模块

提供面向 NeoForge 的网络通信抽象,支持按包扫描并自动注册数据包。

**主要特性:**

- 使用 `IClientboundPacket` / `IServerboundPacket` / `IInsensitiveBiPacket` 定义通信方向
- 通过 `NetworkRegistrar.register(...)` 自动注册同一包下的数据包
- 支持 `PLAY` / `CONFIGURATION` / `COMMON` 三种协议通道

**使用示例:**

```java

@SubscribeEvent
public static void onRegisterPayload(RegisterPayloadHandlersEvent event) {
PayloadRegistrar registrar = event.registrar("1");
NetworkRegistrar.register(registrar, "my_mod");
}
```

### Recipe 模块

提供世界内配方系统,允许定义在世界中(而非工作台)执行的配方。
Expand Down Expand Up @@ -137,6 +162,17 @@ public static final RegistryEntry<Item> MY_ITEM = REGISTRUM
.register();
```

### Main 模块

`anvillib-neoforge-1.21.1` 为聚合发行模块,默认打包并重导出以下子模块:

- `config`
- `integration`
- `network`
- `recipe`
- `moveable-entity-block`
- `registrum`

## 依赖引入

### Gradle (Groovy DSL)
Expand All @@ -153,6 +189,7 @@ dependencies {
// 或按需引入单独模块
implementation "dev.anvilcraft.lib:anvillib-config-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-integration-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-network-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-recipe-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-moveable-entity-block-neoforge-1.21.1:2.0.0"
implementation "dev.anvilcraft.lib:anvillib-registrum-neoforge-1.21.1:2.0.0"
Expand All @@ -168,18 +205,26 @@ repositories {

dependencies {
implementation("dev.anvilcraft.lib:anvillib-neoforge-1.21.1:2.0.0")

// 按需引入示例
implementation("dev.anvilcraft.lib:anvillib-network-neoforge-1.21.1:2.0.0")
}
```

> 版本号建议与项目发布版本保持一致(当前工程配置为 `mod_version=2.0.0`)。

## 构建项目

```bash
# 克隆仓库
git clone https://github.com/Anvil-Dev/AnvilLib.git
cd AnvilLib

# 构建
# macOS / Linux 构建
./gradlew build

# Windows PowerShell / CMD 构建
gradlew.bat build
```

## 环境要求
Expand Down
Loading