Skip to content

Commit

Permalink
[Docs] Fixed (lot) some missing capital letter and Java usage
Browse files Browse the repository at this point in the history
  • Loading branch information
JojoFR1 committed Dec 28, 2023
1 parent 69d3810 commit ab7d83b
Show file tree
Hide file tree
Showing 6 changed files with 217 additions and 36 deletions.
4 changes: 2 additions & 2 deletions docs/customize/drawer.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ sprites/

![DrawRecipe example](../assets/draw-recipes.gif){ loading=lazy width="280" }

=== "Hjson"
=== "HJSON"

```hjson
drawer: {
Expand Down Expand Up @@ -63,7 +63,7 @@ sprites/
}
```

=== "Json"
=== "JSON"

```json
"drawer": {
Expand Down
4 changes: 2 additions & 2 deletions docs/customize/menu.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
You can select which menu style detailed-described blow you want with a case-insensitive name.
The default menu style is `Transform`.

=== "Hjson"
=== "HJSON"

Suppose you have such structure with a MultiCrafter, named `mine-crafter`
```
Expand All @@ -16,7 +16,7 @@ The default menu style is `Transform`.
menu: Transform
```

=== "Json"
=== "JSON"

Suppose you have such structure with a MultiCrafter, named `mine-crafter`
```
Expand Down
10 changes: 5 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ or search it on the Mod Browser with its name, `MultiCrafter Lib`.

| Method | Json | JavaScript | Java | Note |
|:----------:|:----:|:----------:|:-------:|:------------------------------:|
| Dependency | ✔️ | ✔️ | ✔️ | Players need download this mod |
| Injection | ✔️ | ✔️ | No Need | Keep your mod standalone |
| Jitpack | | | ✔️ | Full sources code support |
| Dependency | ✔️ | ✔️ | ✔️ | Players need download this mod |
| Injection | ✔️ | ✔️ | No Need | Keep your mod standalone |
| Jitpack | | | ✔️ | Full sources code support |

=== "Dependency"

**For a Json, JavaScript or Java mod.**
**For a JSON, JavaScript or Java mod.**

If you want your mod to depend on MultiCrafter and only focus on your contents, it's for your use case.

Expand All @@ -35,7 +35,7 @@ or search it on the Mod Browser with its name, `MultiCrafter Lib`.

=== "Injection"

**For a Json or JavaScript mod.**
**For a JSON or JavaScript mod.**

*Injection makes your mod an actual Java mod, so it must fit the structure of Java mod.*

Expand Down
181 changes: 181 additions & 0 deletions docs/usage/java.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,183 @@
# Java

