Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3edfe12
Add layout and camera for a crafting plan graph view
claude Oct 11, 2026
855510d
Add a pannable and zoomable graph view for crafting plans
claude Oct 11, 2026
3336244
Default to the crafting plan graph and remember the chosen view
claude Oct 11, 2026
bb6c7b5
Collapse large crafting plan graphs to an overview that fits
claude Oct 11, 2026
7103193
Move crafting plan buttons out of the view toggler
claude Oct 11, 2026
ba466c2
Calm down the crafting plan graph styling
claude Oct 11, 2026
e846aaf
Color the whole path to failed nodes in the crafting plan graph
claude Oct 11, 2026
c9bb478
Animate crafting nodes in the crafting plan graph
claude Oct 11, 2026
06b40bb
Experiment: running border animation for crafting nodes
claude Oct 11, 2026
cb35f97
Use a running border for crafting nodes and fix gaps in flowing edges
claude Oct 11, 2026
08071df
Keep completed jobs in the crafting plan graph and add keyboard controls
claude Oct 11, 2026
f48f9e9
Show collapsed crafting plan graph nodes as a stack with a count pill
claude Oct 11, 2026
553173b
Always show the crafting plan graph legend and stop folding completed…
claude Oct 11, 2026
096c54e
Address review findings in the crafting plan views
claude Oct 11, 2026
ae97d81
Show the root of the crafting plan graph as a larger node
claude Oct 11, 2026
ae428b6
Show crafting jobs whose inputs were refused as blocked instead of fa…
claude Oct 12, 2026
d13965f
Show the graph view button first
claude Oct 12, 2026
c46a51f
Hide the crafting plan tree list view by default
claude Oct 12, 2026
862ff10
Update Integrated Crafting to 1.7.2-840
claude Oct 12, 2026
3c7cf42
Show the progress of crafting jobs in the crafting plan views
claude Oct 12, 2026
30b6373
Only show the crafting plan durations in the progress bar for running…
claude Oct 12, 2026
a7f1b4c
Show the owner and channel of running jobs on the top line of the pla…
claude Oct 12, 2026
4158174
Show the ingredients taken from storage in crafting plan previews
claude Oct 13, 2026
85e8bab
Merge remote-tracking branch 'origin/master-1.21-lts' into fix/crafti…
claude Oct 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package org.cyclops.integratedterminals.gametest;

import net.minecraft.core.BlockPos;
import net.minecraft.gametest.framework.GameTest;
import net.minecraft.gametest.framework.GameTestHelper;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.crafting.RecipeType;
import net.minecraft.world.level.block.entity.ChestBlockEntity;
import net.neoforged.neoforge.gametest.GameTestHolder;
import net.neoforged.neoforge.gametest.PrefixGameTestTemplate;
import org.apache.commons.lang3.tuple.Triple;
import org.cyclops.commoncapabilities.api.capability.recipehandler.IRecipeDefinition;
import org.cyclops.commoncapabilities.api.ingredient.IPrototypedIngredient;
import org.cyclops.commoncapabilities.api.ingredient.IngredientComponent;
import org.cyclops.integratedcrafting.core.CraftingHelpers;
import org.cyclops.integratedcrafting.gametest.GameTestHelpersIntegratedCrafting;
import org.cyclops.integratedcrafting.part.PartTypeInterfaceCrafting;
import org.cyclops.integrateddynamics.api.network.INetwork;
import org.cyclops.integrateddynamics.api.network.IPositionedAddonsNetworkIngredients;
import org.cyclops.integrateddynamics.core.helper.NetworkHelpers;
import org.cyclops.integratedterminals.Reference;
import org.cyclops.integratedterminals.api.terminalstorage.crafting.ITerminalCraftingPlan;
import org.cyclops.integratedterminals.api.terminalstorage.crafting.TerminalCraftingJobStatus;
import org.cyclops.integratedterminals.modcompat.integratedcrafting.TerminalCraftingOptionRecipeDefinition;
import org.cyclops.integratedterminals.modcompat.integratedcrafting.TerminalStorageTabIngredientCraftingHandlerCraftingNetwork;

import java.util.List;

