net.minecraft.entity.passive.EntitySheep Java Examples

The following examples show how to use net.minecraft.entity.passive.EntitySheep. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DyeModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Listener
public void onUpdate(EventPlayerUpdate event) {
    if (event.getStage() == EventStageable.EventStage.PRE) {
        final Minecraft mc = Minecraft.getMinecraft();
        if(mc.player.inventory.getCurrentItem().getItem() instanceof ItemDye) {
            final EnumDyeColor color = EnumDyeColor.byDyeDamage(mc.player.inventory.getCurrentItem().getMetadata());

            for(Entity e : mc.world.loadedEntityList) {
                if(e != null && e instanceof EntitySheep) {
                    final EntitySheep sheep = (EntitySheep) e;
                    if(sheep.getHealth() > 0) {
                        if (sheep.getFleeceColor() != color && !sheep.getSheared() && mc.player.getDistance(sheep) <= 4.5f) {
                            mc.playerController.interactWithEntity(mc.player, sheep, EnumHand.MAIN_HAND);
                        }
                    }
                }
            }
        }
    }
}
 
Example #2
Source File: BeefGuiRedNetChannelSelector.java    From BigReactors with MIT License 6 votes vote down vote up
@Override
public void drawBackground(TextureManager renderEngine, int mouseX, int mouseY) {
	int barTop = absoluteY + height/2 - (barHeight/2-1);
	int borderColor = 0xff000000;
	if(this.selected) {
		borderColor = 0xff22dd22; // bright green?
	}
	this.drawRect(absoluteX, absoluteY, absoluteX+height, absoluteY+height, borderColor);
	this.drawRect(absoluteX+width-height, absoluteY, absoluteX+width, absoluteY+height, borderColor);
	this.drawRect(absoluteX+height, barTop, absoluteX+width-height, barTop+barHeight, borderColor);
	
	float[] color = EntitySheep.fleeceColorTable[this.channelIdx];
	
	this.drawRect(absoluteX+1, absoluteY+1, absoluteX+height-1, absoluteY+height-1, color[0], color[1], color[2], 1.0f);
	this.drawRect(absoluteX+width-height+1, absoluteY+1, absoluteX+width-1, absoluteY+height-1, 0xff777777);
}
 
Example #3
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public final int despawnVanillaAnimals(WorldServer worldObj)
{
    int count = 0;
    for (int j = 0; j < worldObj.loadedEntityList.size(); j++)
    {
        Entity entity = (Entity) worldObj.loadedEntityList.get(j);
        if (!(entity instanceof EntityLiving))
        {
            continue;
        }
        if ((entity instanceof EntityCow || entity instanceof EntitySheep || entity instanceof EntityPig || entity instanceof EntityOcelot || entity instanceof EntityChicken || entity instanceof EntitySquid || entity instanceof EntityWolf))
        {
            count += entityDespawnCheck(worldObj, (EntityLiving) entity);

        }
    }
    return count;
}
 
Example #4
Source File: MoCreatures.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
public static void ClearVanillaSpawnLists()
{
    for (int i = 0; i < BiomeGenBase.biomeList.length; i++)
    {
        if (BiomeGenBase.biomeList[i] != null)
        {
            EntityRegistry.removeSpawn(EntityCow.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityPig.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySheep.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityChicken.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityWolf.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntitySquid.class, EnumCreatureType.waterCreature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityOcelot.class, EnumCreatureType.creature, BiomeGenBase.biomeList[i]);
            EntityRegistry.removeSpawn(EntityBat.class, EnumCreatureType.ambient, BiomeGenBase.biomeList[i]);
        }
    }
}
 
Example #5
Source File: ServerEventHandler.java    From Et-Futurum with The Unlicense 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
Source File: ShearModule.java    From seppuku with GNU General Public License v3.0 6 votes vote down vote up
@Listener
public void onUpdate(EventPlayerUpdate event) {
    if (event.getStage() == EventStageable.EventStage.PRE) {
        final Minecraft mc = Minecraft.getMinecraft();
        if(mc.player.inventory.getCurrentItem().getItem() instanceof ItemShears) {
            for(Entity e : mc.world.loadedEntityList) {
                if(e != null && e instanceof EntitySheep) {
                    final EntitySheep sheep = (EntitySheep) e;
                    if(sheep.getHealth() > 0) {
                        if (!sheep.isChild() && !sheep.getSheared() && mc.player.getDistance(sheep) <= 4.5f) {
                            mc.playerController.interactWithEntity(mc.player, sheep, EnumHand.MAIN_HAND);
                        }
                    }
                }
            }
        }
    }
}
 
Example #7
Source File: ActivationRange.java    From Kettle with GNU General Public License v3.0 5 votes vote down vote up
/**
 * If an entity is not in range, do some more checks to see if we should
 * give it a shot.
 *
 * @param entity
 * @return
 */
