Java Code Examples for net.minecraft.entity.monster.EntityCreeper

The following are top voted examples for showing how to use net.minecraft.entity.monster.EntityCreeper. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: DecompiledMinecraft   File: EntityWolf.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityWolf)
        {
            EntityWolf entitywolf = (EntityWolf)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 2
Project: DecompiledMinecraft   File: EntityWolf.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityWolf)
        {
            EntityWolf entitywolf = (EntityWolf)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 3
Project: DecompiledMinecraft   File: RenderCreeper.java   View source code 6 votes vote down vote up
/**
 * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime
 */
protected int getColorMultiplier(EntityCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime)
{
    float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);

    if ((int)(f * 10.0F) % 2 == 0)
    {
        return 0;
    }
    else
    {
        int i = (int)(f * 0.2F * 255.0F);
        i = MathHelper.clamp_int(i, 0, 255);
        return i << 24 | 16777215;
    }
}
 
Example 4
Project: DecompiledMinecraft   File: EntityRenderer.java   View source code 6 votes vote down vote up
/**
 * What shader to use when spectating this entity
 */
public void loadEntityShader(Entity entityIn)
{
    if (OpenGlHelper.shadersSupported)
    {
        if (this.theShaderGroup != null)
        {
            this.theShaderGroup.deleteShaderGroup();
        }

        this.theShaderGroup = null;

        if (entityIn instanceof EntityCreeper)
        {
            this.loadShader(new ResourceLocation("shaders/post/creeper.json"));
        }
        else if (entityIn instanceof EntitySpider)
        {
            this.loadShader(new ResourceLocation("shaders/post/spider.json"));
        }
        else if (entityIn instanceof EntityEnderman)
        {
            this.loadShader(new ResourceLocation("shaders/post/invert.json"));
        }
    }
}
 
Example 5
Project: BaseClient   File: EntityWolf.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityWolf)
        {
            EntityWolf entitywolf = (EntityWolf)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 6
Project: BaseClient   File: RenderCreeper.java   View source code 6 votes vote down vote up
/**
 * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime
 */
protected int getColorMultiplier(EntityCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime)
{
    float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);

    if ((int)(f * 10.0F) % 2 == 0)
    {
        return 0;
    }
    else
    {
        int i = (int)(f * 0.2F * 255.0F);
        i = MathHelper.clamp_int(i, 0, 255);
        return i << 24 | 16777215;
    }
}
 
Example 7
Project: BaseClient   File: EntityWolf.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityWolf)
        {
            EntityWolf entitywolf = (EntityWolf)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 8
Project: BaseClient   File: RenderCreeper.java   View source code 6 votes vote down vote up
/**
 * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime
 */
protected int getColorMultiplier(EntityCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime)
{
    float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);

    if ((int)(f * 10.0F) % 2 == 0)
    {
        return 0;
    }
    else
    {
        int i = (int)(f * 0.2F * 255.0F);
        i = MathHelper.clamp_int(i, 0, 255);
        return i << 24 | 16777215;
    }
}
 
Example 9
Project: BaseClient   File: EntityRenderer.java   View source code 6 votes vote down vote up
/**
 * What shader to use when spectating this entity
 */
public void loadEntityShader(Entity entityIn) {
	if (OpenGlHelper.shadersSupported) {
		if (this.theShaderGroup != null) {
			this.theShaderGroup.deleteShaderGroup();
		}

		this.theShaderGroup = null;

		if (entityIn instanceof EntityCreeper) {
			this.loadShader(new ResourceLocation("shaders/post/creeper.json"));
		} else if (entityIn instanceof EntitySpider) {
			this.loadShader(new ResourceLocation("shaders/post/spider.json"));
		} else if (entityIn instanceof EntityEnderman) {
			this.loadShader(new ResourceLocation("shaders/post/invert.json"));
		}
	}
}
 
Example 10
Project: Halloween   File: ModEntities.java   View source code 6 votes vote down vote up
/**
 * Add spawning rules for the living mobs we want to be able to spawn naturally.
 */
