Jump to content

[1.7.2] Custom Tree Won't Generate in Custom Biome.


Eternaldoom

Recommended Posts

I have created a custom dimension with its own custom biome. I have made a new tree that I would like to generate in this biome, but cannot get it to generate. The WorldGenTree file definitely works, as the sapling that I have made grows the tree.

 

The Biome Code:

 

 

package com.doomturd.doomsmod;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.entity.monster.EntitySlime;

import net.minecraft.init.Blocks;

import net.minecraft.world.World;

import net.minecraft.world.biome.BiomeGenBase;

import net.minecraft.world.gen.feature.WorldGenerator;

import net.minecraft.world.gen.feature.WorldGenForest;

 

public class BiomeGenDoom extends BiomeGenBase

{

protected static final WorldGenDoomedTree WorldGenDoomedTree = new WorldGenDoomedTree(true);

 

public int treesPerChunk;

 

    public BiomeGenDoom(int par1)

    {

        super(par1);

        this.spawnableCreatureList.clear();

        this.topBlock = Blocks.grass;

        this.fillerBlock = DoomBlocks.blockDoomedDirt;

        this.theBiomeDecorator.treesPerChunk = 5;

        this.theBiomeDecorator.deadBushPerChunk = 2;

        this.theBiomeDecorator.reedsPerChunk = 50;

        this.theBiomeDecorator.cactiPerChunk = 10;

        this.spawnableCreatureList.clear();

        this.spawnableMonsterList.add(new BiomeGenBase.SpawnListEntry(EntityLobster.class, 5, 4, 4));

        this.waterColorMultiplier = 0xFFFF00;

        this.setBiomeName("Doomed Land");

    }

   

    public WorldGenModTrees getRandomWorldGenForTrees(Random par1Random)

    {

    return (WorldGenModTrees)(par1Random.nextInt(5) == 0 ? this.WorldGenDoomedTree : (par1Random.nextInt(10) == 0 ? this.WorldGenDoomedTree : WorldGenDoomedTree));

    }

   

   

    @Override

    public void genTerrainBlocks(World p_150573_1_, Random p_150573_2_, Block[] p_150573_3_, byte[] p_150573_4_, int p_150573_5_, int p_150573_6_, double p_150573_7_)

    {

        this.genDoomTerrain(p_150573_1_, p_150573_2_, p_150573_3_, p_150573_4_, p_150573_5_, p_150573_6_, p_150573_7_);

    }

   

    public final void genDoomTerrain(World p_150560_1_, Random p_150560_2_, Block[] p_150560_3_, byte[] p_150560_4_, int p_150560_5_, int p_150560_6_, double p_150560_7_)

    {

        boolean flag = true;

        Block block = this.topBlock;

        byte b0 = (byte)(this.field_150604_aj & 255);

        Block block1 = this.fillerBlock;

        int k = -1;

        int l = (int)(p_150560_7_ / 3.0D + 3.0D + p_150560_2_.nextDouble() * 0.25D);

        int i1 = p_150560_5_ & 15;

        int j1 = p_150560_6_ & 15;

        int k1 = p_150560_3_.length / 256;

 

        for (int l1 = 255; l1 >= 0; --l1)

        {

            int i2 = (j1 * 16 + i1) * k1 + l1;

 

            if (l1 <= 0 + p_150560_2_.nextInt(5))

            {

                p_150560_3_[i2] = Blocks.bedrock;

            }

            else

            {

                Block block2 = p_150560_3_[i2];

 

                if (block2 != null && block2.getMaterial() != Material.air)

                {

                    if (block2 == DoomBlocks.blockDoomedStone)

                    {

                        if (k == -1)

                        {

                            if (l <= 0)

                            {

                                block = null;

                                b0 = 0;

                                block1 = DoomBlocks.blockDoomedStone;

                            }

                            else if (l1 >= 59 && l1 <= 64)

                            {

                                block = this.topBlock;

                                b0 = (byte)(this.field_150604_aj & 255);

                                block1 = this.fillerBlock;

                            }

 

                            if (l1 < 63 && (block == null || block.getMaterial() == Material.air))

                            {

                                if (this.getFloatTemperature(p_150560_5_, l1, p_150560_6_) < 0.15F)

                                {

                                    block = Blocks.ice;

                                    b0 = 0;

                                }

                                else

                                {

                                    block = Blocks.water;

                                    b0 = 0;

                                }

                            }

 

                            k = l;

 

                            if (l1 >= 62)

                            {

                                p_150560_3_[i2] = block;

                                p_150560_4_[i2] = b0;

                            }

                            else if (l1 < 56 - l)

                            {

                                block = null;

                                block1 = DoomBlocks.blockDoomedStone;

                                p_150560_3_[i2] = Blocks.gravel;

                            }

                            else

                            {

                                p_150560_3_[i2] = block1;

                            }

                        }

                        else if (k > 0)

                        {

                            --k;

                            p_150560_3_[i2] = block1;

 

                            if (k == 0 && block1 == Blocks.sand)

                            {

                                k = p_150560_2_.nextInt(4) + Math.max(0, l1 - 63);

                                block1 = Blocks.sandstone;

                            }

                        }

                    }

                }

                else

                {

                    k = -1;

                }

            }

        }

    }

}

 

 

 

The WorldGeneratorTree Code:

 

 

package com.doomturd.doomsmod;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockSapling;

import net.minecraft.init.Blocks;

import net.minecraft.util.Direction;

import net.minecraft.world.World;

import net.minecraft.world.gen.feature.WorldGenAbstractTree;

import net.minecraftforge.common.util.ForgeDirection;

 

public class WorldGenDoomedTree extends WorldGenModTrees

{

    public WorldGenDoomedTree(boolean p_i45461_1_)

    {

        super(p_i45461_1_);

    }

 

    public boolean generate(World par1World, Random par2Random, int par3, int par4, int par5)

    {

        int l = par2Random.nextInt(3) + par2Random.nextInt(2) + 6;

        boolean flag = true;

 

        if (par4 >= 1 && par4 + l + 1 <= 256)

        {

            int j1;

            int k1;

 

            for (int i1 = par4; i1 <= par4 + 1 + l; ++i1)

            {

                byte b0 = 1;

 

                if (i1 == par4)

                {

                    b0 = 0;

                }

 

                if (i1 >= par4 + 1 + l - 2)

                {

                    b0 = 2;

                }

 

                for (j1 = par3 - b0; j1 <= par3 + b0 && flag; ++j1)

                {

                    for (k1 = par5 - b0; k1 <= par5 + b0 && flag; ++k1)

                    {

                        if (i1 >= 0 && i1 < 256)

                        {

                            Block block = par1World.getBlock(j1, i1, k1);

 

                            if (!this.isReplaceable(par1World, j1, i1, k1))

                            {

                                flag = false;

                            }

                        }

                        else

                        {

                            flag = false;

                        }

                    }

                }

            }

 

            if (!flag)

            {

                return false;

            }

            else

            {

                Block block2 = par1World.getBlock(par3, par4 - 1, par5);

 

                boolean isSoil = block2.canSustainPlant(par1World, par3, par4 - 1, par5, ForgeDirection.UP, (DoomedSapling)DoomBlocks.DoomedSapling);

                if (isSoil && par4 < 256 - l - 1)

                {

                    onPlantGrow(par1World, par3,    par4 - 1, par5,    par3, par4, par5);

                    onPlantGrow(par1World, par3 + 1, par4 - 1, par5,    par3, par4, par5);

                    onPlantGrow(par1World, par3 + 1, par4 - 1, par5 + 1, par3, par4, par5);

                    onPlantGrow(par1World, par3,    par4 - 1, par5 + 1, par3, par4, par5);

                    int j3 = par2Random.nextInt(4);

                    j1 = l - par2Random.nextInt(4);

                    k1 = 2 - par2Random.nextInt(3);

                    int k3 = par3;

                    int l1 = par5;

                    int i2 = 0;

                    int j2;

                    int k2;

 

                    for (j2 = 0; j2 < l; ++j2)

                    {

                        k2 = par4 + j2;

 

                        if (j2 >= j1 && k1 > 0)

                        {

                            k3 += Direction.offsetX[j3];

                            l1 += Direction.offsetZ[j3];

                            --k1;

                        }

 

                        Block block1 = par1World.getBlock(k3, k2, l1);

 

                        if (block1.isAir(par1World, k3, k2, l1) || block1.isLeaves(par1World, k3, k2, l1))

                        {

                            this.setBlockAndNotifyAdequately(par1World, k3, k2, l1, DoomBlocks.DoomedWood, 1);

                            this.setBlockAndNotifyAdequately(par1World, k3 + 1, k2, l1, DoomBlocks.DoomedWood, 1);

                            this.setBlockAndNotifyAdequately(par1World, k3, k2, l1 + 1, DoomBlocks.DoomedWood, 1);

                            this.setBlockAndNotifyAdequately(par1World, k3 + 1, k2, l1 + 1, DoomBlocks.DoomedWood, 1);

                            i2 = k2;

                        }

                    }

 

                    for (j2 = -2; j2 <= 0; ++j2)

                    {

                        for (k2 = -2; k2 <= 0; ++k2)

                        {

                            byte b2 = -1;

                            this.func_150526_a(par1World, k3 + j2, i2 + b2, l1 + k2);

                            this.func_150526_a(par1World, 1 + k3 - j2, i2 + b2, l1 + k2);

                            this.func_150526_a(par1World, k3 + j2, i2 + b2, 1 + l1 - k2);

                            this.func_150526_a(par1World, 1 + k3 - j2, i2 + b2, 1 + l1 - k2);

 

                            if ((j2 > -2 || k2 > -1) && (j2 != -1 || k2 != -2))

                            {

                                byte b1 = 1;

                                this.func_150526_a(par1World, k3 + j2, i2 + b1, l1 + k2);

                                this.func_150526_a(par1World, 1 + k3 - j2, i2 + b1, l1 + k2);

                                this.func_150526_a(par1World, k3 + j2, i2 + b1, 1 + l1 - k2);

                                this.func_150526_a(par1World, 1 + k3 - j2, i2 + b1, 1 + l1 - k2);

                            }

                        }

                    }

 

                    if (par2Random.nextBoolean())

                    {

                        this.func_150526_a(par1World, k3, i2 + 2, l1);

                        this.func_150526_a(par1World, k3 + 1, i2 + 2, l1);

                        this.func_150526_a(par1World, k3 + 1, i2 + 2, l1 + 1);

                        this.func_150526_a(par1World, k3, i2 + 2, l1 + 1);

                    }

 

                    for (j2 = -3; j2 <= 4; ++j2)

                    {

                        for (k2 = -3; k2 <= 4; ++k2)

                        {

                            if ((j2 != -3 || k2 != -3) && (j2 != -3 || k2 != 4) && (j2 != 4 || k2 != -3) && (j2 != 4 || k2 != 4) && (Math.abs(j2) < 3 || Math.abs(k2) < 3))

                            {

                                this.func_150526_a(par1World, k3 + j2, i2, l1 + k2);

                            }

                        }

                    }

 

                    for (j2 = -1; j2 <= 2; ++j2)

                    {

                        for (k2 = -1; k2 <= 2; ++k2)

                        {

                            if ((j2 < 0 || j2 > 1 || k2 < 0 || k2 > 1) && par2Random.nextInt(3) <= 0)

                            {

                                int l3 = par2Random.nextInt(3) + 2;

                                int l2;

 

                                for (l2 = 0; l2 < l3; ++l2)

                                {

                                    this.setBlockAndNotifyAdequately(par1World, par3 + j2, i2 - l2 - 1, par5 + k2, DoomBlocks.DoomedWood, 1);

                                }

 

                                int i3;

 

                                for (l2 = -1; l2 <= 1; ++l2)

                                {

                                    for (i3 = -1; i3 <= 1; ++i3)

                                    {

                                        this.func_150526_a(par1World, k3 + j2 + l2, i2 - 0, l1 + k2 + i3);

                                    }

                                }

 

                                for (l2 = -2; l2 <= 2; ++l2)

                                {

                                    for (i3 = -2; i3 <= 2; ++i3)

                                    {

                                        if (Math.abs(l2) != 2 || Math.abs(i3) != 2)

                                        {

                                            this.func_150526_a(par1World, k3 + j2 + l2, i2 - 1, l1 + k2 + i3);

                                        }

                                    }

                                }

                            }

                        }

                    }

 

                    return true;

                }

                else

                {

                    return false;

                }

            }

        }

        else

        {

            return false;

        }

    }

 

