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: BaseClient   File: EntityWolf.java   Source Code and License 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: BaseClient   File: RenderCreeper.java   Source Code and License 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 3
Project: BaseClient   File: EntityWolf.java   Source Code and License 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 4
Project: BaseClient   File: RenderCreeper.java   Source Code and License 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 5
Project: BaseClient   File: EntityRenderer.java   Source Code and License 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 6
Project: Halloween   File: ModEntities.java   Source Code and License 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 7
Project: EndermanEvolution   File: EntityFrienderman.java   Source Code and License 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 8
Project: uniquecrops   File: ItemGeneric.java   Source Code and License 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 9
Project: Backmemed   File: EntityWolf.java   Source Code and License 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 10
Project: Backmemed   File: RenderCreeper.java   Source Code and License 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 11
Project: CustomWorldGen   File: EntityWolf.java   Source Code and License 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 12
Project: CustomWorldGen   File: RenderCreeper.java   Source Code and License 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 13
Project: BetterWithAddons   File: EffectElectrified.java   Source Code and License 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 14
Project: Overlord   File: EntityAINearestNonTeamTarget.java   Source Code and License 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 15
Project: Overlord   File: EntityArmyMember.java   Source Code and License 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 16
Project: Overlord   File: EntityArmyMember.java   Source Code and License 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 17
Project: Overlord   File: EntityBabySkeleton.java   Source Code and License 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 18
Project: 4Space-5   File: EntitySlimeling.java   Source Code and License 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 19
Project: 4Space-5   File: RenderEvolvedCreeper.java   Source Code and License 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 20
Project: CrystalMod   File: MinionAICombat.java   Source Code and License 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 21
Project: MidgarCrusade   File: EntitySlave.java   Source Code and License 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 22
Project: ChameleonCreepersMod   File: RenderChameleonCreeper.java   Source Code and License 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 23
Project: ToroQuest   File: EntityGuard.java   Source Code and License 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 24
Project: Gravestone-mod-Extended   File: GSEventsHandler.java   Source Code and License 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 25
Project: Minecraft-Flux   File: EntityActionEnergy.java   Source Code and License 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 26
Project: demomod   File: DemoEntityTameable.java   Source Code and License 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 27
Project: It-s-About-Time-Minecraft-Mod   File: EntityIatWolf.java   Source Code and License 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 28
Project: Resilience-Client-Source   File: EntityWolf.java   Source Code and License 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 29
Project: Resilience-Client-Source   File: RenderCreeper.java   Source Code and License 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 30
Project: Rediscovered-Mod-1.8.8   File: EntityRana.java   Source Code and License 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 31
Project: CreepTech   File: EntityDeathEventHooks.java   Source Code and License 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 32
Project: GalacticraftPixelGalaxy   File: ChunkProviderGreenPixel.java   Source Code and License 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 33
Project: ZeroQuest   File: EntityKortor.java   Source Code and License 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 34
Project: ZeroQuest   File: EntityForisZertum.java   Source Code and License 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 35
Project: ZeroQuest   File: EntityDestroZertum.java   Source Code and License 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 36
Project: ModTutoriel17   File: LivingEventHandler.java   Source Code and License 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);
        }
    }
}
 
