Java 类net.minecraft.entity.player.EntityPlayer 实例源码

项目:BaseClient    文件:EntityEnderman.java   
/**
 * Checks to see if this enderman should be attacking this player
 */
private boolean shouldAttackPlayer(EntityPlayer player)
{
    ItemStack itemstack = player.inventory.armorInventory[3];

    if (itemstack != null && itemstack.getItem() == Item.getItemFromBlock(Blocks.pumpkin))
    {
        return false;
    }
    else
    {
        Vec3 vec3 = player.getLook(1.0F).normalize();
        Vec3 vec31 = new Vec3(this.posX - player.posX, this.getEntityBoundingBox().minY + (double)(this.height / 2.0F) - (player.posY + (double)player.getEyeHeight()), this.posZ - player.posZ);
        double d0 = vec31.lengthVector();
        vec31 = vec31.normalize();
        double d1 = vec3.dotProduct(vec31);
        return d1 > 1.0D - 0.025D / d0 ? player.canEntityBeSeen(this) : false;
    }
}
项目:BaseClient    文件:EntitySheep.java   
public EntitySheep(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, 1.25D));
    this.tasks.addTask(2, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(3, new EntityAITempt(this, 1.1D, Items.wheat, false));
    this.tasks.addTask(4, new EntityAIFollowParent(this, 1.1D));
    this.tasks.addTask(5, this.entityAIEatGrass);
    this.tasks.addTask(6, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWatchClosest(this, EntityPlayer.class, 6.0F));
    this.tasks.addTask(8, new EntityAILookIdle(this));
    this.inventoryCrafting.setInventorySlotContents(0, new ItemStack(Items.dye, 1, 0));
    this.inventoryCrafting.setInventorySlotContents(1, new ItemStack(Items.dye, 1, 0));
}
项目:Loot-Slash-Conquer    文件:PacketClassGui.java   
@Override
public IMessage onMessage(final PacketClassGui message, final MessageContext ctx) 
{           
    IThreadListener mainThread = Minecraft.getMinecraft();
    mainThread.addScheduledTask(new Runnable()
    {
        @Override
        public void run() 
        {
            EntityPlayer player = Minecraft.getMinecraft().player;
            PlayerInformation playerInfo = (PlayerInformation) player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);

            if (playerInfo != null && playerInfo.getPlayerClass() == 0)
            {
                player.openGui(LootSlashConquer.instance, GuiHandler.CLASS_SELECTION, player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ());
            }
        }
    });

    return null;
}
项目:Zombe-Modpack    文件:Motion.java   
private static void emulateSendMotion(EntityPlayer player) {
    // emulate client player's sendMotion
    Vec3d newPosition = null;
    if (player.isRiding()) {
        // needs improvement
        newPosition = getPosition(player);
        emulateHandleMotion(player, newPosition, getOnGround(player));
    } else if (getView() == player) {
        double dx = getX(sentPosition) - getX(player);
        double dy = getY(sentPosition) - getY(player);
        double dz = getZ(sentPosition) - getZ(player);
        boolean sync = (dx*dx + dy*dy + dz*dz > 9.0E-4D
            || ticksForForceSync >= 20);
        ++ticksForForceSync;
        if (sync) {
            newPosition = sentPosition = getPosition(player);
            ticksForForceSync = 0;
        }
        emulateHandleMotion(player, newPosition, getOnGround(player));
    }
}
项目:DecompiledMinecraft    文件:BlockFarmland.java   
/**
 * Block's chance to react to a living entity falling on it.
 */
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
{
    if (entityIn instanceof EntityLivingBase)
    {
        if (!worldIn.isRemote && worldIn.rand.nextFloat() < fallDistance - 0.5F)
        {
            if (!(entityIn instanceof EntityPlayer) && !worldIn.getGameRules().getBoolean("mobGriefing"))
            {
                return;
            }

            worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
        }

        super.onFallenUpon(worldIn, pos, entityIn, fallDistance);
    }
}
项目:DecompiledMinecraft    文件:EntitySkeleton.java   
/**
 * Called when the mob's health reaches 0.
 */
