Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
PUSH FAILED!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
ChengF3ng233 committed Aug 15, 2024
0 parents commit 1cc9e83
Show file tree
Hide file tree
Showing 6,289 changed files with 396,713 additions and 0 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/.idea/
/run/
/lib/mc/
/build/
/.gradle/
/src/main/java/cn/feng/untitled/ui/font/nano/
/src/main/java/cn/feng/untitled/music/api/base/
/ffmpeg/
/src/main/java/Test.java
674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Untitled Client
> 你可以在[我的B站](https://space.bilibili.com/538684595)看到开发日志。<br>
> ***我给广大开发者设置了一个挑战,如果你想用NanoVG绘制或使用MusicPlayer的话。***
## 基本内容
- 客户端框架(命令系统、事件系统、配置系统、模块系统、HUD系统、参数系统)
- 客户端优化
- 跨版本(1.7-1.21)
- java17
- lwjgl3

## 开发指南
请转到[这里](docs/GettingStarted.md)
73 changes: 73 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
plugins {
id("java")
id 'org.openjfx.javafxplugin' version '0.1.0'
}

group = "cn.feng"
version = "1.0-SNAPSHOT"

repositories {
mavenCentral()

maven {
name "Velocity"
url "https://nexus.velocitypowered.com/repository/maven-public/"
}

}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}

javafx {
modules = [ 'javafx.controls', 'javafx.media', 'javafx.base', 'javafx.graphics', 'javafx.swing' ]
version = '22'
platform = 'windows'
configurations = [ 'implementation', 'testImplementation' ]
}