Example 37
Project: ZeroQuest   File: EntityIceZertum.java   Source Code and License 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 EntityIceZertum)
        {
            EntityIceZertum entitywolf = (EntityIceZertum)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: RuneCraftery   File: RenderCreeper.java   Source Code and License 6 votes vote down vote up
protected void func_77060_a(EntityCreeper p_77060_1_, float p_77060_2_) {
   float var3 = p_77060_1_.func_70831_j(p_77060_2_);
   float var4 = 1.0F + MathHelper.func_76126_a(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 39
Project: ZeldaSwordSkills   File: ZSSItemEvents.java   Source Code and License 6 votes vote down vote up
private static void init() {
	addDrop(EntityCreeper.class, SkillBase.armorBreak);
	addDrop(EntityIronGolem.class, SkillBase.armorBreak);
	addDrop(EntitySilverfish.class, SkillBase.dash);
	addDrop(EntityHorse.class, SkillBase.dash);
	addDrop(EntityEnderman.class, SkillBase.dodge);
	addDrop(EntityKeese.class, SkillBase.dodge);
	addDrop(EntitySpider.class, SkillBase.endingBlow);
	addDrop(EntityCaveSpider.class, SkillBase.leapingBlow);
	addDrop(EntityMagmaCube.class, SkillBase.leapingBlow);
	addDrop(EntityPigZombie.class, SkillBase.parry);
	addDrop(EntityOcelot.class, SkillBase.parry);
	addDrop(EntityOctorok.class, SkillBase.risingCut);
	addDrop(EntityBlaze.class, SkillBase.spinAttack);
	addDrop(EntityDarknut.class, SkillBase.spinAttack);
	addDrop(EntityZombie.class, SkillBase.swordBasic);
	addDrop(EntitySkeleton.class, SkillBase.swordBasic);
	addDrop(EntityGhast.class, SkillBase.swordBeam);
	addDrop(EntityWitch.class, SkillBase.swordBeam);
	addDrop(EntityWizzrobe.class, SkillBase.swordBreak);
}
 
Example 40
Project: ZeroQuest   File: BiomeGenBioZone.java   Source Code and License 6 votes vote down vote up
public BiomeGenBioZone(int id) {
    super(id);
    this.theBiomeDecorator.generateLakes = true;
    this.theBiomeDecorator.treesPerChunk = 4;
    this.spawnableMonsterList.clear();
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 100, 4, 4));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityZertum.class, 100, 4, 4));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 5, 1, 5));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 5, 1, 5));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 5, 1, 5));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 5, 1, 5)); 
}
 
Example 41
Project: ZeroQuest   File: BiomeGenBioZone.java   Source Code and License 6 votes vote down vote up
public BiomeGenBioZone(int id) {
    super(id);
    this.theBiomeDecorator.generateLakes = true;
    this.theBiomeDecorator.treesPerChunk = 4;
    this.spawnableMonsterList.clear();
    this.addFlower(ModBlocks.nileBlueFlower.getDefaultState(), 90);
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 100, 4, 4));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 5, 1, 5));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 5, 1, 5));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 5, 1, 5));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 5, 1, 5)); 
}
 
Example 42
Project: SecurityCraft   File: BlockReinforcedFenceGate.java   Source Code and License 6 votes vote down vote up
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
	if(BlockUtils.getBlockPropertyAsBoolean(world, pos, OPEN))
		return;

	if(entity instanceof EntityItem)
		return;
	else if(entity instanceof EntityPlayer)
	{
		EntityPlayer player = (EntityPlayer)entity;

		if(((TileEntityOwnable)world.getTileEntity(pos)).getOwner().isOwner(player))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ(), true);

		creeper.onStruckByLightning(lightning);
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F);
}
 
Example 43
Project: Cauldron   File: RenderCreeper.java   Source Code and License 6 votes vote down vote up
protected void preRenderCallback(EntityCreeper p_77041_1_, float p_77041_2_)
{
    float f1 = p_77041_1_.getCreeperFlashIntensity(p_77041_2_);
    float f2 = 1.0F + MathHelper.sin(f1 * 100.0F) * f1 * 0.01F;

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

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

    f1 *= f1;
    f1 *= f1;
    float f3 = (1.0F + f1 * 0.4F) * f2;
    float f4 = (1.0F + f1 * 0.1F) / f2;
    GL11.glScalef(f3, f4, f3);
}
 
Example 44
Project: SecurityCraft   File: BlockReinforcedFenceGate.java   Source Code and License 6 votes vote down vote up
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
	if(BlockUtils.getBlockPropertyAsBoolean(world, pos, OPEN))
		return;

	if(entity instanceof EntityItem)
		return;
	else if(entity instanceof EntityPlayer)
	{
		EntityPlayer player = (EntityPlayer)entity;

		if(((TileEntityOwnable)world.getTileEntity(pos)).getOwner().isOwner(player))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ(), true);

		creeper.onStruckByLightning(lightning);
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F);
}
 
