Java Code Examples for net.minecraft.entity.player.EntityPlayer.mountEntity()

The following are Jave code examples for showing how to use mountEntity() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: EntityBoat.java   View Source Code Vote up 6 votes
/**
 * First layer of player interaction
 */
public boolean interactFirst(EntityPlayer playerIn)
{
    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
    {
        return true;
    }
    else
    {
        if (!this.worldObj.isRemote)
        {
            playerIn.mountEntity(this);
        }

        return true;
    }
}
 
Example 2
Project: DecompiledMinecraft   File: EntityMinecartEmpty.java   View Source Code Vote up 6 votes
/**
 * First layer of player interaction
 */
public boolean interactFirst(EntityPlayer playerIn)
{
    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
    {
        return true;
    }
    else if (this.riddenByEntity != null && this.riddenByEntity != playerIn)
    {
        return false;
    }
    else
    {
        if (!this.worldObj.isRemote)
        {
            playerIn.mountEntity(this);
        }

        return true;
    }
}
 
Example 3
Project: DecompiledMinecraft   File: EntityPig.java   View Source Code Vote up 6 votes
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    if (super.interact(player))
    {
        return true;
    }
    else if (!this.getSaddled() || this.worldObj.isRemote || this.riddenByEntity != null && this.riddenByEntity != player)
    {
        return false;
    }
    else
    {
        player.mountEntity(this);
        return true;
    }
}
 
Example 4
Project: DecompiledMinecraft   File: EntityBoat.java   View Source Code Vote up 6 votes
/**
 * First layer of player interaction
 */
public boolean interactFirst(EntityPlayer playerIn)
{
    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
    {
        return true;
    }
    else
    {
        if (!this.worldObj.isRemote)
        {
            playerIn.mountEntity(this);
        }

        return true;
    }
}
 
Example 5
Project: DecompiledMinecraft   File: EntityMinecartEmpty.java   View Source Code Vote up 6 votes
/**
 * First layer of player interaction
 */
public boolean interactFirst(EntityPlayer playerIn)
{
    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
    {
        return true;
    }
    else if (this.riddenByEntity != null && this.riddenByEntity != playerIn)
    {
        return false;
    }
    else
    {
        if (!this.worldObj.isRemote)
        {
            playerIn.mountEntity(this);
        }

        return true;
    }
}
 
Example 6
Project: DecompiledMinecraft   File: EntityPig.java   View Source Code Vote up 6 votes
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    if (super.interact(player))
    {
        return true;
    }
    else if (!this.getSaddled() || this.worldObj.isRemote || this.riddenByEntity != null && this.riddenByEntity != player)
    {
        return false;
    }
    else
    {
        player.mountEntity(this);
        return true;
    }
}
 
Example 7
Project: BaseClient   File: EntityBoat.java   View Source Code Vote up 6 votes
/**
 * First layer of player interaction
 */
public boolean interactFirst(EntityPlayer playerIn)
{
    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
    {
        return true;
    }
    else
    {
        if (!this.worldObj.isRemote)
        {
            playerIn.mountEntity(this);
        }

        return true;
    }
}
 
Example 8
Project: BaseClient   File: EntityMinecartEmpty.java   View Source Code Vote up 6 votes
/**
 * First layer of player interaction
 */
public boolean interactFirst(EntityPlayer playerIn)
{
    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
    {
        return true;
    }
    else if (this.riddenByEntity != null && this.riddenByEntity != playerIn)
    {
        return false;
    }
    else
    {
        if (!this.worldObj.isRemote)
        {
            playerIn.mountEntity(this);
        }

        return true;
    }
}
 
Example 9
Project: BaseClient   File: EntityPig.java   View Source Code Vote up 6 votes
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    if (super.interact(player))
    {
        return true;
    }
    else if (!this.getSaddled() || this.worldObj.isRemote || this.riddenByEntity != null && this.riddenByEntity != player)
    {
        return false;
    }
    else
    {
        player.mountEntity(this);
        return true;
    }
}
 
Example 10
Project: BaseClient   File: EntityBoat.java   View Source Code Vote up 6 votes
/**
 * First layer of player interaction
 */
public boolean interactFirst(EntityPlayer playerIn)
{
    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
    {
        return true;
    }
    else
    {
        if (!this.worldObj.isRemote)
        {
            playerIn.mountEntity(this);
        }

        return true;
    }
}
 
Example 11
Project: BaseClient   File: EntityMinecartEmpty.java   View Source Code Vote up 6 votes
/**
 * First layer of player interaction
 */
public boolean interactFirst(EntityPlayer playerIn)
{
    if (this.riddenByEntity != null && this.riddenByEntity instanceof EntityPlayer && this.riddenByEntity != playerIn)
    {
        return true;
    }
    else if (this.riddenByEntity != null && this.riddenByEntity != playerIn)
    {
        return false;
    }
    else
    {
        if (!this.worldObj.isRemote)
        {
            playerIn.mountEntity(this);
        }

        return true;
    }
}
 