public static void addEntitySpawns()
{
	// get the list of biomes that creepers can spawn in, we'll use the same biomes for all of our mobs
	Biome[] biomes = getBiomeList(EntityCreeper.class, EnumCreatureType.MONSTER);

	// add the spawn rules to the entity registry
	EntityRegistry.addSpawn(EntityJumpkin.class, 100, 4, 4, EnumCreatureType.MONSTER, biomes);
	EntityRegistry.addSpawn(EntityZombieHands.class, 100, 4, 4, EnumCreatureType.MONSTER, biomes);
	EntityRegistry.addSpawn(EntityHallowitch.class, 75, 4, 4, EnumCreatureType.MONSTER, biomes);
	EntityRegistry.addSpawn(EntityCreeperween.class, 75, 4, 4, EnumCreatureType.MONSTER, biomes);
	EntityRegistry.addSpawn(EntityHaunter.class, 5, 1, 1, EnumCreatureType.MONSTER, biomes);
	EntityRegistry.addSpawn(EntityTreater.class, 50, 4, 4, EnumCreatureType.MONSTER, biomes);
}
 
Example 11
Project: EndermanEvolution   File: EntityFrienderman.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) {
	if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) {
		if (p_142018_1_ instanceof EntityFrienderman) {
			EntityFrienderman frienderman = (EntityFrienderman) p_142018_1_;

			if (frienderman.isTamed() && frienderman.getOwner() == p_142018_2_) {
				return false;
			}
		}

		return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame();
	}
	else {
		return false;
	}
}
 
Example 12
Project: uniquecrops   File: ItemGeneric.java   View source code 6 votes vote down vote up
@Override
   public void onUpdate(ItemStack stack, World world, Entity entity, int itemSlot, boolean isSelected) {
	
	if (stack.getItemDamage() != 20)
		return;
	
	if (!(entity instanceof EntityPlayer) || (entity instanceof FakePlayer))
		return;
	
	if (itemSlot < ((EntityPlayer)entity).inventory.getHotbarSize()) {
		List<EntityLiving> entities = entity.worldObj.getEntitiesWithinAABB(EntityLiving.class, new AxisAlignedBB(entity.getPosition().add(-range, -range, -range), entity.getPosition().add(range, range, range)));
		
		for (EntityLiving ent : entities) {
			List<EntityAITaskEntry> entries = new ArrayList(ent.tasks.taskEntries);
			entries.addAll(new ArrayList(ent.targetTasks.taskEntries));
			
			for (EntityAITaskEntry entry : entries) {
				if (entry.action instanceof EntityAIAttackRangedBow) {
					makeSkellyShootSlower((EntityAIAttackRangedBow)entry.action);
				}
			}
			if (ent instanceof EntityCreeper)
				ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper)ent, 60, this.FUSETIME);
		}
	}
}
 
Example 13
Project: Backmemed   File: EntityWolf.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityWolf)
        {
            EntityWolf entitywolf = (EntityWolf)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof AbstractHorse) || !((AbstractHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 14
Project: Backmemed   File: RenderCreeper.java   View source code 6 votes vote down vote up
/**
 * Gets an RGBA int color multiplier to apply.
 */
protected int getColorMultiplier(EntityCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime)
{
    float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);

    if ((int)(f * 10.0F) % 2 == 0)
    {
        return 0;
    }
    else
    {
        int i = (int)(f * 0.2F * 255.0F);
        i = MathHelper.clamp(i, 0, 255);
        return i << 24 | 822083583;
    }
}
 
Example 15
Project: CustomWorldGen   File: EntityWolf.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityWolf)
        {
            EntityWolf entitywolf = (EntityWolf)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 16
Project: CustomWorldGen   File: RenderCreeper.java   View source code 6 votes vote down vote up
/**
 * Gets an RGBA int color multiplier to apply.
 */
protected int getColorMultiplier(EntityCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime)
{
    float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);

    if ((int)(f * 10.0F) % 2 == 0)
    {
        return 0;
    }
    else
    {
        int i = (int)(f * 0.2F * 255.0F);
        i = MathHelper.clamp_int(i, 0, 255);
        return i << 24 | 822083583;
    }
}
 
