Java Code Examples for net.minecraft.entity.passive.EntitySheep

The following are top voted examples for showing how to use net.minecraft.entity.passive.EntitySheep. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: DecompiledMinecraft   File: ItemDye.java   View source code 6 votes vote down vote up
/**
 * Returns true if the item can be used on the given entity, e.g. shears on sheep.
 */
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target)
{
    if (target instanceof EntitySheep)
    {
        EntitySheep entitysheep = (EntitySheep)target;
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
        {
            entitysheep.setFleeceColor(enumdyecolor);
            --stack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 2
Project: DecompiledMinecraft   File: ItemDye.java   View source code 6 votes vote down vote up
/**
 * Returns true if the item can be used on the given entity, e.g. shears on sheep.
 */
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target)
{
    if (target instanceof EntitySheep)
    {
        EntitySheep entitysheep = (EntitySheep)target;
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
        {
            entitysheep.setFleeceColor(enumdyecolor);
            --stack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 3
Project: BaseClient   File: ItemDye.java   View source code 6 votes vote down vote up
/**
 * Returns true if the item can be used on the given entity, e.g. shears on sheep.
 */
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target)
{
    if (target instanceof EntitySheep)
    {
        EntitySheep entitysheep = (EntitySheep)target;
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
        {
            entitysheep.setFleeceColor(enumdyecolor);
            --stack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 4
Project: BaseClient   File: ItemDye.java   View source code 6 votes vote down vote up
/**
 * Returns true if the item can be used on the given entity, e.g. shears on sheep.
 */
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target)
{
    if (target instanceof EntitySheep)
    {
        EntitySheep entitysheep = (EntitySheep)target;
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
        {
            entitysheep.setFleeceColor(enumdyecolor);
            --stack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 5
Project: connor41-etfuturum2   File: ServerEventHandler.java   View source code 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void dropEvent(LivingDropsEvent event) {
	if (event.entityLiving.worldObj.isRemote)
		return;

	if (EtFuturum.enableSkullDrop)
		dropHead(event.entityLiving, event.source, event.lootingLevel, event.drops);

	Random rand = event.entityLiving.worldObj.rand;
	if (EtFuturum.enableMutton && event.entityLiving instanceof EntitySheep) {
		int amount = rand.nextInt(3) + 1 + rand.nextInt(1 + event.lootingLevel);
		for (int i = 0; i < amount; i++)
			if (event.entityLiving.isBurning())
				addDrop(new ItemStack(ModItems.cooked_mutton), event.entityLiving, event.drops);
			else
				addDrop(new ItemStack(ModItems.raw_mutton), event.entityLiving, event.drops);
	}
}
 
Example 6
Project: modName   File: BiomeTundra.java   View source code 6 votes vote down vote up
public BiomeTundra() {
    super(new BiomeProperties("Tundra")
            .setBaseHeight(0.325f)
            .setHeightVariation(0.05f)
            .setTemperature(0.2f) // 0.25f
            .setRainfall(0.45f)
    );

    this.setRegistryName(Ref.MODID+":steppe");
    this.decorator.treesPerChunk = 1;
    this.decorator.grassPerChunk = 10;
    this.decorator.flowersPerChunk = 2;
    this.decorator.reedsPerChunk = -999;
    this.decorator.cactiPerChunk = -999;

    this.spawnableCreatureList.clear();
    this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityRabbit.class, 10, 2, 3));
    this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntitySheep.class, 12, 1, 5));
    Ref.BIOMES.add(this);
}
 
Example 7
Project: uniquecrops   File: EmblemRainbow.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onSheared(EntityInteractSpecific event) {
	
	ItemStack rainbow = BaublesApi.getBaublesHandler((EntityPlayer)event.getEntityPlayer()).getStackInSlot(6);
	if (rainbow == null || (rainbow != null && rainbow.getItem() != this)) return;
	
	if (!(event.getTarget() instanceof IShearable)) return;
	if (!(event.getTarget() instanceof EntitySheep) || (event.getTarget() instanceof EntitySheep && ((EntitySheep)event.getTarget()).getSheared())) return;
	if (event.getItemStack() == null || (event.getItemStack() != null && !(event.getItemStack().getItem() instanceof ItemShears))) return;
	
	int fortune = EnchantmentHelper.getEnchantmentLevel(Enchantments.FORTUNE, event.getItemStack());
	if (!event.getWorld().isRemote) {
		List<ItemStack> wools = ((IShearable)event.getTarget()).onSheared(event.getItemStack(), event.getWorld(), event.getPos(), fortune);
		for (ItemStack is : wools) {
			Random rand = new Random();
			is.setItemDamage(rand.nextInt(15));
			EntityItem wool = new EntityItem(event.getWorld(), event.getTarget().posX, event.getTarget().posY, event.getTarget().posZ, is);
			event.getWorld().spawnEntityInWorld(wool);
		}
	}
}
 
Example 8
Project: Backmemed   File: ItemDye.java   View source code 6 votes vote down vote up
/**
 * Returns true if the item can be used on the given entity, e.g. shears on sheep.
 */
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand)
{
    if (target instanceof EntitySheep)
    {
        EntitySheep entitysheep = (EntitySheep)target;
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
        {
            entitysheep.setFleeceColor(enumdyecolor);
            stack.func_190918_g(1);
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 9
Project: Backmemed   File: LayerWolfCollar.java   View source code 6 votes vote down vote up
public void doRenderLayer(EntityWolf entitylivingbaseIn, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
    if (entitylivingbaseIn.isTamed() && !entitylivingbaseIn.isInvisible())
    {
        this.wolfRenderer.bindTexture(WOLF_COLLAR);
        float[] afloat = EntitySheep.getDyeRgb(entitylivingbaseIn.getCollarColor());

        if (Config.isCustomColors())
        {
            afloat = CustomColors.getWolfCollarColors(entitylivingbaseIn.getCollarColor(), afloat);
        }

        GlStateManager.color(afloat[0], afloat[1], afloat[2]);
        this.wolfRenderer.getMainModel().render(entitylivingbaseIn, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
    }
}
 
Example 10
Project: Backmemed   File: TileEntityEndGatewayRenderer.java   View source code 6 votes vote down vote up
public void renderTileEntityAt(TileEntityEndPortal te, double x, double y, double z, float partialTicks, int destroyStage)
{
    GlStateManager.disableFog();
    TileEntityEndGateway tileentityendgateway = (TileEntityEndGateway)te;

    if (tileentityendgateway.isSpawning() || tileentityendgateway.isCoolingDown())
    {
        GlStateManager.alphaFunc(516, 0.1F);
        this.bindTexture(END_GATEWAY_BEAM_TEXTURE);
        float f = tileentityendgateway.isSpawning() ? tileentityendgateway.getSpawnPercent(partialTicks) : tileentityendgateway.getCooldownPercent(partialTicks);
        double d0 = tileentityendgateway.isSpawning() ? 256.0D - y : 50.0D;
        f = MathHelper.sin(f * (float)Math.PI);
        int i = MathHelper.floor((double)f * d0);
        float[] afloat = EntitySheep.getDyeRgb(tileentityendgateway.isSpawning() ? EnumDyeColor.MAGENTA : EnumDyeColor.PURPLE);
        TileEntityBeaconRenderer.renderBeamSegment(x, y, z, (double)partialTicks, (double)f, (double)tileentityendgateway.getWorld().getTotalWorldTime(), 0, i, afloat, 0.15D, 0.175D);
        TileEntityBeaconRenderer.renderBeamSegment(x, y, z, (double)partialTicks, (double)f, (double)tileentityendgateway.getWorld().getTotalWorldTime(), 0, -i, afloat, 0.15D, 0.175D);
    }

    super.renderTileEntityAt(te, x, y, z, partialTicks, destroyStage);
    GlStateManager.enableFog();
}
 
Example 11
Project: CustomWorldGen   File: ItemDye.java   View source code 6 votes vote down vote up
/**
 * Returns true if the item can be used on the given entity, e.g. shears on sheep.
 */
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer playerIn, EntityLivingBase target, EnumHand hand)
{
    if (target instanceof EntitySheep)
    {
        EntitySheep entitysheep = (EntitySheep)target;
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (!entitysheep.getSheared() && entitysheep.getFleeceColor() != enumdyecolor)
        {
            entitysheep.setFleeceColor(enumdyecolor);
            --stack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 12
Project: PonySocks2   File: PonySocks.java   View source code 6 votes vote down vote up
private static void initSockLists() {
	if (socksOrdered == null) {
		socksOrdered = new ArrayList<>(256);

		for (int i = 0; i < 256; i++) {
			ItemStack sock = new ItemStack(PonySocks.sock, 1, 0);
			sock.setTagCompound(new NBTTagCompound());
			sock.getTagCompound().setInteger("color1", RecipeDyeableBase.fromFloats(EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(i & 15))));
			sock.getTagCompound().setInteger("color2", RecipeDyeableBase.fromFloats(EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(i >> 4))));
			socksOrdered.add(sock);
		}

		socksShuffled = Lists.newArrayList(socksOrdered);
		Collections.shuffle(socksShuffled);
	}
}
 
Example 13
Project: ExtraUtilities   File: RenderItemGlove.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void renderEquippedGlove(final RenderPlayerEvent.Specials.Post event) {
    if (event.entityPlayer == null) {
        return;
    }
    final ItemStack heldItem = event.entityPlayer.getHeldItem();
    if (heldItem == null || heldItem.getItem() != ExtraUtils.glove) {
        return;
    }
    final int dmg = heldItem.getItemDamage();
    final RenderPlayer renderplayer = event.renderer;
    float[] col = EntitySheep.fleeceColorTable[ItemGlove.getColIndex(1, dmg)];
    GL11.glColor3f(col[0], col[1], col[2]);
    Minecraft.getMinecraft().getTextureManager().bindTexture(RenderItemGlove.glove1);
    renderplayer.modelBipedMain.bipedRightArm.render(0.0625f);
    col = EntitySheep.fleeceColorTable[ItemGlove.getColIndex(0, dmg)];
    GL11.glColor3f(col[0], col[1], col[2]);
    Minecraft.getMinecraft().getTextureManager().bindTexture(RenderItemGlove.glove2);
    renderplayer.modelBipedMain.bipedRightArm.render(0.0625f);
}
 
Example 14
Project: ShearMadness   File: ChanceCubeBehaviour.java   View source code 6 votes vote down vote up
@Override
public void onBehaviourStarted(BlockPos currentPos) {
    if (type != ChanceCubeType.GIANT) return;

    EntitySheep entity = getEntity();
    World worldObj = entity.worldObj;
    final int distance = ChanceCubesConfiguration.distance.getInt();
    ShearMadnessMod.CHANNEL.sendToAllAround(
            new PlayCustomSoundMessage(
                    entity.posX, entity.posY, entity.posZ,
                    ChanceCubeSounds.chancecube_giantcubespawned, SoundCategory.NEUTRAL,
                    0.3F, 1.0f,
                    true
            ),
            new NetworkRegistry.TargetPoint(
                    worldObj.provider.getDimension(),
                    entity.posX, entity.posY, entity.posZ,
                    distance
            )
    );
}
 
Example 15
Project: ShearMadness   File: VanillaInteractions.java   View source code 6 votes vote down vote up
@SubscribeEvent
public static void onInteraction(ShearMadnessSpecialInteractionEvent event) {
    final ItemStack itemStack = event.getItemStack();
    final EntitySheep sheep = event.getSheep();
    final EntityPlayer player = event.getPlayer();
    if (ItemStackHelper.isStackForBlock(itemStack, Blocks.ANVIL)) {
        player.displayGui(new AnvilInteraction(event.getWorld(), sheep));
    }
    if (ItemStackHelper.isStackForBlock(itemStack, Blocks.CRAFTING_TABLE)) {
        player.displayGui(new WorkbenchInteraction(event.getWorld(), sheep));
    }
    if (ItemStackHelper.isStackForBlock(itemStack, Blocks.ENCHANTING_TABLE)) {
        player.displayGui(new EnchantmentInteraction(event.getWorld(), sheep));
    }
    if (ItemStackHelper.isStackForBlock(itemStack, Blocks.NOTEBLOCK)) {
        NoteBlockBehaviour.tuneNoteBlockSheep(event.getSheep());
    }
}
 
Example 16
Project: ShearMadness   File: Shearing.java   View source code 6 votes vote down vote up
public static void shearSheep(ItemStack itemStack, EntitySheep sheep, IChiseledSheepCapability capability)
{
    if (Settings.Shearing.getBehaviour() == ShearBehaviour.CannotShear) {
        //TODO: Play shear cancelled Sound.
        return;
    }

    sheep.setSheared(true);

    //TODO: Add support for facade drop.
    //Select the item to drop.
    final ItemStack itemToDrop = capability.getChiselItemStack().copy();
    itemToDrop.stackSize = 1;

    ItemStackUtils.dropItem(sheep, itemToDrop);

    sheep.playSound(SoundEvents.ENTITY_SHEEP_SHEAR, 1.0F, 1.0F);
    itemStack.damageItem(1, sheep);

    if (Settings.Shearing.getBehaviour() == ShearBehaviour.RevertSheep) {
        capability.unChisel();
        CHANNEL.sendToAll(new SheepChiseledMessage(sheep));
    }
}
 
Example 17
Project: Gravestone-mod-Extended   File: EntityZombieDog.java   View source code 6 votes vote down vote up
public EntityZombieDog(World world, boolean isHusk) {
    super(world);

    this.setMobType(isHusk ? EnumUndeadMobType.HUSK : EnumUndeadMobType.ZOMBIE);

    ((PathNavigateGround) this.getNavigator()).setCanSwim(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackMelee(this, 1, false));
    this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1));
    this.tasks.addTask(6, new EntityAIWander(this, 1));
    this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, 1, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityVillager.class, false));
    if (ExtendedConfig.zombiePetsAttackPets) {
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityWolf.class, false));
        this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityOcelot.class, false));
    }
    this.targetTasks.addTask(4, new EntityAINearestAttackableHorse(this, false));
    if (ExtendedConfig.zombiePetsAttackAnimals) {
        this.targetTasks.addTask(4, new EntityAINearestAttackableTarget(this, EntitySheep.class, false));
    }
}
 
Example 18
Project: Tannery   File: EntityDropsHandler.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onLivingDrops(LivingDropsEvent event)
{
	Entity e = event.entity;
	List<EntityItem> drops = event.drops;
	// Remove all drops from cows, sheep and pigs, add carcass drop
	if (e instanceof EntityCow || e instanceof EntityPig || e instanceof EntitySheep)
	{
		EntityAnimal a = (EntityAnimal) e;
		Iterator<EntityItem> it = drops.iterator();
		while (it.hasNext())
		{
			EntityItem i = it.next();
			it.remove();
		}

		if (a.getGrowingAge() == 0)
		{
			if (a instanceof EntityCow) a.dropItem(TanneryItems.bloodyCowCarcass, 1);
			else if (a instanceof EntityPig) a.dropItem(TanneryItems.bloodyPigCarcass, 1);
			else if (a instanceof EntitySheep) a.dropItem(TanneryItems.bloodySheepCarcass, 1);
		}
	}
}
 
Example 19
Project: FairyFactions   File: FairyJob.java   View source code 6 votes vote down vote up
public ArrayList getSheep( final World world ) {
	final List list = world.getEntitiesWithinAABB( EntitySheep.class, fairy.boundingBox.expand( 5D, 5D, 5D ) );

	if ( list.size() < 1 ) {
		return null;
	}

	final ArrayList list2 = new ArrayList();

	for ( int i = 0; i < list.size(); i++ ) {
		final EntitySheep entity1 = (EntitySheep) list.get( i );

		final int fleeingTick = ReflectionHelper.getPrivateValue(EntityCreature.class, entity1, MCP_FLEEINGTICK);
		if ( fairy.canEntityBeSeen( entity1 ) && entity1.getHealth() > 0 && entity1.getEntityToAttack() == null
				&& fleeingTick <= 0 && entity1.getGrowingAge() >= 0 && !entity1.getSheared() ) {
			list2.add( entity1 );
		}
	}

	if ( list2.size() <= 0 ) {
		return null;
	} else {
		return list2;
	}
}
 
Example 20
Project: FairyFactions   File: FairyJob.java   View source code 6 votes vote down vote up
private boolean onShearingUse( final ItemStack stack, final World world ) {
	final ArrayList sheep = getSheep( world );
	triedShearing = true;

	if ( sheep == null ) {
		return false;
	}
	for (Object one_sheep_raw : sheep) {
		EntitySheep one_sheep = (EntitySheep) one_sheep_raw;
		if (!one_sheep.getSheared()) {
			fairy.armSwing( !fairy.didSwing );
			fairy.setTempItem( stack.getItem() );
			stack.damageItem( 1, fairy );
			fairy.attackTime = 30;

			one_sheep.entityDropItem(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, one_sheep.getFleeceColor()), 0.0F);
			one_sheep.setSheared(true);
			break; // shear one at a time... looks better.
		}
	}

	return false;
}
 
Example 21
Project: Dark-Utilities   File: FeatureSheepArmor.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onEntityUpdate (LivingUpdateEvent event) {

    final EntityLivingBase entity = event.getEntityLiving();

    if (entity instanceof EntitySheep) {

        final ModifiableAttributeInstance instance = (ModifiableAttributeInstance) entity.getEntityAttribute(SharedMonsterAttributes.ARMOR);
        final boolean hasModifier = instance.hasModifier(sheepArmor);
        final boolean isSheared = ((EntitySheep) entity).getSheared();

        if (!isSheared && !hasModifier) {
            instance.applyModifier(sheepArmor);
        }
        else if (isSheared && hasModifier) {
            instance.removeModifier(sheepArmor);
        }
    }
}
 
Example 22
Project: Survivalist   File: StringEventHandling.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void entityDrops(LivingDropsEvent ev)
{
    Entity entity = ev.getEntity();
    if (!(entity instanceof EntitySheep))
        return;

    List<EntityItem> drops = ev.getDrops();
    if (drops instanceof ImmutableList)
    {
        Survivalist.logger.warn("WARNING: Some mod is returning an ImmutableList, replacing drops will NOT be possible.");
        return;
    }

    if (rnd.nextFloat() < 0.25f)
        drops.add(new EntityItem(entity.getEntityWorld(), entity.posX, entity.posY, entity.posZ, new ItemStack(Items.STRING)));
}
 
Example 23
Project: Factorization   File: TileEntityLightningRod.java   View source code 6 votes vote down vote up
@Override
public boolean activate(EntityPlayer player, EnumFacing side) {
    if (worldObj.isRemote) return true;
    if (sheep != null) return false;
    Coord at = new Coord(this);
    AxisAlignedBB box = SpaceUtil.newBox(at.add3(-7), at.add3(+7));
    for (Entity ent : worldObj.getEntitiesWithinAABBExcludingEntity(player, box)) {
        if (ent instanceof EntitySheep) {
            EntitySheep s = (EntitySheep) ent;
            if (s.isChild()) continue;
            if (s.getSheared()) continue;
            if (powered) {
                new Notice(this, "").withStyle(Style.DRAWITEM).withItem(new ItemStack(Blocks.redstone_torch)).sendTo(player);
                return false;
            }
            if (s.getLeashedToEntity() == player) {
                sheep.clearLeashed(true, !PlayerUtil.isPlayerCreative(player));
            }
            sheep = s;
            return true;
        }
    }
    return false;
}
 
Example 24
Project: Et-Futurum   File: ServerEventHandler.java   View source code 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void dropEvent(LivingDropsEvent event) {
	if (event.entityLiving.worldObj.isRemote)
		return;

	if (EtFuturum.enableSkullDrop)
		dropHead(event.entityLiving, event.source, event.lootingLevel, event.drops);

	Random rand = event.entityLiving.worldObj.rand;
	if (EtFuturum.enableMutton && event.entityLiving instanceof EntitySheep) {
		int amount = rand.nextInt(3) + 1 + rand.nextInt(1 + event.lootingLevel);
		for (int i = 0; i < amount; i++)
			if (event.entityLiving.isBurning())
				addDrop(new ItemStack(ModItems.cooked_mutton), event.entityLiving, event.drops);
			else
				addDrop(new ItemStack(ModItems.raw_mutton), event.entityLiving, event.drops);
	}
}
 
Example 25
Project: ARKCraft-Code   File: EntityRaptorTest.java   View source code 6 votes vote down vote up
public EntityRaptorTest(World world)
    {
        super(world);

//        this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));

        ((PathNavigateGround) this.getNavigator()).func_179690_a(true);
        this.tasks.addTask(0, new EntityAISwimming(this));
        this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
        this.tasks.addTask(5, new EntityAIMoveTowardsRestriction(this, 1.0D));
        this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
        this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
        this.tasks.addTask(8, new EntityAILookIdle(this));
        attackPlayerTarget = new EntityAINearestAttackableTarget(this, EntityPlayer.class, true);
        this.targetTasks.addTask(1, attackPlayerTarget);

        int p = 1;
        this.targetTasks.addTask(p++, new EntityDinoAIOwnerHurtByTarget(this));
        this.targetTasks.addTask(p++, new EntityDinoAIOwnerHurtTarget(this));
        this.targetTasks.addTask(p++, new EntityAIHurtByTarget(this, true));
        this.targetTasks.addTask(p++, new EntityDinoAITargetNonTamed(this, EntitySheep.class, false));

        type = RaptorType.ALBINO;
//        type.setRandomRaptorType(); // Set to a random type for now
    }
 
