Keyblade_crafter

EntityBulbasaur

May 2nd, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.67 KB | None | 0 0
  1. package frank.Pokemod;
  2.  
  3. import net.minecraft.entity.EntityAgeable;
  4. import net.minecraft.entity.ai.EntityAIFollowParent;
  5. import net.minecraft.entity.ai.EntityAILookIdle;
  6. import net.minecraft.entity.ai.EntityAIMate;
  7. import net.minecraft.entity.ai.EntityAIPanic;
  8. import net.minecraft.entity.ai.EntityAISwimming;
  9. import net.minecraft.entity.ai.EntityAITempt;
  10. import net.minecraft.entity.ai.EntityAIWander;
  11. import net.minecraft.entity.ai.EntityAIWatchClosest;
  12. import net.minecraft.entity.passive.EntityAnimal;
  13. import net.minecraft.entity.player.EntityPlayer;
  14. import net.minecraft.init.Items;
  15. import net.minecraft.item.Item;
  16. import net.minecraft.world.World;
  17.  
  18. //Your declaration. If your mob swims, change EntityAnimal to EntityWaterMob.
  19. public class EntityBulbasaur extends EntityAnimal {
  20.        
  21.         public EntityBulbasaur(World par1World) {
  22.                 super(par1World);
  23.                 this.texture = "/frank/Pokemod/BulbasaurTexture.png";
  24.                 //The below means if possible, it wont walk into water
  25.                 this.getNavigator().setAvoidsWater(true);
  26.                 //This is the hit box size. I believe it starts in the center and grows outwards
  27.                 this.setSize(1.5F, 0.9F);
  28.                 //Pretty self-explanatory.
  29.                 this.isImmuneToFire = false;
  30.                 float var2 = 0.25F;
  31.  
  32.                 //Now, we have the AI. Each number in the addTask is a priority. 0 is the highest, the largest is lowest.
  33.                 //They should be set in the order which the mob should focus, because it can only do one thing at a time. I'll explain my choice for order below.
  34.                 //There are tons of tasks you can add. Look in the JavaDocs or other mob classes to find some more!
  35.  
  36.                 //Swimming should ALWAYS be first. Otherwise if your mob falls in water, but it's running away from you or something it'll drown.
  37.                 this.tasks.addTask(0, new EntityAISwimming(this));
  38.  
  39.                 //This makes the mob run away when you punch it
  40.                 this.tasks.addTask(1, new EntityAIPanic(this, 0.38F));
  41.  
  42.                 //If you have mating code, this allows it to mate.
  43.                 this.tasks.addTask(2, new EntityAIMate(this, var2));
  44.  
  45.                 //This code is used to get the mob to follow you (like cows with wheat). Here it's set to a custom fruit
  46.                 this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.apple, false));
  47.  
  48.                 //If the mob is a child, it will follow it's parent.
  49.                 this.tasks.addTask(4, new EntityAIFollowParent(this, 0.28F));
  50.  
  51.                 //This makes the mob walk around. Without it, it'd just stand still.
  52.                 this.tasks.addTask(5, new EntityAIWander(this, var2));
  53.  
  54.                 //This makes the mob watch the nearest player, within a range set by the float.
  55.                 this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
  56.  
  57.                 //Finally, this makes it look around when it's not looking at a player or wandering.
  58.                 this.tasks.addTask(7, new EntityAILookIdle(this));
  59.         }
  60.  
  61.         //This is required. If it's false, none of the above takes effect.
  62.         public boolean isAIEnabled() {
  63.                 return true;
  64.         }
  65.        
  66.         //Pretty obvious, set it's health!
  67.         public int getMaxHealth() {
  68.                 return 10;
  69.         }
  70.        
  71.         //The sound effect played when it's just living, like a cow mooing.
  72.         protected String getLivingSound() {
  73.                 return "mob.cow.say";
  74.         }
  75.        
  76.         //The sound made when it's attacked. Often it's the same as the normal say sound, but sometimes different (such as in the ender dragon)
  77.         protected String getHurtSound() {
  78.                 return "mob.cow.say";
  79.         }
  80.        
  81.         //The sound made when it actually dies.
  82.         protected String getDeathSound() {
  83.                 return "mob.cow.death";
  84.         }
  85.  
  86.         //The sound the mob plays when walking around.  
  87.         protected void playStepSound(int par1, int par2, int par3, int par4) {
  88.                 this.worldObj.playSoundAtEntity(this, "mob.cow.step", 0.15F,  1.0F);
  89.         }
  90.        
  91.         //A basic example of what a mob should drop on death. For more advanced examples, look at code for chicken or squid.
  92.         protected Item getDropItemId() {
  93.                 return Items.experience_bottle;
  94.         }
  95.        
  96.         //This is required regardless of if your animal can breed or not. Set to null if it can't breed - I wont cover breeding here.
  97.         public EntityAgeable createChild(EntityAgeable var1) {
  98.                 return null;
  99.         }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment