本文整理汇总了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);
}
示例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);
}
}
示例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;
}
}
}
}
示例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);
}
示例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;
}
}
}
}