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: BaseClient   File: ItemDye.java   Source Code and License 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: BaseClient   File: ItemDye.java   Source Code and License 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: connor41-etfuturum2   File: ServerEventHandler.java   Source Code and License 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 4
Project: modName   File: BiomeTundra.java   Source Code and License 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 5
Project: uniquecrops   File: EmblemRainbow.java   Source Code and License 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 6
Project: Backmemed   File: ItemDye.java   Source Code and License 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 7
Project: Backmemed   File: LayerWolfCollar.java   Source Code and License 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 8
Project: Backmemed   File: TileEntityEndGatewayRenderer.java   Source Code and License 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 9
Project: CustomWorldGen   File: ItemDye.java   Source Code and License 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 10
Project: PonySocks2   File: PonySocks.java   Source Code and License 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 11
Project: ExtraUtilities   File: RenderItemGlove.java   Source Code and License 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 12
Project: ShearMadness   File: ChanceCubeBehaviour.java   Source Code and License 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 13
Project: ShearMadness   File: VanillaInteractions.java   Source Code and License 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 14
Project: ShearMadness   File: Shearing.java   Source Code and License 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 15
Project: Gravestone-mod-Extended   File: EntityZombieDog.java   Source Code and License 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 16
Project: Tannery   File: EntityDropsHandler.java   Source Code and License 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 17
Project: FairyFactions   File: FairyJob.java   Source Code and License 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 18
Project: FairyFactions   File: FairyJob.java   Source Code and License 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 19
Project: Dark-Utilities   File: FeatureSheepArmor.java   Source Code and License 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 20
Project: Survivalist   File: StringEventHandling.java   Source Code and License 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 21
Project: Factorization   File: TileEntityLightningRod.java   Source Code and License 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 22
Project: Et-Futurum   File: ServerEventHandler.java   Source Code and License 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 23
Project: ARKCraft-Code   File: EntityRaptorTest.java   Source Code and License 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 24
Project: It-s-About-Time-Minecraft-Mod   File: EntityVelociraptor.java   Source Code and License 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 25
Project: It-s-About-Time-Minecraft-Mod   File: RenderVelociraptor.java   Source Code and License 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 26
Project: It-s-About-Time-Minecraft-Mod   File: RenderCompsognathus.java   Source Code and License 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 27
Project: Resilience-Client-Source   File: ItemDye.java   Source Code and License 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 28
Project: Resilience-Client-Source   File: RenderWolf.java   Source Code and License 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 29
Project: ZeroQuest   File: EntityForisZertum.java   Source Code and License 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 30
Project: ZeroQuest   File: EntityRedZertum.java   Source Code and License 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 31
Project: ZeroQuest   File: EntityJakan.java   Source Code and License 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 32
Project: ZeroQuest   File: EntityIceZertum.java   Source Code and License 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 33
Project: ZeroQuest   File: EntityZertum.java   Source Code and License 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 34
Project: ZeroQuest   File: EntityDarkZertum.java   Source Code and License 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 35
Project: ZeroQuest   File: RenderZertum.java   Source Code and License 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 36
Project: ZeroQuest   File: RenderIceZertum.java   Source Code and License 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 37
Project: ZeroQuest   File: RenderRedZertum.java   Source Code and License 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 38
Project: ZeroQuest   File: RenderDarkZertum.java   Source Code and License 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;
    }
}
 
