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


Java World.playAuxSFXAtEntity方法代码示例

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


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

示例1: onItemUse

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * 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 (iblockstate.getBlock() == Blocks.jukebox && !((Boolean)iblockstate.getValue(BlockJukebox.HAS_RECORD)).booleanValue())
    {
        if (worldIn.isRemote)
        {
            return true;
        }
        else
        {
            ((BlockJukebox)Blocks.jukebox).insertRecord(worldIn, pos, iblockstate, stack);
            worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1005, pos, Item.getIdFromItem(this));
            --stack.stackSize;
            playerIn.triggerAchievement(StatList.field_181740_X);
            return true;
        }
    }
    else
    {
        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:28,代码来源:ItemRecord.java

示例2: onBlockActivated

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (((Boolean)state.getValue(OPEN)).booleanValue())
    {
        state = state.withProperty(OPEN, Boolean.valueOf(false));
        worldIn.setBlockState(pos, state, 2);
    }
    else
    {
        EnumFacing enumfacing = EnumFacing.fromAngle((double)playerIn.rotationYaw);

        if (state.getValue(FACING) == enumfacing.getOpposite())
        {
            state = state.withProperty(FACING, enumfacing);
        }

        state = state.withProperty(OPEN, Boolean.valueOf(true));
        worldIn.setBlockState(pos, state, 2);
    }

    worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
    return true;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:BlockFenceGate.java

示例3: onBlockActivated

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (this.blockMaterial == Material.iron)
    {
        return true;
    }
    else
    {
        BlockPos blockpos = state.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
        IBlockState iblockstate = pos.equals(blockpos) ? state : worldIn.getBlockState(blockpos);

        if (iblockstate.getBlock() != this)
        {
            return false;
        }
        else
        {
            state = iblockstate.cycleProperty(OPEN);
            worldIn.setBlockState(blockpos, state, 2);
            worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
            worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
            return true;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:BlockDoor.java

示例4: toggleDoor

import net.minecraft.world.World; //导入方法依赖的package包/类
public void toggleDoor(World worldIn, BlockPos pos, boolean open)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == this)
    {
        BlockPos blockpos = iblockstate.getValue(HALF) == BlockDoor.EnumDoorHalf.LOWER ? pos : pos.down();
        IBlockState iblockstate1 = pos == blockpos ? iblockstate : worldIn.getBlockState(blockpos);

        if (iblockstate1.getBlock() == this && ((Boolean)iblockstate1.getValue(OPEN)).booleanValue() != open)
        {
            worldIn.setBlockState(blockpos, iblockstate1.withProperty(OPEN, Boolean.valueOf(open)), 2);
            worldIn.markBlockRangeForRenderUpdate(blockpos, pos);
            worldIn.playAuxSFXAtEntity((EntityPlayer)null, open ? 1003 : 1006, pos, 0);
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:18,代码来源:BlockDoor.java

示例5: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (!worldIn.isRemote)
    {
        boolean flag = worldIn.isBlockPowered(pos);

        if (flag || neighborBlock.canProvidePower())
        {
            if (flag && !((Boolean)state.getValue(OPEN)).booleanValue() && !((Boolean)state.getValue(POWERED)).booleanValue())
            {
                worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(true)).withProperty(POWERED, Boolean.valueOf(true)), 2);
                worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1003, pos, 0);
            }
            else if (!flag && ((Boolean)state.getValue(OPEN)).booleanValue() && ((Boolean)state.getValue(POWERED)).booleanValue())
            {
                worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(false)).withProperty(POWERED, Boolean.valueOf(false)), 2);
                worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1006, pos, 0);
            }
            else if (flag != ((Boolean)state.getValue(POWERED)).booleanValue())
            {
                worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(flag)), 2);
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:29,代码来源:BlockFenceGate.java

示例6: updateTask

import net.minecraft.world.World; //导入方法依赖的package包/类
public void updateTask()
{
    EntityLivingBase entitylivingbase = this.parentEntity.getAttackTarget();
    double d0 = 64.0D;

    if (entitylivingbase.getDistanceSqToEntity(this.parentEntity) < d0 * d0 && this.parentEntity.canEntityBeSeen(entitylivingbase))
    {
        World world = this.parentEntity.worldObj;
        ++this.attackTimer;

        if (this.attackTimer == 10)
        {
            world.playAuxSFXAtEntity((EntityPlayer)null, 1007, new BlockPos(this.parentEntity), 0);
        }

        if (this.attackTimer == 20)
        {
            double d1 = 4.0D;
            Vec3 vec3 = this.parentEntity.getLook(1.0F);
            double d2 = entitylivingbase.posX - (this.parentEntity.posX + vec3.xCoord * d1);
            double d3 = entitylivingbase.getEntityBoundingBox().minY + (double)(entitylivingbase.height / 2.0F) - (0.5D + this.parentEntity.posY + (double)(this.parentEntity.height / 2.0F));
            double d4 = entitylivingbase.posZ - (this.parentEntity.posZ + vec3.zCoord * d1);
            world.playAuxSFXAtEntity((EntityPlayer)null, 1008, new BlockPos(this.parentEntity), 0);
            EntityLargeFireball entitylargefireball = new EntityLargeFireball(world, this.parentEntity, d2, d3, d4);
            entitylargefireball.explosionPower = this.parentEntity.getFireballStrength();
            entitylargefireball.posX = this.parentEntity.posX + vec3.xCoord * d1;
            entitylargefireball.posY = this.parentEntity.posY + (double)(this.parentEntity.height / 2.0F) + 0.5D;
            entitylargefireball.posZ = this.parentEntity.posZ + vec3.zCoord * d1;
            world.spawnEntityInWorld(entitylargefireball);
            this.attackTimer = -40;
        }
    }
    else if (this.attackTimer > 0)
    {
        --this.attackTimer;
    }

    this.parentEntity.setAttacking(this.attackTimer > 10);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:EntityGhast.java

示例7: onItemRightClick

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
 */
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
{
    MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(worldIn, playerIn, false);

    if (movingobjectposition != null && movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK && worldIn.getBlockState(movingobjectposition.getBlockPos()).getBlock() == Blocks.end_portal_frame)
    {
        return itemStackIn;
    }
    else
    {
        if (!worldIn.isRemote)
        {
            BlockPos blockpos = worldIn.getStrongholdPos("Stronghold", new BlockPos(playerIn));

            if (blockpos != null)
            {
                EntityEnderEye entityendereye = new EntityEnderEye(worldIn, playerIn.posX, playerIn.posY, playerIn.posZ);
                entityendereye.moveTowards(blockpos);
                worldIn.spawnEntityInWorld(entityendereye);
                worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
                worldIn.playAuxSFXAtEntity((EntityPlayer)null, 1002, new BlockPos(playerIn), 0);

                if (!playerIn.capabilities.isCreativeMode)
                {
                    --itemStackIn.stackSize;
                }

                playerIn.triggerAchievement(StatList.objectUseStats[Item.getIdFromItem(this)]);
            }
        }

        return itemStackIn;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:38,代码来源:ItemEnderEye.java

示例8: onBlockActivated

import net.minecraft.world.World; //导入方法依赖的package包/类
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (this.blockMaterial == Material.iron)
    {
        return true;
    }
    else
    {
        state = state.cycleProperty(OPEN);
        worldIn.setBlockState(pos, state, 2);
        worldIn.playAuxSFXAtEntity(playerIn, ((Boolean)state.getValue(OPEN)).booleanValue() ? 1003 : 1006, pos, 0);
        return true;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:15,代码来源:BlockTrapDoor.java

示例9: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (!worldIn.isRemote)
    {
        BlockPos blockpos = pos.offset(((EnumFacing)state.getValue(FACING)).getOpposite());

        if (!isValidSupportBlock(worldIn.getBlockState(blockpos).getBlock()))
        {
            worldIn.setBlockToAir(pos);
            this.dropBlockAsItem(worldIn, pos, state, 0);
        }
        else
        {
            boolean flag = worldIn.isBlockPowered(pos);

            if (flag || neighborBlock.canProvidePower())
            {
                boolean flag1 = ((Boolean)state.getValue(OPEN)).booleanValue();

                if (flag1 != flag)
                {
                    worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2);
                    worldIn.playAuxSFXAtEntity((EntityPlayer)null, flag ? 1003 : 1006, pos, 0);
                }
            }
        }
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:32,代码来源:BlockTrapDoor.java

示例10: onNeighborBlockChange

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (state.getValue(HALF) == BlockDoor.EnumDoorHalf.UPPER)
    {
        BlockPos blockpos = pos.down();
        IBlockState iblockstate = worldIn.getBlockState(blockpos);

        if (iblockstate.getBlock() != this)
        {
            worldIn.setBlockToAir(pos);
        }
        else if (neighborBlock != this)
        {
            this.onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock);
        }
    }
    else
    {
        boolean flag1 = false;
        BlockPos blockpos1 = pos.up();
        IBlockState iblockstate1 = worldIn.getBlockState(blockpos1);

        if (iblockstate1.getBlock() != this)
        {
            worldIn.setBlockToAir(pos);
            flag1 = true;
        }

        if (!World.doesBlockHaveSolidTopSurface(worldIn, pos.down()))
        {
            worldIn.setBlockToAir(pos);
            flag1 = true;

            if (iblockstate1.getBlock() == this)
            {
                worldIn.setBlockToAir(blockpos1);
            }
        }

        if (flag1)
        {
            if (!worldIn.isRemote)
            {
                this.dropBlockAsItem(worldIn, pos, state, 0);
            }
        }
        else
        {
            boolean flag = worldIn.isBlockPowered(pos) || worldIn.isBlockPowered(blockpos1);

            if ((flag || neighborBlock.canProvidePower()) && neighborBlock != this && flag != ((Boolean)iblockstate1.getValue(POWERED)).booleanValue())
            {
                worldIn.setBlockState(blockpos1, iblockstate1.withProperty(POWERED, Boolean.valueOf(flag)), 2);

                if (flag != ((Boolean)state.getValue(OPEN)).booleanValue())
                {
                    worldIn.setBlockState(pos, state.withProperty(OPEN, Boolean.valueOf(flag)), 2);
                    worldIn.markBlockRangeForRenderUpdate(pos, pos);
                    worldIn.playAuxSFXAtEntity((EntityPlayer)null, flag ? 1003 : 1006, pos, 0);
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:68,代码来源:BlockDoor.java


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