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

The following are top voted examples for showing how to use net.minecraft.entity.passive.EntityHorse. 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: Melodium   File: SongHorse.java   View source code 6 votes vote down vote up
@Override
public boolean songTick(EntityPlayer player, ItemStack instrument, int interval, int ticks, int length) {
	if (interval == 0 && ticks == 1) {
		EnumHand hand = player.getActiveHand();
		World world = player.world;
		SoundType t = SoundType.getSoundTypeByName(SoundType.AMBIENT.getTag());
		if (!world.isRemote) {
			EntityHorse horse = new EntityGhostHorse(world);
			horse.setHorseSaddled(true);
			horse.setTamedBy(player);
			horse.setLocationAndAngles(player.posX, player.posY, player.posZ, player.rotationYaw, player.rotationPitch);
			world.spawnEntity(horse);
			player.startRiding(horse);
			NBTTagCompound tag = ItemUtil.getOrCreateTag(instrument);
			tag.setInteger("id", horse.getEntityId());
		}
		player.setActiveHand(hand);
	}
	return true;
}
 
Example 2
Project: Melodium   File: SongHorse.java   View source code 6 votes vote down vote up
@Override
public void songEnded(EntityPlayer player, ItemStack instrument, int interval) {
	World world = player.world;
	player.dismountRidingEntity();
	if (!world.isRemote) {
		NBTTagCompound tag = ItemUtil.getOrCreateTag(instrument);
		if (tag.hasKey("id")) {
			int id = tag.getInteger("id");
			EntityHorse horse = (EntityHorse) world.getEntityByID(id);
			if (horse != null) {
				horse.setDead();

			}
		}
	}

}
 
Example 3
Project: DecompiledMinecraft   File: RenderHorse.java   View source code 6 votes vote down vote up
/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime
 */
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
{
    float f = 1.0F;
    int i = entitylivingbaseIn.getHorseType();

    if (i == 1)
    {
        f *= 0.87F;
    }
    else if (i == 2)
    {
        f *= 0.92F;
    }

    GlStateManager.scale(f, f, f);
    super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
 
Example 4
Project: BaseClient   File: RenderHorse.java   View source code 6 votes vote down vote up
/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime
 */
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
{
    float f = 1.0F;
    int i = entitylivingbaseIn.getHorseType();

    if (i == 1)
    {
        f *= 0.87F;
    }
    else if (i == 2)
    {
        f *= 0.92F;
    }

    GlStateManager.scale(f, f, f);
    super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
 
Example 5
Project: BaseClient   File: RenderHorse.java   View source code 6 votes vote down vote up
/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime
 */
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
{
    float f = 1.0F;
    int i = entitylivingbaseIn.getHorseType();

    if (i == 1)
    {
        f *= 0.87F;
    }
    else if (i == 2)
    {
        f *= 0.92F;
    }

    GlStateManager.scale(f, f, f);
    super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
 
Example 6
Project: EndermanEvolution   File: EntityFrienderman.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) {
	if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) {
		if (p_142018_1_ instanceof EntityFrienderman) {
			EntityFrienderman frienderman = (EntityFrienderman) p_142018_1_;

			if (frienderman.isTamed() && frienderman.getOwner() == p_142018_2_) {
				return false;
			}
		}

		return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame();
	}
	else {
		return false;
	}
}
 
Example 7
Project: modName   File: BiomeShrubland.java   View source code 6 votes vote down vote up
public BiomeShrubland() {
    super(new BiomeProperties("Shrubland")
            .setBaseHeight(0.115f)
            .setHeightVariation(0.1f)
            .setTemperature(0.77f)
            .setRainfall(0.53f)
    );

    this.setRegistryName(Ref.MODID+":shrubland");
    this.decorator.treesPerChunk = 1;
    this.decorator.grassPerChunk = 7;
    this.decorator.flowersPerChunk = 3;

    this.spawnableCreatureList.add(new Biome.SpawnListEntry(EntityHorse.class, 2, 2, 4));
    Ref.BIOMES.add(this);
}
 
Example 8
Project: CustomWorldGen   File: EntityAISkeletonRiders.java   View source code 6 votes vote down vote up
/**
 * Updates the task
 */
public void updateTask()
{
    DifficultyInstance difficultyinstance = this.horse.worldObj.getDifficultyForLocation(new BlockPos(this.horse));
    this.horse.setSkeletonTrap(false);
    this.horse.setType(HorseType.SKELETON);
    this.horse.setHorseTamed(true);
    this.horse.setGrowingAge(0);
    this.horse.worldObj.addWeatherEffect(new EntityLightningBolt(this.horse.worldObj, this.horse.posX, this.horse.posY, this.horse.posZ, true));
    EntitySkeleton entityskeleton = this.createSkeleton(difficultyinstance, this.horse);
    entityskeleton.startRiding(this.horse);

    for (int i = 0; i < 3; ++i)
    {
        EntityHorse entityhorse = this.createHorse(difficultyinstance);
        EntitySkeleton entityskeleton1 = this.createSkeleton(difficultyinstance, entityhorse);
        entityskeleton1.startRiding(entityhorse);
        entityhorse.addVelocity(this.horse.getRNG().nextGaussian() * 0.5D, 0.0D, this.horse.getRNG().nextGaussian() * 0.5D);
    }
}
 
Example 9
Project: CustomWorldGen   File: EntityAISkeletonRiders.java   View source code 6 votes vote down vote up
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, EntityHorse p_188514_2_)
{
    EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.worldObj);
    entityskeleton.onInitialSpawn(p_188514_1_, (IEntityLivingData)null);
    entityskeleton.setPosition(p_188514_2_.posX, p_188514_2_.posY, p_188514_2_.posZ);
    entityskeleton.hurtResistantTime = 60;
    entityskeleton.enablePersistence();

    if (entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null)
    {
        entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
    }

    EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
    EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
    entityskeleton.worldObj.spawnEntityInWorld(entityskeleton);
    return entityskeleton;
}
 
