diff --git a/README.md b/README.md index 995fb02..ac86038 100644 --- a/README.md +++ b/README.md @@ -236,20 +236,27 @@ ModFactory 不仅做模组,也能设计和验证整合包: ## 环境要求 -- **AI Agent**:Claude Code / Cursor / 通用 Agent(能读写文件、执行命令) -- **Java 21+**:Minecraft 1.21.11 运行环境 -- **Node.js 18+**:MCP 服务运行环境 -- **Blockbench**:3D 模型编辑器(可选,实体管线需要) -- **PowerShell**:纹理引擎运行环境 +| 组件 | Windows | macOS | Linux | +|------|---------|-------|-------| +| AI Agent | Claude Code / Cursor / 通用 Agent | 同左 | 同左 | +| Java 21+ | [Adoptium](https://adoptium.net/) | `brew install openjdk@21` | `apt install openjdk-21-jdk` | +| Node.js 18+ | [nodejs.org](https://nodejs.org/) | `brew install node` | `apt install nodejs` | +| Blockbench | [blockbench.net](https://www.blockbench.net/) | `brew install --cask blockbench` | AppImage | +| PowerShell | 系统自带 | `brew install powershell` | `apt install powershell` | + +> PowerShell 是纹理引擎(GearFactory forge.ps1)的运行环境。macOS/Linux 用户需安装 `powershell`(pwsh)。 ## 安装 ```bash -# 一键安装(安装 MCP 服务 + 克隆 GearFactory + 配置 Claude Code) +# macOS / Linux 一键安装 +chmod +x install.sh && ./install.sh + +# Windows 一键安装 install.bat -# 或手动安装 +# 或手动安装(所有平台通用) npm install -g @mcdxai/minecraft-dev-mcp # MC 源码实时访问 npm install -g mcmodding-mcp # Fabric 官方文档检索 git clone https://github.com/buyicoder/GearFactory.git forge_engine @@ -257,6 +264,14 @@ git clone https://github.com/buyicoder/GearFactory.git forge_engine 安装后在 Claude Code 中直接使用 `/mc-mod-master` 即可触发。 +### 启动开发客户端 + +```bash +cd fabric-mod-dev +./gradlew runClient # macOS / Linux +gradlew.bat runClient # Windows +``` + ## 核心设计文档 diff --git a/docs/superpowers/plans/2026-06-10-modfactory-entity-pipeline-tools.md b/docs/superpowers/plans/2026-06-10-modfactory-entity-pipeline-tools.md index 6bb7687..72bf0f8 100644 --- a/docs/superpowers/plans/2026-06-10-modfactory-entity-pipeline-tools.md +++ b/docs/superpowers/plans/2026-06-10-modfactory-entity-pipeline-tools.md @@ -612,7 +612,11 @@ Write-Host "PASS" Run after a `runClient` session: ```powershell -powershell -NoProfile -ExecutionPolicy Bypass -File scripts\qa-runclient-check.ps1 -LogPath C:\Users\Lenovo\.cursor\projects\d-MC\terminals\.txt +# PowerShell (cross-platform via pwsh on macOS/Linux) +pwsh -NoProfile -ExecutionPolicy Bypass -File scripts/qa-runclient-check.ps1 -LogPath terminals/.txt + +# Or on Windows: +powershell -NoProfile -ExecutionPolicy Bypass -File scripts\qa-runclient-check.ps1 -LogPath terminals\.txt ``` Expected: diff --git a/fabric-mod-dev/.gitignore b/fabric-mod-dev/.gitignore new file mode 100644 index 0000000..8ffa774 --- /dev/null +++ b/fabric-mod-dev/.gitignore @@ -0,0 +1,20 @@ +# Gradle +.gradle/ +build/ + +# Minecraft runtime +run/ + +# IDE +.idea/ +*.iml +*.ipr +*.iws + +# OS +.DS_Store +Thumbs.db + +# Logs +*.log +logs/ diff --git a/fabric-mod-dev/build.gradle b/fabric-mod-dev/build.gradle new file mode 100644 index 0000000..4212703 --- /dev/null +++ b/fabric-mod-dev/build.gradle @@ -0,0 +1,69 @@ +plugins { + id 'fabric-loom' version '1.9-SNAPSHOT' + id 'maven-publish' +} + +version = project.mod_version +group = project.maven_group + +base { + archivesName = project.archives_base_name +} + +repositories { +} + +loom { + splitEnvironmentSourceSets() + + mods { + "rubythunder" { + sourceSet sourceSets.main + sourceSet sourceSets.client + } + } +} + +dependencies { + minecraft "com.mojang:minecraft:${project.minecraft_version}" + mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2" + modImplementation "net.fabricmc:fabric-loader:${project.loader_version}" + + modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" +} + +processResources { + inputs.property "version", project.version + filteringCharset "UTF-8" + + filesMatching("fabric.mod.json") { + expand "version": project.version + } +} + +tasks.withType(JavaCompile).configureEach { + it.options.release = 21 +} + +java { + withSourcesJar() + sourceCompatibility = JavaVersion.VERSION_21 + targetCompatibility = JavaVersion.VERSION_21 +} + +jar { + from("LICENSE") { + rename { "${it}_${project.base.archivesName.get()}" } + } +} + +publishing { + publications { + create("mavenJava", MavenPublication) { + artifactId = project.archives_base_name + from components.java + } + } + repositories { + } +} diff --git a/fabric-mod-dev/gradle.properties b/fabric-mod-dev/gradle.properties new file mode 100644 index 0000000..b3e6a19 --- /dev/null +++ b/fabric-mod-dev/gradle.properties @@ -0,0 +1,11 @@ +org.gradle.jvmargs=-Xmx2G +org.gradle.parallel=true + +minecraft_version=1.21.1 +yarn_mappings=1.21.1+build.3 +loader_version=0.19.3 +fabric_version=0.116.15+1.21.1 + +mod_version=1.0.0 +maven_group=com.example +archives_base_name=rubythunder diff --git a/fabric-mod-dev/gradle/wrapper/gradle-wrapper.jar b/fabric-mod-dev/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..a4b76b9 Binary files /dev/null and b/fabric-mod-dev/gradle/wrapper/gradle-wrapper.jar differ diff --git a/fabric-mod-dev/gradle/wrapper/gradle-wrapper.properties b/fabric-mod-dev/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..e2847c8 --- /dev/null +++ b/fabric-mod-dev/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/fabric-mod-dev/gradlew b/fabric-mod-dev/gradlew new file mode 100755 index 0000000..f5feea6 --- /dev/null +++ b/fabric-mod-dev/gradlew @@ -0,0 +1,252 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/fabric-mod-dev/gradlew.bat b/fabric-mod-dev/gradlew.bat new file mode 100644 index 0000000..9b42019 --- /dev/null +++ b/fabric-mod-dev/gradlew.bat @@ -0,0 +1,94 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/fabric-mod-dev/settings.gradle b/fabric-mod-dev/settings.gradle new file mode 100644 index 0000000..b02216b --- /dev/null +++ b/fabric-mod-dev/settings.gradle @@ -0,0 +1,10 @@ +pluginManagement { + repositories { + maven { + name = 'Fabric' + url = 'https://maven.fabricmc.net/' + } + mavenCentral() + gradlePluginPortal() + } +} diff --git a/fabric-mod-dev/src/client/java/com/example/client/RubyThunderModClient.java b/fabric-mod-dev/src/client/java/com/example/client/RubyThunderModClient.java new file mode 100644 index 0000000..38f25d8 --- /dev/null +++ b/fabric-mod-dev/src/client/java/com/example/client/RubyThunderModClient.java @@ -0,0 +1,17 @@ +package com.example.client; + +import com.example.RubyThunderMod; +import com.example.ModEntityTypes; +import com.example.client.model.DarkIronGolemEntityModel; +import com.example.client.renderer.DarkIronGolemEntityRenderer; +import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry; +import net.minecraft.client.render.entity.EntityRendererFactory; + +public class RubyThunderModClient implements ClientModInitializer { + @Override + public void onInitializeClient() { + EntityRendererRegistry.register(ModEntityTypes.DARK_IRON_GOLEM, DarkIronGolemEntityRenderer::new); + RubyThunderMod.LOGGER.info("Client renderers registered"); + } +} diff --git a/fabric-mod-dev/src/client/java/com/example/client/model/DarkIronGolemEntityModel.java b/fabric-mod-dev/src/client/java/com/example/client/model/DarkIronGolemEntityModel.java new file mode 100644 index 0000000..7fcc383 --- /dev/null +++ b/fabric-mod-dev/src/client/java/com/example/client/model/DarkIronGolemEntityModel.java @@ -0,0 +1,36 @@ +package com.example.client.model; + +import net.minecraft.client.model.*; +import net.minecraft.client.render.VertexConsumer; +import net.minecraft.client.render.entity.model.EntityModel; +import net.minecraft.client.util.math.MatrixStack; +import com.example.DarkIronGolemEntity; + +public class DarkIronGolemEntityModel extends EntityModel { + private final ModelPart root; + + public DarkIronGolemEntityModel(ModelPart root) { + this.root = root.getChild("body"); + } + + public static TexturedModelData getTexturedModelData() { + ModelData modelData = new ModelData(); + ModelPartData modelPartData = modelData.getRoot(); + modelPartData.addChild("body", + ModelPartBuilder.create() + .uv(0, 0) + .cuboid(-7.0F, -14.0F, -4.0F, 14.0F, 25.0F, 8.0F), + ModelTransform.NONE + ); + return TexturedModelData.of(modelData, 128, 64); + } + + @Override + public void setAngles(DarkIronGolemEntity entity, float limbAngle, float limbDistance, float animationProgress, float headYaw, float headPitch) { + } + + @Override + public void render(MatrixStack matrices, VertexConsumer vertexConsumer, int light, int overlay, int color) { + root.render(matrices, vertexConsumer, light, overlay, color); + } +} diff --git a/fabric-mod-dev/src/client/java/com/example/client/renderer/DarkIronGolemEntityRenderer.java b/fabric-mod-dev/src/client/java/com/example/client/renderer/DarkIronGolemEntityRenderer.java new file mode 100644 index 0000000..d4c218e --- /dev/null +++ b/fabric-mod-dev/src/client/java/com/example/client/renderer/DarkIronGolemEntityRenderer.java @@ -0,0 +1,20 @@ +package com.example.client.renderer; + +import com.example.DarkIronGolemEntity; +import com.example.client.model.DarkIronGolemEntityModel; +import net.minecraft.client.render.entity.EntityRendererFactory; +import net.minecraft.client.render.entity.MobEntityRenderer; +import net.minecraft.util.Identifier; + +public class DarkIronGolemEntityRenderer extends MobEntityRenderer { + private static final Identifier TEXTURE = Identifier.of("rubythunder", "textures/entity/dark_iron_golem.png"); + + public DarkIronGolemEntityRenderer(EntityRendererFactory.Context ctx) { + super(ctx, new DarkIronGolemEntityModel(DarkIronGolemEntityModel.getTexturedModelData().createModel()), 0.5F); + } + + @Override + public Identifier getTexture(DarkIronGolemEntity entity) { + return TEXTURE; + } +} diff --git a/fabric-mod-dev/src/main/java/com/example/DarkIronGolemEntity.java b/fabric-mod-dev/src/main/java/com/example/DarkIronGolemEntity.java new file mode 100644 index 0000000..420e8ae --- /dev/null +++ b/fabric-mod-dev/src/main/java/com/example/DarkIronGolemEntity.java @@ -0,0 +1,11 @@ +package com.example; + +import net.minecraft.entity.EntityType; +import net.minecraft.entity.mob.PathAwareEntity; +import net.minecraft.world.World; + +public class DarkIronGolemEntity extends PathAwareEntity { + public DarkIronGolemEntity(EntityType entityType, World world) { + super(entityType, world); + } +} diff --git a/fabric-mod-dev/src/main/java/com/example/ModEntityTypes.java b/fabric-mod-dev/src/main/java/com/example/ModEntityTypes.java new file mode 100644 index 0000000..4ca2cc2 --- /dev/null +++ b/fabric-mod-dev/src/main/java/com/example/ModEntityTypes.java @@ -0,0 +1,21 @@ +package com.example; + +import net.minecraft.entity.EntityType; +import net.minecraft.entity.SpawnGroup; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; + +public class ModEntityTypes { + public static final EntityType DARK_IRON_GOLEM = Registry.register( + Registries.ENTITY_TYPE, + Identifier.of(RubyThunderMod.MOD_ID, "dark_iron_golem"), + EntityType.Builder.create(DarkIronGolemEntity::new, SpawnGroup.MISC) + .dimensions(1.4F, 2.9F) + .build("dark_iron_golem") + ); + + public static void register() { + RubyThunderMod.LOGGER.info("Entity types registered"); + } +} diff --git a/fabric-mod-dev/src/main/java/com/example/ModItems.java b/fabric-mod-dev/src/main/java/com/example/ModItems.java new file mode 100644 index 0000000..d797e0b --- /dev/null +++ b/fabric-mod-dev/src/main/java/com/example/ModItems.java @@ -0,0 +1,27 @@ +package com.example; + +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroups; +import net.minecraft.item.SwordItem; +import net.minecraft.item.ToolMaterials; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; + +public class ModItems { + public static final Item THUNDER_SWORD = new SwordItem( + ToolMaterials.DIAMOND, + new Item.Settings() + ); + + public static void register() { + Registry.register(Registries.ITEM, + Identifier.of(RubyThunderMod.MOD_ID, "thunder_sword"), + THUNDER_SWORD); + + ItemGroupEvents.modifyEntriesEvent(ItemGroups.COMBAT).register(entries -> { + entries.add(THUNDER_SWORD); + }); + } +} diff --git a/fabric-mod-dev/src/main/java/com/example/RubyThunderMod.java b/fabric-mod-dev/src/main/java/com/example/RubyThunderMod.java new file mode 100644 index 0000000..99c5beb --- /dev/null +++ b/fabric-mod-dev/src/main/java/com/example/RubyThunderMod.java @@ -0,0 +1,28 @@ +package com.example; + +import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.itemgroup.v1.ItemGroupEvents; +import net.minecraft.item.Item; +import net.minecraft.item.ItemGroups; +import net.minecraft.registry.Registries; +import net.minecraft.registry.Registry; +import net.minecraft.util.Identifier; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class RubyThunderMod implements ModInitializer { + public static final String MOD_ID = "rubythunder"; + public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); + + @Override + public void onInitialize() { + LOGGER.info("Ruby & Thunder Mod initializing..."); + + // Register items + ModItems.register(); + // Register entities + ModEntityTypes.register(); + + LOGGER.info("Ruby & Thunder Mod initialized!"); + } +} diff --git a/fabric-mod-dev/src/main/resources/assets/rubythunder/lang/en_us.json b/fabric-mod-dev/src/main/resources/assets/rubythunder/lang/en_us.json new file mode 100644 index 0000000..aae78bf --- /dev/null +++ b/fabric-mod-dev/src/main/resources/assets/rubythunder/lang/en_us.json @@ -0,0 +1,4 @@ +{ + "item.rubythunder.thunder_sword": "Thunder Sword", + "entity.rubythunder.dark_iron_golem": "Dark Iron Golem" +} diff --git a/fabric-mod-dev/src/main/resources/assets/rubythunder/models/item/thunder_sword.json b/fabric-mod-dev/src/main/resources/assets/rubythunder/models/item/thunder_sword.json new file mode 100644 index 0000000..0749c9a --- /dev/null +++ b/fabric-mod-dev/src/main/resources/assets/rubythunder/models/item/thunder_sword.json @@ -0,0 +1,6 @@ +{ + "parent": "minecraft:item/handheld", + "textures": { + "layer0": "rubythunder:item/thunder_sword" + } +} diff --git a/fabric-mod-dev/src/main/resources/assets/rubythunder/textures/entity/dark_iron_golem.png b/fabric-mod-dev/src/main/resources/assets/rubythunder/textures/entity/dark_iron_golem.png new file mode 100644 index 0000000..26c9458 Binary files /dev/null and b/fabric-mod-dev/src/main/resources/assets/rubythunder/textures/entity/dark_iron_golem.png differ diff --git a/fabric-mod-dev/src/main/resources/assets/rubythunder/textures/item/thunder_sword.png b/fabric-mod-dev/src/main/resources/assets/rubythunder/textures/item/thunder_sword.png new file mode 100644 index 0000000..c4aceb0 Binary files /dev/null and b/fabric-mod-dev/src/main/resources/assets/rubythunder/textures/item/thunder_sword.png differ diff --git a/fabric-mod-dev/src/main/resources/fabric.mod.json b/fabric-mod-dev/src/main/resources/fabric.mod.json new file mode 100644 index 0000000..53272eb --- /dev/null +++ b/fabric-mod-dev/src/main/resources/fabric.mod.json @@ -0,0 +1,22 @@ +{ + "schemaVersion": 1, + "id": "rubythunder", + "version": "${version}", + "name": "Ruby & Thunder Mod", + "description": "Ruby tools, thunder sword, dark iron golem — generated by ModFactory", + "authors": ["ModFactory"], + "contact": {}, + "license": "MIT", + "icon": "assets/rubythunder/icon.png", + "environment": "*", + "entrypoints": { + "main": ["com.example.RubyThunderMod"], + "client": ["com.example.client.RubyThunderModClient"] + }, + "depends": { + "fabricloader": ">=0.16.9", + "minecraft": "~1.21.1", + "java": ">=21", + "fabric-api": "*" + } +} diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..9987527 --- /dev/null +++ b/install.sh @@ -0,0 +1,144 @@ +#!/usr/bin/env bash +set -euo pipefail + +# ModFactory v3.1 — macOS / Linux One-Click Install +echo "========================================" +echo " ModFactory v3.1 — One-Click Install" +echo "========================================" +echo "" + +# --------------------------------------------------------------------------- +# 0. Prerequisites check +# --------------------------------------------------------------------------- +echo "[0/5] Checking prerequisites..." + +missing=() + +command -v git >/dev/null 2>&1 || missing+=("git") +command -v node >/dev/null 2>&1 || missing+=("node") +command -v npm >/dev/null 2>&1 || missing+=("npm") + +if command -v java >/dev/null 2>&1; then + java_version=$(java -version 2>&1 | head -1 | grep -oE '[0-9]+' | head -1 || echo "0") + if [ "$java_version" -lt 21 ]; then + echo " [WARN] Java $java_version detected. Java 21+ is recommended for Minecraft 1.21.1." + else + echo " [OK] Java $java_version" + fi +else + echo " [WARN] Java not found. Minecraft 1.21.1 requires Java 21+." +fi + +if [ ${#missing[@]} -gt 0 ]; then + echo " [WARN] Missing: ${missing[*]}" + echo " Install with: brew install ${missing[*]}" +else + echo " [OK] git, node, npm found" +fi + +# PowerShell (pwsh) check — needed for texture engine scripts +if command -v pwsh >/dev/null 2>&1; then + echo " [OK] PowerShell (pwsh) found" +else + echo " [INFO] PowerShell (pwsh) not found — texture engine needs it" + echo " Install with: brew install powershell" +fi + +echo "" + +# --------------------------------------------------------------------------- +# 1. Install MCP packages +# --------------------------------------------------------------------------- +echo "[1/5] Installing mcdev-mcp (Minecraft source access)..." +if npm install -g @mcdxai/minecraft-dev-mcp 2>/dev/null; then + echo " [OK] mcdev-mcp installed" +else + echo " [SKIP] npm not available — mcdev-mcp skipped" +fi + +echo "[2/5] Installing mcmodding-mcp (Fabric docs)..." +if npm install -g mcmodding-mcp 2>/dev/null; then + echo " [OK] mcmodding-mcp installed" +else + echo " [SKIP] npm not available — mcmodding-mcp skipped" +fi + +# --------------------------------------------------------------------------- +# 3. Clone GearFactory engine +# --------------------------------------------------------------------------- +echo "[3/5] Installing GearFactory engine..." +if [ -d "forge_engine" ]; then + echo " [OK] GearFactory already present" +else + echo " [INFO] Clone from https://github.com/buyicoder/GearFactory" + if git clone https://github.com/buyicoder/GearFactory.git forge_engine 2>/dev/null; then + echo " [OK] GearFactory installed" + else + echo " [SKIP] git not available — install manually" + fi +fi + +# --------------------------------------------------------------------------- +# 4. Configure MCP servers for Claude Code +# --------------------------------------------------------------------------- +echo "[4/5] Configuring MCP servers..." +mkdir -p .claude + +MCP_CONFIG=".claude/settings.local.json" +if [ -f "$MCP_CONFIG" ]; then + echo " [SKIP] $MCP_CONFIG already exists" +else + cat > "$MCP_CONFIG" << 'MCPEOF' +{ + "mcpServers": { + "minecraft-dev": { + "command": "npx", + "args": ["-y", "@mcdxai/minecraft-dev-mcp"] + }, + "mcmodding": { + "command": "npx", + "args": ["-y", "mcmodding-mcp"] + } + } +} +MCPEOF + echo " [OK] MCP config created at $MCP_CONFIG" +fi + +# --------------------------------------------------------------------------- +# 5. Verify fabric-mod-dev builds (smoke test) +# --------------------------------------------------------------------------- +echo "[5/5] Verifying fabric-mod-dev project..." +if [ -f "fabric-mod-dev/gradlew" ]; then + chmod +x fabric-mod-dev/gradlew + echo " [INFO] Running ./gradlew build in fabric-mod-dev/..." + if (cd fabric-mod-dev && ./gradlew build --no-daemon 2>&1 | tail -3); then + echo " [OK] fabric-mod-dev builds successfully" + else + echo " [WARN] Build failed — check Java version or network" + fi +else + echo " [SKIP] fabric-mod-dev/gradlew not found (may need manual setup)" +fi + +# --------------------------------------------------------------------------- +# Done +# --------------------------------------------------------------------------- +echo "" +echo "========================================" +echo " Install Complete!" +echo "========================================" +echo "" +echo " ModFactory skills: 25 (auto-loaded)" +echo " MCP servers: mcdev-mcp + mcmodding-mcp" +echo " GearFactory: texture engine" +echo " Architecture: 5 patterns from classic mods" +echo "" +echo " Quick start:" +echo " cd fabric-mod-dev && ./gradlew runClient" +echo "" +echo " macOS tips:" +echo " - Install PowerShell for texture engine: brew install powershell" +echo " - Install Blockbench: brew install --cask blockbench" +echo " - Blockbench path: /Applications/Blockbench.app" +echo "" diff --git a/integration/mcp-ecosystem.md b/integration/mcp-ecosystem.md index 3b147a1..a38d338 100644 --- a/integration/mcp-ecosystem.md +++ b/integration/mcp-ecosystem.md @@ -96,8 +96,8 @@ if (mcdevMCP_available()) { **Status:** ✅ Connected — Blockbench MCP active on localhost:3000 **Setup:** -1. Blockbench installed: `~/AppData/Local/Programs/Blockbench/` -2. Plugin: `jasonjgardner/blockbench-mcp-plugin` loaded → `D:/MC/blockbench-mcp-plugin/dist/mcp.js` +1. Blockbench installed (see platform-specific paths in `skills/entity-designer/SKILL.md`) +2. Plugin: `jasonjgardner/blockbench-mcp-plugin` loaded → `blockbench-mcp-plugin/dist/mcp.js` (project-relative) 3. MCP endpoint: `http://localhost:3000/bb-mcp` 4. Adapter runtime connects an MCP server named `blockbench` to `http://localhost:3000/bb-mcp` diff --git a/landing/index.html b/landing/index.html index 51b1f75..bccbcfb 100644 --- a/landing/index.html +++ b/landing/index.html @@ -111,7 +111,8 @@

