MFF

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

    son custom sur une entité

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

      bonjour, je voudrais mettre mon son pour mon mob (comme le son du zombie)

      package com.extremium.mod.entity;
      
      import java.util.Random;
      
      import com.extremium.mod.Extremium;
      import com.extremium.mod.Reference;
      import com.extremium.mod.init.BlockMod;
      import com.extremium.mod.init.ItemMod;
      
      import cpw.mods.fml.common.registry.EntityRegistry;
      import net.minecraft.entity.Entity;
      import net.minecraft.entity.EnumCreatureType;
      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.player.EntityPlayer;
      import net.minecraft.entity.projectile.EntityFireball;
      import net.minecraft.entity.projectile.EntitySmallFireball;
      import net.minecraft.entity.projectile.EntitySnowball;
      import net.minecraft.init.Items;
      import net.minecraft.item.Item;
      import net.minecraft.util.MathHelper;
      import net.minecraft.world.World;
      import net.minecraft.world.biome.BiomeGenBase;
      import net.minecraftforge.common.ForgeModContainer;
      
      public class EntityDrastic extends EntityMob
      {
          private int field_70846_g;
          
          public EntityDrastic(World world, int x, int y, int z)
          {
          this(world);
          this.setPosition(x, y, z);
          }
          
          public EntityDrastic(World world)
          {
              super(world);
              this.getNavigator().setBreakDoors(true);
              this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 5.0D, false));
              this.tasks.addTask(0, new EntityAISwimming(this)); 
              this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
              this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 64.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);
              this.isImmuneToFire();
          }
         
          
          protected void applyEntityAttributes()
          {
              super.applyEntityAttributes();
              this.getEntityAttribute(SharedMonsterAttributes.followRange).setBaseValue(80.0D);
              this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(24.0D);
              this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(75.0D);
              this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setBaseValue(2500.0D);
              this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setBaseValue(0.1);
          }
      
          
          public Item getItemDropped(int metadata, Random random, int fortune)
          {
              return null;
          }
          
          protected void dropFewItems(boolean p_70628_1_, int p_70628_2_)
          {
              this.dropItem(ItemMod.dark_sword, 1);
          }
          
          protected String getLivingSound()
          {
             return Reference.MOD_ID + "sounds.drastic.fight";
          }
          
      
          
          protected void attackEntity(Entity p_70785_1_, float p_70785_2_)
          {
              if (this.attackTime <= 0 && p_70785_2_ < 2.0F && p_70785_1_.boundingBox.maxY > this.boundingBox.minY && p_70785_1_.boundingBox.minY < this.boundingBox.maxY)
              {
                  this.attackTime = 20;
                  this.attackEntityAsMob(p_70785_1_);
              }
              else if (p_70785_2_ < 30.0F)
              {
                  double d0 = p_70785_1_.posX - this.posX;
                  double d1 = p_70785_1_.boundingBox.minY + (double)(p_70785_1_.height / 2.0F) - (this.posY + (double)(this.height / 2.0F));
                  double d2 = p_70785_1_.posZ - this.posZ;
      
                  if (this.attackTime == 0)
                  {
                     
                          float f1 = MathHelper.sqrt_float(p_70785_2_) * 0.5F;
                          this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1009, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
      
                          
                              EntitySmallFireball entitysmallfireball = new EntitySmallFireball(this.worldObj, this, d0 + this.rand.nextGaussian() * (double)f1, d1, d2 + this.rand.nextGaussian() * (double)f1);
                              entitysmallfireball.posY = this.posY + (double)(this.height / 2.0F) + 0.5D;
                              this.worldObj.spawnEntityInWorld(entitysmallfireball);
                              EntitySnowball snowball = new EntitySnowball(worldObj);
                              snowball.posY = this.posY + (double)(this.height / 2.0F) + 0.5D;
                              this.worldObj.spawnEntityInWorld(snowball);
                       
                  }
                  if (this.attackTime == 1)
                  {
                      
                  }
                  if (this.attackTime == 2)
                  {
                      
                  }
                  if (this.attackTime == 3)
                  {
                      
                  }
                  if (this.attackTime == 4)
                  {
                      
                  }
                  if (this.attackTime == 5)
                  {
                      
                  }
                  if (this.attackTime == 6)
                  {
                      
                  }
      
                  this.rotationYaw = (float)(Math.atan2(d2, d0) * 180.0D / Math.PI) - 90.0F;
                  this.hasAttacked = true;
              }
          }
      }
      
      

      Merci

      1 réponse Dernière réponse Répondre Citer -1
      • AytrexoisA Hors-ligne
        Aytrexois
        dernière édition par

        Il n’y a pas un this.addson / entity.addson un truc comme sa ? (je ne sais pas mais je propose)

        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