當前位置: 首頁>>代碼示例>>Java>>正文


Java CommandBase.CoordinateArg方法代碼示例

本文整理匯總了Java中net.minecraft.command.CommandBase.CoordinateArg方法的典型用法代碼示例。如果您正苦於以下問題:Java CommandBase.CoordinateArg方法的具體用法?Java CommandBase.CoordinateArg怎麽用?Java CommandBase.CoordinateArg使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.command.CommandBase的用法示例。


在下文中一共展示了CommandBase.CoordinateArg方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: execute

import net.minecraft.command.CommandBase; //導入方法依賴的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

示例2: execute

import net.minecraft.command.CommandBase; //導入方法依賴的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

示例3: execute

import net.minecraft.command.CommandBase; //導入方法依賴的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);
            func_189862_a(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:BlazeAxtrius,項目名稱:ExpandedRailsMod,代碼行數:31,代碼來源:CommandTeleport.java

示例4: doTeleport

import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
/**
 * Perform the actual teleport
 */
private static void doTeleport(Entity p_189862_0_, CommandBase.CoordinateArg p_189862_1_, CommandBase.CoordinateArg p_189862_2_, CommandBase.CoordinateArg p_189862_3_, CommandBase.CoordinateArg p_189862_4_, CommandBase.CoordinateArg p_189862_5_)
{
    if (p_189862_0_ instanceof EntityPlayerMP)
    {
        Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
        float f = (float)p_189862_4_.getAmount();

        if (p_189862_4_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
        }
        else
        {
            f = MathHelper.wrapDegrees(f);
        }

        float f1 = (float)p_189862_5_.getAmount();

        if (p_189862_5_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
        }
        else
        {
            f1 = MathHelper.wrapDegrees(f1);
        }

        p_189862_0_.dismountRidingEntity();
        ((EntityPlayerMP)p_189862_0_).connection.setPlayerLocation(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f, f1, set);
        p_189862_0_.setRotationYawHead(f);
    }
    else
    {
        float f2 = (float)MathHelper.wrapDegrees(p_189862_4_.getResult());
        float f3 = (float)MathHelper.wrapDegrees(p_189862_5_.getResult());
        f3 = MathHelper.clamp(f3, -90.0F, 90.0F);
        p_189862_0_.setLocationAndAngles(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f2, f3);
        p_189862_0_.setRotationYawHead(f2);
    }

    if (!(p_189862_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189862_0_).isElytraFlying())
    {
        p_189862_0_.motionY = 0.0D;
        p_189862_0_.onGround = true;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:50,代碼來源:CommandTeleport.java

示例5: doTeleport

import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
/**
 * Perform the actual teleport
 */
private static void doTeleport(Entity p_189862_0_, CommandBase.CoordinateArg p_189862_1_, CommandBase.CoordinateArg p_189862_2_, CommandBase.CoordinateArg p_189862_3_, CommandBase.CoordinateArg p_189862_4_, CommandBase.CoordinateArg p_189862_5_)
{
    if (p_189862_0_ instanceof EntityPlayerMP)
    {
        Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
        float f = (float)p_189862_4_.getAmount();

        if (p_189862_4_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
        }
        else
        {
            f = MathHelper.wrapDegrees(f);
        }

        float f1 = (float)p_189862_5_.getAmount();

        if (p_189862_5_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
        }
        else
        {
            f1 = MathHelper.wrapDegrees(f1);
        }

        p_189862_0_.dismountRidingEntity();
        ((EntityPlayerMP)p_189862_0_).connection.setPlayerLocation(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f, f1, set);
        p_189862_0_.setRotationYawHead(f);
    }
    else
    {
        float f2 = (float)MathHelper.wrapDegrees(p_189862_4_.getResult());
        float f3 = (float)MathHelper.wrapDegrees(p_189862_5_.getResult());
        f3 = MathHelper.clamp_float(f3, -90.0F, 90.0F);
        p_189862_0_.setLocationAndAngles(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f2, f3);
        p_189862_0_.setRotationYawHead(f2);
    }

    if (!(p_189862_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189862_0_).isElytraFlying())
    {
        p_189862_0_.motionY = 0.0D;
        p_189862_0_.onGround = true;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:50,代碼來源:CommandTeleport.java

示例6: func_189862_a

import net.minecraft.command.CommandBase; //導入方法依賴的package包/類
private static void func_189862_a(Entity p_189862_0_, CommandBase.CoordinateArg p_189862_1_, CommandBase.CoordinateArg p_189862_2_, CommandBase.CoordinateArg p_189862_3_, CommandBase.CoordinateArg p_189862_4_, CommandBase.CoordinateArg p_189862_5_)
{
    if (p_189862_0_ instanceof EntityPlayerMP)
    {
        Set<SPacketPlayerPosLook.EnumFlags> set = EnumSet.<SPacketPlayerPosLook.EnumFlags>noneOf(SPacketPlayerPosLook.EnumFlags.class);
        float f = (float)p_189862_4_.getAmount();

        if (p_189862_4_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.Y_ROT);
        }
        else
        {
            f = MathHelper.wrapDegrees(f);
        }

        float f1 = (float)p_189862_5_.getAmount();

        if (p_189862_5_.isRelative())
        {
            set.add(SPacketPlayerPosLook.EnumFlags.X_ROT);
        }
        else
        {
            f1 = MathHelper.wrapDegrees(f1);
        }

        p_189862_0_.dismountRidingEntity();
        ((EntityPlayerMP)p_189862_0_).connection.setPlayerLocation(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f, f1, set);
        p_189862_0_.setRotationYawHead(f);
    }
    else
    {
        float f2 = (float)MathHelper.wrapDegrees(p_189862_4_.getResult());
        float f3 = (float)MathHelper.wrapDegrees(p_189862_5_.getResult());
        f3 = MathHelper.clamp_float(f3, -90.0F, 90.0F);
        p_189862_0_.setLocationAndAngles(p_189862_1_.getResult(), p_189862_2_.getResult(), p_189862_3_.getResult(), f2, f3);
        p_189862_0_.setRotationYawHead(f2);
    }

    if (!(p_189862_0_ instanceof EntityLivingBase) || !((EntityLivingBase)p_189862_0_).isElytraFlying())
    {
        p_189862_0_.motionY = 0.0D;
        p_189862_0_.onGround = true;
    }
}
 
開發者ID:BlazeAxtrius,項目名稱:ExpandedRailsMod,代碼行數:47,代碼來源:CommandTeleport.java


注:本文中的net.minecraft.command.CommandBase.CoordinateArg方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。