2023-12-03 15:41:58 +01:00
|
|
|
package de.ellpeck.actuallyadditions.data;
|
|
|
|
|
|
|
|
import de.ellpeck.actuallyadditions.api.ActuallyTags;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
|
|
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
|
|
|
import net.minecraft.advancements.Advancement;
|
2024-03-04 20:21:48 +01:00
|
|
|
import net.minecraft.advancements.AdvancementHolder;
|
|
|
|
import net.minecraft.advancements.AdvancementType;
|
|
|
|
import net.minecraft.advancements.CriteriaTriggers;
|
2023-12-03 15:41:58 +01:00
|
|
|
import net.minecraft.advancements.DisplayInfo;
|
2024-03-02 21:23:08 +01:00
|
|
|
import net.minecraft.advancements.critereon.ImpossibleTrigger;
|
|
|
|
import net.minecraft.advancements.critereon.InventoryChangeTrigger;
|
|
|
|
import net.minecraft.advancements.critereon.ItemPredicate;
|
2024-03-03 01:20:53 +01:00
|
|
|
import net.minecraft.core.HolderLookup;
|
|
|
|
import net.minecraft.data.PackOutput;
|
|
|
|
import net.minecraft.network.chat.Component;
|
2024-03-02 21:23:08 +01:00
|
|
|
import net.minecraft.resources.ResourceLocation;
|
2024-03-04 20:21:48 +01:00
|
|
|
import net.neoforged.neoforge.common.data.AdvancementProvider;
|
|
|
|
import net.neoforged.neoforge.common.data.ExistingFileHelper;
|
2023-12-03 15:41:58 +01:00
|
|
|
|
2024-03-03 01:20:53 +01:00
|
|
|
import java.util.List;
|
2024-03-04 20:21:48 +01:00
|
|
|
import java.util.Optional;
|
2024-03-03 01:20:53 +01:00
|
|
|
import java.util.concurrent.CompletableFuture;
|
2023-12-03 15:41:58 +01:00
|
|
|
import java.util.function.Consumer;
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
public class AdvancementGenerator extends AdvancementProvider {
|
2024-03-03 01:20:53 +01:00
|
|
|
public AdvancementGenerator(PackOutput packOutput, CompletableFuture<HolderLookup.Provider> registries, ExistingFileHelper existingFileHelper) {
|
|
|
|
super(packOutput, registries, existingFileHelper, List.of(new ActuallyAdvancementGenerator()));
|
2023-12-03 15:41:58 +01:00
|
|
|
}
|
|
|
|
|
2024-03-03 01:20:53 +01:00
|
|
|
public static class ActuallyAdvancementGenerator implements AdvancementGenerator {
|
|
|
|
@Override
|
2024-03-04 20:21:48 +01:00
|
|
|
public void generate(HolderLookup.Provider registries, Consumer<AdvancementHolder> consumer, ExistingFileHelper existingFileHelper) {
|
|
|
|
AdvancementHolder root = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.display(new DisplayInfo(ActuallyItems.ITEM_BOOKLET.get().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.openBooklet"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.openBooklet.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
Optional.of(new ResourceLocation("textures/gui/advancements/backgrounds/stone.png")), AdvancementType.TASK, true, true, false))
|
|
|
|
.addCriterion("right_click", CriteriaTriggers.IMPOSSIBLE.createCriterion(new ImpossibleTrigger.TriggerInstance()))
|
2024-03-03 01:20:53 +01:00
|
|
|
.save(consumer, "actuallyadditions:root");
|
|
|
|
|
|
|
|
//TODO: Underwater Treasure Chest Advancement?
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder phantomFace = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(root)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_ITEMFACE.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftPhantomface"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftPhantomface.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
Optional.of(new ResourceLocation("textures/blocks/stone.png")), AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("phantom_face", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_ITEMFACE.get()))
|
|
|
|
.save(consumer, "actuallyadditions:craft_phantom_face");
|
|
|
|
|
|
|
|
|
|
|
|
Advancement.Builder.advancement()
|
|
|
|
.parent(phantomFace)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_LIQUIFACE.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLiquiface"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLiquiface.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("liquiface", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_LIQUIFACE.get()))
|
|
|
|
.save(consumer, "actuallyadditions:craft_liquiface");
|
|
|
|
|
|
|
|
Advancement.Builder.advancement()
|
|
|
|
.parent(phantomFace)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.PHANTOM_ENERGYFACE.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftEnergyface"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftEnergyface.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("energyface", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.PHANTOM_ENERGYFACE.get()))
|
|
|
|
.save(consumer, "actuallyadditions:craft_energyface");
|
|
|
|
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder coalGenerator = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(root)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.COAL_GENERATOR.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftCoalGen"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftCoalGen.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("coal_generator", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.COAL_GENERATOR.get()))
|
|
|
|
.save(consumer, "actuallyadditions:craft_coal_generator");
|
|
|
|
|
|
|
|
Advancement.Builder.advancement()
|
|
|
|
.parent(coalGenerator)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.LEAF_GENERATOR.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLeafGen"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLeafGen.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("leaf_generator", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.LEAF_GENERATOR.get()))
|
|
|
|
.save(consumer, "actuallyadditions:craft_leaf_generator");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder coffeeBeans = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(coalGenerator)
|
|
|
|
.display(new DisplayInfo(ActuallyItems.COFFEE_BEANS.get().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.pickUpCoffee"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.pickUpCoffee.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("coffee_beans", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyItems.COFFEE_BEANS.get()))
|
|
|
|
.save(consumer, "actuallyadditions:pickup_coffee");
|
|
|
|
|
|
|
|
Advancement.Builder.advancement()
|
|
|
|
.parent(coffeeBeans)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.COFFEE_MACHINE.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftCoffeeMachine"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftCoffeeMachine.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("coffee_machine", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.COFFEE_MACHINE.get()))
|
|
|
|
.save(consumer, "actuallyadditions:craft_coffee_machine");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder reconstructor = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(coalGenerator)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftReconstructor"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftReconstructor.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("atomic_reconstructor", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.ATOMIC_RECONSTRUCTOR.get()))
|
|
|
|
.save(consumer, "actuallyadditions:craft_reconstructor");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder makeFirstCrystal = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(reconstructor)
|
|
|
|
.display(new DisplayInfo(ActuallyItems.EMERADIC_CRYSTAL.get().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.makeCrystal"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.makeCrystal.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
|
|
|
ItemPredicate.Builder.item().of(ActuallyTags.Items.CRYSTALS).build())
|
|
|
|
)
|
|
|
|
.save(consumer, "actuallyadditions:make_first_crystal");
|
|
|
|
|
|
|
|
Advancement.Builder.advancement()
|
|
|
|
.parent(makeFirstCrystal)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.EMPOWERER.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftEmpowerer"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftEmpowerer.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("empowerer", InventoryChangeTrigger.TriggerInstance.hasItems(ActuallyBlocks.EMPOWERER.get()))
|
|
|
|
.save(consumer, "actuallyadditions:craft_empowerer");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder craftCrusher = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(reconstructor)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.CRUSHER.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftCrusher"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftCrusher.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
|
|
|
ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER.get()).build())
|
|
|
|
)
|
|
|
|
.save(consumer, "actuallyadditions:craft_crusher");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder craftDoubleCrusher = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(craftCrusher)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.CRUSHER_DOUBLE.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftDoubleCrusher"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftDoubleCrusher.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("crystal", InventoryChangeTrigger.TriggerInstance.hasItems(
|
|
|
|
ItemPredicate.Builder.item().of(ActuallyBlocks.CRUSHER_DOUBLE.get()).build())
|
|
|
|
)
|
|
|
|
.save(consumer, "actuallyadditions:craft_double_crusher");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder craftLaserRelay = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(reconstructor)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLaserRelay"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLaserRelay.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("laser_relay", InventoryChangeTrigger.TriggerInstance.hasItems(
|
|
|
|
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY.get()).build())
|
|
|
|
)
|
|
|
|
.save(consumer, "actuallyadditions:craft_laser_relay");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder craftLaserRelayAdvanced = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(craftLaserRelay)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ADVANCED.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayAdvanced"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayAdvanced.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("laser_relay_advanced", InventoryChangeTrigger.TriggerInstance.hasItems(
|
|
|
|
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ADVANCED.get()).build())
|
|
|
|
)
|
|
|
|
.save(consumer, "actuallyadditions:craft_laser_relay_advanced");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder craftLaserRelayExtreme = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(craftLaserRelayAdvanced)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_EXTREME.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayExtreme"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayExtreme.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("laser_relay_extreme", InventoryChangeTrigger.TriggerInstance.hasItems(
|
|
|
|
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_EXTREME.get()).build())
|
|
|
|
)
|
|
|
|
.save(consumer, "actuallyadditions:craft_laser_relay_extreme");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder craftLaserRelayItem = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(craftLaserRelay)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.LASER_RELAY_ITEM.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayItem"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftLaserRelayItem.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("laser_relay_item", InventoryChangeTrigger.TriggerInstance.hasItems(
|
|
|
|
ItemPredicate.Builder.item().of(ActuallyBlocks.LASER_RELAY_ITEM.get()).build())
|
|
|
|
)
|
|
|
|
.save(consumer, "actuallyadditions:craft_laser_relay_item");
|
|
|
|
|
2024-03-04 20:21:48 +01:00
|
|
|
AdvancementHolder craftItemInterface = Advancement.Builder.advancement()
|
2024-03-03 01:20:53 +01:00
|
|
|
.parent(craftLaserRelay)
|
|
|
|
.display(new DisplayInfo(ActuallyBlocks.ITEM_INTERFACE.get().asItem().getDefaultInstance(),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftItemInterface"),
|
|
|
|
Component.translatable("achievement.actuallyadditions.craftItemInterface.desc"),
|
2024-03-04 20:21:48 +01:00
|
|
|
null, AdvancementType.TASK, true, true, false))
|
2024-03-03 01:20:53 +01:00
|
|
|
.addCriterion("item_interface", InventoryChangeTrigger.TriggerInstance.hasItems(
|
|
|
|
ItemPredicate.Builder.item().of(ActuallyBlocks.ITEM_INTERFACE.get()).build())
|
|
|
|
)
|
|
|
|
.save(consumer, "actuallyadditions:craft_item_interface");
|
|
|
|
}
|
2023-12-03 15:41:58 +01:00
|
|
|
}
|
|
|
|
}
|