public void onDeath(DamageSource cause)
{
    super.onDeath(cause);

    if (cause.getSourceOfDamage() instanceof EntityArrow && cause.getEntity() instanceof EntityPlayer)
    {
        EntityPlayer entityplayer = (EntityPlayer)cause.getEntity();
        double d0 = entityplayer.posX - this.posX;
        double d1 = entityplayer.posZ - this.posZ;

        if (d0 * d0 + d1 * d1 >= 2500.0D)
        {
            entityplayer.triggerAchievement(AchievementList.snipeSkeleton);
        }
    }
    else if (cause.getEntity() instanceof EntityCreeper && ((EntityCreeper)cause.getEntity()).getPowered() && ((EntityCreeper)cause.getEntity()).isAIEnabled())
    {
        ((EntityCreeper)cause.getEntity()).func_175493_co();
        this.entityDropItem(new ItemStack(Items.skull, 1, this.getSkeletonType() == 1 ? 1 : 0), 0.0F);
    }
}
项目:IceMod    文件:IceFragment.java   
/** Makes your Item Enchanted when it is crafted */
public void onCreated(ItemStack item, World world, EntityPlayer player) 
{
    item.addEnchantment(Enchantment.sharpness, 5);
    // Replace the "." after "Enchantment" to see options
    // The number is the Enchantment Level
}
项目:DecompiledMinecraft    文件:EntitySkeleton.java   
public EntitySkeleton(World worldIn)
{
    super(worldIn);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, new EntityAIRestrictSun(this));
    this.tasks.addTask(3, new EntityAIFleeSun(this, 1.0D));
    this.tasks.addTask(3, new EntityAIAvoidEntity(this, EntityWolf.class, 6.0F, 1.0D, 1.2D));
    this.tasks.addTask(4, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(6, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(6, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false, new Class[0]));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, true));
    this.targetTasks.addTask(3, new EntityAINearestAttackableTarget(this, EntityIronGolem.class, true));

    if (worldIn != null && !worldIn.isRemote)
    {
        this.setCombatTask();
    }
}
项目:DecompiledMinecraft    文件:ContainerHopper.java   
public ContainerHopper(InventoryPlayer playerInventory, IInventory hopperInventoryIn, EntityPlayer player)
{
    this.hopperInventory = hopperInventoryIn;
    hopperInventoryIn.openInventory(player);
    int i = 51;

    for (int j = 0; j < hopperInventoryIn.getSizeInventory(); ++j)
    {
        this.addSlotToContainer(new Slot(hopperInventoryIn, j, 44 + j * 18, 20));
    }

    for (int l = 0; l < 3; ++l)
    {
        for (int k = 0; k < 9; ++k)
        {
            this.addSlotToContainer(new Slot(playerInventory, k + l * 9 + 9, 8 + k * 18, l * 18 + i));
        }
    }

    for (int i1 = 0; i1 < 9; ++i1)
    {
        this.addSlotToContainer(new Slot(playerInventory, i1, 8 + i1 * 18, 58 + i));
    }
}
项目:Clef    文件:Track.java   
@SideOnly(Side.CLIENT)
public void findPlayers()
{
    Iterator<String> ite = playersNames.iterator();
    while(ite.hasNext())
    {
        String s = ite.next();
        if(Minecraft.getMinecraft().world != null)
        {
            EntityPlayer player = Minecraft.getMinecraft().world.getPlayerEntityByName(s);
            if(player != null && player.isEntityAlive())
            {
                players.put(player, 0);
                ite.remove();
            }
        }
    }
}
项目:FirstAid    文件:DamageDistribution.java   
@Override
public float distributeDamage(float damage, @Nonnull EntityPlayer player, @Nonnull DamageSource source, boolean addStat) {
    AbstractPlayerDamageModel damageModel = PlayerDataManager.getDamageModel(player);
    for (Pair<EntityEquipmentSlot, EnumPlayerPart[]> pair : getPartList()) {
        EntityEquipmentSlot slot = pair.getLeft();
        damage = ArmorUtils.applyArmor(player, player.getItemStackFromSlot(slot), source, damage, slot);
        if (damage <= 0F)
            return 0F;
        damage = ArmorUtils.applyEnchantmentModifiers(player.getItemStackFromSlot(slot), source, damage);
        if (damage <= 0F)
            return 0F;

        damage = distributeDamageOnParts(damage, damageModel, pair.getRight(), player, addStat);
        if (damage == 0F)
            break;
    }
    return damage;
}
项目:CustomWorldGen    文件:ItemElytra.java   
public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    EntityEquipmentSlot entityequipmentslot = EntityLiving.getSlotForItemStack(itemStackIn);
    ItemStack itemstack = playerIn.getItemStackFromSlot(entityequipmentslot);

    if (itemstack == null)
    {
        playerIn.setItemStackToSlot(entityequipmentslot, itemStackIn.copy());
        itemStackIn.stackSize = 0;
        return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
    }
    else
    {
        return new ActionResult(EnumActionResult.FAIL, itemStackIn);
    }
}
项目:BaseClient    文件:ServerConfigurationManager.java   
public void sendMessageToAllTeamMembers(EntityPlayer player, IChatComponent message)
{
    Team team = player.getTeam();

    if (team != null)
    {
        for (String s : team.getMembershipCollection())
        {
            EntityPlayerMP entityplayermp = this.getPlayerByUsername(s);

            if (entityplayermp != null && entityplayermp != player)
            {
                entityplayermp.addChatMessage(message);
            }
        }
    }
}
项目:pnc-repressurized    文件:ItemRemote.java   
private boolean isAllowedToEdit(EntityPlayer player, ItemStack remote) {
    NBTTagCompound tag = remote.getTagCompound();
    if (tag != null) {
        if (tag.hasKey("securityX")) {
            int x = tag.getInteger("securityX");
            int y = tag.getInteger("securityY");
            int z = tag.getInteger("securityZ");
            int dimensionId = tag.getInteger("securityDimension");
            WorldServer world = DimensionManager.getWorld(dimensionId);
            if (world != null) {
                TileEntity te = world.getTileEntity(new BlockPos(x, y, z));
                if (te instanceof TileEntitySecurityStation) {
                    boolean canAccess = ((TileEntitySecurityStation) te).doesAllowPlayer(player);
                    if (!canAccess) {
                        player.sendStatusMessage(new TextComponentTranslation("gui.remote.noEditRights", x, y, z), false);
                    }
                    return canAccess;
                }
            }
        }
    }
    return true;
}
项目:Backmemed    文件:TileEntityStructure.java   
public boolean usedBy(EntityPlayer player)
{
    if (!player.canUseCommandBlock())
    {
        return false;
    }
    else
    {
        if (player.getEntityWorld().isRemote)
        {
            player.openEditStructure(this);
        }

        return true;
    }
}
项目:DecompiledMinecraft    文件:EntityArrow.java   
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
    {
        boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && entityIn.capabilities.isCreativeMode;

        if (this.canBePickedUp == 1 && !entityIn.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1)))
        {
            flag = false;
        }

        if (flag)
        {
            this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            entityIn.onItemPickup(this, 1);
            this.setDead();
        }
    }
}
项目:Backmemed    文件:ItemSlab.java   
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)
{
    BlockPos blockpos = pos;
    IProperty<?> iproperty = this.singleSlab.getVariantProperty();
    Comparable<?> comparable = this.singleSlab.getTypeForItem(stack);
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == this.singleSlab)
    {
        boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;

        if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && comparable == iblockstate.getValue(iproperty))
        {
            return true;
        }
    }

    pos = pos.offset(side);
    IBlockState iblockstate1 = worldIn.getBlockState(pos);
    return iblockstate1.getBlock() == this.singleSlab && comparable == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos, side, player, stack);
}
项目:CustomWorldGen    文件:CommandBlockBaseLogic.java   
public boolean tryOpenEditCommandBlock(EntityPlayer playerIn)
{
    if (!playerIn.canUseCommandBlock())
    {
        return false;
    }
    else
    {
        if (playerIn.getEntityWorld().isRemote)
        {
            playerIn.displayGuiEditCommandCart(this);
        }

        return true;
    }
}
项目:BaseClient    文件:BlockFlowerPot.java   
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
    super.onBlockHarvested(worldIn, pos, state, player);

    if (player.capabilities.isCreativeMode)
    {
        TileEntityFlowerPot tileentityflowerpot = this.getTileEntity(worldIn, pos);

        if (tileentityflowerpot != null)
        {
            tileentityflowerpot.setFlowerPotData((Item)null, 0);
        }
    }
}
项目:CustomWorldGen    文件:ItemTooltipEvent.java   
/**
 * This event is fired in {@link ItemStack#getTooltip(EntityPlayer, boolean)}, which in turn is called from it's respective GUIContainer.
 */
