-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/CrychicTeam/CrychicDoc
- Loading branch information
Showing
52 changed files
with
2,768 additions
and
2,213 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
layout: doc | ||
title: Community Link | ||
layoutClass: m-nav-layout | ||
sidebar: false | ||
|
||
prev: false | ||
next: false | ||
editLink: false | ||
editor: false | ||
gitChangelog: false | ||
showComment: false | ||
metadata: false | ||
outline: [2,2] | ||
--- | ||
<style src="../../../../.vitepress/theme/style/nav.scss"></style> | ||
|
||
<script setup> | ||
import { ref } from "vue"; | ||
import { NAV_DATA } from './guidets/community.ts' | ||
const NAV_DATAS = ref(NAV_DATA) | ||
</script> | ||
|
||
# {{ $frontmatter.title }} | ||
## This part is still pending. | ||
<MNavLinks v-for="{title, items} in NAV_DATAS" :title="title" :items="items"/> |
2 changes: 1 addition & 1 deletion
2
docs/zh/Components/guide.ts → docs/en/doc/guide/guidets/KubeJS.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
docs/en/Components/guide.ts → docs/en/doc/guide/guidets/minecraft.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
layout: doc | ||
title: Pixel Art | ||
layoutClass: m-nav-layout | ||
sidebar: false | ||
|
||
prev: false | ||
next: false | ||
editLink: false | ||
editor: false | ||
gitChangelog: false | ||
showComment: false | ||
metadata: false | ||
outline: [2,2] | ||
--- | ||
<style src="../../../../.vitepress/theme/style/nav.scss"></style> | ||
|
||
<script setup> | ||
import { ref } from "vue"; | ||
import { NAV_DATA } from './guidets/pixelart.ts' | ||
const NAV_DATAS = ref(NAV_DATA) | ||
</script> | ||
|
||
# {{ $frontmatter.title }} | ||
|
||
<MNavLinks v-for="{title, items} in NAV_DATAS" :title="title" :items="items"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
layout: doc | ||
title: Art resources | ||
layoutClass: m-nav-layout | ||
sidebar: false | ||
|
||
prev: false | ||
next: false | ||
editLink: false | ||
editor: false | ||
gitChangelog: false | ||
showComment: false | ||
metadata: false | ||
outline: [2,2] | ||
--- | ||
<style src="../../../../.vitepress/theme/style/nav.scss"></style> | ||
|
||
<script setup> | ||
import { ref } from "vue"; | ||
import { NAV_DATA } from './guidets/resource.ts' | ||
const NAV_DATAS = ref(NAV_DATA) | ||
</script> | ||
|
||
# {{ $frontmatter.title }} | ||
## This part is still pending. | ||
<MNavLinks v-for="{title, items} in NAV_DATAS" :title="title" :items="items"/> |
This file was deleted.
Oops, something went wrong.
67 changes: 0 additions & 67 deletions
67
docs/en/modpack/kubejs/1.20.1/KubeJSCourse/Files/RecipesSchema.java
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
docs/en/modpack/kubejs/1.20.1/KubeJSCourse/KubeJSAdvanced/ForgeEvent.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
# ForgeEvent的使用 | ||
> 孤梦注:可千万不要玩forge事件啊,玩了你就要长脑子了!!! | ||
`ForgeEvent`是写在**startup**里的,这个一定得注意! | ||
|
||
ForgeEvent不仅仅只能调用到forge提供的事件,如果其他模组在源代码(指的Java代码)里直接继承了`Event`类,也是可以被ForgeEvent捕捉下来的,类似的示例:[机械动力修改流体管道流体和流体产生块](../KubeJSProjects/Meng/SmallProject/CreatePipeCollision.md) | ||
|
||
ForgeEvent是可以搭配着[loadClass](./JavaLoadClass.md)一起使用的 | ||
|
||
## forge提供的事件 | ||
forge本身提供了非常多的事件可以使我们捕捉到游戏内的事情,但是我们一个个去翻又太过麻烦,这里孤梦就推荐使用[crt文档](https://docs.blamejared.com/1.20.1/en)去找对应的事件! | ||
|
||
[crt文档](https://docs.blamejared.com/1.20.1/en)的forge栏里的event目录下是非常好的ForgeEvent文档 | ||
|
||
我们可以现在crt文档里找到对应的事件,然后再去[forge的GitHub](https://github.com/MinecraftForge/MinecraftForge/tree/1.20.1/src/main/java/net/minecraftforge/event)上去找到相应事件的类 | ||
|
||
## 关于使用 | ||
```js | ||
ForgeEvents.onEvent("事件类",event=>{ | ||
//关于事件的code | ||
}) | ||
``` | ||
因为每个事件给出的方法是有可能不一样的,所以这里无法举例,且提供不了详细的函数使用(这里也可以简单参考一下crt文档提供的事件的使用函数) | ||
|
||
## 事件的“热加载” | ||
绝大部分的事件都是可以“热加载”的,但是需要使用一点手段 | ||
|
||
在前面我们学习了[global全局变量](./GlobalVariable.md),我们可以在事件里嵌入一个[global全局变量](./GlobalVariable.md),将事件处理引出来,像下面这样写 | ||
```js | ||
ForgeEvents.onEvent("事件类",event=>{ | ||
global.eventTest(event); | ||
}) | ||
|
||
global.eventTest = event =>{ | ||
//事件处理 | ||
} | ||
``` | ||
这样我们在游戏里只需要输入 `/kjs reload startup_scripts` 就可以进行事件处理的热加载了 | ||
|
||
## 注意事项 | ||
startup是非常脆弱的,稍不注意就会大退然后报错,说你的“犀牛”有问题, | ||
|
||
所以建议在测试的过程中使用`try catch`包裹处理一下报错,能够减少闪退的次数 | ||
|
||
具体像下面这样写(沿用上面代码) | ||
|
||
```js | ||
global.eventTest = event =>{ | ||
try{ | ||
//事件处理 | ||
}catch(err){ | ||
console.error(err); | ||
} | ||
} | ||
``` | ||
这样在报错时,可以在`/logs/kubejs/startup.log`里看见因为什么报错,然后去调整代码,一定不要因为错误被catch了就不管不顾了,除非你的这个错误是在意料之中的,并且出现报错后也有对应的处理,不会导致一直重复报错 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
docs/en/modpack/kubejs/1.20.1/KubeJSCourse/KubeJSAdvanced/JavaLoadClass.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# LoadClass使用 | ||
> 孤梦注:千万不要玩Java.loadClass啊,这东西比较废人 | ||
在使用Java.loadClass时,孤梦建议是你有一定的Java基础,至少得知道类、类路径、静态、对象、访问修饰符等概念 | ||
|
||
在绝大多数时候我们都用不到loadClass | ||
|
||
loadclass就是kjs提供给我们用来加载java类的 | ||
|
||
这使得KubeJS的可玩性非常高,比如[注册AE存储元件和对应的组件](../KubeJSProjects/Meng/RegComponent&Storage.md)就使用到了非常多的loadClass | ||
|
||
## 关于使用 | ||
```js | ||
let class = Java.loadClass("类路径"); | ||
``` | ||
在使用ProbeJS时,在绝大多数时候都会为你补齐类路径,但是ProbeJS并不是所有的类都有对应的路径,所以这个时候你可以去翻一下对应模组的GitHub开源链接,查找到你需要的类,并将其路径复制过来 | ||
|
||
在你使用`Java.loadClass`class时候,你可以直接去调用到里面的`public static`的方法或者变量常量等 | ||
|
||
但是有些内容调用不到,你就可以和写java一样去`new`这个类 | ||
|
||
沿用上面的内容 | ||
```js | ||
let newClass = new class(); | ||
``` | ||
这里的`new class()`括号里可能会需要传参有的也不需要,这里根据对应类提供的源码来写 | ||
|
||
## 总结 | ||
总的来说你如果需要更好的使用`Java.loadClass`你是需要有一定的Java基础,这不是靠一个篇章能说明白的事情 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.