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


Java BlockPos類代碼示例

本文整理匯總了Java中net.minecraft.util.BlockPos的典型用法代碼示例。如果您正苦於以下問題:Java BlockPos類的具體用法?Java BlockPos怎麽用?Java BlockPos使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: BlockPistonStructureHelper

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public BlockPistonStructureHelper(World worldIn, BlockPos posIn, EnumFacing pistonFacing, boolean extending)
{
    this.world = worldIn;
    this.pistonPos = posIn;

    if (extending)
    {
        this.moveDirection = pistonFacing;
        this.blockToMove = posIn.offset(pistonFacing);
    }
    else
    {
        this.moveDirection = pistonFacing.getOpposite();
        this.blockToMove = posIn.offset(pistonFacing, 2);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:BlockPistonStructureHelper.java

示例2: onBlockActivated

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ)
{
    if (((Boolean)state.getValue(POWERED)).booleanValue())
    {
        return true;
    }
    else
    {
        worldIn.setBlockState(pos, state.withProperty(POWERED, Boolean.valueOf(true)), 3);
        worldIn.markBlockRangeForRenderUpdate(pos, pos);
        worldIn.playSoundEffect((double)pos.getX() + 0.5D, (double)pos.getY() + 0.5D, (double)pos.getZ() + 0.5D, "random.click", 0.3F, 0.6F);
        this.notifyNeighbors(worldIn, pos, (EnumFacing)state.getValue(FACING));
        worldIn.scheduleUpdate(pos, this, this.tickRate(worldIn));
        return true;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:BlockButton.java

示例3: onNeighborBlockChange

import net.minecraft.util.BlockPos; //導入依賴的package包/類
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    if (this.canBlockStay(worldIn, pos))
    {
        this.updateState(worldIn, pos, state);
    }
    else
    {
        this.dropBlockAsItem(worldIn, pos, state, 0);
        worldIn.setBlockToAir(pos);

        for (EnumFacing enumfacing : EnumFacing.values())
        {
            worldIn.notifyNeighborsOfStateChange(pos.offset(enumfacing), this);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:21,代碼來源:BlockRedstoneDiode.java

示例4: generate

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public boolean generate(World worldIn, Random rand, BlockPos position)
{
    Block block;

    while (((block = worldIn.getBlockState(position).getBlock()).getMaterial() == Material.air || block.getMaterial() == Material.leaves) && position.getY() > 0)
    {
        position = position.down();
    }

    for (int i = 0; i < 128; ++i)
    {
        BlockPos blockpos = position.add(rand.nextInt(8) - rand.nextInt(8), rand.nextInt(4) - rand.nextInt(4), rand.nextInt(8) - rand.nextInt(8));

        if (worldIn.isAirBlock(blockpos) && Blocks.tallgrass.canBlockStay(worldIn, blockpos, this.tallGrassState))
        {
            worldIn.setBlockState(blockpos, this.tallGrassState, 2);
        }
    }

    return true;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:22,代碼來源:WorldGenTallGrass.java

示例5: addBlockInfo

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public static void addBlockInfo(CrashReportCategory category, final BlockPos pos, final IBlockState state)
{
    category.addCrashSectionCallable("Block", new Callable<String>()
    {
        public String call() throws Exception
        {
            return state.toString();
        }
    });
    category.addCrashSectionCallable("Block location", new Callable<String>()
    {
        public String call() throws Exception
        {
            return CrashReportCategory.getCoordinateInfo(pos);
        }
    });
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:18,代碼來源:CrashReportCategory.java

示例6: updateTick

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (!this.canBlockStay(worldIn, pos, state))
    {
        this.dropBlock(worldIn, pos, state);
    }
    else if (worldIn.rand.nextInt(5) == 0)
    {
        int i = ((Integer)state.getValue(AGE)).intValue();

        if (i < 2)
        {
            worldIn.setBlockState(pos, state.withProperty(AGE, Integer.valueOf(i + 1)), 2);
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:17,代碼來源:BlockCocoa.java

示例7: getTouchingBlocks

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public static List<BlockPos> getTouchingBlocks(EntityPlayerSP player)
{
	// Determine which blocks we are touching.
	// This code is adapted from Entity, where it is used to fire the Block.onEntityCollidedWithBlock methods.
	BlockPos blockposmin = new BlockPos(player.getEntityBoundingBox().minX - 0.001D, player.getEntityBoundingBox().minY - 0.001D, player.getEntityBoundingBox().minZ - 0.001D);
    BlockPos blockposmax = new BlockPos(player.getEntityBoundingBox().maxX + 0.001D, player.getEntityBoundingBox().maxY + 0.001D, player.getEntityBoundingBox().maxZ + 0.001D);
    List<BlockPos> blocks = new ArrayList<BlockPos>();
    
    if (player.worldObj.isAreaLoaded(blockposmin, blockposmax))
    {
        for (int i = blockposmin.getX(); i <= blockposmax.getX(); ++i)
        {
            for (int j = blockposmin.getY(); j <= blockposmax.getY(); ++j)
            {
                for (int k = blockposmin.getZ(); k <= blockposmax.getZ(); ++k)
                {
                    blocks.add(new BlockPos(i, j, k));
                }
            }
        }
    }
    return blocks;
}
 
開發者ID:Yarichi,項目名稱:Proyecto-DASI,代碼行數:24,代碼來源:PositionHelper.java

示例8: decorate

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public void decorate(World worldIn, Random rand, BlockPos pos)
{
    if (this.field_150615_aC)
    {
        for (int i = 0; i < 3; ++i)
        {
            int j = rand.nextInt(16) + 8;
            int k = rand.nextInt(16) + 8;
            this.field_150616_aD.generate(worldIn, rand, worldIn.getHeight(pos.add(j, 0, k)));
        }

        for (int l = 0; l < 2; ++l)
        {
            int i1 = rand.nextInt(16) + 8;
            int j1 = rand.nextInt(16) + 8;
            this.field_150617_aE.generate(worldIn, rand, worldIn.getHeight(pos.add(i1, 0, j1)));
        }
    }

    super.decorate(worldIn, rand, pos);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:22,代碼來源:BiomeGenSnow.java

示例9: onNeighborBlockChange

import net.minecraft.util.BlockPos; //導入依賴的package包/類
/**
 * Called when a neighboring block changes.
 */
public void onNeighborBlockChange(World worldIn, BlockPos pos, IBlockState state, Block neighborBlock)
{
    EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
    BlockPos blockpos = pos.offset(enumfacing.getOpposite());
    IBlockState iblockstate = worldIn.getBlockState(blockpos);

    if (iblockstate.getBlock() != Blocks.piston && iblockstate.getBlock() != Blocks.sticky_piston)
    {
        worldIn.setBlockToAir(pos);
    }
    else
    {
        iblockstate.getBlock().onNeighborBlockChange(worldIn, blockpos, iblockstate, neighborBlock);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:BlockPistonExtension.java

示例10: setBlockBoundsBasedOnState

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
    if (worldIn.getBlockState(pos.north()).getBlock() == this)
    {
        this.setBlockBounds(0.0625F, 0.0F, 0.0F, 0.9375F, 0.875F, 0.9375F);
    }
    else if (worldIn.getBlockState(pos.south()).getBlock() == this)
    {
        this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 1.0F);
    }
    else if (worldIn.getBlockState(pos.west()).getBlock() == this)
    {
        this.setBlockBounds(0.0F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
    }
    else if (worldIn.getBlockState(pos.east()).getBlock() == this)
    {
        this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 1.0F, 0.875F, 0.9375F);
    }
    else
    {
        this.setBlockBounds(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:24,代碼來源:BlockChest.java

示例11: getAdjacentChest

import net.minecraft.util.BlockPos; //導入依賴的package包/類
protected TileEntityChest getAdjacentChest(EnumFacing side)
{
    BlockPos blockpos = this.pos.offset(side);

    if (this.isChestAt(blockpos))
    {
        TileEntity tileentity = this.worldObj.getTileEntity(blockpos);

        if (tileentity instanceof TileEntityChest)
        {
            TileEntityChest tileentitychest = (TileEntityChest)tileentity;
            tileentitychest.func_174910_a(this, side.getOpposite());
            return tileentitychest;
        }
    }

    return null;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:19,代碼來源:TileEntityChest.java

示例12: addTileEntity

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public void addTileEntity(BlockPos pos, TileEntity tileEntityIn)
{
    tileEntityIn.setWorldObj(this.worldObj);
    tileEntityIn.setPos(pos);

    if (this.getBlock(pos) instanceof ITileEntityProvider)
    {
        if (this.chunkTileEntityMap.containsKey(pos))
        {
            ((TileEntity)this.chunkTileEntityMap.get(pos)).invalidate();
        }

        tileEntityIn.validate();
        this.chunkTileEntityMap.put(pos, tileEntityIn);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:17,代碼來源:Chunk.java

示例13: onBlockAdded

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
        BlockBeacon.updateColorAsync(worldIn, pos);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:8,代碼來源:BlockStainedGlass.java

示例14: ContainerWorkbench

import net.minecraft.util.BlockPos; //導入依賴的package包/類
public ContainerWorkbench(InventoryPlayer playerInventory, World worldIn, BlockPos posIn)
{
    this.worldObj = worldIn;
    this.pos = posIn;
    this.addSlotToContainer(new SlotCrafting(playerInventory.player, this.craftMatrix, this.craftResult, 0, 124, 35));

    for (int i = 0; i < 3; ++i)
    {
        for (int j = 0; j < 3; ++j)
        {
            this.addSlotToContainer(new Slot(this.craftMatrix, j + i * 3, 30 + j * 18, 17 + i * 18));
        }
    }

    for (int k = 0; k < 3; ++k)
    {
        for (int i1 = 0; i1 < 9; ++i1)
        {
            this.addSlotToContainer(new Slot(playerInventory, i1 + k * 9 + 9, 8 + i1 * 18, 84 + k * 18));
        }
    }

    for (int l = 0; l < 9; ++l)
    {
        this.addSlotToContainer(new Slot(playerInventory, l, 8 + l * 18, 142));
    }

    this.onCraftMatrixChanged(this.craftMatrix);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:30,代碼來源:ContainerWorkbench.java

示例15: func_179661_a

import net.minecraft.util.BlockPos; //導入依賴的package包/類
private static AxisAlignedBB func_179661_a(BlockPos p_179661_0_, int p_179661_1_, int p_179661_2_, int p_179661_3_)
{
    boolean flag = p_179661_1_ < 0;
    boolean flag1 = p_179661_2_ < 0;
    boolean flag2 = p_179661_3_ < 0;
    int i = p_179661_0_.getX() + (flag ? p_179661_1_ : 0);
    int j = p_179661_0_.getY() + (flag1 ? p_179661_2_ : 0);
    int k = p_179661_0_.getZ() + (flag2 ? p_179661_3_ : 0);
    int l = p_179661_0_.getX() + (flag ? 0 : p_179661_1_) + 1;
    int i1 = p_179661_0_.getY() + (flag1 ? 0 : p_179661_2_) + 1;
    int j1 = p_179661_0_.getZ() + (flag2 ? 0 : p_179661_3_) + 1;
    return new AxisAlignedBB((double)i, (double)j, (double)k, (double)l, (double)i1, (double)j1);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:14,代碼來源:PlayerSelector.java


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