Jump to content

[1.7.10]Update from 1.6.4: Block.blocksList[block];


SantacreeperLP

Recommended Posts

Ummm I'd help but don't know what you're trying to do. It looks like you're trying to make two block variables based on a block at x, y, z. However var6 whatever you're trying to do there, would probably end up being the same as var5, if you explain it a bit I might be able to help.

Link to comment
Share on other sites

Yea, i tried to set var6 == var5, but it doesnt seems to work ^^ Heres my whole class:


import java.util.Random;

import codechicken.lib.vec.Vector3;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenerator;
import de.xthelegend.projectredextended.lib.xawpnqf;
import de.xthelegend.projectredextended.lib.nawapsk;

public class WorldGenRubberTree extends WorldGenerator
{
    public void putLeaves(World var1, int x, int y, int z)
    {
        Block var5 = var1.getBlock(x, y, z);
        var1.setBlock(x, y, z, MainClass.BlockRubberLeaves);  
    }

    
    public boolean fillBlock(World var1, int x, int y, int z)
    {
        if (y >= 0 && y <= 126)
        {

            Block var5 = var1.getBlock(x, y, z);
            Block var6 = var5;

            if (var6 != null && var6.isWood(var1, x, y, z))
            {
                return true;
            }
            else if (var6 != null && !var6.isLeaves(var1, x, y, z) && var5 != Blocks.tallgrass && var5 != Blocks.grass && var5 != Blocks.vine)
            {
                return false;
            }
            else
            {
                var1.setBlock(x, y, z, MainClass.BlockRubberWood);
                this.putLeaves(var1, x, y - 1, z);
                this.putLeaves(var1, x, y + 1, z);
                this.putLeaves(var1, x, y, z - 1);
                this.putLeaves(var1, x, y, z + 1);
                this.putLeaves(var1, x - 1, y, z);
                this.putLeaves(var1, x + 1, y, z);
                return true;
            }
        }
        else
        {
            return false;
        }
    }

