[SEMI TUTO] Création de mon mob hostile: spawn, attaque etc.
-
C’est à dire? Je la mets en forme comment? Je dois refaire la partie AI (que tout le monde me déconseille de faire)? Ou autrement?
Une fois que je saurais ce sera bon et assimilé :). Faut juste que je vois l’exemple :/.
Et cela va lui faire attaquer tous les mobs non hostiles?PS: C’est la dernière chose qui manque pour que le mob soit près :D!
-
Il faut que tu reprennes la fonction applyEntityAi() que tu avais (elle est dans le code du Zombie), c’est elle qui s’occupe de ça, ajouté son appel à la fin de ton constructeur et pour mettre que ça attaque tous les mobs, change EntityPlayer.class par EntityCreature.class.
-
package Entity; import fr.minecraftforgefrance.modzoic.common.Modzoic; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveThroughVillage; import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.passive.EntityRabbit; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class Entityclass extends EntityMob { public Entityclass(World world) { super(world); ((PathNavigateGround)this.getNavigator()).setBreakDoors(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.setSize(2, 3); this.applyEntityAI(); } public void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(62D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(9D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(2D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.36D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(120D); } protected void applyEntityAI() { this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityCreature.class, true)); } public void dropFewItems(boolean b, int looting) { this.dropItem(Modzoic.meatEpanterias, 6); } protected String getLivingSound() { return "modzoic" + ":mob.nanuqsaurus.living"; } @Override public boolean canDespawn() { return false; } @Override public boolean getCanSpawnHere() { int i = MathHelper.floor_double(posX); int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); int k = MathHelper.floor_double(posZ); int l = worldObj.getLight(new BlockPos(i, j, k)); return worldObj.getCollidingBoundingBoxes(this, getEntityBoundingBox()).size() == 0 && worldObj.checkNoEntityCollision(this.getEntityBoundingBox()) && worldObj.canSeeSky(new BlockPos(i, j, k)) && rand.nextInt(5) == 0 && l > 10; } }Il n’attaque toujours personne, même pas moi

