diff --git a/README.md b/README.md index d492f90..57129c5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # Redstone Computer Utilities -> Lightweight and Modular Redstone Computer Debugging Tools. +> Lightweight and Modular Redstone Computer Debugging Tools. [English README](./README.md) | [简体中文简介](./README.zh_cn.md) @@ -19,12 +19,23 @@ ## Installation -This mod supports Minecraft 1.19.2 and requires the latest Fabric Loader and Fabric API. +This mod supports Minecraft 1.16-1.19.2 and requires Java 17, the latest Fabric Loader and the latest Fabric API. Only server-side installation is required for multiplayer and client-side installation is required for singleplayer. Python 3.7.2 or newer (CPython or PyPy) is required to use the provided Python library. +```sh +$ pip install redstone-computer-utilities +``` + +or + +```toml +# pyproject.toml +redstone-computer-utilities = "^0.2.0" +``` + ## Basic Usage 1. Execute `/rcu` to receive a wand item (or pick a pink dye by yourself). diff --git a/README.zh_cn.md b/README.zh_cn.md index 7965a4b..2a6fdd3 100644 --- a/README.zh_cn.md +++ b/README.zh_cn.md @@ -19,12 +19,23 @@ ## 安装 -支持 Minecraft 1.19.2,需要安装最新的 Fabric Loader 和 Fabric API。 +支持 Minecraft 1.16-1.19.2,需要安装 Java 17、最新的 Fabric Loader 和最新的 Fabric API。 多人游戏只需要安装在服务器侧,单人游戏需要安装在客户端侧。 需要安装 Python 3.7.2 或更新版本(CPython 或 PyPy)来使用提供的 Python 库。 +```sh +$ pip install redstone-computer-utilities +``` + +或者 + +```toml +# pyproject.toml +redstone-computer-utilities = "^0.2.0" +``` + ## 基础用法 1. 执行 `/rcu` 来获取一个魔杖物品(也可以直接拿一个粉红色染料)。 diff --git a/build.gradle b/build.gradle index be060de..efed141 100644 --- a/build.gradle +++ b/build.gradle @@ -12,7 +12,7 @@ sourceCompatibility = JavaVersion.VERSION_17 targetCompatibility = JavaVersion.VERSION_17 archivesBaseName = project.archives_base_name -version = "${project.mod_version}-mc1.19.2+${buildMetadata()}" +version = "${project.mod_version}-mc1.19+${buildMetadata()}" group = project.maven_group def buildMetadata() { diff --git a/docs/PyPI.md b/docs/PyPI.md new file mode 100644 index 0000000..5cf6522 --- /dev/null +++ b/docs/PyPI.md @@ -0,0 +1,22 @@ +icon + +# Redstone Computer Utilities + +> Lightweight and Modular Redstone Computer Debugging Tools. + +## Installation + +Python 3.7.2 or newer (CPython or PyPy) is required. + +```sh +$ pip install redstone-computer-utilities +``` + +or + +```toml +# pyproject.toml +redstone-computer-utilities = "^0.2.0" +``` + +### Check the GitHub repository [NKID00/redstone-computer-utilities](https://github.com/NKID00/redstone-computer-utilities) for details. \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 629e0bf..1e0b71e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,16 +1,16 @@ # Done to increase the memory available to gradle. - org.gradle.jvmargs=-Xmx1G + org.gradle.jvmargs=-Xmx1G # Fabric Properties - # check these on https://fabricmc.net/develop - minecraft_version=1.19.2 - yarn_mappings=1.19.2+build.8 - loader_version=0.14.9 + # check these on https://fabricmc.net/develop + minecraft_version=1.19 + yarn_mappings=1.19+build.4 + loader_version=0.14.9 # Mod Properties - mod_version = 0.2.0 - maven_group = name.nkid00 - archives_base_name = redstone-computer-utilities + mod_version = 0.2.1 + maven_group = name.nkid00 + archives_base_name = redstone-computer-utilities # Dependencies - fabric_version=0.60.0+1.19.2 + fabric_version=0.58.0+1.19 diff --git a/pyproject.toml b/pyproject.toml index 514bb08..e2d0d8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,9 +1,11 @@ [tool.poetry] name = "redstone-computer-utilities" -version = "0.2.0" -description = "Simple debug tools for redstone computers." +version = "0.2.0.post3" +description = "Lightweight and Modular Redstone Computer Debugging Tools." authors = ["NKID00 "] +readme = "docs/PyPI.md" license = "MPL-2.0" +homepage = "https://github.com/NKID00/redstone-computer-utilities" [tool.poetry.dependencies] python = "^3.7.2" diff --git a/src/main/java/name/nkid00/rcutil/command/RcuInfoInterface.java b/src/main/java/name/nkid00/rcutil/command/RcuInfoInterface.java index c76003b..d978d87 100644 --- a/src/main/java/name/nkid00/rcutil/command/RcuInfoInterface.java +++ b/src/main/java/name/nkid00/rcutil/command/RcuInfoInterface.java @@ -19,7 +19,7 @@ public static int execute(CommandContext c) throws CommandS public static int executeDetail(CommandContext c) throws CommandSyntaxException { var s = c.getSource(); - var player = s.getPlayer(); + var player = CommandHelper.playerOrNull(s); var uuid = CommandHelper.uuidOrNull(s); var args = ArgumentHelper.getMulti(c, "interface name..."); int result = 0; diff --git a/src/main/java/name/nkid00/rcutil/helper/CommandHelper.java b/src/main/java/name/nkid00/rcutil/helper/CommandHelper.java index 1dfc28b..7666a7c 100644 --- a/src/main/java/name/nkid00/rcutil/helper/CommandHelper.java +++ b/src/main/java/name/nkid00/rcutil/helper/CommandHelper.java @@ -48,8 +48,12 @@ public static UUID uuidOrNull(ServerCommandSource s) { return player.getUuid(); } + public static ServerPlayerEntity playerOrNull(ServerCommandSource s) throws CommandSyntaxException { + return s.getPlayer(); + } + public static ServerPlayerEntity requirePlayer(ServerCommandSource s) throws CommandSyntaxException { - var player = s.getPlayer(); + var player = playerOrNull(s); if (player == null) { throw NOT_PLAYER_ENTITY_EXCEPTION.create(); } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index d9766be..795fac2 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,32 +1,32 @@ { - "schemaVersion": 1, - "id": "rcutil", - "version": "${version}", - "name": "Redstone Computer Utilities", - "description": "Simple debug tools for redstone computers.", - "authors": [ - "NKID00" - ], - "contact": { - "homepage": "https://github.com/NKID00/redstone-computer-utilities", - "sources": "https://github.com/NKID00/redstone-computer-utilities", - "issues": "https://github.com/NKID00/redstone-computer-utilities" - }, - "license": "MIT", - "icon": "assets/rcutil/icon.png", - "environment": "*", - "entrypoints": { - "main": [ - "name.nkid00.rcutil.RCUtil" - ] - }, - "mixins": [ - "rcutil.mixins.json" - ], - "accessWidener" : "rcutil.accesswidener", - "depends": { - "fabricloader": ">=0.12", - "fabric": "*", - "minecraft": "1.19.2" - } -} + "schemaVersion": 1, + "id": "rcutil", + "version": "${version}", + "name": "Redstone Computer Utilities", + "description": "Simple debug tools for redstone computers.", + "authors": [ + "NKID00" + ], + "contact": { + "homepage": "https://github.com/NKID00/redstone-computer-utilities", + "sources": "https://github.com/NKID00/redstone-computer-utilities", + "issues": "https://github.com/NKID00/redstone-computer-utilities/issues" + }, + "license": "MIT", + "icon": "assets/rcutil/icon.png", + "environment": "*", + "entrypoints": { + "main": [ + "name.nkid00.rcutil.RCUtil" + ] + }, + "mixins": [ + "rcutil.mixins.json" + ], + "accessWidener": "rcutil.accesswidener", + "depends": { + "fabricloader": ">=0.12", + "fabric": "*", + "minecraft": "~1.19" + } +} \ No newline at end of file diff --git a/src/main/resources/rcutil.accesswidener b/src/main/resources/rcutil.accesswidener index c3bf69a..dbdeb26 100644 --- a/src/main/resources/rcutil.accesswidener +++ b/src/main/resources/rcutil.accesswidener @@ -1,15 +1,3 @@ -accessWidener v1 named +accessWidener v1 named accessible field net/minecraft/server/command/ServerCommandSource output Lnet/minecraft/server/command/CommandOutput; -accessible field net/minecraft/server/command/ServerCommandSource position Lnet/minecraft/util/math/Vec3d; -accessible field net/minecraft/server/command/ServerCommandSource world Lnet/minecraft/server/world/ServerWorld; -accessible field net/minecraft/server/command/ServerCommandSource level I -accessible field net/minecraft/server/command/ServerCommandSource name Ljava/lang/String; -accessible field net/minecraft/server/command/ServerCommandSource displayName Lnet/minecraft/text/Text; accessible field net/minecraft/server/command/ServerCommandSource server Lnet/minecraft/server/MinecraftServer; -accessible field net/minecraft/server/command/ServerCommandSource silent Z -accessible field net/minecraft/server/command/ServerCommandSource entity Lnet/minecraft/entity/Entity; -accessible field net/minecraft/server/command/ServerCommandSource resultConsumer Lcom/mojang/brigadier/ResultConsumer; -accessible field net/minecraft/server/command/ServerCommandSource entityAnchor Lnet/minecraft/command/argument/EntityAnchorArgumentType$EntityAnchor; -accessible field net/minecraft/server/command/ServerCommandSource rotation Lnet/minecraft/util/math/Vec2f; -accessible field net/minecraft/server/command/ServerCommandSource signedArguments Lnet/minecraft/network/message/SignedCommandArguments; -accessible field net/minecraft/server/command/ServerCommandSource messageChainTaskQueue Lnet/minecraft/util/thread/FutureQueue; diff --git a/src/main/resources/rcutil.mixins.json b/src/main/resources/rcutil.mixins.json index 4d975d7..8ec7e40 100644 --- a/src/main/resources/rcutil.mixins.json +++ b/src/main/resources/rcutil.mixins.json @@ -1,15 +1,14 @@ { - "required": true, - "minVersion": "0.8", - "package": "name.nkid00.rcutil.mixin", - "compatibilityLevel": "JAVA_17", - "mixins": [ - "MinecraftServerMixin", - "AbstractBlockMixin" - ], - "client": [ - ], - "injectors": { - "defaultRequire": 1 - } -} + "required": true, + "minVersion": "0.8", + "package": "name.nkid00.rcutil.mixin", + "compatibilityLevel": "JAVA_17", + "mixins": [ + "MinecraftServerMixin", + "AbstractBlockMixin" + ], + "client": [], + "injectors": { + "defaultRequire": 1 + } +} \ No newline at end of file