本文整理汇总了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();
}
}
示例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;
}
示例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();
}
}
示例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;
}
}
示例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);
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例11: withDensityCoreMaterial
import net.minecraft.block.Block; //导入方法依赖的package包/类
public NeoBiome withDensityCoreMaterial(Block material) {
this.densityCoreMaterial = material.getDefaultState();
return this;
}
示例12: Lava
import net.minecraft.block.Block; //导入方法依赖的package包/类
public Lava(Block blockIn) {
this.block = blockIn.getDefaultState();
}
示例13: BasePineTreeGenerator
import net.minecraft.block.Block; //导入方法依赖的package包/类
public BasePineTreeGenerator(Block trunk, IBlockState leaf) {
super(false);
TRUNK = trunk.getDefaultState();
LEAF = leaf;
}
示例14: PontusWorldGeneratorStone
import net.minecraft.block.Block; //导入方法依赖的package包/类
public PontusWorldGeneratorStone(Block block) {
this(block.getDefaultState());
}
示例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));
}
}