net.minecraft.util.EnumFacing#EAST源码实例Demo

下面列出了net.minecraft.util.EnumFacing#EAST 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: EmergingTechnology   文件: Cooker.java
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
    if (!worldIn.isRemote) {
        IBlockState north = worldIn.getBlockState(pos.north());
        IBlockState east = worldIn.getBlockState(pos.east());
        IBlockState south = worldIn.getBlockState(pos.south());
        IBlockState west = worldIn.getBlockState(pos.west());

        EnumFacing face = (EnumFacing) state.getValue(FACING);

        if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) {
            face = EnumFacing.SOUTH;
        } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) {
            face = EnumFacing.NORTH;
        } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) {
            face = EnumFacing.WEST;
        } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) {
            face = EnumFacing.EAST;
        }

        worldIn.setBlockState(pos, state.withProperty(FACING, face));
    }
}
 
源代码2 项目: Signals   文件: SignalsUtils.java
public static EnumFacing getRelativeHorizonal(BlockPos original, BlockPos neighbor){
    int relX = neighbor.getX() - original.getX();
    int relZ = neighbor.getZ() - original.getZ();

    if(relZ == 0) {
        if(relX == 1) return EnumFacing.EAST;
        if(relX == -1) return EnumFacing.WEST;
    }

    if(relX == 0) {
        if(relZ > 0) return EnumFacing.SOUTH;
        if(relZ < 0) return EnumFacing.NORTH;
    }

    return null;
}
 
源代码3 项目: CommunityMod   文件: BlockUnpackager.java
public EnumFacing getFacingFromMeta(int meta) {
	if (meta == 0 || meta == 6) {
		return EnumFacing.EAST;
	}
	if (meta == 1 || meta == 7) {
		return EnumFacing.WEST;
	}
	if (meta == 2 || meta == 8) {
		return EnumFacing.NORTH;
	}
	if (meta == 3 || meta == 9) {
		return EnumFacing.SOUTH;
	}
	if (meta == 4 || meta == 10) {
		return EnumFacing.UP;
	}
	if (meta == 5 || meta == 11) {
		return EnumFacing.DOWN;
	}
	return EnumFacing.EAST;
}
 
源代码4 项目: EmergingTechnology   文件: BiomassGenerator.java
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
    if (!worldIn.isRemote) {
        IBlockState north = worldIn.getBlockState(pos.north());
        IBlockState east = worldIn.getBlockState(pos.east());
        IBlockState south = worldIn.getBlockState(pos.south());
        IBlockState west = worldIn.getBlockState(pos.west());

        EnumFacing face = (EnumFacing) state.getValue(FACING);

        if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) {
            face = EnumFacing.SOUTH;
        } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) {
            face = EnumFacing.NORTH;
        } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) {
            face = EnumFacing.WEST;
        } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) {
            face = EnumFacing.EAST;
        }

        worldIn.setBlockState(pos, state.withProperty(FACING, face));
    }
}
 
源代码5 项目: CommunityMod   文件: BlockPackager.java
public EnumFacing getFacingFromMeta(int meta) {
	if (meta == 0) {
		return EnumFacing.EAST;
	}
	if (meta == 1) {
		return EnumFacing.WEST;
	}
	if (meta == 2) {
		return EnumFacing.NORTH;
	}
	if (meta == 3) {
		return EnumFacing.SOUTH;
	}
	if (meta == 4) {
		return EnumFacing.UP;
	}
	if (meta == 5) {
		return EnumFacing.DOWN;
	}
	return EnumFacing.EAST;
}
 
源代码6 项目: EmergingTechnology   文件: TidalGenerator.java
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
    if (!worldIn.isRemote) {
        IBlockState north = worldIn.getBlockState(pos.north());
        IBlockState east = worldIn.getBlockState(pos.east());
        IBlockState south = worldIn.getBlockState(pos.south());
        IBlockState west = worldIn.getBlockState(pos.west());

        EnumFacing face = (EnumFacing) state.getValue(FACING);

        if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) {
            face = EnumFacing.SOUTH;
        } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) {
            face = EnumFacing.NORTH;
        } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) {
            face = EnumFacing.WEST;
        } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) {
            face = EnumFacing.EAST;
        }

        worldIn.setBlockState(pos, state.withProperty(FACING, face));
    }
}
 
源代码7 项目: EmergingTechnology   文件: Piezoelectric.java
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
    if (!worldIn.isRemote) {
        IBlockState north = worldIn.getBlockState(pos.north());
        IBlockState east = worldIn.getBlockState(pos.east());
        IBlockState south = worldIn.getBlockState(pos.south());
        IBlockState west = worldIn.getBlockState(pos.west());

        EnumFacing face = (EnumFacing) state.getValue(FACING);

        if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) {
            face = EnumFacing.SOUTH;
        } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) {
            face = EnumFacing.NORTH;
        } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) {
            face = EnumFacing.WEST;
        } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) {
            face = EnumFacing.EAST;
        }

        worldIn.setBlockState(pos, state.withProperty(FACING, face));
    }
}
 
源代码8 项目: EmergingTechnology   文件: Scrubber.java
@Override
public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) {
    if (!worldIn.isRemote) {
        IBlockState north = worldIn.getBlockState(pos.north());
        IBlockState east = worldIn.getBlockState(pos.east());
        IBlockState south = worldIn.getBlockState(pos.south());
        IBlockState west = worldIn.getBlockState(pos.west());

        EnumFacing face = (EnumFacing) state.getValue(FACING);

        if (face == EnumFacing.NORTH && north.isFullBlock() && !south.isFullBlock()) {
            face = EnumFacing.SOUTH;
        } else if (face == EnumFacing.SOUTH && south.isFullBlock() && !north.isFullBlock()) {
            face = EnumFacing.NORTH;
        } else if (face == EnumFacing.EAST && east.isFullBlock() && !west.isFullBlock()) {
            face = EnumFacing.WEST;
        } else if (face == EnumFacing.WEST && west.isFullBlock() && !east.isFullBlock()) {
            face = EnumFacing.EAST;
        }

        worldIn.setBlockState(pos, state.withProperty(FACING, face));
    }
}
 
源代码9 项目: NOVA-Core   文件: DirectionConverter.java
@Override
public EnumFacing toNative(Direction novaObj) {
	switch (novaObj) {
		case DOWN:  return EnumFacing.DOWN;
		case UP:    return EnumFacing.UP;
		case NORTH: return EnumFacing.NORTH;
		case SOUTH: return EnumFacing.SOUTH;
		case WEST:  return EnumFacing.WEST;
		case EAST:  return EnumFacing.EAST;
		default: return (EnumFacing) null;
	}
}
 
源代码10 项目: TFC2   文件: IslandData.java
public void enablePortal(EnumFacing facing)
{
	if(facing == EnumFacing.NORTH)
		northPortalState = PortalEnumType.Enabled;
	else if(facing == EnumFacing.SOUTH)
		southPortalState = PortalEnumType.Enabled;
	else if(facing == EnumFacing.EAST)
		eastPortalState = PortalEnumType.Enabled;
	else if(facing == EnumFacing.WEST)
		westPortalState = PortalEnumType.Enabled;
}
 
源代码11 项目: Sakura_mod   文件: BlockBarrelDistillation.java
public void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
         IBlockState iblockstate = worldIn.getBlockState(pos.north());
         IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
         IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
         IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
         EnumFacing enumfacing = state.getValue(FACING);

         if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
         {
             enumfacing = EnumFacing.SOUTH;
         }
         else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
         {
             enumfacing = EnumFacing.NORTH;
         }
         else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
         {
             enumfacing = EnumFacing.EAST;
         }
         else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
         {
             enumfacing = EnumFacing.WEST;
         }

         worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
     }
 }
 
源代码12 项目: Sakura_mod   文件: BlockBarrel.java
public void setDefaultFacing(World worldIn, BlockPos pos, IBlockState state)
{
    if (!worldIn.isRemote)
    {
         IBlockState iblockstate = worldIn.getBlockState(pos.north());
         IBlockState iblockstate1 = worldIn.getBlockState(pos.south());
         IBlockState iblockstate2 = worldIn.getBlockState(pos.west());
         IBlockState iblockstate3 = worldIn.getBlockState(pos.east());
         EnumFacing enumfacing = state.getValue(FACING);

         if (enumfacing == EnumFacing.NORTH && iblockstate.isFullBlock() && !iblockstate1.isFullBlock())
         {
             enumfacing = EnumFacing.SOUTH;
         }
         else if (enumfacing == EnumFacing.SOUTH && iblockstate1.isFullBlock() && !iblockstate.isFullBlock())
         {
             enumfacing = EnumFacing.NORTH;
         }
         else if (enumfacing == EnumFacing.WEST && iblockstate2.isFullBlock() && !iblockstate3.isFullBlock())
         {
             enumfacing = EnumFacing.EAST;
         }
         else if (enumfacing == EnumFacing.EAST && iblockstate3.isFullBlock() && !iblockstate2.isFullBlock())
         {
             enumfacing = EnumFacing.WEST;
         }

         worldIn.setBlockState(pos, state.withProperty(FACING, enumfacing), 2);
     }
 }
 
protected EnumFacing getPortalOrientation(World world, BlockPos portalPos)
{
    if (world.getBlockState(portalPos.west()).getBlock() == Blocks.PORTAL ||
        world.getBlockState(portalPos.east()).getBlock() == Blocks.PORTAL)
    {
        return EnumFacing.EAST;
    }
    else if (world.getBlockState(portalPos.north()).getBlock() == Blocks.PORTAL ||
             world.getBlockState(portalPos.south()).getBlock() == Blocks.PORTAL)
    {
        return EnumFacing.SOUTH;
    }

    return EnumFacing.NORTH;
}
 
源代码14 项目: EmergingTechnology   文件: FacingHelper.java
public static EnumFacing intToFacing(int id) {
    switch(id) {
        case 1:
            return EnumFacing.NORTH;
        case 2:
            return EnumFacing.EAST;
        case 3:
            return EnumFacing.SOUTH;
        case 4:
            return EnumFacing.WEST;
        default:
            return EnumFacing.NORTH;
    }
}
 
源代码15 项目: Signals   文件: AbstractRailRenderer.java
public static int getRailHeightOffset(NetworkRail<MCPos> rail, EnumFacing dir){
    switch(((MCNetworkRail)rail).getCurDir()){
        case ASCENDING_EAST:
            return dir == EnumFacing.EAST ? 1 : (dir == EnumFacing.WEST ? -1 : 0);
        case ASCENDING_NORTH:
            return dir == EnumFacing.NORTH ? 1 : (dir == EnumFacing.SOUTH ? -1 : 0);
        case ASCENDING_SOUTH:
            return dir == EnumFacing.SOUTH ? 1 : (dir == EnumFacing.NORTH ? -1 : 0);
        case ASCENDING_WEST:
            return dir == EnumFacing.WEST ? 1 : (dir == EnumFacing.EAST ? -1 : 0);
        default:
            return 0;
    }
}
 
