Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…into crab
  • Loading branch information
AViewFromTheTop committed Nov 1, 2023
2 parents 685c990 + bd505cb commit 9f7fdd9
Showing 1 changed file with 80 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@
import net.minecraft.advancements.critereon.PlayerTrigger;
import net.minecraft.core.BlockPos;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.monster.EnderMan;
import net.minecraft.world.item.InstrumentItem;
Expand Down Expand Up @@ -167,79 +165,86 @@ public void init() {
AdvancementEvents.INIT.register(holder -> {
Advancement advancement = holder.value();
if (MiscConfig.get().modifyAdvancements) {
if (holder.id().equals(new ResourceLocation("adventure/adventuring_time"))) {
addBiomeRequirement(advancement, RegisterWorldgen.CYPRESS_WETLANDS);
addBiomeRequirement(advancement, RegisterWorldgen.MIXED_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.OASIS);
addBiomeRequirement(advancement, RegisterWorldgen.WARM_RIVER);
addBiomeRequirement(advancement, RegisterWorldgen.WARM_BEACH);
addBiomeRequirement(advancement, RegisterWorldgen.JELLYFISH_CAVES);
addBiomeRequirement(advancement, RegisterWorldgen.ARID_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.ARID_SAVANNA);
addBiomeRequirement(advancement, RegisterWorldgen.PARCHED_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.BIRCH_JUNGLE);
addBiomeRequirement(advancement, RegisterWorldgen.SPARSE_BIRCH_JUNGLE);
addBiomeRequirement(advancement, RegisterWorldgen.BIRCH_TAIGA);
addBiomeRequirement(advancement, RegisterWorldgen.SEMI_BIRCH_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.DARK_BIRCH_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.FLOWER_FIELD);
addBiomeRequirement(advancement, RegisterWorldgen.TEMPERATE_RAINFOREST);
addBiomeRequirement(advancement, RegisterWorldgen.RAINFOREST);
addBiomeRequirement(advancement, RegisterWorldgen.DARK_TAIGA);
addBiomeRequirement(advancement, RegisterWorldgen.OLD_GROWTH_BIRCH_TAIGA);
addBiomeRequirement(advancement, RegisterWorldgen.OLD_GROWTH_DARK_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.SNOWY_OLD_GROWTH_PINE_TAIGA);
} else if (holder.id().equals(new ResourceLocation("husbandry/balanced_diet"))) {
AdvancementAPI.addCriteria(advancement, "wilderwild:baobab_nut", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.BAOBAB_NUT).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:split_coconut", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.SPLIT_COCONUT).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:crab_claw", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.CRAB_CLAW).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:cooked_crab_claw", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.COOKED_CRAB_CLAW).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:prickly_pear", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.PRICKLY_PEAR).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:peeled_prickly_pear", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.PEELED_PRICKLY_PEAR).triggerInstance())
);
AdvancementAPI.addRequirements(advancement,
new AdvancementRequirements(new String[][]{{
"wilderwild:baobab_nut",
"wilderwild:split_coconut",
"wilderwild:crab_claw",
"wilderwild:cooked_crab_claw",
"wilderwild:prickly_pear",
"wilderwild:peeled_prickly_pear"
}})
);
} else if (holder.id().equals(new ResourceLocation("husbandry/bred_all_animals"))) {
AdvancementAPI.addCriteria(advancement, "wilderwild:crab", CriteriaTriggers.BRED_ANIMALS.createCriterion(
BredAnimalsTrigger.TriggerInstance.bredAnimals(EntityPredicate.Builder.entity().of(RegisterEntities.CRAB)).triggerInstance())
);
AdvancementAPI.addRequirements(advancement, new
AdvancementRequirements(new String[][]{{
"wilderwild:crab"
}})
);
} else if (holder.id().equals(new ResourceLocation("husbandry/tactical_fishing"))) {
AdvancementAPI.addCriteria(advancement, "wilderwild:crab_bucket", CriteriaTriggers.FILLED_BUCKET.createCriterion(
FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(RegisterItems.CRAB_BUCKET)).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:jellyfish_bucket", CriteriaTriggers.FILLED_BUCKET.createCriterion(
FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(RegisterItems.CRAB_BUCKET)).triggerInstance())
);
AdvancementAPI.addRequirements(advancement, new
AdvancementRequirements(new String[][]{{
"wilderwild:crab_bucket",
"wilderwild:jellyfish_bucket"
}})
);
switch (holder.id().toString()) {
case "minecraft:adventure/adventuring_time" -> {
addBiomeRequirement(advancement, RegisterWorldgen.CYPRESS_WETLANDS);
addBiomeRequirement(advancement, RegisterWorldgen.MIXED_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.OASIS);
addBiomeRequirement(advancement, RegisterWorldgen.WARM_RIVER);
addBiomeRequirement(advancement, RegisterWorldgen.WARM_BEACH);
addBiomeRequirement(advancement, RegisterWorldgen.JELLYFISH_CAVES);
addBiomeRequirement(advancement, RegisterWorldgen.ARID_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.ARID_SAVANNA);
addBiomeRequirement(advancement, RegisterWorldgen.PARCHED_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.BIRCH_JUNGLE);
addBiomeRequirement(advancement, RegisterWorldgen.SPARSE_BIRCH_JUNGLE);
addBiomeRequirement(advancement, RegisterWorldgen.BIRCH_TAIGA);
addBiomeRequirement(advancement, RegisterWorldgen.SEMI_BIRCH_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.DARK_BIRCH_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.FLOWER_FIELD);
addBiomeRequirement(advancement, RegisterWorldgen.TEMPERATE_RAINFOREST);
addBiomeRequirement(advancement, RegisterWorldgen.RAINFOREST);
addBiomeRequirement(advancement, RegisterWorldgen.DARK_TAIGA);
addBiomeRequirement(advancement, RegisterWorldgen.OLD_GROWTH_BIRCH_TAIGA);
addBiomeRequirement(advancement, RegisterWorldgen.OLD_GROWTH_DARK_FOREST);
addBiomeRequirement(advancement, RegisterWorldgen.SNOWY_OLD_GROWTH_PINE_TAIGA);
}
case "husbandry/balanced_diet" -> {
AdvancementAPI.addCriteria(advancement, "wilderwild:baobab_nut", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.BAOBAB_NUT).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:split_coconut", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.SPLIT_COCONUT).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:crab_claw", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.CRAB_CLAW).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:cooked_crab_claw", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.COOKED_CRAB_CLAW).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:prickly_pear", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.PRICKLY_PEAR).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:peeled_prickly_pear", CriteriaTriggers.CONSUME_ITEM.createCriterion(
ConsumeItemTrigger.TriggerInstance.usedItem(RegisterItems.PEELED_PRICKLY_PEAR).triggerInstance())
);
AdvancementAPI.addRequirements(advancement,
new AdvancementRequirements(new String[][]{{
"wilderwild:baobab_nut",
"wilderwild:split_coconut",
"wilderwild:crab_claw",
"wilderwild:cooked_crab_claw",
"wilderwild:prickly_pear",
"wilderwild:peeled_prickly_pear"
}})
);
}
case "husbandry/bred_all_animals" -> {
AdvancementAPI.addCriteria(advancement, "wilderwild:crab", CriteriaTriggers.BRED_ANIMALS.createCriterion(
BredAnimalsTrigger.TriggerInstance.bredAnimals(EntityPredicate.Builder.entity().of(RegisterEntities.CRAB)).triggerInstance())
);
AdvancementAPI.addRequirements(advancement, new
AdvancementRequirements(new String[][]{{
"wilderwild:crab"
}})
);
}
case "husbandry/tactical_fishing" -> {
AdvancementAPI.addCriteria(advancement, "wilderwild:crab_bucket", CriteriaTriggers.FILLED_BUCKET.createCriterion(
FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(RegisterItems.CRAB_BUCKET)).triggerInstance())
);
AdvancementAPI.addCriteria(advancement, "wilderwild:jellyfish_bucket", CriteriaTriggers.FILLED_BUCKET.createCriterion(
FilledBucketTrigger.TriggerInstance.filledBucket(ItemPredicate.Builder.item().of(RegisterItems.CRAB_BUCKET)).triggerInstance())
);
AdvancementAPI.addRequirements(advancement, new
AdvancementRequirements(new String[][]{{
"wilderwild:crab_bucket",
"wilderwild:jellyfish_bucket"
}})
);
}
default -> {
}
}
}
});
Expand Down

0 comments on commit 9f7fdd9

Please sign in to comment.