Example 10
Project: CustomWorldGen   File: RenderHorse.java   View source code 6 votes vote down vote up
/**
 * Allows the render to do state modifications necessary before the model is rendered.
 */
protected void preRenderCallback(EntityHorse entitylivingbaseIn, float partialTickTime)
{
    float f = 1.0F;
    HorseType horsetype = entitylivingbaseIn.getType();

    if (horsetype == HorseType.DONKEY)
    {
        f *= 0.87F;
    }
    else if (horsetype == HorseType.MULE)
    {
        f *= 0.92F;
    }

    GlStateManager.scale(f, f, f);
    super.preRenderCallback(entitylivingbaseIn, partialTickTime);
}
 
Example 11
Project: Overlord   File: EntityArmyMember.java   View source code 6 votes vote down vote up
public boolean shouldAttackEntity(EntityLivingBase target){
	EntityLivingBase owner = getOwner();
	if (ConfigValues.HUNTCREEPERS || !(target instanceof EntityCreeper)) {
		if (target instanceof EntityWolf) {
			EntityWolf entitywolf = (EntityWolf) target;

			if (entitywolf.isTamed() && entitywolf.getOwner() == owner || Alliances.getInstance().isAlliedTo(entitywolf.getOwnerId(), getOwnerId()))
				return false;
		}

		if (target instanceof EntityArmyMember)
			if ((getAttackMode() < 2 && Enemies.getInstance().isNotEnemiesWith(((EntityArmyMember) target).getOwnerId(), getOwnerId())) || ((EntityArmyMember) target).getOwnerId().equals(getOwnerId()) || Alliances.getInstance().isAlliedTo(((EntityArmyMember) target).getOwnerId(), getOwnerId()))
				return false;

		return !(target instanceof EntityPlayer && owner instanceof EntityPlayer && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) target)) && (!(target instanceof EntityHorse) || !((EntityHorse) target).isTame());
	} else
		return false;
}
 
Example 12
Project: 4Space-5   File: EntitySlimeling.java   View source code 6 votes vote down vote up
@Override
public boolean func_142018_a(EntityLivingBase par1EntityLivingBase, EntityLivingBase par2EntityLivingBase)
{
    if (!(par1EntityLivingBase instanceof EntityCreeper) && !(par1EntityLivingBase instanceof EntityGhast))
    {
        if (par1EntityLivingBase instanceof EntitySlimeling)
        {
            EntitySlimeling slimeling = (EntitySlimeling) par1EntityLivingBase;

            if (slimeling.isTamed() && slimeling.getOwner() == par2EntityLivingBase)
            {
                return false;
            }
        }

        return !(par1EntityLivingBase instanceof EntityPlayer && par2EntityLivingBase instanceof EntityPlayer && !((EntityPlayer) par2EntityLivingBase).canAttackPlayer((EntityPlayer) par1EntityLivingBase)) && (!(par1EntityLivingBase instanceof EntityHorse) || !((EntityHorse) par1EntityLivingBase).isTame());
    }
    else
    {
        return false;
    }
}
 
Example 13
Project: CrystalMod   File: ClientEventHandler.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onGuiOpen(GuiOpenEvent event)
{
	GuiScreen gui = event.getGui();
	if(gui !=null && gui instanceof GuiScreenHorseInventory){
		GuiScreenHorseInventory horseGui = (GuiScreenHorseInventory)gui;
		EntityHorse horse = (EntityHorse)ReflectionUtils.getPrivateValue(horseGui, GuiScreenHorseInventory.class, ObfuscatedNames.GuiScreenHorseInventory_horseEntity);
		if(horse !=null && HorseAccessories.hasEnderChest(horse)){
			ContainerHorseChest animalchest = new ContainerHorseChest("HorseChest", 2);
			animalchest.setCustomName(horse.getName());
			event.setGui(new GuiHorseEnderChest(CrystalMod.proxy.getClientPlayer().inventory, animalchest, horse));
			PacketGuiMessage pkt = new PacketGuiMessage("Gui");
			pkt.setOpenGui(GuiHandler.GUI_ID_ENTITY, horse.getEntityId(), 0, 0);
			CrystalModNetwork.sendToServer(pkt);
		}
	}
}
 
Example 14
Project: CrystalMod   File: MinionAICombat.java   View source code 6 votes vote down vote up
private void moveToAttackTarget(EntityMinionWarrior minion)
{
	final EntityLiving entityPathController = (EntityLiving) (minion.getRidingEntity() instanceof EntityHorse ? minion.getRidingEntity() : minion);
	float speed = entityPathController instanceof EntityHorse ? MinionConstants.SPEED_HORSE_RUN :  MinionConstants.SPEED_WALK;
	if (entityPathController instanceof EntityHorse)
	{
		final EntityHorse horse = (EntityHorse) entityPathController;

		//This makes the horse move properly.
		if (horse.isHorseSaddled())
		{
			horse.setHorseSaddled(false);
		}
	}
	
	if(minion.getNavigator().noPath())
	entityPathController.getNavigator().tryMoveToEntityLiving(attackTarget, speed);
}
 
Example 15
Project: Gravestone-mod-Extended   File: EntityUndeadHorse.java   View source code 6 votes vote down vote up
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) {

    livingdata = super.onInitialSpawn(difficulty, livingdata);
    int i;

    if (livingdata instanceof EntityHorse.GroupData) {
        i = ((EntityHorse.GroupData) livingdata).variant;
    } else {
        i = this.rand.nextInt(7);
        livingdata = new EntityHorse.GroupData(i);
    }

    this.setHorseVariant(i | this.rand.nextInt(5) << 8);
    return livingdata;
}
 
Example 16
Project: Gravestone-mod-Extended   File: HorseCorpseHelper.java   View source code 6 votes vote down vote up
public static void setNbt(AbstractHorse horse, NBTTagCompound nbt) {
    setName(horse, nbt);

    EnumHorseType horseType = getHorseType(horse);
    nbt.setInteger("HorseType", horseType.ordinal());

    int variant = 0;
    if (horseType == EnumHorseType.HORSE) {
        variant = ((EntityHorse) horse).getHorseVariant();
    }
    nbt.setInteger("Variant", variant);

    AbstractAttributeMap attrMap = horse.getAttributeMap();
    nbt.setDouble("Max Health", attrMap.getAttributeInstanceByName("Max Health").getAttributeValue());
    nbt.setDouble("Movement Speed", attrMap.getAttributeInstanceByName("Movement Speed").getAttributeValue());
    nbt.setDouble("Jump Strength", attrMap.getAttributeInstanceByName("Jump Strength").getAttributeValue());
}
 
