java类net.minecraft.entity.player.EntityPlayer的实例源码

EnderQuartzClip.java 文件源码 项目:minecraft-quiverbow 阅读 25 收藏 0 点赞 0 评论 0
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean unknown) 
{
    list.add(EnumChatFormatting.BLUE + "Ender Quartz: " + (this.getMaxDamage() - stack.getItemDamage()) + " / " + this.getMaxDamage());
    list.add(EnumChatFormatting.YELLOW + "Use magazine to fill it with");
    list.add(EnumChatFormatting.YELLOW + "Ender Pearls and Quartz.");
    list.add("A clip full of");
    list.add("quartz-encased ender pearls.");

    if (!player.inventory.hasItem(Items.ender_pearl)) { list.add(EnumChatFormatting.RED + "You don't have ender pearls."); }
    if (!player.inventory.hasItem(Items.quartz)) { list.add(EnumChatFormatting.RED + "You don't have quartz."); }
    if (player.capabilities.isCreativeMode) { list.add(EnumChatFormatting.RED + "Does not work in creative mode."); }
}
ItemWateringCan.java 文件源码 项目:ExPetrum 阅读 25 收藏 0 点赞 0 评论 0
public void tryHydrateBlock(EntityPlayer player, int tier, BlockPos pos, World w, IBlockState state, IFluidHandlerItem cap, ItemStack is)
{
    while ((state.getMaterial() == Material.PLANTS || w.isAirBlock(pos)) && pos.getY() > 0)
    {
        pos = pos.down();
        state = w.getBlockState(pos);
    }

    if (state.getBlock() instanceof IAcceptsWaterCan)
    {
        ((IAcceptsWaterCan)state.getBlock()).acceptWatering(player, w, pos, state, cap, is, tier);
    }

    w.spawnParticle(EnumParticleTypes.WATER_SPLASH, pos.getX() + w.rand.nextFloat(), pos.getY() + 1, pos.getZ() + w.rand.nextFloat(), 0, 0, 0);
}
StartFactionDeed.java 文件源码 项目:minecraft-territorialdealings 阅读 60 收藏 0 点赞 0 评论 0
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
    super.addInformation(stack, player, list, par4);

    list.add("'The start of something great.'");
    list.add("Use this to create a new faction");
    list.add("in your current chunk.");
    list.add(ChatFormatting.YELLOW + "Each claimed chunk increases");
    list.add(ChatFormatting.YELLOW + "territory upkeep by 1.");
    list.add(ChatFormatting.RED + "Used up on successful creation.");
   }
InventoryEnderChest.java 文件源码 项目:DecompiledMinecraft 阅读 25 收藏 0 点赞 0 评论 0
public void closeInventory(EntityPlayer player)
{
    if (this.associatedChest != null)
    {
        this.associatedChest.closeChest();
    }

    super.closeInventory(player);
    this.associatedChest = null;
}
EntityLivingBase.java 文件源码 项目:BaseClient 阅读 25 收藏 0 点赞 0 评论 0
/**
 * returns true if this entity is by a ladder, false otherwise
 */
public boolean isOnLadder()
{
    int i = MathHelper.floor_double(this.posX);
    int j = MathHelper.floor_double(this.getEntityBoundingBox().minY);
    int k = MathHelper.floor_double(this.posZ);
    Block block = this.worldObj.getBlockState(new BlockPos(i, j, k)).getBlock();
    return (block == Blocks.ladder || block == Blocks.vine) && (!(this instanceof EntityPlayer) || !((EntityPlayer)this).isSpectator());
}
Entity.java 文件源码 项目:Backmemed 阅读 27 收藏 0 点赞 0 评论 0
/**
 * Only used by renderer in EntityLivingBase subclasses.
 * Determines if an entity is visible or not to a specfic player, if the entity is normally invisible.
 * For EntityLivingBase subclasses, returning false when invisible will render the entity semitransparent.
 */
