Don't like ads? PRO users don't see any ads ;-)
Guest

Herobrine The First Mob By Eth for FLS.

By: a guest on Jun 9th, 2012  |  syntax: Java  |  size: 4.98 KB  |  hits: 38  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. mod_Mobs
  2. package net.minecraft.src;
  3.  
  4. import java.util.Map;
  5.  
  6. public class mod_Mobs extends BaseMod
  7. {
  8.  
  9.         @Override
  10.         public String getVersion() {
  11.                 return "Test";
  12.         }
  13.     public void addRenderer(Map map)
  14.     {
  15.         map.put(EntiteBloodMonster.class, new RenderBloodMonster( new ModelBloodMonster(), 0.5f));
  16.         map.put(EntityHerobrine.class, new RenderHerobrine( new ModelHerobrine(), 0.5f));
  17.        
  18.     }
  19.         @Override
  20.         public void load() {
  21.                 ModLoader.registerEntityID(EntiteBloodMonster.class, "Blood Monster", ModLoader.getUniqueEntityId());
  22.                 ModLoader.registerEntityID(EntityHerobrine.class, "Herobrine", ModLoader.getUniqueEntityId());
  23.                 ModLoader.addSpawn(EntiteBloodMonster.class, 12, 4, 4, EnumCreatureType.creature);
  24.                 ModLoader.addSpawn(EntityHerobrine.class, 5, 1, 1, EnumCreatureType.creature, new BiomeGenBase[] {BiomeGenBase.hell, });
  25.         }
  26.        
  27. }
  28.  
  29. EntityHerobrine
  30. ----
  31.  
  32. package net.minecraft.src;
  33.  
  34. import java.util.Random;
  35.  
  36. public class EntityHerobrine extends EntityMob
  37. {
  38.         public EntityHerobrine(World par1World)
  39.  
  40.         {
  41.                 super(par1World);
  42.                 texture = "/mod/herobrine.png";
  43.                 moveSpeed = 0.25F;
  44.                 attackStrength = 15;
  45.                 getNavigator().setBreakDoors(true);
  46.         }
  47.        
  48.  
  49.         public int getMaxHealth()
  50.         {
  51.                 return 28;
  52.         }
  53.  
  54.         /**
  55.          * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
  56.          */
  57.         public int getTotalArmorValue()
  58.         {
  59.                 return 2;
  60.         }
  61.  
  62.         /**
  63.          * Returns true if the newer Entity AI code should be run
  64.          */
  65.         protected boolean isAIEnabled()
  66.         {
  67.                 return true;
  68.         }
  69.  
  70.         /**
  71.          * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
  72.          * use this to react to sunlight and start to burn.
  73.          */
  74.         public void onLivingUpdate()
  75.         {
  76.  
  77.                 super.onLivingUpdate();
  78.         }
  79.  
  80.        
  81.  
  82.         /**
  83.          * Returns the sound this mob makes while it's alive.
  84.          */
  85.         protected String getLivingSound()
  86.         {
  87.                 return "mob.zombie";
  88.         }
  89.  
  90.         /**
  91.          * Returns the sound this mob makes when it is hurt.
  92.          */
  93.         protected String getHurtSound()
  94.         {
  95.                 return "mob.zombiehurt";
  96.         }
  97.  
  98.         /**
  99.          * Returns the sound this mob makes on death.
  100.          */
  101.         protected String getDeathSound()
  102.         {
  103.                 return "mob.zombiedeath";
  104.         }
  105.  
  106.         /**
  107.          * Returns the item ID for the item the mob drops on death.
  108.          */
  109.         protected void dropFewItems(boolean flag, int i)
  110.     {
  111.     int num =rand.nextInt(10);
  112.     if (num>=3){
  113.     dropItem(Item.appleGold.shiftedIndex,1);
  114.             }
  115.     else if (num==2){
  116.     dropItem(10,1);
  117.     }
  118.     else{
  119.     dropItem(51,1);
  120.     }
  121.     dropItem(Item.diamond.shiftedIndex,1);
  122.     }
  123.  
  124.         /**
  125.          * Get this Entity's EnumCreatureAttribute
  126.          */
  127.  
  128.          public ItemStack getHeldItem()
  129.          {return new ItemStack(Item.swordGold, 1);}
  130.  
  131.  
  132.  
  133.         {
  134.         }
  135. }
  136.  
  137.  
  138.  
  139.  
  140. RENDERHEROBRINE
  141.  
  142. package net.minecraft.src;
  143.  
  144. import org.lwjgl.opengl.GL11;
  145.  
  146. public class RenderHerobrine extends RenderLiving
  147. {
  148.         protected ModelBiped modelBipedMain;
  149.         protected float field_40296_d;
  150.  
  151.         public RenderHerobrine(ModelHerobrine modelHerobrine, float par2)
  152.         {
  153.                 this(modelHerobrine, par2, 1.0F);
  154.                 modelBipedMain = modelHerobrine;
  155.         }
  156.  
  157.         public RenderHerobrine(ModelBiped par1ModelBiped, float par2, float par3)
  158.         {
  159.                 super(par1ModelBiped, par2);
  160.                 modelBipedMain = par1ModelBiped;
  161.                 field_40296_d = par3;
  162.         }
  163.  
  164.         protected void renderEquippedItems(EntityLiving par1EntityLiving, float par2)
  165.         {
  166.                 super.renderEquippedItems(par1EntityLiving, par2);
  167.                 ItemStack itemstack = par1EntityLiving.getHeldItem();
  168.  
  169.                 if (itemstack != null)
  170.                 {
  171.                         GL11.glPushMatrix();
  172.                         modelBipedMain.bipedRightArm.postRender(0.0625F);
  173.                         GL11.glTranslatef(-0.0625F, 0.4375F, 0.0625F);
  174.  
  175.                         if (itemstack.itemID < 256 && RenderBlocks.renderItemIn3d(Block.blocksList[itemstack.itemID].getRenderType()))
  176.                         {
  177.                                 float f = 0.5F;
  178.                                 GL11.glTranslatef(0.0F, 0.1875F, -0.3125F);
  179.                                 f *= 0.75F;
  180.                                 GL11.glRotatef(20F, 1.0F, 0.0F, 0.0F);
  181.                                 GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
  182.                                 GL11.glScalef(f, -f, f);
  183.                         }
  184.                         else if (itemstack.itemID == Item.bow.shiftedIndex)
  185.                         {
  186.                                 float f1 = 0.625F;
  187.                                 GL11.glTranslatef(0.0F, 0.125F, 0.3125F);
  188.                                 GL11.glRotatef(-20F, 0.0F, 1.0F, 0.0F);
  189.                                 GL11.glScalef(f1, -f1, f1);
  190.                                 GL11.glRotatef(-100F, 1.0F, 0.0F, 0.0F);
  191.                                 GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
  192.                         }
  193.                         else if (Item.itemsList[itemstack.itemID].isFull3D())
  194.                         {
  195.                                 float f2 = 0.625F;
  196.                                 GL11.glTranslatef(0.0F, 0.1875F, 0.0F);
  197.                                 GL11.glScalef(f2, -f2, f2);
  198.                                 GL11.glRotatef(-100F, 1.0F, 0.0F, 0.0F);
  199.                                 GL11.glRotatef(45F, 0.0F, 1.0F, 0.0F);
  200.                         }
  201.                         else
  202.                         {
  203.                                 float f3 = 0.375F;
  204.                                 GL11.glTranslatef(0.25F, 0.1875F, -0.1875F);
  205.                                 GL11.glScalef(f3, f3, f3);
  206.                                 GL11.glRotatef(60F, 0.0F, 0.0F, 1.0F);
  207.                                 GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
  208.                                 GL11.glRotatef(20F, 0.0F, 0.0F, 1.0F);
  209.                         }
  210.  
  211.                         renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 0);
  212.  
  213.                         if (itemstack.getItem().func_46058_c())
  214.                         {
  215.                                 renderManager.itemRenderer.renderItem(par1EntityLiving, itemstack, 1);
  216.                         }
  217.  
  218.                         GL11.glPopMatrix();
  219.                        
  220.                 }
  221.         }
  222. }