Example 45
Project: SecurityCraft   File: TileEntityProtecto.java   Source Code and License 6 votes vote down vote up
@Override
public boolean attackEntity(Entity entity){
	if (entity instanceof EntityLivingBase) {
		if ((entity instanceof EntityPlayer && (getOwner().isOwner((EntityPlayer) entity) || (hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(world, pos, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) entity).getName().toLowerCase())))) ||
				entity instanceof EntityPigZombie ||
				(entity instanceof EntityCreeper && ((EntityCreeper) entity).getPowered()))
			return false;

		EntityLightningBolt lightning = new EntityLightningBolt(world, entity.posX, entity.posY, entity.posZ, true);
		world.addWeatherEffect(lightning);

		BlockUtils.setBlockProperty(world, pos, BlockProtecto.ACTIVATED, false);
		return true;
	}

	return false;
}
 
Example 46
Project: RuneCraftery   File: RenderCreeper.java   Source Code and License 6 votes vote down vote up
protected int func_77063_a(EntityCreeper p_77063_1_, float p_77063_2_, float p_77063_3_) {
   float var4 = p_77063_1_.func_70831_j(p_77063_3_);
   if((int)(var4 * 10.0F) % 2 == 0) {
      return 0;
   } else {
      int var5 = (int)(var4 * 0.2F * 255.0F);
      if(var5 < 0) {
         var5 = 0;
      }

      if(var5 > 255) {
         var5 = 255;
      }

      short var6 = 255;
      short var7 = 255;
      short var8 = 255;
      return var5 << 24 | var6 << 16 | var7 << 8 | var8;
   }
}
 
Example 47
Project: SecurityCraft   File: TileEntityProtecto.java   Source Code and License 6 votes vote down vote up
@Override
public boolean attackEntity(Entity entity){
	if (entity instanceof EntityLivingBase) {
		if ((entity instanceof EntityPlayer && (getOwner().isOwner((EntityPlayer) entity) || (hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(worldObj, pos, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) entity).getCommandSenderName().toLowerCase())))) ||
				entity instanceof EntityPigZombie ||
				(entity instanceof EntityCreeper && ((EntityCreeper) entity).getPowered()))
			return false;

		EntityLightningBolt lightning = new EntityLightningBolt(worldObj, entity.posX, entity.posY, entity.posZ);
		worldObj.addWeatherEffect(lightning);

		BlockUtils.setBlockProperty(worldObj, pos, BlockProtecto.ACTIVATED, false);
		return true;
	}

	return false;
}
 
Example 48
Project: SecurityCraft   File: BlockReinforcedFenceGate.java   Source Code and License 6 votes vote down vote up
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
	if(BlockUtils.getBlockPropertyAsBoolean(world, pos, OPEN))
		return;

	if(entity instanceof EntityItem)
		return;
	else if(entity instanceof EntityPlayer)
	{
		EntityPlayer player = (EntityPlayer)entity;

		if(((TileEntityOwnable)world.getTileEntity(pos)).getOwner().isOwner(player))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ());

		creeper.onStruckByLightning(lightning);
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F);
}
 
Example 49
Project: SecurityCraft   File: BlockIronFence.java   Source Code and License 6 votes vote down vote up
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity)
{
	//so dropped items don't get destroyed
	if(entity instanceof EntityItem)
		return;
	//owner check
	else if(entity instanceof EntityPlayer)
	{
		if(((TileEntityOwnable) world.getTileEntity(pos)).getOwner().isOwner((EntityPlayer)entity))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ());

		creeper.onStruckByLightning(lightning);
		creeper.extinguish();
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F); //3 hearts per attack
}
 
Example 50
Project: SecurityCraft   File: TileEntityProtecto.java   Source Code and License 6 votes vote down vote up
@Override
public boolean attackEntity(Entity entity){
	if (entity instanceof EntityLivingBase) {
		if ((entity instanceof EntityPlayer && (getOwner().isOwner((EntityPlayer) entity) || (hasModule(EnumCustomModules.WHITELIST) && ModuleUtils.getPlayersFromModule(worldObj, pos, EnumCustomModules.WHITELIST).contains(((EntityLivingBase) entity).getName().toLowerCase())))) ||
				entity instanceof EntityPigZombie ||
				(entity instanceof EntityCreeper && ((EntityCreeper) entity).getPowered()))
			return false;

		EntityLightningBolt lightning = new EntityLightningBolt(worldObj, entity.posX, entity.posY, entity.posZ);
		worldObj.addWeatherEffect(lightning);

		BlockUtils.setBlockProperty(worldObj, pos, BlockProtecto.ACTIVATED, false);
		return true;
	}

	return false;
}
 
