當前位置: 首頁>>代碼示例>>Java>>正文


Java World.addBlockEvent方法代碼示例

本文整理匯總了Java中net.minecraft.world.World.addBlockEvent方法的典型用法代碼示例。如果您正苦於以下問題:Java World.addBlockEvent方法的具體用法?Java World.addBlockEvent怎麽用?Java World.addBlockEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.world.World的用法示例。


在下文中一共展示了World.addBlockEvent方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkForMove

import net.minecraft.world.World; //導入方法依賴的package包/類
private void checkForMove(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    boolean flag = this.shouldBeExtended(worldIn, pos, enumfacing);

    if (flag && !((Boolean)state.getValue(EXTENDED)).booleanValue())
    {
        if ((new BlockPistonStructureHelper(worldIn, pos, enumfacing, true)).canMove())
        {
            worldIn.addBlockEvent(pos, this, 0, enumfacing.getIndex());
        }
    }
    else if (!flag && ((Boolean)state.getValue(EXTENDED)).booleanValue())
    {
        worldIn.setBlockState(pos, state.withProperty(EXTENDED, Boolean.valueOf(false)), 2);
        worldIn.addBlockEvent(pos, this, 1, enumfacing.getIndex());
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:BlockPistonBase.java

示例2: checkForMove

import net.minecraft.world.World; //導入方法依賴的package包/類
private void checkForMove(World worldIn, BlockPos pos, IBlockState state)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    boolean flag = this.shouldBeExtended(worldIn, pos, enumfacing);

    if (flag && !((Boolean)state.getValue(EXTENDED)).booleanValue())
    {
        if ((new BlockPistonStructureHelper(worldIn, pos, enumfacing, true)).canMove())
        {
            worldIn.addBlockEvent(pos, this, 0, enumfacing.getIndex());
        }
    }
    else if (!flag && ((Boolean)state.getValue(EXTENDED)).booleanValue())
    {
        worldIn.addBlockEvent(pos, this, 1, enumfacing.getIndex());
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:18,代碼來源:BlockPistonBase.java

示例3: onNeighborBlockChange

import net.minecraft.world.World; //導入方法依賴的package包/類
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBeacon)
    {
        ((TileEntityBeacon)tileentity).updateBeacon();
        worldIn.addBlockEvent(pos, this, 1, 0);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:14,代碼來源:BlockBeacon.java

示例4: triggerNote

import net.minecraft.world.World; //導入方法依賴的package包/類
public void triggerNote(World worldIn, BlockPos p_175108_2_)
{
    if (worldIn.getBlockState(p_175108_2_.up()).getBlock().getMaterial() == Material.air)
    {
        Material material = worldIn.getBlockState(p_175108_2_.down()).getBlock().getMaterial();
        int i = 0;

        if (material == Material.rock)
        {
            i = 1;
        }

        if (material == Material.sand)
        {
            i = 2;
        }

        if (material == Material.glass)
        {
            i = 3;
        }

        if (material == Material.wood)
        {
            i = 4;
        }

        worldIn.addBlockEvent(p_175108_2_, Blocks.noteblock, i, this.note);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:31,代碼來源:TileEntityNote.java

示例5: neighborChanged

import net.minecraft.world.World; //導入方法依賴的package包/類
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos p_189540_5_)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBeacon)
    {
        ((TileEntityBeacon)tileentity).updateBeacon();
        worldIn.addBlockEvent(pos, this, 1, 0);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:16,代碼來源:BlockBeacon.java

示例6: triggerNote

import net.minecraft.world.World; //導入方法依賴的package包/類
public void triggerNote(World worldIn, BlockPos posIn)
{
    if (worldIn.getBlockState(posIn.up()).getMaterial() == Material.AIR)
    {
        Material material = worldIn.getBlockState(posIn.down()).getMaterial();
        int i = 0;

        if (material == Material.ROCK)
        {
            i = 1;
        }

        if (material == Material.SAND)
        {
            i = 2;
        }

        if (material == Material.GLASS)
        {
            i = 3;
        }

        if (material == Material.WOOD)
        {
            i = 4;
        }

        worldIn.addBlockEvent(posIn, Blocks.NOTEBLOCK, i, this.note);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:31,代碼來源:TileEntityNote.java

示例7: neighborChanged

import net.minecraft.world.World; //導入方法依賴的package包/類
/**
 * Called when a neighboring block was changed and marks that this state should perform any checks during a neighbor
 * change. Cases may include when redstone power is updated, cactus blocks popping off due to a neighboring solid
 * block, etc.
 */
public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn)
{
    TileEntity tileentity = worldIn.getTileEntity(pos);

    if (tileentity instanceof TileEntityBeacon)
    {
        ((TileEntityBeacon)tileentity).updateBeacon();
        worldIn.addBlockEvent(pos, this, 1, 0);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:16,代碼來源:BlockBeacon.java


注:本文中的net.minecraft.world.World.addBlockEvent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。