Skip to content

Commit

Permalink
feat(EMI): Toggles
Browse files Browse the repository at this point in the history
- Ability to toggle EMI support
- Ability to toggle CobbleGen tooltip (#41)
  • Loading branch information
null2264 committed Nov 12, 2023
1 parent 7c3db06 commit 96af546
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/main/java/io/github/null2264/cobblegen/CobbleGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class CobbleGen implements net.fabricmc.api.ModInitializer
private static final Path configPath = LoaderCompat.getConfigDir();
private static final File configFile = new File(configPath + File.separator + MOD_ID + "-meta.json5");
@ApiStatus.Internal
@Nullable
public static ConfigMetaData META_CONFIG = loadConfig(false, configFile, null, new ConfigMetaData(), ConfigMetaData.class);

//#if FABRIC>=1
Expand All @@ -44,4 +43,4 @@ public enum Channel {
PING,
SYNC,
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ public class CGEMIPlugin implements EmiPlugin

@Override
public void register(EmiRegistry registry) {
if (Util.optional(CobbleGen.META_CONFIG).orElse(new ConfigMetaData()).mergeEMIRecipeCategory) {
if (!CobbleGen.META_CONFIG.enableRecipeViewer)
return;

if (CobbleGen.META_CONFIG.mergeEMIRecipeCategory) {
FLUID_INTERACTION_CATEGORIES.forEach((ignored, category) -> registry.addCategory(category));
FLUID_INTERACTION.getGenerators().forEach((fluid, generators) -> generators.forEach(generator -> generator.getOutput().forEach(
(modifierId, blocks) -> {
Expand Down Expand Up @@ -120,6 +123,8 @@ public void register(EmiRegistry registry) {

recipe.output(EmiStack.of(Util.getBlock(resultId)),
s -> {
if (!CobbleGen.META_CONFIG.emi.addTooltip) return s;

var minY = block.minY;
if (minY == null)
minY = minecraft.level != null ? minecraft.level.getMinBuildHeight() : 0;
Expand Down

0 comments on commit 96af546

Please sign in to comment.