Example 39
Project: ZeroQuest   File: RenderForisZertum.java   Source Code and License 6 votes vote down vote up
protected int func_82447_a(EntityForisZertum par1EntityZertum, int par2, float par3)
{
    if (par2 == 0 && par1EntityZertum.getWolfShaking())
    {
        float f1 = par1EntityZertum.getBrightness(par3) * par1EntityZertum.getShadingWhileShaking(par3);
        this.bindTexture(forisZertumTextures);
        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: projectzulu1.7.10   File: ChangeVanillaDrops.java   Source Code and License 6 votes vote down vote up
@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
public void onEvent(LivingDropsEvent event)
{
    if (event.entity instanceof EntitySheep)
    {
        // DEBUG
    	Optional<?> itemBlock = ItemList.muttonRaw;
    	
    	if (itemBlock.isPresent()) {
    	ItemStack itemStackToDrop = new ItemStack((Item)itemBlock.get());
    	
        event.drops.add(new EntityItem(event.entity.worldObj, event.entity.posX, 

              event.entity.posY, event.entity.posZ, itemStackToDrop));
    	}
    }
}
 
Example 41
Project: ZeroQuest   File: RenderJakanPrime.java   Source Code and License 6 votes vote down vote up
protected int func_82447_a(EntityJakanPrime par1EntityJakanPrime, int par2, float par3)
{
    float f1;
    
    if (par2 == 1 && par1EntityJakanPrime.isTamed())
    {
        this.bindTexture(saddledJakanPrimeTextures);
        f1 = 1.0F;
        int j = par1EntityJakanPrime.getCollarColor();
        GL11.glColor3f(f1 * EntitySheep.fleeceColorTable[j][0], f1 * EntitySheep.fleeceColorTable[j][1], f1 * EntitySheep.fleeceColorTable[j][2]);
        return 1;
    }
    else
    {
        return -1;
    }
}
 
Example 42
Project: ZeroQuest   File: RenderJakan.java   Source Code and License 6 votes vote down vote up
protected int func_82447_a(EntityJakan par1EntityJakan, int par2, float par3)
{
    float f1;
    
    if (par2 == 1 && par1EntityJakan.isTamed())
    {
        this.bindTexture(saddledJakanTextures);
        f1 = 1.0F;
        int j = par1EntityJakan.getCollarColor();
        GL11.glColor3f(f1 * EntitySheep.fleeceColorTable[j][0], f1 * EntitySheep.fleeceColorTable[j][1], f1 * EntitySheep.fleeceColorTable[j][2]);
        return 1;
    }
    else
    {
        return -1;
    }
}
 
Example 43
Project: ZeroQuest   File: EntityDestroZertum.java   Source Code and License 6 votes vote down vote up
public EntityDestroZertum(World par1World)
{
    super(par1World);
    this.setSize(0.6F, 0.8F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiCSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityCustomAIFollowOwner(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 EntityDAIBeg(this, 8.0F));
    this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(9, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityCustomAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityCustomAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(4, new EntityCustomAITargetNonTamed(this, EntitySheep.class, 200, false));
    this.setTamed(false);
    this.inventory = new InventoryDestroPack(this);
}
 
Example 44
Project: ZeroQuest   File: EntityRedZertum.java   Source Code and License 6 votes vote down vote up
public EntityRedZertum(World par1World)
{
    super(par1World);
    this.setSize(0.6F, 0.8F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiCSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityCustomAIFollowOwner(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 EntityRZAIBeg(this, 8.0F));
    this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(9, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityCustomAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityCustomAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
    this.targetTasks.addTask(4, new EntityCustomAITargetNonTamed(this, EntitySheep.class, 200, false));
    this.setTamed(false);
    this.inventory = new InventoryRedPack(this);
}
 
Example 45
Project: ZeroQuest   File: EntityZertum.java   Source Code and License 6 votes vote down vote up
public EntityZertum(World par1World)
{
    super(par1World);
    this.setSize(0.6F, 0.8F);
    this.getNavigator().setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiCSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityCustomAIFollowOwner(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 EntityZAIBeg(this, 8.0F));
    this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(9, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityCustomAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityCustomAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true));
    //this.targetTasks.addTask(4, new EntityAIModeAttackTarget(this));
    this.targetTasks.addTask(5, new EntityCustomAITargetNonTamed(this, EntitySheep.class, 200, false));
    this.setTamed(false);
    this.inventory = new InventoryPack(this);
}
 
Example 46
Project: RuneCraftery   File: RenderWolf.java   Source Code and License 6 votes vote down vote up
protected int func_82447_a(EntityWolf p_82447_1_, int p_82447_2_, float p_82447_3_) {
   float var4;
   if(p_82447_2_ == 0 && p_82447_1_.func_70921_u()) {
      var4 = p_82447_1_.func_70013_c(p_82447_3_) * p_82447_1_.func_70915_j(p_82447_3_);
      this.func_110776_a(field_110917_a);
      GL11.glColor3f(var4, var4, var4);
      return 1;
   } else if(p_82447_2_ == 1 && p_82447_1_.func_70909_n()) {
      this.func_110776_a(field_110918_h);
      var4 = 1.0F;
      int var5 = p_82447_1_.func_82186_bH();
      GL11.glColor3f(var4 * EntitySheep.field_70898_d[var5][0], var4 * EntitySheep.field_70898_d[var5][1], var4 * EntitySheep.field_70898_d[var5][2]);
      return 1;
   } else {
      return -1;
   }
}
 
Example 47
Project: ExpandedRailsMod   File: ItemDye.java   Source Code and License 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 48
Project: reptiles   File: EntityMegalania.java   Source Code and License 6 votes vote down vote up
public EntityMegalania(World world) {
    super(world);
    float scaleFactor = 2.5f;
    setSize(1.0F * scaleFactor, 0.6F * scaleFactor);
    setPathPriority(PathNodeType.WATER, 0.0f);
    setHealth(60.0f);

    tasks.addTask(0, new EntityAISwimming(this));
    tasks.addTask(1, new EntityAILeapAtTarget(this, 0.4F));
    tasks.addTask(2, new EntityAIAttackMelee(this, 1.0D, true));
    tasks.addTask(3, new EntityAIWander(this, 0.9));
    tasks.addTask(4, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    tasks.addTask(5, new EntityAILookIdle(this));

    targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    targetTasks.addTask(2, new EntityAINearestAttackableTarget<>(this, EntityChicken.class, true));
    targetTasks.addTask(3, new EntityAINearestAttackableTarget<>(this, EntityPig.class, true));
    targetTasks.addTask(4, new EntityAINearestAttackableTarget<>(this, EntityPlayer.class, true));
    targetTasks.addTask(5, new EntityAINearestAttackableTarget<>(this, EntitySheep.class, true));
    targetTasks.addTask(6, new EntityAINearestAttackableTarget<>(this, EntityCow.class, true));
    targetTasks.addTask(7, new EntityAINearestAttackableTarget<>(this, EntitySkeleton.class, true));
    targetTasks.addTask(8, new EntityAINearestAttackableTarget<>(this, EntityRabbit.class, true));
}
 
Example 49
Project: AbyssalCraft   File: LayerDemonSheepWool.java   Source Code and License 6 votes vote down vote up
@Override
public void doRenderLayer(EntityDemonSheep entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
	if (!entitylivingbaseIn.isInvisible())
	{

		sheepRenderer.bindTexture(TEXTURE);

		if (entitylivingbaseIn.hasCustomName() && "jeb_".equals(entitylivingbaseIn.getCustomNameTag()))
		{
			int i = entitylivingbaseIn.ticksExisted / 25 + entitylivingbaseIn.getEntityId();
			int j = EnumDyeColor.values().length;
			int k = i % j;
			int l = (i + 1) % j;
			float f = (entitylivingbaseIn.ticksExisted % 25 + partialTicks) / 25.0F;
			float[] afloat1 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(k));
			float[] afloat2 = EntitySheep.getDyeRgb(EnumDyeColor.byMetadata(l));
			GlStateManager.color(afloat1[0] * (1.0F - f) + afloat2[0] * f, afloat1[1] * (1.0F - f) + afloat2[1] * f, afloat1[2] * (1.0F - f) + afloat2[2] * f);
		}

		sheepModel.setModelAttributes(sheepRenderer.getMainModel());
		sheepModel.setLivingAnimations(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks);
		sheepModel.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
	}
}
 
Example 50
Project: AbyssalCraft   File: AbyssalCrafting.java   Source Code and License 6 votes vote down vote up
private static void addDisruptions(){
	DisruptionHandler.instance().registerDisruption(new DisruptionLightning());
	DisruptionHandler.instance().registerDisruption(new DisruptionFire());
	DisruptionHandler.instance().registerDisruption(new DisruptionSpawn("spawnShoggoth", null, EntityLesserShoggoth.class));
	DisruptionHandler.instance().registerDisruption(new DisruptionSpawn("spawnGatekeeperMinion", DeityType.JZAHAR, EntityGatekeeperMinion.class));
	DisruptionHandler.instance().registerDisruption(new DisruptionPotion("poisonPotion", null, MobEffects.POISON));
	DisruptionHandler.instance().registerDisruption(new DisruptionPotion("slownessPotion", null, MobEffects.SLOWNESS));
	DisruptionHandler.instance().registerDisruption(new DisruptionPotion("weaknessPotion", null, MobEffects.WEAKNESS));
	DisruptionHandler.instance().registerDisruption(new DisruptionPotion("witherPotion", null, MobEffects.WITHER));
	DisruptionHandler.instance().registerDisruption(new DisruptionPotion("coraliumPotion", null, AbyssalCraftAPI.coralium_plague));
	DisruptionHandler.instance().registerDisruption(new DisruptionPotentialEnergy());
	DisruptionHandler.instance().registerDisruption(new DisruptionFreeze());
	DisruptionHandler.instance().registerDisruption(new DisruptionSwarm("swarmShadow", null, EntityShadowCreature.class, EntityShadowMonster.class, EntityShadowBeast.class));
	DisruptionHandler.instance().registerDisruption(new DisruptionFireRain());
	DisruptionHandler.instance().registerDisruption(new DisruptionDisplaceEntities());
	//		DisruptionHandler.instance().registerDisruption(new DisruptionMonolith()); //uncomment at some point when there's a lot more disruptions
	DisruptionHandler.instance().registerDisruption(new DisruptionTeleportRandomly());
	DisruptionHandler.instance().registerDisruption(new DisruptionDrainNearbyPE());
	DisruptionHandler.instance().registerDisruption(new DisruptionSwarm("swarmSheep", DeityType.SHUBNIGGURATH, EntityEvilSheep.class, EntitySheep.class));
	DisruptionHandler.instance().registerDisruption(new DisruptionAnimalCorruption());
	DisruptionHandler.instance().registerDisruption(new DisruptionCorruption());
}
 
Example 51
Project: SilentPets   File: PetDog.java   Source Code and License 6 votes vote down vote up
public PetDog(World world) {

    super(world);

    entityName = "wolf";

    this.setSize(0.6F, 0.8F);
    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 EntityAIBegPet(this, 8.0F));
    this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(9, 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);
  }
 
Example 52
Project: SilentPets   File: RenderPetDog.java   Source Code and License 6 votes vote down vote up
/**
 * Queries whether should render the specified pass or not.
 */
protected int shouldRenderPass(PetDog p_77032_1_, int p_77032_2_, float p_77032_3_)
{
    if (p_77032_2_ == 0 && p_77032_1_.getWolfShaking())
    {
        float f1 = p_77032_1_.getBrightness(p_77032_3_) * p_77032_1_.getShadingWhileShaking(p_77032_3_);
        this.bindTexture(wolfTextures);
        GL11.glColor3f(f1, f1, f1);
        return 1;
    }
    else if (p_77032_2_ == 1 && p_77032_1_.isTamed())
    {
        this.bindTexture(wolfCollarTextures);
        int j = p_77032_1_.getCollarColor();
        GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]);
        return 1;
    }
    else
    {
        return -1;
    }
}
 
Example 53
Project: SamsPowerups   File: BlockShearWool.java   Source Code and License 6 votes vote down vote up
@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity)
{
	if(entity instanceof EntitySheep)
	{
		EntitySheep sheep = (EntitySheep)entity;

		if(sheep.getSheared() == false && sheep.worldObj.isRemote == false)
		{ 
			//this part is the same as how EntitySheep goes
			sheep.setSheared(true);
               int i = 1 + sheep.worldObj.rand.nextInt(3);

               for (int j = 0; j < i; ++j)
               {
                   EntityItem entityitem = sheep.entityDropItem(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, sheep.getFleeceColor().getMetadata()), 1.0F);
                   entityitem.motionY += (double)(sheep.worldObj.rand.nextFloat() * 0.05F);
                   entityitem.motionX += (double)((sheep.worldObj.rand.nextFloat() - sheep.worldObj.rand.nextFloat()) * 0.1F);
                   entityitem.motionZ += (double)((sheep.worldObj.rand.nextFloat() - sheep.worldObj.rand.nextFloat()) * 0.1F);
               }
               
               sheep.playSound("mob.sheep.shear", 1.0F, 1.0F);
		} 
	}
}
 
