Jump to content

Recommended Posts

Posted

So I'm still trying to simplify this code within my spreading block:

 

 

   if (world.getBlock(x + 1, y, z) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x + 1, y, z, Blocks.glass);
                    }
                    if (world.getBlock(x - 1, y, z) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x - 1, y, z, Blocks.glass);
                    }
                    
                    if (world.getBlock(x + 1, y, z + 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x + 1, y, z + 1, Blocks.glass);
                    }      
                    
                    if (world.getBlock(x - 1, y, z - 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x - 1, y, z - 1, Blocks.glass);
                    }   
                    
                    if (world.getBlock(x + 1, y, z - 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x + 1, y, z - 1, Blocks.glass);
                    }
                    
                    if (world.getBlock(x - 1, y, z + 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x - 1, y, z + 1, Blocks.glass);
                    }     
                    
                    if (world.getBlock(x, y, z + 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x, y, z + 1, Blocks.glass);
                    }
                    if (world.getBlock(x, y, z - 1) == Blocks.grass && world.getBlockLightValue(x, y + 1, z) >= 4 && world.getBlockLightOpacity(z, y + 1, z) <= 2)
                    {
                        world.setBlock(x, y, z - 1, Blocks.glass);
                    }

 

And this code is within this after this code in the updateTick method with old vanilla grass spread commented out:

 

 

public void updateTick(World world, int x, int y, int z, Random random)
    {
        if (!world.isRemote)
        {
            if (world.getBlockLightValue(x, y + 1, z) >= 9)
            {
                for (int l = 0; l < 97; ++l)
                {
                    /*int i1 = x + random.nextInt(3) - 1;
                    int j1 = y + random.nextInt(5) - 3;
                    int k1 = z + random.nextInt(3) - 1;
                    Block block = world.getBlock(i1, j1 + 1, k1);*/

 

I would appreciate any help given

Member of Aerotech Networks, a Multi-Gaming server.

Also Currently porting the "Rise of the Automatons" minecraft mod

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.