Example 51
Project: SecurityCraft   File: BlockFullMineBase.java   Source Code and License 6 votes vote down vote up
/**
  * Triggered whenever an entity collides with this block (enters into the block). Args: world, x, y, z, entity
  */
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity){
 	if(par1World.isRemote){
 		return;
 	}else{
 	
 		if(par5Entity instanceof EntityCreeper || par5Entity instanceof EntityOcelot || par5Entity instanceof EntityEnderman || par5Entity instanceof EntityItem){
 			return;
 		}else{
 			this.explode(par1World, par2, par3, par4);
 		}
 		
 	}
 
 	
 }
 
Example 52
Project: SecurityCraft   File: BlockReinforcedFenceGate.java   Source Code and License 6 votes vote down vote up
@Override
public void onEntityIntersected(World world, BlockPos pos, Entity entity) {
	if(BlockUtils.getBlockPropertyAsBoolean(world, pos, OPEN))
		return;

	if(entity instanceof EntityItem)
		return;
	else if(entity instanceof EntityPlayer)
	{
		EntityPlayer player = (EntityPlayer)entity;

		if(((TileEntityOwnable)world.getTileEntity(pos)).getOwner().isOwner(player))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, pos.getX(), pos.getY(), pos.getZ(), true);

		creeper.onStruckByLightning(lightning);
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F);
}
 
Example 53
Project: SecurityCraft   File: BlockIronFence.java   Source Code and License 6 votes vote down vote up
@Override
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity)
{
	//so dropped items don't get destroyed
	if(entity instanceof EntityItem)
		return;
	//owner check
	else if(entity instanceof EntityPlayer)
	{
		if(((TileEntityOwnable) world.getTileEntity(x, y, z)).getOwner().isOwner((EntityPlayer)entity))
			return;
	}
	else if(entity instanceof EntityCreeper)
	{
		EntityCreeper creeper = (EntityCreeper)entity;
		EntityLightningBolt lightning = new EntityLightningBolt(world, x, y, z);

		creeper.onStruckByLightning(lightning);
		creeper.extinguish();
		return;
	}

	entity.attackEntityFrom(CustomDamageSources.electricity, 6.0F); //3 hearts per attack
}
 
Example 54
Project: MineCraft   File: CreeperSpawnAlert.java   Source Code and License 6 votes vote down vote up
@SubscribeEvent
public void sendAlert(EntityJoinWorldEvent event) {
	if (!(event.getEntity() instanceof EntityCreeper)) {
		return;
	}

	List players = event.getEntity().worldObj.playerEntities;

	for (int i = 0; i < players.size(); i++) {
		EntityPlayer player = (EntityPlayer) players.get(i);
		if (event.getWorld().isRemote) {
			player.addChatComponentMessage(new TextComponentString(
					TextFormatting.GREEN + "A creeper has spawned!"));
		}
	}
}
 
Example 55
Project: Sophisticated-wolves   File: EntityAIAvoidCreeper.java   Source Code and License 6 votes vote down vote up
/**
 * Returns whether the EntityAIBase should begin execution.
 */
@Override
public boolean shouldExecute() {
    List list = this.entity.world.getEntitiesWithinAABB(EntityCreeper.class, this.entity.getEntityBoundingBox().grow(this.distance, 3, this.distance),
            Predicates.and(EntitySelectors.CAN_AI_TARGET, this.canBeSeenSelector));

    if (list.isEmpty()) {
        return false;
    } else {
        this.creeper = null;
        this.listSize = list.size();

        for (int cr = 0; cr < this.listSize; cr++) {
            this.creeper = (EntityCreeper) list.get(cr);

            if (this.creeper.getCreeperState() >= 0) {
                if (this.entity.getDistance(creeper) < this.minDistToCharged * this.minDistToCharged) {
                    return moveAway(16, 7);
                }
            } else if (this.entity.getDistance(creeper) < this.minDist * this.minDist) {
                return moveAway(this.minDist, this.minDist);
            }
        }
    }
    return false;
}
 
