Skip to content

Commit

Permalink
Added support for Advancements
Browse files Browse the repository at this point in the history
- added advancements to aid progression and help provide a checklist of what there is to do with the new ores and also guide the player
  • Loading branch information
Sephta committed Jun 24, 2024
1 parent 7f6cc5d commit 27afcc9
Show file tree
Hide file tree
Showing 21 changed files with 1,223 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.21+build.2
loader_version=0.15.11

# Mod Properties
mod_version=1.0.1
mod_version=1.1.1
maven_group=net.stal.alloys
archives_base_name=stal-alloys
modid=stal-alloys
Expand Down
1 change: 1 addition & 0 deletions src/main/java/net/stal/alloys/StalAlloysDataGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public void onInitializeDataGenerator(FabricDataGenerator fabricDataGenerator) {
pack.addProvider(StalAlloysBlockTagProvider::new);
pack.addProvider(StalAlloysModelProvider::new);
pack.addProvider(StalAlloysRecipeProvider::new);
pack.addProvider(StalAlloysAdvancementProvider::new);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,307 @@
package net.stal.alloys.datagen;

import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;

import net.fabricmc.fabric.api.datagen.v1.FabricDataOutput;
import net.fabricmc.fabric.api.datagen.v1.provider.FabricAdvancementProvider;
import net.minecraft.advancement.Advancement;
import net.minecraft.advancement.AdvancementEntry;
import net.minecraft.advancement.AdvancementFrame;
import net.minecraft.advancement.AdvancementRewards;
import net.minecraft.advancement.criterion.InventoryChangedCriterion;
import net.minecraft.registry.RegistryWrapper.WrapperLookup;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.stal.alloys.StalAlloys;
import net.stal.alloys.block.StalAlloysBlocks;
import net.stal.alloys.item.StalAlloysItems;

public class StalAlloysAdvancementProvider extends FabricAdvancementProvider {

public StalAlloysAdvancementProvider(FabricDataOutput output, CompletableFuture<WrapperLookup> registryLookup) {
super(output, registryLookup);
}

@SuppressWarnings("unused")
@Override
public void generateAdvancement(WrapperLookup registryLookup, Consumer<AdvancementEntry> consumer) {
AdvancementEntry alloySmelterRoot = Advancement.Builder.create()
.display(
StalAlloysBlocks.ALLOY_SMELTER,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_root_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_root_description_text"),
Identifier.of("textures/gui/advancements/backgrounds/stone.png"),
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("alloy_smelter_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysBlocks.ALLOY_SMELTER))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/alloy-smelter-root");

AdvancementEntry alloysTin = Advancement.Builder.create().parent(alloySmelterRoot)
.display(
StalAlloysItems.RAW_TIN,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_tin_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_tin_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("raw_tin_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.RAW_TIN))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/alloys-tin");

AdvancementEntry alloysBronze = Advancement.Builder.create().parent(alloysTin)
.display(
StalAlloysItems.BRONZE_INGOT,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_bronze_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_bronze_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("bronze_ingot_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRONZE_INGOT))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/alloys-bronze");

AdvancementEntry alloysZinc = Advancement.Builder.create().parent(alloySmelterRoot)
.display(
StalAlloysItems.RAW_ZINC,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_zinc_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_zinc_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("raw_zinc_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.RAW_ZINC))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/alloys-zinc");

AdvancementEntry alloysBrass = Advancement.Builder.create().parent(alloysZinc)
.display(
StalAlloysItems.BRASS_INGOT,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_brass_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_brass_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("brass_ingot_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRASS_INGOT))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/alloys-brass");

AdvancementEntry alloysNickel = Advancement.Builder.create().parent(alloySmelterRoot)
.display(
StalAlloysItems.RAW_NICKEL,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_nickel_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_nickel_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("raw_nickel_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.RAW_NICKEL))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/alloys-nickel");

AdvancementEntry alloysChromium = Advancement.Builder.create().parent(alloySmelterRoot)
.display(
StalAlloysItems.RAW_CHROMIUM,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_chromium_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_chromium_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("raw_chromium_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.RAW_CHROMIUM))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/alloys-chromium");

AdvancementEntry alloysStainlessSteel = Advancement.Builder.create().parent(alloysChromium)
.display(
StalAlloysItems.STAINLESS_STEEL_INGOT,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_stainless_steel_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_stainless_steel_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("chromium_ingot_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.CHROMIUM_INGOT))
.criterion("steel_ingot_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STEEL_INGOT))
.criterion("stainless_steel_ingot_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STAINLESS_STEEL_INGOT))
.rewards(AdvancementRewards.Builder.experience(15))
.build(consumer, StalAlloys.MOD_ID + "/alloys-stainless-steel");

AdvancementEntry alloysCarbon = Advancement.Builder.create().parent(alloySmelterRoot)
.display(
StalAlloysItems.RAW_CARBON,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_carbon_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_carbon_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("raw_carbon_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.RAW_CARBON))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/alloys-carbon");

AdvancementEntry carbonPlates = Advancement.Builder.create().parent(alloysCarbon)
.display(
StalAlloysItems.CARBON_PLATE,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_carbon_plate_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_carbon_plate_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("carbon_plate_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.CARBON_PLATE))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/carbon-plate");

AdvancementEntry alloysSteel = Advancement.Builder.create().parent(carbonPlates)
.display(
StalAlloysItems.STEEL_INGOT,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_steel_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_alloys_steel_description_text"),
null,
AdvancementFrame.TASK,
true,
true,
false
)
.criterion("steel_ingot_acquired", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STEEL_INGOT))
.rewards(AdvancementRewards.Builder.experience(10))
.build(consumer, StalAlloys.MOD_ID + "/alloys-steel");

AdvancementEntry nickelDecorativeBlocks = Advancement.Builder.create().parent(alloysNickel)
.display(
StalAlloysBlocks.CUT_NICKEL,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_nickel_decor_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_nickel_decor_description_text"),
null,
AdvancementFrame.GOAL,
true,
true,
false
)
.criterion("cut_nickel_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysBlocks.CUT_NICKEL))
.criterion("cut_nickel_slab_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysBlocks.CUT_NICKEL_SLAB))
.criterion("cut_nickel_stairs_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysBlocks.CUT_NICKEL_STAIRS))
.rewards(AdvancementRewards.Builder.experience(20))
.build(consumer, StalAlloys.MOD_ID + "/nickel-decorative-blocks");

AdvancementEntry copperTools = Advancement.Builder.create().parent(alloySmelterRoot)
.display(
StalAlloysItems.COPPER_PICKAXE,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_copper_tools_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_copper_tools_description_text"),
null,
AdvancementFrame.GOAL,
true,
true,
false
)
.criterion("copper_sword_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.COPPER_SWORD))
.criterion("copper_pickaxe_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.COPPER_PICKAXE))
.criterion("copper_axe_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.COPPER_AXE))
.criterion("copper_shovel_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.COPPER_SHOVEL))
.criterion("copper_hoe_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.COPPER_HOE))
.rewards(AdvancementRewards.Builder.experience(20))
.build(consumer, StalAlloys.MOD_ID + "/copper-tools");


AdvancementEntry steelTools = Advancement.Builder.create().parent(alloysSteel)
.display(
StalAlloysItems.STEEL_PICKAXE,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_steel_tools_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_steel_tools_description_text"),
null,
AdvancementFrame.GOAL,
true,
true,
false
)
.criterion("steel_pickaxe_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STEEL_PICKAXE))
.criterion("steel_axe_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STEEL_AXE))
.criterion("steel_shovel_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STEEL_SHOVEL))
.criterion("steel_hoe_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STEEL_HOE))
.rewards(AdvancementRewards.Builder.experience(20))
.build(consumer, StalAlloys.MOD_ID + "/steel-tools");

AdvancementEntry bronzeWeapons = Advancement.Builder.create().parent(alloysBronze)
.display(
StalAlloysItems.BRONZE_SWORD,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_bronze_weapons_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_bronze_weapons_description_text"),
null,
AdvancementFrame.GOAL,
true,
true,
false
)
.criterion("bronze_axe_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRONZE_AXE))
.criterion("bronze_dagger_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRONZE_DAGGER))
.criterion("bronze_dirk_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRONZE_DIRK))
.criterion("bronze_sword_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRONZE_SWORD))
.rewards(AdvancementRewards.Builder.experience(20))
.build(consumer, StalAlloys.MOD_ID + "/bronze-weapons");


AdvancementEntry brassArmor = Advancement.Builder.create().parent(alloysBrass)
.display(
StalAlloysItems.BRASS_CHESTPLATE,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_brass_armor_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_brass_armor_description_text"),
null,
AdvancementFrame.GOAL,
true,
true,
false
)
.criterion("brass_helment_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRASS_HELMET))
.criterion("brass_chestplate_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRASS_CHESTPLATE))
.criterion("brass_leggings_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRASS_LEGGINGS))
.criterion("brass_boots_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.BRASS_BOOTS))
.rewards(AdvancementRewards.Builder.experience(18))
.build(consumer, StalAlloys.MOD_ID + "/brass-armor");

AdvancementEntry stainlessSteelArmor = Advancement.Builder.create().parent(alloysStainlessSteel)
.display(
StalAlloysItems.STAINLESS_STEEL_CHESTPLATE,
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_stainless_steel_armor_title_text"),
Text.translatable(StalAlloys.MOD_ID + ":" + "advancement_stainless_steel_armor_description_text"),
null,
AdvancementFrame.GOAL,
true,
true,
false
)
.criterion("stainless_steel_helment_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STAINLESS_STEEL_HELMET))
.criterion("stainless_steel_chestplate_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STAINLESS_STEEL_CHESTPLATE))
.criterion("stainless_steel_leggings_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STAINLESS_STEEL_LEGGINGS))
.criterion("stainless_steel_boots_crafted", InventoryChangedCriterion.Conditions.items(StalAlloysItems.STAINLESS_STEEL_BOOTS))
.rewards(AdvancementRewards.Builder.experience(35))
.build(consumer, StalAlloys.MOD_ID + "/stainless-steel-armor");
}

}
37 changes: 36 additions & 1 deletion src/main/resources/assets/stal-alloys/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,40 @@
"itemGroup.stal-alloys": "STAL Alloys",

"key.category.stal-alloys.example": "Example Key Category",
"key.stal-alloys.example": "Example Key Binding"
"key.stal-alloys.example": "Example Key Binding",

"stal-alloys:advancement_root_title_text" : "Means of Production",
"stal-alloys:advancement_root_description_text" : "Craft an Alloy Smelter",
"stal-alloys:advancement_alloys_tin_title_text" : "Small Part of a Greater Whole",
"stal-alloys:advancement_alloys_tin_description_text" : "Acquire Raw Tin",
"stal-alloys:advancement_alloys_zinc_title_text" : "Greener Rocky Pastures",
"stal-alloys:advancement_alloys_zinc_description_text" : "Acquire Raw Zinc",
"stal-alloys:advancement_alloys_nickel_title_text" : "A Builder's Fusible Dream",
"stal-alloys:advancement_alloys_nickel_description_text" : "Acquire Raw Nickel",
"stal-alloys:advancement_alloys_chromium_title_text" : "The Path to End Game",
"stal-alloys:advancement_alloys_chromium_description_text" : "Acquire Raw Chromium",
"stal-alloys:advancement_alloys_carbon_title_text" : "As the Dust Settles",
"stal-alloys:advancement_alloys_carbon_description_text" : "Acquire Carbon Dust",
"stal-alloys:advancement_nickel_decor_title_text" : "The Cutting Room Floor",
"stal-alloys:advancement_nickel_decor_description_text" : "Use a Stone Cutter to craft Cut Nickel Blocks, Slabs, and Stairs",
"stal-alloys:advancement_carbon_plate_title_text" : "Don't Eat Off of This",
"stal-alloys:advancement_carbon_plate_description_text" : "Craft Carbon Plates",
"stal-alloys:advancement_alloys_bronze_title_text" : "The Bronze Age",
"stal-alloys:advancement_alloys_bronze_description_text" : "Smelt Tin and Copper into Bronze",
"stal-alloys:advancement_alloys_brass_title_text" : "The Brass Age",
"stal-alloys:advancement_alloys_brass_description_text" : "Smelt Zinc and Copper into Brass",
"stal-alloys:advancement_alloys_steel_title_text" : "Beyond Iron",
"stal-alloys:advancement_alloys_steel_description_text" : "Smelt Carbon Plates and Iron into Steel",
"stal-alloys:advancement_alloys_stainless_steel_title_text" : "The Beginning of the Endgame",
"stal-alloys:advancement_alloys_stainless_steel_description_text" : "Smelt Chromium and Steel into Stainless Steel",
"stal-alloys:advancement_copper_tools_title_text" : "Wasn't This Here the Whole Time?",
"stal-alloys:advancement_copper_tools_description_text" : "Use Copper Ingots to craft every Copper tool",
"stal-alloys:advancement_steel_tools_title_text" : "This Stuff is Tough",
"stal-alloys:advancement_steel_tools_description_text" : "Use Steel Ingots to craft every Steel tool",
"stal-alloys:advancement_bronze_weapons_title_text" : "Bolster Your Arsenal",
"stal-alloys:advancement_bronze_weapons_description_text" : "Use Bronze Ingots to craft every Bronze weapon",
"stal-alloys:advancement_brass_armor_title_text" : "Better Than Gold?",
"stal-alloys:advancement_brass_armor_description_text" : "Use Brass Ingots to craft Brass Armor",
"stal-alloys:advancement_stainless_steel_armor_title_text" : "I'm Happy You Made it This Far",
"stal-alloys:advancement_stainless_steel_armor_description_text" : "Use the Smithing Table to Craft Stainless Steel Armor"
}
Loading

0 comments on commit 27afcc9

Please sign in to comment.