dependencies {
implementation fileTree(dir: 'lib', includes: ['*.jar'])

implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: '5.0.0-alpha.14'
implementation group: 'org.jetbrains', name: 'annotations', version: '24.1.0'
implementation group: 'org.yaml', name: 'snakeyaml', version: '2.2'
implementation group: 'com.google.code.gson', name: 'gson', version: '2.11.0'
implementation group: 'io.netty', name: 'netty-all', version: '5.0.0.Alpha2'
implementation group: 'com.github.kokorin.jaffree', name: 'jaffree', version: '2023.09.10'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.1.0-alpha1'
implementation group: 'org.apache.logging.log4j', name: 'log4j-api', version: '3.0.0-beta2'
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '3.0.0-beta2'
implementation group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '3.0.0-beta2'

compileOnly group: 'org.projectlombok', name: 'lombok', version: '1.18.34'
annotationProcessor 'org.projectlombok:lombok:1.18.34'

// Vanilla Minecraft Libraries
implementation group: 'com.typesafe.akka', name: 'akka-actor_2.11', version: '2.3.3'
implementation group: 'com.paulscode', name: 'codecjorbis', version: '20101023'
implementation group: 'com.paulscode', name: 'codecwav', version: '20101023'
implementation group: 'commons-codec', name: 'commons-codec', version: '1.9'
implementation group: 'org.apache.commons', name: 'commons-compress', version: '1.8.1'
implementation group: 'commons-io', name: 'commons-io', version: '2.16.1'
implementation group: 'org.apache.commons', name: 'commons-lang3', version: '3.3.2'
implementation group: 'commons-logging', name: 'commons-logging', version: '1.1.3'
implementation group: 'com.google.guava', name: 'guava', version: '17.0'
implementation group: 'com.ibm.icu', name: 'icu4j-core-mojang', version: '51.2'
implementation group: 'net.sf.jopt-simple', name: 'jopt-simple', version: '4.6'
implementation group: 'com.paulscode', name: 'libraryjavasound', version: '20101123'
implementation group: 'org.scala-lang', name: 'scala-actors-migration_2.11', version: '1.1.0'
implementation group: 'org.scala-lang', name: 'scala-compiler', version: '2.11.1'
implementation group: 'org.scala-lang.plugins', name: 'scala-continuations-library_2.11', version: '1.0.2'
implementation group: 'org.scala-lang.plugins', name: 'scala-continuations-plugin_2.11.1', version: '1.0.2'
implementation group: 'org.scala-lang', name: 'scala-library', version: '2.11.1'
implementation group: 'org.scala-lang.modules', name: 'scala-parser-combinators_2.11', version: '1.0.1'
implementation group: 'org.scala-lang', name: 'scala-reflect', version: '2.11.1'
implementation group: 'org.scala-lang.modules', name: 'scala-xml_2.11', version: '1.0.2'
implementation group: 'com.paulscode', name: 'soundsystem', version: '20120107'
implementation group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.3'
implementation group: 'javax.vecmath', name: 'vecmath', version: '1.5.2'
implementation group: 'com.mojang', name: 'authlib', version: '1.5.21'
implementation group: 'oshi-project', name: 'oshi-core', version: '1.1'
}
2 changes: 2 additions & 0 deletions docs/Advanced.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 这是进阶教程
Work in progress.
136 changes: 136 additions & 0 deletions docs/GettingStarted.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Getting Started
目录:<br>
[配置开发环境](#配置开发环境-)<br>
[创建一个Module](#创建一个module)<br>
[使用Event](#使用event)<br>
[文本渲染](#文本渲染)<br>
[调用mc](#调用minecraftgetminecraft)<br>
[进阶教程](#进阶教程)<br>
[常见问题](#常见问题解决)

## 配置开发环境
1. 自行添加mc自带依赖库,删除lwjgl2
2. 添加如下jvm参数:
- `--add-opens
java.base/jdk.internal.access=ALL-UNNAMED`
- `--add-opens
java.base/java.nio=ALL-UNNAMED`
- `--add-opens
java.base/jdk.internal.misc=ALL-UNNAMED`
3. 从你的`.minecraft`文件夹复制`assets`文件夹到你的运行配置的Working Directory里面

## 创建一个Module
以下是一个示例:

```java
package cn.feng.untitled.module.impl.movement;

import cn.feng.untitled.module.Module;
import cn.feng.untitled.module.ModuleCategory;
import org.lwjgl.input.Keyboard;

/**
* @author ChengFeng
* @since 2024/7/28
**/
public class ToggleSprint extends Module {

/**
* Module类有多种构造器
* @see Module
*/
public ToggleSprint() {
super("ToggleSprint", ModuleCategory.Movement, Keyboard.getKeyIndex("V"));
}

@Override
public void onEnable() {
// 你的代码
}

@Override
public void onDisable() {
// 你的代码
}
}
```

## 使用Event
客户端内置了一个EventBus

```java
import cn.feng.untitled.Client;
import cn.feng.untitled.event.api.SubscribeEvent;
import cn.feng.untitled.event.impl.UpdateEvent;

public class YourClass {
/**
* 使用 EventBus 注册实例
*/
public void selfRegister() {
Client.instance.eventBus.register(this);
}

/**
* 反注册
*/
public void selfUnregister() {
Client.instance.eventBus.unregister(this);
}

/**
* 监听事件
*/
@SubscribeEvent
private void onUpdate(UpdateEvent event) {
// 你的代码
}
}
```

## 文本渲染
客户端内置了两种文本渲染器,分别为:
1. AWTFontRenderer
2. NanoFontRenderer

*注:<br>
AWTFont使用graphics绘制纹理贴图后渲染到屏幕上,优点是渲染快、占用低,缺点是加载慢,不灵活,字体大小样式不能随时调整。<br>
NanoFont为矢量绘制,优点是加载快、较灵活,发光效果效率高。缺点是大量渲染时占用较高。<br>
**需要特别注意的是,任何NanoVG相关操作都需要使用NanoUtil封装的方法或者NanoVG类中的方法执行,包括`Scale`, `Translate`, `Scissor`等<br>
除Widget外,所有NanoVG的绘制必须包含在NanoVG.beginFrame()和NanoVG.endFrame()之间<br>
想要进一步了解NanoVG在本项目中的使用,请转到[这里](Advanced.md)***
#### 使用AWTFontRenderer
```java
import cn.feng.untitled.ui.font.awt.FontLoader;

public void render() {
// 遇到中文会自动使用支持中文的字体渲染
FontLoader.greyCliff(16).drawString("Hello, graphics!你好世界!", textX, textY, textColor);
}
```
#### 使用NanoFontRenderer

```java
import cn.feng.untitled.ui.font.nano.NanoFontLoader;
import cn.feng.untitled.ui.font.nano.NanoFontRenderer;

public void render() {
// 遇到中文或emoji会自动切换字体
NanoFontRenderer fontRenderer = NanoFontLoader.script;
fontRenderer.setSize(16);
fontRenderer.drawString("Hello, NanoVG!你好世界!😀");
}
```
## 调用Minecraft.getMinecraft()
请让你的类继承 MinecraftInstance

## 进阶教程
想进一步了解此项目,请转到[这里](Advanced.md)

## 常见问题解决
### *Q:提示某些OpenGL方法不存在*
A:删除lwjgl2依赖
### *Q:提示某些类中的getter/setter不存在*
A:启用lombok注解,在编译项目时IDEA会自动提示你(右下角)
### *Q:怎么构建/怎么用启动器启动*
A:看[我的b站](https://space.bilibili.com/538684595)
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.gradle.jvmargs=-Dfile.encoding=UTF-8
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 5 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 1cc9e83

Please sign in to comment.