本文整理汇总了Java中dan200.computercraft.api.peripheral.IComputerAccess.mount方法的典型用法代码示例。如果您正苦于以下问题:Java IComputerAccess.mount方法的具体用法?Java IComputerAccess.mount怎么用?Java IComputerAccess.mount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dan200.computercraft.api.peripheral.IComputerAccess
的用法示例。
在下文中一共展示了IComputerAccess.mount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: attach
import dan200.computercraft.api.peripheral.IComputerAccess; //导入方法依赖的package包/类
@Override
public void attach(IComputerAccess computer) {
super.attach(computer);
// mount anything required to this computer
if (mounts.isEmpty()) {
return;
}
if (methodAttach != null) {
try {
methodAttach.invoke(null);
} catch (IllegalAccessException | InvocationTargetException e) {
e.printStackTrace();
}
}
final int id = computer.getID();
// make an entry for this computer if there isn't one
if (!MOUNT_COUNTS.containsKey(id)) {
MOUNT_COUNTS.put(id, 0);
}
// perform the mount if needed
int count = MOUNT_COUNTS.get(id);
if (count++ == 0) {
for (IPFMount mount : mounts) {
computer.mount(mount.getMountLocation(), mount);
}
}
// remember how many peripherals are attached to this computer
MOUNT_COUNTS.put(id, count);
}
示例2: attach
import dan200.computercraft.api.peripheral.IComputerAccess; //导入方法依赖的package包/类
@Override
public void attach(IComputerAccess computer) {
computer.mount(DynamicMount.DIRECTORY, new DynamicMount(this));
}
示例3: detach
import dan200.computercraft.api.peripheral.IComputerAccess; //导入方法依赖的package包/类
@Override
public void detach(IComputerAccess computer) {
computer.mount(DynamicMount.DIRECTORY, new DynamicMount(this));
computer.unmount(DynamicMount.DIRECTORY);
}