Skip to content

Commit f44e50d

Browse files
committed
refactor(research): rename idea chip command and overhaul research tree
1 parent 18596cb commit f44e50d

156 files changed

Lines changed: 1268 additions & 1332 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/main/java/com/researchcube/command/ResearchCubeCommand.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,16 @@ public class ResearchCubeCommand {
4141
);
4242
};
4343

44+
private static final SuggestionProvider<CommandSourceStack> SUGGEST_RESEARCH_WITH_IDEA_CHIP = (context, builder) -> {
45+
Collection<ResearchDefinition> all = ResearchRegistry.getAll();
46+
return SharedSuggestionProvider.suggestResource(
47+
all.stream()
48+
.filter(def -> def.getIdeaChip().isPresent())
49+
.map(ResearchDefinition::getId),
50+
builder
51+
);
52+
};
53+
4454
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
4555
dispatcher.register(Commands.literal("researchcube")
4656
.requires(src -> src.hasPermission(2))
@@ -70,11 +80,11 @@ public static void register(CommandDispatcher<CommandSourceStack> dispatcher) {
7080
.executes(ctx -> addToDrive(ctx, false))
7181
.then(Commands.argument("force", BoolArgumentType.bool())
7282
.executes(ctx -> addToDrive(ctx, BoolArgumentType.getBool(ctx, "force"))))))
73-
.then(Commands.literal("giveChip")
83+
.then(Commands.literal("ideaChip")
7484
.then(Commands.argument("player", EntityArgument.player())
7585
.then(Commands.argument("research", ResourceLocationArgument.id())
76-
.suggests(SUGGEST_RESEARCH)
77-
.executes(ResearchCubeCommand::giveChip))))
86+
.suggests(SUGGEST_RESEARCH_WITH_IDEA_CHIP)
87+
.executes(ResearchCubeCommand::giveIdeaChip))))
7888
.then(Commands.literal("help")
7989
.executes(ResearchCubeCommand::help))
8090
);
@@ -238,7 +248,7 @@ private static int addToDrive(CommandContext<CommandSourceStack> ctx, boolean fo
238248
return 1;
239249
}
240250

241-
private static int giveChip(CommandContext<CommandSourceStack> ctx) throws CommandSyntaxException {
251+
private static int giveIdeaChip(CommandContext<CommandSourceStack> ctx) throws CommandSyntaxException {
242252
ServerPlayer player = EntityArgument.getPlayer(ctx, "player");
243253
ResourceLocation researchId = ResourceLocationArgument.getId(ctx, "research");
244254
CommandSourceStack source = ctx.getSource();
@@ -283,7 +293,7 @@ private static int help(CommandContext<CommandSourceStack> ctx) {
283293
source.sendSuccess(() -> Component.literal("/researchcube addToDrive <research> [force]")
284294
.withStyle(ChatFormatting.YELLOW)
285295
.append(Component.literal(" - Add research recipes to held drive").withStyle(ChatFormatting.GRAY)), false);
286-
source.sendSuccess(() -> Component.literal("/researchcube giveChip <player> <research>")
296+
source.sendSuccess(() -> Component.literal("/researchcube ideaChip <player> <research>")
287297
.withStyle(ChatFormatting.YELLOW)
288298
.append(Component.literal(" - Give the idea chip for a research").withStyle(ChatFormatting.GRAY)), false);
289299
source.sendSuccess(() -> Component.literal("/researchcube help")

src/main/resources/data/researchcube/advancement/research/advanced_processor.json

Lines changed: 0 additions & 20 deletions
This file was deleted.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"parent": "researchcube:root",
3+
"display": {
4+
"icon": {
5+
"id": "researchcube:cube_advanced"
6+
},
7+
"title": "Alloy Blending",
8+
"description": "Complete the Alloy Blending research",
9+
"show_toast": true,
10+
"announce_to_chat": true
11+
},
12+
"criteria": {
13+
"research_complete": {
14+
"trigger": "researchcube:complete_research",
15+
"conditions": {
16+
"research_id": "researchcube:alloy_blending"
17+
}
18+
}
19+
}
20+
}

src/main/resources/data/researchcube/advancement/research/alloy_fabrication.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/main/resources/data/researchcube/advancement/research/fragmented_data.json renamed to src/main/resources/data/researchcube/advancement/research/basic_smelting.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
"icon": {
55
"id": "researchcube:cube_unstable"
66
},
7-
"title": "Fragmented Data",
8-
"description": "Complete the Fragmented Data research",
7+
"title": "Basic Smelting",
8+
"description": "Complete the Basic Smelting research",
99
"show_toast": true,
1010
"announce_to_chat": true
1111
},
1212
"criteria": {
1313
"research_complete": {
1414
"trigger": "researchcube:complete_research",
1515
"conditions": {
16-
"research_id": "researchcube:fragmented_data"
16+
"research_id": "researchcube:basic_smelting"
1717
}
1818
}
1919
}

src/main/resources/data/researchcube/advancement/research/biophotonic_matrix.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/main/resources/data/researchcube/advancement/research/cognitive_framework.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/main/resources/data/researchcube/advancement/research/energy_handling.json renamed to src/main/resources/data/researchcube/advancement/research/copper_shaping.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
"icon": {
55
"id": "researchcube:cube_basic"
66
},
7-
"title": "Energy Handling",
8-
"description": "Complete the Energy Handling research",
7+
"title": "Copper Shaping",
8+
"description": "Complete the Copper Shaping research",
99
"show_toast": true,
1010
"announce_to_chat": true
1111
},
1212
"criteria": {
1313
"research_complete": {
1414
"trigger": "researchcube:complete_research",
1515
"conditions": {
16-
"research_id": "researchcube:energy_handling"
16+
"research_id": "researchcube:copper_shaping"
1717
}
1818
}
1919
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"parent": "researchcube:root",
3+
"display": {
4+
"icon": {
5+
"id": "researchcube:cube_self_aware"
6+
},
7+
"title": "Cosmic Assembly",
8+
"description": "Complete the Cosmic Assembly research",
9+
"show_toast": true,
10+
"announce_to_chat": true
11+
},
12+
"criteria": {
13+
"research_complete": {
14+
"trigger": "researchcube:complete_research",
15+
"conditions": {
16+
"research_id": "researchcube:cosmic_assembly"
17+
}
18+
}
19+
}
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"parent": "researchcube:root",
3+
"display": {
4+
"icon": {
5+
"id": "researchcube:cube_precise"
6+
},
7+
"title": "Crystal Growing",
8+
"description": "Complete the Crystal Growing research",
9+
"show_toast": true,
10+
"announce_to_chat": true
11+
},
12+
"criteria": {
13+
"research_complete": {
14+
"trigger": "researchcube:complete_research",
15+
"conditions": {
16+
"research_id": "researchcube:crystal_growing"
17+
}
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)