Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class EntityStarHeart extends EntityItem {
- public EntityStarHeart(World world, double posX, double posY, double posZ,
- ItemStack itemstack) {
- super(world, posX, posY, posZ, itemstack);
- this.isImmuneToFire = true;
- this.delayBeforeCanPickup = 40;
- }
- @Override
- public void onUpdate() {
- super.onUpdate();
- if (this.isBurning())
- {
- //changeToStar();
- }
- }
- private void changeToStar() {
- ItemStack star = new ItemStack(SuperMassiveTech.itemRegistry.star, this.getEntityItem().stackSize);
- // Sets the type of the star to a random type
- Utils.setType(star, StarType.values()[new Random().nextInt(StarType.values().length)]);
- worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY, posZ));
- this.setDead();
- }
- @Override
- public boolean isEntityInvulnerable() {
- return true;
- }
- @Override
- public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
- {
- if (par1DamageSource.isFireDamage())
- return false;
- else
- return super.attackEntityFrom(par1DamageSource, par2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment