net.minecraft.entity.passive.EntityWolf Java Examples

The following examples show how to use net.minecraft.entity.passive.EntityWolf. 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: EntityRabbit.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
public EntityRabbit(World world) {
	super(world);
	moveType = EntityRabbit.EnumMoveType.HOP;
	carrotTicks = 0;
	setSize(0.4F, 0.5F);
	ReflectionHelper.setPrivateValue(EntityLiving.class, this, new EntityRabbit.RabbitJumpHelper(this), "jumpHelper", "field_70767_i");
	ReflectionHelper.setPrivateValue(EntityLiving.class, this, new EntityRabbit.RabbitMoveHelper(), "moveHelper", "field_70765_h");
	getNavigator().setAvoidsWater(true);
	//		navigator.func_179678_a(2.5F);
	tasks.addTask(1, new EntityAISwimming(this));
	tasks.addTask(1, new EntityRabbit.AIPanic(1.33D));
	tasks.addTask(2, new EntityAIMate(this, 0.8D));
	tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.carrot, false));
	tasks.addTask(5, new EntityRabbit.AIRaidFarm());
	tasks.addTask(5, new EntityAIWander(this, 0.6D));
	tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F));
	tasks.addTask(4, new EntityAIAvoidEntity(this, EntityWolf.class, 16.0F, 1.33D, 1.33D));
	tasks.addTask(4, new EntityAIAvoidEntity(this, EntityPlayer.class, 16.0F, 0.8D, 1.33D));
	setMovementSpeed(0.0D);
}
 
Example #2
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public final int despawnVanillaAnimals(WorldServer worldObj)
{
    int count = 0;
    for (int j = 0; j < worldObj.loadedEntityList.size(); j++)
    {
        Entity entity = (Entity) worldObj.loadedEntityList.get(j);
        if (!(entity instanceof EntityLiving))
        {
            continue;
        }
        if ((entity instanceof EntityCow || entity instanceof EntitySheep || entity instanceof EntityPig || entity instanceof EntityOcelot || entity instanceof EntityChicken || entity instanceof EntitySquid || entity instanceof EntityWolf))
        {
            count += entityDespawnCheck(worldObj, (EntityLiving) entity);

        }
    }
    return count;
}
 
Example #3
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void ClearVanillaSpawnLists()
{
    for (int i = 0; i < BiomeGenBase.biomeList.length; i++)
    {
        if (BiomeGenBase.biomeList[i] != null)
        {
            EntityRegistry.removeSpawn(EntityCow.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityPig.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySheep.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityChicken.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityWolf.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySquid.class, EnumCreatureType.waterCreature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityOcelot.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityBat.class, EnumCreatureType.ambient, BiomeGenBase.biomeList[i]);
        }
    }
}
 
Example #4
Source File: MoCEntityHorse.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean attackEntityFrom(DamageSource damagesource, int i)
{

    Entity entity = damagesource.getEntity();
    if ((riddenByEntity != null) && (entity == riddenByEntity)) { return false; }
    if (entity instanceof EntityWolf)
    {
        EntityCreature entitycreature = (EntityCreature) entity;
        entitycreature.setAttackTarget(null);
        return false;
    }
    else
    {
        i = i - (getArmorType() + 2);
        if (i < 0)
        {
            i = 0;
        }
        return super.attackEntityFrom(damagesource, i);
    }
}
 
Example #5
Source File: MoCEntityAnimal.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public boolean entitiesToIgnore(Entity entity)
{

	return ((!(entity instanceof EntityLiving)) 
	        || (entity instanceof EntityMob) 
	        || (entity instanceof EntityPlayer && this.getIsTamed()) 
	        || (entity instanceof MoCEntityKittyBed) 
	        || (entity instanceof MoCEntityLitterBox) 
	        || (this.getIsTamed() && (entity instanceof MoCIMoCreature && ((MoCIMoCreature) entity).getIsTamed())) 
	        || ((entity instanceof EntityWolf) && !(MoCreatures.proxy.attackWolves)) 
	        || ((entity instanceof MoCEntityHorse) && !(MoCreatures.proxy.attackHorses)) 
	        || (entity.width >= this.width || entity.height >= this.height)
	        || (entity instanceof MoCEntityEgg)

	);
}
 
Example #6
Source File: MoCEntityAmbient.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public boolean entitiesToIgnore(Entity entity)
{

	return ((!(entity instanceof EntityLiving)) 
	        || (entity instanceof EntityMob) 
	        || (entity instanceof EntityPlayer && this.getIsTamed()) 
	        || (entity instanceof MoCEntityKittyBed) 
	        || (entity instanceof MoCEntityLitterBox) 
	        || (this.getIsTamed() && (entity instanceof MoCEntityAnimal && ((MoCEntityAnimal) entity).getIsTamed())) 
	        || ((entity instanceof EntityWolf) && !(MoCreatures.proxy.attackWolves)) 
	        || ((entity instanceof MoCEntityHorse) && !(MoCreatures.proxy.attackHorses)) 
	        || (entity.width > this.width && entity.height > this.height)
	        || (entity instanceof MoCEntityEgg)

	);
}
 
Example #7
Source File: ServerEventHandler.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
@SubscribeEvent
public void spawnEvent(EntityJoinWorldEvent event) {
	if (event.entity instanceof EntityPig) {
		EntityPig pig = (EntityPig) event.entity;
		if (EtFuturum.enableBeetroot)
			pig.tasks.addTask(4, new EntityAITempt(pig, 1.2, ModItems.beetroot, false));
	} else if (event.entity instanceof EntityChicken) {
		EntityChicken chicken = (EntityChicken) event.entity;
		if (EtFuturum.enableBeetroot)
			chicken.tasks.addTask(3, new EntityAITempt(chicken, 1.0D, ModItems.beetroot_seeds, false));
	} else if (event.entity instanceof EntityWolf) {
		EntityWolf wolf = (EntityWolf) event.entity;
		if (EtFuturum.enableRabbit)
			wolf.targetTasks.addTask(4, new EntityAITargetNonTamed(wolf, EntityRabbit.class, 200, false));
	} else if (event.entity instanceof EntityVillager) {
		EntityVillager villager = (EntityVillager) event.entity;
		for (Object obj : villager.tasks.taskEntries) {
			EntityAITaskEntry entry = (EntityAITaskEntry) obj;
			if (entry.action instanceof EntityAIOpenDoor) {
				villager.tasks.removeTask(entry.action);
				villager.tasks.addTask(entry.priority, new EntityAIOpenCustomDoor(villager, true));
				break;
			}
		}
	}
}
 
Example #8
Source File: EntityLivingBaseHook.java    From SkyblockAddons with MIT License 6 votes vote down vote up
public static void onResetHurtTime(EntityLivingBase entity) {
    if (entity == Minecraft.getMinecraft().thePlayer) {
        SkyblockAddons main = SkyblockAddons.getInstance();
        if (!main.getUtils().isOnSkyblock() || !main.getConfigValues().isEnabled(Feature.COMBAT_TIMER_DISPLAY)) {
            return;
        }

        Minecraft mc = Minecraft.getMinecraft();
        List<Entity> nearEntities = mc.theWorld.getEntitiesWithinAABB(Entity.class,
                new AxisAlignedBB(mc.thePlayer.posX - 3, mc.thePlayer.posY - 2, mc.thePlayer.posZ - 3, mc.thePlayer.posX + 3, mc.thePlayer.posY + 2, mc.thePlayer.posZ + 3));
        boolean foundPossibleAttacker = false;

        for (Entity nearEntity : nearEntities) {
            if (nearEntity instanceof EntityMob || nearEntity instanceof EntityWolf || nearEntity instanceof IProjectile) {
                foundPossibleAttacker = true;
                break;
            }
        }

        if (foundPossibleAttacker) {
            SkyblockAddons.getInstance().getUtils().setLastDamaged(System.currentTimeMillis());
        }
    }
}
 
Example #9
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 #10
Source File: BiomeAutumnalWoods.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BiomeAutumnalWoods() {
	super(properties);
	decorator.treesPerChunk = 10;
	decorator.flowersPerChunk = 4;
	decorator.grassPerChunk = 6;

	this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityWolf.class, 5, 4, 4));
}
 
Example #11
Source File: BiomeWoodlands.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public BiomeWoodlands() {
	super(properties);
	decorator.treesPerChunk = 4;
	decorator.flowersPerChunk = 6;
	decorator.grassPerChunk = 16;

	this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 2, 4, 4));

	this.flowers.clear();
	for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
		if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) continue;
		if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY;
		addFlower(net.minecraft.init.Blocks.RED_FLOWER.getDefaultState().withProperty(net.minecraft.init.Blocks.RED_FLOWER.getTypeProperty(), type), 10);
	}
}
 
Example #12
Source File: BiomeAutumnalWoodedHills.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public BiomeAutumnalWoodedHills() {
    super(properties);
    decorator.treesPerChunk = 10;
    decorator.flowersPerChunk = 4;
    decorator.grassPerChunk = 6;

    this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 4));
}
 
Example #13
Source File: BiomeAutumnalWoods.java    From Traverse-Legacy-1-12-2 with MIT License 5 votes vote down vote up
public BiomeAutumnalWoods() {
	super(properties);
	decorator.treesPerChunk = 10;
	decorator.flowersPerChunk = 4;
	decorator.grassPerChunk = 6;

	this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityWolf.class, 5, 4, 4));
}
 
Example #14
Source File: EntityWolfMetaProvider.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
@Override
public Object getMeta(EntityWolf target, Vec3 relativePos) {
	Map<String, Object> map = Maps.newHashMap();

	map.put("isShaking", target.getWolfShaking());
	map.put("isAngry", target.isAngry());
	map.put("collarColor", ColorUtils.vanillaBlockToColor(target.getCollarColor()).bitmask);

	return map;
}
 
Example #15
Source File: EntityEasterCow.java    From Moo-Fluids with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void initEntityAI() {
  tasks.addTask(0, new EntityAISwimming(this));
  tasks.addTask(1, new EntityAIPanic(this, 2.0D));
  tasks.addTask(2, new EntityAIMate(this, 1.0D));
  tasks.addTask(3, new EntityAITempt(this, 1.0D, Items.GOLDEN_CARROT, false));
  tasks.addTask(4, new EntityAIAvoidEntity<EntityPlayer>
      (this, EntityPlayer.class, 8.0F, 2.2D, 2.2D));
  tasks.addTask(4, new EntityAIAvoidEntity<EntityWolf>
      (this, EntityWolf.class, 10.0F, 2.2D, 2.2D));
  tasks.addTask(6, new EntityAIWander(this, 0.6D));
  tasks.addTask(7, new EntityAILookIdle(this));
  tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 10.0F));
}
 
Example #16
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public CustomSpawner()
{
    biomeList = new ArrayList<BiomeGenBase>();
    log.setParent(FMLLog.getLogger());
    try
    {
        for (BiomeGenBase biomegenbase : BiomeGenBase.biomeList)
        {
            if (biomegenbase == null)
            {
                continue;
            }
            biomeList.add(biomegenbase);
        }

        customCreatureSpawnList = new List[biomeList.size()];
        customMobSpawnList = new List[biomeList.size()];
        customAmbientSpawnList = new List[biomeList.size()];
        customAquaticSpawnList = new List[biomeList.size()];
        entityClasses = new List[4];
        vanillaClassList = new ArrayList<Class>();
        vanillaClassList.add(EntityChicken.class);
        vanillaClassList.add(EntityCow.class);
        vanillaClassList.add(EntityPig.class);
        vanillaClassList.add(EntitySheep.class);
        vanillaClassList.add(EntityWolf.class);
        vanillaClassList.add(EntitySquid.class);
        vanillaClassList.add(EntityOcelot.class);
        vanillaClassList.add(EntityBat.class);
        clearLists();
    }
    catch (Exception ex)
    {
        throw new RuntimeException(ex);
    }
}
 
Example #17
Source File: MoCTools.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public static int despawnVanillaAnimals(World worldObj, List[] classList)
{
    int count = 0;
    for (int j = 0; j < worldObj.loadedEntityList.size(); j++)
    {
        Entity entity = (Entity) worldObj.loadedEntityList.get(j);
        if ((entity instanceof EntityLiving) && (entity instanceof EntityCow || entity instanceof EntitySheep || entity instanceof EntityPig || entity instanceof EntityChicken || entity instanceof EntitySquid || entity instanceof EntityWolf))
        {
            count += entityDespawnCheck(worldObj, (EntityLiving) entity);

        }
    }
    return count;
}
 