    @Override
    public boolean generate(World var1, Random x, int y, int z, int var5)
    {
        int var9 = x.nextInt(6) + 25;

        if (z >= 1 && z + var9 + 2 <= var1.getHeight())
        {
            Block var6;
            int var7;
            int var8;

            for (var7 = -1; var7 <= 1; ++var7)
            {
                for (var8 = -1; var8 <= 1; ++var8)
                {
                    var6 = var1.getBlock(y + var7, z - 1, var5 + var8);

                    if (var6 != Blocks.grass && var6 != Blocks.dirt)
                    {
                        return false;
                    }
                }
            }

            byte var10 = 1;
            int var11;

            for (var11 = z; var11 < z + var9; ++var11)
            {
                if (var11 > z + 3)
                {
                    var10 = 5;
                }

                for (var7 = y - var10; var7 <= y + var10; ++var7)
                {
                    for (var8 = var5 - var10; var8 <= var5 + var10; ++var8)
                    {
                        var6 = var1.getBlock(var7, var11, var8);
                        Block var12 = var6; /*Block.blocksList[var6];*/

                        if (var12 != null && !var12.isLeaves(var1, var7, var11, var8) && !var12.isWood(var1, var7, var11, var8) && var6 != Blocks.tallgrass && var6 != Blocks.grass && var6 != Blocks.vine)
                        {
                            return false;
                        }
                    }
                }
            }

            for (var7 = -1; var7 <= 1; ++var7)
            {
                for (var8 = -1; var8 <= 1; ++var8)
                {
                    var1.setBlock(y + var7, z - 1, var5 + var8, Blocks.dirt);
                }
            }

            for (var11 = 0; var11 <= 6; ++var11)
            {
                for (var7 = -1; var7 <= 1; ++var7)
                {
                    for (var8 = -1; var8 <= 1; ++var8)
                    {
                        var1.setBlock(y + var7, z + var11, var5 + var8, MainClass.BlockRubberWood);
                    }
                }

                for (var7 = -1; var7 <= 1; ++var7)
                {
                    if (x.nextInt(5) == 1 && var1.getBlock(y + var7, z + var11, var5 - 2) == Blocks.air)
                    {
                    	var1.setBlock(y + var7, z + var11, var5 - 2, Blocks.vine);
                        var1.setBlockMetadataWithNotify(y + var7, z + var11, var5 - 2,  1, 0);
                    }

                    if (x.nextInt(5) == 1 && var1.getBlock(y + var7, z + var11, var5 + 2) == Blocks.air)
                    {
                    	var1.setBlock(y + var7, z + var11, var5 + 2, Blocks.vine);
                        var1.setBlockMetadataWithNotify(y + var7, z + var11, var5 + 2,  4, 0);
                    }
                }

                for (var8 = -1; var8 <= 1; ++var8)
                {
                    if (x.nextInt(5) == 1 && var1.getBlock(y - 2, z + var11, var5 + var8) == Blocks.air)
                    {
                    	var1.setBlock(y - 2, z + var11, var5 + var8, Blocks.vine);
                        var1.setBlockMetadataWithNotify(y - 2, z + var11, var5 + var8,  8, 0);
                    }

                    if (x.nextInt(5) == 1 && var1.getBlock(y + 2, z + var11, var5 + var8) == Blocks.air)
                    {
                    	var1.setBlock(y + 2, z + var11, var5 + var8, Blocks.vine);
                        var1.setBlockMetadataWithNotify(y + 2, z + var11, var5 + var8,  2, 0);
                    }
                }
            }

            Vector3 x3 = new Vector3();
            Vector3 x4 = new Vector3();
            int var14 = x.nextInt(100) + 10;
            int var17 = 0;

            while (var17 < var14)
            {
                x4.set((double)x.nextFloat() - 0.5D, (double)x.nextFloat(), (double)x.nextFloat() - 0.5D);
                x4.normalize();
                double var18 = ((double)var14 / 10.0D + 4.0D) * (double)(1.0F + 1.0F * x.nextFloat());
                x4.x *= var18;
                x4.z *= var18;
                x4.y = x4.y * (double)(var9 - 15) + (double)var14 / 10.0D;

                if (var14 < 
                {
                    switch (var14)
                    {
                        case 0:
                            x3.set((double)(y - 1), (double)(z + 6), (double)(var5 - 1));
                            break;

                        case 1:
                            x3.set((double)(y - 1), (double)(z + 6), (double)var5);
                            break;

                        case 2:
                            x3.set((double)(y - 1), (double)(z + 6), (double)(var5 + 1));
                            break;

                        case 3:
                            x3.set((double)y, (double)(z + 6), (double)(var5 + 1));
                            break;

                        case 4:
                            x3.set((double)(y + 1), (double)(z + 6), (double)(var5 + 1));
                            break;

                        case 5:
                            x3.set((double)(y + 1), (double)(z + 6), (double)var5);
                            break;

                        case 6:
                            x3.set((double)(y + 1), (double)(z + 6), (double)(var5 - 1));
                            break;

                        default:
                            x3.set((double)y, (double)(z + 6), (double)(var5 - 1));
                    }
                }
                else
                {
                    x3.set((double)(y + x.nextInt(3) - 1), (double)(z + 6), (double)(var5 + x.nextInt(3) - 1));
                }

                long x0 = x.nextLong();
                nawapsk var13 = new nawapsk(x3, x4, x0);

                while (true)
                {
                    if (var13.iterate())
                    {
                        Vector3 x2 = var13.get();

                        if (this.fillBlock(var1, (int)Math.floor(x2.x), (int)Math.floor(x2.y), (int)Math.floor(x2.z)))
                        {
                            continue;
                        }
                    }

                    ++var17;
                    break;
                }
            }

            return true;
        }
        else
        {
            return false;
        }
    }
}

Link to comment
Share on other sites

You get the Block using

world.getBlock()

. You can remove the

Blocks.blocksList

because it doesn't exist anymore and isn't needed.

 

And please, rename your variables properly, it will be much easier to understand the code and what it does.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

I decompiled my old 1.6 mod because I lost the source ^^ :D

And what do you want to tell us with that?

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

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.