Example 56
Project: Loot-Slash-Conquer   File: DungeonHelper.java   Source Code and License 5 votes vote down vote up
private static ResourceLocation getRandomMonster()
{
	ArrayList<ResourceLocation> entities = new ArrayList<ResourceLocation>();
	
	entities.add(EntityList.getKey(EntityZombie.class));
	entities.add(EntityList.getKey(EntitySpider.class));
	entities.add(EntityList.getKey(EntitySkeleton.class));
	entities.add(EntityList.getKey(EntityEnderman.class));
	entities.add(EntityList.getKey(EntityCreeper.class));
	entities.add(EntityList.getKey(EntityCaveSpider.class));
	
	return entities.get((int) (Math.random() * entities.size()));
}
 
Example 57
Project: pnc-repressurized   File: EntityTrackHandler.java   Source Code and License 5 votes vote down vote up
@Override
public void update(Entity entity) {
    if (((EntityCreeper) entity).getCreeperState() == 1) {
        creeperInFuseTime++;
        if (creeperInFuseTime > 30) creeperInFuseTime = 30;
    } else {
        creeperInFuseTime--;
        if (creeperInFuseTime < 0) creeperInFuseTime = 0;
    }
}
 
Example 58
Project: pnc-repressurized   File: EntityTrackHandler.java   Source Code and License 5 votes vote down vote up
@Override
public void addInfo(Entity entity, List<String> curInfo) {
    if (creeperInFuseTime > 0) {
        if (((EntityCreeper) entity).getCreeperState() == 1) {
            curInfo.add(TextFormatting.RED + "FUSE: " + Math.round((30 - creeperInFuseTime) / 20F * 10F) / 10F + "s !");
        } else {
            curInfo.add(TextFormatting.DARK_GREEN + "Cooling down: " + Math.round((30 - creeperInFuseTime) / 20F * 10F) / 10F + "s !");
        }
    }
}
 
Example 59
Project: ProgressiveDifficulty   File: CreeperChargeModifier.java   Source Code and License 5 votes vote down vote up
@Override
public void handleSpawnEvent(int numInstances, EntityLiving entity) {
    if (entity instanceof EntityCreeper) {
        EntityCreeper creeper = (EntityCreeper) entity;
        //this avoids our creepers being on fire when they spawn
        creeper.setFire(0);
        creeper.onStruckByLightning(null);
        entity.setHealth(entity.getMaxHealth());
    }
}
 
Example 60
Project: BaseClient   File: BiomeGenBase.java   Source Code and License 5 votes vote down vote up
protected BiomeGenBase(int id)
{
    this.minHeight = height_Default.rootHeight;
    this.maxHeight = height_Default.variation;
    this.temperature = 0.5F;
    this.rainfall = 0.5F;
    this.waterColorMultiplier = 16777215;
    this.spawnableMonsterList = Lists.<BiomeGenBase.SpawnListEntry>newArrayList();
    this.spawnableCreatureList = Lists.<BiomeGenBase.SpawnListEntry>newArrayList();
    this.spawnableWaterCreatureList = Lists.<BiomeGenBase.SpawnListEntry>newArrayList();
    this.spawnableCaveCreatureList = Lists.<BiomeGenBase.SpawnListEntry>newArrayList();
    this.enableRain = true;
    this.worldGeneratorTrees = new WorldGenTrees(false);
    this.worldGeneratorBigTree = new WorldGenBigTree(false);
    this.worldGeneratorSwamp = new WorldGenSwamp();
    this.biomeID = id;
    biomeList[id] = this;
    this.theBiomeDecorator = this.createBiomeDecorator();
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySheep.class, 12, 4, 4));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityRabbit.class, 10, 3, 3));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 10, 4, 4));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 10, 4, 4));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 8, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySpider.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityZombie.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySkeleton.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityCreeper.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntitySlime.class, 100, 4, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityEnderman.class, 10, 1, 4));
    this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityWitch.class, 5, 1, 1));
    this.spawnableWaterCreatureList.add(new BiomeGenBase.SpawnListEntry(EntitySquid.class, 10, 4, 4));
    this.spawnableCaveCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityBat.class, 10, 8, 8));
}