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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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));
}
 
Example 41
Project: ZeroQuest   File: BiomeGenRedSeed.java   Source Code and License 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.getDefaultState(), 4);
    this.addFlower(ModBlocks.nileBlackFlower.getDefaultState(), 90);
    this.spawnableMonsterList.clear();
    this.spawnableCreatureList.add(new BiomeGenBase.SpawnListEntry(EntityHorse.class, 5, 2, 6));
    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));
}
 
Example 42
Project: RuneCraftery   File: RenderHorse.java   Source Code and License 6 votes vote down vote up
protected void func_110847_a(EntityHorse par1EntityHorse, float par2)
{
    float f1 = 1.0F;
    int i = par1EntityHorse.getHorseType();

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

    GL11.glScalef(f1, f1, f1);
    super.preRenderCallback(par1EntityHorse, par2);
}
 
Example 43
Project: ExpandedRailsMod   File: RenderHorse.java   Source Code and License 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 44
Project: ExpandedRailsMod   File: RenderHorse.java   Source Code and License 6 votes vote down vote up
@Nullable
private ResourceLocation getOrCreateLayeredResourceLoc(EntityHorse p_188328_1_)
{
    String s = p_188328_1_.getHorseTexture();

    if (!p_188328_1_.hasTexture())
    {
        return null;
    }
    else
    {
        ResourceLocation resourcelocation = (ResourceLocation)LAYERED_LOCATION_CACHE.get(s);

        if (resourcelocation == null)
        {
            resourcelocation = new ResourceLocation(s);
            Minecraft.getMinecraft().getTextureManager().loadTexture(resourcelocation, new LayeredTexture(p_188328_1_.getVariantTexturePaths()));
            LAYERED_LOCATION_CACHE.put(s, resourcelocation);
        }

        return resourcelocation;
    }
}
 
Example 45
Project: BetterHorseHud   File: ModGui.java   Source Code and License 6 votes vote down vote up
@SubscribeEvent(priority = EventPriority.NORMAL)
public void onRenderMountHealth(RenderGameOverlayEvent event)
{
    if (event.type == ElementType.EXPERIENCE || event.type == ElementType.FOOD || event.type == ElementType.JUMPBAR )
    {
        YesOrNo = true;
    }

    if (!event.isCancelable() || !YesOrNo)return;

    if(this.mc.thePlayer.ridingEntity != null)
    {
        GuiIngameForge.renderFood = true;
    }

    if(GuiIngameForge.renderExperiance)
    {
        if(this.mc.thePlayer.ridingEntity instanceof EntityHorse)
        {
            GuiIngameForge.renderJumpBar = Keyboard.isKeyDown(Keyboard.KEY_SPACE);
        }
    }
}
 
Example 46
Project: SilentPets   File: EntityPet.java   Source Code and License 6 votes vote down vote up
@Override
public boolean func_142018_a(EntityLivingBase target, EntityLivingBase owner) {

  if (!(target instanceof EntityCreeper) && !(target instanceof EntityGhast)) {
    if (target instanceof EntityTameable) {
      EntityTameable entityTameable = (EntityTameable) target;

      if (entityTameable.isTamed() && entityTameable.getOwner() == owner) {
        return false;
      }
    }

    return target instanceof EntityPlayer && owner instanceof EntityPlayer
        && !((EntityPlayer) owner).canAttackPlayer((EntityPlayer) target) ? false
            : !(target instanceof EntityHorse) || !((EntityHorse) target).isTame();
  } else {
    return false;
  }
}
 
Example 47
Project: Cauldron   File: EntityPlayerMP.java   Source Code and License 6 votes vote down vote up
public void displayGUIHorse(EntityHorse p_110298_1_, IInventory p_110298_2_)
{
    // CraftBukkit start - Inventory open hook
    Container container = CraftEventFactory.callInventoryOpenEvent(this, new ContainerHorseInventory(this.inventory, p_110298_2_, p_110298_1_));

    if (container == null)
    {
        p_110298_2_.closeInventory(); // Cauldron - prevent chests from being stuck in open state on clients
        return;
    }

    // CraftBukkit end

    if (this.openContainer != this.inventoryContainer)
    {
        this.closeScreen();
    }

    this.getNextWindowId();
    this.playerNetServerHandler.sendPacket(new S2DPacketOpenWindow(this.currentWindowId, 11, p_110298_2_.getInventoryName(), p_110298_2_.getSizeInventory(), p_110298_2_.hasCustomInventoryName(), p_110298_1_.getEntityId()));
    this.openContainer = container; // CraftBukkit - Use container we passed to event
    this.openContainer.windowId = this.currentWindowId;
    this.openContainer.addCraftingToCrafters(this);
}
 
Example 48
Project: Rediscovered-Mod-1.7.10   File: EntitySkeletonHorse.java   Source Code and License 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.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityHorse.class, 0, false));
}
 
Example 49
Project: Cauldron   File: RenderHorse.java   Source Code and License 6 votes vote down vote up
protected ResourceLocation getEntityTexture(EntityHorse p_110775_1_)
{
    if (!p_110775_1_.func_110239_cn())
    {
        switch (p_110775_1_.getHorseType())
        {
            case 0:
            default:
                return whiteHorseTextures;
            case 1:
                return donkeyTextures;
            case 2:
                return muleTextures;
            case 3:
                return zombieHorseTextures;
            case 4:
                return skeletonHorseTextures;
        }
    }
    else
    {
        return this.func_110848_b(p_110775_1_);
    }
}
 
Example 50
Project: RuneCraftery   File: RenderHorse.java   Source Code and License 6 votes vote down vote up
protected ResourceLocation func_110849_a(EntityHorse par1EntityHorse)
{
    if (!par1EntityHorse.func_110239_cn())
    {
        switch (par1EntityHorse.getHorseType())
        {
            case 0:
            default:
                return whiteHorseTextures;
            case 1:
                return donkeyTextures;
            case 2:
                return muleTextures;
            case 3:
                return zombieHorseTextures;
            case 4:
                return skeletonHorseTextures;
        }
    }
    else
    {
        return this.func_110848_b(par1EntityHorse);
    }
}
 
Example 51
Project: Rediscovered-Mod-1.7.10   File: EntityZombieHorse.java   Source Code and License 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.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityHorse.class, 0, false));
}
 
Example 52
Project: Cauldron   File: RenderHorse.java   Source Code and License 6 votes vote down vote up
protected void preRenderCallback(EntityHorse p_77041_1_, float p_77041_2_)
{
    float f1 = 1.0F;
    int i = p_77041_1_.getHorseType();

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

    GL11.glScalef(f1, f1, f1);
    super.preRenderCallback(p_77041_1_, p_77041_2_);
}
 
Example 53
Project: Cauldron   File: RenderHorse.java   Source Code and License 6 votes vote down vote up
protected ResourceLocation getEntityTexture(EntityHorse p_110775_1_)
{
    if (!p_110775_1_.func_110239_cn())
    {
        switch (p_110775_1_.getHorseType())
        {
            case 0:
            default:
                return whiteHorseTextures;
            case 1:
                return donkeyTextures;
            case 2:
                return muleTextures;
            case 3:
                return zombieHorseTextures;
            case 4:
                return skeletonHorseTextures;
        }
    }
    else
    {
        return this.func_110848_b(p_110775_1_);
    }
}
 
Example 54
Project: Rediscovered-Mod-1.7.10   File: EntitySkeletonHorse.java   Source Code and License 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, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
    }
}
 
Example 55
Project: Rediscovered-Mod-1.6.4   File: EntitySkeletonHorse.java   Source Code and License 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 (this.worldObj.difficultySetting >= 2 && par1EntityLivingBase instanceof EntityHorse)
    {
        if (this.worldObj.difficultySetting == 2 && this.rand.nextBoolean())
        {
            return;
        }

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

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
    }
}
 
Example 56
Project: Rediscovered-Mod-1.6.4   File: EntityZombieHorse.java   Source Code and License 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.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityHorse.class, 0, false));
}
 
Example 57
Project: Rediscovered-Mod-1.6.4   File: EntityZombieHorse.java   Source Code and License 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 (this.worldObj.difficultySetting >= 2 && par1EntityLivingBase instanceof EntityHorse)
    {
        if (this.worldObj.difficultySetting == 2 && this.rand.nextBoolean())
        {
            return;
        }

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

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, (int)this.posX, (int)this.posY, (int)this.posZ, 0);
    }
}
 
Example 58
Project: ZeldaSwordSkills   File: ZSSPlayerSongs.java   Source Code and License 6 votes vote down vote up
/**
 * Returns last horse ridden or null if unavailable for some reason
 */
public EntityHorse getLastHorseRidden() {
	Entity entity = (horseId < 0 ? null : player.worldObj.getEntityByID(horseId));
	if (entity == null && horseUUID != null) {
		entity = getHorseByUUID();
	}
	// Check horse's last known chunk coordinates
	if (entity == null) {
		entity = getHorseFromChunk(horseChunkX, horseChunkZ);
		int n = 1; // search n surrounding chunks if horse is still null
		for (int i = -n; entity == null && i <= n; ++i) {
			for (int k = -n; entity == null && k <= n; ++k) {
				if (i != 0 || k != 0) {
					entity = getHorseFromChunk(horseChunkX + i, horseChunkZ + k);
				}
			}
		}
	}
	if (entity instanceof EntityHorse && entity.isEntityAlive()) {
		return (EntityHorse) entity;
	}
	// don't reset id fields, as horse may simply be in an unloaded chunk
	return null;
}
 
Example 59
Project: ZeldaSwordSkills   File: ZSSItemEvents.java   Source Code and License 6 votes vote down vote up
private static void init() {
	addDrop(EntityCreeper.class, SkillBase.armorBreak);
	addDrop(EntityIronGolem.class, SkillBase.armorBreak);
	addDrop(EntitySilverfish.class, SkillBase.dash);
	addDrop(EntityHorse.class, SkillBase.dash);
	addDrop(EntityEnderman.class, SkillBase.dodge);
	addDrop(EntityKeese.class, SkillBase.dodge);
	addDrop(EntitySpider.class, SkillBase.endingBlow);
	addDrop(EntityCaveSpider.class, SkillBase.leapingBlow);
	addDrop(EntityMagmaCube.class, SkillBase.leapingBlow);
	addDrop(EntityPigZombie.class, SkillBase.parry);
	addDrop(EntityOcelot.class, SkillBase.parry);
	addDrop(EntityOctorok.class, SkillBase.risingCut);
	addDrop(EntityBlaze.class, SkillBase.spinAttack);
	addDrop(EntityDarknut.class, SkillBase.spinAttack);
	addDrop(EntityZombie.class, SkillBase.swordBasic);
	addDrop(EntitySkeleton.class, SkillBase.swordBasic);
	addDrop(EntityGhast.class, SkillBase.swordBeam);
	addDrop(EntityWitch.class, SkillBase.swordBeam);
	addDrop(EntityWizzrobe.class, SkillBase.swordBreak);
}
 
Example 60
Project: ForbiddenMagic   File: ItemRidingCrop.java   Source Code and License 6 votes vote down vote up
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) {
    stack.damageItem(1, player);
    if (victim instanceof EntityHorse || victim instanceof EntityPig)
        victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 5));
    else if (victim instanceof EntityPlayer || victim instanceof EntityGolem) {
        victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 1));
        victim.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 200, 1));
        victim.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 200, 1));
    }
    if (!player.worldObj.isRemote && !Config.noLust && player.worldObj.provider.dimensionId == -1 && player.worldObj.rand.nextInt(15) == 1) {
        EntityItem ent = victim.entityDropItem(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), 1.0F);
        ent.motionY += player.worldObj.rand.nextFloat() * 0.05F;
        ent.motionX += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
        ent.motionZ += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
    }
    return true;
}