Example 54
Project: Cauldron   File: RenderWolf.java   Source Code and License 6 votes vote down vote up
protected int shouldRenderPass(EntityWolf p_77032_1_, int p_77032_2_, float p_77032_3_)
{
    if (p_77032_2_ == 0 && p_77032_1_.getWolfShaking())
    {
        float f1 = p_77032_1_.getBrightness(p_77032_3_) * p_77032_1_.getShadingWhileShaking(p_77032_3_);
        this.bindTexture(wolfTextures);
        GL11.glColor3f(f1, f1, f1);
        return 1;
    }
    else if (p_77032_2_ == 1 && p_77032_1_.isTamed())
    {
        this.bindTexture(wolfCollarTextures);
        int j = p_77032_1_.getCollarColor();
        GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]);
        return 1;
    }
    else
    {
        return -1;
    }
}
 
Example 55
Project: Cauldron   File: ItemDye.java   Source Code and License 6 votes vote down vote up
public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, EntityLivingBase p_111207_3_)
{
    if (p_111207_3_ instanceof EntitySheep)
    {
        EntitySheep entitysheep = (EntitySheep)p_111207_3_;
        int i = BlockColored.func_150032_b(p_111207_1_.getItemDamage());

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

        return true;
    }
    else
    {
        return false;
    }
}
 