一行命令,全部就绪

git clone https://github.com/buyicoder/modfactory.git
cd modfactory
- install.bat + ./install.sh # macOS / Linux
+ install.bat # Windows

然后对你的 AI Agent 说:
/mc-mod-master 创建一把能召唤闪电的红宝石剑

diff --git a/mcp/blockbench-mcp.json b/mcp/blockbench-mcp.json index 5bf735a..9c271f6 100644 --- a/mcp/blockbench-mcp.json +++ b/mcp/blockbench-mcp.json @@ -2,7 +2,7 @@ "mcpServers": { "blockbench": { "command": "npx", - "args": ["tsx", "D:/MC/blockbench-mcp/apps/mcp-server/src/index.ts"], + "args": ["tsx", "blockbench-mcp/apps/mcp-server/src/index.ts"], "env": { "BLOCKBENCH_PORT": "3000" } diff --git a/skills/entity-designer/SKILL.md b/skills/entity-designer/SKILL.md index 45b462e..77af129 100644 --- a/skills/entity-designer/SKILL.md +++ b/skills/entity-designer/SKILL.md @@ -157,7 +157,10 @@ integrity-checker ← VERIFIES COMPLETENESS ### Blockbench Integration -Blockbench is available at: `C:\Users\Lenovo\AppData\Local\Programs\Blockbench\Blockbench.exe` +Blockbench is available at: +- **Windows:** `C:\Users\\AppData\Local\Programs\Blockbench\Blockbench.exe` +- **macOS:** `/Applications/Blockbench.app` (install via `brew install --cask blockbench`) +- **Linux:** `blockbench` (install via AppImage or package manager) **Workflow: Code → Import → Visual Edit → Export** @@ -182,7 +185,7 @@ Blockbench is available at: `C:\Users\Lenovo\AppData\Local\Programs\Blockbench\B // ... generated from blueprint specs ], "textures": { - "0": "D:/MC/fabric-mod-dev/src/main/resources/assets/modid/textures/entity/thunder_golem.png" + "0": "fabric-mod-dev/src/main/resources/assets/modid/textures/entity/thunder_golem.png" } } ``` diff --git a/tools/setup-minecraft-ai.sh b/tools/setup-minecraft-ai.sh new file mode 100755 index 0000000..6696f2f --- /dev/null +++ b/tools/setup-minecraft-ai.sh @@ -0,0 +1,47 @@ +#!/usr/bin/env bash +set -euo pipefail + +# ModFactory — Setup: minecraft-ai texture generator (macOS / Linux) +echo "========================================" +echo " Setup: minecraft-ai texture generator" +echo "========================================" +echo "" + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +cd "$SCRIPT_DIR" + +# Step 1: Clone minecraft-ai +if [ ! -d "minecraft-ai" ]; then + echo "[1/3] Cloning minecraft-ai..." + if git clone https://github.com/Jhon-crypt/minecraft-ai.git; then + : + else + echo "[FAIL] Could not clone. Install git or download manually." + exit 1 + fi +else + echo "[1/3] minecraft-ai already exists" +fi + +# Step 2: Install Python dependencies +echo "[2/3] Installing Python dependencies..." +if pip install torch torchvision pillow numpy; then + : +else + echo "[WARN] pip install failed. Try: pip install torch torchvision pillow numpy" +fi + +# Step 3: Verify +echo "[3/3] Verifying setup..." +if python -c "from src.minecraft_ai_generator.texture_generator import generate_texture; print('minecraft-ai ready!')" 2>/dev/null; then + echo "[OK] minecraft-ai is ready!" +else + echo "[WARN] Import test failed — check torch installation" +fi + +echo "" +echo "========================================" +echo " Setup complete!" +echo "" +echo " Usage: python -c \"from src.minecraft_ai_generator.texture_generator import generate_texture; generate_texture('your prompt here')\"" +echo "========================================"