Example 26
Project: It-s-About-Time-Minecraft-Mod   File: EntityVelociraptor.java   View source code 6 votes vote down vote up
public EntityVelociraptor(World world)
  {
      super(world);
      this.setSize(1F, 0.6F);
      isCarnivore = true;
      minSize = 0.2F;
maxSize = 1.4F;
adultAge = 10;
maxAge = 16;
      this.tasks.addTask(8, new EntityAITempt(this, 1.2D, Items.chicken, false));
      this.tasks.addTask(10, new MobAIWatchClosestWhenAwake(this, EntityPlayer.class, 8.0F));
      this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityChicken.class, 200, false));
      this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityCow.class, 200, false));
      this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
      this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityCompsognathus.class, 200, false));
      this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityPig.class, 200, false));

      this.setTamed(false);
  }
 
Example 27
Project: It-s-About-Time-Minecraft-Mod   File: RenderVelociraptor.java   View source code 6 votes vote down vote up
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityVelociraptor mob, int pass, float f1)
{
 if (pass == 0)
 {
	 this.bindTexture(getEntityTexture(mob));
	 return 1;
 }
 
 else if (pass == 1 && mob.isTamed())
 {
	 this.bindTexture(collarTexture);
	 int j = mob.getCollarColor();
	 GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]);
	 return 1;
 }
 else
 {
	 return -1;
 }
}
 
Example 28
Project: It-s-About-Time-Minecraft-Mod   File: RenderCompsognathus.java   View source code 6 votes vote down vote up
/**
* Queries whether should render the specified pass or not.
*/
protected int shouldRenderPass(EntityCompsognathus mob, int pass, float f1)
{
 if (pass == 0)
 {
	 this.bindTexture(getEntityTexture(mob));
	 return 1;
 }
 if (pass == 1 && mob.isAngry())
 {
	 this.bindTexture(EyeTexture);
	 return 2;
 }
 else if (pass == 1 && mob.isTamed())
 {
	 this.bindTexture(CollarTexture);
	 int j = mob.getCollarColor();
	 GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]);
	 return 1;
 }
 else
 {
	 return -1;
 }
}
 
Example 29
Project: Resilience-Client-Source   File: ItemDye.java   View source code 6 votes vote down vote up
/**
 * Returns true if the item can be used on the given entity, e.g. shears on sheep.
 */
