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


Java InventoryArchetype类代码示例

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


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

示例1: create

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public SimpleCustomInventory create(DataHolder dataHolder) {
    SimpleCustomInventory result = new SimpleCustomInventory(this, dataHolder);
    String typeId = getTypeId();
    InventoryArchetype archetype = InventoryArchetype.builder()
            .with(InventoryArchetypes.DOUBLE_CHEST)
            .property(new InventoryDimension(INVENTORY_SLOTS_WIDTH, getHeight()))
            .build(typeId, typeId);
    Inventory inventory = Inventory.builder()
            .of(archetype)
            .listener(InteractInventoryEvent.class, result)
            .build(CustomItemLibrary.getInstance());

    result.setInventory(inventory);
    populate(result);

    return result;
}
 
开发者ID:Limeth,项目名称:CustomItemLibrary,代码行数:19,代码来源:SimpleCustomInventoryDefinition.java

示例2: registerDefaults

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public void registerDefaults() {
    register(new UnknownInventoryArchetype("minecraft", "unknown"));
    register(new UnknownInventoryArchetype("minecraft", "empty"));

    for (Class<?> target : Arrays.asList(VanillaInventoryArchetypes.class, SpongeInventoryArchetypes.class)) {
        for (Field field : target.getFields()) {
            if (LanternInventoryArchetype.class.isAssignableFrom(field.getType())) {
                try {
                    register((InventoryArchetype) field.get(null));
                } catch (IllegalAccessException e) {
                    throw new IllegalStateException(e);
                }
            }
        }
    }
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:18,代码来源:InventoryArchetypeRegistryModule.java

示例3: getArchetypes

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
protected List<InventoryArchetype> getArchetypes() {
    if (this.cachedArchetypesList == null) {
        final List<PrioritizedObject<InventoryArchetype>> list = new ArrayList<>();
        for (int y = 0; y < this.slots.length; y++) {
            for (int x = 0; x < this.slots[y].length; x++) {
                checkState(this.slots[y][x] != null, "There is no slot bound at %s;%s", x, y);
                list.add((PrioritizedObject) this.slots[y][x]);
            }
        }
        this.cachedArchetypesList = list.stream()
                .sorted()
                .map(entry -> entry.object)
                .collect(ImmutableList.toImmutableList());
    }
    return this.cachedArchetypesList;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:18,代码来源:AbstractGridInventory.java

示例4: Open

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
public CommandResult Open(CommandSource src, CommandContext args, InventoryArchetype invArch, Text inventorytitle) {
    final Inventory invx = Inventory.builder().of(invArch)
            .property(InventoryTitle.PROPERTY_NAME, new InventoryTitle(inventorytitle))
            .build(vt);
    return this.Open(src, args, invx);

}
 
开发者ID:poqdavid,项目名称:VirtualTool,代码行数:8,代码来源:Invs.java

示例5: from

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public InventoryArchetype.Builder from(InventoryArchetype value) {
    checkNotNull(value, "value");
    this.baseArchetype = (LanternInventoryArchetype<?>) value;
    this.archetypes.clear();
    this.properties.clear();
    return this;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:9,代码来源:LanternInventoryArchetypeBuilder.java

示例6: reset

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public InventoryArchetype.Builder reset() {
    this.baseArchetype = null;
    this.archetypes.clear();
    this.properties.clear();
    return this;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:LanternInventoryArchetypeBuilder.java

示例7: with

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public InventoryArchetype.Builder with(InventoryArchetype archetype) {
    checkNotNull(archetype, "archetype");
    if (this.baseArchetype != null && this.baseArchetype.getBuilder() instanceof AbstractSlot.Builder) {
        throw new IllegalArgumentException("Slots cannot contain children InventoryArchetypes.");
    }
    this.archetypes.add((LanternInventoryArchetype<?>) archetype);
    return this;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:10,代码来源:LanternInventoryArchetypeBuilder.java

示例8: of

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public LanternInventoryBuilder<T> of(InventoryArchetype archetype) {
    checkNotNull(archetype, "archetype");
    this.inventoryArchetype = (LanternInventoryArchetype<T>) archetype;
    this.builder = null; // Regenerate the builder if needed
    return this;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:LanternInventoryBuilder.java

示例9: parseInventory

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
private static Inventory parseInventory(ItemBank<ItemStack, Logger, Player, World> plugin, AccountPage<ItemStack> page, String ownerName, World world) {
    String name = ownerName + "'s Account for " + world.getName() + " - Page " + page.getPage();
    InventoryArchetype.Builder builder = InventoryArchetype.builder().property(new InventoryCapacity(54)).title(Text.of(name));
    for (int i = 0; i < 54; i++) {
        builder.with(InventoryArchetype.builder().from(InventoryArchetypes.SLOT).property(new SlotIndex(i)).build("minecraft:slot" + i, "Slot"));
    }

    Inventory inventory = Inventory.builder().of(builder.build(plugin.getId() + ":" + name.replace("\\s", "_").replace("'", "").replace("-", ""), name)).build(plugin);
    page.getSlots().values().forEach(slot -> setItem(inventory, slot.getSlot(), slot.getItemStack()));
    return inventory;
}
 
开发者ID:Musician101,项目名称:ItemBank,代码行数:12,代码来源:SpongeInventoryHandler.java

示例10: getInventoryType

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public InventoryArchetype getInventoryType() {
    return InventoryArchetypeRegistryModule.getInstance().getById(inventoryType).orElse(InventoryArchetypes.UNKNOWN);
}
 
开发者ID:Guichaguri,项目名称:PacketControl,代码行数:5,代码来源:MixinPacketOpenWindow.java

示例11: setInventoryType

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public void setInventoryType(InventoryArchetype inventoryType) {
    this.inventoryType = inventoryType.getId();
}
 
开发者ID:Guichaguri,项目名称:PacketControl,代码行数:5,代码来源:MixinPacketOpenWindow.java

示例12: getArchetype

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public InventoryArchetype getArchetype() {
    return VanillaInventoryArchetypes.DOUBLE_CHEST;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:DoubleChestInventory.java

示例13: getArchetypes

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
protected List<InventoryArchetype> getArchetypes() {
    return Collections.emptyList();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:AbstractInventorySlot.java

示例14: getArchetype

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public InventoryArchetype getArchetype() {
    return LanternInventoryArchetypes.EMPTY;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:LanternEmptyInventory.java

示例15: getArchetype

import org.spongepowered.api.item.inventory.InventoryArchetype; //导入依赖的package包/类
@Override
public InventoryArchetype getArchetype() {
    return this.archetype == null ? InventoryArchetypes.UNKNOWN : this.archetype;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:AbstractMutableInventory.java


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