Example 17
Project: BetterWithAddons   File: EffectElectrified.java   View source code 6 votes vote down vote up
@Override
public void performEffect(EntityLivingBase entity, int level) {
    if(entity instanceof EntityCreeper)
    {
        //spawn firefly particles
        return;
    }

        if (entity instanceof EntityPlayer) {
            entity.resetActiveHand();
        }
        entity.attackEntityFrom(DamageSource.LIGHTNING_BOLT, 0.1f);
        entity.heal(0.1f);
        entity.motionX = 0;
        entity.motionY = 0;
        entity.motionZ = 0;
}
 
Example 18
Project: Overlord   File: EntityAINearestNonTeamTarget.java   View source code 6 votes vote down vote up
@Override
public int compare(Entity p_compare_1_, Entity p_compare_2_) {
	double compareDistance1 = this.theEntity.getDistanceSqToEntity(p_compare_1_);
	double compareDistance2 = this.theEntity.getDistanceSqToEntity(p_compare_2_);
	boolean b0 = false;
	boolean b1i = true;
	if (!ConfigValues.HUNTCREEPERS && p_compare_1_ instanceof EntityCreeper)
		b0 = true;
	if (!ConfigValues.HUNTCREEPERS && p_compare_2_ instanceof EntityCreeper)
		b1i = false;
	if (!b0 && b1i) {
		return Double.compare(compareDistance1, compareDistance2);
	} else if (b0 && b1i) {
		return 1;
	} else if (!b0) {
		return -1;
	} else {
		return 0;
	}
}
 
Example 19
Project: Overlord   File: EntityArmyMember.java   View source code 6 votes vote down vote up
/**
 * Register your movement tasks here.
 */
public void addMovementTasks() {
	switch (dataManager.get(MOVEMENT_MODE)) {
		case 1:
			if (!ConfigValues.HUNTCREEPERS)
				this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityCreeper.class, 10.0F, 1.2D, 1.6D));
			this.tasks.addTask(4, new EntityAIOpenDoor(this, getAttackMode() != 2));
			this.tasks.addTask(6, new EntityAIFollowMaster(this, 1.0D, 10.0F, 2.0F));
		case 0:
			this.detachHome();
			break;
		case 2:
		default:
			this.setHomePosAndDistance(new BlockPos(this.posX, this.posY, this.posZ), 20);
			this.tasks.addTask(2, new EntityAIRestrictSun(this));
			this.tasks.addTask(3, new EntityAIFleeSun(this, 1.0D));
			if (!ConfigValues.HUNTCREEPERS)
				this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityCreeper.class, 10.0F, 1.2D, 1.6D));
			this.tasks.addTask(4, new EntityAIOpenDoor(this, getAttackMode() != 2));
			this.tasks.addTask(7, new EntityAIWanderBase(this, 1.0D));
	}
}
 
Example 20
Project: Overlord   File: EntityArmyMember.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase target){
	EntityLivingBase owner = getOwner();
	if (ConfigValues.HUNTCREEPERS || !(target instanceof EntityCreeper)) {
		if (target instanceof EntityWolf) {
			EntityWolf entitywolf = (EntityWolf) target;

			if (entitywolf.isTamed() && entitywolf.getOwner() == owner || Alliances.getInstance().isAlliedTo(entitywolf.getOwnerId(), getOwnerId()))
				return false;
		}

		if (target instanceof EntityArmyMember)
			if ((getAttackMode() < 2 && Enemies.getInstance().isNotEnemiesWith(((EntityArmyMember) target).getOwnerId(), getOwnerId())) || ((EntityArmyMember) target).getOwnerId().equals(getOwnerId()) || Alliances.getInstance().isAlliedTo(((EntityArmyMember) target).getOwnerId(), getOwnerId()))
				return false;

		return !(target instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) target)) && (!(target instanceof EntityHorse) || !((EntityHorse) target).isTame());
	} else
		return false;
}
 