    private void func_150526_a(World p_150526_1_, int p_150526_2_, int p_150526_3_, int p_150526_4_)

    {

        Block block = p_150526_1_.getBlock(p_150526_2_, p_150526_3_, p_150526_4_);

 

        if (block.isAir(p_150526_1_, p_150526_2_, p_150526_3_, p_150526_4_))

        {

            this.setBlockAndNotifyAdequately(p_150526_1_, p_150526_2_, p_150526_3_, p_150526_4_, DoomBlocks.DoomedLeaves, 1);

        }

    }

 

    //Just a helper macro

    private void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ)

    {

        world.getBlock(x, y, z).onPlantGrow(world, x, y, z, sourceX, sourceY, sourceZ);

    }

}

 

 

 

Also, I cannot get the sapling to grow on my custom dirt. Is is based off of a class similar to BlockBush, but has the dirt value changed to my custom dirt. It seems that the EnumPlantType from the Forge plant API only allows it to be places on vanilla dirt. Is there a way to make a new EnumPlantType? If not, is there another way to allow my sapling to be placed on my custom dirt?

 

The Custom BlockBush class:

 

 

package com.doomturd.doomsmod;

 

import static net.minecraftforge.common.EnumPlantType.Cave;

import static net.minecraftforge.common.EnumPlantType.Crop;