public ItemTooltipEvent(ItemStack itemStack, EntityPlayer entityPlayer, List<String> toolTip, boolean showAdvancedItemTooltips)
{
    super(entityPlayer);
    this.itemStack = itemStack;
    this.toolTip = toolTip;
    this.showAdvancedItemTooltips = showAdvancedItemTooltips;
}
项目:BaseClient    文件:EntitySheep.java   
/**
 * Called when a player interacts with a mob. e.g. gets milk from a cow, gets into the saddle on a pig.
 */
public boolean interact(EntityPlayer player)
{
    ItemStack itemstack = player.inventory.getCurrentItem();

    if (itemstack != null && itemstack.getItem() == Items.shears && !this.getSheared() && !this.isChild())
    {
        if (!this.worldObj.isRemote)
        {
            this.setSheared(true);
            int i = 1 + this.rand.nextInt(3);

            for (int j = 0; j < i; ++j)
            {
                EntityItem entityitem = this.entityDropItem(new ItemStack(Item.getItemFromBlock(Blocks.wool), 1, this.getFleeceColor().getMetadata()), 1.0F);
                entityitem.motionY += (double)(this.rand.nextFloat() * 0.05F);
                entityitem.motionX += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
                entityitem.motionZ += (double)((this.rand.nextFloat() - this.rand.nextFloat()) * 0.1F);
            }
        }

        itemstack.damageItem(1, player);
        this.playSound("mob.sheep.shear", 1.0F, 1.0F);
    }

    return super.interact(player);
}
项目:Mods    文件:TF2ProjectileHandler.java   
@Override
public IMessage onMessage(final PredictionMessage message, MessageContext ctx) {
    final EntityPlayer shooter = ctx.getServerHandler().player;
    // ItemStack stack=shooter.getHeldItem(EnumHand.MAIN_HAND);
    ((WorldServer) shooter.world).addScheduledTask(new Runnable() {

        @Override
        public void run() {
            shooter.getCapability(TF2weapons.WEAPONS_CAP, null).predictionList.add(message);
            message.time=shooter.world.getTotalWorldTime();
        }

    });
    return null;
}
项目:DecompiledMinecraft    文件:EntityWolf.java   
public EntityWolf(World worldIn)
{
    super(worldIn);
    this.setSize(0.6F, 0.8F);
    ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
    this.tasks.addTask(1, new EntityAISwimming(this));
    this.tasks.addTask(2, this.aiSit);
    this.tasks.addTask(3, new EntityAILeapAtTarget(this, 0.4F));
    this.tasks.addTask(4, new EntityAIAttackOnCollide(this, 1.0D, true));
    this.tasks.addTask(5, new EntityAIFollowOwner(this, 1.0D, 10.0F, 2.0F));
    this.tasks.addTask(6, new EntityAIMate(this, 1.0D));
    this.tasks.addTask(7, new EntityAIWander(this, 1.0D));
    this.tasks.addTask(8, new EntityAIBeg(this, 8.0F));
    this.tasks.addTask(9, new EntityAIWatchClosest(this, EntityPlayer.class, 8.0F));
    this.tasks.addTask(9, new EntityAILookIdle(this));
    this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
    this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
    this.targetTasks.addTask(3, new EntityAIHurtByTarget(this, true, new Class[0]));
    this.targetTasks.addTask(4, new EntityAITargetNonTamed(this, EntityAnimal.class, false, new Predicate<Entity>()
    {
        public boolean apply(Entity p_apply_1_)
        {
            return p_apply_1_ instanceof EntitySheep || p_apply_1_ instanceof EntityRabbit;
        }
    }));
    this.targetTasks.addTask(5, new EntityAINearestAttackableTarget(this, EntitySkeleton.class, false));
    this.setTamed(false);
}
项目:CustomWorldGen    文件:BlockDoublePlant.java   
private boolean onHarvest(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player)
{
    BlockDoublePlant.EnumPlantType blockdoubleplant$enumplanttype = (BlockDoublePlant.EnumPlantType)state.getValue(VARIANT);

    if (blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.FERN && blockdoubleplant$enumplanttype != BlockDoublePlant.EnumPlantType.GRASS)
    {
        return false;
    }
    else
    {
        player.addStat(StatList.getBlockStats(this));
        return true;
    }
}
项目:DecompiledMinecraft    文件:GuiContainerCreative.java   
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index)
{
    if (index >= this.inventorySlots.size() - 9 && index < this.inventorySlots.size())
    {
        Slot slot = (Slot)this.inventorySlots.get(index);

        if (slot != null && slot.getHasStack())
        {
            slot.putStack((ItemStack)null);
        }
    }

    return null;
}
项目:Bewitchment    文件:ItemSalt.java   
@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    final boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos);
    final BlockPos blockpos = flag ? pos : pos.offset(facing);

    ItemStack stack = playerIn.getHeldItem(hand);
    if (playerIn.canPlayerEdit(blockpos, facing, stack) && worldIn.mayPlace(worldIn.getBlockState(blockpos).getBlock(), blockpos, false, facing, playerIn) && ModBlocks.salt_barrier.canPlaceBlockAt(worldIn, blockpos)) {
        stack.shrink(1);
        worldIn.setBlockState(blockpos, ModBlocks.salt_barrier.getDefaultState());
        return EnumActionResult.SUCCESS;
    } else {
        return EnumActionResult.FAIL;
    }
}
项目:ProgressiveDifficulty    文件:ServerCommand.java   
private void sendChat(ICommandSender sender, String[] msg){
    EntityPlayer player = (EntityPlayer)sender.getCommandSenderEntity();
    for (String str : msg)
    {
        TextComponentString line = new TextComponentString(str);
        player.sendMessage(line);
    }
}
项目:DecompiledMinecraft    文件:ItemStack.java   
/**
 * Called when a Block is destroyed using this ItemStack
 */
