当前位置: 首页>>代码示例>>Java>>正文


Java Block.getDefaultState方法代码示例

本文整理汇总了Java中net.minecraft.block.Block.getDefaultState方法的典型用法代码示例。如果您正苦于以下问题:Java Block.getDefaultState方法的具体用法?Java Block.getDefaultState怎么用?Java Block.getDefaultState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.block.Block的用法示例。


在下文中一共展示了Block.getDefaultState方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStateFromMeta

import net.minecraft.block.Block; //导入方法依赖的package包/类
private IBlockState getStateFromMeta(Block p_getStateFromMeta_1_, int p_getStateFromMeta_2_)
{
    try
    {
        IBlockState iblockstate = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_);

        if (p_getStateFromMeta_1_ == Blocks.DOUBLE_PLANT && p_getStateFromMeta_2_ > 7)
        {
            IBlockState iblockstate1 = p_getStateFromMeta_1_.getStateFromMeta(p_getStateFromMeta_2_ & 7);
            iblockstate = iblockstate.withProperty(BlockDoublePlant.VARIANT, iblockstate1.getValue(BlockDoublePlant.VARIANT));
        }

        return iblockstate;
    }
    catch (IllegalArgumentException var5)
    {
        return p_getStateFromMeta_1_.getDefaultState();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:ConnectedParser.java

示例2: getConstantPatternResult

import net.minecraft.block.Block; //导入方法依赖的package包/类
private IBlockState getConstantPatternResult(String text) {
    if (text.codePoints().allMatch(c -> '0' <= c && c <= '9')) {
        // blockstate number
        IBlockState stateConstant = Block.getStateById(Integer.parseInt(text));
        // don't accidentally include air!
        if (stateConstant.getBlock() != Blocks.AIR || text.equals("0")) {
            return stateConstant;
        } else {
            // no use doing the other branch here
            return null;
        }
    }
    if (text.codePoints().allMatch(BLOCK_ID_CPS)) {
        // string block ID?
        Block block = Block.getBlockFromName(text);
        if (block != null) {
            return block.getDefaultState();
        }
    }
    return null;
}
 
开发者ID:kenzierocks,项目名称:HardVox,代码行数:22,代码来源:BlockPatternArg.java

示例3: parseBlockState

import net.minecraft.block.Block; //导入方法依赖的package包/类
public IBlockState parseBlockState(String p_parseBlockState_1_, IBlockState p_parseBlockState_2_)
{
    MatchBlock[] amatchblock = this.parseMatchBlock(p_parseBlockState_1_);

    if (amatchblock == null)
    {
        return p_parseBlockState_2_;
    }
    else if (amatchblock.length != 1)
    {
        return p_parseBlockState_2_;
    }
    else
    {
        MatchBlock matchblock = amatchblock[0];
        int i = matchblock.getBlockId();
        Block block = Block.getBlockById(i);
        return block.getDefaultState();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:21,代码来源:ConnectedParser.java

示例4: readBlockState

import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
 * Reads a blockstate from the given tag.
 *  
 * @param tag The tag the blockstate is to be read from
 */
public static IBlockState readBlockState(NBTTagCompound tag)
{
    if (!tag.hasKey("Name", 8))
    {
        return Blocks.AIR.getDefaultState();
    }
    else
    {
        Block block = (Block)Block.REGISTRY.getObject(new ResourceLocation(tag.getString("Name")));
        IBlockState iblockstate = block.getDefaultState();

        if (tag.hasKey("Properties", 10))
        {
            NBTTagCompound nbttagcompound = tag.getCompoundTag("Properties");
            BlockStateContainer blockstatecontainer = block.getBlockState();

            for (String s : nbttagcompound.getKeySet())
            {
                IProperty<?> iproperty = blockstatecontainer.getProperty(s);

                if (iproperty != null)
                {
                    iblockstate = setValueHelper(iblockstate, iproperty, nbttagcompound.getString(s));
                }
            }
        }

        return iblockstate;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:36,代码来源:NBTUtil.java

示例5: WorldGenOre

import net.minecraft.block.Block; //导入方法依赖的package包/类
WorldGenOre(Function<Block, IBlockState> function, Block block, int minVeinSize, int maxVeinSize, int minHeight, int maxHeight, int generationChance, Block surrounding, BiomeDictionary.Type... biomes) {
	super(block.getDefaultState(), minVeinSize);
	this.oreToGen = function.apply(block);
	this.minOreVeinSize = minVeinSize;
	this.maxOreVeinSize = maxVeinSize;
	this.maxHeight = maxHeight;
	this.minHeight = minHeight;
	this.genChance = generationChance;
	this.predicate = BlockMatcher.forBlock(surrounding);
	if (biomes != null)
		Collections.addAll(this.biomes, biomes);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:13,代码来源:WorldGenOre.java

示例6: FlatLayerInfo

import net.minecraft.block.Block; //导入方法依赖的package包/类
public FlatLayerInfo(int p_i45627_1_, int height, Block layerMaterialIn)
{
    this.layerCount = 1;
    this.version = p_i45627_1_;
    this.layerCount = height;
    this.layerMaterial = layerMaterialIn.getDefaultState();
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:8,代码来源:FlatLayerInfo.java

示例7: getStateForOrePlacementImpl

import net.minecraft.block.Block; //导入方法依赖的package包/类
public static IBlockState getStateForOrePlacementImpl(Block self, World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) {
    ItemStack stack = placer.getHeldItem(hand);
    if (RandoresItemData.hasData(stack)) {
        return RandoresWorldData.delegate(new RandoresItemData(stack), def -> self.getDefaultState().withProperty(RandoresOre.HARVEST_LEVEL, def.getOre().getHarvestLevel()), self::getDefaultState);
    }
    return self.getDefaultState();
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:8,代码来源:RandoresItemHelper.java

示例8: FlatLayerInfo

import net.minecraft.block.Block; //导入方法依赖的package包/类
public FlatLayerInfo(int p_i45627_1_, int p_i45627_2_, Block p_i45627_3_)
{
    this.layerCount = 1;
    this.field_175902_a = p_i45627_1_;
    this.layerCount = p_i45627_2_;
    this.field_175901_b = p_i45627_3_.getDefaultState();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:FlatLayerInfo.java

示例9: SnakeDecoratorImplementation

import net.minecraft.block.Block; //导入方法依赖的package包/类
public SnakeDecoratorImplementation()
{
	Block fresh = (Block)Block.blockRegistry.getObject(new ResourceLocation(this.freshBlockName));
	Block stale = (Block)Block.blockRegistry.getObject(new ResourceLocation(this.staleBlockName));
	this.freshBlock = (fresh != null) ? fresh.getDefaultState() : Blocks.glowstone.getDefaultState();
	this.staleBlock = (stale != null) ? stale.getDefaultState() : Blocks.air.getDefaultState();
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:8,代码来源:SnakeDecoratorImplementation.java

示例10: ParseBlockType

import net.minecraft.block.Block; //导入方法依赖的package包/类
/**
 * Attempts to parse the block type string.
 * @param s The string to parse.
 * @return The block type, or null if the string is not recognised.
 */
public static IBlockState ParseBlockType( String s )
{
    if( s == null )
        return null; 
    Block block = (Block)Block.blockRegistry.getObject(new ResourceLocation( s ));
    if( block instanceof BlockAir && !s.equals("air") ) // Minecraft returns BlockAir when it doesn't recognise the string
        return null; // unrecognised string
    return block.getDefaultState();
}
 
开发者ID:Yarichi,项目名称:Proyecto-DASI,代码行数:15,代码来源:MinecraftTypeHelper.java

示例11: withDensityCoreMaterial

import net.minecraft.block.Block; //导入方法依赖的package包/类
public NeoBiome withDensityCoreMaterial(Block material) {
	this.densityCoreMaterial = material.getDefaultState();
	return this;
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:5,代码来源:NeoBiome.java

示例12: Lava

import net.minecraft.block.Block; //导入方法依赖的package包/类
public Lava(Block blockIn) {
	this.block = blockIn.getDefaultState();
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:4,代码来源:NeoHellGenerators.java

示例13: BasePineTreeGenerator

import net.minecraft.block.Block; //导入方法依赖的package包/类
public BasePineTreeGenerator(Block trunk, IBlockState leaf) {
	super(false);
	TRUNK = trunk.getDefaultState();
	LEAF = leaf;
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:6,代码来源:BasePineTreeGenerator.java

示例14: PontusWorldGeneratorStone

import net.minecraft.block.Block; //导入方法依赖的package包/类
public PontusWorldGeneratorStone(Block block) {
	this(block.getDefaultState());
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:4,代码来源:PontusWorldGeneratorStone.java

示例15: generateBlock

import net.minecraft.block.Block; //导入方法依赖的package包/类
public void generateBlock(Block block, World world, Random rand, int chunkX, int chunkZ, int minVienSize, int maxVienSize, int chance, int minY, int maxY) {
	
	int vienSize = minVienSize + rand.nextInt(maxVienSize - minVienSize);
	int heigthRange = maxY - minY;
	WorldGenMinable wGenMinable = new WorldGenMinable(block.getDefaultState(), vienSize);
	
	for(int i = 0; i < chance; i++) {
		
		int xRand = chunkX * 16 + rand.nextInt(16);
		int yRand = rand.nextInt(heigthRange) + minY;
		int zRand = chunkZ * 16 + rand.nextInt(16);
		
		wGenMinable.generate(world, rand, new BlockPos(xRand, yRand, zRand));
		
	}
	
}
 
开发者ID:RedPer,项目名称:MC-More-Ore-Mod,代码行数:18,代码来源:OreGenerator.java


注:本文中的net.minecraft.block.Block.getDefaultState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。