public boolean generate(World worldIn, Random rand, BlockPos position) {
    int num = rand.nextInt(5);
    EnumFacing orientation;
    if (num == 0) {
        orientation = EnumFacing.EAST;
        stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X);
    } else if (num == 1) {
        orientation = EnumFacing.WEST;
        stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X);
    } else if (num == 1) {
        orientation = EnumFacing.SOUTH;
        stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z);
    } else {
        orientation = EnumFacing.NORTH;
        stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z);
    }
    int i = rand.nextInt(2) + this.minTreeLength;
    boolean flag = true;

    if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
        for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) {
            int k = 1;

            if (j == position.getY()) {
                k = 0;
            }

            if (j >= position.getY() + 1 + i - 2) {
                k = 2;
            }

            BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos();

            for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) {
                for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) {
                    if (j >= 0 && j < worldIn.getHeight()) {
                        if (!this.isReplaceable(worldIn, mutablePos.setPos(l, j, i1))) {
                            flag = false;
                        }
                    } else {
                        flag = false;
                    }
                }
            }
        }

        if (!flag) {
            return false;
        } else {
            IBlockState state = worldIn.getBlockState(position.down());

            if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
                state.getBlock().onPlantGrow(state, worldIn, position.down(), position);

                for (int j3 = 0; j3 < i; ++j3) {
                    BlockPos offsetPos = position.offset(orientation, j3);
                    state = worldIn.getBlockState(offsetPos);

                    if (state.getBlock().isAir(state, worldIn, offsetPos) || state.getBlock().isLeaves(state, worldIn, offsetPos) || state.getMaterial() == Material.VINE) {
                        this.setBlockAndNotifyAdequately(worldIn, position.offset(orientation, j3), this.stateWood);
                    }
                }
                return true;
            } else {
                return false;
            }
        }
    } else {
        return false;
    }
}
 
源代码17 项目: Cyberware   文件: BlockSurgeryChamber.java
@Override
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn)
{
	EnumFacing face = state.getValue(FACING);
	boolean open = state.getValue(OPEN);
	
	if (state.getValue(HALF) == EnumChamberHalf.UPPER)
	{
		addCollisionBoxToList(pos, entityBox, collidingBoxes, top);
		if (!open || face != EnumFacing.SOUTH)
		{
			addCollisionBoxToList(pos, entityBox, collidingBoxes, south);
		}
		if (!open || face != EnumFacing.NORTH)
		{
			addCollisionBoxToList(pos, entityBox, collidingBoxes, north);
		}
		if (!open || face != EnumFacing.EAST)
		{
			addCollisionBoxToList(pos, entityBox, collidingBoxes, east);
		}
		if (!open || face != EnumFacing.WEST)
		{
			addCollisionBoxToList(pos, entityBox, collidingBoxes, west);
		}
	}
	else
	{		
		addCollisionBoxToList(pos, entityBox, collidingBoxes, bottom);
		if (!open || face != EnumFacing.SOUTH)
		{
			addCollisionBoxToList(pos, entityBox, collidingBoxes, south);
		}
		if (!open || face != EnumFacing.NORTH)
		{
			addCollisionBoxToList(pos, entityBox, collidingBoxes, north);
		}
		if (!open || face != EnumFacing.EAST)
		{
			addCollisionBoxToList(pos, entityBox, collidingBoxes, east);
		}
		if (!open || face != EnumFacing.WEST)
		{
			addCollisionBoxToList(pos, entityBox, collidingBoxes, west);
		}
	}
}
 
源代码18 项目: TFC2   文件: SmallVesselHighlightHandler.java
public static void drawFace(AxisAlignedBB aabb, float[] color, EnumFacing facing)
{
	//TODO: Add UV coords for other faces
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer buffer = tessellator.getBuffer();
	if(facing == EnumFacing.UP)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
		buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).tex(0, 1).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).tex(0, 0).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).tex(1, 0).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).tex(1, 1).color(color[0], color[1], color[2], color[3]).endVertex();

		tessellator.draw();
	}
	else if(facing == EnumFacing.DOWN)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
	else if(facing == EnumFacing.WEST)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
	else if(facing == EnumFacing.EAST)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
	else if(facing == EnumFacing.NORTH)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
	else if(facing == EnumFacing.SOUTH)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
}
 