import static net.minecraftforge.common.EnumPlantType.Desert;

import static net.minecraftforge.common.EnumPlantType.Nether;

import static net.minecraftforge.common.EnumPlantType.Plains;

import static net.minecraftforge.common.EnumPlantType.Water;

 

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.util.AxisAlignedBB;

import net.minecraft.world.IBlockAccess;

import net.minecraft.world.World;

import net.minecraftforge.common.EnumPlantType;

import net.minecraftforge.common.IPlantable;

import net.minecraftforge.common.util.ForgeDirection;

 

public class DoomBushBase extends Block implements IPlantable

{

    protected DoomBushBase(Material p_i45395_1_)

    {

        super(p_i45395_1_);

        this.setTickRandomly(true);

        float f = 0.2F;

        this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 3.0F, 0.5F + f);

    }

 

    protected DoomBushBase()

    {

        this(Material.plants);

    }

 

    /**

    * Checks to see if its valid to put this block at the specified coordinates. Args: world, x, y, z

    */

    public boolean canPlaceBlockAt(World p_149742_1_, int p_149742_2_, int p_149742_3_, int p_149742_4_)

    {

        return super.canPlaceBlockAt(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_) && this.canBlockStay(p_149742_1_, p_149742_2_, p_149742_3_, p_149742_4_);

    }

 

    /**

    * is the block grass, dirt or farmland

    */

    protected boolean canPlaceBlockOn(Block p_149854_1_)

    {

        return p_149854_1_ == DoomBlocks.blockDoomedGrass || p_149854_1_ == DoomBlocks.blockDoomedDirt;

    }

 

    /**

    * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are

    * their own) Args: x, y, z, neighbor Block

    */

    public void onNeighborBlockChange(World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)

    {

        super.onNeighborBlockChange(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_, p_149695_5_);

        this.checkAndDropBlock(p_149695_1_, p_149695_2_, p_149695_3_, p_149695_4_);

    }

 

    /**

    * Ticks the block if it's been scheduled

    */

    public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)

    {

        this.checkAndDropBlock(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);

    }

 

    /**

    * checks if the block can stay, if not drop as item

    */

    protected void checkAndDropBlock(World p_149855_1_, int p_149855_2_, int p_149855_3_, int p_149855_4_)

    {

        if (!this.canBlockStay(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_))

        {

            this.dropBlockAsItem(p_149855_1_, p_149855_2_, p_149855_3_, p_149855_4_, p_149855_1_.getBlockMetadata(p_149855_2_, p_149855_3_, p_149855_4_), 0);

            p_149855_1_.setBlock(p_149855_2_, p_149855_3_, p_149855_4_, getBlockById(0), 0, 2);

        }

    }

 

    /**

    * Can this block stay at this position.  Similar to canPlaceBlockAt except gets checked often with plants.

    */

    public boolean canBlockStay(World p_149718_1_, int p_149718_2_, int p_149718_3_, int p_149718_4_)

    {

        return  p_149718_1_.getBlock(p_149718_2_, p_149718_3_ - 1, p_149718_4_).canSustainPlant(p_149718_1_, p_149718_2_, p_149718_3_ - 1, p_149718_4_, ForgeDirection.UP, this);

    }

 

    /**

    * Returns a bounding box from the pool of bounding boxes (this means this box can change after the pool has been

    * cleared to be reused)

    */

    public AxisAlignedBB getCollisionBoundingBoxFromPool(World p_149668_1_, int p_149668_2_, int p_149668_3_, int p_149668_4_)

    {

        return null;

    }

 

    /**

    * Is this block (a) opaque and (b) a full 1m cube?  This determines whether or not to render the shared face of two

    * adjacent blocks and also whether the player can attach torches, redstone wire, etc to this block.

    */

    public boolean isOpaqueCube()

    {

        return false;

    }

 

    /**

    * If this block doesn't render as an ordinary block it will return False (examples: signs, buttons, stairs, etc)

    */

    public boolean renderAsNormalBlock()

    {

        return false;

    }

 

    /**

    * The type of render function that is called for this block

    */

    public int getRenderType()

    {

        return 1;

    }

 

    @Override

    public EnumPlantType getPlantType(IBlockAccess world, int x, int y, int z)

    {

 

        if (this == DoomBlocks.DoomedSapling)        return Plains;     

        return Plains;

    }

 

    @Override

    public Block getPlant(IBlockAccess world, int x, int y, int z)

    {

        return this;

    }

 

    @Override

    public int getPlantMetadata(IBlockAccess world, int x, int y, int z)

    {

        return world.getBlockMetadata(x, y, z);

    }

}

 

 

 

