Search in sources :

Example 1 with AdvancementBridge

use of org.spongepowered.common.bridge.advancements.AdvancementBridge in project SpongeCommon by SpongePowered.

the class SpongeAdvancementBuilder method build0.

@Override
public Advancement build0() {
    final Tuple<Map<String, Criterion>, String[][]> result = SpongeCriterionUtil.toVanillaCriteriaData(this.criterion);
    final AdvancementRewards rewards = AdvancementRewards.EMPTY;
    final ResourceLocation resourceLocation = (ResourceLocation) (Object) key;
    final net.minecraft.advancements.DisplayInfo displayInfo = this.displayInfo == null ? null : new net.minecraft.advancements.DisplayInfo(ItemStackUtil.fromSnapshotToNative(this.displayInfo.icon()), SpongeAdventure.asVanilla(this.displayInfo.title()), SpongeAdventure.asVanilla(this.displayInfo.description()), this.backgroundPath, (FrameType) (Object) this.displayInfo.type(), this.displayInfo.doesShowToast(), this.displayInfo.doesAnnounceToChat(), this.displayInfo.isHidden());
    final net.minecraft.advancements.Advancement parent = (net.minecraft.advancements.Advancement) this.parent;
    final Advancement advancement = (Advancement) new net.minecraft.advancements.Advancement(resourceLocation, parent, displayInfo, rewards, result.first(), result.second());
    ((AdvancementBridge) advancement).bridge$setCriterion(this.criterion);
    return advancement;
}
Also used : AdvancementRewards(net.minecraft.advancements.AdvancementRewards) ResourceLocation(net.minecraft.resources.ResourceLocation) FrameType(net.minecraft.advancements.FrameType) AdvancementBridge(org.spongepowered.common.bridge.advancements.AdvancementBridge) Map(java.util.Map) Advancement(org.spongepowered.api.advancement.Advancement)

Aggregations

Map (java.util.Map)1 AdvancementRewards (net.minecraft.advancements.AdvancementRewards)1 FrameType (net.minecraft.advancements.FrameType)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 Advancement (org.spongepowered.api.advancement.Advancement)1 AdvancementBridge (org.spongepowered.common.bridge.advancements.AdvancementBridge)1