In your Java file containing all your blocks (create one if you don't already have one) imports the MultiCrater library.

```java
import multicraft.*
```

Then create a new block with the type `MultiCrafter`

```java
Block mine-crafter = new MultiCrafter("mine-crafter") {{

}};
```

You can add recipes like this:

```java
resolvedRecipes = Seq.with(
new Recipe() {{
input = new IOEntry() {{
items = ItemStack.with(
Items.copper, 1,
Items.lead, 1
);
}};
output = new IOEntry() {{
items = ItemStack.with(
Items.surgeAlloy, 1,
Items.thorium, 1
);
}};
craftTime = 120f;
}},
new Recipe() {{
input = new IOEntry() {{
items = ItemStack.with(
Items.copper, 1
);
}};
output = new IOEntry() {{
items = ItemStack.with(
Items.copper, 1,
Items.beryllium, 1
);
}};
craftTime = 160f;
}}
);
```

### Recipe

A recipe has several fields:

| Field | Type | Note |
|-------------|------------------------------------|---------------------------------------------|
| input | IOEntry | |
| output | IOEntry | |
| crafterTime | Float | how long to do a synthesis, can be 0. |
| icon | Prov<TextureRegion\> | such as `Icon.lock-open`. See [Icon](#icon) |
| iconColor | Color (RGB, RGBA, rgba8888 or Hex) | a color for icon |



### Input and Output

The `input` or `output` are `IOEntry`.
With this style, its power is unlimited.

| Key | Type | Note |
|-------------|------------------------------------|-------------------------------------------------|
| items | ItemStack[] | how much item for input/output, default: empty |
| fluids | LiquidStack[] | how much fluid for input/output, default: empty |
| power | Float &#124 unit: power/tick | how much power for input/output, default: 0f |
| heat | Float | how much heat for input/output, default: 0f |
| icon | Icon | such as `Icon.lock-open`. See [Icon](#icon) |
| iconColor | Color (RGB, RGBA, rgba8888 or Hex) | a color for icon |
| craftEffect | Effect | an independent craft effect for each recipe |

### Icon

You can customize which icon is used for your recipe selector menu.

If you don't set a dedicated icon, it will find the first one from the recipe.

For example:

=== "alphaaaa"

![Alphaaaa](../assets/customizedIcon-alphaaaa.png){ loading=lazy }

<details>
<summary>
icon = Icon.alphaaaa
<br>
iconColor: F30000
</summary>
```
switchStyle = RecipeSwitchStyle.simple;
resolvedRecipes = Seq.with(
new Recipe() {{
input = new IOEntry(){{
fluids = Seq.with(
Liquids.ozone, 1.5f
);
}};
output = new IOEntry() {{
items = Seq.with(
Items.coal, 1
)
power = 2f;
icon: alphaaaa
iconColor = Color.valueOf("#F30000");
}};
craftTime = 250f;
}},
new Recipe() {{
input = new IOEntry(){{
items = Seq.with(
Items.copper, 1
);
}};
output = new IOEntry() {{
items = Seq.with(
Items.coal, 1
)
icon = () -> Icon.lock.uiIcon;
}};
craftTime = 120f;
}}
);
```
</details>

=== "mono"

![Mono](../assets/customizedIcon-mono.png){ loading=lazy width="250" }

<details>
<summary>
icon: mono
</summary>
```java
switchStyle = RecipeSwitchStyle.simple;
resolvedRecipes = Seq.with(
new Recipe() {{
input = new IOEntry(){{
items = Seq.with(
Items.copper, 1
);
}};
output = new IOEntry() {{
items = Seq.with(
Items.coal, 1
)
}};
craftTime = 60f;
icon = () -> UnitTypes.mono.uiIcon;
}},
new Recipe() {{
input = new IOEntry(){{
items = Seq.with(
Items.copper, 1
);
}};
output = new IOEntry() {{
fluids = Seq.with(
Liquid.ozone, 1f
)
}};
craftTime = 60f;
}}
);
```
</details>

- The `icon` variable as to be always defined by `icon = () -> ...;`
- For a built-in icon, it should start with `Icon.`, such as `Icon.lock-open` or `Icon.trash`.
- For an icon from item, fluid, unit or block, it should be the content `uiIcon`, such as `Units.mono.uiIcon`,`phase-heat.uiIcon`.
- For any texture, it should be its name, such as `your-mod-icon` or `alphaaaa`.

52 changes: 26 additions & 26 deletions docs/usage/json.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Json & Javascript
# JSON & Javascript

=== "Hjson"
=== "HJSON"

Create a file, for example, a `mine-crafter.hjson`, in the `content/blocks` folder.
```
Expand Down Expand Up @@ -47,7 +47,7 @@
]
```

=== "Json"
=== "JSON"

Create a file, for example, a `mine-crafter.json`, in the `content/blocks` folder.
```
Expand Down Expand Up @@ -94,7 +94,7 @@

=== "JavaScript"

In a javascript file, you should import the `MultiCrafter` class from `multi-cafter`
In a JavaScript file, you should import the `MultiCrafter` class from `multi-cafter`
```javascript
const multi = require("multi-crafter/lib")
const mineCrafter = multi.MultiCrafter("mine-crafter")
Expand All @@ -119,8 +119,8 @@
craftTime: 210.0
}]
```


### Recipe

A recipe has several fields:
Expand All @@ -129,8 +129,8 @@ A recipe has several fields:
|-------------|--------------------------|---------------------------------------------|
| input | Object, String or List | alias: [`in`,`i`] |
| output | Object, String or List | alias: [`out`,`o`] |
| crafterTime | number &#124 unit: tick | how long to do a synthesis, can be 0. |
| icon | String | such as `Icon.lock-open`. see [icon](#icon) |
| crafterTime | Number &#124 unit: tick | how long to do a synthesis, can be 0. |
| icon | String | such as `Icon.lock-open`. See [Icon](#icon) |
| iconColor | String | a hex color for icon |

### Input and Output
Expand All @@ -141,14 +141,14 @@ The `input` or `output` can be a `String`.
If so, it will be considered as an item or fluid.

If there is no amount given, `1` will be the amount as default.
=== "Hjson"
=== "HJSON"

```hjson
input: copper/2
output: water/1.2
```

=== "Json"
=== "JSON"

```json
"input": "copper/2",
Expand All @@ -167,14 +167,14 @@ If there is no amount given, `1` will be the amount as default.
The `input` or `output` can be a `List`.
If so, every element will be treated as an item or fluid.

=== "Hjson"
=== "HJSON"

```hjson
input: [copper/2,lead/3]
output: slag/2.5
```

=== "Json"
=== "JSON"

```json
"input": ["copper/2","lead/3"],
Expand All @@ -193,17 +193,17 @@ If so, every element will be treated as an item or fluid.
The `input` or `output` can be an `Object`.
With this style, its power is unlimited.

| Key | Type | Optional | Note |
|-------------|--------------------------------|:--------:|-------------------------------------------------|
| items | String or List | ✔️ | how much item for input/output, default: empty |
| fluids | String or List | ✔️ | how much fluid for input/output, default: empty |
| power | Number &#124 unit: power/tick | ✔️ | how much power for input/output, default: 0 |
| heat | Number | ✔️ | how much heat for input/output, default: 0 |
| icon | String | ✔️ | such as `Icon.lock-open`. see [icon](#icon) |
| iconColor | String | ✔️ | a hex color for icon |
| craftEffect | String | ✔️ | an independent craft effect for each recipe |
| Key | Type | Note |
|-------------|--------------------------------|-------------------------------------------------|
| items | String or List | how much item for input/output, default: empty |
| fluids | String or List | how much fluid for input/output, default: empty |
| power | Number &#124 unit: power/tick | how much power for input/output, default: 0 |
| heat | Number | how much heat for input/output, default: 0 |
| icon | String | such as `Icon.lock-open`. See [Icon](#icon) |
| iconColor | String | a hex color for icon |
| craftEffect | String | an independent craft effect for each recipe |

=== "Hjson"
=== "HJSON"

```hjson
input: {
Expand All @@ -219,7 +219,7 @@ With this style, its power is unlimited.
}
```

=== "Json"
=== "JSON"

```json
"input": {
Expand Down Expand Up @@ -269,7 +269,7 @@ For example:
<br>
iconColor: F30000
</summary>
```
```hjson
recipes: [
{
input: ozone/1.5
Expand Down Expand Up @@ -299,9 +299,9 @@ For example:

<details>
<summary>
icon: mono
icon = mono
</summary>
```
```hjson
menu: Simple
recipes:
[
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ nav:
- Built-in: customize/builtin.md
- Drawer: customize/drawer.md
- API:
- Multicrafter: api/multicrafter.md
- MultiCrafter: api/multicrafter.md
- Drawer: api/drawer.md

markdown_extensions:
Expand Down

0 comments on commit ab7d83b

Please sign in to comment.