-
Et si tu retires toutes les IA, toutes les lignes commençant par targetTasks ou tasks…Quel résultat obtiens-tu ? Ton mob t’attaque-t-il ?
-
@Plaigon, il ne va pas bouger sans AI. (Et les super classes ne servent qu’à gérer les réglés de spawn des mobs). Essaye plutôt avec EntityPlayer.class. Et tu pourras dire à quoi correspond le true (ai pas le code en face(.
-
Cela ne changera rien c’était justement comme ça avant.
Vous n’avez pas de mob hostile 1.8 vous? -
Si j’ai un mob qui marche très bien (en 1.8 du moins).
Et c’est bizarre que ça ne marche pas. Essaye de voir si il te prend comme cible (donc pb de déplacement) ou pas, ajoutes ça dans ton code :@Override public void onUpdate() { super.onUpdate(); //On laisse la fonction de EntityMob s'exécuter System.out.println("Cible : " + this.getAttackTarget()); //On print la cible }Si ça met null, c’est que ça marche pas, sinon c’est qu’il arrive à te choisir comme cible.
PS : ça va te l’afficher 20 fois par seconde tant que le mob est en vie alors le test pas pendant des heures ^^
-
Petite question conne, mais quand tu teste tu es en creatif? si oui normal, les mob ne target pas les joueurs en créatif
-
Isador, je suis pas bête à ce point quand même ^^'…
Sinon:
19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:38] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:38] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:39] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:39] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:39] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [19:08:39] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : Entityclass[' Nanuqsaurus'/72, l='Nouveau monde', x=-8,77, y=4,00, z=-1052,10] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/76, l='Nouveau monde', x=8,98, y=4,00, z=-1213,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : Entitygorgosaurus[' Gorgosaurus'/75, l='Nouveau monde', x=5,10, y=4,00, z=-1213,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/95, l='Nouveau monde', x=43,70, y=4,00, z=-1102,28] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntitySheep['Mouton'/61, l='Nouveau monde', x=-33,96, y=4,00, z=-1124,02] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/62, l='Nouveau monde', x=-28,50, y=4,00, z=-1123,50] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntitySheep['Mouton'/74, l='Nouveau monde', x=-7,24, y=4,00, z=-1053,85] [19:08:39] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:Ils n’ont attaqué personne (les deux mobs, presque identiques dans le comportement).
-
Apparement l’entité change constamment de cible, ce qui l’empêche de se diriger vers une précisément, renvoie ton code avec tes entity AI.
-
C’est le même, il a pas changé x’)…
Nanuqsaurus:package Entity; import fr.minecraftforgefrance.modzoic.common.Modzoic; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveThroughVillage; import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.passive.EntityRabbit; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class Entityclass extends EntityMob { public Entityclass(World world) { super(world); ((PathNavigateGround)this.getNavigator()).setBreakDoors(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.setSize(2, 3); this.applyEntityAI(); } @Override public void onUpdate() { super.onUpdate(); //On laisse la fonction de EntityMob s'exécuter System.out.println("Cible : " + this.getAttackTarget()); //On print la cible } public void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(62D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(9D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(2D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.36D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(120D); } protected void applyEntityAI() { this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityCreature.class, true)); } public void dropFewItems(boolean b, int looting) { this.dropItem(Modzoic.meatEpanterias, 6); } protected String getLivingSound() { return "modzoic" + ":mob.nanuqsaurus.living"; } @Override public boolean canDespawn() { return false; } @Override public boolean getCanSpawnHere() { int i = MathHelper.floor_double(posX); int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); int k = MathHelper.floor_double(posZ); int l = worldObj.getLight(new BlockPos(i, j, k)); return worldObj.getCollidingBoundingBoxes(this, getEntityBoundingBox()).size() == 0 && worldObj.checkNoEntityCollision(this.getEntityBoundingBox()) && worldObj.canSeeSky(new BlockPos(i, j, k)) && rand.nextInt(5) == 0 && l > 10; } }Gorgosaurus:
package Entity; import fr.minecraftforgefrance.modzoic.common.Modzoic; import net.minecraft.entity.EntityCreature; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.EntityAIAttackOnCollide; import net.minecraft.entity.ai.EntityAIHurtByTarget; import net.minecraft.entity.ai.EntityAILookIdle; import net.minecraft.entity.ai.EntityAIMoveThroughVillage; import net.minecraft.entity.ai.EntityAIMoveTowardsRestriction; import net.minecraft.entity.ai.EntityAINearestAttackableTarget; import net.minecraft.entity.ai.EntityAISwimming; import net.minecraft.entity.ai.EntityAIWander; import net.minecraft.entity.ai.EntityAIWatchClosest; import net.minecraft.entity.monster.EntityIronGolem; import net.minecraft.entity.monster.EntityMob; import net.minecraft.entity.monster.EntityPigZombie; import net.minecraft.entity.passive.EntityChicken; import net.minecraft.entity.passive.EntityCow; import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityOcelot; import net.minecraft.entity.passive.EntityPig; import net.minecraft.entity.passive.EntityRabbit; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.pathfinding.PathNavigateGround; import net.minecraft.util.BlockPos; import net.minecraft.util.MathHelper; import net.minecraft.world.World; public class Entitygorgosaurus extends EntityMob { public Entitygorgosaurus(World world) { super(world); ((PathNavigateGround)this.getNavigator()).setBreakDoors(true); this.tasks.addTask(0, new EntityAISwimming(this)); this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false)); this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D)); this.tasks.addTask(7, new EntityAIWander(this, 1.0D)); this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F)); this.tasks.addTask(8, new EntityAILookIdle(this)); this.setSize(3, 3); this.applyEntityAI(); } public void applyEntityAttributes() { super.applyEntityAttributes(); this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(100D); this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(14D); this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(2.5D); this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.32D); this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(150D); } protected void applyEntityAI() { this.targetTasks.addTask(1, new EntityAINearestAttackableTarget(this, EntityCreature.class, true)); } public void dropFewItems(boolean b, int looting) { this.dropItem(Modzoic.meatEpanterias, 14); } @Override public void onUpdate() { super.onUpdate(); //On laisse la fonction de EntityMob s'exécuter System.out.println("conquerorguepard : " + this.getAttackTarget()); //On print la cible } protected String getLivingSound() { return "modzoic" + ":mob.gorgosaurus.living"; } @Override public boolean canDespawn() { return false; } @Override public boolean getCanSpawnHere() { int i = MathHelper.floor_double(posX); int j = MathHelper.floor_double(this.getEntityBoundingBox().minY); int k = MathHelper.floor_double(posZ); int l = worldObj.getLight(new BlockPos(i, j, k)); return worldObj.getCollidingBoundingBoxes(this, getEntityBoundingBox()).size() == 0 && worldObj.checkNoEntityCollision(this.getEntityBoundingBox()) && worldObj.canSeeSky(new BlockPos(i, j, k)) && rand.nextInt(5) == 0 && l > 10; } } -
Essaye avec juste EntityPlayer (à la place de EntityCreature pour l’ai). Si ça ne marche toujours pas, je regarderais demain (ou ce soir) ce qui peut poser ce problème (on sait au moins maintenant ce qui le cause).
-
Mais on avait déjà essayé! X)
-
Ouais mais la je sais que le pb c’est qu’il change tj de cible
-
[17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntityPlayerMP['conquerorguepard'/18, l='Nouveau monde', x=-447,50, y=4,00, z=169,50] [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntityPlayerMP['conquerorguepard'/18, l='Nouveau monde', x=-447,50, y=4,00, z=169,50] [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : EntityPlayerMP['conquerorguepard'/18, l='Nouveau monde', x=-447,50, y=4,00, z=169,50] [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Server thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : EntityPlayerMP['conquerorguepard'/18, l='Nouveau monde', x=-447,50, y=4,00, z=169,50] [17:33:03] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Client thread/INFO] [STDOUT]: [Entity.Entitygorgosaurus:onUpdate:72]: conquerorguepard : null [17:33:03] [Client thread/INFO] [STDOUT]: [Entity.Entityclass:onUpdate:52]: Cible : null [17:33:03] [Server thread/INFO]: Saving and pausing game…Ils me ré-attaquent. Mais n’attaque que moi, et surtout… Ne saute plus :'(… On se retrouve avec le problème de départ.
-
Ça c’est normal qui tattaquent que toi avec ce code mais qu’il ne sautent pas…
-
Oui. Très étrange. Je ne comprends pas… Tu voudrais les fichiers pour tester de ton coté?
-
Ouais je veux bien.
-
Envoyé. Dis moi si tu trouves.

-
Là je suis en voiture donc ça va attendre ce soir/demain ^^EDIT : Effectivement, il attaque très bien mais ne saute pas, je vais voir ça en testant avec ton mob. Et je te fais la remarque que tes fichiers sont très mal organisés et les noms ne sont pas vraiment logiques (je vais voir si je te renvoies tout organisé ou te dis la meilleure organisation à faire), t’a aussi, là où tu register tes entitées du code unutile et déprécié (déconseillé) pas Forge.
REDIT : Bon ben ça vient d’un bug tout con de mc, la taille, elle est apparemment trop grande, je l’ai réduite à 1*3 et ça marche
