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


Java EntityPlayer.getRidingEntity方法代码示例

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


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

示例1: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (playerIn.isRiding() && playerIn.getRidingEntity() instanceof EntityPig)
    {
        EntityPig entitypig = (EntityPig)playerIn.getRidingEntity();

        if (itemStackIn.getMaxDamage() - itemStackIn.getMetadata() >= 7 && entitypig.boost())
        {
            itemStackIn.damageItem(7, playerIn);

            if (itemStackIn.stackSize == 0)
            {
                ItemStack itemstack = new ItemStack(Items.FISHING_ROD);
                itemstack.setTagCompound(itemStackIn.getTagCompound());
                return new ActionResult(EnumActionResult.SUCCESS, itemstack);
            }

            return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
        }
    }

    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.PASS, itemStackIn);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:ItemCarrotOnAStick.java

示例2: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);

    if (itemStackIn.isRemote)
    {
        return new ActionResult(EnumActionResult.PASS, itemstack);
    }
    else
    {
        if (worldIn.isRiding() && worldIn.getRidingEntity() instanceof EntityPig)
        {
            EntityPig entitypig = (EntityPig)worldIn.getRidingEntity();

            if (itemstack.getMaxDamage() - itemstack.getMetadata() >= 7 && entitypig.boost())
            {
                itemstack.damageItem(7, worldIn);

                if (itemstack.func_190926_b())
                {
                    ItemStack itemstack1 = new ItemStack(Items.FISHING_ROD);
                    itemstack1.setTagCompound(itemstack.getTagCompound());
                    return new ActionResult(EnumActionResult.SUCCESS, itemstack1);
                }

                return new ActionResult(EnumActionResult.SUCCESS, itemstack);
            }
        }

        worldIn.addStat(StatList.getObjectUseStats(this));
        return new ActionResult(EnumActionResult.PASS, itemstack);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:34,代码来源:ItemCarrotOnAStick.java

示例3: renderMountHealth

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private void renderMountHealth(ScaledResolution p_184047_1_)
{
    if (this.mc.getRenderViewEntity() instanceof EntityPlayer)
    {
        EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity();
        Entity entity = entityplayer.getRidingEntity();

        if (entity instanceof EntityLivingBase)
        {
            this.mc.mcProfiler.endStartSection("mountHealth");
            EntityLivingBase entitylivingbase = (EntityLivingBase)entity;
            int i = (int)Math.ceil((double)entitylivingbase.getHealth());
            float f = entitylivingbase.getMaxHealth();
            int j = (int)(f + 0.5F) / 2;

            if (j > 30)
            {
                j = 30;
            }

            int k = p_184047_1_.getScaledHeight() - 39;
            int l = p_184047_1_.getScaledWidth() / 2 + 91;
            int i1 = k;
            int j1 = 0;

            for (boolean flag = false; j > 0; j1 += 20)
            {
                int k1 = Math.min(j, 10);
                j -= k1;

                for (int l1 = 0; l1 < k1; ++l1)
                {
                    int i2 = 52;
                    int j2 = 0;
                    int k2 = l - l1 * 8 - 9;
                    this.drawTexturedModalRect(k2, i1, 52 + j2 * 9, 9, 9, 9);

                    if (l1 * 2 + 1 + j1 < i)
                    {
                        this.drawTexturedModalRect(k2, i1, 88, 9, 9, 9);
                    }

                    if (l1 * 2 + 1 + j1 == i)
                    {
                        this.drawTexturedModalRect(k2, i1, 97, 9, 9, 9);
                    }
                }

                i1 -= 10;
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:54,代码来源:GuiIngame.java

示例4: renderHealthMount

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected void renderHealthMount(int width, int height)
{
    EntityPlayer player = (EntityPlayer)mc.getRenderViewEntity();
    Entity tmp = player.getRidingEntity();
    if (!(tmp instanceof EntityLivingBase)) return;

    bind(ICONS);

    if (pre(HEALTHMOUNT)) return;

    boolean unused = false;
    int left_align = width / 2 + 91;

    mc.mcProfiler.endStartSection("mountHealth");
    GlStateManager.enableBlend();
    EntityLivingBase mount = (EntityLivingBase)tmp;
    int health = (int)Math.ceil((double)mount.getHealth());
    float healthMax = mount.getMaxHealth();
    int hearts = (int)(healthMax + 0.5F) / 2;

    if (hearts > 30) hearts = 30;

    final int MARGIN = 52;
    final int BACKGROUND = MARGIN + (unused ? 1 : 0);
    final int HALF = MARGIN + 45;
    final int FULL = MARGIN + 36;

    for (int heart = 0; hearts > 0; heart += 20)
    {
        int top = height - right_height;

        int rowCount = Math.min(hearts, 10);
        hearts -= rowCount;

        for (int i = 0; i < rowCount; ++i)
        {
            int x = left_align - i * 8 - 9;
            drawTexturedModalRect(x, top, BACKGROUND, 9, 9, 9);

            if (i * 2 + 1 + heart < health)
                drawTexturedModalRect(x, top, FULL, 9, 9, 9);
            else if (i * 2 + 1 + heart == health)
                drawTexturedModalRect(x, top, HALF, 9, 9, 9);
        }

        right_height += 10;
    }
    GlStateManager.disableBlend();
    post(HEALTHMOUNT);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:51,代码来源:GuiIngameForge.java

示例5: renderMountHealth

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
protected void renderMountHealth(ScaledResolution p_184047_1_)
{
    if (this.mc.getRenderViewEntity() instanceof EntityPlayer)
    {
        EntityPlayer entityplayer = (EntityPlayer)this.mc.getRenderViewEntity();
        Entity entity = entityplayer.getRidingEntity();

        if (entity instanceof EntityLivingBase)
        {
            this.mc.mcProfiler.endStartSection("mountHealth");
            EntityLivingBase entitylivingbase = (EntityLivingBase)entity;
            int i = (int)Math.ceil((double)entitylivingbase.getHealth());
            float f = entitylivingbase.getMaxHealth();
            int j = (int)(f + 0.5F) / 2;

            if (j > 30)
            {
                j = 30;
            }

            int k = p_184047_1_.getScaledHeight() - 39;
            int l = p_184047_1_.getScaledWidth() / 2 + 91;
            int i1 = k;
            int j1 = 0;

            for (boolean flag = false; j > 0; j1 += 20)
            {
                int k1 = Math.min(j, 10);
                j -= k1;

                for (int l1 = 0; l1 < k1; ++l1)
                {
                    int i2 = 52;
                    int j2 = 0;
                    int k2 = l - l1 * 8 - 9;
                    this.drawTexturedModalRect(k2, i1, 52 + j2 * 9, 9, 9, 9);

                    if (l1 * 2 + 1 + j1 < i)
                    {
                        this.drawTexturedModalRect(k2, i1, 88, 9, 9, 9);
                    }

                    if (l1 * 2 + 1 + j1 == i)
                    {
                        this.drawTexturedModalRect(k2, i1, 97, 9, 9, 9);
                    }
                }

                i1 -= 10;
            }
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:54,代码来源:GuiIngame.java


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