Example #18
Source File: BiomeWoodlands.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BiomeWoodlands() {
	super(properties);
	decorator.treesPerChunk = 4;
	decorator.flowersPerChunk = 6;
	decorator.grassPerChunk = 16;

	this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 2, 4, 4));

	this.flowers.clear();
	for (BlockFlower.EnumFlowerType type : BlockFlower.EnumFlowerType.values()) {
		if (type.getBlockType() == BlockFlower.EnumFlowerColor.YELLOW) continue;
		if (type == BlockFlower.EnumFlowerType.BLUE_ORCHID) type = BlockFlower.EnumFlowerType.POPPY;
		addFlower(net.minecraft.init.Blocks.RED_FLOWER.getDefaultState().withProperty(net.minecraft.init.Blocks.RED_FLOWER.getTypeProperty(), type), 10);
	}
}
 
Example #19
Source File: MoCEntityMob.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public boolean entitiesToIgnore(Entity entity)
{
    return ((!(entity instanceof EntityLiving)) 
            || (entity instanceof EntityMob)
            || (entity instanceof MoCEntityEgg)
            || (entity instanceof EntityPlayer && this.getIsTamed()) 
            || (entity instanceof MoCEntityKittyBed) || (entity instanceof MoCEntityLitterBox) 
            || (this.getIsTamed() && (entity instanceof MoCEntityAnimal && ((MoCEntityAnimal) entity).getIsTamed())) 
            || ((entity instanceof EntityWolf) && !(MoCreatures.proxy.attackWolves)) 
            || ((entity instanceof MoCEntityHorse) && !(MoCreatures.proxy.attackHorses))

    );
}
 
Example #20
Source File: BiomeAutumnalWoodedHills.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public BiomeAutumnalWoodedHills() {
    super(properties);
    decorator.treesPerChunk = 10;
    decorator.flowersPerChunk = 4;
    decorator.grassPerChunk = 6;

    this.spawnableCreatureList.add(new SpawnListEntry(EntityWolf.class, 5, 4, 4));
}
 
Example #21
Source File: CraftWolf.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntityWolf getHandle() {
    return (EntityWolf) entity;
}
 
Example #22
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 4 votes vote down vote up
protected final int entityDespawnCheck(WorldServer worldObj, EntityLiving entityliving)
{
    
    if (entityliving instanceof EntityWolf && ((EntityWolf) entityliving).isTamed()) { return 0; }
    if (isNearTorch(entityliving, 8D, worldObj)) { return 0; }

    /*if (!(entityliving instanceof EntityCow 
    		|| entityliving instanceof EntitySheep 
    		|| entityliving instanceof EntityChicken 
    		|| entityliving instanceof EntityPig
    		|| entityliving instanceof EntityOcelot
    		|| entityliving instanceof EntitySquid
    		))
    {
    	return 0;
    }*/
    
    EntityPlayer entityplayer = worldObj.getClosestPlayerToEntity(entityliving, -1D);
    if (entityplayer != null) //entityliving.canDespawn() && 
    {
        double d = ((Entity) (entityplayer)).posX - entityliving.posX;
        double d1 = ((Entity) (entityplayer)).posY - entityliving.posY;
        double d2 = ((Entity) (entityplayer)).posZ - entityliving.posZ;
        double d3 = d * d + d1 * d1 + d2 * d2;
        if (d3 > 16384D)
        {
            entityliving.setDead();
            return 1;
        }
        if (entityliving.getAge() > 600 && worldObj.rand.nextInt(800) == 0)
        {
            if (d3 < 1024D)
            {
                //entityliving.attackEntityFrom(DamageSource.generic, 0);
            }
            else
            {
                entityliving.setDead();
                return 1;
            }
        }
    }
    return 0;
}
 
Example #23
Source File: CraftWolf.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftWolf(CraftServer server, EntityWolf wolf) {
    super(server, wolf);
}
 
Example #24
Source File: WolfMob.java    From ForgeHax with MIT License 4 votes vote down vote up
@Override
protected MobTypeEnum getMobTypeUnchecked(Entity entity) {
  EntityWolf wolf = (EntityWolf) entity;
  return wolf.isAngry() ? MobTypeEnum.HOSTILE : MobTypeEnum.NEUTRAL;
}
 
Example #25
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 #26
Source File: WolfMob.java    From ForgeHax with MIT License 4 votes vote down vote up
@Override
public boolean isMobType(Entity entity) {
  return entity instanceof EntityWolf;
}