當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。