The Sapling class:

 

 

package com.doomturd.doomsmod;

 

import java.util.List;

import java.util.Random;

 

import net.minecraft.block.Block;

import net.minecraft.block.BlockBush;

import net.minecraft.block.IGrowable;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.creativetab.CreativeTabs;

import net.minecraft.init.Blocks;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

import net.minecraft.util.IIcon;

import net.minecraft.util.MathHelper;

import net.minecraft.world.World;

import net.minecraft.world.gen.feature.WorldGenBigTree;

import net.minecraft.world.gen.feature.WorldGenCanopyTree;

import net.minecraft.world.gen.feature.WorldGenForest;

import net.minecraft.world.gen.feature.WorldGenMegaJungle;

import net.minecraft.world.gen.feature.WorldGenMegaPineTree;

import net.minecraft.world.gen.feature.WorldGenSavannaTree;

import net.minecraft.world.gen.feature.WorldGenTaiga2;

import net.minecraft.world.gen.feature.WorldGenTrees;

import net.minecraft.world.gen.feature.WorldGenerator;

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

public class DoomedSapling extends DoomBushBase implements IGrowable

{

    public static final String[] field_149882_a = new String[] {"Doomed"};

    private static final IIcon[] field_149881_b = new IIcon[field_149882_a.length];

    protected DoomedSapling()

    {

        float f = 0.4F;

        this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);

