当前位置: 首页>>代码示例>>Java>>正文


Java AdvancementTree类代码示例

本文整理汇总了Java中org.spongepowered.api.advancement.AdvancementTree的典型用法代码示例。如果您正苦于以下问题:Java AdvancementTree类的具体用法?Java AdvancementTree怎么用?Java AdvancementTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

AdvancementTree类属于org.spongepowered.api.advancement包,在下文中一共展示了AdvancementTree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: CachedPlayer

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
public CachedPlayer(Player player) {
    super(player);

    this.uuid = UUID.fromString(player.getUniqueId().toString());
    this.name = player.getName();
    this.isOnline = true;

    this.location = new CachedLocation(player.getLocation());
    this.rotation = player.getRotation().clone();
    this.velocity = player.getVelocity().clone();
    this.scale = player.getScale().clone();

    this.address = player.getConnection().getAddress().toString();
    this.latency = player.getConnection().getLatency();

    // Collect unlocked advancements
    for (AdvancementTree tree : player.getUnlockedAdvancementTrees()) {
        addUnlockedAdvancements(player, tree.getRootAdvancement());
    }

    // This will be moved to the other constructor once Sponge implements the offline inventory API
    this.helmet = player.getHelmet().map(ItemStack::copy).orElse(null);
    this.chestplate = player.getChestplate().map(ItemStack::copy).orElse(null);
    this.leggings = player.getLeggings().map(ItemStack::copy).orElse(null);
    this.boots = player.getBoots().map(ItemStack::copy).orElse(null);
    this.inventory = new CachedInventory(player.getInventory());
}
 
开发者ID:Valandur,项目名称:Web-API,代码行数:28,代码来源:CachedPlayer.java


示例2: onRegisterAdvancementTrees

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@Listener
public void onRegisterAdvancementTrees(GameRegistryEvent.Register<AdvancementTree> event) {
    // Create the advancement tree
    this.advancementTree = AdvancementTree.builder()
            .rootAdvancement(this.rootAdvancement)
            .background("minecraft:textures/blocks/dirt.png")
            .id("dirt")
            .build();
    event.register(this.advancementTree);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:11,代码来源:AdvancementTest.java


示例3: registerDefaults

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@DelayedRegistration(RegistrationPhase.INIT)
@Override
public void registerDefaults() {
    for (AdvancementTree tree : AdvancementTreeRegistryModule.get().getAll()) {
        final LanternTreeLayout layout = new LanternTreeLayout(tree);
        layout.generate();
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:AdvancementTreeLayoutModule.java


示例4: registerKeys

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@Override
public void registerKeys() {
    super.registerKeys();
    final ValueCollection c = getValueCollection();
    ((ElementKeyRegistration<?, Optional<AdvancementTree>>) c.get(LanternKeys.OPEN_ADVANCEMENT_TREE).get())
            .addListener((oldElement, newElement) -> {
                if (getWorld() != null) {
                    this.session.send(new MessagePlayOutSelectAdvancementTree(newElement.map(AdvancementTree::getId).orElse(null)));
                }
            });
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:12,代码来源:LanternPlayer.java


示例5: build

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@Override
public AdvancementTree build() {
    checkState(this.id != null, "The id must be set");
    checkState(this.rootAdvancement != null, "The root advancement must be set");
    checkState(!this.rootAdvancement.getTree().isPresent(),
            "The root advancement is already used by a different Advancement Tree.");
    return new LanternAdvancementTree(this);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:LanternAdvancementTreeBuilder.java


示例6: reset

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@Override
public AdvancementTree.Builder reset() {
    this.background = "minecraft:textures/gui/advancements/backgrounds/stone.png";
    this.rootAdvancement = null;
    this.name = null;
    this.id = null;
    return this;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:LanternAdvancementTreeBuilder.java


示例7: getUnlockedAdvancementTrees

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
public Collection<AdvancementTree> getUnlockedAdvancementTrees() {
    final ImmutableList.Builder<AdvancementTree> builder = ImmutableList.builder();
    for (AdvancementTree tree : AdvancementTreeRegistryModule.get().getAll()) {
        final Advancement advancement = tree.getRootAdvancement();
        final LanternAdvancementProgress progress = get(advancement);
        if ((!progress.dirtyVisibility && progress.visible) ||
                (progress.dirtyVisibility && shouldBeVisible(advancement))) {
            builder.add(tree);
        }
    }
    return builder.build();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:13,代码来源:LanternPlayerAdvancements.java


示例8: getElement

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@Override
public Optional<TreeLayoutElement> getElement(Advancement advancement) {
    final AdvancementTree tree = advancement.getTree().orElse(null);
    if (tree != this.advancementTree) {
        return Optional.empty();
    }
    return Optional.ofNullable(((LanternAdvancement) advancement).getLayoutElement());
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:LanternTreeLayout.java


示例9: onRegisterAdvancementTrees

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@Listener
public void onRegisterAdvancementTrees(GameRegistryEvent.Register<AdvancementTree> event) {
    this.advancementTree = AdvancementTree.builder()
            .rootAdvancement(this.rootAdvancement)
            .id("itemduct")
            .build();
    event.register(this.advancementTree);
}
 
开发者ID:CubeEngine,项目名称:modules-extra,代码行数:9,代码来源:Itemduct.java


示例10: getUnlockedAdvancementTrees

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@Override
public Collection<AdvancementTree> getUnlockedAdvancementTrees() {
    return this.advancementsProgress.getUnlockedAdvancementTrees();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternPlayer.java


示例11: setTree

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
void setTree(AdvancementTree advancementTree) {
    this.advancementTree = advancementTree;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:LanternAdvancement.java


示例12: getTree

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@Override
public Optional<AdvancementTree> getTree() {
    return Optional.ofNullable(this.advancementTree);
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternAdvancement.java


示例13: applyTree

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
private static void applyTree(Advancement advancement, AdvancementTree tree) {
    ((LanternAdvancement) advancement).setTree(tree);
    for (Advancement child : advancement.getChildren()) {
        applyTree(child, tree);
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:7,代码来源:LanternAdvancementTree.java


示例14: LanternTreeLayout

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
public LanternTreeLayout(AdvancementTree advancementTree) {
    this.advancementTree = advancementTree;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:4,代码来源:LanternTreeLayout.java


示例15: getTree

import org.spongepowered.api.advancement.AdvancementTree; //导入依赖的package包/类
@Override
public AdvancementTree getTree() {
    return this.advancementTree;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternTreeLayout.java



注:本文中的org.spongepowered.api.advancement.AdvancementTree类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。