Jump to content

Recommended Posts

Posted

Hello,

 

I do not know if this is normal, when I put number (in the game) to fly speed, brand myself it to change, but I am forced to restart the world. For the speed, i don't need reload world.

Is this normal? A there a solution?

 

My code :

package com.BlockU.blocks.command;

import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.World;
import net.minecraft.world.WorldSettings.GameType;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;

public class CommandFlySpeed extends CommandBase{

@Override
public String getName() {
	return "Fly";
}

@Override
public String getCommandUsage(ICommandSender sender) {
	return "/Fly";
}



@Override
public void execute(ICommandSender sender, String[] args) throws CommandException {
	if (args.length < 2)
        {

		EntityPlayer player = (EntityPlayer) sender;

		String str = args[0];
		int i = Integer.parseInt(str);
		Integer a = Integer.valueOf(str);
		player.capabilities.setFlySpeed(a);
		player.setSprinting(true);
		player.addChatMessage(new ChatComponentText (EnumChatFormatting.GREEN + "La vitesse de vol a été augementé de" + args[0]));

	} else{
		sender.addChatMessage(new ChatComponentText (EnumChatFormatting.RED + "Erreur"));
	}
}

}

 

Thank you for your help

 

Ps: Thanks diesieben07, I managed with Args  D

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.