Skip to content

Commit 240c230

Browse files
authored
update zh loc
* add zh copy * add Introduction but not be fully translated * add @shadow * Update configuration.md * en wiki fix * change sidebar item order * update * Update preface.md * en mixinbooter format * Update mixinbooter.md * update * update rong's update * update * update * update * Update event.md * update * update * Update event.md * update * update format * update homepage * add grs docs to the zh environment * grs update * fallback to en grs wiki * clean up
1 parent 1aa0bd8 commit 240c230

398 files changed

Lines changed: 28979 additions & 126 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/.vitepress/config/zh.ts

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,50 @@
11
import { type DefaultTheme, defineConfigWithTheme } from "vitepress";
2+
import { generateSidebar } from "vitepress-sidebar";
23
import { CleanRoomConfig } from "./customConfig";
34

5+
const sidebar = generateSidebar([
6+
{
7+
// GroovyScript:
8+
documentRootPath: "docs",
9+
scanStartPath: "groovy-script",
10+
resolvePath: "/groovy-script/",
11+
hyphenToSpace: true,
12+
underscoreToSpace: true,
13+
useFolderTitleFromIndexFile: true,
14+
keepMarkdownSyntaxFromTitle: true,
15+
useTitleFromFrontmatter: true,
16+
useTitleFromFileHeading: true,
17+
sortMenusByName: true,
18+
collapseDepth: 2,
19+
folderLinkNotIncludesFileName: true,
20+
useFolderLinkFromIndexFile: true,
21+
},
22+
]);
23+
24+
sidebar["/zh/wiki/"] = wikiSidebar();
25+
426
export const zh = defineConfigWithTheme<CleanRoomConfig>({
527
lang: "zh",
628
description: "CleanroomMC",
729
themeConfig: {
830
nav: nav(),
9-
sidebar: {
10-
"/zh/wiki/": wikiSidebar(),
11-
},
12-
docFooter: {
13-
next: "下一篇",
14-
prev: "上一篇",
15-
},
31+
sidebar,
1632
outlineTitle: "大纲",
1733
lastUpdatedText: "更新于",
1834
editLinkText: "编辑此页",
1935
sourceLinkText: "查看源码",
36+
timeDict: {
37+
today: "今天",
38+
ago: "前",
39+
day: "一天",
40+
days: "%d 天",
41+
week: "大约一周",
42+
weeks: "%d 周",
43+
month: "大约一个月",
44+
months: "%d 个月",
45+
year: "大约一年",
46+
years: "%d 年",
47+
},
2048
},
2149
});
2250