Example 21
Project: Overlord   File: EntityBabySkeleton.java   View source code 6 votes vote down vote up
@Override
public void onDeath(@Nonnull DamageSource cause) {
	super.onDeath(cause);

	Entity damageCause = cause.getTrueSource();
	if (damageCause instanceof EntityCreeper && ((EntityCreeper) damageCause).getPowered() && !((EntityCreeper) damageCause).isAIDisabled()) {
		((EntityCreeper) damageCause).incrementDroppedSkulls();
		this.entityDropItem(new ItemStack(Items.SKULL), 0.0F);
	}

	if (!this.world.isRemote) {
		for (int i = 0; i < equipInventory.getSizeInventory(); i++) {
			if (!equipInventory.getStackInSlot(i).isEmpty()) {
				EntityItem entityitem = new EntityItem(world, posX, posY, posZ, equipInventory.getStackInSlot(i));
				entityitem.setDefaultPickupDelay();
				world.spawnEntity(entityitem);
			}
		}
	}
}
 
Example 22
Project: 4Space-5   File: EntitySlimeling.java   View source code 6 votes vote down vote up
@Override
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
{
    if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
    {
        if (par1EntityLivingBase instanceof EntitySlimeling)
        {
            EntitySlimeling slimeling = (EntitySlimeling) par1EntityLivingBase;

            if (slimeling.isTamed() && slimeling.getOwner() == par2EntityLivingBase)
            {
                return false;
            }
        }

        return !(par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase)) && (!(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame());
    }
    else
    {
        return false;
    }
}
 
Example 23
Project: 4Space-5   File: RenderEvolvedCreeper.java   View source code 6 votes vote down vote up
protected void updateCreeperScale(EntityCreeper par1GCEntityCreeper, float par2)
{
    float var4 = par1GCEntityCreeper.getCreeperFlashIntensity(par2);
    final float var5 = 1.0F + MathHelper.sin(var4 * 100.0F) * var4 * 0.01F;

    if (var4 < 0.0F)
    {
        var4 = 0.0F;
    }

    if (var4 > 1.0F)
    {
        var4 = 1.0F;
    }

    var4 *= var4;
    var4 *= var4;
    final float var6 = (1.0F + var4 * 0.4F) * var5;
    final float var7 = (1.0F + var4 * 0.1F) / var5;
    GL11.glScalef(0.2F + var6, 0.2F + var7, 0.2F + var6);
}
 
