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


Java IBlockAccess.getBlockState方法代碼示例

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


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

示例1: func_176364_g

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
public boolean func_176364_g(IBlockAccess blockAccess, BlockPos pos)
{
    for (int i = -1; i <= 1; ++i)
    {
        for (int j = -1; j <= 1; ++j)
        {
            IBlockState iblockstate = blockAccess.getBlockState(pos.add(i, 0, j));
            Block block = iblockstate.getBlock();
            Material material = block.getMaterial();

            if (material != this.blockMaterial && !block.isFullBlock())
            {
                return true;
            }
        }
    }

    return false;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:20,代碼來源:BlockLiquid.java

示例2: isConnectedTo

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
public static boolean isConnectedTo(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing direction)
{
    BlockPos blockpos = pos.offset(direction);
    IBlockState iblockstate = worldIn.getBlockState(blockpos);
    Block block = iblockstate.getBlock();

    if (block == Blocks.TRIPWIRE_HOOK)
    {
        EnumFacing enumfacing = direction.getOpposite();
        return iblockstate.getValue(BlockTripWireHook.FACING) == enumfacing;
    }
    else
    {
        return block == Blocks.TRIPWIRE;
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:BlockTripWire.java

示例3: isConnectedTo

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
public static boolean isConnectedTo(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing direction)
{
    BlockPos blockpos = pos.offset(direction);
    IBlockState iblockstate = worldIn.getBlockState(blockpos);
    Block block = iblockstate.getBlock();

    if (block == Blocks.tripwire_hook)
    {
        EnumFacing enumfacing = direction.getOpposite();
        return iblockstate.getValue(BlockTripWireHook.FACING) == enumfacing;
    }
    else if (block == Blocks.tripwire)
    {
        boolean flag = ((Boolean)state.getValue(SUSPENDED)).booleanValue();
        boolean flag1 = ((Boolean)iblockstate.getValue(SUSPENDED)).booleanValue();
        return flag == flag1;
    }
    else
    {
        return false;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:23,代碼來源:BlockTripWire.java

示例4: shouldSideBeRendered

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
    switch (side)
    {
        case UP:
            return true;
        case NORTH:
        case SOUTH:
        case WEST:
        case EAST:
            IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
            Block block = iblockstate.getBlock();
            return !iblockstate.isOpaqueCube() && block != Blocks.FARMLAND && block != Blocks.GRASS_PATH;
        default:
            return super.shouldSideBeRendered(blockState, blockAccess, pos, side);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:19,代碼來源:BlockGrassPath.java

示例5: shouldSideBeRendered

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();

    if (this == Blocks.glass || this == Blocks.stained_glass)
    {
        if (worldIn.getBlockState(pos.offset(side.getOpposite())) != iblockstate)
        {
            return true;
        }

        if (block == this)
        {
            return false;
        }
    }

    return !this.ignoreSimilarity && block == this ? false : super.shouldSideBeRendered(worldIn, pos, side);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:BlockBreakable.java

示例6: func_176339_d

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
private boolean func_176339_d(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
    BlockPos blockpos = pos.offset(side);
    IBlockState iblockstate = worldIn.getBlockState(blockpos);
    Block block = iblockstate.getBlock();
    boolean flag = block.isNormalCube();
    boolean flag1 = worldIn.getBlockState(pos.up()).getBlock().isNormalCube();
    return !flag1 && flag && canConnectUpwardsTo(worldIn, blockpos.up()) ? true : (canConnectTo(iblockstate, side) ? true : (block == Blocks.powered_repeater && iblockstate.getValue(BlockRedstoneDiode.FACING) == side ? true : !flag && canConnectUpwardsTo(worldIn, blockpos.down())));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:10,代碼來源:BlockRedstoneWire.java

示例7: shouldSideBeRendered

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
    EnumFacing.Axis enumfacing$axis = null;
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (worldIn.getBlockState(pos).getBlock() == this)
    {
        enumfacing$axis = (EnumFacing.Axis)iblockstate.getValue(AXIS);

        if (enumfacing$axis == null)
        {
            return false;
        }

        if (enumfacing$axis == EnumFacing.Axis.Z && side != EnumFacing.EAST && side != EnumFacing.WEST)
        {
            return false;
        }

        if (enumfacing$axis == EnumFacing.Axis.X && side != EnumFacing.SOUTH && side != EnumFacing.NORTH)
        {
            return false;
        }
    }

    boolean flag = worldIn.getBlockState(pos.west()).getBlock() == this && worldIn.getBlockState(pos.west(2)).getBlock() != this;
    boolean flag1 = worldIn.getBlockState(pos.east()).getBlock() == this && worldIn.getBlockState(pos.east(2)).getBlock() != this;
    boolean flag2 = worldIn.getBlockState(pos.north()).getBlock() == this && worldIn.getBlockState(pos.north(2)).getBlock() != this;
    boolean flag3 = worldIn.getBlockState(pos.south()).getBlock() == this && worldIn.getBlockState(pos.south(2)).getBlock() != this;
    boolean flag4 = flag || flag1 || enumfacing$axis == EnumFacing.Axis.X;
    boolean flag5 = flag2 || flag3 || enumfacing$axis == EnumFacing.Axis.Z;
    return flag4 && side == EnumFacing.WEST ? true : (flag4 && side == EnumFacing.EAST ? true : (flag5 && side == EnumFacing.NORTH ? true : flag5 && side == EnumFacing.SOUTH));
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:34,代碼來源:BlockPortal.java

示例8: isLadder

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
@Override
public boolean isLadder(IBlockState state, IBlockAccess world, BlockPos pos, EntityLivingBase entity)
{
    if (state.getValue(OPEN))
    {
        IBlockState down = world.getBlockState(pos.down());
        if (down.getBlock() == net.minecraft.init.Blocks.LADDER)
            return down.getValue(BlockLadder.FACING) == state.getValue(FACING);
    }
    return false;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:12,代碼來源:BlockTrapDoor.java

示例9: getPowerOnSide

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
protected int getPowerOnSide(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return this.isAlternateInput(iblockstate) ? (block == Blocks.REDSTONE_BLOCK ? 15 : (block == Blocks.REDSTONE_WIRE ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : worldIn.getStrongPower(pos, side))) : 0;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:7,代碼來源:BlockRedstoneDiode.java

示例10: canConnectTo

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return block == Blocks.BARRIER ? false : ((!(block instanceof BlockFence) || block.blockMaterial != this.blockMaterial) && !(block instanceof BlockFenceGate) ? (block.blockMaterial.isOpaque() && iblockstate.isFullCube() ? block.blockMaterial != Material.GOURD : false) : true);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:7,代碼來源:BlockFence.java

示例11: canConnectTo

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
private boolean canConnectTo(IBlockAccess worldIn, BlockPos pos)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return block == Blocks.BARRIER ? false : (block != this && !(block instanceof BlockFenceGate) ? (block.blockMaterial.isOpaque() && iblockstate.isFullCube() ? block.blockMaterial != Material.GOURD : false) : true);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:7,代碼來源:BlockWall.java

示例12: getFluidHeight

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
private float getFluidHeight(IBlockAccess blockAccess, BlockPos blockPosIn, Material blockMaterial)
{
    int i = 0;
    float f = 0.0F;

    for (int j = 0; j < 4; ++j)
    {
        BlockPos blockpos = blockPosIn.add(-(j & 1), 0, -(j >> 1 & 1));

        if (blockAccess.getBlockState(blockpos.up()).getBlock().getMaterial() == blockMaterial)
        {
            return 1.0F;
        }

        IBlockState iblockstate = blockAccess.getBlockState(blockpos);
        Material material = iblockstate.getBlock().getMaterial();

        if (material != blockMaterial)
        {
            if (!material.isSolid())
            {
                ++f;
                ++i;
            }
        }
        else
        {
            int k = ((Integer)iblockstate.getValue(BlockLiquid.LEVEL)).intValue();

            if (k >= 8 || k == 0)
            {
                f += BlockLiquid.getLiquidHeightPercent(k) * 10.0F;
                i += 10;
            }

            f += BlockLiquid.getLiquidHeightPercent(k);
            ++i;
        }
    }

    return 1.0F - f / (float)i;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:43,代碼來源:BlockFluidRenderer.java

示例13: getPowerOnSide

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
protected int getPowerOnSide(IBlockAccess worldIn, BlockPos pos, EnumFacing side)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);
    Block block = iblockstate.getBlock();
    return this.canPowerSide(block) ? (block == Blocks.redstone_wire ? ((Integer)iblockstate.getValue(BlockRedstoneWire.POWER)).intValue() : worldIn.getStrongPower(pos, side)) : 0;
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:7,代碼來源:BlockRedstoneDiode.java

示例14: shouldSideBeRendered

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
    IBlockState iblockstate = blockAccess.getBlockState(pos.offset(side));
    Block block = iblockstate.getBlock();
    return !iblockstate.isOpaqueCube() && block != Blocks.END_GATEWAY;
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:7,代碼來源:BlockEndGateway.java

示例15: isBurning

import net.minecraft.world.IBlockAccess; //導入方法依賴的package包/類
@Override
public boolean isBurning(IBlockAccess world, BlockPos pos)
{
    IBlockState state = world.getBlockState(pos);
    return getContent().isBurning.get(getSubtype(state)).orElse(false);
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:7,代碼來源:BlockMixin.java


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