Skip to content

Commit

Permalink
Add docs for Crystal Resonance Generator (#7723)
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte authored Mar 8, 2024
1 parent 9841392 commit fefba8e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 1 deletion.
4 changes: 3 additions & 1 deletion guidebook/ae2-mechanics/energy.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ energy acceptors can intake at functionally unlimited speed, only limited by you
<BlockImage id="controller" p:state="online" scale="4" />

<BlockImage id="vibration_chamber" p:active="true" scale="4" />

<BlockImage id="crystal_resonance_generator" scale="4" />
</Row>

AE2 does not use Forge Energy (on Forge) or TechReborn Energy (on Fabric) internally. Instead it converts them to
its own unit, AE. This conversion is one-way. Energy can be converted by <ItemLink id="energy_acceptor" />s and
<ItemLink id="controller" />s, though controller faces are better used for more [channels](../ae2-mechanics/channels.md).
It can also be generated by <ItemLink id="vibration_chamber" />s, but AE2 is designed
It can also be generated by <ItemLink id="vibration_chamber" />s or passively using a <ItemLink id="crystal_resonance_generator" />, but AE2 is designed
to be used with other tech mods that have better energy generation.

All this means that it's best to consider an AE2 network as a single large multiblock machine when laying out your base's
Expand Down
23 changes: 23 additions & 0 deletions guidebook/items-blocks-machines/crystal_resonance_generator.md
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" />
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());
}
}
3 changes: 3 additions & 0 deletions src/main/java/appeng/core/AppEngClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
import appeng.client.guidebook.Guide;
import appeng.client.guidebook.PageAnchor;
import appeng.client.guidebook.command.GuidebookStructureCommands;
import appeng.client.guidebook.compiler.TagCompiler;
import appeng.client.guidebook.extensions.ConfigValueTagExtension;
import appeng.client.guidebook.hotkey.OpenGuideHotkey;
import appeng.client.guidebook.scene.ImplicitAnnotationStrategy;
import appeng.client.guidebook.scene.PartAnnotationStrategy;
Expand Down Expand Up @@ -190,6 +192,7 @@ private Guide createGuide(IEventBus modEventBus) {

return Guide.builder(modEventBus, MOD_ID, "ae2guide")
.extension(ImplicitAnnotationStrategy.EXTENSION_POINT, new PartAnnotationStrategy())
.extension(TagCompiler.EXTENSION_POINT, new ConfigValueTagExtension())
.build();
}

Expand Down

0 comments on commit fefba8e

Please sign in to comment.