Example 24
Project: CrystalMod   File: MinionAICombat.java   View source code 6 votes vote down vote up
public boolean isEntityValidToAttack(EntityMinionWarrior minion, EntityLivingBase entity)
{
	if(entity == minion || entity == minion.getRidingEntity() || !EntityAITarget.isSuitableTarget(minion, entity, false, false) || entity.getClass() == EntityCreeper.class) return false;
	
	if (entity instanceof EntityMob &&
			(getTargetBehavior() == EnumCombatBehaviors.TARGET_HOSTILE_MOBS || 
			getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
	{
		return true;
	}

	else if (entity instanceof EntityAnimal &&
			(getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_MOBS || 
			getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
	{
		return true;
	}

	else
	{
		return false;
	}
}
 
Example 25
Project: MidgarCrusade   File: EntitySlave.java   View source code 6 votes vote down vote up
public EntitySlave(World p_i1688_1_)
{
    super(p_i1688_1_);
    this.setSize(0.8F, 1.6F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, this.aiTempt = new EntityAITempt(this, 0.6D, Items.diamond, true));
    this.tasks.addTask(4, new EntityAIFollowOwner(this, 1.0D, 10.0F, 5.0F));
    this.tasks.addTask(5, new EntityAIAvoidEntity(this, EntityCreeper.class, 16.0F, 0.8D, 1.33D));
    this.tasks.addTask(6, new EntityAILeapAtTarget(this, 0.3F));
    this.tasks.addTask(7, new EntityAIOcelotAttack(this));
    this.tasks.addTask(8, new EntityAIMate(this, 0.8D));
    this.tasks.addTask(9, new EntityAIWander(this, 0.8D));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.targetTasks.addTask(1, new EntityAITargetNonTamed(this, EntityMob.class, 750, false));
    this.setType(this.rand.nextInt(4));
    this.setRandomStuff();
}
 
Example 26
Project: ChameleonCreepersMod   File: RenderChameleonCreeper.java   View source code 6 votes vote down vote up
/**
 * Returns an ARGB int color back. Args: entityLiving, lightBrightness, partialTickTime
 */
protected int getColorMultiplier(EntityCreeper entitylivingbaseIn, float lightBrightness, float partialTickTime)
{
    float f = entitylivingbaseIn.getCreeperFlashIntensity(partialTickTime);

    if ((int)(f * 10.0F) % 2 == 0)
    {
        return 0;
    }
    else
    {
        int i = (int)(f * 0.2F * 255.0F);
        i = MathHelper.clamp(i, 0, 255);
        return i << 24 | 16777215;
    }
}
 
Example 27
Project: ToroQuest   File: EntityGuard.java   View source code 6 votes vote down vote up
protected void initEntityAI() {
	areaAI = new EntityAIMoveIntoArea(this, 0.5D, 30);
	tasks.addTask(0, new EntityAISwimming(this));
	tasks.addTask(2, new EntityAIAttackMelee(this, 0.6D, false));
	tasks.addTask(4, areaAI);
	tasks.addTask(7, new EntityAIWander(this, 0.35D));
	tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
	tasks.addTask(8, new EntityAILookIdle(this));

	targetTasks.addTask(2, new EntityAINearestAttackableCivTarget(this));
	targetTasks.addTask(3, new EntityAINearestAttackableTarget<EntityMob>(this, EntityMob.class, 10, false, false, new Predicate<EntityMob>() {
		@Override
		public boolean apply(EntityMob target) {
			return !(target instanceof EntityCreeper);
		}
	}));
}
 
Example 28
Project: Gravestone-mod-Extended   File: GSEventsHandler.java   View source code 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGH)
public void onEntityLivingDeath(LivingDeathEvent event) {
    if (FMLCommonHandler.instance().getEffectiveSide().isServer()) {
        if (ExtendedConfig.spawnSkullCrawlersAtMobsDeath) {
            if (event.getEntity() instanceof AbstractSkeleton) {
                EntitySkullCrawler crawler;
                if (MobSpawn.isWitherSkeleton((AbstractSkeleton) event.getEntity())) {
                    crawler = new EntityWitherSkullCrawler(event.getEntity().getEntityWorld());
                } else if (MobSpawn.isStraySkeleton((AbstractSkeleton) event.getEntity())) {
                    crawler = new EntityStraySkullCrawler(event.getEntity().getEntityWorld());
                } else {
                    crawler = new EntitySkullCrawler(event.getEntity().getEntityWorld());
                }
                MobSpawn.spawnCrawler(event.getEntity(), crawler);
            } else if (event.getEntity() instanceof EntityZombie) {
                MobSpawn.spawnCrawler(event.getEntity(), new EntityZombieSkullCrawler(event.getEntity().getEntityWorld()));
            }
        }
        if (event.getEntity() instanceof EntityCreeper && ((EntityCreeper) event.getEntity()).getPowered()) {
            // drop creeper statue if entity is a charged creeper
            GSBlock.MEMORIAL.dropCreeperMemorial(event.getEntity().getEntityWorld(), new BlockPos(event.getEntity()));
        }
    }
}
 
Example 29
Project: Minecraft-Flux   File: EntityActionEnergy.java   View source code 6 votes vote down vote up
@Override
public long inputEnergy(long amount, boolean simulate) {
	if (!simulate && !charged) {
		if (creature instanceof EntityPig) {
			final EntityPigZombie pigman = new EntityPigZombie(creature.world);
			pigman.setItemStackToSlot(EntityEquipmentSlot.MAINHAND, new ItemStack(Items.GOLDEN_AXE));
			pigman.setLocationAndAngles(creature.posX, creature.posY, creature.posZ, creature.rotationYaw, creature.rotationPitch);
			pigman.setNoAI(creature.isAIDisabled());
			if (creature.hasCustomName()) {
				pigman.setCustomNameTag(creature.getCustomNameTag());
				pigman.setAlwaysRenderNameTag(creature.getAlwaysRenderNameTag());
			}
			creature.world.spawnEntity(pigman);
			creature.setDead();
		} else if (creature instanceof EntityCreeper)
			creature.onStruckByLightning(null);
		charged = true;
		return 1;
	}
	return charged ? 0 : 1;
}
 
Example 30
Project: demomod   File: DemoEntityTameable.java   View source code 6 votes vote down vote up
@Override
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) {
	if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) {
		if (p_142018_1_ instanceof DemoEntityTameable) {
			DemoEntityTameable demoEntityTameable = (DemoEntityTameable) p_142018_1_;

			if (demoEntityTameable.isTamed() && demoEntityTameable.getOwnerEntity() == p_142018_2_) {
				return false;
			}
		}

		return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer
				&& !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false
						: !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame();
	} else {
		return false;
	}
}
 
Example 31
Project: It-s-About-Time-Minecraft-Mod   File: EntityIatWolf.java   View source code 6 votes vote down vote up
public boolean canTargetCreature(EntityLivingBase targetMob, EntityLivingBase thisMob)
{
    if (!(targetMob instanceof EntityCreeper) && !(targetMob instanceof EntityGhast))
    {
        if (targetMob instanceof EntityIatWolf)
        {
            EntityIatWolf entitywolf = (EntityIatWolf)targetMob;

            if (entitywolf.isTamed() && entitywolf.getOwner() == thisMob)
            {
                return false;
            }
        }

        return targetMob instanceof EntityPlayer && thisMob instanceof EntityPlayer && !((EntityPlayer)thisMob).canAttackPlayer((EntityPlayer)targetMob) ? false : !(targetMob instanceof EntityHorse) || !((EntityHorse)targetMob).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 32
Project: Resilience-Client-Source   File: EntityWolf.java   View source code 6 votes vote down vote up
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
{
    if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
    {
        if (par1EntityLivingBase instanceof EntityWolf)
        {
            EntityWolf var3 = (EntityWolf)par1EntityLivingBase;

            if (var3.isTamed() && var3.getOwner() == par2EntityLivingBase)
            {
                return false;
            }
        }

        return par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer)par2EntityLivingBase).canAttackPlayer((EntityPlayer)par1EntityLivingBase) ? false : !(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse)par1EntityLivingBase).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 33
Project: Resilience-Client-Source   File: RenderCreeper.java   View source code 6 votes vote down vote up
/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime
 */
protected void preRenderCallback(EntityCreeper par1EntityCreeper, float par2)
{
    float var3 = par1EntityCreeper.getCreeperFlashIntensity(par2);
    float var4 = 1.0F + MathHelper.sin(var3 * 100.0F) * var3 * 0.01F;

    if (var3 < 0.0F)
    {
        var3 = 0.0F;
    }

    if (var3 > 1.0F)
    {
        var3 = 1.0F;
    }

    var3 *= var3;
    var3 *= var3;
    float var5 = (1.0F + var3 * 0.4F) * var4;
    float var6 = (1.0F + var3 * 0.1F) / var4;
    GL11.glScalef(var5, var6, var5);
}
 
Example 34
Project: Rediscovered-Mod-1.8.8   File: EntityRana.java   View source code 6 votes vote down vote up
public EntityRana(World par1World, int par2)
{
    super(par1World);
    randomTickDivider = 0;
    isPlayingFlag = false;
    villageObj = null;
    setProfession(par2);
    dead = false;
    ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
    tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntitySkeleton.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntitySpider.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityTNTPrimed.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityCreeper.class, 8.0F, 0.6D, 0.6D));
    tasks.addTask(5, new EntityAIMoveIndoors(this));
    tasks.addTask(6, new EntityAIRestrictOpenDoor(this));
    tasks.addTask(7, new EntityAIOpenDoor(this, true));
    tasks.addTask(8, new EntityAIMoveTowardsRestriction(this, 0.3F));
    tasks.addTask(9, new EntityAIWatchClosest2(this, net.minecraft.entity.player.EntityPlayer.class, 3F, 1.0F));
    tasks.addTask(10, new EntityAIWatchClosest2(this, net.minecraft.entity.passive.EntityVillager.class, 5F, 0.02F));
    tasks.addTask(11, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityRana.class, 5F, 0.02F));
    tasks.addTask(12, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntitySteve.class, 5F, 0.02F));
    tasks.addTask(13, new EntityAIWander(this, 0.3F));
    tasks.addTask(14, new EntityAIWatchClosest(this, net.minecraft.entity.EntityLiving.class, 8F));
}
 
