tterrag1098

Untitled

Mar 7th, 2014
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.07 KB | None | 0 0
  1. public class EntityStarHeart extends EntityItem {
  2.    
  3.     public EntityStarHeart(World world, double posX, double posY, double posZ,
  4.             ItemStack itemstack) {
  5.         super(world, posX, posY, posZ, itemstack);
  6.         this.isImmuneToFire = true;
  7.         this.delayBeforeCanPickup = 40;
  8.     }
  9.  
  10.     @Override
  11.     public void onUpdate() {
  12.         super.onUpdate();
  13.        
  14.         if (this.isBurning())
  15.         {
  16.             //changeToStar();
  17.         }
  18.     }
  19.  
  20.     private void changeToStar() {
  21.         ItemStack star = new ItemStack(SuperMassiveTech.itemRegistry.star, this.getEntityItem().stackSize);
  22.        
  23.         // Sets the type of the star to a random type
  24.         Utils.setType(star, StarType.values()[new Random().nextInt(StarType.values().length)]);
  25.        
  26.         worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY, posZ));
  27.         this.setDead();
  28.     }
  29.    
  30.     @Override
  31.     public boolean isEntityInvulnerable() {
  32.         return true;
  33.     }
  34.    
  35.     @Override
  36.     public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
  37.     {
  38.         if (par1DamageSource.isFireDamage())
  39.             return false;
  40.        
  41.         else
  42.             return super.attackEntityFrom(par1DamageSource, par2);
  43.     }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment