mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-27 15:17:59 +01:00
Fix sweet apple acres advancement
This commit is contained in:
parent
cfbf6832d0
commit
0995d01a2f
1 changed files with 9 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
package com.minelittlepony.unicopia.datagen.providers;
|
package com.minelittlepony.unicopia.datagen.providers;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
@ -95,7 +96,7 @@ public class UAdvancementsProvider extends FabricAdvancementProvider {
|
||||||
parent.child(UItems.TOAST).criterion("has_toast", hasItems(UItems.TOAST)).build(consumer, "toast")
|
parent.child(UItems.TOAST).criterion("has_toast", hasItems(UItems.TOAST)).build(consumer, "toast")
|
||||||
.child(UItems.BURNED_TOAST).hidden().criterion("has_burned_toast", hasItems(UItems.BURNED_TOAST)).build(consumer, "burn_toast");
|
.child(UItems.BURNED_TOAST).hidden().criterion("has_burned_toast", hasItems(UItems.BURNED_TOAST)).build(consumer, "burn_toast");
|
||||||
parent.child(UItems.GREEN_APPLE).criterion("has_apple", hasItems(UTags.Items.FRESH_APPLES)).build(consumer, "apple_route").children(p -> {
|
parent.child(UItems.GREEN_APPLE).criterion("has_apple", hasItems(UTags.Items.FRESH_APPLES)).build(consumer, "apple_route").children(p -> {
|
||||||
p.child(UItems.SWEET_APPLE).criterion("has_all_apples", hasItems(Items.APPLE, UItems.GREEN_APPLE, UItems.SWEET_APPLE, UItems.SOUR_APPLE, UItems.ROTTEN_APPLE, UItems.ZAP_APPLE, UItems.COOKED_ZAP_APPLE, Items.GOLDEN_APPLE)).build(consumer, "sweet_apple_acres");
|
requireAllItems(p.child(UItems.SWEET_APPLE), Items.APPLE, UItems.GREEN_APPLE, UItems.SWEET_APPLE, UItems.SOUR_APPLE, UItems.ROTTEN_APPLE, UItems.ZAP_APPLE, UItems.COOKED_ZAP_APPLE, Items.GOLDEN_APPLE).build(consumer, "sweet_apple_acres");
|
||||||
p.child(UItems.ZAP_BULB).criterion("has_zap_apple", hasItems(UItems.ZAP_APPLE)).build(consumer, "trick_apple").children(pp -> {
|
p.child(UItems.ZAP_BULB).criterion("has_zap_apple", hasItems(UItems.ZAP_APPLE)).build(consumer, "trick_apple").children(pp -> {
|
||||||
pp.child(UItems.ZAP_APPLE).hidden().criterion("eat_trick_apple", CustomEventCriterion.createFlying("eat_trick_apple")).build(consumer, "eat_trick_apple");
|
pp.child(UItems.ZAP_APPLE).hidden().criterion("eat_trick_apple", CustomEventCriterion.createFlying("eat_trick_apple")).build(consumer, "eat_trick_apple");
|
||||||
pp.child(UItems.ZAP_APPLE).hidden().criterion("feed_trick_apple", CustomEventCriterion.createFlying("feed_trick_apple")).build(consumer, "feed_trick_apple");
|
pp.child(UItems.ZAP_APPLE).hidden().criterion("feed_trick_apple", CustomEventCriterion.createFlying("feed_trick_apple")).build(consumer, "feed_trick_apple");
|
||||||
|
@ -130,6 +131,13 @@ public class UAdvancementsProvider extends FabricAdvancementProvider {
|
||||||
.child(UItems.GOLDEN_FEATHER).apply(d -> applyShedFeatherCriterions(d, 2048, 10000)).frame(AdvancementFrame.GOAL).build(consumer, "dedicated_flier");
|
.child(UItems.GOLDEN_FEATHER).apply(d -> applyShedFeatherCriterions(d, 2048, 10000)).frame(AdvancementFrame.GOAL).build(consumer, "dedicated_flier");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private AdvancementDisplayBuilder requireAllItems(AdvancementDisplayBuilder builder, ItemConvertible...items) {
|
||||||
|
List.of(items).forEach(item -> {
|
||||||
|
builder.criterion("has_" + Registries.ITEM.getId(item.asItem()).getPath(), hasItems(item));
|
||||||
|
});
|
||||||
|
return builder.criteriaMerger(AdvancementRequirements.CriterionMerger.AND);
|
||||||
|
}
|
||||||
|
|
||||||
private AdvancementDisplayBuilder applyShedFeatherCriterions(AdvancementDisplayBuilder builder, int repeats, int experience) {
|
private AdvancementDisplayBuilder applyShedFeatherCriterions(AdvancementDisplayBuilder builder, int repeats, int experience) {
|
||||||
for (int i = 1; i <= repeats; i++) {
|
for (int i = 1; i <= repeats; i++) {
|
||||||
builder.criterion("shed_feather_" + i, CustomEventCriterion.createFlying("shed_feather", i));
|
builder.criterion("shed_feather_" + i, CustomEventCriterion.createFlying("shed_feather", i));
|
||||||
|
|
Loading…
Reference in a new issue