• Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes
  • S'inscrire
  • Se connecter
  • S'inscrire
  • Se connecter
  • Recherche
  • Récent
  • Mots-clés
  • Populaire
  • Utilisateurs
  • Groupes

Une sorte de "familié"

Sans suite
1.7.10
8
90
14.1k
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.
  • leo01418
    leo01418 dernière édition par 12 mai 2016, 20:54

    Bonjour voilà un post que j’aurais du faire plutôt  Déjà je vais m’expliqué pour moi ce que c’est un familié.
    un familié = une sorte d’animal qui t’aide (oscar de l’explication)

    Voilà mon histoire:un soir de pluie j’ai crée un mob familié l’endermire mais je souhaite le supprimé est faire un familié beaucoup plus complet je vais m’expliqué

    Le familié que j’éssaye de faire:

    un familié que tu clique droit dessus avec une “paper” avec une list de joueur il ne l’attaquera pas

    que quand tu fait clique droit dessus avec un item spécial  sa tue le mob et en fait spawn un autre mob

    que quand tu fait clique droit dessus avec un item spécial sa change c’est caractéristique

    qu’il se tp à toi

    quand tu fait clique sur ce mob il ne se tp plus et reste à l’endroit ou il est mais peux bougé et attaqué

    quand tu fait clique droit avec un item spécial sa lui change son skin

    et quand il va se transformé en l’autre mob il va gardé ses caractéristique

    Je signale que j’enlèverais petit à petit la liste que je dois faire pour ce mob quand j’y arriverai

    Merci de votre aide    🙂
    sa fais trés longtemps que j’essaie 😞

    Cordialement leo01418

    Eddit: j’ai peut étre trouvé un moyen pour quelle attaque toute les entity et à extends EntityTameable

    Voila ma signature

    1 réponse Dernière réponse Répondre Citer 0
    • Yeyvo
      Yeyvo dernière édition par 12 mai 2016, 21:00

      Commence par créer t’en entyté petit a petit puis ajoute les modif pour la withe liste j’ai déjà lu un truc du genre sur mff peut être de mosca (peu-etre)  🙂

      1 réponse Dernière réponse Répondre Citer 0
      • leo01418
        leo01418 dernière édition par 12 mai 2016, 21:04

        @‘Yeyvo’:

        Commence par créer t’en entyté petit a petit puis ajoute les modif pour la withe liste j’ai déjà lu un truc du genre sur mff peut être de mosca (peu-etre)  🙂

        C’est justement que je suis en train de faire et pour la whitelist merci  😉

        Eddit j’ai trouvé sa

         this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 1, true, true));
        

        Voila ma signature

        1 réponse Dernière réponse Répondre Citer 0
        • Superloup10
          Superloup10 Modérateurs dernière édition par 13 mai 2016, 00:28

          Tu peux t’inspirer du loup pour la plupart des fonctionnalités.

          Si vous souhaitez me faire un don, il vous suffit de cliquer sur le bouton situé en dessous.

          Je suis un membre apprécié et joueur, j'ai déjà obtenu 17 points de réputation.

          1 réponse Dernière réponse Répondre Citer 0
          • Deleted
            Deleted dernière édition par 13 mai 2016, 05:26

            Pour toutes les interactions avec items spéciaux, faudra que t’override la fonction interact. Sur quoi bloques-tu précisément car là, tout est à ta portée dans ce que tu demandes.

            1 réponse Dernière réponse Répondre Citer 0
            • leo01418
              leo01418 dernière édition par 13 mai 2016, 15:41

              le problème c’est que j’ai fait un extends EntityTameable et que je n’arrive pas à faire qu’il attaque j’ai regardé dans la class du zombie j’ai copié collé et sa marche pas
              (je voudrais faire que l’entity attaque tout le monde sauf les gens dans la white list + le créateur) et j’ai essayé sa 
              this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, true));

              Voila ma signature

              1 réponse Dernière réponse Répondre Citer 0
              • Deleted
                Deleted dernière édition par 13 mai 2016, 16:17

                C’est sûr que si tu extends EntityTameable, ton mob n’attaquera pas. En plus de ça, tu fais un copier-coller du zombie, alors là cerise sur le gâteau x)
                Tu sais, je vais te dire, si t’as encore du mal avec les AI, clairement t’en sers pas. Faudrait pas encore que ça recommence comme avec le cas de @conquerorguepard. Moi perso pour TOUTES mes entity, je ne me suis jamais servi des AI. Si tu veux l’extends EntityTameable et le faire attaquer, va falloir refaire sa méthode attackEntity, je pense….

                1 réponse Dernière réponse Répondre Citer 0
                • leo01418
                  leo01418 dernière édition par 13 mai 2016, 16:25

                  @‘Plaigon’:

                  C’est sûr que si tu extends EntityTameable, ton mob n’attaquera pas. En plus de ça, tu fais un copier-coller du zombie, alors là cerise sur le gâteau x)
                  Tu sais, je vais te dire, si t’as encore du mal avec les AI, clairement t’en sers pas. Faudrait pas encore que ça recommence comme avec le cas de @conquerorguepard. Moi perso pour TOUTES  mes entity, je ne me suis jamais servi des AI. Si tu veux l’extends EntityTameable et le faire attaquer, va falloir refaire sa méthode attackEntity, je pense….

                  Ok je pensé que c’était fait fait exprès pour que même si c’est en extends EntityTameable mais je pense comme tu la dis de refaire la méthode attackentity ou de faire un extends EntityMob

                  Voila ma signature

                  1 réponse Dernière réponse Répondre Citer 0
                  • Deleted
                    Deleted dernière édition par 13 mai 2016, 17:51

                    Sa revient au même si tu extends mob, mais donc tu devras override la fonction interact pour pouvoir l’apprivoiser. Les deux propositions reviennent au même 🙂

                    1 réponse Dernière réponse Répondre Citer 0
                    • leo01418
                      leo01418 dernière édition par 17 mai 2016, 18:35

                      Bon après plusieurs jour j’avais laissé tombé l’idée et supprimé la classe.  😞
                      Mais ensuite après avoir quelque chose je me suis remotivé mais j’ai décidé de changé le familiar c’est à dire 
                      [font=Ubuntu, sans-serifun familié que tu clique droit dessus avec une “paper” avec une list de joueur il ne l’attaquera pas ]

                      [font=Ubuntu, sans-serifque quand tu fait clique droit dessus avec un item spécial sa change c’est caractéristique  mais avec des “lvl”]

                      [font=Ubuntu, sans-serifqu’il se tp à toi fait]

                      [font=Ubuntu, sans-serifquand tu fait clique sur ce mob il ne se tp plus et reste à l’endroit ou il est mais peux bougé et attaqué]

                      [font=Ubuntu, sans-serifquand tu fait clique droit avec un item spécial sa lui change son skin]

                      quand ton familiar est mort tu craft un item spécial et sa le fait respawn avec son skin spécial + ses lvl

                      quand pars exemple il est lvl 5 il gagne une capacité quand il attaque le mob sa donne c’est effet de potion ou quand il est lvl 10 il peut gagné la capacité quand il tape un joueur 3 fois sa lui donne un effet de potion.

                      Merci de votre aide  😉

                      Voila ma signature

                      1 réponse Dernière réponse Répondre Citer 0
                      • leo01418
                        leo01418 dernière édition par 18 mai 2016, 20:15

                        Salut alors j’ai un problème j’etait entrain de codé mais j’ai un problème c’est que comme mon entity à déjà était adopté avec mon entity je peut le re adopté avec un autre item une sorte d’amélioration

                        Voila ma signature

                        1 réponse Dernière réponse Répondre Citer 0
                        • Deleted
                          Deleted dernière édition par 19 mai 2016, 00:04

                          Pas compris, essaie de t’expliquer différemment. Poste ton code sa nous aidera aussi 😃

                          1 réponse Dernière réponse Répondre Citer 0
                          • M
                            mosca421 dernière édition par 19 mai 2016, 11:11

                            3 problèmes se sont posé quand j’ai fais mon mini kirby 😃
                            1 - Si une personne l’adopte au clique droit si tu ne lui donne pas un maitre tout le monde peux faire se qu’il veut avec
                            2 - Le chunk qui se décharge lors d’un /spawn ton piti chou ne va pas se tp =/
                            3 - Si tu stock pas le maitre quelque par si la personne déco ou leave il sera sans maitre jusqu’a se que quelqu’un le réadopte

                            1 réponse Dernière réponse Répondre Citer 0
                            • leo01418
                              leo01418 dernière édition par 19 mai 2016, 17:49

                              package ed.enderdeath.mod.entity;
                              import cpw.mods.fml.relauncher.Side;
                              import cpw.mods.fml.relauncher.SideOnly;
                              import ed.enderdeath.mod.Food.Baie;
                              import ed.enderdeath.mod.common.enderdeath;
                              import net.minecraft.block.Block;
                              import net.minecraft.block.BlockColored;
                              import net.minecraft.entity.Entity;
                              import net.minecraft.entity.EntityAgeable;
                              import net.minecraft.entity.EntityLivingBase;
                              import net.minecraft.entity.SharedMonsterAttributes;
                              import net.minecraft.entity.ai.EntityAIAttackOnCollide;
                              import net.minecraft.entity.ai.EntityAIFollowOwner;
                              import net.minecraft.entity.ai.EntityAIHurtByTarget;
                              import net.minecraft.entity.ai.EntityAILeapAtTarget;
                              import net.minecraft.entity.ai.EntityAILookIdle;
                              import net.minecraft.entity.ai.EntityAIMate;
                              import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
                              import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
                              import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
                              import net.minecraft.entity.ai.EntityAISwimming;
                              import net.minecraft.entity.ai.EntityAITargetNonTamed;
                              import net.minecraft.entity.ai.EntityAIWander;
                              import net.minecraft.entity.ai.EntityAIWatchClosest;
                              import net.minecraft.entity.monster.IMob;
                              import net.minecraft.entity.passive.EntityAnimal;
                              import net.minecraft.entity.passive.EntityTameable;
                              import net.minecraft.entity.player.EntityPlayer;
                              import net.minecraft.item.ItemFood;
                              import net.minecraft.item.ItemStack;
                              import net.minecraft.pathfinding.PathEntity;
                              import net.minecraft.util.DamageSource;
                              import net.minecraft.util.MathHelper;
                              import net.minecraft.world.World;
                              public class Familiar extends EntityTameable implements IMob {
                              private boolean test;
                              private int lvl;
                              private boolean getActive;
                              private float field_70926_e;
                              private float field_70924_f;
                              /** true is the wolf is wet else false */
                              private boolean isShaking;
                              private boolean field_70928_h;
                              /**
                              * This time increases while wolf is shaking and emitting water particles.
                              */
                              private float timeWolfIsShaking;
                              private float prevTimeWolfIsShakin;
                              public Familiar(World world) {
                              super(world);
                              this.setSize(1.0F, 1.0F);
                              this.tasks.addTask(1, new EntityAISwimming(this));
                              this.tasks.addTask(2, this.aiSit);
                              this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
                              this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
                              this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
                              this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
                              this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
                              this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
                              this.tasks.addTask(9, new EntityAILookIdle(this));
                              this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
                              this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
                              this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
                              this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityPlayer.class, 200, false));
                              this.targetTasks.addTask(10, new EntityAIAttackOnCollide(this, EntityPlayer.class, 5, true));
                              }
                              protected void applyEntityAttributes() {
                              super.applyEntityAttributes();
                              this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
                              if (this.isTamed()) {
                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
                              } else {
                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
                              }
                              }
                              public boolean isAIEnabled() {
                              return true;
                              }
                              protected void updateAITick() {
                              this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth()));
                              }
                              protected void entityInit() {
                              super.entityInit();
                              this.dataWatcher.addObject(18, new Float(this.getHealth()));
                              this.dataWatcher.addObject(19, new Byte((byte) 0));
                              this.dataWatcher.addObject(20, new Byte((byte) BlockColored.func_150032_b(1)));
                              }
                              public void onLivingUpdate() {
                              super.onLivingUpdate();
                              if (!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround) {
                              this.field_70928_h = true;
                              this.worldObj.setEntityState(this, (byte) 8);
                              }
                              }
                              public void onUpdate() {
                              super.onUpdate();
                              this.field_70924_f = this.field_70926_e;
                              if (this.func_70922_bv()) {
                              this.field_70926_e += (1.0F - this.field_70926_e) * 0.4F;
                              } else {
                              this.field_70926_e += (0.0F - this.field_70926_e) * 0.4F;
                              }
                              if (this.func_70922_bv()) {
                              this.numTicksToChaseTarget = 10;
                              }
                              if (this.isWet()) {
                              this.isShaking = true;
                              this.field_70928_h = false;
                              this.timeWolfIsShaking = 0.0F;
                              } else if ((this.isShaking || this.field_70928_h) && this.field_70928_h) {
                              if (this.timeWolfIsShaking == 0.0F) {
                              this.playSound("mob.wolf.shake", this.getSoundVolume(),
                              (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
                              }
                              this.timeWolfIsShaking += 0.05F;
                              if (this.timeWolfIsShaking > 0.4F) {
                              float f = (float) this.boundingBox.minY;
                              int i = (int) (MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float) Math.PI) * 7.0F);
                              for (int j = 0; j < i; ++j) {
                              float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
                              float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
                              this.worldObj.spawnParticle("splash", this.posX + (double) f1, (double) (f + 0.8F),
                              this.posZ + (double) f2, this.motionX, this.motionY, this.motionZ);
                              }
                              }
                              }
                              }
                              public int getVerticalFaceSpeed() {
                              return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
                              }
                              public boolean attackEntityAsMob(Entity p_70652_1_) {
                              int i = this.isTamed() ? 4 : 2;
                              return p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
                              }
                              public void setTamed(boolean p_70903_1_) {
                              super.setTamed(p_70903_1_);
                              if (p_70903_1_) {
                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(700.0D);
                              } else {
                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
                              }
                              }
                              public void setTameda(boolean p_70903_1_) {
                              super.setTamed(p_70903_1_);
                              if (p_70903_1_) {
                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
                              } else {
                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
                              }
                              }
                              public boolean interact(EntityPlayer p_70085_1_) {
                              ItemStack itemstack = p_70085_1_.inventory.getCurrentItem();
                              if (this.isTamed()) {
                              if (itemstack != null) {
                              if (itemstack.getItem() instanceof Baie) {
                              ItemFood itemfood = (ItemFood) itemstack.getItem();
                              if (itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F) {
                              if (!p_70085_1_.capabilities.isCreativeMode) {
                              –itemstack.stackSize;
                              }
                              this.heal((float) itemfood.func_150905_g(itemstack));
                              if (itemstack.stackSize <= 0) {
                              p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem,
                              (ItemStack) null);
                              }
                              return true;
                              }
                              } else if (itemstack.getItem() == null) {
                              int i = BlockColored.func_150032_b(itemstack.getItemDamage());
                              if (!p_70085_1_.capabilities.isCreativeMode && --itemstack.stackSize <= 0) {
                              p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem,
                              (ItemStack) null);
                              return true;
                              }
                              }
                              }
                              if (this.func_152114_e(p_70085_1_) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack)) {
                              this.aiSit.setSitting(!this.isSitting());
                              this.isJumping = false;
                              this.setPathToEntity((PathEntity) null);
                              this.setTarget((Entity) null);
                              this.setAttackTarget((EntityLivingBase) null);
                              }
                              }
                              if (!p_70085_1_.capabilities.isCreativeMode) {
                              --itemstack.stackSize;
                              }
                              if (itemstack.stackSize <= 0) {
                              p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack) null);
                              }
                              if (itemstack != null && itemstack.getItem() == enderdeath.GoldenCroquette) {
                              if (!p_70085_1_.capabilities.isCreativeMode)
                              {
                              --itemstack.stackSize;
                              }
                              if (itemstack.stackSize <= 0) {
                              p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack) null);
                              }
                              if (!this.worldObj.isRemote) {
                              if (this.rand.nextInt(3) == 0) {
                              this.setTameda(true);
                              this.setPathToEntity((PathEntity) null);
                              this.setAttackTarget((EntityLivingBase) null);
                              this.aiSit.setSitting(true);
                              this.setHealth(100.0F);
                              this.func_152115_b(p_70085_1_.getUniqueID().toString());
                              this.playTameEffect(true);
                              this.lvl = 2;
                              this.worldObj.setEntityState(this, (byte) 7);
                              } else {
                              this.playTameEffect(false);
                              this.worldObj.setEntityState(this, (byte) 6);
                              }
                              } else if (itemstack != null && itemstack.getItem() == enderdeath.RubisCroquette && itemstack != null
                              && this.lvl == 2) {
                              if (!p_70085_1_.capabilities.isCreativeMode) {
                              --itemstack.stackSize;
                              }
                              if (itemstack.stackSize <= 0) {
                              p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack) null);
                              }
                              if (!this.worldObj.isRemote) {
                              if (this.rand.nextInt(3) == 0) {
                              this.setTamed(true);
                              this.setPathToEntity((PathEntity) null);
                              this.setAttackTarget((EntityLivingBase) null);
                              this.aiSit.setSitting(true);
                              this.setHealth(5.0F);
                              this.func_152115_b(p_70085_1_.getUniqueID().toString());
                              this.playTameEffect(true);
                              this.lvl = 3;
                              System.out.println("Test Lvl3");
                              this.worldObj.setEntityState(this, (byte) 7);
                              } else {
                              this.playTameEffect(false);
                              this.worldObj.setEntityState(this, (byte) 6);
                              }
                              }
                              }
                              return true;
                              }
                              return super.interact(p_70085_1_);
                              }
                              public boolean isBreedingItem(ItemStack p_70877_1_) {
                              return p_70877_1_ == null ? false
                              : (!(p_70877_1_.getItem() instanceof Baie) ? false
                              : ((Baie) p_70877_1_.getItem()).isWolfsFavoriteMeat());
                              }
                              public Familiar createChild(EntityAgeable p_90011_1_) {
                              Familiar entitywolf = new Familiar(this.worldObj);
                              String s = this.func_152113_b();
                              if (s != null && s.trim().length() > 0) {
                              entitywolf.func_152115_b(s);
                              entitywolf.setTamed(true);
                              }
                              return entitywolf;
                              }
                              public void func_70918_i(boolean p_70918_1_) {
                              if (p_70918_1_) {
                              this.dataWatcher.updateObject(19, Byte.valueOf((byte) 1));
                              } else {
                              this.dataWatcher.updateObject(19, Byte.valueOf((byte) 0));
                              }
                              }
                              public boolean canMateWith(EntityAnimal p_70878_1_) {
                              if (p_70878_1_ == this) {
                              return false;
                              } else if (!this.isTamed()) {
                              return false;
                              } else if (!(p_70878_1_ instanceof Familiar)) {
                              return false;
                              } else {
                              Familiar entitywolf = (Familiar) p_70878_1_;
                              return !entitywolf.isTamed() ? false
                              : (entitywolf.isSitting() ? false : this.isInLove() && entitywolf.isInLove());
                              }
                              }
                              public boolean func_70922_bv() {
                              return this.dataWatcher.getWatchableObjectByte(19) == 1;
                              }
                              }

                              Voici ma classe actuel je suis bloqué sur faire que l’entity attaque tout le sauf celui qui la adopté,sur de lui donné le lvl 3 je suis bloqué au lvl 2 comme pour mon entity quand je lui donne les croquette en or il est déjà adopté et donc je peut pas le re adoptée pour lui faire changé de stats.

                              aprés autre problème si tu lui donne un skin (avec l’item spécial n’importe qui peux donné un skin alors et il faut que sa soit juste le maite )

                              Ps:ma classe est un peu beaucoup en bazar  😉

                              Merci de votre aide  🙂

                              Voila ma signature

                              1 réponse Dernière réponse Répondre Citer 0
                              • robin4002
                                robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par 19 mai 2016, 18:51

                                Vas sur eclipse, appuies sur les touches ctrl + shift + f puis repostes ton code.

                                1 réponse Dernière réponse Répondre Citer 0
                                • leo01418
                                  leo01418 dernière édition par 19 mai 2016, 18:56

                                  @‘robin4002’:

                                  Vas sur eclipse, appuies sur les touches ctrl + shift + f puis repostes ton code.

                                  Excuse j’y avais pas pensé x)
                                  tien  😉

                                  package ed.enderdeath.mod.entity;
                                  import cpw.mods.fml.relauncher.Side;
                                  import cpw.mods.fml.relauncher.SideOnly;
                                  import ed.enderdeath.mod.Food.Baie;
                                  import ed.enderdeath.mod.common.enderdeath;
                                  import net.minecraft.block.Block;
                                  import net.minecraft.block.BlockColored;
                                  import net.minecraft.entity.Entity;
                                  import net.minecraft.entity.EntityAgeable;
                                  import net.minecraft.entity.EntityLivingBase;
                                  import net.minecraft.entity.SharedMonsterAttributes;
                                  import net.minecraft.entity.ai.EntityAIAttackOnCollide;
                                  import net.minecraft.entity.ai.EntityAIFollowOwner;
                                  import net.minecraft.entity.ai.EntityAIHurtByTarget;
                                  import net.minecraft.entity.ai.EntityAILeapAtTarget;
                                  import net.minecraft.entity.ai.EntityAILookIdle;
                                  import net.minecraft.entity.ai.EntityAIMate;
                                  import net.minecraft.entity.ai.EntityAINearestAttackableTarget;
                                  import net.minecraft.entity.ai.EntityAIOwnerHurtByTarget;
                                  import net.minecraft.entity.ai.EntityAIOwnerHurtTarget;
                                  import net.minecraft.entity.ai.EntityAISwimming;
                                  import net.minecraft.entity.ai.EntityAITargetNonTamed;
                                  import net.minecraft.entity.ai.EntityAIWander;
                                  import net.minecraft.entity.ai.EntityAIWatchClosest;
                                  import net.minecraft.entity.monster.IMob;
                                  import net.minecraft.entity.passive.EntityAnimal;
                                  import net.minecraft.entity.passive.EntityTameable;
                                  import net.minecraft.entity.player.EntityPlayer;
                                  import net.minecraft.item.ItemFood;
                                  import net.minecraft.item.ItemStack;
                                  import net.minecraft.pathfinding.PathEntity;
                                  import net.minecraft.util.DamageSource;
                                  import net.minecraft.util.MathHelper;
                                  import net.minecraft.world.World;
                                  public class Familiar extends EntityTameable implements IMob
                                  {
                                      private boolean test;
                                      private int lvl;
                                      private boolean getActive;
                                      private float field_70926_e;
                                      private float field_70924_f;
                                      /** true is the wolf is wet else false */
                                      private boolean isShaking;
                                      private boolean field_70928_h;
                                      /**
                                       * This time increases while wolf is shaking and emitting water particles.
                                       */
                                      private float timeWolfIsShaking;
                                      private float prevTimeWolfIsShakin;
                                      public Familiar(World world)
                                      {
                                          super(world);
                                          this.setSize(1.0F, 1.0F);
                                          this.tasks.addTask(1, new EntityAISwimming(this));
                                          this.tasks.addTask(2, this.aiSit);
                                          this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
                                          this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
                                          this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
                                          this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
                                          this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
                                          this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
                                          this.tasks.addTask(9, new EntityAILookIdle(this));
                                          this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
                                          this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
                                          this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
                                          this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityPlayer.class, 200, false));
                                          this.targetTasks.addTask(10, new EntityAIAttackOnCollide(this, EntityPlayer.class, 5, true));
                                      }
                                      protected void applyEntityAttributes()
                                      {
                                          super.applyEntityAttributes();
                                          this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.30000001192092896D);
                                          if(this.isTamed())
                                          {
                                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
                                          }
                                          else
                                          {
                                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
                                          }
                                      }
                                      public boolean isAIEnabled()
                                      {
                                          return true;
                                      }
                                      protected void updateAITick()
                                      {
                                          this.dataWatcher.updateObject(18, Float.valueOf(this.getHealth()));
                                      }
                                      protected void entityInit()
                                      {
                                          super.entityInit();
                                          this.dataWatcher.addObject(18, new Float(this.getHealth()));
                                          this.dataWatcher.addObject(19, new Byte((byte)0));
                                          this.dataWatcher.addObject(20, new Byte((byte)BlockColored.func_150032_b(1)));
                                      }
                                      public void onLivingUpdate()
                                      {
                                          super.onLivingUpdate();
                                          if(!this.worldObj.isRemote && this.isShaking && !this.field_70928_h && !this.hasPath() && this.onGround)
                                          {
                                              this.field_70928_h = true;
                                              this.worldObj.setEntityState(this, (byte)8);
                                          }
                                      }
                                      public void onUpdate()
                                      {
                                          super.onUpdate();
                                          this.field_70924_f = this.field_70926_e;
                                          if(this.func_70922_bv())
                                          {
                                              this.field_70926_e += (1.0F - this.field_70926_e) * 0.4F;
                                          }
                                          else
                                          {
                                              this.field_70926_e += (0.0F - this.field_70926_e) * 0.4F;
                                          }
                                          if(this.func_70922_bv())
                                          {
                                              this.numTicksToChaseTarget = 10;
                                          }
                                          if(this.isWet())
                                          {
                                              this.isShaking = true;
                                              this.field_70928_h = false;
                                              this.timeWolfIsShaking = 0.0F;
                                          }
                                          else if((this.isShaking || this.field_70928_h) && this.field_70928_h)
                                          {
                                              if(this.timeWolfIsShaking == 0.0F)
                                              {
                                                  this.playSound("mob.wolf.shake", this.getSoundVolume(), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
                                              }
                                              this.timeWolfIsShaking += 0.05F;
                                              if(this.timeWolfIsShaking > 0.4F)
                                              {
                                                  float f = (float)this.boundingBox.minY;
                                                  int i = (int)(MathHelper.sin((this.timeWolfIsShaking - 0.4F) * (float)Math.PI) * 7.0F);
                                                  for(int j = 0; j < i; ++j)
                                                  {
                                                      float f1 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
                                                      float f2 = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width * 0.5F;
                                                      this.worldObj.spawnParticle("splash", this.posX + (double)f1, (double)(f + 0.8F), this.posZ + (double)f2, this.motionX, this.motionY, this.motionZ);
                                                  }
                                              }
                                          }
                                      }
                                      public int getVerticalFaceSpeed()
                                      {
                                          return this.isSitting() ? 20 : super.getVerticalFaceSpeed();
                                      }
                                      public boolean attackEntityAsMob(Entity p_70652_1_)
                                      {
                                          int i = this.isTamed() ? 4 : 2;
                                          return p_70652_1_.attackEntityFrom(DamageSource.causeMobDamage(this), (float)i);
                                      }
                                      public void setTamed(boolean p_70903_1_)
                                      {
                                          super.setTamed(p_70903_1_);
                                          if(p_70903_1_)
                                          {
                                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(700.0D);
                                          }
                                          else
                                          {
                                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
                                          }
                                      }
                                      public void setTameda(boolean p_70903_1_)
                                      {
                                          super.setTamed(p_70903_1_);
                                          if(p_70903_1_)
                                          {
                                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100.0D);
                                          }
                                          else
                                          {
                                              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(8.0D);
                                          }
                                      }
                                      public boolean interact(EntityPlayer p_70085_1_)
                                      {
                                          ItemStack itemstack = p_70085_1_.inventory.getCurrentItem();
                                          if(this.isTamed())
                                          {
                                              if(itemstack != null)
                                              {
                                                  if(itemstack.getItem() instanceof Baie)
                                                  {
                                                      ItemFood itemfood = (ItemFood)itemstack.getItem();
                                                      if(itemfood.isWolfsFavoriteMeat() && this.dataWatcher.getWatchableObjectFloat(18) < 20.0F)
                                                      {
                                                          if(!p_70085_1_.capabilities.isCreativeMode)
                                                          {
                                                              –itemstack.stackSize;
                                                          }
                                                          this.heal((float)itemfood.func_150905_g(itemstack));
                                                          if(itemstack.stackSize <= 0)
                                                          {
                                                              p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack)null);
                                                          }
                                                          return true;
                                                      }
                                                  }
                                                  else if(itemstack.getItem() == null)
                                                  {
                                                      int i = BlockColored.func_150032_b(itemstack.getItemDamage());
                                                      if(!p_70085_1_.capabilities.isCreativeMode && --itemstack.stackSize <= 0)
                                                      {
                                                          p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack)null);
                                                          return true;
                                                      }
                                                  }
                                              }
                                              if(this.func_152114_e(p_70085_1_) && !this.worldObj.isRemote && !this.isBreedingItem(itemstack))
                                              {
                                                  this.aiSit.setSitting(!this.isSitting());
                                                  this.isJumping = false;
                                                  this.setPathToEntity((PathEntity)null);
                                                  this.setTarget((Entity)null);
                                                  this.setAttackTarget((EntityLivingBase)null);
                                              }
                                          }
                                          if(!p_70085_1_.capabilities.isCreativeMode)
                                          {
                                              --itemstack.stackSize;
                                          }
                                          if(itemstack.stackSize <= 0)
                                          {
                                              p_70085_1_.inventory.setInventorySlotContents(p_70085_1_.inventory.currentItem, (ItemStack)null);
                                          }
                                          if(itemstack != null && itemstack.getItem() == enderdeath.GoldenCroquette)
                                          {
                                              if(!p_70085_1_.capabilities.isCreativeMode)
                                              {
                                                  --itemstack.stackSize;
                                              }
                                              if(!this.worldObj.isRemote)
                                              {
                                                  if(this.rand.nextInt(3) == 0)
                                                  {
                                                      this.setTameda(true);
                                                      this.setPathToEntity((PathEntity)null);
                                                      this.setAttackTarget((EntityLivingBase)null);
                                                      this.aiSit.setSitting(true);
                                                      this.setHealth(100.0F);
                                                      this.playTameEffect(true);
                                                      this.lvl = 2;
                                                      this.worldObj.setEntityState(this, (byte)7);
                                                  }
                                                  else
                                                  {
                                                      this.playTameEffect(false);
                                                      this.worldObj.setEntityState(this, (byte)6);
                                                  }
                                              }
                                              else if(itemstack != null && itemstack.getItem() == enderdeath.RubisCroquette && itemstack != null && this.lvl == 2)
                                              {
                                                  if(!p_70085_1_.capabilities.isCreativeMode)
                                                  {
                                                      --itemstack.stackSize;
                                                  }
                                                  if(!this.worldObj.isRemote)
                                                  {
                                                      if(this.rand.nextInt(3) == 0)
                                                      {
                                                          this.setTamed(true);
                                                          this.setPathToEntity((PathEntity)null);
                                                          this.setAttackTarget((EntityLivingBase)null);
                                                          this.aiSit.setSitting(true);
                                                          this.setHealth(5.0F);
                                                          this.func_152115_b(p_70085_1_.getUniqueID().toString());
                                                          this.playTameEffect(true);
                                                          this.lvl = 3;
                                                          System.out.println("Test Lvl3");
                                                          this.worldObj.setEntityState(this, (byte)7);
                                                      }
                                                      else
                                                      {
                                                          this.playTameEffect(false);
                                                          this.worldObj.setEntityState(this, (byte)6);
                                                      }
                                                  }
                                              }
                                              return true;
                                          }
                                          return super.interact(p_70085_1_);
                                      }
                                      public boolean isBreedingItem(ItemStack p_70877_1_)
                                      {
                                          return p_70877_1_ == null ? false : (!(p_70877_1_.getItem() instanceof Baie) ? false : ((Baie)p_70877_1_.getItem()).isWolfsFavoriteMeat());
                                      }
                                      public Familiar createChild(EntityAgeable p_90011_1_)
                                      {
                                          Familiar entitywolf = new Familiar(this.worldObj);
                                          String s = this.func_152113_b();
                                          if(s != null && s.trim().length() > 0)
                                          {
                                              entitywolf.func_152115_b(s);
                                              entitywolf.setTamed(true);
                                          }
                                          return entitywolf;
                                      }
                                      public void func_70918_i(boolean p_70918_1_)
                                      {
                                          if(p_70918_1_)
                                          {
                                              this.dataWatcher.updateObject(19, Byte.valueOf((byte)1));
                                          }
                                          else
                                          {
                                              this.dataWatcher.updateObject(19, Byte.valueOf((byte)0));
                                          }
                                      }
                                      public boolean canMateWith(EntityAnimal p_70878_1_)
                                      {
                                          if(p_70878_1_ == this)
                                          {
                                              return false;
                                          }
                                          else if(!this.isTamed())
                                          {
                                              return false;
                                          }
                                          else if(!(p_70878_1_ instanceof Familiar))
                                          {
                                              return false;
                                          }
                                          else
                                          {
                                              Familiar entitywolf = (Familiar)p_70878_1_;
                                              return !entitywolf.isTamed() ? false : (entitywolf.isSitting() ? false : this.isInLove() && entitywolf.isInLove());
                                          }
                                      }
                                      public boolean func_70922_bv()
                                      {
                                          return this.dataWatcher.getWatchableObjectByte(19) == 1;
                                      }
                                  }

                                  Voila ma signature

                                  1 réponse Dernière réponse Répondre Citer 0
                                  • robin4002
                                    robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par 19 mai 2016, 19:34

                                    Ce n’est toujours pas formaté comme il faut …
                                    J’ai édité ton message, c’est mieux comme ça.

                                    Ce que tu veux faire c’est qu’on puisse adopter une entité déjà adopté pour augmenter son niveau ?

                                    1 réponse Dernière réponse Répondre Citer 0
                                    • leo01418
                                      leo01418 dernière édition par 19 mai 2016, 20:18

                                      @‘robin4002’:

                                      Ce n’est toujours pas formaté comme il faut …
                                      J’ai édité ton message, c’est mieux comme ça.

                                      Ce que tu veux faire c’est qu’on puisse adopter une entité déjà adopté pour augmenter son niveau ?

                                      Excuse 
                                      Et c’est exact

                                      Voila ma signature

                                      1 réponse Dernière réponse Répondre Citer 0
                                      • robin4002
                                        robin4002 Moddeurs confirmés Rédacteurs Administrateurs dernière édition par 19 mai 2016, 20:25

                                        Du-coup au lieu d’avoir une variable tamed du type boolean il faudrait utiliser un int ou un short.
                                        0 correspondrait à non adopté. 1 pour le premier niveau, etc …
                                        Après c’est pas compliqué à mettre en place, il faut modifier la fonction interact et adapter en fonction de cette variable.
                                        Et les fonctions qui demande un boolean il suffit de mettre this.tamed > 0 à la place.

                                        1 réponse Dernière réponse Répondre Citer 0
                                        • leo01418
                                          leo01418 dernière édition par 20 mai 2016, 19:40

                                          @‘robin4002’:

                                          Du-coup au lieu d’avoir une variable tamed du type boolean il faudrait utiliser un int ou un short.
                                          0 correspondrait à non adopté. 1 pour le premier niveau, etc …
                                          Après c’est pas compliqué à mettre en place, il faut modifier la fonction interact et adapter en fonction de cette variable.
                                          Et les fonctions qui demande un boolean il suffit de mettre this.tamed > 0 à la place.

                                          Bonjour robin merci de ta réponse rapide et précise  🙂 
                                          Mais pour moi sa devait être plus facile j’ai essayé des tas de manniére pour le faire mais n’y arrivant pas je poste ce message et je n’ai pas compris comment faire pour que la variable = adopté ou pas

                                          Voila ma signature

                                          1 réponse Dernière réponse Répondre Citer 0
                                          • 1
                                          • 2
                                          • 3
                                          • 4
                                          • 5
                                          • 1 / 5
                                          13 sur 90
                                          • Premier message
                                            13/90
                                            Dernier message
                                          Design by Woryk
                                          Contact / Mentions Légales

                                          MINECRAFT FORGE FRANCE © 2018

                                          Powered by NodeBB