Skip to content

Commit

Permalink
Fix behavior for the "enabled" config options (#4)
Browse files Browse the repository at this point in the history
Conditionally register recipes and nomicon pages
  • Loading branch information
rndmorris authored Oct 12, 2024
2 parents 643924d + 188a86a commit 2ddb003
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 94 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ usesMavenPublishing = false
#
# The project's ID on Modrinth. Can be either the slug or the ID.
# Leave this empty if you don't want to publish to Modrinth.
modrinthProjectId = essentia-pipes
modrinthProjectId = UlWn33x6

# The project's relations on Modrinth. You can use this to refer to other projects on Modrinth.
# Syntax: scope1-type1:name1;scope2-type2:name2;...
Expand Down
81 changes: 43 additions & 38 deletions src/main/java/dev/rndmorris/essentiapipes/Recipes.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,48 +17,53 @@ public class Recipes {
public static InfusionRecipe voidmetalPipeRecipe;

public static void postInit() {
final var essentiaTube = ItemApi.getBlock("blockTube", 0);
final var basicPipe = new ItemStack(BlockPipeSegment.pipe_segment, 1);
basicPipeRecipe = ThaumcraftApi.addCrucibleRecipe(
Research.PIPES_BASIC,
basicPipe,
essentiaTube,
new AspectList().add(Aspect.METAL, 3)
.add(Aspect.VOID, 3)
.add(Aspect.MOTION, 2)
.add(Aspect.SENSES, 1));

final var twoThaumiumPipes = new ItemStack(BlockPipeSegment.pipe_segment_thaumium, 2);
ItemStack previousPipe = ItemApi.getBlock("blockTube", 0);
final var thaumiumBlock = ItemApi.getBlock("blockCosmeticSolid", 4);
final var bellows = ItemApi.getBlock("blockWoodenDevice", 0);
thaumiumPipeRecipe = ThaumcraftApi.addInfusionCraftingRecipe(
Research.PIPES_THAUMIUM,
twoThaumiumPipes,
3,
new AspectList().add(Aspect.METAL, 8)
.add(Aspect.MAGIC, 4)
.add(Aspect.VOID, 2),
thaumiumBlock,
new ItemStack[] { bellows, basicPipe, basicPipe, basicPipe, basicPipe, bellows, basicPipe, basicPipe,
basicPipe, basicPipe, });

final var thaumiumPipe = new ItemStack(BlockPipeSegment.pipe_segment_thaumium);
final var hungryChest = ItemApi.getBlock("blockChestHungry", 0);
final var voidmetalIngot = ItemApi.getItem("itemResource", 16);
final var twoVoidmetalPipes = new ItemStack(BlockPipeSegment.pipe_segment_voidmetal, 2);
voidmetalPipeRecipe = ThaumcraftApi.addInfusionCraftingRecipe(
Research.PIPES_VOIDMETAL,
twoVoidmetalPipes,
7,
new AspectList().add(Aspect.METAL, 16)
.add(Aspect.ELDRITCH, 16)
.add(Aspect.VOID, 8)
.add(Aspect.HUNGER, 8),
hungryChest,
new ItemStack[] { bellows, thaumiumPipe, voidmetalIngot, thaumiumPipe, voidmetalIngot, thaumiumPipe,
bellows, thaumiumPipe, voidmetalIngot, thaumiumPipe, voidmetalIngot, thaumiumPipe, });
if (Config.pipeEnabledBasic) {
final var basicPipe = new ItemStack(BlockPipeSegment.pipe_segment, 1);
basicPipeRecipe = ThaumcraftApi.addCrucibleRecipe(
Research.PIPES_BASIC,
basicPipe,
previousPipe,
new AspectList().add(Aspect.METAL, 3)
.add(Aspect.VOID, 3)
.add(Aspect.MOTION, 2)
.add(Aspect.SENSES, 1));
previousPipe = basicPipe;
}

;
if (Config.pipeEnabledThaumium) {
final var twoThaumiumPipes = new ItemStack(BlockPipeSegment.pipe_segment_thaumium, 2);
thaumiumPipeRecipe = ThaumcraftApi.addInfusionCraftingRecipe(
Research.PIPES_THAUMIUM,
twoThaumiumPipes,
3,
new AspectList().add(Aspect.METAL, 8)
.add(Aspect.MAGIC, 4)
.add(Aspect.VOID, 2),
thaumiumBlock,
new ItemStack[] { bellows, previousPipe, previousPipe, previousPipe, previousPipe, bellows,
previousPipe, previousPipe, previousPipe, previousPipe, });
previousPipe = new ItemStack(BlockPipeSegment.pipe_segment_thaumium, 1);
}

if (Config.pipeEnabledVoidmetal) {
final var hungryChest = ItemApi.getBlock("blockChestHungry", 0);
final var voidmetalIngot = ItemApi.getItem("itemResource", 16);
final var twoVoidmetalPipes = new ItemStack(BlockPipeSegment.pipe_segment_voidmetal, 2);
voidmetalPipeRecipe = ThaumcraftApi.addInfusionCraftingRecipe(
Research.PIPES_VOIDMETAL,
twoVoidmetalPipes,
7,
new AspectList().add(Aspect.METAL, 16)
.add(Aspect.ELDRITCH, 16)
.add(Aspect.VOID, 8)
.add(Aspect.HUNGER, 8),
hungryChest,
new ItemStack[] { bellows, previousPipe, voidmetalIngot, previousPipe, voidmetalIngot, previousPipe,
bellows, previousPipe, voidmetalIngot, previousPipe, voidmetalIngot, previousPipe, });
}
}
}
120 changes: 65 additions & 55 deletions src/main/java/dev/rndmorris/essentiapipes/Research.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,63 +29,73 @@ public static void postInit() {
new ResourceLocation("thaumcraft", "textures/blocks/alchemyblock.png"),
new ResourceLocation("thaumcraft", "textures/gui/gui_researchback.png"));

basicPipes = new ResearchItem(
PIPES_BASIC,
CATEGORY,
new AspectList().add(Aspect.METAL, 5)
.add(Aspect.MOTION, 3)
.add(Aspect.VOID, 1),
0,
-2,
1,
new ItemStack(Item.getItemFromBlock(BlockPipeSegment.pipe_segment)))
.setPages(
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.1"),
new ResearchPage(Recipes.basicPipeRecipe),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.2"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.3"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.4"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.5"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.6"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.7"))
.setParentsHidden("THAUMATORIUM")
.setAutoUnlock()
.registerResearchItem();
var previousResearch = "THAUMATORIUM";

