Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
added more advancements
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinsdar committed Jul 20, 2024
1 parent 9cbc007 commit f2fb8fe
Showing 1 changed file with 45 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
package muramasa.gregtech.datagen;

import io.github.gregtechintergalactical.gtcore.data.GTCoreItems;
import muramasa.antimatter.data.AntimatterMaterialTypes;
import muramasa.antimatter.machine.Tier;
import muramasa.antimatter.machine.types.Machine;
import muramasa.antimatter.util.Utils;
import muramasa.gregtech.GTIRef;
import muramasa.gregtech.data.Machines;
import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.AdvancementRewards;
import net.minecraft.advancements.FrameType;
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
import net.minecraft.advancements.critereon.ItemPredicate;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.ItemLike;

import java.util.List;
import java.util.function.Consumer;

import static muramasa.antimatter.data.AntimatterDefaultTools.*;
import static muramasa.antimatter.data.AntimatterMaterialTypes.DUST;
import static muramasa.antimatter.data.AntimatterMaterialTypes.RAW_ORE;
import static muramasa.antimatter.data.AntimatterMaterialTypes.*;
import static muramasa.antimatter.data.AntimatterMaterials.*;
import static muramasa.antimatter.datagen.providers.AntimatterAdvancementProvider.*;
import static muramasa.antimatter.machine.Tier.BRONZE;
import static muramasa.antimatter.machine.Tier.STEEL;
import static muramasa.antimatter.machine.Tier.*;
import static muramasa.antimatter.util.TagUtils.getForgelikeItemTag;
import static muramasa.antimatter.util.Utils.hasItem;
import static muramasa.gregtech.data.Materials.Bronze;
import static muramasa.gregtech.data.Materials.Tin;
import static muramasa.gregtech.data.Machines.*;
import static muramasa.gregtech.data.Materials.*;

