Search in sources :

Example 1 with Builder

use of net.minecraft.advancements.Advancement.Builder in project blueprint by team-abnormals.

the class AdvancementModificationManager method apply.

@Override
protected void apply(Map<ResourceLocation, JsonElement> map, ResourceManager resourceManager, ProfilerFiller profiler) {
    this.reset();
    SelectionSpace unmodifiedAdvancements = this.getUnmodifiedEntries();
    for (Map.Entry<ResourceLocation, JsonElement> entry : map.entrySet()) {
        ResourceLocation resourcelocation = entry.getKey();
        if (resourcelocation.getPath().startsWith("_"))
            continue;
        try {
            TargetedModifier<Builder, Void, DeserializationContext> targetedAdvancementModifier = TargetedModifier.deserialize(entry.getValue().getAsJsonObject(), "advancement", new DeserializationContext(resourcelocation, this.lootPredicateManager), AdvancementModifiers.REGISTRY, true);
            this.addModifiers(targetedAdvancementModifier.getTargetSelector().getTargetNames(unmodifiedAdvancements), targetedAdvancementModifier.getPriority(), targetedAdvancementModifier.getConfiguredModifiers());
        } catch (IllegalArgumentException | JsonParseException jsonparseexception) {
            Blueprint.LOGGER.error("Parsing error loading Advancement Modifier: {}", resourcelocation, jsonparseexception);
        }
    }
    Blueprint.LOGGER.info("Advancement Modification Manager has assigned {} sets of modifiers", this.size());
}
Also used : SelectionSpace(com.teamabnormals.blueprint.core.util.modification.targeting.SelectionSpace) JsonElement(com.google.gson.JsonElement) ResourceLocation(net.minecraft.resources.ResourceLocation) GsonBuilder(com.google.gson.GsonBuilder) Builder(net.minecraft.advancements.Advancement.Builder) DeserializationContext(net.minecraft.advancements.critereon.DeserializationContext) JsonParseException(com.google.gson.JsonParseException) Map(java.util.Map)

Aggregations

GsonBuilder (com.google.gson.GsonBuilder)1 JsonElement (com.google.gson.JsonElement)1 JsonParseException (com.google.gson.JsonParseException)1 SelectionSpace (com.teamabnormals.blueprint.core.util.modification.targeting.SelectionSpace)1 Map (java.util.Map)1 Builder (net.minecraft.advancements.Advancement.Builder)1 DeserializationContext (net.minecraft.advancements.critereon.DeserializationContext)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1