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


Java ICommandSender.getEntityWorld方法代码示例

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


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

示例1: cast

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@Override
public void cast(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	World world = sender.getEntityWorld();
	BlockPos source = sender.getPosition();
	for (BlockPos pos : BlockPos.getAllInBox(source.add(5, 5, 5), source.add(-5, -5, -5))) {
		TileEntity tile = world.getTileEntity(pos);
		if (tile instanceof TileCandle && ((TileCandle) tile).isLit()) {
			for (int i = 0; i < 5; i++) {
				double x = pos.getX() + world.rand.nextFloat();
				double y = pos.getY() + world.rand.nextFloat();
				double z = pos.getZ() + world.rand.nextFloat();
				world.spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0);
			}
			((TileCandle) tile).unLitCandle();
			PacketHandler.updateToNearbyPlayers(world, pos);
		}
	}
	EnergyHandler.addEnergy((EntityPlayer) sender, 800);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:20,代码来源:IncantationSnuff.java

示例2: cast

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@Override
public void cast(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	World world = sender.getEntityWorld();
	BlockPos source = sender.getPosition();
	for (BlockPos pos : BlockPos.getAllInBox(source.add(5, 5, 5), source.add(-5, -5, -5))) {
		TileEntity tile = world.getTileEntity(pos);
		if (tile instanceof TileCandle && !((TileCandle) tile).isLit()) {
			for (int i = 0; i < 5; i++) {
				double x = pos.getX() + world.rand.nextFloat();
				double y = pos.getY() + world.rand.nextFloat();
				double z = pos.getZ() + world.rand.nextFloat();
				world.spawnParticle(EnumParticleTypes.FLAME, x, y, z, 0, 0, 0);
			}
			((TileCandle) tile).litCandle();
			PacketHandler.updateToNearbyPlayers(world, pos);
		}
	}
	EnergyHandler.addEnergy((EntityPlayer) sender, 800);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:20,代码来源:IncantationCandlelight.java

示例3: processCommand

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/**
 * Callback when the command is invoked
 */
public void processCommand(ICommandSender sender, String[] args) throws CommandException
{
    BlockPos blockpos;

    if (args.length == 0)
    {
        blockpos = getCommandSenderAsPlayer(sender).getPosition();
    }
    else
    {
        if (args.length != 3 || sender.getEntityWorld() == null)
        {
            throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
        }

        blockpos = parseBlockPos(sender, args, 0, true);
    }

    sender.getEntityWorld().setSpawnPoint(blockpos);
    MinecraftServer.getServer().getConfigurationManager().sendPacketToAllPlayers(new S05PacketSpawnPosition(blockpos));
    notifyOperators(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:CommandSetDefaultSpawnpoint.java

示例4: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
	World world = sender.getEntityWorld();
	if (!world.isRemote && args.length > 0)
	{
		EntityPlayer player = this.getCommandSenderAsPlayer(sender);
		EntityCurse curse = null;

		EnumCurseType curseType = EnumCurseType.byName(args[0]);
		switch(curseType)
		{
			case CREEPER: curse = new EntityCreeperCurse(world, player); break;
			case GHAST: curse = new EntityGhastCurse(world, player); break;
			case SKELETON: curse = new EntitySkeletonCurse(world, player); break;
			case SLIME: curse = new EntitySlimeCurse(world, player); break;
			case SPIDER: curse = new EntitySpiderCurse(world, player); break;
			case ZOMBIE: curse = new EntityZombieCurse(world, player); break;
		}
		world.spawnEntity(curse);
	}
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:23,代码来源:CommandCurse.java

示例5: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    BlockPos blockpos;

    if (args.length == 0)
    {
        blockpos = getCommandSenderAsPlayer(sender).getPosition();
    }
    else
    {
        if (args.length != 3 || sender.getEntityWorld() == null)
        {
            throw new WrongUsageException("commands.setworldspawn.usage", new Object[0]);
        }

        blockpos = parseBlockPos(sender, args, 0, true);
    }

    sender.getEntityWorld().setSpawnPoint(blockpos);
    server.getPlayerList().sendPacketToAllPlayers(new SPacketSpawnPosition(blockpos));
    notifyCommandListener(sender, this, "commands.setworldspawn.success", new Object[] {Integer.valueOf(blockpos.getX()), Integer.valueOf(blockpos.getY()), Integer.valueOf(blockpos.getZ())});
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:CommandSetDefaultSpawnpoint.java

示例6: execGen

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/** Generate world region. Very high-weight for cpu-calculation resources command
 * @param vars Variables to parse arguments
 * @param sender Who sends the command
 */
static void execGen(Variables vars, ICommandSender sender) {
    int size = vars.get(new String[]{"size", "s", "length", "radius", "r"}, 16);
    int startX = vars.get(new String[]{"startx", "sx"}, 0);
    int startZ = vars.get(new String[]{"startz", "sz"}, 0);
    boolean stop = vars.get(new String[]{"stop", "end", "finish"}, false);
    boolean skip = vars.get(new String[]{"skip"}, false);
    int progress = vars.get(new String[]{"progress"}, 0);
    int step = Math.min(Math.max(1, vars.get(new String[]{"step", "delta"}, 32)), 4096);
    String worldName = vars.get(new String[]{"world"});
    UWorld world = worldName == null ? new UWorld(sender.getEntityWorld()) : UWorld.getWorld(worldName);
    if (world == null) {
        feedback(sender, "§4No matching world");
        return;
    }
    feedback(sender, Evaluator.cmdGen(world, startX, startZ, step, size, stop, skip, progress));
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:21,代码来源:Evaluator.java

示例7: execSave

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/** Saves fragment from the world to schematic
 * @param vars Variables to parse arguments
 * @param sender Who sends the command
 */
static void execSave(Variables vars, ICommandSender sender) {
    String name = vars.get(new String[]{"name"}, "unnamed");
    UBlockPos where = new UBlockPos(0, 0, 0);
    if (sender instanceof EntityPlayerMP) {
        EntityPlayerMP player = (EntityPlayerMP) sender;
        where = new UBlockPos((int)player.posX, (int)player.posY, (int)player.posZ);
    }
    int posX = vars.get(new String[]{"posx", "px", "x"}, where.getX());
    int posY = vars.get(new String[]{"posy", "py", "y"}, where.getY());
    int posZ = vars.get(new String[]{"posz", "pz", "z"}, where.getZ());
    int width = vars.get(new String[]{"width", "w"}, 64);
    int height = vars.get(new String[]{"height", "h"}, 64);
    int length = vars.get(new String[]{"length", "l"}, 64);
    if (vars.get(new String[]{"wand"}, false) && sender instanceof EntityPlayer && wand.containsKey(sender)) {
        UBlockPos posK = wand.get(sender).getKey();
        UBlockPos posV = wand.get(sender).getValue();
        posX = Math.min(posK.getX(), posV.getX());
        posY = Math.min(posK.getY(), posV.getY());
        posZ = Math.min(posK.getZ(), posV.getZ());
        width = Math.max(posK.getX(), posV.getX()) - posX + 1;
        height = Math.max(posK.getY(), posV.getY()) - posY + 1;
        length = Math.max(posK.getZ(), posV.getZ()) - posZ + 1;
    }
    String worldName = vars.get(new String[]{"world"});
    UWorld world = worldName == null ? new UWorld(sender.getEntityWorld()) : UWorld.getWorld(worldName);
    if (world == null) {
        feedback(sender, "§4No matching world");
        return;
    }
    feedback(sender, Evaluator.cmdSave(world, name, posX, posY, posZ, width, height, length));
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:36,代码来源:Evaluator.java

示例8: reload

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@HarshenCommand
public static void reload(MinecraftServer server, ICommandSender sender, String[] args)
{
	BaseConfig.reloadAll();
	for(EntityPlayer player : sender.getEntityWorld().playerEntities)
		HandlerSyncConfig.syncConfigWithClient((EntityPlayerMP) player);
	message(sender, "success");
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:9,代码来源:HarshenCastleCommands.java

示例9: execPaste

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/** Paste something to the world
 * @param vars Variables to parse arguments
 * @param sender Who sends the command
 */
static void execPaste(Variables vars, ICommandSender sender) {
    Random random = new Random();
    String name = vars.get(new String[]{"name"}, "");
    UBlockPos where = new UBlockPos(0, 0, 0);
    if (sender instanceof EntityPlayerMP) {
        EntityPlayerMP player = (EntityPlayerMP) sender;
        where = new UBlockPos((int)player.posX, (int)player.posY, (int)player.posZ);
    }
    int posX = vars.get(new String[]{"posx", "px", "x"}, where.getX());
    int posY = vars.get(new String[]{"posy", "py", "y"}, where.getY());
    int posZ = vars.get(new String[]{"posz", "pz", "z"}, where.getZ());
    int rotateX = vars.get(new String[]{"rotatex", "rotx", "rx"}, 0);
    int rotateY = vars.get(new String[]{"rotatey", "roty", "ry"}, random.nextInt() % 4);
    int rotateZ = vars.get(new String[]{"rotatez", "rotz", "rz"}, 0);
    boolean flipX = vars.get(new String[]{"flipx", "fx"},  random.nextBoolean());
    boolean flipY = vars.get(new String[]{"flipy", "fy"}, false);
    boolean flipZ = vars.get(new String[]{"flipz", "fz"}, random.nextBoolean());
    boolean isVillage = vars.get(new String[]{"village", "town", "city"}, false);
    boolean isInsecure = vars.get(new String[]{"insecure"}, false);
    posY = vars.get(new String[]{"auto"}, false) ? 0 : posY;
    if (vars.get(new String[]{"wand"}, false) && sender instanceof EntityPlayer && wand.containsKey(sender)) {
        UBlockPos pos = wand.get(sender).getValue();
        posX = pos.getX(); posY = pos.getY(); posZ = pos.getZ();
    }
    String worldName = vars.get(new String[]{"world"});
    UWorld world = worldName == null ? new UWorld(sender.getEntityWorld()) : UWorld.getWorld(worldName);
    if (world == null) {
        feedback(sender, "No matching world");
        return;
    }
    feedback(sender, Evaluator.cmdPaste(world, name, posX, posY, posZ, rotateX, rotateY, rotateZ, flipX, flipY, flipZ, isVillage, isInsecure));
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:37,代码来源:Evaluator.java

示例10: execSave

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/** Saves fragment from the world to schematic
 * @param vars Variables to parse arguments
 * @param sender Who sends the command
 */
static void execSave(Variables vars, ICommandSender sender) {
    String name = vars.get(new String[]{"name"}, "unnamed");
    int posX = vars.get(new String[]{"posx", "px", "x"}, sender.getPosition().getX());
    int posY = vars.get(new String[]{"posy", "py", "y"}, sender.getPosition().getY());
    int posZ = vars.get(new String[]{"posz", "pz", "z"}, sender.getPosition().getZ());
    int width = vars.get(new String[]{"width", "w"}, 64);
    int height = vars.get(new String[]{"height", "h"}, 64);
    int length = vars.get(new String[]{"length", "l"}, 64);
    if (vars.get(new String[]{"wand"}, false) && sender instanceof EntityPlayer && wand.containsKey(sender)) {
        UBlockPos posK = wand.get(sender).getKey();
        UBlockPos posV = wand.get(sender).getValue();
        posX = Math.min(posK.getX(), posV.getX());
        posY = Math.min(posK.getY(), posV.getY());
        posZ = Math.min(posK.getZ(), posV.getZ());
        width = Math.max(posK.getX(), posV.getX()) - posX + 1;
        height = Math.max(posK.getY(), posV.getY()) - posY + 1;
        length = Math.max(posK.getZ(), posV.getZ()) - posZ + 1;
    }
    String worldName = vars.get(new String[]{"world"});
    UWorld world = worldName == null ? new UWorld(sender.getEntityWorld()) : UWorld.getWorld(worldName);
    if (world == null) {
        feedback(sender, "§4No matching world");
        return;
    }
    feedback(sender, Evaluator.cmdSave(world, name, posX, posY, posZ, width, height, length));
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:31,代码来源:Evaluator.java

示例11: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
	World world = sender.getEntityWorld();
	if (!world.isRemote)
	{

		if (args.length == 0)
		{
			for (Map.Entry<Integer, String> kvp : VillagerRegistryHelper.getProfessionIdsAndNamesSortedById())
			{
				sender.sendMessage(new TextComponentString(kvp.getKey() + ": " + kvp.getValue()));
			}
			return;
		}

		if (args.length == 2 && args[0].equals("profession"))
		{
			VillagerProfession profession = VillagerRegistryHelper.getProfession(args[1]);
			if (profession != null)
			{
				for (VillagerCareer career : new VTTVillagerProfession(profession).getCareers())
				{
					VTTVillagerCareer vttCareer = new VTTVillagerCareer(career);
					sender.sendMessage(new TextComponentString(vttCareer.getId() + ": " + vttCareer.getName()));
					sender.sendMessage(new TextComponentString("   " + vttCareer.getCareerLevels() + " levels"));
				}
			}
		}

	}
}
 
开发者ID:crazysnailboy,项目名称:VillagerTrades,代码行数:33,代码来源:ModCommand.java

示例12: execPaste

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
/** Paste something to the world
 * @param vars Variables to parse arguments
 * @param sender Who sends the command
 */
static void execPaste(Variables vars, ICommandSender sender) {
    Random random = new Random();
    String name = vars.get(new String[]{"name"}, "");
    int posX = vars.get(new String[]{"posx", "px", "x"}, sender.getPosition().getX());
    int posY = vars.get(new String[]{"posy", "py", "y"}, sender.getPosition().getY());
    int posZ = vars.get(new String[]{"posz", "pz", "z"}, sender.getPosition().getZ());
    int rotateX = vars.get(new String[]{"rotatex", "rotx", "rx"}, 0);
    int rotateY = vars.get(new String[]{"rotatey", "roty", "ry"}, random.nextInt() % 4);
    int rotateZ = vars.get(new String[]{"rotatez", "rotz", "rz"}, 0);
    boolean flipX = vars.get(new String[]{"flipx", "fx"},  random.nextBoolean());
    boolean flipY = vars.get(new String[]{"flipy", "fy"}, false);
    boolean flipZ = vars.get(new String[]{"flipz", "fz"}, random.nextBoolean());
    boolean isVillage = vars.get(new String[]{"village", "town", "city"}, false);
    boolean isInsecure = vars.get(new String[]{"insecure"}, false);
    posY = vars.get(new String[]{"auto"}, false) ? 0 : posY;
    if (vars.get(new String[]{"wand"}, false) && sender instanceof EntityPlayer && wand.containsKey(sender)) {
        UBlockPos pos = wand.get(sender).getValue();
        posX = pos.getX(); posY = pos.getY(); posZ = pos.getZ();
    }
    String worldName = vars.get(new String[]{"world"});
    UWorld world = worldName == null ? new UWorld(sender.getEntityWorld()) : UWorld.getWorld(worldName);
    if (world == null) {
        feedback(sender, "No matching world");
        return;
    }
    feedback(sender, Evaluator.cmdPaste(world, name, posX, posY, posZ, rotateX, rotateY, rotateZ, flipX, flipY, flipZ, isVillage, isInsecure));
}
 
开发者ID:ternsip,项目名称:StructPro,代码行数:32,代码来源:Evaluator.java

示例13: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args)
    throws CommandException {
  World world = sender.getEntityWorld();
  if (!world.isRemote) {
    if (args.length == 0) {
      showUsage(sender);
      return;
    }

    if (args[0].equalsIgnoreCase("start")) {
      YouTubeConfiguration configuration = YouTubeConfiguration.getInstance();
      String clientSecret = configuration.getClientSecret();
      if (clientSecret == null || clientSecret.isEmpty()) {
        showMessage("No client secret configurated", sender);
        return;
      }
      service.start(configuration.getVideoId(), clientSecret, sender);
    } else if (args[0].equalsIgnoreCase("stop")) {
      service.stop(sender);
    } else if (args[0].equalsIgnoreCase("logout")) {
      service.stop(sender);
      try {
        Auth.clearCredentials();
      } catch(IOException e) {
        showMessage(e.getMessage(), sender);
      }
    } else {
      if (args[0].equalsIgnoreCase("echoStart")) {
        if (!service.isInitialized()) {
          showMessage("Service is not initialized", sender);
          showUsage(sender);
        } else {
          service.subscribe(this);
        }
      } else if (args[0].equalsIgnoreCase("echoStop")) {
        service.unsubscribe(this);
      } else {
        showUsage(sender);
      }
    }
  }
}
 
开发者ID:youtube,项目名称:youtube-chat-for-minecraft,代码行数:44,代码来源:YouTubeCommand.java


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