public class ProgressionAdvancements implements Consumer<Consumer<Advancement>> {

Expand All @@ -49,14 +51,48 @@ public void accept(Consumer<Advancement> consumer) {
.addCriterion("has_raw_copper", hasItem(DUST.getMaterialTag(Bronze))).save(consumer, getLoc(GTIRef.ID, "progression/bronze_dust"));
Advancement hammer = buildBasicAdvancement(bronzeDust, HAMMER.getToolItem(Bronze), "hammer", FrameType.TASK)
.addCriterion("has_hammer", hasItem(HAMMER.getTag())).save(consumer, getLoc(GTIRef.ID, "progression/hammer"));
Advancement bronzeSmallBoiler = buildBasicAdvancement(hammer, Machines.SOLID_FUEL_BOILER.getItem(BRONZE), "solid_fuel_boiler", FrameType.TASK)
.addCriterion("has_solid_fuel_boilers", hasItem(ItemPredicate.Builder.item().of(Machines.SOLID_FUEL_BOILER.getItem(BRONZE), Machines.SOLID_FUEL_BOILER.getItem(STEEL)).build()))
Advancement bronzeSmallBoiler = buildBasicAdvancement(hammer, SOLID_FUEL_BOILER.getItem(BRONZE), "bronze_solid_fuel_boiler", FrameType.TASK)
.addCriterion("has_solid_fuel_boilers", hasItem(SOLID_FUEL_BOILER.getItem(BRONZE)))
.save(consumer, getLoc(GTIRef.ID, "progression/bronze_small_boiler"));

buildBasicAdvancement(bronzeSmallBoiler, STEAM_ALLOY_SMELTER.getItem(BRONZE), "bronze_steam_alloy_smelter", FrameType.TASK)
.addCriterion("has_steam_alloy_smelter", hasItem(STEAM_ALLOY_SMELTER.getItem(BRONZE)))
.save(consumer, getLoc(GTIRef.ID, "progression/bronze_steam_alloy_smelter"));
buildBasicAdvancement(bronzeSmallBoiler, STEAM_FURNACE.getItem(BRONZE), "bronze_steam_furnace", FrameType.TASK)
.addCriterion("has_steam_furnace", hasItem(STEAM_FURNACE.getItem(BRONZE)))
.save(consumer, getLoc(GTIRef.ID, "progression/bronze_steam_furnace"));
buildBasicAdvancement(bronzeSmallBoiler, STEAM_MACERATOR.getItem(BRONZE), "bronze_steam_macerator", FrameType.TASK)
.addCriterion("has_steam_macerator", hasItem(STEAM_MACERATOR.getItem(BRONZE)))
.save(consumer, getLoc(GTIRef.ID, "progression/bronze_steam_macerator"));
buildBasicAdvancement(bronzeSmallBoiler, STEAM_EXTRACTOR.getItem(BRONZE), "bronze_steam_extractor", FrameType.TASK)
.addCriterion("has_steam_extractor", hasItem(STEAM_EXTRACTOR.getItem(BRONZE)))
.save(consumer, getLoc(GTIRef.ID, "progression/bronze_steam_extractor"));
Advancement bronzeSteamForgeHammer = buildBasicAdvancement(bronzeSmallBoiler, STEAM_FORGE_HAMMER.getItem(BRONZE), "bronze_steam_forge_hammer", FrameType.TASK)
.addCriterion("has_steam_forge_hammer", hasItem(STEAM_FORGE_HAMMER.getItem(BRONZE)))
.save(consumer, getLoc(GTIRef.ID, "progression/bronze_steam_forge_hammer"));
Advancement bronzeSteamCompressor = buildBasicAdvancement(bronzeSteamForgeHammer, STEAM_COMPRESSOR.getItem(BRONZE), "bronze_steam_compressor", FrameType.TASK)
.addCriterion("has_steam_compressor", hasItem(STEAM_COMPRESSOR.getItem(BRONZE)))
.save(consumer, getLoc(GTIRef.ID, "progression/bronze_steam_compressor"));
Advancement fireBrick= buildBasicAdvancement(bronzeSteamCompressor, GTCoreItems.FireBrick, "fire_brick", FrameType.TASK)
.addCriterion("has_fire_brick", hasItem(GTCoreItems.FireBrick))
.save(consumer, getLoc(GTIRef.ID, "progression/fire_brick"));
Advancement primitiveBlastFurnace = buildBasicAdvancement(fireBrick, PRIMITIVE_BLAST_FURNACE.getItem(NONE), "primitive_blast_furnace", FrameType.TASK)
.addCriterion("has_primitive_blast_furnace", hasItem(PRIMITIVE_BLAST_FURNACE.getItem(NONE)))
.save(consumer, getLoc(GTIRef.ID, "progression/primitive_blast_furnace"));
buildBasicAdvancement(fireBrick, COKE_OVEN.getItem(NONE), "coke_oven", FrameType.TASK)
.addCriterion("has_coke_oven", hasItem(COKE_OVEN.getItem(NONE)))
.save(consumer, getLoc(GTIRef.ID, "progression/coke_oven"));
Advancement steel = buildBasicAdvancement(primitiveBlastFurnace, INGOT.get(Steel), "steel_ingot", FrameType.GOAL)
.addCriterion("has_steel_ingot", hasItem(INGOT.getMaterialTag(Steel)))
.save(consumer, getLoc(GTIRef.ID, "progression/steel_ingot"));
}

public static Advancement.Builder buildBasicAdvancement(Advancement parent, ItemLike provider, String langComponent, FrameType type) {
return buildAdvancement(parent, provider, GTIRef.ID + ".advancements." + langComponent + ".title", GTIRef.ID + ".advancements." + langComponent + ".desc", type, true, true, false);
}

public static InventoryChangeTrigger.TriggerInstance hasMachine(Machine<?> machine){
List<Item> list = machine.getTiers().stream().map(machine::getItem).toList();
return hasItem(ItemPredicate.Builder.item().of(list.toArray(ItemLike[]::new)).build());
}

}

0 comments on commit f2fb8fe

Please sign in to comment.