Skip to content

🛠️ 开发者环境搭建与 Gradle 编译指南

📌 代码仓库源码声明:本 Wiki 中的文档反映了代码仓库当前的最新源码状态,可能包含尚未在 CurseForge 和 Modrinth 上发布的开发中功能或最新提交。


🏗️ 开发环境前置要求

从源码构建 True Sleep 需要准备以下工具链:

  1. Java 开发工具包 (JDK):JDK 25 或更高版本(如 Eclipse Temurin 25 或 GraalVM 25)。
  2. Git 版本控制:2.40 或更高版本。
  3. 集成开发环境 (IDE):IntelliJ IDEA 2026.1+ 或配置了 Java Extension Pack 的 VS Code。

📥 代码仓库克隆

bash
git clone https://github.com/Rifaditya/Vanilla-Outsider-True-Sleep.git
cd Vanilla-Outsider-True-Sleep

🔨 Gradle 编译构建指南

True Sleep 基于 Fabric Loom 构建体系与 Gradle 9.3+,并在构建时采用无守护进程 (--no-daemon) 规范。

1. 编译并打包 JAR 构件

bash
./gradlew build --no-daemon

编译完成的模组二进制 JAR 与源码 JAR 将生成于 build/libs/ 目录下:

  • vanilla-outsider-true-sleep-1.3.22+26.2.jar
  • vanilla-outsider-true-sleep-1.3.22+26.2-sources.jar

2. 运行无头 (Headless) 单元测试套件

bash
./gradlew test --no-daemon

3. 启动开发客户端进行调试

bash
./gradlew runClient --no-daemon

4. 启动专用独立测试服务器

bash
./gradlew runServer --no-daemon

📐 源码目录工程架构图

Vanilla-Outsider-True-Sleep/
├── build.gradle                 # Loom build script (Java 25 release)
├── gradle.properties            # Target Minecraft & mod versions
├── src/main/java/net/vanillaoutsider/truesleep/
│   ├── TrueSleep.java           # Entrypoint & ModVersionGuard init
│   ├── TrueSleepTags.java       # Datapack tag constants
│   ├── command/
│   │   └── TrueSleepCommand.java# Brigadier /truesleep command tree
│   ├── config/
│   │   ├── TrueSleepRules.java  # Namespaced GameRule definitions
│   │   ├── TrueSleepConfig.java # GSON JSON config persistence
│   │   ├── ClothConfigScreenHelper.java # Cloth Config GUI builder
│   │   └── ModMenuIntegration.java      # ModMenu API integration
│   ├── logic/
│   │   ├── TimeWarpManager.java        # Hyperspace acceleration engine
│   │   ├── BiologicalStasisHelper.java # Farm aging math & potion aging
│   │   ├── SleepHungerHelper.java      # Sleep hunger exhaustion math
│   │   └── QuietClockManager.java      # World clock interfaces
│   ├── mixin/
│   │   ├── BedRuleMixin.java           # Bed threshold override
│   │   ├── EntityMixin.java            # Drown immunity pulmonary stasis
│   │   ├── LevelMixin.java             # Machine & hopper tick multiplier
│   │   ├── LivingEntityMixin.java      # Active potion effect aging
│   │   ├── MobEffectInstanceMixin.java # Cascade duration decrement
│   │   ├── MobMixin.java               # Mob freeze & aging bridge
│   │   ├── ServerLevelMixin.java       # Sleep suppression & warp hook
│   │   └── VibrationSystemListenerMixin.java # Warden vibration mute
│   └── mixin/client/
│       ├── HudMixin.java               # Sleep black fade cancellation
│       └── SkyRendererMixin.java       # Angular celestial sky lerp
└── src/main/resources/
    ├── fabric.mod.json          # Mod metadata & dependencies
    ├── truesleep.mixins.json    # Common mixin configuration
    ├── truesleep.client.mixins.json # Client mixin configuration
    └── data/truesleep/tags/     # Machine & worker mob tags

Official documentation & web portal for Dasik Igaijinn mods.