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


Java World.playAuxSFX方法代码示例

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


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

示例1: dispense

import net.minecraft.world.World; //导入方法依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playAuxSFX(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);
            IBehaviorDispenseItem ibehaviordispenseitem = this.getBehavior(itemstack);

            if (ibehaviordispenseitem != IBehaviorDispenseItem.itemDispenseBehaviorProvider)
            {
                ItemStack itemstack1 = ibehaviordispenseitem.dispense(blocksourceimpl, itemstack);
                tileentitydispenser.setInventorySlotContents(i, itemstack1.stackSize <= 0 ? null : itemstack1);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:27,代码来源:BlockDispenser.java

示例2: tryAbsorb

import net.minecraft.world.World; //导入方法依赖的package包/类
protected void tryAbsorb(World worldIn, BlockPos pos, IBlockState state)
{
    if (!((Boolean)state.getValue(WET)).booleanValue() && this.absorb(worldIn, pos))
    {
        worldIn.setBlockState(pos, state.withProperty(WET, Boolean.valueOf(true)), 2);
        worldIn.playAuxSFX(2001, pos, Block.getIdFromBlock(Blocks.water));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:9,代码来源:BlockSponge.java

示例3: dropRecord

import net.minecraft.world.World; //导入方法依赖的package包/类
private void dropRecord(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        TileEntity tileentity = worldIn.getTileEntity(pos);

        if (tileentity instanceof BlockJukebox.TileEntityJukebox)
        {
            BlockJukebox.TileEntityJukebox blockjukebox$tileentityjukebox = (BlockJukebox.TileEntityJukebox)tileentity;
            ItemStack itemstack = blockjukebox$tileentityjukebox.getRecord();

            if (itemstack != null)
            {
                worldIn.playAuxSFX(1005, pos, 0);
                worldIn.playRecord(pos, (String)null);
                blockjukebox$tileentityjukebox.setRecord((ItemStack)null);
                float f = 0.7F;
                double d0 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
                double d1 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.2D + 0.6D;
                double d2 = (double)(worldIn.rand.nextFloat() * f) + (double)(1.0F - f) * 0.5D;
                ItemStack itemstack1 = itemstack.copy();
                EntityItem entityitem = new EntityItem(worldIn, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, itemstack1);
                entityitem.setDefaultPickupDelay();
                worldIn.spawnEntityInWorld(entityitem);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:29,代码来源:BlockJukebox.java

示例4: 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)
{
    if (!playerIn.canPlayerEdit(pos.offset(side), side, stack))
    {
        return false;
    }
    else
    {
        EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

        if (enumdyecolor == EnumDyeColor.WHITE)
        {
            if (applyBonemeal(stack, worldIn, pos))
            {
                if (!worldIn.isRemote)
                {
                    worldIn.playAuxSFX(2005, pos, 0);
                }

                return true;
            }
        }
        else if (enumdyecolor == EnumDyeColor.BROWN)
        {
            IBlockState iblockstate = worldIn.getBlockState(pos);
            Block block = iblockstate.getBlock();

            if (block == Blocks.log && iblockstate.getValue(BlockPlanks.VARIANT) == BlockPlanks.EnumType.JUNGLE)
            {
                if (side == EnumFacing.DOWN)
                {
                    return false;
                }

                if (side == EnumFacing.UP)
                {
                    return false;
                }

                pos = pos.offset(side);

                if (worldIn.isAirBlock(pos))
                {
                    IBlockState iblockstate1 = Blocks.cocoa.onBlockPlaced(worldIn, pos, side, hitX, hitY, hitZ, 0, playerIn);
                    worldIn.setBlockState(pos, iblockstate1, 2);

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

                return true;
            }
        }

        return false;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:63,代码来源:ItemDye.java

示例5: dispense

import net.minecraft.world.World; //导入方法依赖的package包/类
protected void dispense(World worldIn, BlockPos pos)
{
    BlockSourceImpl blocksourceimpl = new BlockSourceImpl(worldIn, pos);
    TileEntityDispenser tileentitydispenser = (TileEntityDispenser)blocksourceimpl.getBlockTileEntity();

    if (tileentitydispenser != null)
    {
        int i = tileentitydispenser.getDispenseSlot();

        if (i < 0)
        {
            worldIn.playAuxSFX(1001, pos, 0);
        }
        else
        {
            ItemStack itemstack = tileentitydispenser.getStackInSlot(i);

            if (itemstack != null)
            {
                EnumFacing enumfacing = (EnumFacing)worldIn.getBlockState(pos).getValue(FACING);
                BlockPos blockpos = pos.offset(enumfacing);
                IInventory iinventory = TileEntityHopper.getInventoryAtPosition(worldIn, (double)blockpos.getX(), (double)blockpos.getY(), (double)blockpos.getZ());
                ItemStack itemstack1;

                if (iinventory == null)
                {
                    itemstack1 = this.dropBehavior.dispense(blocksourceimpl, itemstack);

                    if (itemstack1 != null && itemstack1.stackSize <= 0)
                    {
                        itemstack1 = null;
                    }
                }
                else
                {
                    itemstack1 = TileEntityHopper.putStackInInventoryAllSlots(iinventory, itemstack.copy().splitStack(1), enumfacing.getOpposite());

                    if (itemstack1 == null)
                    {
                        itemstack1 = itemstack.copy();

                        if (--itemstack1.stackSize <= 0)
                        {
                            itemstack1 = null;
                        }
                    }
                    else
                    {
                        itemstack1 = itemstack.copy();
                    }
                }

                tileentitydispenser.setInventorySlotContents(i, itemstack1);
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:58,代码来源:BlockDropper.java

示例6: onEndFalling

import net.minecraft.world.World; //导入方法依赖的package包/类
public void onEndFalling(World worldIn, BlockPos pos)
{
    worldIn.playAuxSFX(1022, pos, 0);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:5,代码来源:BlockAnvil.java

示例7: onPlayerDestroyBlock

import net.minecraft.world.World; //导入方法依赖的package包/类
/**
 * Called when a player completes the destruction of a block
 */
public boolean onPlayerDestroyBlock(BlockPos pos, EnumFacing side)
{
    if (this.currentGameType.isAdventure())
    {
        if (this.currentGameType == WorldSettings.GameType.SPECTATOR)
        {
            return false;
        }

        if (!this.mc.thePlayer.isAllowEdit())
        {
            Block block = this.mc.theWorld.getBlockState(pos).getBlock();
            ItemStack itemstack = this.mc.thePlayer.getCurrentEquippedItem();

            if (itemstack == null)
            {
                return false;
            }

            if (!itemstack.canDestroy(block))
            {
                return false;
            }
        }
    }

    if (this.currentGameType.isCreative() && this.mc.thePlayer.getHeldItem() != null && this.mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)
    {
        return false;
    }
    else
    {
        World world = this.mc.theWorld;
        IBlockState iblockstate = world.getBlockState(pos);
        Block block1 = iblockstate.getBlock();

        if (block1.getMaterial() == Material.air)
        {
            return false;
        }
        else
        {
            world.playAuxSFX(2001, pos, Block.getStateId(iblockstate));
            boolean flag = world.setBlockToAir(pos);

            if (flag)
            {
                block1.onBlockDestroyedByPlayer(world, pos, iblockstate);
            }

            this.currentBlock = new BlockPos(this.currentBlock.getX(), -1, this.currentBlock.getZ());

            if (!this.currentGameType.isCreative())
            {
                ItemStack itemstack1 = this.mc.thePlayer.getCurrentEquippedItem();

                if (itemstack1 != null)
                {
                    itemstack1.onBlockDestroyed(world, block1, pos, this.mc.thePlayer);

                    if (itemstack1.stackSize == 0)
                    {
                        this.mc.thePlayer.destroyCurrentEquippedItem();
                    }
                }
            }

            return flag;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:75,代码来源:PlayerControllerMP.java

示例8: tryAbsorb

import net.minecraft.world.World; //导入方法依赖的package包/类
protected void tryAbsorb(World worldIn, int x, int y, int z, boolean wet) {
	if (!wet && absorb(worldIn, x, y, z)) {
		worldIn.setBlockMetadataWithNotify(x, y, z, 1, 2);
		worldIn.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(Blocks.water));
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:7,代码来源:Sponge.java


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