Advertisement
drackiseries

A New Slime

Jun 24th, 2012
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5.09 KB | None | 0 0
  1. ENTITYREDSLIME CODE:
  2.  
  3.  
  4. package net.minecraft.src;
  5.  
  6. import java.util.List;
  7. import java.util.Random;
  8.  
  9. public class EntityRedSlime extends EntitySlime
  10. {
  11.     public EntityRedSlime(World par1World)
  12.     {
  13.         super(par1World);
  14.         texture = "/mob/redslime.png";
  15.         isImmuneToFire = false;
  16.         landMovementFactor = 0.8F;
  17.     }
  18.  
  19.     /**
  20.      * Checks if the entity's current position is a valid location to spawn this entity.
  21.      */
  22.     public boolean getCanSpawnHere()
  23.     {
  24.         return worldObj.difficultySetting > 0 && worldObj.checkIfAABBIsClear(boundingBox) && worldObj.getCollidingBoundingBoxes(this, boundingBox).size() == 0 && !worldObj.isAnyLiquid(boundingBox);
  25.     }
  26.  
  27.     /**
  28.      * Returns the current armor value as determined by a call to InventoryPlayer.getTotalArmorValue
  29.      */
  30.     public int getTotalArmorValue()
  31.     {
  32.         return getSlimeSize() * 3;
  33.     }
  34.  
  35.     public int getBrightnessForRender(float par1)
  36.     {
  37.         return 0xf000f0;
  38.     }
  39.  
  40.     /**
  41.      * Gets how bright this entity is.
  42.      */
  43.     public float getBrightness(float par1)
  44.     {
  45.         return 1.0F;
  46.     }
  47.  
  48.     protected EntitySlime createInstance()
  49.     {
  50.         return new EntityRedSlime(worldObj);
  51.     }
  52.  
  53.     /**
  54.      * Returns the item ID for the item the mob drops on death.
  55.      */
  56.     protected int getDropItemId()
  57.     {
  58.         return mod_tutorial.RedSlimeBall.shiftedIndex;
  59.     }
  60.  
  61.     /**
  62.      * Drop 0-2 items of this living's type
  63.      */
  64.     protected void dropFewItems(boolean par1, int par2)
  65.     {
  66.         int i = getDropItemId();
  67.  
  68.         if (i > 0 && getSlimeSize() > 1)
  69.         {
  70.             int j = rand.nextInt(4) - 2;
  71.  
  72.             if (par2 > 0)
  73.             {
  74.                 j += rand.nextInt(par2 + 1);
  75.             }
  76.  
  77.             for (int k = 0; k < j; k++)
  78.             {
  79.                 dropItem(i, 1);
  80.             }
  81.         }
  82.     }
  83.  
  84.     /**
  85.      * Returns true if the entity is on fire. Used by render to add the fire effect on rendering.
  86.      */
  87.     public boolean isBurning()
  88.     {
  89.         return false;
  90.     }
  91.  
  92.     protected int func_40131_af()
  93.     {
  94.         return super.func_40131_af() * 4;
  95.     }
  96.  
  97.     protected void func_40136_ag()
  98.     {
  99.         field_40139_a = field_40139_a * 0.9F;
  100.     }
  101.  
  102.     /**
  103.      * jump, Causes this entity to do an upwards motion (jumping)
  104.      */
  105.     protected void jump()
  106.     {
  107.         motionY = 0.42F + (float)getSlimeSize() * 0.1F;
  108.         isAirBorne = true;
  109.     }
  110.  
  111.     /**
  112.      * Called when the mob is falling. Calculates and applies fall damage.
  113.      */
  114.     protected void fall(float f)
  115.     {
  116.     }
  117.  
  118.     protected boolean func_40137_ah()
  119.     {
  120.         return true;
  121.     }
  122.  
  123.     protected int func_40130_ai()
  124.     {
  125.         return super.func_40130_ai() + 2;
  126.     }
  127.  
  128.     /**
  129.      * Returns the sound this mob makes when it is hurt.
  130.      */
  131.     protected String getHurtSound()
  132.     {
  133.         return "mob.slime";
  134.     }
  135.  
  136.     /**
  137.      * Returns the sound this mob makes on death.
  138.      */
  139.     protected String getDeathSound()
  140.     {
  141.         return "mob.slime";
  142.     }
  143.  
  144.     protected String func_40138_aj()
  145.     {
  146.         if (getSlimeSize() > 1)
  147.         {
  148.             return "mob.magmacube.big";
  149.         }
  150.         else
  151.         {
  152.             return "mob.magmacube.small";
  153.         }
  154.     }
  155.  
  156.     /**
  157.      * Whether or not the current entity is in lava
  158.      */
  159.     public boolean handleLavaMovement()
  160.     {
  161.         return false;
  162.     }
  163.  
  164.     protected boolean func_40134_ak()
  165.     {
  166.         return true;
  167.     }
  168. }
  169.  
  170.  
  171. SPAWNING OF RED SLIME IN SWAMP BIOME:
  172.  
  173.  
  174. package net.minecraft.src;
  175.  
  176. import java.util.Random;
  177.  
  178. public class BiomeGenSwamp extends BiomeGenBase
  179. {
  180.     protected BiomeGenSwamp(int par1)
  181.     {
  182.         super(par1);
  183.         biomeDecorator.treesPerChunk = 2;
  184.         biomeDecorator.flowersPerChunk = -999;
  185.         biomeDecorator.deadBushPerChunk = 1;
  186.         biomeDecorator.mushroomsPerChunk = 8;
  187.         biomeDecorator.reedsPerChunk = 10;
  188.         biomeDecorator.clayPerChunk = 1;
  189.         biomeDecorator.waterlilyPerChunk = 4;
  190.         waterColorMultiplier = 0xe0ffae;
  191.         spawnableMonsterList.clear();
  192.         spawnableMonsterList.add(new SpawnListEntry(net.minecraft.src.EntityRedSlime.class, 15, 1, 5));
  193.        
  194.     }
  195.  
  196.     /**
  197.      * Gets a WorldGen appropriate for this biome.
  198.      */
  199.     public WorldGenerator getRandomWorldGenForTrees(Random par1Random)
  200.     {
  201.         return worldGenSwamp;
  202.     }
  203.  
  204.     /**
  205.      * Provides the basic grass color based on the biome temperature and rainfall
  206.      */
  207.     public int getBiomeGrassColor()
  208.     {
  209.         double d = getFloatTemperature();
  210.         double d1 = getFloatRainfall();
  211.         return ((ColorizerGrass.getGrassColor(d, d1) & 0xfefefe) + 0x4e0e4e) / 2;
  212.     }
  213.  
  214.     /**
  215.      * Provides the basic foliage color based on the biome temperature and rainfall
  216.      */
  217.     public int getBiomeFoliageColor()
  218.     {
  219.         double d = getFloatTemperature();
  220.         double d1 = getFloatRainfall();
  221.         return ((ColorizerFoliage.getFoliageColor(d, d1) & 0xfefefe) + 0x4e0e4e) / 2;
  222.     }
  223. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement