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


Java IBlockState.getValue方法代碼示例

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


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

示例1: getMetaFromState

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
@SuppressWarnings("incomplete-switch")

    /**
     * Convert the BlockState into the correct metadata value
     */
    public int getMetaFromState(IBlockState state)
    {
        int i = 0;
        i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata() - 4;

        switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS))
        {
            case X:
                i |= 4;
                break;

            case Z:
                i |= 8;
                break;

            case NONE:
                i |= 12;
        }

        return i;
    }
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:27,代碼來源:BlockNewLog.java

示例2: setBlockBoundsBasedOnState

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos)
{
    if (this.isDouble())
    {
        this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos);

        if (iblockstate.getBlock() == this)
        {
            if (iblockstate.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
            {
                this.setBlockBounds(0.0F, 0.5F, 0.0F, 1.0F, 1.0F, 1.0F);
            }
            else
            {
                this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
            }
        }
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:24,代碼來源:BlockSlab.java

示例3: canPlaceBlockOnSide

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack)
{
    BlockPos blockpos = pos;
    IProperty iproperty = this.singleSlab.getVariantProperty();
    Object object = this.singleSlab.getVariant(stack);
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() == this.singleSlab)
    {
        boolean flag = iblockstate.getValue(BlockSlab.HALF) == BlockSlab.EnumBlockHalf.TOP;

        if ((side == EnumFacing.UP && !flag || side == EnumFacing.DOWN && flag) && object == iblockstate.getValue(iproperty))
        {
            return true;
        }
    }

    pos = pos.offset(side);
    IBlockState iblockstate1 = worldIn.getBlockState(pos);
    return iblockstate1.getBlock() == this.singleSlab && object == iblockstate1.getValue(iproperty) ? true : super.canPlaceBlockOnSide(worldIn, blockpos, side, player, stack);
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:22,代碼來源:ItemSlab.java

示例4: rotateBlock

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis)
{
    IBlockState state = world.getBlockState(pos);
    for (IProperty prop : state.getProperties().keySet())
    {
        if (prop.getName().equals("variant") && prop.getValueClass() == EnumType.class)
        {
            EnumType current = (EnumType)state.getValue(prop);
            EnumType next = current == EnumType.LINES_X ? EnumType.LINES_Y :
                            current == EnumType.LINES_Y ? EnumType.LINES_Z :
                            current == EnumType.LINES_Z ? EnumType.LINES_X : current;
            if (next == current)
                return false;
            world.setBlockState(pos, state.withProperty(prop, next));
            return true;
        }
    }
    return false;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:BlockQuartz.java

示例5: onNeighborBlockChange

import net.minecraft.block.state.IBlockState; //導入方法依賴的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:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:BlockPistonExtension.java

示例6: getMapColor

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * Get the MapColor for this Block and the given BlockState
 */
public MapColor getMapColor(IBlockState state)
{
    switch ((BlockHugeMushroom.EnumType)state.getValue(VARIANT))
    {
        case ALL_STEM:
            return MapColor.clothColor;

        case ALL_INSIDE:
            return MapColor.sandColor;

        case STEM:
            return MapColor.sandColor;

        default:
            return super.getMapColor(state);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:BlockHugeMushroom.java

示例7: getRenderColor

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public int getRenderColor(IBlockState state)
{
    if (state.getBlock() != this)
    {
        return super.getRenderColor(state);
    }
    else
    {
        BlockPlanks.EnumType blockplanks$enumtype = (BlockPlanks.EnumType)state.getValue(VARIANT);
        return blockplanks$enumtype == BlockPlanks.EnumType.SPRUCE ? ColorizerFoliage.getFoliageColorPine() : (blockplanks$enumtype == BlockPlanks.EnumType.BIRCH ? ColorizerFoliage.getFoliageColorBirch() : super.getRenderColor(state));
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:13,代碼來源:BlockOldLeaf.java

示例8: getMetaFromState

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * Convert the BlockState into the correct metadata value
 */
public int getMetaFromState(IBlockState state)
{
    int i = 0;
    i = i | ((BlockPlanks.EnumType)state.getValue(VARIANT)).getMetadata();

    if (!this.isDouble() && state.getValue(HALF) == BlockSlab.EnumBlockHalf.TOP)
    {
        i |= 8;
    }

    return i;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:16,代碼來源:BlockWoodSlab.java

示例9: getActualState

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
/**
 * Get the actual Block state of this Block at the given position. This applies properties not visible in the
 * metadata, such as fence connections.
 */
public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos)
{
    if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos.down());

        if (iblockstate.getBlock() == this)
        {
            state = state.withProperty(VARIANT, iblockstate.getValue(VARIANT));
        }
    }

    return state;
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:19,代碼來源:BlockDoublePlant.java

示例10: isSameRailWithPower

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
protected boolean isSameRailWithPower(World worldIn, BlockPos pos, boolean p_176567_3_, int distance, BlockRailBase.EnumRailDirection p_176567_5_)
{
    IBlockState iblockstate = worldIn.getBlockState(pos);

    if (iblockstate.getBlock() != this)
    {
        return false;
    }
    else
    {
        BlockRailBase.EnumRailDirection blockrailbase$enumraildirection = (BlockRailBase.EnumRailDirection)iblockstate.getValue(SHAPE);
        return p_176567_5_ != BlockRailBase.EnumRailDirection.EAST_WEST || blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.NORTH_SOUTH && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_NORTH && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_SOUTH ? (p_176567_5_ != BlockRailBase.EnumRailDirection.NORTH_SOUTH || blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.EAST_WEST && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_EAST && blockrailbase$enumraildirection != BlockRailBase.EnumRailDirection.ASCENDING_WEST ? (((Boolean)iblockstate.getValue(POWERED)).booleanValue() ? (worldIn.isBlockPowered(pos) ? true : this.findPoweredRailSignal(worldIn, pos, iblockstate, p_176567_3_, distance + 1)) : false) : false) : false;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:15,代碼來源:BlockRailPowered.java

示例11: update

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
@Override
public void update() {
	this.energyStorage.tick();
	IBlockState cur = world.getBlockState(pos);
	EnumFacing facing = cur.getValue(BlockBattery.FACING);
	IEnergyStorage target = RFTransport.getStorage(world, pos.offset(facing), facing.getOpposite());
	if (target.canReceive()) {
		int toPush = Math.min(energyStorage.getEnergyStored(), target.getMaxEnergyStored());
		int received = target.receiveEnergy(toPush, false);
		if (received>0) energyStorage.extractEnergy(received, false);
		energyStorage.receiveEnergy(energyStorage.getMaxEnergyStored(), false);
	}
}
 
開發者ID:elytra,項目名稱:Thermionics,代碼行數:14,代碼來源:TileEntityBatteryCreative.java

示例12: canBlockStay

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    if (pos.getY() >= 0 && pos.getY() < 256)
    {
        IBlockState iblockstate = worldIn.getBlockState(pos.down());
        return iblockstate.getBlock() == Blocks.MYCELIUM ? true : (iblockstate.getBlock() == Blocks.DIRT && iblockstate.getValue(BlockDirt.VARIANT) == BlockDirt.DirtType.PODZOL ? true : worldIn.getLight(pos) < 13 && this.canSustainBush(iblockstate));
    }
    else
    {
        return false;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:BlockMushroom.java

示例13: canBlockStay

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state)
{
    if (state.getValue(HALF) == BlockDoublePlant.EnumBlockHalf.UPPER)
    {
        return worldIn.getBlockState(pos.down()).getBlock() == this;
    }
    else
    {
        IBlockState iblockstate = worldIn.getBlockState(pos.up());
        return iblockstate.getBlock() == this && super.canBlockStay(worldIn, pos, iblockstate);
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:13,代碼來源:BlockDoublePlant.java

示例14: canConnectRedstone

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
@Override
public boolean canConnectRedstone(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing side) {
	if (side == state.getValue(FACING) || side == state.getValue(FACING).getOpposite())
		return false;

	return true;
}
 
開發者ID:oMilkyy,項目名稱:SimpleTubes,代碼行數:8,代碼來源:BlockDisplacer.java

示例15: getUnpoweredState

import net.minecraft.block.state.IBlockState; //導入方法依賴的package包/類
protected IBlockState getUnpoweredState(IBlockState poweredState)
{
    Integer integer = (Integer)poweredState.getValue(DELAY);
    Boolean obool = (Boolean)poweredState.getValue(LOCKED);
    EnumFacing enumfacing = (EnumFacing)poweredState.getValue(FACING);
    return Blocks.unpowered_repeater.getDefaultState().withProperty(FACING, enumfacing).withProperty(DELAY, integer).withProperty(LOCKED, obool);
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:8,代碼來源:BlockRedstoneRepeater.java


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