/**
* Game tests for the crafting plans that are shown before a crafting job is started.
* @author rubensworks
*/
@GameTestHolder(Reference.MOD_ID)
@PrefixGameTestTemplate(false)
public class GameTestTerminalCraftingPlanPreview {

public static final BlockPos POS = BlockPos.ZERO.offset(2, 0, 2);
public static final int TIMEOUT = 2000;

/**
* Each job of a preview must show the ingredients it will take from storage.
*/
@GameTest(template = "empty10", templateNamespace = Reference.MOD_ID, timeoutTicks = TIMEOUT)
public void testCraftingPlanPreviewShowsStorageIngredients(GameTestHelper helper) {
GameTestHelpersIntegratedCrafting.INetworkPositions<PartTypeInterfaceCrafting.State> positions =
GameTestHelpersIntegratedCrafting.createBasicNetwork(helper, POS);
ChestBlockEntity chest = helper.getBlockEntity(POS.east());
chest.setItem(0, new ItemStack(Items.OAK_LOG, 2));
positions.interfaceRecipeAdders().get(0).accept(Triple.of(0, RecipeType.CRAFTING, ResourceLocation.fromNamespaceAndPath("minecraft", "chest")));
positions.interfaceRecipeAdders().get(0).accept(Triple.of(1, RecipeType.CRAFTING, ResourceLocation.fromNamespaceAndPath("minecraft", "oak_planks")));

helper.succeedWhen(() -> {
INetwork network = NetworkHelpers.getNetwork(helper.getLevel(), helper.absolutePos(POS), null)
.orElseThrow(() -> new IllegalStateException("Could not find a network"));
IRecipeDefinition recipe = CraftingHelpers.getCraftingNetworkChecked(network)
.getRecipeCraftingInterfaces(IPositionedAddonsNetworkIngredients.DEFAULT_CHANNEL).keySet().stream()
.filter(r -> r.getOutput().getInstances(IngredientComponent.ITEMSTACK).stream().anyMatch(s -> s.getItem() == Items.CHEST))
.findFirst()
.orElse(null);
helper.assertTrue(recipe != null, "The network does not expose the chest recipe yet");

ITerminalCraftingPlan<Integer> plan = new TerminalStorageTabIngredientCraftingHandlerCraftingNetwork()
.calculateCraftingPlan(network, IPositionedAddonsNetworkIngredients.DEFAULT_CHANNEL,
new TerminalCraftingOptionRecipeDefinition<>(IngredientComponent.ITEMSTACK, recipe), 1);
helper.assertValueEqual(plan.getStatus(), TerminalCraftingJobStatus.UNSTARTED, "Status of the plan");

// The chest takes nothing from storage, as its planks are crafted first
helper.assertTrue(plan.getBufferedIngredients().isEmpty(), "The chest job takes ingredients from storage");

// The planks are crafted from the logs in storage
helper.assertValueEqual(plan.getDependencies().size(), 1, "Dependencies of the chest job");
List<IPrototypedIngredient<?, ?>> storage = plan.getDependencies().get(0).getBufferedIngredients();
helper.assertValueEqual(storage.size(), 1, "Storage ingredients of the planks job");
ItemStack logs = (ItemStack) storage.get(0).getPrototype();
helper.assertValueEqual(logs.getItem(), Items.OAK_LOG, "Storage ingredient of the planks job");
helper.assertValueEqual(logs.getCount(), 2, "Storage quantity of the planks job");
});
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ protected static ITerminalCraftingPlan<Integer> newCraftingPlan(@Nullable ICraft
// The job has not started yet, so its remaining duration is equal to its total duration
long estimatedTickDuration = estimateTickDuration(getEstimatedRecipeDuration(craftingNetwork, craftingJob),
craftingJob.getAmountTotal(), dependencies);
// The buffer is only filled once the job starts, so show what it will take from storage
if (root) {
return new TerminalCraftingPlanCraftingJobDependencyGraph(
craftingJob.getId(),
Expand All @@ -224,7 +225,7 @@ protected static ITerminalCraftingPlan<Integer> newCraftingPlan(@Nullable ICraft
TerminalCraftingJobStatus.UNSTARTED,
craftingJob.getAmount(),
craftingJob.getAmountTotal(),
IntegratedCraftingHelpers.getPrototypesFromIngredients(craftingJob.getIngredientsStorageBuffer()),
IntegratedCraftingHelpers.getPrototypesFromIngredients(craftingJob.getIngredientsStorage()),
Collections.emptyList(),
TerminalCraftingPlanStatic.Label.VALID,
-1,
Expand All @@ -241,7 +242,7 @@ protected static ITerminalCraftingPlan<Integer> newCraftingPlan(@Nullable ICraft
TerminalCraftingJobStatus.UNSTARTED,
craftingJob.getAmount(),
craftingJob.getAmountTotal(),
IntegratedCraftingHelpers.getPrototypesFromIngredients(craftingJob.getIngredientsStorageBuffer()),
IntegratedCraftingHelpers.getPrototypesFromIngredients(craftingJob.getIngredientsStorage()),
Collections.emptyList(),
TerminalCraftingPlanStatic.Label.VALID,
-1,
Expand Down
Loading