Keyblade_crafter

EntityBulbasaur

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