本文整理汇总了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;
}
示例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;
}