本文整理汇总了Java中net.minecraft.block.BlockLog类的典型用法代码示例。如果您正苦于以下问题:Java BlockLog类的具体用法?Java BlockLog怎么用?Java BlockLog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockLog类属于net.minecraft.block包,在下文中一共展示了BlockLog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import net.minecraft.block.BlockLog; //导入依赖的package包/类
@Override
public void update() {
super.update();
if (!worldObj.isRemote && boundedRect != null && worldObj.getTotalWorldTime() % 20L == 0) {
if (currentCheckingVec == null)
currentCheckingVec = new Vector3<Integer>(boundedRect.min.x.intValue(), pos.getY(), boundedRect.min.y.intValue());
// ProjectZed.logHelper.info("boundedRect", boundedRect, "currentCheckingVec", currentCheckingVec, getCurrentFacing());
final Block currentBlock = BlockUtils.getBlock(worldObj, currentCheckingVec).getBlock();
final int currentMeta = BlockUtils.getBlockMetadata(worldObj, currentCheckingVec);
if (currentBlock instanceof BlockLog || (currentBlock instanceof BlockCrops && currentMeta >= 7)) {
// chopTree((BlockLog) currentBlock);
chopTree();
return;
}
incrementVector();
}
}
示例2: getLogAxis
import net.minecraft.block.BlockLog; //导入依赖的package包/类
private BlockLog.EnumAxis getLogAxis(BlockPos p_175938_1_, BlockPos p_175938_2_)
{
BlockLog.EnumAxis blocklog$enumaxis = BlockLog.EnumAxis.Y;
int i = Math.abs(p_175938_2_.getX() - p_175938_1_.getX());
int j = Math.abs(p_175938_2_.getZ() - p_175938_1_.getZ());
int k = Math.max(i, j);
if (k > 0)
{
if (i == k)
{
blocklog$enumaxis = BlockLog.EnumAxis.X;
}
else if (j == k)
{
blocklog$enumaxis = BlockLog.EnumAxis.Z;
}
}
return blocklog$enumaxis;
}
示例3: getMetaFromState
import net.minecraft.block.BlockLog; //导入依赖的package包/类
/**
* Convert the BlockState into the correct metadata value
*/
@SuppressWarnings("incomplete-switch")
public int getMetaFromState(IBlockState state)
{
int i = 0;
switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS))
{
case X:
i |= 0;
break;
case Z:
i |= 1;
break;
case NONE:
i |= 2;
}
int j = state.getValue(GENERATED);
i += j*3;
return i;
}
示例4: getAmountPerTick
import net.minecraft.block.BlockLog; //导入依赖的package包/类
public int getAmountPerTick(World world, BlockPos pos,EnumFacing facing){
int amtPerBlock = 2; //mb
BlockPos start = pos.offset(facing);
int totalAmount = 0 ;
if(world.getBlockState(start) instanceof BlockLog){
for(int k= -1;k<14;k++){
for(int i= -1;i<2;i++){
for(int j= -1;j<2;j++){
if(world.getBlockState(start.add(i, j, k)) instanceof BlockLog){
totalAmount += amtPerBlock;
}
}
}
}
}
return totalAmount;
}
示例5: getStateFromMeta
import net.minecraft.block.BlockLog; //导入依赖的package包/类
@Override
public IBlockState getStateFromMeta(int meta) {
IBlockState iblockstate = this.getDefaultState();
switch (meta) {
case 0:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
break;
case 1:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
break;
case 2:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
break;
default:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
}
return iblockstate;
}
示例6: getAmountPerTick
import net.minecraft.block.BlockLog; //导入依赖的package包/类
public int getAmountPerTick(World world, BlockPos pos, EnumFacing facing) {
int amtPerBlock = 2; //mb
BlockPos start = pos.offset(facing);
int totalAmount = 0;
if (world.getBlockState(start) instanceof BlockLog) {
for (int k = -1; k < 14; k++) {
for (int i = -1; i < 2; i++) {
for (int j = -1; j < 2; j++) {
if (world.getBlockState(start.add(i, j, k)) instanceof BlockLog) {
totalAmount += amtPerBlock;
}
}
}
}
}
return totalAmount;
}
示例7: func_175938_b
import net.minecraft.block.BlockLog; //导入依赖的package包/类
private BlockLog.EnumAxis func_175938_b(BlockPos p_175938_1_, BlockPos p_175938_2_)
{
BlockLog.EnumAxis blocklog$enumaxis = BlockLog.EnumAxis.Y;
int i = Math.abs(p_175938_2_.getX() - p_175938_1_.getX());
int j = Math.abs(p_175938_2_.getZ() - p_175938_1_.getZ());
int k = Math.max(i, j);
if (k > 0)
{
if (i == k)
{
blocklog$enumaxis = BlockLog.EnumAxis.X;
}
else if (j == k)
{
blocklog$enumaxis = BlockLog.EnumAxis.Z;
}
}
return blocklog$enumaxis;
}
示例8: generate
import net.minecraft.block.BlockLog; //导入依赖的package包/类
@Override
public boolean generate(World world, Random rand, BlockPos pos) {
int height = getTreeHeight(rand);
int trunkHeight = height - variant.leavesHeightTotal;
// if (!BlockVolumeShape.region(-1, 1, -1, 1, trunkHeight - 1, 1)
// .and(-3, trunkHeight, -3, 3, height, 3)
// .hasSpace(pos, isEmptySpace(world)))
// return false;
for (int i = 0; i < trunkHeight; i++) {
setBlockInWorld(world, pos.up(i), LOG.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y));
}
generateTreeLeavesAndBranches(world, pos.add(0, trunkHeight, 0), pos, rand);
return true;
}
示例9: generateBranch
import net.minecraft.block.BlockLog; //导入依赖的package包/类
private void generateBranch(World world, Random rand, BlockPos trunkPos, Vec3d endPos) {
Vec3d curr = new Vec3d(trunkPos);
Vec3d next = next(world, curr, endPos.subtract(curr).normalize(), endPos, trunkPos);
BlockPos prev;
do {
BlockPos currBlock = new BlockPos(curr);
Vec3d dir = endPos.subtract(curr).normalize();
prev = currBlock;
curr = next;
next = next(world, curr, dir, endPos, trunkPos);
IBlockState state = (xzEqual(currBlock, trunkPos) ? LOG : LOG.withProperty(BlockLog.LOG_AXIS, getLogAxis(world, currBlock, dir)));
setBlockInWorld(world, currBlock, state);
// check to avoid long straight up branches
BlockPos nextBlock = new BlockPos(next);
if (endPos.squareDistanceTo(next) > Math.sqrt(3) && xzEqual(prev, currBlock) && xzEqual(currBlock, nextBlock)) {
next = next.addVector(rand.nextBoolean() ? -1 : 1, 0, rand.nextBoolean() ? -1 : 1);
}
} while (endPos.squareDistanceTo(curr) > Math.sqrt(3));
generateLeaves(world, rand, curr);
generateLeaves(world, rand, new Vec3d(prev));
}
示例10: getStateFromMeta
import net.minecraft.block.BlockLog; //导入依赖的package包/类
@Override
public IBlockState getStateFromMeta(int meta) {
IBlockState state = getDefaultState();
switch (meta & LOG_NO_AXIS_FLAG) {
case 0:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
break;
case LOG_X_AXIS_FLAG:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
break;
case LOG_Z_AXIS_FLAG:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
break;
default:
state = state.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
}
return state;
}
示例11: getStateFromMeta
import net.minecraft.block.BlockLog; //导入依赖的package包/类
/**
* Convert the given metadata into a BlockState for this Block
*/
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState().withProperty(VARIANT, WoodType.byMetadata((meta & 3) % 4));
switch (meta & 12)
{
case 0:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
break;
case 4:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
break;
case 8:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
break;
default:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
}
return iblockstate;
}
示例12: getStateFromMeta
import net.minecraft.block.BlockLog; //导入依赖的package包/类
@Override
@Nonnull
public IBlockState getStateFromMeta(int meta) {
IBlockState iblockstate = this.getDefaultState();
switch (meta & 12) {
case 0:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
break;
case 4:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
break;
case 8:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
break;
default:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
}
return iblockstate;
}
示例13: getStateFromMeta
import net.minecraft.block.BlockLog; //导入依赖的package包/类
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState().withProperty(wood_type, EnumLogType.getType(meta)).withProperty(double_drop, Boolean.valueOf((meta % 4) < 2));
switch (meta & 12)
{
case 0:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
break;
case 4:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
break;
case 8:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
break;
default:
iblockstate = iblockstate.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
}
return iblockstate;
}
示例14: getStateFromMeta
import net.minecraft.block.BlockLog; //导入依赖的package包/类
@Override
public IBlockState getStateFromMeta(int meta) {
IBlockState state = this.getDefaultState();
switch (meta & 12) {
case 0:
return state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Y);
case 4:
return state.withProperty(LOG_AXIS, BlockLog.EnumAxis.X);
case 8:
return state.withProperty(LOG_AXIS, BlockLog.EnumAxis.Z);
default:
return state.withProperty(LOG_AXIS, BlockLog.EnumAxis.NONE);
}
}
示例15: Trunk
import net.minecraft.block.BlockLog; //导入依赖的package包/类
@SuppressWarnings("incomplete-switch")
public Trunk(World world, BlockPos pos, EnumFacing direction,
IBlockState blockState, int treeHeight) {
super(world, pos, direction, blockState, treeHeight);
switch (this.direction) {
case NORTH :
case SOUTH :
this.blockState = this.blockState
.withProperty(BlockLog.LOG_AXIS, EnumAxis.Z);
break;
case EAST :
case WEST :
this.blockState = this.blockState
.withProperty(BlockLog.LOG_AXIS, EnumAxis.X);
}
}