You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			149 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			Java
		
	
			
		
		
	
	
			149 lines
		
	
	
		
			4.6 KiB
		
	
	
	
		
			Java
		
	
package net.minecraft.entity.projectile;
 | 
						|
 | 
						|
import cpw.mods.fml.relauncher.Side;
 | 
						|
import cpw.mods.fml.relauncher.SideOnly;
 | 
						|
import net.minecraft.block.Block;
 | 
						|
import net.minecraft.entity.EntityLivingBase;
 | 
						|
import net.minecraft.init.Blocks;
 | 
						|
import net.minecraft.potion.Potion;
 | 
						|
import net.minecraft.potion.PotionEffect;
 | 
						|
import net.minecraft.util.DamageSource;
 | 
						|
import net.minecraft.util.MovingObjectPosition;
 | 
						|
import net.minecraft.world.EnumDifficulty;
 | 
						|
import net.minecraft.world.Explosion;
 | 
						|
import net.minecraft.world.World;
 | 
						|
 | 
						|
public class EntityWitherSkull extends EntityFireball
 | 
						|
{
 | 
						|
    private static final String __OBFID = "CL_00001728";
 | 
						|
 | 
						|
    public EntityWitherSkull(World p_i1793_1_)
 | 
						|
    {
 | 
						|
        super(p_i1793_1_);
 | 
						|
        this.setSize(0.3125F, 0.3125F);
 | 
						|
    }
 | 
						|
 | 
						|
    public EntityWitherSkull(World p_i1794_1_, EntityLivingBase p_i1794_2_, double p_i1794_3_, double p_i1794_5_, double p_i1794_7_)
 | 
						|
    {
 | 
						|
        super(p_i1794_1_, p_i1794_2_, p_i1794_3_, p_i1794_5_, p_i1794_7_);
 | 
						|
        this.setSize(0.3125F, 0.3125F);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Return the motion factor for this projectile. The factor is multiplied by the original motion.
 | 
						|
     */
 | 
						|
    protected float getMotionFactor()
 | 
						|
    {
 | 
						|
        return this.isInvulnerable() ? 0.73F : super.getMotionFactor();
 | 
						|
    }
 | 
						|
 | 
						|
    @SideOnly(Side.CLIENT)
 | 
						|
    public EntityWitherSkull(World p_i1795_1_, double p_i1795_2_, double p_i1795_4_, double p_i1795_6_, double p_i1795_8_, double p_i1795_10_, double p_i1795_12_)
 | 
						|
    {
 | 
						|
        super(p_i1795_1_, p_i1795_2_, p_i1795_4_, p_i1795_6_, p_i1795_8_, p_i1795_10_, p_i1795_12_);
 | 
						|
        this.setSize(0.3125F, 0.3125F);
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Returns true if the entity is on fire. Used by render to add the fire effect on rendering.
 | 
						|
     */
 | 
						|
    public boolean isBurning()
 | 
						|
    {
 | 
						|
        return false;
 | 
						|
    }
 | 
						|
 | 
						|
    public float func_145772_a(Explosion explosionIn, World worldIn, int x, int y, int z, Block blockIn)
 | 
						|
    {
 | 
						|
        float f = super.func_145772_a(explosionIn, worldIn, x, y, z, blockIn);
 | 
						|
 | 
						|
        if (this.isInvulnerable() && blockIn != Blocks.bedrock && blockIn != Blocks.end_portal && blockIn != Blocks.end_portal_frame && blockIn != Blocks.command_block)
 | 
						|
        {
 | 
						|
            f = Math.min(0.8F, f);
 | 
						|
        }
 | 
						|
 | 
						|
        return f;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Called when this EntityFireball hits a block or entity.
 | 
						|
     */
 | 
						|
    protected void onImpact(MovingObjectPosition p_70227_1_)
 | 
						|
    {
 | 
						|
        if (!this.worldObj.isRemote)
 | 
						|
        {
 | 
						|
            if (p_70227_1_.entityHit != null)
 | 
						|
            {
 | 
						|
                if (this.shootingEntity != null)
 | 
						|
                {
 | 
						|
                    if (p_70227_1_.entityHit.attackEntityFrom(DamageSource.causeMobDamage(this.shootingEntity), 8.0F) && !p_70227_1_.entityHit.isEntityAlive())
 | 
						|
                    {
 | 
						|
                        this.shootingEntity.heal(5.0F);
 | 
						|
                    }
 | 
						|
                }
 | 
						|
                else
 | 
						|
                {
 | 
						|
                    p_70227_1_.entityHit.attackEntityFrom(DamageSource.magic, 5.0F);
 | 
						|
                }
 | 
						|
 | 
						|
                if (p_70227_1_.entityHit instanceof EntityLivingBase)
 | 
						|
                {
 | 
						|
                    byte b0 = 0;
 | 
						|
 | 
						|
                    if (this.worldObj.difficultySetting == EnumDifficulty.NORMAL)
 | 
						|
                    {
 | 
						|
                        b0 = 10;
 | 
						|
                    }
 | 
						|
                    else if (this.worldObj.difficultySetting == EnumDifficulty.HARD)
 | 
						|
                    {
 | 
						|
                        b0 = 40;
 | 
						|
                    }
 | 
						|
 | 
						|
                    if (b0 > 0)
 | 
						|
                    {
 | 
						|
                        ((EntityLivingBase)p_70227_1_.entityHit).addPotionEffect(new PotionEffect(Potion.wither.id, 20 * b0, 1));
 | 
						|
                    }
 | 
						|
                }
 | 
						|
            }
 | 
						|
 | 
						|
            this.worldObj.newExplosion(this, this.posX, this.posY, this.posZ, 1.0F, false, this.worldObj.getGameRules().getGameRuleBooleanValue("mobGriefing"));
 | 
						|
            this.setDead();
 | 
						|
        }
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Returns true if other Entities should be prevented from moving through this Entity.
 | 
						|
     */
 | 
						|
    public boolean canBeCollidedWith()
 | 
						|
    {
 | 
						|
        return false;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Called when the entity is attacked.
 | 
						|
     */
 | 
						|
    public boolean attackEntityFrom(DamageSource source, float amount)
 | 
						|
    {
 | 
						|
        return false;
 | 
						|
    }
 | 
						|
 | 
						|
    protected void entityInit()
 | 
						|
    {
 | 
						|
        this.dataWatcher.addObject(10, Byte.valueOf((byte)0));
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Return whether this skull comes from an invulnerable (aura) wither boss.
 | 
						|
     */
 | 
						|
    public boolean isInvulnerable()
 | 
						|
    {
 | 
						|
        return this.dataWatcher.getWatchableObjectByte(10) == 1;
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Set whether this skull comes from an invulnerable (aura) wither boss.
 | 
						|
     */
 | 
						|
    public void setInvulnerable(boolean p_82343_1_)
 | 
						|
    {
 | 
						|
        this.dataWatcher.updateObject(10, Byte.valueOf((byte)(p_82343_1_ ? 1 : 0)));
 | 
						|
    }
 | 
						|
} |