use of net.minecraft.advancement.AdvancementProgress in project SpeedRunIGT by RedLime.
the class ClientAdvancementManagerMixin method getCompleteAdvancementsCount.
private int getCompleteAdvancementsCount() {
int count = 0;
for (Advancement advancement : this.getManager().getAdvancements()) {
if (this.advancementProgresses.containsKey(advancement) && advancement.getDisplay() != null && !advancement.getId().getPath().startsWith("recipes")) {
AdvancementProgress advancementProgress = this.advancementProgresses.get(advancement);
advancementProgress.init(advancement.getCriteria(), advancement.getRequirements());
if (advancementProgress.isDone())
count++;
}
}
return count;
}
use of net.minecraft.advancement.AdvancementProgress in project SpeedRunIGT by RedLime.
the class ClientAdvancementManagerMixin method advancement.
@Redirect(method = "onAdvancements", at = @At(value = "INVOKE", target = "Ljava/util/Map$Entry;getValue()Ljava/lang/Object;"))
public Object advancement(Map.Entry<Identifier, AdvancementProgress> entry) {
InGameTimer timer = InGameTimer.getInstance();
Advancement advancement = this.manager.get(entry.getKey());
AdvancementProgress advancementProgress = entry.getValue();
assert advancement != null;
advancementProgress.init(advancement.getCriteria(), advancement.getRequirements());
if (advancementProgress.isDone() && timer.getStatus() != TimerStatus.NONE) {
// For Timelines
if (timer.getCategory() == RunCategories.ANY) {
if (Objects.equals(advancement.getId().getPath(), "story/follow_ender_eye")) {
timer.tryInsertNewTimeline("enter_stronghold");
} else if (Objects.equals(advancement.getId().getPath(), "nether/find_bastion")) {
timer.tryInsertNewTimeline("enter_bastion");
} else if (Objects.equals(advancement.getId().getPath(), "nether/find_fortress")) {
timer.tryInsertNewTimeline("enter_fortress");
}
}
timer.tryInsertNewAdvancement(advancement.getId().toString(), null);
// How Did We Get Here
if (timer.getCategory() == RunCategories.HOW_DID_WE_GET_HERE && Objects.equals(advancement.getId().toString(), new Identifier("nether/all_effects").toString())) {
InGameTimer.complete();
}
// Hero of Village
if (timer.getCategory() == RunCategories.HERO_OF_VILLAGE && Objects.equals(advancement.getId().toString(), new Identifier("adventure/hero_of_the_village").toString())) {
InGameTimer.complete();
}
// Arbalistic
if (timer.getCategory() == RunCategories.ARBALISTIC && Objects.equals(advancement.getId().toString(), new Identifier("adventure/arbalistic").toString())) {
InGameTimer.complete();
}
}
return entry.getValue();
}
Aggregations