net.minecraft.entity.monster.EntityEnderman Java Examples

The following examples show how to use net.minecraft.entity.monster.EntityEnderman. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: EntityUtils.java    From ForgeHax with MIT License 6 votes vote down vote up
/**
 * Checks if the mob could be possibly hostile towards us (we can't detect their attack target
 * easily) Current entities: PigZombie: Aggressive if arms are raised, when arms are put down a
 * internal timer is slowly ticked down from 400 Wolf: Aggressive if the owner isn't the local
 * player and the wolf is angry Enderman: Aggressive if making screaming sounds
 */
public static boolean isMobAggressive(Entity entity) {
  if (entity instanceof EntityPigZombie) {
    // arms raised = aggressive, angry = either game or we have set the anger cooldown
    if (((EntityPigZombie) entity).isArmsRaised() || ((EntityPigZombie) entity).isAngry()) {
      if (!((EntityPigZombie) entity).isAngry()) {
        // set pigmens anger to 400 if it hasn't been angered already
        FastReflection.Fields.EntityPigZombie_angerLevel.set(entity, 400);
      }
      return true;
    }
  } else if (entity instanceof EntityWolf) {
    return ((EntityWolf) entity).isAngry() && !MC.player.equals(((EntityWolf) entity).getOwner());
  } else if (entity instanceof EntityEnderman) {
    return ((EntityEnderman) entity).isScreaming();
  }
  return false;
}
 
Example #2
Source File: HackableHandler.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
public static void addDefaultEntries(){
    PneumaticRegistry.getInstance().addHackable(Blocks.tnt, HackableTNT.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.mob_spawner, HackableMobSpawner.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.lever, HackableLever.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.stone_button, HackableButton.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.wooden_button, HackableButton.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.wooden_door, HackableDoor.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.tripwire_hook, HackableTripwire.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.dispenser, HackableDispenser.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.dropper, HackableDispenser.class);
    PneumaticRegistry.getInstance().addHackable(Blockss.securityStation, HackableSecurityStation.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.monster_egg, HackableTripwire.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.noteblock, HackableNoteblock.class);
    PneumaticRegistry.getInstance().addHackable(Blocks.jukebox, HackableJukebox.class);

    PneumaticRegistry.getInstance().addHackable(EntityCreeper.class, HackableCreeper.class);
    PneumaticRegistry.getInstance().addHackable(EntityTameable.class, HackableTameable.class);
    PneumaticRegistry.getInstance().addHackable(EntityCow.class, HackableCow.class);
    PneumaticRegistry.getInstance().addHackable(EntityCaveSpider.class, HackableCaveSpider.class);
    PneumaticRegistry.getInstance().addHackable(EntityBlaze.class, HackableBlaze.class);
    PneumaticRegistry.getInstance().addHackable(EntityGhast.class, HackableGhast.class);
    PneumaticRegistry.getInstance().addHackable(EntityWitch.class, HackableWitch.class);
    PneumaticRegistry.getInstance().addHackable(EntityLiving.class, HackableLivingDisarm.class);
    PneumaticRegistry.getInstance().addHackable(EntityEnderman.class, HackableEnderman.class);
    PneumaticRegistry.getInstance().addHackable(EntityBat.class, HackableBat.class);
}
 
Example #3
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void ClearVanillaMobSpawns()
{
    for (int i = 0; i < BiomeGenBase.biomeList.length; i++)
    {
        if (BiomeGenBase.biomeList[i] != null)
        {
            EntityRegistry.removeSpawn(EntityCreeper.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySkeleton.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityZombie.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySpider.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityEnderman.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityCaveSpider.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySlime.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityGhast.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityPigZombie.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityMagmaCube.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityOcelot.class, EnumCreatureType.monster, BiomeGenBase.biomeList[i]);
        }
    }
}
 
Example #4
Source File: EventHandlers.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public static void onEndermanTeleportEvent(EnderTeleportEvent event) {
    if (event.getEntity() instanceof EntityEnderman && event.getEntityLiving()
        .getActivePotionEffect(MobEffects.WEAKNESS) != null) {
        event.setCanceled(true);
    }
}
 
Example #5
Source File: PlayerListener.java    From SkyblockAddons with MIT License 5 votes vote down vote up
@SubscribeEvent
public void onAttack(AttackEntityEvent e) {
    if (e.target instanceof EntityEnderman) {
        if (isZealot(e.target)) {
            countedEndermen.add(e.target.getUniqueID());
        }
    }
}
 
Example #6
Source File: ItemDoll.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
/**
 * Spawns the mob in the world at position
 * @param stack The Doll Stack
 * @param pos Blockpos
 * @return true if spawn is successful
 */
