Java Code Examples for net.minecraft.block.BlockLog#EnumAxis

The following examples show how to use net.minecraft.block.BlockLog#EnumAxis . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorldGenBigSakura.java    From Sakura_mod with MIT License 6 votes vote down vote up
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;
}
 
Example 2
Source File: WorldGenBigMaple.java    From Sakura_mod with MIT License 6 votes vote down vote up
void limb(BlockPos p_175937_1_, BlockPos p_175937_2_, Block p_175937_3_)
{
    BlockPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ());
    int i = this.getGreatestDistance(blockpos);
    float f = (float)blockpos.getX() / (float)i;
    float f1 = (float)blockpos.getY() / (float)i;
    float f2 = (float)blockpos.getZ() / (float)i;

    for (int j = 0; j <= i; ++j)
    {
        BlockPos blockpos1 = p_175937_1_.add(0.5F + j * f, 0.5F + j * f1, 0.5F + j * f2);
        BlockLog.EnumAxis blocklog$enumaxis = this.getLogAxis(p_175937_1_, blockpos1);
        this.setBlockAndNotifyAdequately(this.world, blockpos1, p_175937_3_.getDefaultState().withProperty(BlockLog.LOG_AXIS, blocklog$enumaxis));
        if (this.generateSap && j == 1) {
            if (this.world.getBlockState(blockpos1.add(0, j, 0))==this.metaWood) {
                this.addSapLog(this.world, blockpos1.add(0, j, 0));
            }

        }
    }
}
 
Example 3
Source File: WorldGenBigMaple.java    From Sakura_mod with MIT License 6 votes vote down vote up
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;
}
 
Example 4
Source File: BlockAlienWood.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public int getMetaFromState(IBlockState state)
{
	int i = 0;
	switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS))
	{
	case X:
		i |= 4;
		break;
	case Z:
		i |= 8;
		break;
	case NONE:
		i |= 12;
	}

	return i;
}
 
Example 5
Source File: BlockCharcoalLog.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
public int getMetaFromState(IBlockState state)
{
	int i = 0;
	switch ((BlockLog.EnumAxis)state.getValue(LOG_AXIS))
	{
	case X:
		i |= 4;
		break;
	case Z:
		i |= 8;
		break;
	case NONE:
		i |= 12;
	}

	return i;
}
 
Example 6
Source File: WorldGenBigSakura.java    From Sakura_mod with MIT License 5 votes vote down vote up
void limb(BlockPos p_175937_1_, BlockPos p_175937_2_, Block p_175937_3_)
{
    BlockPos blockpos = p_175937_2_.add(-p_175937_1_.getX(), -p_175937_1_.getY(), -p_175937_1_.getZ());
    int i = this.getGreatestDistance(blockpos);
    float f = (float)blockpos.getX() / (float)i;
    float f1 = (float)blockpos.getY() / (float)i;
    float f2 = (float)blockpos.getZ() / (float)i;

    for (int j = 0; j <= i; ++j)
    {
        BlockPos blockpos1 = p_175937_1_.add(0.5F + j * f, 0.5F + j * f1, 0.5F + j * f2);
        BlockLog.EnumAxis blocklog$enumaxis = this.getLogAxis(p_175937_1_, blockpos1);
        this.setBlockAndNotifyAdequately(this.world, blockpos1, p_175937_3_.getDefaultState().withProperty(BlockLog.LOG_AXIS, blocklog$enumaxis));
    }
}