当前位置: 首页>>代码示例>>Java>>正文


Java EntityPlayer.startRiding方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.startRiding方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.startRiding方法的具体用法?Java EntityPlayer.startRiding怎么用?Java EntityPlayer.startRiding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


在下文中一共展示了EntityPlayer.startRiding方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: songTick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@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;
}
 
开发者ID:TeamMelodium,项目名称:Melodium,代码行数:21,代码来源:SongHorse.java

示例2: processInitialInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean processInitialInteract(EntityPlayer player, EnumHand stack)
{
    if (player.isSneaking())
    {
        return false;
    }
    else
    {
        if (!this.world.isRemote && this.outOfControlTicks < 60.0F)
        {
            player.startRiding(this);
        }

        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:17,代码来源:EntityBoat.java

示例3: processInitialInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean processInitialInteract(EntityPlayer player, EnumHand stack)
{
    if (player.isSneaking())
    {
        return false;
    }
    else if (this.isBeingRidden())
    {
        return true;
    }
    else
    {
        if (!this.world.isRemote)
        {
            player.startRiding(this);
        }

        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:EntityMinecartEmpty.java

示例4: processInitialInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean processInitialInteract(EntityPlayer player, @Nullable ItemStack stack, EnumHand hand)
{
    if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.minecart.MinecartInteractEvent(this, player, stack, hand))) return true;

    if (player.isSneaking())
    {
        return false;
    }
    else if (this.isBeingRidden())
    {
        return true;
    }
    else
    {
        if (!this.worldObj.isRemote)
        {
            player.startRiding(this);
        }

        return true;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:EntityMinecartEmpty.java

示例5: processInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
    if (!super.processInteract(player, hand, stack))
    {
        if (this.getSaddled() && !this.worldObj.isRemote && !this.isBeingRidden())
        {
            player.startRiding(this);
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:EntityPig.java

示例6: mountTo

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected void mountTo(EntityPlayer player)
{
    player.rotationYaw = this.rotationYaw;
    player.rotationPitch = this.rotationPitch;
    this.setEatingHaystack(false);
    this.setRearing(false);

    if (!this.world.isRemote)
    {
        player.startRiding(this);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:AbstractHorse.java

示例7: processInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    if (!super.processInteract(player, hand))
    {
        ItemStack itemstack = player.getHeldItem(hand);

        if (itemstack.getItem() == Items.NAME_TAG)
        {
            itemstack.interactWithEntity(player, this, hand);
            return true;
        }
        else if (this.getSaddled() && !this.isBeingRidden())
        {
            if (!this.world.isRemote)
            {
                player.startRiding(this);
            }

            return true;
        }
        else if (itemstack.getItem() == Items.SADDLE)
        {
            itemstack.interactWithEntity(player, this, hand);
            return true;
        }
        else
        {
            return false;
        }
    }
    else
    {
        return true;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:EntityPig.java

示例8: processInitialInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean processInitialInteract(EntityPlayer player, @Nullable ItemStack stack, EnumHand hand)
{
    if (!this.worldObj.isRemote && !player.isSneaking() && this.outOfControlTicks < 60.0F)
    {
        player.startRiding(this);
    }

    return true;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:EntityBoat.java

示例9: mountTo

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void mountTo(EntityPlayer player)
{
    player.rotationYaw = this.rotationYaw;
    player.rotationPitch = this.rotationPitch;
    this.setEatingHaystack(false);
    this.setRearing(false);

    if (!this.worldObj.isRemote)
    {
        player.startRiding(this);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:EntityHorse.java

示例10: processInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
protected boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack) {
    if(player != null && this.canBeRidden(player) && !this.isBeingRidden()) {
        player.startRiding(this);
        return true;
    }
    return false;
}
 
开发者ID:CJ-MC-Mods,项目名称:SimpleTractor,代码行数:9,代码来源:EntityTractor.java


注:本文中的net.minecraft.entity.player.EntityPlayer.startRiding方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。