本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getItemInUse方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getItemInUse方法的具体用法?Java EntityPlayer.getItemInUse怎么用?Java EntityPlayer.getItemInUse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.getItemInUse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getIcon
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
{
if(player.getItemInUse() == null) { return this.itemIcon; }
int Pulling = stack.getMaxItemUseDuration() - useRemaining; // Displaying the bow drawing animation based on the use state
if (Pulling >= 18) { return this.pull_2; }
else if (Pulling > 13) { return this.pull_1; }
else if (Pulling > 0) { return this.pull_0; }
return itemIcon;
}
示例2: getIcon
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) // On hand display
{
if(player.getItemInUse() == null) { return this.itemIcon; }
int Pulling = stack.getMaxItemUseDuration() - useRemaining; // Displaying the bow drawing animation based on the use state
if (Pulling >= 18) { return this.pull_2; }
else if (Pulling > 13) { return this.pull_1; }
else if (Pulling > 0) { return this.pull_0; }
return this.itemIcon;
}
示例3: renderItem
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
ResourceLocation resource = textureManager.getResourceLocation(stack.getItemSpriteNumber());
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
ItemStack usingItem = player.getItemInUse();
int useRemaining = player.getItemInUseCount();
ItemBow bow = (ItemBow) stack.getItem();
IIcon icon = bow.getIcon(stack, 0);
if (usingItem != null && usingItem == stack) {
int charge = stack.getMaxItemUseDuration() - useRemaining;
if (charge >= 18)
icon = bow.getItemIconForUseDuration(2);
else if (charge > 13)
icon = bow.getItemIconForUseDuration(1);
else if (charge > 0)
icon = bow.getItemIconForUseDuration(0);
}
if (icon == null)
icon = ((TextureMap) textureManager.getTexture(resource)).getAtlasSprite("missingno");
OpenGLHelper.pushMatrix();
textureManager.bindTexture(resource);
OpenGLHelper.colour(bow.getColorFromItemStack(stack, 0));
OpenGLHelper.disableLighting();
OpenGLHelper.enableAlpha();
OpenGLHelper.enableBlend();
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
renderItem.renderIcon(0, 0, icon, 16, 16);
OpenGLHelper.enableLighting();
OpenGLHelper.disableAlpha();
OpenGLHelper.disableBlend();
if (stack.hasEffect(0))
renderItem.renderEffect(textureManager, 0, 0);
OpenGLHelper.popMatrix();
}