-
Notifications
You must be signed in to change notification settings - Fork 682
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docs for Crystal Resonance Generator (#7723)
- Loading branch information
Showing
4 changed files
with
71 additions
and
1 deletion.
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
23 changes: 23 additions & 0 deletions
23
guidebook/items-blocks-machines/crystal_resonance_generator.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,23 @@ | ||
--- | ||
navigation: | ||
parent: items-blocks-machines/items-blocks-machines-index.md | ||
title: Crystal Resonance Generator | ||
icon: crystal_resonance_generator | ||
position: 110 | ||
categories: | ||
- devices | ||
item_ids: | ||
- ae2:crystal_resonance_generator | ||
--- | ||
|
||
# The Crystal Resonance Generator | ||
|
||
<BlockImage id="crystal_resonance_generator" scale="8" /> | ||
|
||
This device generates energy for your ME network without the need for fuel. Because of the crystal vibrations this device generates, only one can be used in each network. These vibrations even pass through <ItemLink id="quartz_fiber" />. | ||
|
||
**Generation Rate:** <ae2:ConfigValue name="crystalResonanceGeneratorRate"/> AE/t | ||
|
||
## Recipes | ||
|
||
<RecipeFor id="crystal_resonance_generator" /> |
42 changes: 42 additions & 0 deletions
42
src/main/java/appeng/client/guidebook/extensions/ConfigValueTagExtension.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package appeng.client.guidebook.extensions; | ||
|
||
import java.util.Map; | ||
import java.util.Set; | ||
import java.util.function.Supplier; | ||
|
||
import appeng.client.guidebook.compiler.PageCompiler; | ||
import appeng.client.guidebook.compiler.tags.FlowTagCompiler; | ||
import appeng.client.guidebook.document.flow.LytFlowParent; | ||
import appeng.core.AEConfig; | ||
import appeng.libs.mdast.mdx.model.MdxJsxElementFields; | ||
|
||
/** | ||
* Provides access to AE2 config values in guide content. | ||
*/ | ||
public class ConfigValueTagExtension extends FlowTagCompiler { | ||
private static final Map<String, Supplier<String>> CONFIG_VALUES = Map.of( | ||
"crystalResonanceGeneratorRate", | ||
() -> String.valueOf(AEConfig.instance().getCrystalResonanceGeneratorRate())); | ||
|
||
@Override | ||
public Set<String> getTagNames() { | ||
return Set.of("ae2:ConfigValue"); | ||
} | ||
|
||
@Override | ||
protected void compile(PageCompiler compiler, LytFlowParent parent, MdxJsxElementFields el) { | ||
var configValueName = el.getAttributeString("name", ""); | ||
if (configValueName.isEmpty()) { | ||
parent.appendError(compiler, "name is required", el); | ||
return; | ||
} | ||
|
||
var configValueSupplier = CONFIG_VALUES.get(configValueName); | ||
if (configValueSupplier == null) { | ||
parent.appendError(compiler, "unknown configuration value", el); | ||
return; | ||
} | ||
|
||
parent.appendText(configValueSupplier.get()); | ||
} | ||
} |
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