當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。