net.minecraft.entity.passive.EntityAmbientCreature Java Examples

The following examples show how to use net.minecraft.entity.passive.EntityAmbientCreature. 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: ActivationRange.java    From Thermos with GNU General Public License v3.0 6 votes vote down vote up
/**
 * Initializes an entities type on construction to specify what group this
 * entity is in for activation ranges.
 *
 * @param entity
 * @return group id
 */
public static byte initializeEntityActivationType(Entity entity)
{
    Chunk chunk = null;
    // Cauldron start - account for entities that dont extend EntityMob, EntityAmbientCreature, EntityCreature
    if ( entity instanceof EntityMob || entity instanceof EntitySlime || entity.isCreatureType(EnumCreatureType.monster, false)) // Cauldron - account for entities that dont extend EntityMob
    {
        return 1; // Monster
    } else if ( entity instanceof EntityCreature || entity instanceof EntityAmbientCreature || entity.isCreatureType(EnumCreatureType.creature, false) 
             || entity.isCreatureType(EnumCreatureType.waterCreature, false) || entity.isCreatureType(EnumCreatureType.ambient, false))
    {
        return 2; // Animal
    // Cauldron end
    } else
    {
        return 3; // Misc
    }
}
 
Example #2
Source File: ActivationRange.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Initializes an entities type on construction to specify what group this
 * entity is in for activation ranges.
 *
 * @param entity
 * @return group id
 */
public static byte initializeEntityActivationType(Entity entity) {
    // Cauldron start - account for entities that dont extend EntityMob, EntityAmbientCreature, EntityCreature
    if (entity instanceof EntityMob || entity instanceof EntitySlime || entity.isCreatureType(EnumCreatureType.MONSTER, false)) // Cauldron - account for entities that dont extend EntityMob
    {
        return 1; // Monster
    } else if (entity instanceof EntityCreature || entity instanceof EntityAmbientCreature || entity.isCreatureType(EnumCreatureType.CREATURE, false)
            || entity.isCreatureType(EnumCreatureType.WATER_CREATURE, false) || entity.isCreatureType(EnumCreatureType.AMBIENT, false)) {
        return 2; // Animal
        // Cauldron end
    } else {
        return 3; // Misc
    }
}
 
Example #3
Source File: RadarHack.java    From ForgeWurst with GNU General Public License v3.0 5 votes vote down vote up
@SubscribeEvent
public void onUpdate(WUpdateEvent event)
{
	EntityPlayerSP player = event.getPlayer();
	World world = WPlayer.getWorld(player);
	
	entities.clear();
	Stream<Entity> stream = world.loadedEntityList.parallelStream()
		.filter(e -> !e.isDead && e != player)
		.filter(e -> !(e instanceof EntityFakePlayer))
		.filter(e -> e instanceof EntityLivingBase)
		.filter(e -> ((EntityLivingBase)e).getHealth() > 0);
	
	if(filterPlayers.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityPlayer));
	
	if(filterSleeping.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityPlayer
			&& ((EntityPlayer)e).isPlayerSleeping()));
	
	if(filterMonsters.isChecked())
		stream = stream.filter(e -> !(e instanceof IMob));
	
	if(filterAnimals.isChecked())
		stream = stream.filter(e -> !(e instanceof EntityAnimal
			|| e instanceof EntityAmbientCreature
			|| e instanceof EntityWaterMob));
	
	if(filterInvisible.isChecked())
		stream = stream.filter(e -> !e.isInvisible());
	
	entities.addAll(stream.collect(Collectors.toList()));
}
 
Example #4
Source File: CraftAmbient.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftAmbient(CraftServer server, EntityAmbientCreature entity) {
    super(server, entity);
}
 
Example #5
Source File: CraftAmbient.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAmbientCreature getHandle() {
    return (EntityAmbientCreature) entity;
}
 
Example #6
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 #7
Source File: CraftAmbient.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
public CraftAmbient(CraftServer server, EntityAmbientCreature entity) {
    super(server, entity);
}
 
Example #8
Source File: CraftAmbient.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityAmbientCreature getHandle() {
    return (EntityAmbientCreature) entity;
}