Example 56
Project: Cauldron   File: RenderWolf.java   Source Code and License 6 votes vote down vote up
protected int shouldRenderPass(EntityWolf p_77032_1_, int p_77032_2_, float p_77032_3_)
{
    if (p_77032_2_ == 0 && p_77032_1_.getWolfShaking())
    {
        float f1 = p_77032_1_.getBrightness(p_77032_3_) * p_77032_1_.getShadingWhileShaking(p_77032_3_);
        this.bindTexture(wolfTextures);
        GL11.glColor3f(f1, f1, f1);
        return 1;
    }
    else if (p_77032_2_ == 1 && p_77032_1_.isTamed())
    {
        this.bindTexture(wolfCollarTextures);
        int j = p_77032_1_.getCollarColor();
        GL11.glColor3f(EntitySheep.fleeceColorTable[j][0], EntitySheep.fleeceColorTable[j][1], EntitySheep.fleeceColorTable[j][2]);
        return 1;
    }
    else
    {
        return -1;
    }
}
 
Example 57
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));
}
 
Example 58
Project: BaseClient   File: LayerWolfCollar.java   Source Code and License 5 votes vote down vote up
public void doRenderLayer(EntityWolf entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
    if (entitylivingbaseIn.isTamed() && !entitylivingbaseIn.isInvisible())
    {
        this.wolfRenderer.bindTexture(WOLF_COLLAR);
        EnumDyeColor enumdyecolor = EnumDyeColor.byMetadata(entitylivingbaseIn.getCollarColor().getMetadata());
        float[] afloat = EntitySheep.func_175513_a(enumdyecolor);
        GlStateManager.color(afloat[0], afloat[1], afloat[2]);
        this.wolfRenderer.getMainModel().render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
    }
}
 
Example 59
Project: BaseClient   File: LayerSheepWool.java   Source Code and License 5 votes vote down vote up
public void doRenderLayer(EntitySheep entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
{
    if (!entitylivingbaseIn.getSheared() && !entitylivingbaseIn.isInvisible())
    {
        this.sheepRenderer.bindTexture(TEXTURE);

        if (entitylivingbaseIn.hasCustomName() && "jeb_".equals(entitylivingbaseIn.getCustomNameTag()))
        {
            int i1 = 25;
            int i = entitylivingbaseIn.ticksExisted / 25 + entitylivingbaseIn.getEntityId();
            int j = EnumDyeColor.values().length;
            int k = i % j;
            int l = (i + 1) % j;
            float f = ((float)(entitylivingbaseIn.ticksExisted % 25) + partialTicks) / 25.0F;
            float[] afloat1 = EntitySheep.func_175513_a(EnumDyeColor.byMetadata(k));
            float[] afloat2 = EntitySheep.func_175513_a(EnumDyeColor.byMetadata(l));
            GlStateManager.color(afloat1[0] * (1.0F - f) + afloat2[0] * f, afloat1[1] * (1.0F - f) + afloat2[1] * f, afloat1[2] * (1.0F - f) + afloat2[2] * f);
        }
        else
        {
            float[] afloat = EntitySheep.func_175513_a(entitylivingbaseIn.getFleeceColor());
            GlStateManager.color(afloat[0], afloat[1], afloat[2]);
        }

        this.sheepModel.setModelAttributes(this.sheepRenderer.getMainModel());
        this.sheepModel.setLivingAnimations(entitylivingbaseIn, p_177141_2_, p_177141_3_, partialTicks);
        this.sheepModel.render(entitylivingbaseIn, p_177141_2_, p_177141_3_, p_177141_5_, p_177141_6_, p_177141_7_, scale);
    }
}
 
Example 60
Project: BaseClient   File: ModelSheep1.java   Source Code and License 5 votes vote down vote up
/**
 * Used for easily adding entity-dependent animations. The second and third float params here are the same second
 * and third as in the setRotationAngles method.
 */
public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
{
    super.setLivingAnimations(entitylivingbaseIn, p_78086_2_, p_78086_3_, partialTickTime);
    this.head.rotationPointY = 6.0F + ((EntitySheep)entitylivingbaseIn).getHeadRotationPointY(partialTickTime) * 9.0F;
    this.headRotationAngleX = ((EntitySheep)entitylivingbaseIn).getHeadRotationAngleX(partialTickTime);
}