Example 17
Project: Mekfarm   File: AnimalWrapperFactory.java   View source code 6 votes vote down vote up
/**
 * @param entity
 * the entity to be wrapped
 * @return
 * return a nicely wrapped entity ready to be exploited in many many ways
 */
public static IAnimalWrapper getAnimalWrapper(EntityAnimal entity) {
    IAnimalWrapper wrapper = null;

    if (entity instanceof EntityHorse) {
        wrapper = new VanillaHorse((EntityHorse) entity);
    }

    if ((entity instanceof EntityCow) && entity.getClass().getName().equals("com.robrit.moofluids.common.entity.EntityFluidCow")) {
        wrapper = new MooFluidCow((EntityCow)entity);
    }

    if (wrapper == null) {
        wrapper = new VanillaGenericAnimal(entity);
    }
    return wrapper;
}
 
Example 18
Project: demomod   File: DemoEntityTameable.java   View source code 6 votes vote down vote up
@Override
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_) {
	if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast)) {
		if (p_142018_1_ instanceof DemoEntityTameable) {
			DemoEntityTameable demoEntityTameable = (DemoEntityTameable) p_142018_1_;

			if (demoEntityTameable.isTamed() && demoEntityTameable.getOwnerEntity() == p_142018_2_) {
				return false;
			}
		}

		return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer
				&& !((EntityPlayer) p_142018_2_).canAttackPlayer((EntityPlayer) p_142018_1_) ? false
						: !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse) p_142018_1_).isTame();
	} else {
		return false;
	}
}
 
Example 19
Project: ThermalRecycling   File: BreedingItemRegistry.java   View source code 6 votes vote down vote up
private static Class<? extends EntityAnimal> resolveClass(final String entityClass) {
	
	if(!MineTweakerUtil.checkNotNull(entityClass, "Entity class name cannot be null"))
		return null;
	
	if(!MineTweakerUtil.checkArgument(!entityClass.isEmpty(), "Entity class name is invalid"))
		return null;

	final Class<?> clazz = (Class<?>) EntityList.stringToClassMapping.get(entityClass);
	if(!MineTweakerUtil.checkNotNull(clazz, String.format("Unknown entity type '%s'", entityClass)))
		return null;
	
	if(!MineTweakerUtil.checkArgument(!clazz.isAssignableFrom(EntityHorse.class), "Unable to specify breeding items for horses"))
		return null;
	
	final Class<? extends EntityAnimal> animal = clazz.asSubclass(EntityAnimal.class);
	if(!MineTweakerUtil.checkNotNull(animal, "Entity is not an EntityAnimal type"))
		return null;
	
	return animal;
}
 
Example 20
Project: HorseDebugInfo   File: ModScreenText.java   View source code 6 votes vote down vote up
@SideOnly(Side.CLIENT)
private void addHorseInfo(RenderGameOverlayEvent.Text event,	EntityPlayerSP player,EntityHorse horse) 
{ 
	double speed =  horse.getEntityAttribute(SharedMonsterAttributes.movementSpeed).getAttributeValue() ;

	double jump = horse.getHorseJumpStrength() ;
	//convert from scale factor to blocks
	double jumpHeight = 0;
	double gravity = 0.98;
	while (jump > 0)
	{
		jumpHeight += jump;
		jump -= 0.08;
		jump *= gravity;
	}
	
	DecimalFormat df = new DecimalFormat("0.0000");
	
	event.left.add(ModScreenText.lang("debug.horsespeed")+"  "+ df.format(speed)   ); 
	
	df = new DecimalFormat("0.0");
	
	event.left.add(ModScreenText.lang("debug.horsejump") +"  "+ df.format(jumpHeight) );
}
 