源代码19 项目: seppuku   文件: ObsidianReplaceModule.java
private EnumFacing calculateFaceForPlacement(final BlockPos structurePosition,
                                             final BlockPos blockPosition) {
    final BiFunction<Integer, String, Integer> throwingClamp = (number, axis) -> {
        if (number < -1 || number > 1)
            throw new IllegalArgumentException(
                    String.format("Difference in %s is illegal, " +
                            "positions are too far apart.", axis));

        return number;
    };

    final int diffX = throwingClamp.apply(
            structurePosition.getX() - blockPosition.getX(), "x-axis");
    switch (diffX) {
        case 1:
            return EnumFacing.WEST;
        case -1:
            return EnumFacing.EAST;
        default:
            break;
    }

    final int diffY = throwingClamp.apply(
            structurePosition.getY() - blockPosition.getY(), "y-axis");
    switch (diffY) {
        case 1:
            return EnumFacing.DOWN;
        case -1:
            return EnumFacing.UP;
        default:
            break;
    }

    final int diffZ = throwingClamp.apply(
            structurePosition.getZ() - blockPosition.getZ(), "z-axis");
    switch (diffZ) {
        case 1:
            return EnumFacing.NORTH;
        case -1:
            return EnumFacing.SOUTH;
        default:
            break;
    }

    return null;
}
 
源代码20 项目: CommunityMod   文件: WorldGenFallenTree.java
public boolean generate(World worldIn, Random rand, BlockPos position) {
    int num = rand.nextInt(5);
    EnumFacing orientation;
    if (num == 0) {
        orientation = EnumFacing.EAST;
        stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X);
    } else if (num == 1) {
        orientation = EnumFacing.WEST;
        stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X);
    } else if (num == 1) {
        orientation = EnumFacing.SOUTH;
        stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z);
    } else {
        orientation = EnumFacing.NORTH;
        stateWood = stateWood.withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.Z);
    }
    int i = rand.nextInt(2) + this.minTreeLength;
    boolean flag = true;

    if (position.getY() >= 1 && position.getY() + i + 1 <= worldIn.getHeight()) {
        for (int j = position.getY(); j <= position.getY() + 1 + i; ++j) {
            int k = 1;

            if (j == position.getY()) {
                k = 0;
            }

            if (j >= position.getY() + 1 + i - 2) {
                k = 2;
            }

            BlockPos.MutableBlockPos mutablePos = new BlockPos.MutableBlockPos();

            for (int l = position.getX() - k; l <= position.getX() + k && flag; ++l) {
                for (int i1 = position.getZ() - k; i1 <= position.getZ() + k && flag; ++i1) {
                    if (j >= 0 && j < worldIn.getHeight()) {
                        if (!this.isReplaceable(worldIn, mutablePos.setPos(l, j, i1))) {
                            flag = false;
                        }
                    } else {
                        flag = false;
                    }
                }
            }
        }

        if (!flag) {
            return false;
        } else {
            IBlockState state = worldIn.getBlockState(position.down());

            if (state.getBlock().canSustainPlant(state, worldIn, position.down(), net.minecraft.util.EnumFacing.UP, (net.minecraft.block.BlockSapling) Blocks.SAPLING) && position.getY() < worldIn.getHeight() - i - 1) {
                state.getBlock().onPlantGrow(state, worldIn, position.down(), position);

                for (int j3 = 0; j3 < i; ++j3) {
                    BlockPos offsetPos = position.offset(orientation, j3);
                    state = worldIn.getBlockState(offsetPos);

                    if (state.getBlock().isAir(state, worldIn, offsetPos) || state.getBlock().isLeaves(state, worldIn, offsetPos) || state.getMaterial() == Material.VINE) {
                        this.setBlockAndNotifyAdequately(worldIn, position.offset(orientation, j3), this.stateWood);
                    }
                }
                return true;
            } else {
                return false;
            }
        }
    } else {
        return false;
    }
}