Example 12
Project: BaseClient   File: EntityPig.java   View Source Code Vote up 6 votes
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    if (super.interact(player))
    {
        return true;
    }
    else if (!this.getSaddled() || this.worldObj.isRemote || this.riddenByEntity != null && this.riddenByEntity != player)
    {
        return false;
    }
    else
    {
        player.mountEntity(this);
        return true;
    }
}
 
Example 13
Project: DecompiledMinecraft   File: EntityHorse.java   View Source Code Vote up 5 votes
private void mountTo(EntityPlayer player)
{
    player.rotationYaw = this.rotationYaw;
    player.rotationPitch = this.rotationPitch;
    this.setEatingHaystack(false);
    this.setRearing(false);

    if (!this.worldObj.isRemote)
    {
        player.mountEntity(this);
    }
}
 
Example 14
Project: DecompiledMinecraft   File: EntityHorse.java   View Source Code Vote up 5 votes
private void mountTo(EntityPlayer player)
{
    player.rotationYaw = this.rotationYaw;
    player.rotationPitch = this.rotationPitch;
    this.setEatingHaystack(false);
    this.setRearing(false);

    if (!this.worldObj.isRemote)
    {
        player.mountEntity(this);
    }
}
 
Example 15
Project: BaseClient   File: EntityHorse.java   View Source Code Vote up 5 votes
private void mountTo(EntityPlayer player)
{
    player.rotationYaw = this.rotationYaw;
    player.rotationPitch = this.rotationPitch;
    this.setEatingHaystack(false);
    this.setRearing(false);

    if (!this.worldObj.isRemote)
    {
        player.mountEntity(this);
    }
}
 
Example 16
Project: BaseClient   File: EntityHorse.java   View Source Code Vote up 5 votes
private void mountTo(EntityPlayer player)
{
    player.rotationYaw = this.rotationYaw;
    player.rotationPitch = this.rotationPitch;
    this.setEatingHaystack(false);
    this.setRearing(false);

    if (!this.worldObj.isRemote)
    {
        player.mountEntity(this);
    }
}
 
Example 17
Project: minecraft-quiverbow   File: Entity_AA.java   View Source Code Vote up 4 votes
@Override
public boolean interact(EntityPlayer player)
   {
	if (this.worldObj.isRemote) { return true; }	// Client side. Doesn't have the same info, so makes a different decision. Ugh.
													// They'll just shoot when trying to equip this with a weapon
	if (!player.getDisplayName().equals(this.ownerName)) { return false; }	// Not the owner, so not doing this
	
	ItemStack itemstack = player.inventory.getCurrentItem();
	
	// Isn't holding anything
	if (itemstack == null) 
	{
		if (player.isSneaking())	// They're sneaking, so removing our weapon now
		{
			if (!this.hasFirstWeapon)	// Not holding a primary weapon, meaning I'm not holding anything right now. So folding myself up
			{
				AI_Storage.dropSelf(this);
			}
			else	// Holding a weapon, so dropping it and all ammo
			{
				AI_Storage.dropFirstWeapon(this);
				AI_Storage.dropSecondWeapon(this);
				AI_Storage.dropStoredItems(this);
			}
			
			return true;
		}
		else if (this.hasRidingUpgrade)	// Not sneaking and we have the riding upgrade, so the owner can giddy up
        {
			player.mountEntity(this);	
            return true;
        }
		
		return false; 
	}
	
	// Holding a weapon
	else if (itemstack.getItem() instanceof _WeaponBase) 
	{
		if (!player.capabilities.isCreativeMode) { player.setCurrentItemOrArmor(0, null); }	// Taking that
		
		if (this.hasWeaponUpgrade && player.isSneaking())
		{
			AI_WeaponHandler.setSecondWeapon(this, itemstack.copy());	// Equipping it in the second weapon slot, since we have that space
		}
		else	// Either not sneaking or doesn't have that weapon upgrade. Works for me
		{
			AI_WeaponHandler.setFirstWeapon(this, itemstack.copy());	// Equipping it
		}
		
		return true;
	}
	
	else if (itemstack.getItem() == Item.getItemFromBlock(Blocks.iron_block)) // Holding repair material
	{
		AI_Properties.doRepair(player, this, itemstack);
	}
	
	else if (itemstack.getItem() == Items.name_tag) // Holding a name tag
	{
		AI_Properties.applyNameTag(player, this, itemstack, true);
	}
	
	else	// Holding whatever
	{
		AI_Storage.addItem(player, this, itemstack);
		return true;
	}
	
	return false;
   }