Example 35
Project: CreepTech   File: EntityDeathEventHooks.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onDeathDrops(LivingDropsEvent event){
    if(event.entityLiving instanceof EntityCreeper){
        EntityItem item = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(modItems.itemCreepLeaf, 1));
        if(((EntityCreeper)event.entity).getPowered()){
            item = new EntityItem(event.entity.worldObj, event.entity.posX, event.entity.posY, event.entity.posZ, new ItemStack(modItems.itemChargedCreepLeaf, 1));
        }
        event.drops.add(item);
    }
    else if(event.entityLiving.getDisplayName().equals("Harry9137")){
        if(event.source.getEntity() instanceof EntityPlayer){
            EntityPlayer badperson = (EntityPlayer)event.source.getEntity();
            badperson.addChatMessage(new ChatComponentText("§4§lYou Don't Know What You've Done..."));
        }
    }
}
 
Example 36
Project: GalacticraftPixelGalaxy   File: ChunkProviderGreenPixel.java   View source code 6 votes vote down vote up
@SuppressWarnings({"unchecked","rawtypes"}) 
@Override public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType,int i,int j,int k){
	  if (par1EnumCreatureType == EnumCreatureType.monster) 
	{
	    List monsters=new ArrayList();
	    monsters.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 8, 2, 3));
        monsters.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 8, 2, 3));
        monsters.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 8, 2, 3));
        monsters.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 8, 2, 3));
        monsters.add(new BiomeGenBase.SpawnListEntry(EntityEnderman.class, 8, 1, 3));
        monsters.add(new BiomeGenBase.SpawnListEntry(EntityPixelOneSwingman.class, 1, 1, 1));
	    return monsters;
	}
	if (par1EnumCreatureType == EnumCreatureType.creature) 
	{
		List creatures=new ArrayList();
		creatures.add(new BiomeGenBase.SpawnListEntry(EntityhumanPixel.class, 8, 2, 3));
		creatures.add(new BiomeGenBase.SpawnListEntry(EntitypixelPig.class, 8, 1, 3));
		creatures.add(new BiomeGenBase.SpawnListEntry(EntitypixelCow.class, 8, 1, 3));
		return creatures;
		}
	  return null;
	}
 