thaumiumPipes = new ResearchItem(
PIPES_THAUMIUM,
CATEGORY,
new AspectList().add(Aspect.METAL, 7)
.add(Aspect.MAGIC, 5)
.add(Aspect.VOID, 3),
0,
0,
2,
new ItemStack(Item.getItemFromBlock(BlockPipeSegment.pipe_segment_thaumium)))
.setPages(
new ResearchPage("tc.research_page.essentiapipes:PIPES_THAUMIUM.1"),
new ResearchPage(Recipes.thaumiumPipeRecipe))
.setParents(PIPES_BASIC, "ARMORFORTRESS")
.setAutoUnlock()
.registerResearchItem();
if (Config.pipeEnabledBasic) {
basicPipes = new ResearchItem(
PIPES_BASIC,
CATEGORY,
new AspectList().add(Aspect.METAL, 5)
.add(Aspect.MOTION, 3)
.add(Aspect.VOID, 1),
0,
-2,
1,
new ItemStack(Item.getItemFromBlock(BlockPipeSegment.pipe_segment)))
.setPages(
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.1"),
new ResearchPage(Recipes.basicPipeRecipe),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.2"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.3"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.4"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.5"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.6"),
new ResearchPage("tc.research_page.essentiapipes:PIPES_BASIC.7"))
.setParentsHidden(previousResearch)
.setAutoUnlock()
.registerResearchItem();
previousResearch = PIPES_BASIC;
}

voidmetalPipes = new ResearchItem(
PIPES_VOIDMETAL,
CATEGORY,
new AspectList().add(Aspect.METAL, 9)
.add(Aspect.ELDRITCH, 7)
.add(Aspect.VOID, 5),
0,
2,
3,
new ItemStack(Item.getItemFromBlock(BlockPipeSegment.pipe_segment_voidmetal)))
.setPages(
new ResearchPage("tc.research_page.essentiapipes:PIPES_VOIDMETAL.1"),
new ResearchPage(Recipes.voidmetalPipeRecipe),
new ResearchPage("tc.research_page.essentiapipes:PIPES_VOIDMETAL.2"))
.setAutoUnlock()
.setParents(PIPES_THAUMIUM, "ESSENTIARESERVOIR", "HUNGRYCHEST")
.registerResearchItem();
if (Config.pipeEnabledThaumium) {
thaumiumPipes = new ResearchItem(
PIPES_THAUMIUM,
CATEGORY,
new AspectList().add(Aspect.METAL, 7)
.add(Aspect.MAGIC, 5)
.add(Aspect.VOID, 3),
0,
0,
2,
new ItemStack(Item.getItemFromBlock(BlockPipeSegment.pipe_segment_thaumium)))
.setPages(
new ResearchPage("tc.research_page.essentiapipes:PIPES_THAUMIUM.1"),
new ResearchPage(Recipes.thaumiumPipeRecipe))
.setParents(previousResearch, "ARMORFORTRESS")
.setAutoUnlock()
.registerResearchItem();
previousResearch = PIPES_THAUMIUM;
}

if (Config.pipeEnabledVoidmetal) {
voidmetalPipes = new ResearchItem(
PIPES_VOIDMETAL,
CATEGORY,
new AspectList().add(Aspect.METAL, 9)
.add(Aspect.ELDRITCH, 7)
.add(Aspect.VOID, 5),
0,
2,
3,
new ItemStack(Item.getItemFromBlock(BlockPipeSegment.pipe_segment_voidmetal)))
.setPages(
new ResearchPage("tc.research_page.essentiapipes:PIPES_VOIDMETAL.1"),
new ResearchPage(Recipes.voidmetalPipeRecipe),
new ResearchPage("tc.research_page.essentiapipes:PIPES_VOIDMETAL.2"))
.setAutoUnlock()
.setParents(previousResearch, "ESSENTIARESERVOIR", "HUNGRYCHEST")
.registerResearchItem();
}
}

}

0 comments on commit 2ddb003

Please sign in to comment.