MFF

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

    [1.7.10] Spawn de mob en plein jour fonctionne pas

    Planifier Épinglé Verrouillé Déplacé Résolu 1.7.x
    1.7.10
    2 Messages 1 Publieurs 182 Vues 1 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.
    • P Hors-ligne
      PlagueZ
      dernière édition par PlagueZ

      Bonjour,
      Me suis remis a coder un truc et après plusieurs tentative infructueuse je me dirige vers vous je cherche a faire spawner un mob hostile qui étend la class EntityMob en plein jour Mais voila quoi que je fasse mon mob spawn sans problème de nuit sauf si je lui met l’attribut créature ou ambiant la plus rien ne spawn nuit ou jour j’ai aussi essayer de override getCanSpawnHere() ou isValidLightLevel() sans resultat

      
      import net.minecraft.entity.EnumCreatureAttribute;
      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.EntityMob;
      import net.minecraft.entity.passive.EntityVillager;
      import net.minecraft.entity.passive.IAnimals;
      import net.minecraft.entity.player.EntityPlayer;
      import net.minecraft.init.Items;
      import net.minecraft.item.Item;
      import net.minecraft.world.EnumDifficulty;
      import net.minecraft.world.World;
      import net.minecraftforge.common.ForgeModContainer;
      
      public class EntityZeds extends EntityMob implements IAnimals
      {
      	public EntityZeds(World world)
      	{
      		super(world);
              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(4, new EntityAIAttackOnCollide(this, EntityVillager.class, 1.0D, true));
              this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
              this.tasks.addTask(6, new EntityAIMoveThroughVillage(this, 1.0D, false));
              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.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
              this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
              this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, 0, false));
              this.setSize(0.6F, 1.8F);
      	}
      	public void applyEntityAttributes()
      	{
      		super.applyEntityAttributes();
              this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(40.0D);
              this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(0.23000000417232513D);
              this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(3.0D);
      	}
      	@Override
      	public boolean getCanSpawnHere()
      	{
      	return super.getCanSpawnHere();
      	}
      	@Override
      	protected boolean isValidLightLevel(){
      		return true;
      	}
      	protected boolean canDespawn()
      	{
      	return false;
      	}
      	public Item getDropItem()
      	{
      		return Items.apple;
      	}
      } 
      ===
      ===group
      
      @EventHandler
      public void init(FMLInitializationEvent event)
      {		
      	EntityRegistry.addSpawn(EntityZeds.class, ProbaSpawn, min, max, EnumCreatureType.monster, BiomeGenBase.ocean,BiomeGenBase.plains,BiomeGenBase.desert,BiomeGenBase.extremeHills,
      		BiomeGenBase.forest,BiomeGenBase.taiga,BiomeGenBase.swampland,BiomeGenBase.river,BiomeGenBase.hell,BiomeGenBase.sky,BiomeGenBase.frozenOcean,BiomeGenBase.frozenRiver,
      		BiomeGenBase.icePlains,BiomeGenBase.iceMountains,BiomeGenBase.mushroomIsland,BiomeGenBase.mushroomIslandShore,BiomeGenBase.beach,BiomeGenBase.desertHills,BiomeGenBase.forestHills,
      		BiomeGenBase.taigaHills,BiomeGenBase.extremeHillsEdge,BiomeGenBase.jungle,BiomeGenBase.beach,BiomeGenBase.jungleHills,BiomeGenBase.jungleEdge,BiomeGenBase.deepOcean,BiomeGenBase.stoneBeach,
      		BiomeGenBase.coldBeach,BiomeGenBase.birchForest,BiomeGenBase.birchForestHills,BiomeGenBase.roofedForest,BiomeGenBase.coldTaiga,BiomeGenBase.coldTaigaHills,BiomeGenBase.megaTaiga,
      		BiomeGenBase.megaTaigaHills,BiomeGenBase.extremeHillsPlus,BiomeGenBase.savanna,BiomeGenBase.savannaPlateau,BiomeGenBase.mesa,BiomeGenBase.mesaPlateau_F,BiomeGenBase.mesaPlateau);
          	MinecraftForge.EVENT_BUS.register(new EntityJoinEvent());
      	EntityRegistry.registerGlobalEntityID(EntityZeds.class, "zeds", EntityRegistry.findGlobalUniqueEntityId(), new Color(0, 0, 255).getRGB(), new Color(255, 0, 0).getRGB());
      	EntityRegistry.registerModEntity(EntityZeds.class, "zeds", 420, this.instance, 40, 2, true);
      	//new EntityRegister();
      	MinecraftForge.EVENT_BUS.register(new EntityJoinEvent());
      	proxy.registerRender();
      }
      

      du coup si vous trouvez un solution je suis prêt a tout essayer au passage c’est sous forge-1.7.10-10.13.4.1558-1.7.10 des fois que ça ai une importance Merci d’avance

      “Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire wo…

      1 réponse Dernière réponse Répondre Citer 0
      • P Hors-ligne
        PlagueZ
        dernière édition par

        @Override
        public boolean getCanSpawnHere()
        {
        //int i = MathHelper.floor_double(posX);
        //int j = MathHelper.floor_double(boundingBox.minY);
        //int k = MathHelper.floor_double(posZ);
        	
        return (this.worldObj.getCollidingBoundingBoxes(this, this.boundingBox).isEmpty() &&
        !this.worldObj.isAnyLiquid(this.boundingBox));
        }
        @Override
        protected boolean isValidLightLevel(){
        	return true;
        }
        protected boolean canDespawn()
        {
        return false;
        }
        

        ce code semble fonctionner pour ceux qui cherche comment faire en sorte de régler le probleme

        “Imagination is more important than knowledge. For knowledge is limited to all we now know and understand, while imagination embraces the entire wo…

        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