Example 21
Project: HorseFood   File: ModHorseFood.java   View source code 6 votes vote down vote up
@SubscribeEvent
public void onEntityInteractEvent(EntityInteractEvent event){

	if(event.getEntity() instanceof EntityPlayer == false){
		return;
	}
	EntityPlayer entityPlayer = (EntityPlayer)event.getEntity();
	ItemStack held = entityPlayer.getHeldItemMainhand();

	if(held != null && held.getItem() instanceof ItemHorseFood){
		if(event.getTarget() instanceof EntityHorse){
			ItemHorseFood.onHorseInteract((EntityHorse) event.getTarget(), entityPlayer, held);

			event.setCanceled(true);// stop the GUI inventory opening
		}
	}
}
 
Example 22
Project: HorseFood   File: ModHorseFood.java   View source code 6 votes vote down vote up
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void addHorseInfo(RenderGameOverlayEvent.Text event){

	EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
	if(Minecraft.getMinecraft().gameSettings.showDebugInfo){
		if(player.getRidingEntity() != null && player.getRidingEntity() instanceof EntityHorse){
			EntityHorse horse = (EntityHorse) player.getRidingEntity();

			double speed = getSpeedTranslated(horse.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue());

			// double jump = horse.getHorseJumpStrength() ;
			// convert from scale factor to blocks
			double jumpHeight = getJumpTranslated(horse.getHorseJumpStrength());

			DecimalFormat df = new DecimalFormat("0.00");
 
			event.getLeft().add(I18n.translateToLocal("debug.horsespeed") + "  " + df.format(speed));

			df = new DecimalFormat("0.0");

			event.getLeft().add(I18n.translateToLocal("debug.horsejump") + "  " + df.format(jumpHeight));
		}
	}
}
 
Example 23
Project: Rediscovered-Mod-1.8   File: EntitySkeletonHorse.java   View source code 6 votes vote down vote up
public EntitySkeletonHorse(World par1World)
{
    super(par1World);
    this.setSize(1.4F, 1.6F);
    this.getNavigator();
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
    this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityHorse.class, 1.0D, true));
    this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));
    this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, 1.0D, false));
    this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(7, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.applyEntityAI();
}
 
Example 24
Project: Rediscovered-Mod-1.8   File: EntitySkeletonHorse.java   View source code 6 votes vote down vote up
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase par1EntityLivingBase)
{
    super.onKillEntity(par1EntityLivingBase);

    if (par1EntityLivingBase instanceof EntityHorse)
    {
        if (this.rand.nextBoolean())
        {
            return;
        }

        EntityZombieHorse entityzombie = new EntityZombieHorse(this.worldObj);
        entityzombie.copyLocationAndAnglesFrom(par1EntityLivingBase);
        this.worldObj.removeEntity(par1EntityLivingBase);

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
    }
}
 
Example 25
Project: Rediscovered-Mod-1.8   File: EntityZombieHorse.java   View source code 6 votes vote down vote up
public EntityZombieHorse(World par1World)
{
    super(par1World);
    this.setSize(1.4F, 1.6F);
    this.getNavigator();
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
    this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityHorse.class, 1.0D, true));
    this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));
    this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, 1.0D, false));
    this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(7, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.applyEntityAI();
}
 
Example 26
Project: Rediscovered-Mod-1.8   File: EntityZombieHorse.java   View source code 6 votes vote down vote up
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase par1EntityLivingBase)
{
    super.onKillEntity(par1EntityLivingBase);

    if (par1EntityLivingBase instanceof EntityHorse)
    {
        if (this.rand.nextBoolean())
        {
            return;
        }

        EntityZombieHorse entityzombie = new EntityZombieHorse(this.worldObj);
        entityzombie.copyLocationAndAnglesFrom(par1EntityLivingBase);
        this.worldObj.removeEntity(par1EntityLivingBase);

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
    }
}
 
