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


Java BlockRotatedPillar类代码示例

本文整理汇总了Java中net.minecraft.block.BlockRotatedPillar的典型用法代码示例。如果您正苦于以下问题:Java BlockRotatedPillar类的具体用法?Java BlockRotatedPillar怎么用?Java BlockRotatedPillar使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: blockRotates

import net.minecraft.block.BlockRotatedPillar; //导入依赖的package包/类
/**
 * Returns whether block rotates based on placement conditions.
 * The blocks that utilize this property are mostly atypical, and
 * must be added manually.
 */
public static boolean blockRotates(ItemStack itemStack)
{
    Block block = toBlock(itemStack);

    return block instanceof BlockQuartz ||
           block instanceof BlockRotatedPillar;
}
 
开发者ID:Mineshopper,项目名称:carpentersblocks,代码行数:13,代码来源:BlockProperties.java

示例2: generate

import net.minecraft.block.BlockRotatedPillar; //导入依赖的package包/类
@Override
public boolean generate(World world, Random rand, BlockPos position) {
	BlockPos pos = NeoHellGenerators.findSurface(world, position);
	if (pos==null) {
		//System.out.println("Failed to generate at "+position);
		return false;
	} else {
		//System.out.println("Generating at "+pos);
	}
	
	int height = rand.nextInt(4) + 7;
	
	IBlockState trunkState = Blocks.BONE_BLOCK.getDefaultState().withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Y);
	//EnumFacing.Axis axis = rand.nextBoolean() ? EnumFacing.Axis.X : EnumFacing.Axis.Z;
	EnumAxis axis = rand.nextBoolean() ? EnumAxis.X : EnumAxis.Z;
	BlockPos section = pos;
	
	for(int y=0; y<height; y++) {
		
		world.setBlockState(section, trunkState);
		
		if (y>3 && y%2==0) {
			axis = rand.nextBoolean() ? EnumAxis.X : EnumAxis.Z;
			BlockPos arm = section;
			int width = (height-y) / 2;
			
			for(int i=0; i<width; i++) {
				arm = arm.add(axis.xofs, axis.yofs, axis.zofs);
				world.setBlockState(arm, axis==EnumAxis.X ?
						trunkState.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.X) :
						trunkState.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Z));
			}
			arm = section;
			for(int i=0; i<width; i++) {
				arm = arm.add(-axis.xofs, -axis.yofs, -axis.zofs);
				world.setBlockState(arm, axis==EnumAxis.X ?
						trunkState.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.X) :
						trunkState.withProperty(BlockRotatedPillar.AXIS, EnumFacing.Axis.Z));
			}
		}
		section = section.up();
	}
	
	return true;
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:46,代码来源:GeneratorBoneTree.java


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