本文整理汇总了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))";
}
}