Example 27
Project: It-s-About-Time-Minecraft-Mod   File: EntityIatWolf.java   View source code 6 votes vote down vote up
public boolean canTargetCreature(EntityLivingBase targetMob, EntityLivingBase thisMob)
{
    if (!(targetMob instanceof EntityCreeper) && !(targetMob instanceof EntityGhast))
    {
        if (targetMob instanceof EntityIatWolf)
        {
            EntityIatWolf entitywolf = (EntityIatWolf)targetMob;

            if (entitywolf.isTamed() && entitywolf.getOwner() == thisMob)
            {
                return false;
            }
        }

        return targetMob instanceof EntityPlayer && thisMob instanceof EntityPlayer && !((EntityPlayer)thisMob).canAttackPlayer((EntityPlayer)targetMob) ? false : !(targetMob instanceof EntityHorse) || !((EntityHorse)targetMob).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 28
Project: Resilience-Client-Source   File: RenderHorse.java   View source code 6 votes vote down vote up
/**
 * Allows the render to do any OpenGL state modifications necessary before the model is rendered. Args:
 * entityLiving, partialTickTime
 */
protected void preRenderCallback(EntityHorse par1EntityHorse, float par2)
{
    float var3 = 1.0F;
    int var4 = par1EntityHorse.getHorseType();

    if (var4 == 1)
    {
        var3 *= 0.87F;
    }
    else if (var4 == 2)
    {
        var3 *= 0.92F;
    }

    GL11.glScalef(var3, var3, var3);
    super.preRenderCallback(par1EntityHorse, par2);
}
 
Example 29
Project: Rediscovered-Mod-1.8.8   File: EntitySkeletonHorse.java   View source code 6 votes vote down vote up
public EntitySkeletonHorse(World par1World)
{
    super(par1World);
    this.setSize(1.4F, 1.6F);
    this.getNavigator();
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
    this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityHorse.class, 1.0D, true));
    this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));
    this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, 1.0D, false));
    this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(7, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.applyEntityAI();
}
 
Example 30
Project: Rediscovered-Mod-1.8.8   File: EntitySkeletonHorse.java   View source code 6 votes vote down vote up
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase par1EntityLivingBase)
{
    super.onKillEntity(par1EntityLivingBase);

    if (par1EntityLivingBase instanceof EntityHorse)
    {
        if (this.rand.nextBoolean())
        {
            return;
        }

        EntityZombieHorse entityzombie = new EntityZombieHorse(this.worldObj);
        entityzombie.copyLocationAndAnglesFrom(par1EntityLivingBase);
        this.worldObj.removeEntity(par1EntityLivingBase);

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
    }
}
 
Example 31
Project: Rediscovered-Mod-1.8.8   File: EntityZombieHorse.java   View source code 6 votes vote down vote up
public EntityZombieHorse(World par1World)
{
    super(par1World);
    this.setSize(1.4F, 1.6F);
    this.getNavigator();
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
    this.tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityHorse.class, 1.0D, true));
    this.tasks.addTask(4, new EntityAIMoveTowardsRestriction(this, 1.0D));
    this.tasks.addTask(5, new EntityAIMoveThroughVillage(this, 1.0D, false));
    this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(7, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, true));
    this.applyEntityAI();
}
 
Example 32
Project: Rediscovered-Mod-1.8.8   File: EntityZombieHorse.java   View source code 6 votes vote down vote up
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase par1EntityLivingBase)
{
    super.onKillEntity(par1EntityLivingBase);

    if (par1EntityLivingBase instanceof EntityHorse)
    {
        if (this.rand.nextBoolean())
        {
            return;
        }

        EntityZombieHorse entityzombie = new EntityZombieHorse(this.worldObj);
        entityzombie.copyLocationAndAnglesFrom(par1EntityLivingBase);
        this.worldObj.removeEntity(par1EntityLivingBase);

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
    }
}
 
Example 33
Project: RidiculousWorld   File: EntityUnicorn.java   View source code 6 votes vote down vote up
protected EntityHorse getClosestHorse(Entity p_110250_1_, double p_110250_2_)
{
    double d1 = Double.MAX_VALUE;
    Entity entity1 = null;
    List list = this.worldObj.getEntitiesWithinAABBExcludingEntity(p_110250_1_, p_110250_1_.boundingBox.addCoord(p_110250_2_, p_110250_2_, p_110250_2_), unicornBreedingSelector);
    Iterator iterator = list.iterator();

    while (iterator.hasNext())
    {
        Entity entity2 = (Entity)iterator.next();
        double d2 = entity2.getDistanceSq(p_110250_1_.posX, p_110250_1_.posY, p_110250_1_.posZ);

        if (d2 < d1)
        {
            entity1 = entity2;
            d1 = d2;
        }
    }

    return (EntityHorse)entity1;
}
 
