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


Java MainPlayerInventory类代码示例

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


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

示例1: toString

import org.spongepowered.api.item.inventory.entity.MainPlayerInventory; //导入依赖的package包/类
public String toString(boolean unks) {
    if (remAs != null) {
        return "shared/" + remAs;
    }
    if (internal instanceof MainPlayerInventory) {
        return "player/" + ((PlayerInventory) (internal).parent()).getCarrier().get().getUniqueId().toString();
    }
    else if (internal instanceof CarriedInventory) {
        Object o = ((CarriedInventory) internal).getCarrier().orElse(null);
        if (o == null) {
            return "((UNKNOWN INVENTORY TYPE))";
        }
        if (o instanceof Entity) {
            return "entity/" + ((Entity) o).getUniqueId().toString();
        }
        else if (o instanceof TileEntityCarrier) {
            LocatableBlock lb = ((TileEntityCarrier) o).getLocatableBlock();
            return "block/" + new LocationTag(new UtilLocation(lb.getPosition(), lb.getWorld()));
        }
    }
    if (!unks) {
        // TODO: Handle all inventory types somehow???
        throw new RuntimeException("Inventory type not known to the system!");
    }
    else {
        return "((UNKNOWN INVENTORY TYPE))";
    }
}
 
开发者ID:DenizenScript,项目名称:Denizen2Sponge,代码行数:29,代码来源:InventoryTag.java


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