Skip to content

Commit

Permalink
Add experience rewards to challenge advancements (#4611)
Browse files Browse the repository at this point in the history
(fixes #4544)
  • Loading branch information
TheRealWormbo authored Jul 2, 2024
1 parent 3606b93 commit 4b9d595
Show file tree
Hide file tree
Showing 18 changed files with 76 additions and 20 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions Xplat/src/main/java/vazkii/botania/data/AdvancementProvider.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
*/
package vazkii.botania.data;

import net.minecraft.advancements.Advancement;
import net.minecraft.advancements.DisplayInfo;
import net.minecraft.advancements.FrameType;
import net.minecraft.advancements.RequirementsStrategy;
import net.minecraft.advancements.*;
import net.minecraft.advancements.critereon.*;
import net.minecraft.core.HolderLookup;
import net.minecraft.core.registries.BuiltInRegistries;
Expand Down Expand Up @@ -337,6 +334,7 @@ public void generate(HolderLookup.Provider lookup, Consumer<Advancement> consume
Advancement hardMode = Advancement.Builder.advancement()
.display(simple(BotaniaItems.lifeEssence, "gaiaGuardianHardmode", FrameType.CHALLENGE))
.parent(root)
.rewards(AdvancementRewards.Builder.experience(100))
.addCriterion("guardian", KilledTrigger.TriggerInstance.playerKilledEntity(
EntityPredicate.Builder.entity()
.of(BotaniaEntities.DOPPLEGANGER)
Expand All @@ -353,13 +351,15 @@ public void generate(HolderLookup.Provider lookup, Consumer<Advancement> consume
Advancement.Builder.advancement()
.display(simple(BotaniaItems.lokiRing, "lokiRingMany", FrameType.CHALLENGE))
.parent(lokiRing)
.rewards(AdvancementRewards.Builder.experience(85))
.addCriterion("place_blocks", new LokiPlaceTrigger.Instance(
ContextAwarePredicate.ANY, EntityPredicate.ANY, ItemPredicate.ANY, MinMaxBounds.Ints.atLeast(255)
))
.save(consumer, challengeId("loki_ring_many"));
Advancement.Builder.advancement()
.display(simple(BotaniaItems.pinkinator, "pinkinator", FrameType.CHALLENGE))
.parent(hardMode)
.rewards(AdvancementRewards.Builder.experience(40))
.addCriterion("use_pinkinator", new UseItemSuccessTrigger.Instance(
ContextAwarePredicate.ANY, matchItems(BotaniaItems.pinkinator), LocationPredicate.ANY))
.save(consumer, challengeId("pinkinator"));
Expand All @@ -368,42 +368,49 @@ ContextAwarePredicate.ANY, matchItems(BotaniaItems.pinkinator), LocationPredicat
Advancement.Builder.advancement()
.display(simple(Blocks.PLAYER_HEAD, "gaiaGuardianNoArmor", FrameType.CHALLENGE))
.parent(root)
.rewards(AdvancementRewards.Builder.experience(1000))
.addCriterion("no_armor", new GaiaGuardianNoArmorTrigger.Instance(
ContextAwarePredicate.ANY, EntityPredicate.ANY, DamageSourcePredicate.ANY))
.save(consumer, challengeId("gaia_guardian_no_armor"));
Advancement.Builder.advancement()
.display(hidden(BotaniaBlocks.motifDaybloom, "old_flower_pickup", FrameType.CHALLENGE))
.parent(root)
.rewards(AdvancementRewards.Builder.experience(40))
.addCriterion("flower", onPickup(BotaniaBlocks.motifDaybloom, BotaniaBlocks.motifNightshade))
.requirements(RequirementsStrategy.OR)
.save(consumer, challengeId("old_flower_pickup"));
Advancement.Builder.advancement()
.display(simple(BotaniaBlocks.corporeaIndex, "superCorporeaRequest", FrameType.CHALLENGE))
.parent(root)
.rewards(AdvancementRewards.Builder.experience(85))
.addCriterion("big_request", new CorporeaRequestTrigger.Instance(
ContextAwarePredicate.ANY, MinMaxBounds.Ints.atLeast(CorporeaIndexBlockEntity.MAX_REQUEST), LocationPredicate.ANY))
.save(consumer, challengeId("super_corporea_request"));
Advancement.Builder.advancement()
.display(simple(BotaniaItems.terraPick, "rankSSPick", FrameType.CHALLENGE))
.parent(root)
.rewards(AdvancementRewards.Builder.experience(500))
.addCriterion("code_triggered", new ImpossibleTrigger.TriggerInstance())
.save(consumer, challengeId("rank_ss_pick"));
CompoundTag level20Shard = new CompoundTag();
level20Shard.putInt("level", 19);
Advancement.Builder.advancement()
.display(simple(BotaniaItems.laputaShard, "l20ShardUse", FrameType.CHALLENGE))
.parent(root)
.rewards(AdvancementRewards.Builder.experience(65))
.addCriterion("use_l20_shard", InventoryChangeTrigger.TriggerInstance.hasItems(
ItemPredicate.Builder.item().of(BotaniaItems.laputaShard).hasNbt(level20Shard).build()))
.save(consumer, challengeId("l20_shard_use"));
Advancement.Builder.advancement()
.display(hidden(Items.BREAD, "alfPortalBread", FrameType.CHALLENGE))
.parent(root)
.rewards(AdvancementRewards.Builder.experience(40))
.addCriterion("bread", new AlfheimPortalBreadTrigger.Instance(ContextAwarePredicate.ANY, LocationPredicate.ANY))
.save(consumer, challengeId("alf_portal_bread"));
Advancement.Builder.advancement()
.display(simple(BotaniaBlocks.tinyPotato, "tinyPotatoBirthday", FrameType.CHALLENGE))
.parent(root)
.rewards(AdvancementRewards.Builder.experience(40))
.addCriterion("code_triggered", new ImpossibleTrigger.TriggerInstance())
.save(consumer, challengeId("tiny_potato_birthday"));
}
Expand All @@ -415,6 +422,7 @@ private static Advancement relicBindAdvancement(Consumer<Advancement> consumer,
return Advancement.Builder.advancement()
.display(simple(relicItem, titleKey, FrameType.CHALLENGE))
.parent(parent)
.rewards(AdvancementRewards.Builder.experience(50))
.addCriterion(criterionName, new RelicBindTrigger.Instance(ContextAwarePredicate.ANY,
ItemPredicate.Builder.item().of(relicItem).build()))
.save(consumer, id);
Expand Down

0 comments on commit 4b9d595

Please sign in to comment.