public void onBlockDestroyed(World worldIn, Block blockIn, BlockPos pos, EntityPlayer playerIn)
{
    boolean flag = this.item.onBlockDestroyed(this, worldIn, blockIn, pos, playerIn);

    if (flag)
    {
        playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this.item)]);
    }
}
项目:DecompiledMinecraft    文件:EntityAIFollowOwner.java   
/**
 * Returns whether the EntityAIBase should begin execution.
 */
public boolean shouldExecute()
{
    EntityLivingBase entitylivingbase = this.thePet.getOwner();

    if (entitylivingbase == null)
    {
        return false;
    }
    else if (entitylivingbase instanceof EntityPlayer && ((EntityPlayer)entitylivingbase).isSpectator())
    {
        return false;
    }
    else if (this.thePet.isSitting())
    {
        return false;
    }
    else if (this.thePet.getDistanceSqToEntity(entitylivingbase) < (double)(this.minDist * this.minDist))
    {
        return false;
    }
    else
    {
        this.theOwner = entitylivingbase;
        return true;
    }
}
项目:DecompiledMinecraft    文件:GuiScreenBook.java   
public GuiScreenBook(EntityPlayer player, ItemStack book, boolean isUnsigned)
{
    this.editingPlayer = player;
    this.bookObj = book;
    this.bookIsUnsigned = isUnsigned;

    if (book.hasTagCompound())
    {
        NBTTagCompound nbttagcompound = book.getTagCompound();
        this.bookPages = nbttagcompound.getTagList("pages", 8);

        if (this.bookPages != null)
        {
            this.bookPages = (NBTTagList)this.bookPages.copy();
            this.bookTotalPages = this.bookPages.tagCount();

            if (this.bookTotalPages < 1)
            {
                this.bookTotalPages = 1;
            }
        }
    }

    if (this.bookPages == null && isUnsigned)
    {
        this.bookPages = new NBTTagList();
        this.bookPages.appendTag(new NBTTagString(""));
        this.bookTotalPages = 1;
    }
}
项目:minecraft-quiverbow    文件:EnderQuartzClip.java   
@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."); }
}
项目:ExPetrum    文件:ItemWateringCan.java   
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);
}
项目:minecraft-territorialdealings    文件:StartFactionDeed.java   
@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.");
   }
项目:DecompiledMinecraft    文件:InventoryEnderChest.java   
public void closeInventory(EntityPlayer player)
{
    if (this.associatedChest != null)
    {
        this.associatedChest.closeChest();
    }

    super.closeInventory(player);
    this.associatedChest = null;
}
项目:BaseClient    文件:EntityLivingBase.java   
/**
 * 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());
}
项目:Backmemed    文件:Entity.java   
/**
 * 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();
    }
}
项目:BaseClient    文件:EntityCow.java   
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));
}
项目:BaseClient    文件:Scoreboard.java   
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);
    }
}
项目:DecompiledMinecraft    文件:StatisticsFile.java   
/**
 * 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()}));
        }
    }
}
项目:DecompiledMinecraft    文件:ItemMinecart.java   
/**
 * 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;
    }
}