public boolean itemInteractionForEntity(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, EntityLivingBase par3EntityLivingBase)
{
    if (par3EntityLivingBase instanceof EntitySheep)
    {
        EntitySheep var4 = (EntitySheep)par3EntityLivingBase;
        int var5 = BlockColored.func_150032_b(par1ItemStack.getItemDamage());

        if (!var4.getSheared() && var4.getFleeceColor() != var5)
        {
            var4.setFleeceColor(var5);
            --par1ItemStack.stackSize;
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 30
Project: Resilience-Client-Source   File: RenderWolf.java   View source code 6 votes vote down vote up
/**
 * Queries whether should render the specified pass or not.
 */
protected int shouldRenderPass(EntityWolf par1EntityWolf, int par2, float par3)
{
    if (par2 == 0 && par1EntityWolf.getWolfShaking())
    {
        float var5 = par1EntityWolf.getBrightness(par3) * par1EntityWolf.getShadingWhileShaking(par3);
        this.bindTexture(wolfTextures);
        GL11.glColor3f(var5, var5, var5);
        return 1;
    }
    else if (par2 == 1 && par1EntityWolf.isTamed())
    {
        this.bindTexture(wolfCollarTextures);
        int var4 = par1EntityWolf.getCollarColor();
        GL11.glColor3f(EntitySheep.fleeceColorTable[var4][0], EntitySheep.fleeceColorTable[var4][1], EntitySheep.fleeceColorTable[var4][2]);
        return 1;
    }
    else
    {
        return -1;
    }
}
 
Example 31
Project: ZeroQuest   File: EntityForisZertum.java   View source code 6 votes vote down vote up
public EntityForisZertum(World p_i1696_1_)
{
    super(p_i1696_1_);
    this.setSize(0.6F, 1.5F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
    this.tasks.addTask(6, aiFetchBone);
    this.tasks.addTask(7, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(8, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(9, new EntityCustomFZAIBeg(this, 8.0F));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(10, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
    this.setTamed(false);
    this.inventory = new InventoryPack(this);
}
 
Example 32
Project: ZeroQuest   File: EntityRedZertum.java   View source code 6 votes vote down vote up
public EntityRedZertum(World p_i1696_1_)
{
    super(p_i1696_1_);
    this.isImmuneToFire = true;
    this.setSize(0.6F, 1.5F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
    this.tasks.addTask(6, aiFetchBone);
    this.tasks.addTask(7, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(8, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(9, new EntityCustomRZAIBeg(this, 8.0F));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(10, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
    this.setTamed(false);
    this.inventory = new InventoryPack(this);
}
 
Example 33
Project: ZeroQuest   File: EntityJakan.java   View source code 6 votes vote down vote up
public EntityJakan(World p_i1696_1_)
{
    super(p_i1696_1_);
    this.setSize(2.6F, 2.6F);
    this.isImmuneToFire = true;
    this.stepHeight = 1;
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
    this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(8, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(8, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
    this.setTamed(false);
    this.inventory = new InventoryPack(this);
}
 
Example 34
Project: ZeroQuest   File: EntityIceZertum.java   View source code 6 votes vote down vote up
public EntityIceZertum(World p_i1696_1_)
  {
      super(p_i1696_1_);
      this.setSize(0.6F, 1.5F);
      this.getNavigator().setAvoidsWater(true);
      this.tasks.addTask(1, new EntityAISwimming(this));
      this.tasks.addTask(2, this.aiSit);
      this.tasks.addTask(3, new EntityAICustomLeapAtTarget(this, 0.4F));
this.tasks.addTask(4, new EntityAICustomArrowAttack(this, 0.1, 60, 10.0F));
      this.tasks.addTask(5, new EntityAIAttackOnCollide(this, 1.0D, true));
      this.tasks.addTask(6, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
      this.tasks.addTask(7, aiFetchBone);
      this.tasks.addTask(8, new EntityAIMate(this, 1.0D));
      this.tasks.addTask(9, new EntityAIWander(this, 1.0D));
      this.tasks.addTask(10, new EntityCustomIZAIBeg(this, 8.0F));
      this.tasks.addTask(11, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
      this.tasks.addTask(11, new EntityAILookIdle(this));
      this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
      this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
      this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
      this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
      this.setTamed(false);
      this.inventory = new InventoryPack(this);
  }
 
Example 35
Project: ZeroQuest   File: EntityZertum.java   View source code 6 votes vote down vote up
public EntityZertum(World p_i1696_1_)
{
    super(p_i1696_1_);
    this.setSize(0.6F, 1.5F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
    this.tasks.addTask(6, aiFetchBone);
    this.tasks.addTask(7, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(8, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(9, new EntityCustomZAIBeg(this, 8.0F));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(10, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
    this.setTamed(false);
    this.inventory = new InventoryPack(this);
}
 
Example 36
Project: ZeroQuest   File: EntityDarkZertum.java   View source code 6 votes vote down vote up
public EntityDarkZertum(World p_i1696_1_)
{
    super(p_i1696_1_);
    this.setSize(0.6F, 1.5F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
    this.tasks.addTask(6, aiFetchBone);
    this.tasks.addTask(7, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(8, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(9, new EntityCustomDarkZAIBeg(this, 8.0F));
    this.tasks.addTask(10, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(10, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntitySheep.class, 200, false));
    this.setTamed(false);
    this.inventory = new InventoryPack(this);
}
 
Example 37
Project: ZeroQuest   File: RenderZertum.java   View source code 6 votes vote down vote up
protected int func_82447_a(EntityZertum par1EntityZertum, int par2, float par3)
{
    if (par2 == 0 && par1EntityZertum.getWolfShaking())
    {
        float f1 = par1EntityZertum.getBrightness(par3) * par1EntityZertum.getShadingWhileShaking(par3);
        this.bindTexture(zertumTextures);
        GL11.glColor3f(f1, f1, f1);
        return 1;
    }
    else if (par2 == 1 && par1EntityZertum.isTamed())
    {
        this.bindTexture(ZertumCollarTextures);
        int j = par1EntityZertum.getCollarColor();
        GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]);
        return 1;
    }
    else if (par2 == 0 && par1EntityZertum.getHealth() <=10 &&  par1EntityZertum.isTamed())
    {
        this.bindTexture(ZertumDyingTextures);
        return 1;
    }
    else
    {
        return -1;
    }
}
 
Example 38
Project: ZeroQuest   File: RenderIceZertum.java   View source code 6 votes vote down vote up
protected int func_82447_a(EntityIceZertum par1EntityZertum, int par2, float par3)
{
    if (par2 == 0 && par1EntityZertum.getWolfShaking())
    {
        float f1 = par1EntityZertum.getBrightness(par3) * par1EntityZertum.getShadingWhileShaking(par3);
        this.bindTexture(IceZertumTextures);
        GL11.glColor3f(f1, f1, f1);
        return 1;
    }
    else if (par2 == 1 && par1EntityZertum.isTamed())
    {
        this.bindTexture(ZertumCollarTextures);
        int j = par1EntityZertum.getCollarColor();
        GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]);
        return 1;
    }
    else if (par2 == 0 && par1EntityZertum.getHealth() <=10 &&  par1EntityZertum.isTamed())
    {
        this.bindTexture(ZertumDyingTextures);
        return 1;
    }
    else
    {
        return -1;
    }
}
 
Example 39
Project: ZeroQuest   File: RenderRedZertum.java   View source code 6 votes vote down vote up
protected int func_82447_a(EntityRedZertum par1EntityZertum, int par2, float par3)
{
    if (par2 == 0 && par1EntityZertum.getWolfShaking())
    {
        float f1 = par1EntityZertum.getBrightness(par3) * par1EntityZertum.getShadingWhileShaking(par3);
        this.bindTexture(redZertumTextures);
        GL11.glColor3f(f1, f1, f1);
        return 1;
    }
    else if (par2 == 1 && par1EntityZertum.isTamed())
    {
        this.bindTexture(ZertumCollarTextures);
        int j = par1EntityZertum.getCollarColor();
        GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]);
        return 1;
    }
    else if (par2 == 0 && par1EntityZertum.getHealth() <=10 &&  par1EntityZertum.isTamed())
    {
        this.bindTexture(ZertumDyingTextures);
        return 1;
    }
    else
    {
        return -1;
    }
}
 
Example 40
Project: ZeroQuest   File: RenderDarkZertum.java   View source code 6 votes vote down vote up
protected int func_82447_a(EntityDarkZertum par1EntityZertum, int par2, float par3)
{
    if (par2 == 0 && par1EntityZertum.getWolfShaking())
    {
        float f1 = par1EntityZertum.getBrightness(par3) * par1EntityZertum.getShadingWhileShaking(par3);
        this.bindTexture(darkZertumTextures);
        GL11.glColor3f(f1, f1, f1);
        return 1;
    }
    else if (par2 == 1 && par1EntityZertum.isTamed())
    {
        this.bindTexture(ZertumCollarTextures);
        int j = par1EntityZertum.getCollarColor();
        GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]);
        return 1;
    }
    else if (par2 == 0 && par1EntityZertum.getHealth() <=10 &&  par1EntityZertum.isTamed())
    {
        this.bindTexture(ZertumDyingTextures);
        return 1;
    }
    else
    {
        return -1;
    }
}