Example 34
Project: RuneCraftery   File: RenderHorse.java   View source code 6 votes vote down vote up
protected ResourceLocation func_110849_a(EntityHorse p_110849_1_) {
   if(!p_110849_1_.func_110239_cn()) {
      switch(p_110849_1_.func_110265_bP()) {
      case 0:
      default:
         return field_110850_f;
      case 1:
         return field_110855_h;
      case 2:
         return field_110851_g;
      case 3:
         return field_110854_k;
      case 4:
         return field_110853_l;
      }
   } else {
      return this.func_110848_b(p_110849_1_);
   }
}
 
Example 35
Project: ZeroQuest   File: EntityKortor.java   View source code 6 votes vote down vote up
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityKortor)
        {
        	EntityKortor entitywolf = (EntityKortor)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 36
Project: ZeroQuest   File: EntityForisZertum.java   View source code 6 votes vote down vote up
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityForisZertum)
        {
            EntityForisZertum entitywolf = (EntityForisZertum)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 37
Project: ZeroQuest   File: EntityDestroZertum.java   View source code 6 votes vote down vote up
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityDestroZertum)
        {
            EntityDestroZertum entitywolf = (EntityDestroZertum)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 38
Project: ZeroQuest   File: EntityJakan.java   View source code 6 votes vote down vote up
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityJakan)
        {
        	EntityJakan entitywolf = (EntityJakan)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 39
Project: ZeroQuest   File: EntityDarkZertum.java   View source code 6 votes vote down vote up
public boolean func_142018_a(EntityLivingBase p_142018_1_, EntityLivingBase p_142018_2_)
{
    if (!(p_142018_1_ instanceof EntityCreeper) && !(p_142018_1_ instanceof EntityGhast))
    {
        if (p_142018_1_ instanceof EntityDarkZertum)
        {
            EntityDarkZertum entitywolf = (EntityDarkZertum)p_142018_1_;

            if (entitywolf.isTamed() && entitywolf.getOwner() == p_142018_2_)
            {
                return false;
            }
        }

        return p_142018_1_ instanceof EntityPlayer && p_142018_2_ instanceof EntityPlayer && !((EntityPlayer)p_142018_2_).canAttackPlayer((EntityPlayer)p_142018_1_) ? false : !(p_142018_1_ instanceof EntityHorse) || !((EntityHorse)p_142018_1_).isTame();
    }
    else
    {
        return false;
    }
}
 
Example 40
Project: ZeroQuest   File: BiomeGenRedSeed.java   View source code 6 votes vote down vote up
public BiomeGenRedSeed(int id) {
    super(id);
   	this.waterColorMultiplier = 0x003333;
    this.theBiomeDecorator.treesPerChunk = -999;
    this.theBiomeDecorator.flowersPerChunk = 4;
    this.theBiomeDecorator.grassPerChunk = 10;
    this.flowers.clear();
    this.addFlower(Blocks.red_flower,    4,  3);
    this.addFlower(Blocks.red_flower,    5,  3);
    this.addFlower(Blocks.red_flower,    6,  3);
    this.addFlower(Blocks.red_flower,    7,  3);
    this.addFlower(ModBlocks.nileBlackFlower,    0, 20);
    this.addFlower(ModBlocks.nileBlackFlower,    3, 20);
    this.addFlower(ModBlocks.nileBlackFlower,    8, 20);
    this.addFlower(ModBlocks.nileBlackFlower, 0, 30);
    this.spawnableMonsterList.clear();
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 5, 2, 6));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityRedZertum.class, 100, 4, 4));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityChicken.class, 5, 1, 5));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityCow.class, 5, 1, 5));
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityPig.class, 5, 1, 5)); 
    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));
}