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


Java MinecraftServer.getWorld方法代码示例

本文整理汇总了Java中net.minecraft.server.MinecraftServer.getWorld方法的典型用法代码示例。如果您正苦于以下问题:Java MinecraftServer.getWorld方法的具体用法?Java MinecraftServer.getWorld怎么用?Java MinecraftServer.getWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.server.MinecraftServer的用法示例。


在下文中一共展示了MinecraftServer.getWorld方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: teleportToDimension

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
public static void teleportToDimension(EntityPlayer player, int dimension, double x, double y, double z) {
    int oldDimension = player.getEntityWorld().provider.getDimension();
    EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player;
    MinecraftServer server = player.getEntityWorld().getMinecraftServer();
    WorldServer worldServer = server.getWorld(dimension);
    player.addExperienceLevel(0);


    worldServer.getMinecraftServer().getPlayerList().transferPlayerToDimension(entityPlayerMP, dimension, new RfToolsTeleporter(worldServer, x, y, z));
    player.setPositionAndUpdate(x, y, z);
    if (oldDimension == 1) {
        // For some reason teleporting out of the end does weird things.
        player.setPositionAndUpdate(x, y, z);
        worldServer.spawnEntity(player);
        worldServer.updateEntityWithOptionalForce(player, false);
    }
}
 
开发者ID:elytra,项目名称:tp-plus,代码行数:18,代码来源:CommandTPP.java

示例2: teleportToDimension

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
public static void teleportToDimension(EntityPlayer player, int dimension, double x, double y, double z) {
    int oldDimension = player.getEntityWorld().provider.getDimension();
    EntityPlayerMP entityPlayerMP = (EntityPlayerMP) player;
    MinecraftServer server = player.getEntityWorld().getMinecraftServer();
    WorldServer worldServer = server.getWorld(dimension);
    player.addExperienceLevel(0);


    worldServer.getMinecraftServer().getPlayerList().transferPlayerToDimension(entityPlayerMP, dimension, new WhooshTeleporter(worldServer, x, y, z));
    player.setPositionAndUpdate(x, y, z);
    if (oldDimension == 1) {
        // For some reason teleporting out of the end does weird things.
        player.setPositionAndUpdate(x, y, z);
        worldServer.spawnEntity(player);
        worldServer.updateEntityWithOptionalForce(player, false);
    }
}
 
开发者ID:ImbaKnugel,项目名称:Whoosh,代码行数:18,代码来源:TeleportUtil.java

示例3: demote

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
private void demote(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	if (args.length != 2) {
		throw new WrongUsageException("commands.nemesis_system.usage");
	}
	World world = server.getWorld(senderDimId(sender));
	INemesisRegistry registry = NemesisRegistryProvider.get(world);
	NemesisEntry nemesis = registry.getByName(args[1]);
	if (nemesis == null) {
		return;
	}
	NemesisActions.demote(world, nemesis, "Server Command");
	registry.markDirty();
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:14,代码来源:NemesisSystemCommand.java

示例4: promote

import net.minecraft.server.MinecraftServer; //导入方法依赖的package包/类
private void promote(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	if (args.length != 2) {
		throw new WrongUsageException("commands.nemesis_system.usage");
	}
	World world = server.getWorld(senderDimId(sender));
	INemesisRegistry registry = NemesisRegistryProvider.get(world);
	NemesisEntry nemesis = registry.getByName(args[1]);
	if (nemesis == null) {
		return;
	}
	NemesisActions.promote(world, nemesis);
	registry.markDirty();
}
 
开发者ID:ToroCraft,项目名称:NemesisSystem,代码行数:14,代码来源:NemesisSystemCommand.java


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