MFF

    Minecraft Forge France
    • Récent
    • Mots-clés
    • Populaire
    • Utilisateurs
    • Groupes
    • Forge Events
      • Automatique
      • Foncé
      • Clair
    • S'inscrire
    • Se connecter

    comment marche les command ?

    Planifier Épinglé Verrouillé Déplacé Non résolu Support pour les moddeurs
    2 Messages 2 Publieurs 255 Vues 2 Watching
    Charger plus de messages
    • Du plus ancien au plus récent
    • Du plus récent au plus ancien
    • Les plus votés
    Répondre
    • Répondre à l'aide d'un nouveau sujet
    Se connecter pour répondre
    Ce sujet a été supprimé. Seuls les utilisateurs avec les droits d'administration peuvent le voir.
    • G Hors-ligne
      gugus
      dernière édition par

      bonjour je suis actuellement sur les commande, avec ce tuto : https://www.minecraftforgefrance.fr/topic/4471/créer-une-commande, mais pour les command client je ne comprend pas bien comment il faut si prendre, j’ai fait sa pour le moment mais le target ne veut pas s’implémenter et je ne suis pas sur de se que je fait :

      package fr.gugus.tuto.Command;
      
      import java.util.List;
      
      import com.google.common.collect.Lists;
      
      import net.minecraft.command.CommandBase;
      import net.minecraft.command.CommandException;
      import net.minecraft.command.ICommand;
      import net.minecraft.command.ICommandSender;
      import net.minecraft.command.WrongUsageException;
      import net.minecraft.entity.monster.EntityZombie;
      import net.minecraft.server.MinecraftServer;
      import net.minecraft.util.math.BlockPos;
      import net.minecraft.util.text.TextComponentString;
      
      public class CommandTuto extends CommandBase implements ICommand {
      
      	@Override
      	public int compareTo(ICommand arg0) {
      		// TODO Auto-generated method stub
      		return 0;
      	}
      
      	@Override
      	public String getName() {
      		return "tuto";
      	}
      
      	@Override
      	public String getUsage(ICommandSender sender) {
      		// TODO Auto-generated method stub
      		return null;
      	}
      
      	@Override
      	public List<String> getAliases() {
      		// TODO Auto-generated method stub
      		return null;
      	}
      
      	@Override
      	public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
      		 // On vérifie que l'on ait bien les 3 coordonnées
      	    if (args.length < 3)
      	        throw new WrongUsageException(this.getUsage(sender));
      	 
      	    // On récupère la position d'apparition grâce à la fonction de la classe CommandBase
      	    BlockPos pos = parseBlockPos(sender, args, 0, true);
      	 
      	    // On instancie l'entité
      	    EntityZombie steeve = new EntityZombie(sender.getEntityWorld());
      	    steeve.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), 0f, 0f);
      	    steeve.setNoAI(true);
      	    steeve.setCustomNameTag("Steeve");
      	    steeve.setAlwaysRenderNameTag(true);
      	 
      	    // On la fait apparaitre
      	    sender.getEntityWorld().spawnEntity(steeve);
      	 
      	    // On avertie le joueur que ça a fonctionné
      	    sender.sendMessage(new TextComponentString("Steeve est apparue."));
      	}
      
      	@Override
      	public boolean checkPermission(MinecraftServer server, ICommandSender sender) {
      		// TODO Auto-generated method stub
      		return false;
      	}
      
      	@Override
      	public List<String> getTabCompletions(MinecraftServer server, ICommandSender sender, String[] args,BlockPos targetPos) {
      		// Si le bloc visé n'est pas null
      	    if (target != null) {
      	        // Suivant la position de l'argument on complète avec la position du
      	        // bloc visé
      	        switch (args.length) {
      	            case 1:
      	                return Lists.newArrayList(String.valueOf(target.getX()));
      	            case 2:
      	                return Lists.newArrayList(String.valueOf(target.getY()));
      	            case 3:
      	                return Lists.newArrayList(String.valueOf(target.getZ()));
      	        }
      	    }
      	    return Lists.newArrayList();
      	}
      
      	@Override
      	public boolean isUsernameIndex(String[] args, int index) {
      		// TODO Auto-generated method stub
      		return false;
      	}
      
      }
      
      
      1 réponse Dernière réponse Répondre Citer 0
      • KraftyK Hors-ligne
        Krafty
        dernière édition par

        Il nous faudrait déjà la version de ton mod…

        1 réponse Dernière réponse Répondre Citer 0
        • 1 / 1
        • Premier message
          Dernier message
        Design by Woryk
        ContactMentions Légales

        MINECRAFT FORGE FRANCE © 2024

        Powered by NodeBB