public static boolean checkEntityImmunities(Entity entity) {
    // quick checks.
    if (entity.inWater || entity.fire > 0) {
        return true;
    }
    if (!(entity instanceof EntityArrow)) {
        if (!entity.onGround || !entity.riddenByEntities.isEmpty() || entity.isRiding()) {
            return true;
        }
    } else if (!((EntityArrow) entity).inGround) {
        return true;
    }
    // special cases.
    if (entity instanceof EntityLiving) {
        EntityLiving living = (EntityLiving) entity;
        if ( /*TODO: Missed mapping? living.attackTicks > 0 || */ living.hurtTime > 0 || living.activePotionsMap.size() > 0) {
            return true;
        }
        if (entity instanceof EntityCreature && ((EntityCreature) entity).getAttackTarget() != null) {
            return true;
        }
        if (entity instanceof EntityVillager && ((EntityVillager) entity).isMating()) {
            return true;
        }
        if (entity instanceof EntityAnimal) {
            EntityAnimal animal = (EntityAnimal) entity;
            if (animal.isChild() || animal.isInLove()) {
                return true;
            }
            if (entity instanceof EntitySheep && ((EntitySheep) entity).getSheared()) {
                return true;
            }
        }
        if (entity instanceof EntityCreeper && ((EntityCreeper) entity).hasIgnited()) { // isExplosive
            return true;
        }
    }
    return false;
}
 
Example #8
Source File: CivilizationHandlers.java    From ToroQuest with GNU General Public License v3.0 5 votes vote down vote up
private boolean isAnimal(EntityLivingBase victim) {
	return victim instanceof EntityCow ||
			victim instanceof EntityHorse ||
			victim instanceof EntityPig ||
			victim instanceof EntityDonkey ||
			victim instanceof EntityChicken ||
			victim instanceof EntitySheep;
}
 
Example #9
Source File: EntitySheepMetaProvider.java    From OpenPeripheral-Integration with MIT License 5 votes vote down vote up
@Override
public Object getMeta(EntitySheep target, Vec3 relativePos) {
	Map<String, Object> map = Maps.newHashMap();

	map.put("sheepColor", target.getFleeceColor());
	map.put("isSheared", target.getSheared());

	return map;
}
 
Example #10
Source File: ItemResource.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 5 votes vote down vote up
@Override
public boolean itemInteractionForEntity(ItemStack stack, EntityPlayer player, EntityLivingBase yEntityLivingBase) {
    if (yEntityLivingBase instanceof EntitySheep && stack.getItemDamage() == 1) {
        EntitySheep entitysheep = (EntitySheep) yEntityLivingBase;

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

        return true;
    } else {
        return false;
    }
}
 
Example #11
Source File: MoCTools.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public static int despawnVanillaAnimals(World worldObj, List[] classList)
{
    int count = 0;
    for (int j = 0; j < worldObj.loadedEntityList.size(); j++)
    {
        Entity entity = (Entity) worldObj.loadedEntityList.get(j);
        if ((entity instanceof EntityLiving) && (entity instanceof EntityCow || entity instanceof EntitySheep || entity instanceof EntityPig || entity instanceof EntityChicken || entity instanceof EntitySquid || entity instanceof EntityWolf))
        {
            count += entityDespawnCheck(worldObj, (EntityLiving) entity);

        }
    }
    return count;
}
 
Example #12
Source File: CustomSpawner.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
public CustomSpawner()
{
    biomeList = new ArrayList<BiomeGenBase>();
    log.setParent(FMLLog.getLogger());
    try
    {
        for (BiomeGenBase biomegenbase : BiomeGenBase.biomeList)
        {
            if (biomegenbase == null)
            {
                continue;
            }
            biomeList.add(biomegenbase);
        }

        customCreatureSpawnList = new List[biomeList.size()];
        customMobSpawnList = new List[biomeList.size()];
        customAmbientSpawnList = new List[biomeList.size()];
        customAquaticSpawnList = new List[biomeList.size()];
        entityClasses = new List[4];
        vanillaClassList = new ArrayList<Class>();
        vanillaClassList.add(EntityChicken.class);
        vanillaClassList.add(EntityCow.class);
        vanillaClassList.add(EntityPig.class);
        vanillaClassList.add(EntitySheep.class);
        vanillaClassList.add(EntityWolf.class);
        vanillaClassList.add(EntitySquid.class);
        vanillaClassList.add(EntityOcelot.class);
        vanillaClassList.add(EntityBat.class);
        clearLists();
    }
    catch (Exception ex)
    {
        throw new RuntimeException(ex);
    }
}
 