public boolean isInvisibleToPlayer(EntityPlayer player)
{
    if (player.isSpectator())
    {
        return false;
    }
    else
    {
        Team team = this.getTeam();
        return team != null && player != null && player.getTeam() == team && team.getSeeFriendlyInvisiblesEnabled() ? false : this.isInvisible();
    }
}
EntityCow.java 文件源码 项目:BaseClient 阅读 23 收藏 0 点赞 0 评论 0
public EntityCow(World worldIn)
{
    super(worldIn);
    this.setSize(0.9F, 1.3F);
    ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
    this.tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIPanic(this, 2.0D));
    this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(3, new EntityAITempt(this, 1.25D, Items.wheat, false));
    this.tasks.addTask(4, new EntityAIFollowParent(this, 1.25D));
    this.tasks.addTask(5, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.tasks.addTask(7, new EntityAILookIdle(this));
}
Scoreboard.java 文件源码 项目:BaseClient 阅读 24 收藏 0 点赞 0 评论 0
public void func_181140_a(Entity p_181140_1_)
{
    if (p_181140_1_ != null && !(p_181140_1_ instanceof EntityPlayer) && !p_181140_1_.isEntityAlive())
    {
        String s = p_181140_1_.getUniqueID().toString();
        this.removeObjectiveFromEntity(s, (ScoreObjective)null);
        this.removePlayerFromTeams(s);
    }
}
StatisticsFile.java 文件源码 项目:DecompiledMinecraft 阅读 28 收藏 0 点赞 0 评论 0
/**
 * Triggers the logging of an achievement and attempts to announce to server
 */
public void unlockAchievement(EntityPlayer playerIn, StatBase statIn, int p_150873_3_)
{
    int i = statIn.isAchievement() ? this.readStat(statIn) : 0;
    super.unlockAchievement(playerIn, statIn, p_150873_3_);
    this.field_150888_e.add(statIn);

    if (statIn.isAchievement() && i == 0 && p_150873_3_ > 0)
    {
        this.field_150886_g = true;

        if (this.mcServer.isAnnouncingPlayerAchievements())
        {
            this.mcServer.getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.achievement", new Object[] {playerIn.getDisplayName(), statIn.func_150955_j()}));
        }
    }

    if (statIn.isAchievement() && i > 0 && p_150873_3_ == 0)
    {
        this.field_150886_g = true;

        if (this.mcServer.isAnnouncingPlayerAchievements())
        {
            this.mcServer.getConfigurationManager().sendChatMsg(new ChatComponentTranslation("chat.type.achievement.taken", new Object[] {playerIn.getDisplayName(), statIn.func_150955_j()}));
        }
    }
}
ItemMinecart.java 文件源码 项目:DecompiledMinecraft 阅读 23 收藏 0 点赞 0 评论 0
/**
 * Called when a Block is right-clicked with this Item
 */
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (BlockRailBase.isRailBlock(iblockstate))
    {
        if (!worldIn.isRemote)
        {
            BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = iblockstate.getBlock() instanceof BlockRailBase ? (BlockRailBase.EnumRailDirection)iblockstate.getValue(((BlockRailBase)iblockstate.getBlock()).getShapeProperty()) : BlockRailBase.EnumRailDirection.NORTH_SOUTH;
            double d0 = 0.0D;

            if (blockrailbase$enumraildirection.isAscending())
            {
                d0 = 0.5D;
            }

            EntityMinecart entityminecart = EntityMinecart.func_180458_a(worldIn, (double)pos.getX() + 0.5D, (double)pos.getY() + 0.0625D + d0, (double)pos.getZ() + 0.5D, this.minecartType);

            if (stack.hasDisplayName())
            {
                entityminecart.setCustomNameTag(stack.getDisplayName());
            }

            worldIn.spawnEntityInWorld(entityminecart);
        }

        --stack.stackSize;
        return true;
    }
    else
    {
        return false;
    }
}


问题


面经


文章

微信
公众号

扫码关注公众号