public boolean spawnMob(ItemStack stack, World world, BlockPos pos) {
	if (stack.getItemDamage() == 0) {
		EntityBlaze blaze = new EntityBlaze(world);
		blaze.setPosition(pos.getX(), pos.getY()+1, pos.getZ());

		return world.spawnEntity(blaze);
	}
	else {
		EntityEnderman enderman = new EntityEnderman(world);
		enderman.setPosition(pos.getX(), pos.getY()+2, pos.getZ());
		
		return world.spawnEntity(enderman);
	}
}
 
Example #7
Source File: EntityEndermite.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void onLivingUpdate() {
	super.onLivingUpdate();

	if (worldObj.isRemote)
		for (int i = 0; i < 2; i++)
			worldObj.spawnParticle("portal", posX + (rand.nextDouble() - 0.5D) * width, posY + rand.nextDouble() * height, posZ + (rand.nextDouble() - 0.5D) * width, (rand.nextDouble() - 0.5D) * 2.0D, -rand.nextDouble(), (rand.nextDouble() - 0.5D) * 2.0D);
	else {
		if (!isNoDespawnRequired())
			lifetime++;

		if (lifetime >= 2400)
			setDead();
	}

	if (isSpawnedByPlayer()) {
		double range = 64;
		double radius = range / 2.0;
		int tagetChance = 10;
		if (rand.nextInt(tagetChance) != 0) {
			List<EntityEnderman> list = worldObj.getEntitiesWithinAABBExcludingEntity(this, AxisAlignedBB.getBoundingBox(posX - radius, posY - 4, posZ - radius, posX + radius, posY + 4, posZ + radius), new IEntitySelector() {
				@Override
				public boolean isEntityApplicable(Entity entity) {
					return entity instanceof EntityEnderman;
				}
			});
			Collections.sort(list, sorter);
			if (!list.isEmpty()) {
				EntityEnderman enderman = list.get(0);
				enderman.setTarget(this);
			}
		}
	}
}
 
Example #8
Source File: BiomeGenWatermelon.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
public BiomeGenWatermelon(int biomeId, boolean register) {
	super(new BiomeProperties("Watermelon").setBaseHeight(1f).setHeightVariation(0.1f).setTemperature(0.9f).setRainDisabled());
	
	//cold and dry
	
	this.decorator.generateFalls=false;
	this.decorator.flowersPerChunk=0;
	this.decorator.grassPerChunk=0;
	this.decorator.treesPerChunk=0;
	this.fillerBlock = this.topBlock = Blocks.MELON_BLOCK.getDefaultState();
	
	this.spawnableMonsterList.clear();
	this.spawnableMonsterList.add(new Biome.SpawnListEntry(EntityEnderman.class, 10, 1, 10));
}
 
Example #9
Source File: EnchantmentEnderDamage.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onEntityDamaged(EntityLivingBase hurtEntity, Entity damagingEntity, int level) {
    String entityName = EntityList.getEntityString(hurtEntity);
    if (hurtEntity instanceof EntityEnderman || hurtEntity instanceof EntityDragon || (entityName != null && entityName.toLowerCase().contains("ender"))) {
        hurtEntity.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, level * 200, Math.max(1, (5 * level) / 7)));
        hurtEntity.addPotionEffect(new PotionEffect(MobEffects.POISON, level * 200, Math.max(1, (5 * level) / 7)));
    }
}
 
Example #10
Source File: CraftEnderman.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftEnderman(CraftServer server, EntityEnderman entity) {
    super(server, entity);
}
 
Example #11
Source File: CraftEnderman.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityEnderman getHandle() {
    return (EntityEnderman) entity;
}
 