Example 37
Project: ZeroQuest   File: EntityKortor.java   View source code 6 votes vote down vote up
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityKortor)
        {
        	EntityKortor entitywolf = (EntityKortor)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 38
Project: ZeroQuest   File: EntityForisZertum.java   View source code 6 votes vote down vote up
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityForisZertum)
        {
            EntityForisZertum entitywolf = (EntityForisZertum)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 39
Project: ZeroQuest   File: EntityDestroZertum.java   View source code 6 votes vote down vote up
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityDestroZertum)
        {
            EntityDestroZertum entitywolf = (EntityDestroZertum)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 40
Project: ModTutoriel17   File: LivingEventHandler.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onLivingHurt(LivingHurtEvent event)
{
    ItemStack boots = event.entityLiving.getEquipmentInSlot(1);
    ItemStack leggings = event.entityLiving.getEquipmentInSlot(2);
    ItemStack chestPlate = event.entityLiving.getEquipmentInSlot(3);
    ItemStack helmet = event.entityLiving.getEquipmentInSlot(4);

    if(boots != null && boots.getItem() == ModTutoriel.bootsTuto && leggings != null && leggings.getItem() == ModTutoriel.leggingsTuto && chestPlate != null && chestPlate.getItem() == ModTutoriel.chestPlateTuto && helmet != null && helmet.getItem() == ModTutoriel.helmetTuto)
    {
        if(event.source.getEntity() != null && event.source.getEntity() instanceof EntityCreeper)
        {
            boots.damageItem(MathHelper.floor_float(event.ammount / 4), event.entityLiving);
            leggings.damageItem(MathHelper.floor_float(event.ammount / 4), event.entityLiving);
            chestPlate.damageItem(MathHelper.floor_float(event.ammount / 4), event.entityLiving);
            helmet.damageItem(MathHelper.floor_float(event.ammount / 4), event.entityLiving);
            event.ammount = 0F;
        }
        else if(event.source.getDamageType().equals("cactus"))
        {
            event.entityLiving.worldObj.newExplosion(event.entityLiving, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, event.ammount, true, true);
        }
    }
}