Example #13
Source File: LayerOvergrownSheepWool.java    From CommunityMod with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void doRenderLayer(EntityOvergrownSheep sheep, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale)
{
	if (!sheep.getSheared() && !sheep.isInvisible())
	{
		this.sheepRenderer.bindTexture(TEXTURE);

		if (sheep.hasCustomName() && "jeb_".equals(sheep.getCustomNameTag()))
		{
			float time = 25F;
			int i = sheep.ticksExisted / 25 + sheep.getEntityId();
			int j = EnumDyeColor.values().length;
			int k = i % j;
			int l = (i + 1) % j;
			float f = ((sheep.ticksExisted % time) + partialTicks) / time;
			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);
		}
		else
		{
			float[] afloat = EntitySheep.getDyeRgb(sheep.getFleeceColor());
			GlStateManager.color(afloat[0], afloat[1], afloat[2]);
		}

		this.sheepModel.setModelAttributes(this.sheepRenderer.getMainModel());
		this.sheepModel.setLivingAnimations(sheep, limbSwing, limbSwingAmount, partialTicks);
		//(float)sheep.getDataManager().get(EntityOvergrownSheep.GROWTH) / 10000000F
		this.sheepModel.render(sheep, limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scale);
	}
}
 
Example #14
Source File: ActivationRange.java    From Thermos with GNU General Public License v3.0 4 votes vote down vote up
/**
 * If an entity is not in range, do some more checks to see if we should
 * give it a shot.
 *
 * @param entity
 * @return
 */
public static boolean checkEntityImmunities(Entity entity)
{
    // quick checks.
    if ( entity.inWater /* isInWater */ || entity.fire > 0 )
    {
        return true;
    }
    if ( !( entity instanceof EntityArrow ) )
    {
        if ( !entity.onGround || entity.riddenByEntity != null
                || entity.ridingEntity != null )
        {
            return true;
        }
    } else if ( !( (EntityArrow) entity ).inGround )
    {
        return true;
    }
    // special cases.
    if ( entity instanceof EntityLiving )
    {
        EntityLiving living = (EntityLiving) entity;
        if ( living.attackTime > 0 || living.hurtTime > 0 || living.activePotionsMap.size() > 0 )
        {
            return true;
        }
        if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).entityToAttack != null )
        {
            return true;
        }
        if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).isMating() /* Getter for first boolean */ )
        {
            return true;
        }
        if ( entity instanceof EntityAnimal )
        {
            EntityAnimal animal = (EntityAnimal) entity;
            if ( animal.isChild() || animal.isInLove() /*love*/ )
            {
                return true;
            }
            if ( entity instanceof EntitySheep && ( (EntitySheep) entity ).getSheared() )
            {
                return true;
            }
        }
    }
    return false;
}
 
Example #15
Source File: AuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean isEntityApplicable(Entity e) {
    return e instanceof EntitySheep && ((EntitySheep) e).getSheared();
}
 
Example #16
Source File: AuraEffects.java    From Gadomancy with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void doEntityEffect(ChunkCoordinates originTile, Entity e) {
    EntitySheep sheep = (EntitySheep) e;
    if(sheep.worldObj.rand.nextInt(10) == 0) sheep.setSheared(false);
}
 
Example #17
Source File: TileEntityNewBeacon.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
private void updateSegments() {
	int x = xCoord;
	int y = yCoord;
	int z = zCoord;
	segments.clear();
	TileEntityNewBeacon.BeamSegment beamsegment = new TileEntityNewBeacon.BeamSegment(EntitySheep.fleeceColorTable[0]);
	segments.add(beamsegment);
	boolean flag = true;

	for (int i = y + 1; i < worldObj.getActualHeight(); i++) {
		Block iblockstate = worldObj.getBlock(x, i, z);
		float[] colours;

		if (iblockstate == Blocks.stained_glass)
			colours = EntitySheep.fleeceColorTable[worldObj.getBlockMetadata(x, i, z)];
		else {
			if (iblockstate != Blocks.stained_glass_pane) {
				if (iblockstate.getLightOpacity() >= 15) {
					segments.clear();
					break;
				}

				beamsegment.func_177262_a();
				continue;
			}

			colours = EntitySheep.fleeceColorTable[worldObj.getBlockMetadata(x, i, z)];
		}

		if (!flag)
			colours = new float[] { (beamsegment.func_177263_b()[0] + colours[0]) / 2.0F, (beamsegment.func_177263_b()[1] + colours[1]) / 2.0F, (beamsegment.func_177263_b()[2] + colours[2]) / 2.0F };

		if (Arrays.equals(colours, beamsegment.func_177263_b()))
			beamsegment.func_177262_a();
		else {
			beamsegment = new TileEntityNewBeacon.BeamSegment(colours);
			segments.add(beamsegment);
		}

		flag = false;
	}
}
 
Example #18
Source File: CraftSheep.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
@Override
public EntitySheep getHandle() {
    return (EntitySheep) entity;
}
 
Example #19
Source File: CraftSheep.java    From Kettle with GNU General Public License v3.0 4 votes vote down vote up
public CraftSheep(CraftServer server, EntitySheep entity) {
    super(server, entity);
}