本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.getItemInUseCount方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.getItemInUseCount方法的具体用法?Java EntityPlayer.getItemInUseCount怎么用?Java EntityPlayer.getItemInUseCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.getItemInUseCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCastTick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onCastTick(World world, EntityPlayer player, ItemStack stack) {
if (!world.isRemote) {
if (player.getItemInUseCount() % 2 == 0 && consumePower(player)) {
Vec3d lookVec = player.getLookVec();
double x = player.posX + lookVec.xCoord;
double y = player.posY + lookVec.yCoord + player.getEyeHeight();
double z = player.posZ + lookVec.zCoord;
EntityFireBreath fireBreath = new EntityFireBreath(world, player, 5);
fireBreath.setPosition(x, y, z);
fireBreath.setAim(player, player.rotationPitch, player.rotationYaw, 1F, 0.1F);
world.spawnEntity(fireBreath);
}
}
}
示例2: onCastTick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public void onCastTick(World world, EntityPlayer player, ItemStack stack) {
if (!world.isRemote) {
BlockPos centerPos = player.getPosition();
AxisAlignedBB area = new AxisAlignedBB(centerPos).expandXyz(3F);
for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(player, area)) {
if (entity instanceof EntityLivingBase) {
WorldServer worldServer = (WorldServer) world;
if (player.getItemInUseCount() % 10 == 0 && consumePower(player)) {
MessageSoulDrainFX message = new MessageSoulDrainFX(entity.posX,
entity.posY + (entity.height / 2.0F), entity.posZ, player.posX,
player.posY + (player.height / 2.0F), player.posZ);
PacketHandler.INSTANCE.sendToAllAround(message, new NetworkRegistry.TargetPoint(
player.dimension, player.posX, player.posY, player.posZ, 128));
entity.attackEntityFrom(DamageSource.magic, 1);
world.spawnEntity(new EntityXPOrb(world, entity.posX, entity.posY + 0.5, entity.posZ, 1));
}
}
}
}
}
示例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();
}