Example #12
Source File: KillauraHack.java    From ForgeWurst with GNU General Public License v3.0 4 votes vote down vote up
@SubscribeEvent
public void onUpdate(WUpdateEvent event)
{
	EntityPlayerSP player = event.getPlayer();
	World world = WPlayer.getWorld(player);
	
	if(player.getCooledAttackStrength(0) < 1)
		return;
	
	double rangeSq = Math.pow(range.getValue(), 2);
	Stream<EntityLivingBase> stream = world.loadedEntityList
		.parallelStream().filter(e -> e instanceof EntityLivingBase)
		.map(e -> (EntityLivingBase)e)
		.filter(e -> !e.isDead && e.getHealth() > 0)
		.filter(e -> WEntity.getDistanceSq(player, e) <= rangeSq)
		.filter(e -> e != player)
		.filter(e -> !(e instanceof EntityFakePlayer));
	
	if(filterPlayers.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityPlayer));
	
	if(filterSleeping.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityPlayer
			&& ((EntityPlayer)e).isPlayerSleeping()));
	
	if(filterFlying.getValue() > 0)
		stream = stream.filter(e -> {
			
			if(!(e instanceof EntityPlayer))
				return true;
			
			AxisAlignedBB box = e.getEntityBoundingBox();
			box = box.union(box.offset(0, -filterFlying.getValue(), 0));
			// Using expand() with negative values doesn't work in 1.10.2.
			return world.collidesWithAnyBlock(box);
		});
	
	if(filterMonsters.isChecked())
		stream = stream.filter(e -> !(e instanceof IMob));
	
	if(filterPigmen.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityPigZombie));
	
	if(filterEndermen.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityEnderman));
	
	if(filterAnimals.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityAnimal
			|| e instanceof EntityAmbientCreature
			|| e instanceof EntityWaterMob));
	
	if(filterBabies.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityAgeable
			&& ((EntityAgeable)e).isChild()));
	
	if(filterPets.isChecked())
		stream = stream
			.filter(e -> !(e instanceof EntityTameable
				&& ((EntityTameable)e).isTamed()))
			.filter(e -> !WEntity.isTamedHorse(e));
	
	if(filterVillagers.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityVillager));
	
	if(filterGolems.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityGolem));
	
	if(filterInvisible.isChecked())
		stream = stream.filter(e -> !e.isInvisible());
	
	target = stream.min(priority.getSelected().comparator).orElse(null);
	if(target == null)
		return;
	
	RotationUtils
		.faceVectorPacket(target.getEntityBoundingBox().getCenter());
	mc.playerController.attackEntity(player, target);
	player.swingArm(EnumHand.MAIN_HAND);
}
 
Example #13
Source File: EndermanMob.java    From ForgeHax with MIT License 4 votes vote down vote up
@Override
public boolean isMobType(Entity entity) {
  return entity instanceof EntityEnderman;
}
 
Example #14
Source File: EndermanMob.java    From ForgeHax with MIT License 4 votes vote down vote up
@Override
protected MobTypeEnum getMobTypeUnchecked(Entity entity) {
  EntityEnderman enderman = (EntityEnderman) entity;
  return enderman.isScreaming() ? MobTypeEnum.HOSTILE : MobTypeEnum.NEUTRAL;
}
 
Example #15
Source File: EntityUtils.java    From ForgeHax with MIT License 4 votes vote down vote up
/**
 * If the mob by default wont attack the player, but will if the player attacks it
 */
public static boolean isNeutralMob(Entity entity) {
  return entity instanceof EntityPigZombie
      || entity instanceof EntityWolf
      || entity instanceof EntityEnderman;
}
 
Example #16
Source File: CraftEnderman.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public CraftEnderman(CraftServer server, EntityEnderman entity) {
    super(server, entity);
}
 
Example #17
Source File: CraftEnderman.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityEnderman getHandle() {
    return (EntityEnderman) entity;
}
 
Example #18
Source File: PlayerListener.java    From SkyblockAddons with MIT License 4 votes vote down vote up
@SubscribeEvent
    public void onDeath(LivingDeathEvent e) {
        if (e.entity instanceof EntityEnderman) {
            if (countedEndermen.remove(e.entity.getUniqueID())) {
                main.getPersistentValues().addKill();
                EndstoneProtectorManager.onKill();
            } else if (main.getUtils().isOnSkyblock() && main.getConfigValues().isEnabled(Feature.ZEALOT_COUNTER_EXPLOSIVE_BOW_SUPPORT)) {
                if (isZealot(e.entity)) {
                    long now = System.currentTimeMillis();
                    if (recentlyKilledZealots.containsKey(now)) {
                        recentlyKilledZealots.get(now).add(e.entity.getPositionVector());
                    } else {
                        recentlyKilledZealots.put(now, Sets.newHashSet(e.entity.getPositionVector()));
                    }

                    explosiveBowExplosions.keySet().removeIf((explosionTime) -> now - explosionTime > 150);
                    Map.Entry<Long, Vec3> latestExplosion = explosiveBowExplosions.lastEntry();
                    if (latestExplosion == null) return;

                    Vec3 explosionLocation = latestExplosion.getValue();

//                    int possibleZealotsKilled = 1;
//                    System.out.println("This means "+possibleZealotsKilled+" may have been killed...");
//                    int originalPossibleZealotsKilled = possibleZealotsKilled;

                    Vec3 deathLocation = e.entity.getPositionVector();

                    double distance = explosionLocation.distanceTo(deathLocation);
//                    System.out.println("Distance was "+distance+"!");
                    if (explosionLocation.distanceTo(deathLocation) < 4.6) {
//                        possibleZealotsKilled--;

                        main.getPersistentValues().addKill();
                        EndstoneProtectorManager.onKill();
                    }

//                    System.out.println((originalPossibleZealotsKilled-possibleZealotsKilled)+" zealots were actually killed...");
                }
            }
        }
    }