當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。