Search in sources :

Example 1 with SpongeTreeLayout

use of org.spongepowered.common.advancement.SpongeTreeLayout in project SpongeCommon by SpongePowered.

the class MixinAdvancementTreeNode method onLayout.

@Inject(method = "layout", at = @At("RETURN"))
private static void onLayout(Advancement root, CallbackInfo ci) {
    final AdvancementTree advancementTree = ((org.spongepowered.api.advancement.Advancement) root).getTree().get();
    final TreeLayout layout = new SpongeTreeLayout((SpongeAdvancementTree) advancementTree);
    SpongeImpl.postEvent(SpongeEventFactory.createAdvancementTreeEventGenerateLayout(Sponge.getCauseStackManager().getCurrentCause(), layout, advancementTree));
}
Also used : SpongeTreeLayout(org.spongepowered.common.advancement.SpongeTreeLayout) SpongeAdvancementTree(org.spongepowered.common.advancement.SpongeAdvancementTree) AdvancementTree(org.spongepowered.api.advancement.AdvancementTree) SpongeTreeLayout(org.spongepowered.common.advancement.SpongeTreeLayout) TreeLayout(org.spongepowered.api.advancement.TreeLayout) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with SpongeTreeLayout

use of org.spongepowered.common.advancement.SpongeTreeLayout in project SpongeCommon by SpongePowered.

the class TreeNodePositionMixin method impl$onLayout.

@Inject(method = "run", at = @At("RETURN"))
private static void impl$onLayout(Advancement root, CallbackInfo ci) {
    final AdvancementTree advancementTree = ((org.spongepowered.api.advancement.Advancement) root).tree().get();
    final TreeLayout layout = new SpongeTreeLayout(advancementTree);
    final Cause cause = PhaseTracker.getCauseStackManager().currentCause();
    final AdvancementTreeEvent.GenerateLayout event = SpongeEventFactory.createAdvancementTreeEventGenerateLayout(cause, layout, advancementTree);
    SpongeCommon.post(event);
}
Also used : SpongeTreeLayout(org.spongepowered.common.advancement.SpongeTreeLayout) AdvancementTree(org.spongepowered.api.advancement.AdvancementTree) SpongeTreeLayout(org.spongepowered.common.advancement.SpongeTreeLayout) TreeLayout(org.spongepowered.api.advancement.TreeLayout) Cause(org.spongepowered.api.event.Cause) AdvancementTreeEvent(org.spongepowered.api.event.advancement.AdvancementTreeEvent) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

AdvancementTree (org.spongepowered.api.advancement.AdvancementTree)2 TreeLayout (org.spongepowered.api.advancement.TreeLayout)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2 SpongeTreeLayout (org.spongepowered.common.advancement.SpongeTreeLayout)2 Cause (org.spongepowered.api.event.Cause)1 AdvancementTreeEvent (org.spongepowered.api.event.advancement.AdvancementTreeEvent)1 SpongeAdvancementTree (org.spongepowered.common.advancement.SpongeAdvancementTree)1