Posted August 28, 201411 yr I am trying to make a custom biome and i got my custom tree to spawn but not as frequent as i would like and i cant seem to figure out how to make it spawn more. I add my flowers with the addFlowers method in the constructor and only one spawns when i bonemeal the ground. I cant seem to find a away that works to make my flowers randmly spawn in the biome. Here is my class: /** * This class was created by <Professorvennie>. It's distributed as * part of the Machinery Craft Mod. Get the Source Code in github: * https://github.com/Professorvennie/MachineryCraft * * Machinery Craft is Open Source and distributed under a * Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License * (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB) * */ package com.professorvennie.core.world.biome; import com.professorvennie.core.block.ModBlocks; import com.professorvennie.core.lib.Names; import com.professorvennie.core.world.tree.WorldGenPlasticTree; import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.gen.feature.WorldGenAbstractTree; import java.util.Random; public class BiomePlastic extends BiomeGenBase { public BiomePlastic(int id) { super(id); setDisableRain(); for(int i = 0; i < Names.Blocks.BLOCK_PLASTIC_FLOWERS.length; i++){ addFlower(ModBlocks.plasticFlower, i, 20); } topBlock = ModBlocks.plasticGrass; fillerBlock = ModBlocks.plasticDirt; } @Override public int getBiomeGrassColor(int p_150558_1_, int p_150558_2_, int p_150558_3_) { return 0xFFFFFF; } @Override public int getModdedBiomeGrassColor(int original) { return 0xFFFFFF; } public WorldGenAbstractTree func_150567_a(Random random){ return random.nextInt(2) == 0 ? new WorldGenPlasticTree(false) : new WorldGenPlasticTree(false); } @Override public void decorate(World world, Random random, int chunkX, int chunkZ) { super.decorate(world, random, chunkX, chunkZ); int x = chunkX + random.nextInt(16); int y = random.nextInt(28) + 4; int z = chunkZ + random.nextInt(16); plantFlower(world, random, x, y, z); } }
August 28, 201411 yr What are the addFlower and plantFlower functions? Are they in BiomeGenBase? If so, just use WorldGenFlowers to generate your flowers. And maybe move your world gen code to a class that implements IWorldGenerator. Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
August 28, 201411 yr Author Yes addflowers and plant flowers are in biomegenbase. Add flowers I think adds them to a list and when you bone meal it picks flowers based on weight. Were would I use worldgenflowers?
August 28, 201411 yr Change y in your decorate method to world.getHeightValue(x, z) add the following to your decorate method: new WorldGenFlowers(ModBlocks.plasticFlower).generate(world, random, x, y, z); Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
August 28, 201411 yr Author Ok that works but I have one promblem. I have multiply flowers but just with fifferent metadata. So how would I make it spawn all the flowers just not the first flower with metadata 0?
August 28, 201411 yr Make your own WorldGenFlowers class that accepts metadata as a parameter. Here is one you can copy and paste: public class ModWorldGenFlowers extends WorldGenerator { private Block flower; private int meta; public ModWorldGenFlowers(Block flower, int metadata) { this.flower = flower; this.meta = metadata; } public boolean generate(World world, Random rand, int i, int j, int k) { for (int var6 = 0; var6 < 64; ++var6) { int var7 = i + rand.nextInt( - rand.nextInt(; int var8 = j + rand.nextInt(4) - rand.nextInt(4); int var9 = k + rand.nextInt( - rand.nextInt(; if (world.isAirBlock(var7, var8, var9) && (!world.provider.hasNoSky || var8 < 255) && this.flower.canBlockStay(world, var7, var8, var9)) { world.setBlock(var7, var8, var9, this.flower, this.meta, 2); } } return true; } } Check out my mod, Realms of Chaos, here. If I helped you, be sure to press the "Thank You" button!
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.