Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [code]package dofusMobs.Client;
- import java.util.Random;
- import org.lwjgl.opengl.GL11;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.SharedMonsterAttributes;
- import net.minecraft.entity.ai.EntityAISwimming;
- import net.minecraft.entity.ai.attributes.AttributeInstance;
- import net.minecraft.entity.ai.attributes.AttributeModifier;
- import net.minecraft.entity.monster.EntityMob;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.nbt.NBTTagCompound;
- import net.minecraft.util.DamageSource;
- import net.minecraft.world.World;
- public class EntityBouftonBlanc extends EntityMob
- {
- int maxHp = (int) this.getMaxHealth(); //affiche les HP max du mob
- int hp = (int) this.getHealth(); // affiche les PV actuelle du mob (ne s'actualise pas ><)
- int mobLevel; //level du mob)
- public String mobInfo = "Boufton Blanc"; // affiche le nom
- public String infoHP = experienceValue + "/" + maxHp; // รงa c'est juste pour voire ^^
- public String lvl ="Level "+ mobLevel; // affiche le level
- public EntityBouftonBlanc(World par1World)
- {
- super(par1World);
- this.tasks.addTask(1, new EntityAISwimming(this));
- mobLevel = this.worldObj.rand.nextInt(4) + 11; // Dit quelle level est le mob
- }
- @Override
- protected void applyEntityAttributes()
- {
- super.applyEntityAttributes();
- this.getEntityAttribute(SharedMonsterAttributes.followRange).setAttribute(1.0D);
- this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setAttribute(0.25D);
- this.getEntityAttribute(SharedMonsterAttributes.knockbackResistance).setAttribute(10000.0D);
- if (mobLevel == 11)
- {
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(8.0D);
- this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(1.0D);
- }
- if (mobLevel == 12)
- {
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(12.0D);
- this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(1.5D);
- }
- if (mobLevel == 13)
- {
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(14.0D);
- this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(2.0D);
- }
- if (mobLevel == 14)
- {
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(16.0D);
- this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(2.0D);
- }
- if (mobLevel == 15)
- {
- this.getEntityAttribute(SharedMonsterAttributes.maxHealth).setAttribute(18.0D);
- this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setAttribute(2.0D);
- }
- }
- public void writeEntityToNBT(NBTTagCompound nbtTag)
- {
- super.writeEntityToNBT(nbtTag);
- nbtTag.setInteger("nom", mobLevel);
- }
- public void readEntityFromNBT(NBTTagCompound nbtTag)
- {
- super.readEntityFromNBT(nbtTag);
- mobLevel = nbtTag.getInteger("nom");
- }
- protected void attackEntity(Entity par1Entity, float par2)
- {
- if (this.attackTime <= 0 && par2 < 2.0F && par1Entity.boundingBox.maxY > this.boundingBox.minY && par1Entity.boundingBox.minY < this.boundingBox.maxY)
- {
- this.attackTime = 30;
- this.attackEntityAsMob(par1Entity);
- }
- }
- public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
- {
- if (this.isEntityInvulnerable())
- {
- return false;
- }
- else if (super.attackEntityFrom(par1DamageSource, par2))
- {
- Entity entity = par1DamageSource.getEntity();
- if (this.riddenByEntity != entity && this.ridingEntity != entity)
- {
- if (entity != this)
- {
- this.entityToAttack = entity;
- }
- return true;
- }
- else
- {
- return true;
- }
- }
- else
- {
- return false;
- }
- }
- protected Entity findPlayerToAttack()
- {
- EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 0.0D);
- return entityplayer != null && this.canEntityBeSeen(entityplayer) ? entityplayer : null;
- }
- /**
- * Returns the sound this mob makes while it's alive.
- */
- protected String getLivingSound(World world, int x, int y, int z)
- {
- return "dofusmobs:sound.bouftou_ambiant";
- }
- /**
- * Returns the sound this mob makes when it is hurt.
- */
- protected String getHurtSound(World world, int x, int y, int z)
- {
- return "dofusmobs:bouftou_prendcoup";
- }
- /**
- * Returns the sound this mob makes on death.
- * @return
- */
- protected String getDeathSound(World world, EntityPlayer player)
- {
- return "dofusmobs:bouftou_meurt";
- }
- protected String getAttackSound()
- {
- return "dofusmobs:bouftou_attaque";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement