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


Java ICommandSender.getCommandSenderEntity方法代码示例

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


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

示例1: cacheKey

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
private static String cacheKey(ICommandSender sender) {
    if (sender.getCommandSenderEntity() != null) {
        // ez pz, use the UUID
        return sender.getCommandSenderEntity().getCachedUniqueIdString();
    }
    // panic! use the position like it's a block or something!
    // also prepend the simple class name so that we can still kinda cache
    // the server, rcon, etc.
    Vec3d vec = sender.getPositionVector();
    return sender.getClass().getSimpleName() + "[" + vec.x + "," + vec.y + "," + vec.z + "]";
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:12,代码来源:SessionManager.java

示例2: sendChat

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
private void sendChat(ICommandSender sender, String[] msg){
    EntityPlayer player = (EntityPlayer)sender.getCommandSenderEntity();
    for (String str : msg)
    {
        TextComponentString line = new TextComponentString(str);
        player.sendMessage(line);
    }
}
 
开发者ID:talandar,项目名称:ProgressiveDifficulty,代码行数:9,代码来源:ServerCommand.java

示例3: cast

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@SuppressWarnings("ConstantConditions")
@Override
public void cast(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	final EntityLivingBase entity = (EntityLivingBase) sender.getCommandSenderEntity();
	if (entity.isEntityAlive() && entity.getHealth() < entity.getMaxHealth()) {
		entity.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 80, 0));
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:9,代码来源:IncantationHeal.java

示例4: cast

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@SuppressWarnings("ConstantConditions")
@Override
public void cast(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	final EntityLivingBase entity = (EntityLivingBase) sender.getCommandSenderEntity();
	if (entity.isEntityAlive()) {
		entity.addPotionEffect(new PotionEffect(MobEffects.WATER_BREATHING, 275, 0));
		entity.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 275, 0));

		EnergyHandler.addEnergy((EntityPlayer) sender, 800);
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:12,代码来源:IncantationFisheye.java

示例5: execute

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
	if (args.length < 1) throw new WrongUsageException("commands.incantation.usage");
	if (sender.getCommandSenderEntity() == null) return;
	final String command = args[0];
	if (ModCommands.commands.containsKey(command)) {
		ModCommands.commands.get(command).cast(server, sender, args);
	} else {
		throw new CommandException("commands.incantation.notFound", sender.getName());
	}
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:12,代码来源:CommandIncantation.java

示例6: 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
{
    if (args.length < 4)
    {
        throw new WrongUsageException("commands.teleport.usage", new Object[0]);
    }
    else
    {
        Entity entity = getEntity(server, sender, args[0]);

        if (entity.world != null)
        {
            int i = 4096;
            Vec3d vec3d = sender.getPositionVector();
            int j = 1;
            CommandBase.CoordinateArg commandbase$coordinatearg = parseCoordinate(vec3d.xCoord, args[j++], true);
            CommandBase.CoordinateArg commandbase$coordinatearg1 = parseCoordinate(vec3d.yCoord, args[j++], -4096, 4096, false);
            CommandBase.CoordinateArg commandbase$coordinatearg2 = parseCoordinate(vec3d.zCoord, args[j++], true);
            Entity entity1 = sender.getCommandSenderEntity() == null ? entity : sender.getCommandSenderEntity();
            CommandBase.CoordinateArg commandbase$coordinatearg3 = parseCoordinate(args.length > j ? (double)entity1.rotationYaw : (double)entity.rotationYaw, args.length > j ? args[j] : "~", false);
            ++j;
            CommandBase.CoordinateArg commandbase$coordinatearg4 = parseCoordinate(args.length > j ? (double)entity1.rotationPitch : (double)entity.rotationPitch, args.length > j ? args[j] : "~", false);
            doTeleport(entity, commandbase$coordinatearg, commandbase$coordinatearg1, commandbase$coordinatearg2, commandbase$coordinatearg3, commandbase$coordinatearg4);
            notifyCommandListener(sender, this, "commands.teleport.success.coordinates", new Object[] {entity.getName(), Double.valueOf(commandbase$coordinatearg.getResult()), Double.valueOf(commandbase$coordinatearg1.getResult()), Double.valueOf(commandbase$coordinatearg2.getResult())});
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:31,代码来源:CommandTeleport.java

示例7: 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
{
    if (args.length < 4)
    {
        throw new WrongUsageException("commands.teleport.usage", new Object[0]);
    }
    else
    {
        Entity entity = getEntity(server, sender, args[0]);

        if (entity.worldObj != null)
        {
            int i = 4096;
            Vec3d vec3d = sender.getPositionVector();
            int j = 1;
            CommandBase.CoordinateArg commandbase$coordinatearg = parseCoordinate(vec3d.xCoord, args[j++], true);
            CommandBase.CoordinateArg commandbase$coordinatearg1 = parseCoordinate(vec3d.yCoord, args[j++], -4096, 4096, false);
            CommandBase.CoordinateArg commandbase$coordinatearg2 = parseCoordinate(vec3d.zCoord, args[j++], true);
            Entity entity1 = sender.getCommandSenderEntity() == null ? entity : sender.getCommandSenderEntity();
            CommandBase.CoordinateArg commandbase$coordinatearg3 = parseCoordinate(args.length > j ? (double)entity1.rotationYaw : (double)entity.rotationYaw, args.length > j ? args[j] : "~", false);
            ++j;
            CommandBase.CoordinateArg commandbase$coordinatearg4 = parseCoordinate(args.length > j ? (double)entity1.rotationPitch : (double)entity.rotationPitch, args.length > j ? args[j] : "~", false);
            doTeleport(entity, commandbase$coordinatearg, commandbase$coordinatearg1, commandbase$coordinatearg2, commandbase$coordinatearg3, commandbase$coordinatearg4);
            notifyCommandListener(sender, this, "commands.teleport.success.coordinates", new Object[] {entity.getName(), Double.valueOf(commandbase$coordinatearg.getResult()), Double.valueOf(commandbase$coordinatearg1.getResult()), Double.valueOf(commandbase$coordinatearg2.getResult())});
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:31,代码来源:CommandTeleport.java

示例8: canCommandSenderUseCommand

import net.minecraft.command.ICommandSender; //导入方法依赖的package包/类
@Override
public boolean canCommandSenderUseCommand(ICommandSender sender) {
	return (sender.getCommandSenderEntity() != null 
			&& FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().canSendCommands(((EntityPlayerMP)sender.getCommandSenderEntity()).getGameProfile()));
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:6,代码来源:Command.java


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