        this.setCreativeTab(DoomTabs.tabDoomMaterials);

    }

 

    /**

    * Ticks the block if it's been scheduled

    */

    public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)

    {

        if (!p_149674_1_.isRemote)

        {

            super.updateTick(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);

 

            if (p_149674_1_.getBlockLightValue(p_149674_2_, p_149674_3_ + 1, p_149674_4_) >= 9 && p_149674_5_.nextInt(7) == 0)

            {

                this.func_149879_c(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_, p_149674_5_);

            }

        }

    }

 

    /**

    * Gets the block's texture. Args: side, meta

    */

    @SideOnly(Side.CLIENT)

    public IIcon getIcon(int p_149691_1_, int p_149691_2_)

    {

        p_149691_2_ &= 7;

        return field_149881_b[MathHelper.clamp_int(p_149691_2_, 0, 5)];

    }

 

    public void func_149879_c(World p_149879_1_, int p_149879_2_, int p_149879_3_, int p_149879_4_, Random p_149879_5_)

    {

        int l = p_149879_1_.getBlockMetadata(p_149879_2_, p_149879_3_, p_149879_4_);

 

        if ((l & 8) == 0)

        {

            p_149879_1_.setBlockMetadataWithNotify(p_149879_2_, p_149879_3_, p_149879_4_, l | 8, 4);

        }

        else

        {

            this.func_149878_d(p_149879_1_, p_149879_2_, p_149879_3_, p_149879_4_, p_149879_5_);

        }

    }

 

    public void func_149878_d(World p_149878_1_, int p_149878_2_, int p_149878_3_, int p_149878_4_, Random p_149878_5_)

    {

        if (!net.minecraftforge.event.terraingen.TerrainGen.saplingGrowTree(p_149878_1_, p_149878_5_, p_149878_2_, p_149878_3_, p_149878_4_)) return;

        int l = p_149878_1_.getBlockMetadata(p_149878_2_, p_149878_3_, p_149878_4_) & 7;

        Object object = p_149878_5_.nextInt(10) == 0 ? new WorldGenDoomedTree(true) : new WorldGenDoomedTree(true);

        int i1 = 0;

        int j1 = 0;

        boolean flag = false;

 

        switch (l)

        {

            case 0:

            default:

                break;

            case 1:

                label78:

 

                for (i1 = 0; i1 >= -1; --i1)

                {

                    for (j1 = 0; j1 >= -1; --j1)

                    {

                        if (this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1, 1) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1, 1) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1 + 1, 1) && this.func_149880_a(p_149878_1_, p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1 + 1, 1))

                        {

                            object = new WorldGenDoomedTree(false);

                            flag = true;

                            break label78;

                        }

                    }

                }

 

                if (!flag)

                {

                    return;

                }

        }

 

        Block block = Blocks.air;

 

        if (flag)

        {

            p_149878_1_.setBlock(p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1, block, 0, 4);

            p_149878_1_.setBlock(p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1, block, 0, 4);

            p_149878_1_.setBlock(p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1 + 1, block, 0, 4);

            p_149878_1_.setBlock(p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1 + 1, block, 0, 4);

        }

        else

        {

            p_149878_1_.setBlock(p_149878_2_, p_149878_3_, p_149878_4_, block, 0, 4);

        }

 

        if (!((WorldGenerator)object).generate(p_149878_1_, p_149878_5_, p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1))

        {

            if (flag)

            {

                p_149878_1_.setBlock(p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1, this, l, 4);

                p_149878_1_.setBlock(p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1, this, l, 4);

                p_149878_1_.setBlock(p_149878_2_ + i1, p_149878_3_, p_149878_4_ + j1 + 1, this, l, 4);

                p_149878_1_.setBlock(p_149878_2_ + i1 + 1, p_149878_3_, p_149878_4_ + j1 + 1, this, l, 4);

            }

            else

            {

                p_149878_1_.setBlock(p_149878_2_, p_149878_3_, p_149878_4_, this, l, 4);

            }

        }

    }

 

    public boolean func_149880_a(World p_149880_1_, int p_149880_2_, int p_149880_3_, int p_149880_4_, int p_149880_5_)

    {

        return p_149880_1_.getBlock(p_149880_2_, p_149880_3_, p_149880_4_) == this && (p_149880_1_.getBlockMetadata(p_149880_2_, p_149880_3_, p_149880_4_) & 7) == p_149880_5_;

    }

 

    /**

    * Determines the damage on the item the block drops. Used in cloth and wood.

    */

    public int damageDropped(int p_149692_1_)

    {

        return MathHelper.clamp_int(p_149692_1_ & 7, 0, 5);

    }

 

    /**

    * returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)

    */

    @SideOnly(Side.CLIENT)

    public void registerBlockIcons(IIconRegister p_149651_1_)

    {

        for (int i = 0; i < field_149881_b.length; ++i)

        {

            field_149881_b = p_149651_1_.registerIcon(this.getTextureName() + "_" + field_149882_a);

        }

    }

 

    public boolean func_149851_a(World p_149851_1_, int p_149851_2_, int p_149851_3_, int p_149851_4_, boolean p_149851_5_)

    {

        return true;

    }

 

    public boolean func_149852_a(World p_149852_1_, Random p_149852_2_, int p_149852_3_, int p_149852_4_, int p_149852_5_)

    {

        return (double)p_149852_1_.rand.nextFloat() < 0.45D;

    }

 

    public void func_149853_b(World p_149853_1_, Random p_149853_2_, int p_149853_3_, int p_149853_4_, int p_149853_5_)

    {

        this.func_149879_c(p_149853_1_, p_149853_3_, p_149853_4_, p_149853_5_, p_149853_2_);

    }

}

 

 

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

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.