当前位置: 首页>>代码示例>>Java>>正文


Java EntityPlayer.isSpectator方法代码示例

本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.isSpectator方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.isSpectator方法的具体用法?Java EntityPlayer.isSpectator怎么用?Java EntityPlayer.isSpectator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.player.EntityPlayer的用法示例。


在下文中一共展示了EntityPlayer.isSpectator方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: updateAllPlayersSleepingFlag

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Updates the flag that indicates whether or not all players in the world are sleeping.
 */
public void updateAllPlayersSleepingFlag()
{
    this.allPlayersSleeping = false;

    if (!this.playerEntities.isEmpty())
    {
        int i = 0;
        int j = 0;

        for (EntityPlayer entityplayer : this.playerEntities)
        {
            if (entityplayer.isSpectator())
            {
                ++i;
            }
            else if (entityplayer.isPlayerSleeping())
            {
                ++j;
            }
        }

        this.allPlayersSleeping = j > 0 && j >= this.playerEntities.size() - i;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:WorldServer.java

示例2: areAllPlayersAsleep

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean areAllPlayersAsleep()
{
    if (this.allPlayersSleeping && !this.isRemote)
    {
        for (EntityPlayer entityplayer : this.playerEntities)
        {
            if (entityplayer.isSpectator() || !entityplayer.isPlayerFullyAsleep())
            {
                return false;
            }
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:WorldServer.java

示例3: areAllPlayersAsleep

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * Checks if all players in this world are sleeping.
 */
public boolean areAllPlayersAsleep()
{
    if (this.allPlayersSleeping && !this.isRemote)
    {
        for (EntityPlayer entityplayer : this.playerEntities)
        {
            if (!entityplayer.isSpectator() && !entityplayer.isPlayerFullyAsleep())
            {
                return false;
            }
        }

        return true;
    }
    else
    {
        return false;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:WorldServer.java

示例4: closeInventory

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void closeInventory(EntityPlayer player)
{
    if (!player.isSpectator() && this.getBlockType() instanceof BlockChest)
    {
        --this.numPlayersUsing;
        this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
        this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:TileEntityChest.java

示例5: isInvisibleToPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * 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.
 */
@SideOnly(Side.CLIENT)
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();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:Entity.java

示例6: openInventory

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void openInventory(EntityPlayer player)
{
    if (!player.isSpectator())
    {
        if (this.numPlayersUsing < 0)
        {
            this.numPlayersUsing = 0;
        }

        ++this.numPlayersUsing;
        this.worldObj.addBlockEvent(this.pos, this.getBlockType(), 1, this.numPlayersUsing);
        this.worldObj.notifyNeighborsOfStateChange(this.pos, this.getBlockType());
        this.worldObj.notifyNeighborsOfStateChange(this.pos.down(), this.getBlockType());
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:TileEntityChest.java

示例7: closeInventory

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public void closeInventory(EntityPlayer player)
{
    if (!player.isSpectator())
    {
        --this.field_190598_h;
        this.world.addBlockEvent(this.pos, this.getBlockType(), 1, this.field_190598_h);

        if (this.field_190598_h <= 0)
        {
            this.world.playSound((EntityPlayer)null, this.pos, SoundEvents.field_191261_fA, SoundCategory.BLOCKS, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:14,代码来源:TileEntityShulkerBox.java

示例8: canInteractWith

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean canInteractWith(EntityPlayer playerIn) {
	return !playerIn.isSpectator();
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:5,代码来源:ContainerApiary.java

示例9: func_75529_b

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private boolean func_75529_b()
{
    List<EntityPlayer> list = this.worldObj.playerEntities;
    Iterator iterator = list.iterator();

    while (true)
    {
        if (!iterator.hasNext())
        {
            return false;
        }

        EntityPlayer entityplayer = (EntityPlayer)iterator.next();

        if (!entityplayer.isSpectator())
        {
            this.theVillage = this.worldObj.getVillageCollection().getNearestVillage(new BlockPos(entityplayer), 1);

            if (this.theVillage != null && this.theVillage.getNumVillageDoors() >= 10 && this.theVillage.getTicksSinceLastDoorAdding() >= 20 && this.theVillage.getNumVillagers() >= 20)
            {
                BlockPos blockpos = this.theVillage.getCenter();
                float f = (float)this.theVillage.getVillageRadius();
                boolean flag = false;

                for (int i = 0; i < 10; ++i)
                {
                    float f1 = this.worldObj.rand.nextFloat() * (float)Math.PI * 2.0F;
                    this.field_75532_g = blockpos.getX() + (int)((double)(MathHelper.cos(f1) * f) * 0.9D);
                    this.field_75538_h = blockpos.getY();
                    this.field_75539_i = blockpos.getZ() + (int)((double)(MathHelper.sin(f1) * f) * 0.9D);
                    flag = false;

                    for (Village village : this.worldObj.getVillageCollection().getVillageList())
                    {
                        if (village != this.theVillage && village.func_179866_a(new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i)))
                        {
                            flag = true;
                            break;
                        }
                    }

                    if (!flag)
                    {
                        break;
                    }
                }

                if (flag)
                {
                    return false;
                }

                Vec3 vec3 = this.func_179867_a(new BlockPos(this.field_75532_g, this.field_75538_h, this.field_75539_i));

                if (vec3 != null)
                {
                    break;
                }
            }
        }
    }

    this.field_75534_e = 0;
    this.field_75533_d = 20;
    return true;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:67,代码来源:VillageSiege.java

示例10: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing heldItem, float side, float hitX, float hitY)
{
    if (worldIn.isRemote)
    {
        return true;
    }
    else if (playerIn.isSpectator())
    {
        return true;
    }
    else
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof TileEntityShulkerBox)
        {
            EnumFacing enumfacing = (EnumFacing)state.getValue(field_190957_a);
            boolean flag;

            if (((TileEntityShulkerBox)tileentity).func_190591_p() == TileEntityShulkerBox.AnimationStatus.CLOSED)
            {
                AxisAlignedBB axisalignedbb = FULL_BLOCK_AABB.addCoord((double)(0.5F * (float)enumfacing.getFrontOffsetX()), (double)(0.5F * (float)enumfacing.getFrontOffsetY()), (double)(0.5F * (float)enumfacing.getFrontOffsetZ())).func_191195_a((double)enumfacing.getFrontOffsetX(), (double)enumfacing.getFrontOffsetY(), (double)enumfacing.getFrontOffsetZ());
                flag = !worldIn.collidesWithAnyBlock(axisalignedbb.offset(pos.offset(enumfacing)));
            }
            else
            {
                flag = true;
            }

            if (flag)
            {
                playerIn.addStat(StatList.field_191272_ae);
                playerIn.displayGUIChest((IInventory)tileentity);
            }

            return true;
        }
        else
        {
            return false;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:44,代码来源:BlockShulkerBox.java

示例11: trySetupSiege

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
private boolean trySetupSiege()
{
    List<EntityPlayer> list = this.worldObj.playerEntities;
    Iterator iterator = list.iterator();

    while (true)
    {
        if (!iterator.hasNext())
        {
            return false;
        }

        EntityPlayer entityplayer = (EntityPlayer)iterator.next();

        if (!entityplayer.isSpectator())
        {
            this.theVillage = this.worldObj.getVillageCollection().getNearestVillage(new BlockPos(entityplayer), 1);

            if (this.theVillage != null && this.theVillage.getNumVillageDoors() >= 10 && this.theVillage.getTicksSinceLastDoorAdding() >= 20 && this.theVillage.getNumVillagers() >= 20)
            {
                BlockPos blockpos = this.theVillage.getCenter();
                float f = (float)this.theVillage.getVillageRadius();
                boolean flag = false;

                for (int i = 0; i < 10; ++i)
                {
                    float f1 = this.worldObj.rand.nextFloat() * ((float)Math.PI * 2F);
                    this.spawnX = blockpos.getX() + (int)((double)(MathHelper.cos(f1) * f) * 0.9D);
                    this.spawnY = blockpos.getY();
                    this.spawnZ = blockpos.getZ() + (int)((double)(MathHelper.sin(f1) * f) * 0.9D);
                    flag = false;

                    for (Village village : this.worldObj.getVillageCollection().getVillageList())
                    {
                        if (village != this.theVillage && village.isBlockPosWithinSqVillageRadius(new BlockPos(this.spawnX, this.spawnY, this.spawnZ)))
                        {
                            flag = true;
                            break;
                        }
                    }

                    if (!flag)
                    {
                        break;
                    }
                }

                if (flag)
                {
                    return false;
                }

                Vec3d vec3d = this.findRandomSpawnPos(new BlockPos(this.spawnX, this.spawnY, this.spawnZ));

                if (vec3d != null)
                {
                    break;
                }
            }
        }
    }

    this.nextSpawnTime = 0;
    this.siegeCount = 20;
    return true;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:67,代码来源:VillageSiege.java

示例12: isInvisibleToPlayer

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
/**
 * 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)
{
    return player.isSpectator() ? false : this.isInvisible();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:Entity.java


注:本文中的net.minecraft.entity.player.EntityPlayer.isSpectator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。