@@ -25,6 +53,7 @@ function nav(): DefaultTheme.NavItem[] {
2553
{ text: "主页", link: "/zh/" },
2654
{ text: "指南", link: "/zh/guide/" },
2755
{ text: "维基", link: "/zh/wiki/" },
56+
{ text: "GroovyScript", link: "/groovy-script/" },
2857
];
2958
}
3059

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Creating blocks
2+
3+
## The simplest way
4+
5+
```groovy:no-line-numbers
6+
content.createBlock(String name).register()
7+
```
8+
9+
Simple right?
10+
Let's break it up:
11+
12+
- `content` is a global variable.
13+
- `createBlock(String name)` creates a block and an item version and returns it. The name is the registry name and must only consist of lower
14+
case letters and `_`.
15+
- `register()` registers the block and the item. Without this the block will not appear in game.
16+
17+
## Registering a block
18+
19+
The example above creates a simple block for you, but you can also create blocks yourself (to create custom behaviour).
20+
Use the following methods to register custom blocks.
21+
22+
```groovy:no-line-numbers
23+
content.registerBlock(String name, Block block)
24+
content.registerBlock(String name, Block block, ItemBlock block)
25+
```
26+
27+
## Texture
28+
29+
Minecraft's blocks need a texture (or multiple), a model file which describes how the textures are rendered and a block state file which points each block state to a model file. If groovy
30+
can't find a model file or a block state file it will generate default files
31+
at `.minecraft/groovy/assets/[pack id]/models/block/[block name].json` and `.minecraft/groovy/assets/[pack id]/blockstates/[item name].json`.
32+
It will point to a texture you will need to place
33+
at `.minecraft/groovy/assets/[pack id]/textures/blocks/[block name].png`.
34+
35+
## Translating the items name
36+
37+
By default, the items name will show up as `tile.[pack id].[block name].name`. To change that you need add an entry to
38+
the lang file. GroovyScript generates a default lang file at `.minecraft/groovy/assets/[pack id]/lang/en_us.lang`.
39+
40+
::: info Example {id="example"}
41+
42+
First create a block
43+
44+
```groovy:no-line-numbers
45+
content.createBlock('dust_block')
46+
```
47+
48+
Let's assume that the pack id is `nomifactory` so that the item and block id will be `nomifactory:dust_block`.
49+
Insert this line into the lang file.
50+
51+
```mclang:no-line-numbers
52+
tile.nomifactory.dust_block.name=Heart of the universe
53+
```
54+
55+
(`tile.nomifactory.dust_block.name` is the default generated translation key. You can change to anything you want.) <br>
56+
Finally, put a texture at `.minecraft/groovy/assets/nomifactory/textures/items/dust_block.png`
57+
:::
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Creating creative tabs
2+
3+
```groovy:no-line-numbers
4+
content.createCreativeTab(String name, ItemStack icon) // returns the creative tab
5+
```
6+
7+
::: info Example {id="example"}
8+
9+
```groovy:no-line-numbers
10+
def creativeTab = content.createCreativeTab("nomifactory.creative_tab", item("nomifactory:heart_of_the_universe"))
11+
```
12+
:::
13+
14+
## Other
15+
16+
You can get a creative tab by using
17+
18+
```groovy:no-line-numbers
19+
creativeTab(String tabName)
20+
```
21+
22+
A list of existing creative tab names can be obtained by running the `/gs creativeTabs` command.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
# Creating fluids
2+
3+
::: info Warning {id="warning"}
4+
This requires at least version 0.7.0 of GroovyScript.
5+
:::
6+
## The simplest way
7+
8+
```groovy:no-line-numbers
9+
content.createFluid(String name).register()
10+
```
11+
12+
Simple right?
13+
Let's break it up:
14+
15+
- `content` is a global variable.
16+
- `createFluid(String name)` creates a fluid builder object and returns it. The name is the registry name and must only
17+
consist of lower case letters and `_`.
18+
- `register()` registers the item. Without this the item will not appear in game.
19+
20+
This will create a bucket item and a fluid block with a white water texture.
21+
22+
## Setters
23+
24+
- `setStill(ResourceLocation)` sets the still fluid texture
25+
- `setFlowing(ResourceLocation)` sets the flowing fluid texture
26+
- `setOverlay(ResourceLocation)` sets the overlay fluid texture (usually null)
27+
- `setTexture(ResourceLocation still, ResourceLocation flowing)` sets the still and flowing fluid texture
28+
- `setTexture(ResourceLocation still, ResourceLocation flowing, ResourceLocation overlay)` sets the still, flowing and overlay fluid texture
29+
- `setDefaultTexture()` sets the still and flowing texture to the default texture (white water)
30+
- `setMetalTexture()` sets the still and flowing texture to the tinkers molten metal texture
31+
- `setColor(int)` sets fluid color. The texture is usually white. The color is applied on top of the texture
32+
- `setSound(SoundEvent fillSound, SoundEvent emptySound)` sets the sounds for emptying and filling a bucket (default is from the fluids material)
33+
- `setLuminosity(int)` sets the luminosity. The light level of the fluid from 0 to 15 (default is 0).
34+
- `setDensity(int)` sets the density. Completely arbitrary value. Negative values imply that fluid is lighter than air. Default is 1000.
35+
- `setTemperature(int)` sets the temperature. Completely arbitrary value. Default is 300 (room temperature in Kelvin).
36+
- `setViscosity(int)` sets the viscosity. Completely arbitrary value Higher value makes the fluid flow slower. Default is 1000.
37+
- `setGaseous(boolean)` sets if the fluid is a gas. Generally this is associated with negative density fluids. Default is false.
38+
- `setRarity(EnumRarity)` sets the fluid rarity. This is only used for tooltip colors (afaik). Default is `EnumRarity.COMMON`.
39+
- `setWaterMaterial()` sets the fluid material to water. This makes the fluid blocks to behave like water. This is used by default.
40+
- `setLavaMaterial()` sets the fluid material to lava. This makes the fluid blocks to behave like lava. (No custom materials currently)
41+
- `noBlock()` disables the fluid block from generating. Buckets will not be able to place the fluid in the world.
42+
43+
::: details Example {open id="example"}
44+
````groovy
45+
content.createFluid('molten_iron')
46+
.setMetalTexture()
47+
.setColor(0xFF0000)
48+
.setLuminosity(4)
49+
.setDensity(1700)
50+
.setTemperature(1300)
51+
.setViscosity(1500)
52+
.setLavaMaterial()
53+
.register()
54+
````
55+
:::
56+
57+
## Registering a fluid
58+
59+
The example above creates a simple fluid for you, but you can also create fluids yourself.
60+
Use the following methods to register custom fluids.
61+
62+
```groovy:no-line-numbers
63+
content.registerFluid(Fluis)
64+
```
65+
66+
::: info Warning {id="warning"}
67+
This is not recommended since using `createFluid(name).register()` does a lot of work for you.
68+
:::
69+
70+
## Texture
71+
72+
We recommend to use the default textures. But you can add other yourself.
73+
If a fluid has a block the block state json is automatically generated,
74+
75+
## Translating the fluids name
76+
77+
Add `fluid.[pack id].[fluid name]=Fluid Name` to your lang file
78+
79+
Example for molten iron:
80+
```mclang:no-line-numbers
81+
fluid.placeholdername.molten_iron=Molten Iron
82+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Content
2+
3+
This part of GroovyScript allows the creation of game content like items and blocks. It's equivalent to ContentTweaker
4+
for CraftTweaker, but for GroovyScript it doesn't require another mod.
5+
6+
::: info Warning {id="warning"}
7+
Requires version 0.4.0+. <br>
8+
Before you start adding content make sure to specify the pack name and id in
9+
your [runConfig](../getting_started.md#run-config). <br>
10+
Also make sure to read [pack name and id](../getting_started.md#pack-name-and-id)
11+
:::
12+
13+
Currently, GroovyScript adds helpers to create
14+
15+
- [items](item.md)
16+
- [blocks](block.md)
17+
- [creative tabs](creative_tab.md)
18+
- [fluids](fluid.md)
19+
20+
Coming in the future:
21+
22+
- Mekanism gases
23+
24+
## Creative tabs
25+
You can set a default creative tab which registered items and blocks will use if not specified otherwise
26+
```groovy:no-line-numbers
27+
content.setDefaultCreativeTab(CreativeTabs tab)
28+
```
29+
30+
::: info Example {id="example"}
31+
32+
With [that](creative_tab.md) we can do this
33+
```groovy:no-line-numbers
34+
def creativeTab = content.createCreativeTab("nomifactory.creative_tab", item("nomifactory:heart_of_the_universe"))
35+
content.setDefaultCreativeTab(creativeTab)
36+
```
37+
:::
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Creating items
2+
3+
## The simplest way
4+
5+
```groovy:no-line-numbers
6+
content.createItem(String name).register()
7+
```
8+
9+
Simple right?
10+
Let's break it up:
11+
12+
- `content` is a global variable.
13+
- `createItem(String name)` creates an item and returns it. The name is the registry name and must only consist of lower
14+
case letters and `_`.
15+
- `register()` registers the item. Without this the item will not appear in game.
16+
17+
## Registering an item
18+
19+
The example above creates a simple item for you, but you can also create items yourself (to create custom behaviour).
20+
Use the following methods to register custom items.
21+
22+
```groovy:no-line-numbers
23+
content.registerItem(String name, Item item)
24+
```
25+
26+
## Texture
27+
28+
Minecraft's items need a texture (or multiple) and a model file which describes how the textures are rendered. If groovy
29+
can't find a model file it will generate a default file
30+
at `.minecraft/groovy/assets/[pack id]/models/item/[item name].json`.
31+
It will point to a texture you will need to place
32+
at `.minecraft/groovy/assets/[pack id]/textures/items/[item name].png`.
33+
34+
## Translating the items name
35+
36+
By default, the items name will show up as `item.[pack id].[item name].name`. To change that you need add an entry to
37+
the lang file. GroovyScript generates a default lang file at `.minecraft/groovy/assets/[pack id]/lang/en_us.lang`.
38+
39+
::: info Example {id="example"}
40+
41+
First create an item
42+
43+
```groovy:no-line-numbers
44+
content.createItem('heart_of_the_universe')
45+
```
46+
47+
Let's assume that the pack id is `nomifactory` so that the item id will be `nomifactory:heart_of_the_universe`.
48+
Insert this line into the lang file.
49+
50+
```mclang:no-line-numbers
51+
item.nomifactory.heart_of_the_universe.name=Heart of the universe
52+
```
53+
54+
(`item.nomifactory.heart_of_the_universe.name` is the default generated translation key. You can change to anything you want.) <br>
55+
Finally, put a texture at `.minecraft/groovy/assets/nomifactory/textures/items/heart_of_the_universe.png`
56+
:::
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
# External Compat
3+
4+
Here you'll learn about adding external mod compat for GroovyScript.
5+
6+
::: info Warning {id="warning"}
7+
You need at least version 0.7.0.
8+
:::
9+
10+
::: info {id="info"}
11+
Please read the javadoc for the interface and methods.
12+
:::
13+
14+
The plugin must implement `GroovyPlugin`. GroovyScript will automatically find the class and instantiate it. If the
15+
instance field is non-null the class will not be instantiated by GroovyScript, but instead the value of the field will
16+
be used.
17+
18+
The field `TestReg test` represents a machine that can have recipes.
19+
20+
In `onCompatLoaded()` the compat can be initialised. `container.getVirtualizedRegistrar().addFieldsOf(this)`
21+
automatically register fields of this class which are `VirtualRegistries` including the `TestReg test` field.
22+
23+
````java
24+
public class ExampleModGroovyPlugin implements GroovyPlugin {
25+
26+
public final TestReg test = new TestReg();
27+
28+
@Override
29+
public @NotNull String getModId() {
30+
return "example_id";
31+
}
32+
33+
@Override
34+
public @NotNull String getModName() {
35+
return "example_name";
36+
}
37+
38+
@Override
39+
public void onCompatLoaded(GroovyContainer<?> container) {
40+
GroovyScript.LOGGER.info("ExampleMod container loaded");
41+
container.getVirtualizedRegistrar().addRegistry(VanillaModule.furnace);
42+
container.getVirtualizedRegistrar().addFieldsOf(this);
43+
}
44+
}
45+
````

0 commit comments

Comments
 (0)