本文整理汇总了Java中com.xcompwiz.mystcraft.api.linking.ILinkInfo类的典型用法代码示例。如果您正苦于以下问题:Java ILinkInfo类的具体用法?Java ILinkInfo怎么用?Java ILinkInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ILinkInfo类属于com.xcompwiz.mystcraft.api.linking包,在下文中一共展示了ILinkInfo类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getLocationOverride
import com.xcompwiz.mystcraft.api.linking.ILinkInfo; //导入依赖的package包/类
@Override
public Location getLocationOverride(World world, int x, int y, int z) {
if(book != null)
if(book.getItem() instanceof ItemLinking){
ItemLinking bookItem = (ItemLinking) book.getItem();
ILinkInfo info = bookItem.getLinkInfo(book);
if(info != null && info.getSpawn() != null)
if(LinkListenerManager.isLinkPermitted(world, new EntityChicken(world), info))
return new Location(MinecraftServer.getServer().worldServerForDimension(info.getDimensionUID()), info.getSpawn().posX, info.getSpawn().posY, info.getSpawn().posZ);
}
return null;
}
示例2: getLinkInfo
import com.xcompwiz.mystcraft.api.linking.ILinkInfo; //导入依赖的package包/类
private static ILinkInfo getLinkInfo(ItemStack stack) {
if (MystcraftAccess.linkingApi == null) return null;
final NBTTagCompound tag = stack.getTagCompound();
if (tag == null) return null;
return MystcraftAccess.linkingApi.createLinkInfo(tag);
}
示例3: getMeta
import com.xcompwiz.mystcraft.api.linking.ILinkInfo; //导入依赖的package包/类
@Override
public Object getMeta(IItemPortalActivator target, ItemStack stack) {
final ILinkInfo linkInfo = getLinkInfo(stack);
if (linkInfo == null) return null;
final String unlocalizedName = stack.getUnlocalizedName();
final boolean isLinkbook = "item.myst.linkbook".equals(unlocalizedName);
final boolean isAgebook = "item.myst.agebook".equals(unlocalizedName);
Map<String, Object> result = Maps.newHashMap();
result.put("type", isLinkbook? "link" : (isAgebook? "age" : "unknown"));
result.put("destination", linkInfo.getDisplayName());
result.put("dimension", linkInfo.getDimensionUID());
final LinkPropertyAPI linkPropertiesApi = MystcraftAccess.linkPropertiesApi;
if (linkPropertiesApi != null) {
final Collection<String> allProperties = linkPropertiesApi.getLinkProperties();
Set<String> flags = Sets.newHashSet();
for (String flag : allProperties)
if (linkInfo.getFlag(flag)) flags.add(flag);
result.put("flags", flags);
}
{
ChunkCoordinates coords = linkInfo.getSpawn();
if (coords != null) result.put("spawn", Lists.newArrayList(coords.posX, coords.posY, coords.posZ));
}
result.put("spawnYaw", linkInfo.getSpawnYaw());
return result;
}
示例4: callMethod
import com.xcompwiz.mystcraft.api.linking.ILinkInfo; //导入依赖的package包/类
@Override
public Object[] callMethod(IComputerAccess computer, int method, Object[] arguments) throws Exception {
switch (method) {
case 0: {
Future<Boolean> callback = TickHandler.addTickCallback(turtle.getWorld(), new Callable<Boolean>() {
@Override
public Boolean call() {
ItemStack slotstack = turtle.getSlotContents(turtle.getSelectedSlot());
if (slotstack == null || !isValidBook(slotstack) || slotstack.stackTagCompound == null) {
MiscPeripherals.debug("Link failed due to invalid item: "+slotstack+" "+(slotstack == null ? "N/A" : slotstack.getItem())+" "+(slotstack == null ? "N/A" : slotstack.stackTagCompound));
return false;
}
ILinkInfo lo = new LinkInfoStack(slotstack);
if (isLinkPermitted(lo)) {
WorldServer world = MinecraftServer.getServer().worldServerForDimension(lo.getDimensionUID());
if (world == null) {
MiscPeripherals.debug("Link failed due to null world: "+lo.getDimensionUID());
return false;
}
ChunkCoordinates dest = lo.getSpawn();
dest.posY += 2; // whatever weird thing mystcraft does to avoid the old linking through the ground glitch
if (Util.isPassthroughBlock(world, dest.posX, dest.posY, dest.posZ)) {
if (!lo.getFlag("Following")) {
for (int i = 0; i < 6; i++) {
if (turtle.dropItemStack(slotstack, i)) break;
}
turtle.setSlotContents(turtle.getSelectedSlot(), null);
}
if (lo.getFlag("Disarm")) {
for (int i = 0; i < turtle.getInventorySize(); i++) {
ItemStack stack = turtle.getSlotContents(i);
for (int j = 0; j < 6; j++) {
if (turtle.dropItemStack(stack, i)) break;
}
turtle.setSlotContents(i, null);
}
}
Vec3 pos = turtle.getPosition();
String sound = "myst.sound.link";
if (lo.getFlag("Disarm")) sound = "myst.sound.link-disarm";
else if (lo.getProperty("Sound") != null) sound = lo.getProperty("Sound");
else if (lo.getFlag("Following")) sound = "myst.sound.link-following";
else if (lo.getFlag("Intra Linking")) sound = "myst.sound.link-intra";
ByteArrayDataOutput os = ByteStreams.newDataOutput();
os.writeInt((int)pos.xCoord);
os.writeInt((int)pos.yCoord);
os.writeInt((int)pos.zCoord);
os.writeUTF(sound);
PacketDispatcher.sendPacketToAllAround(pos.xCoord + 0.5D, pos.yCoord + 0.5D, pos.zCoord + 0.5D, 64.0D, turtle.getWorld().provider.dimensionId, NetworkHelper.getModulePacket(MiscPeripherals.instance.modules.get("Mystcraft"), os.toByteArray()));
os = ByteStreams.newDataOutput();
os.writeInt(dest.posX);
os.writeInt(dest.posY);
os.writeInt(dest.posZ);
os.writeUTF(sound);
PacketDispatcher.sendPacketToAllAround(dest.posX + 0.5D, dest.posY + 0.5D, dest.posZ + 0.5D, 64.0D, world.provider.dimensionId, NetworkHelper.getModulePacket(MiscPeripherals.instance.modules.get("Mystcraft"), os.toByteArray()));
return Util.teleportTurtleTo(turtle, world, dest.posX, dest.posY, dest.posZ);
}
MiscPeripherals.debug("Link failed due to bad target "+world.getBlockId(dest.posX, dest.posY, dest.posZ));
return false;
}
MiscPeripherals.debug("Link failed due to not permitted");
return false;
}
});
return new Object[] {callback.get()};
}
}
return new Object[0];
}
示例5: isLinkPermitted
import com.xcompwiz.mystcraft.api.linking.ILinkInfo; //导入依赖的package包/类
private boolean isLinkPermitted(ILinkInfo lo) {
if (!lo.getFlag("Intra Linking") && lo.getDimensionUID() != turtle.getWorld().provider.dimensionId) return false;
return true;
}