Readded the Mangrove, readded mangrove saplings, fixed hellbark saplings and began adding null checks in preparation for disablable biome ids

This commit is contained in:
Adubbz 2014-06-01 15:13:58 +10:00
parent 5a4b6d05a6
commit 2063757408
12 changed files with 374 additions and 97 deletions

View file

@ -52,7 +52,6 @@ public class BOPCBiomes
public static BiomeGenBase shrubland; public static BiomeGenBase shrubland;
public static BiomeGenBase silkglades; public static BiomeGenBase silkglades;
public static BiomeGenBase sludgepit; public static BiomeGenBase sludgepit;
public static BiomeGenBase spruceWoods;
public static BiomeGenBase steppe; public static BiomeGenBase steppe;
public static BiomeGenBase temperateRainforest; public static BiomeGenBase temperateRainforest;
public static BiomeGenBase thicket; public static BiomeGenBase thicket;
@ -63,15 +62,17 @@ public class BOPCBiomes
public static BiomeGenBase woodland; public static BiomeGenBase woodland;
//Sub Biomes //Sub Biomes
public static BiomeGenBase glacier;
public static BiomeGenBase scrubland;
public static BiomeGenBase oasis;
public static BiomeGenBase quagmire;
public static BiomeGenBase tropics;
public static BiomeGenBase volcano;
public static BiomeGenBase meadowForest;
public static BiomeGenBase alpsForest; public static BiomeGenBase alpsForest;
public static BiomeGenBase canyonRavine; public static BiomeGenBase canyonRavine;
public static BiomeGenBase glacier;
public static BiomeGenBase mangrove;
public static BiomeGenBase meadowForest;
public static BiomeGenBase oasis;
public static BiomeGenBase quagmire;
public static BiomeGenBase scrubland;
public static BiomeGenBase spruceWoods;
public static BiomeGenBase tropics;
public static BiomeGenBase volcano;
//Ocean Biomes //Ocean Biomes
public static BiomeGenBase coralReef; public static BiomeGenBase coralReef;

View file

@ -1,5 +1,17 @@
package biomesoplenty.api.utils; package biomesoplenty.api.utils;
import net.minecraft.world.biome.BiomeGenBase;
import biomesoplenty.common.biomes.BOPBiome;
public class BiomeUtils public class BiomeUtils
{ {
public static boolean areBiomesEqual(BiomeGenBase biome1, BiomeGenBase biome2)
{
if (biome1 != null && biome2 != null)
{
return biome1.biomeID == biome2.biomeID;
}
return false;
}
} }

View file

@ -0,0 +1,74 @@
package biomesoplenty.common.biomes.overworld.sub;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.common.biomes.BOPSubBiome;
import biomesoplenty.common.world.features.WorldGenBOPTallGrass;
import biomesoplenty.common.world.features.trees.WorldGenBOPShrub;
import biomesoplenty.common.world.features.trees.WorldGenMangrove;
public class BiomeGenMangrove extends BOPSubBiome
{
private static final Height biomeHeight = new Height(0.1F, 0.3F);
public BiomeGenMangrove(int biomeID)
{
super(biomeID);
this.zoom = 0.01D;
this.threshold = 0.8D;
this.setHeight(biomeHeight);
this.setColor(7251289);
this.setTemperatureRainfall(0.8F, 0.9F);
this.spawnableCreatureList.clear();
this.topBlock = Blocks.sand;
this.fillerBlock = Blocks.sand;
this.theBiomeDecorator.treesPerChunk = 6;
this.theBiomeDecorator.deadBushPerChunk = 1;
this.theBiomeDecorator.reedsPerChunk = -999;
this.theBiomeDecorator.cactiPerChunk = -999;
this.bopWorldFeatures.setFeature("waterReedsPerChunk", 2);
this.bopWorldFeatures.setFeature("desertSproutsPerChunk", 1);
this.bopWorldFeatures.setFeature("waterLakesPerChunk", 10);
this.bopWorldFeatures.setFeature("bopGrassPerChunk", 9);
this.bopWorldFeatures.weightedGrassGen.put(new WorldGenBOPTallGrass(BOPBlockHelper.get("plants"), 0), 1D);
}
@Override
//TODO: getRandomWorldGenForTrees()
public WorldGenAbstractTree func_150567_a(Random random)
{
return random.nextInt(3) == 0 ? new WorldGenBOPShrub(BOPBlockHelper.get("logs2"), BOPBlockHelper.get("colorizedLeaves1"), 2, 1, Blocks.sand) : new WorldGenMangrove();
}
@Override
public void decorate(World world, Random random, int chunkX, int chunkZ)
{
super.decorate(world, random, chunkX, chunkZ);
int var5 = 12 + random.nextInt(6);
for (int var6 = 0; var6 < var5; ++var6)
{
int x = chunkX + random.nextInt(16);
int y = random.nextInt(28) + 4;
int z = chunkZ + random.nextInt(16);
Block block = world.getBlock(x, y, z);
if (block != null && block.isReplaceableOreGen(world, x, y, z, Blocks.stone))
{
world.setBlock(x, y, z, BOPBlockHelper.get("gemOre"), 12, 2);
}
}
}
}

View file

@ -18,6 +18,7 @@ import net.minecraftforge.common.util.ForgeDirection;
import biomesoplenty.BiomesOPlenty; import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree; import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree;
import biomesoplenty.common.world.features.trees.WorldGenMangrove;
import biomesoplenty.common.world.features.trees.WorldGenPalmTree1; import biomesoplenty.common.world.features.trees.WorldGenPalmTree1;
import biomesoplenty.common.world.features.trees.WorldGenPineTree; import biomesoplenty.common.world.features.trees.WorldGenPineTree;
import biomesoplenty.common.world.features.trees.WorldGenRainforestTree1; import biomesoplenty.common.world.features.trees.WorldGenRainforestTree1;
@ -32,18 +33,65 @@ public class BlockBOPColorizedSapling extends BlockSapling
public BlockBOPColorizedSapling() public BlockBOPColorizedSapling()
{ {
//TODO: this.setHardness
this.setHardness(0.0F); this.setHardness(0.0F);
//TODO setStepSound(Block.soundGrassFootstep)
this.setStepSound(Block.soundTypeGrass); this.setStepSound(Block.soundTypeGrass);
//TODO: this.setCreativeTab()
this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty); this.setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
} }
@Override @Override
//TODO: registerIcons() public void updateTick(World world, int x, int y, int z, Random random)
{
super.updateTick(world, x, y, z, random);
this.checkAndDropBlock(world, x, y, z);
}
@Override
public void onNeighborBlockChange(World world, int x, int y, int z, Block block)
{
this.checkAndDropBlock(world, x, y, z);
super.onNeighborBlockChange(world, x, y, z, block);
}
@Override
public boolean canReplace(World world, int x, int y, int z, int side, ItemStack itemStack)
{
return this.canBlockStay(world, x, y, z, itemStack.getItemDamage());
}
@Override
@Deprecated
public boolean canBlockStay(World world, int x, int y, int z)
{
return super.canBlockStay(world, x, y, z);
}
public boolean canBlockStay(World world, int x, int y, int z, int metadata)
{
Block block = world.getBlock(x, y - 1, z);
switch (metadata)
{
case 1: // Mangrove
return block == Blocks.sand;
default:
return block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland || block.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this);
}
}
protected void checkAndDropBlock(World world, int x, int y, int z)
{
if (!this.canBlockStay(world, x, y, z, world.getBlockMetadata(x, y, z)))
{
this.dropBlockAsItem(world, x, y, z, world.getBlockMetadata(x, y, z), 0);
world.setBlockToAir(x, y, z);
}
}
@Override
public void registerBlockIcons(IIconRegister iconRegister) public void registerBlockIcons(IIconRegister iconRegister)
{ {
textures = new IIcon[saplings.length]; textures = new IIcon[saplings.length];
@ -55,7 +103,6 @@ public class BlockBOPColorizedSapling extends BlockSapling
} }
@Override @Override
//TODO: getIcon()
public IIcon getIcon(int side, int meta) public IIcon getIcon(int side, int meta)
{ {
if (meta < 0 || meta >= saplings.length) if (meta < 0 || meta >= saplings.length)
@ -67,7 +114,6 @@ public class BlockBOPColorizedSapling extends BlockSapling
} }
@Override @Override
//TODO: getSubBlocks()
public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list) public void getSubBlocks(Item block, CreativeTabs creativeTabs, List list)
{ {
for (int i = 0; i < saplings.length; ++i) { for (int i = 0; i < saplings.length; ++i) {
@ -76,16 +122,15 @@ public class BlockBOPColorizedSapling extends BlockSapling
} }
@Override @Override
//TODO: canPlaceBlockOnSide
public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side) public boolean canPlaceBlockOnSide(World world, int x, int y, int z, int side)
{ {
//TODO: getBlock()
Block block = world.getBlock(x, y - 1, z); Block block = world.getBlock(x, y - 1, z);
int meta = world.getBlockMetadata(x, y - 1, z); int meta = world.getBlockMetadata(x, y - 1, z);
switch (meta) switch (meta)
{ {
case 1: // Mangrove case 1: // Mangrove
System.out.println("H");
return block == Blocks.sand; return block == Blocks.sand;
default: default:
@ -93,35 +138,6 @@ public class BlockBOPColorizedSapling extends BlockSapling
} }
} }
@Override
//TODO: canBlockStay()
public boolean canBlockStay(World world, int x, int y, int z)
{
//TODO: getBlock()
Block soil = world.getBlock(x, y - 1, z);
if (world.getBlockMetadata(x, y, z) != 1)
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) &&
(soil != null && soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this));
else
return (world.getFullBlockLightValue(x, y, z) >= 8 || world.canBlockSeeTheSky(x, y, z)) &&
(soil != null && (soil.canSustainPlant(world, x, y - 1, z, ForgeDirection.UP, this) || soil == Blocks.sand));
}
@Override
//TODO: updateTick()
public void updateTick(World world, int x, int y, int z, Random random)
{
if (!world.isRemote)
{
if (world.getBlockLightValue(x, y + 1, z) >= 9 && random.nextInt(7) == 0)
{
//TODO: growTree()
this.func_149878_d(world, x, y, z, random);
}
}
}
@Override @Override
//TODO: growTree() //TODO: growTree()
public void func_149878_d(World world, int x, int y, int z, Random random) public void func_149878_d(World world, int x, int y, int z, Random random)
@ -138,9 +154,9 @@ public class BlockBOPColorizedSapling extends BlockSapling
obj = new WorldGenSacredOak(false); obj = new WorldGenSacredOak(false);
break; break;
/*case 1: // Mangrove Tree case 1: // Mangrove Tree
obj = new WorldGenMangrove(false); obj = new WorldGenMangrove();
break;*/ break;
case 2: // Palm Tree case 2: // Palm Tree
rnd = random.nextInt(4); rnd = random.nextInt(4);
@ -170,28 +186,18 @@ public class BlockBOPColorizedSapling extends BlockSapling
if (obj != null) if (obj != null)
{ {
//TODO: setBlockToAir()
world.setBlockToAir(x, y, z); world.setBlockToAir(x, y, z);
if (!((WorldGenerator)obj).generate(world, random, x, y, z)) if (!((WorldGenerator)obj).generate(world, random, x, y, z))
{ {
//TODO: setBlock()
world.setBlock(x, y, z, this, meta, 2); world.setBlock(x, y, z, this, meta, 2);
} }
} }
} }
@Override @Override
//TODO damageDropped()
public int damageDropped(int meta) public int damageDropped(int meta)
{ {
return meta & TYPES; return meta;
}
@Override
//TODO: getDamageValue()
public int getDamageValue(World world, int x, int y, int z)
{
return world.getBlockMetadata(x, y, z) & TYPES;
} }
} }

View file

@ -1,5 +1,7 @@
package biomesoplenty.common.blocks; package biomesoplenty.common.blocks;
import static biomesoplenty.api.utils.BiomeUtils.areBiomesEqual;
import java.util.Random; import java.util.Random;
import net.minecraft.block.Block; import net.minecraft.block.Block;
@ -14,6 +16,7 @@ import net.minecraft.world.biome.BiomeGenBase;
import biomesoplenty.BiomesOPlenty; import biomesoplenty.BiomesOPlenty;
import biomesoplenty.api.BOPItemHelper; import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.api.content.BOPCBiomes; import biomesoplenty.api.content.BOPCBiomes;
import biomesoplenty.api.utils.BiomeUtils;
public class BlockBOPGeneric extends Block public class BlockBOPGeneric extends Block
{ {
@ -161,7 +164,11 @@ public class BlockBOPGeneric extends Block
{ {
if (biome != null) if (biome != null)
{ {
if (biome != BOPCBiomes.boneyard && biome != BOPCBiomes.visceralHeap && biome != BOPCBiomes.undergarden && biome != BOPCBiomes.corruptedSands && biome != BOPCBiomes.phantasmagoricInferno && biome != BOPCBiomes.lushRiver && biome != BOPCBiomes.dryRiver && biome != BiomeGenBase.beach && biome != BiomeGenBase.coldBeach && biome != BiomeGenBase.stoneBeach && biome != BiomeGenBase.frozenOcean && biome != BiomeGenBase.frozenRiver && biome != BiomeGenBase.hell && biome != BiomeGenBase.river && biome != BiomeGenBase.sky && biome != BiomeGenBase.ocean && biome != BiomeGenBase.deepOcean) if (!areBiomesEqual(biome, BOPCBiomes.boneyard) && !areBiomesEqual(biome, BOPCBiomes.visceralHeap) && !areBiomesEqual(biome, BOPCBiomes.undergarden) &&
!areBiomesEqual(biome, BOPCBiomes.corruptedSands) && !areBiomesEqual(biome, BOPCBiomes.phantasmagoricInferno) && !areBiomesEqual(biome, BOPCBiomes.lushRiver) && !areBiomesEqual(biome, BOPCBiomes.dryRiver) &&
!areBiomesEqual(biome, BiomeGenBase.beach) && !areBiomesEqual(biome, BiomeGenBase.coldBeach) && !areBiomesEqual(biome, BiomeGenBase.stoneBeach) && !areBiomesEqual(biome, BiomeGenBase.frozenOcean) &&
!areBiomesEqual(biome, BiomeGenBase.frozenRiver) && !areBiomesEqual(biome, BiomeGenBase.hell) && !areBiomesEqual(biome, BiomeGenBase.river) && !areBiomesEqual(biome, BiomeGenBase.sky) &&
!areBiomesEqual(biome, BiomeGenBase.ocean) && !areBiomesEqual(biome, BiomeGenBase.deepOcean))
{ {
ItemStack biomeEssence = new ItemStack(BOPItemHelper.get("biomeEssence")); ItemStack biomeEssence = new ItemStack(BOPItemHelper.get("biomeEssence"));

View file

@ -20,6 +20,7 @@ import biomesoplenty.common.world.features.trees.WorldGenBOPBigTree;
import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree; import biomesoplenty.common.world.features.trees.WorldGenBOPSwampTree;
import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2; import biomesoplenty.common.world.features.trees.WorldGenBOPTaiga2;
import biomesoplenty.common.world.features.trees.WorldGenBulbTree; import biomesoplenty.common.world.features.trees.WorldGenBulbTree;
import biomesoplenty.common.world.features.trees.WorldGenMiniShrub;
import biomesoplenty.common.world.features.trees.WorldGenOriginalTree; import biomesoplenty.common.world.features.trees.WorldGenOriginalTree;
public class BlockBOPSapling extends BlockSapling public class BlockBOPSapling extends BlockSapling
@ -197,9 +198,9 @@ public class BlockBOPSapling extends BlockSapling
obj = new WorldGenBOPBigTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves3"), 1, 3); obj = new WorldGenBOPBigTree(BOPBlockHelper.get("logs1"), BOPBlockHelper.get("leaves3"), 1, 3);
break; break;
/*case 13: // Hellbark case 13: // Hellbark
obj = new WorldGenNetherBush(); obj = new WorldGenMiniShrub(BOPBlockHelper.get("logs4"), BOPBlockHelper.get("leaves4"), 1, 0, BOPBlockHelper.get("overgrownNetherrack"));
break;*/ break;
case 14: // Jacaranda case 14: // Jacaranda
obj = new WorldGenOriginalTree(BOPBlockHelper.get("logs4"), BOPBlockHelper.get("leaves4"), 2, 1); obj = new WorldGenOriginalTree(BOPBlockHelper.get("logs4"), BOPBlockHelper.get("leaves4"), 2, 1);

View file

@ -123,6 +123,6 @@ public class BOPConfigurationStrongholds
public static void addStrongholdBiome(BiomeGenBase biome) public static void addStrongholdBiome(BiomeGenBase biome)
{ {
enabledBiomes.add(biome.biomeID); if (biome != null) enabledBiomes.add(biome.biomeID);
} }
} }

View file

@ -81,6 +81,6 @@ public class BOPConfigurationVillages
public static void addVillageBiome(BiomeGenBase biome) public static void addVillageBiome(BiomeGenBase biome)
{ {
enabledBiomes.add(biome.biomeID); if (biome != null) enabledBiomes.add(biome.biomeID);
} }
} }

View file

@ -81,6 +81,7 @@ import biomesoplenty.common.biomes.overworld.ocean.BiomeGenKelpForest;
import biomesoplenty.common.biomes.overworld.sub.BiomeGenAlpsForest; import biomesoplenty.common.biomes.overworld.sub.BiomeGenAlpsForest;
import biomesoplenty.common.biomes.overworld.sub.BiomeGenCanyonRavine; import biomesoplenty.common.biomes.overworld.sub.BiomeGenCanyonRavine;
import biomesoplenty.common.biomes.overworld.sub.BiomeGenGlacier; import biomesoplenty.common.biomes.overworld.sub.BiomeGenGlacier;
import biomesoplenty.common.biomes.overworld.sub.BiomeGenMangrove;
import biomesoplenty.common.biomes.overworld.sub.BiomeGenMeadowForest; import biomesoplenty.common.biomes.overworld.sub.BiomeGenMeadowForest;
import biomesoplenty.common.biomes.overworld.sub.BiomeGenOasis; import biomesoplenty.common.biomes.overworld.sub.BiomeGenOasis;
import biomesoplenty.common.biomes.overworld.sub.BiomeGenQuagmire; import biomesoplenty.common.biomes.overworld.sub.BiomeGenQuagmire;
@ -190,22 +191,23 @@ public class BOPBiomes
wetland = registerOverworldBiome(BiomeGenWetland.class, "Wetland", TemperatureType.WARM, 7); wetland = registerOverworldBiome(BiomeGenWetland.class, "Wetland", TemperatureType.WARM, 7);
woodland = registerOverworldBiome(BiomeGenWoodland.class, "Woodland", TemperatureType.WARM, 10); woodland = registerOverworldBiome(BiomeGenWoodland.class, "Woodland", TemperatureType.WARM, 10);
//Sub Biomes
glacier = registerOverworldSubBiome(BiomeGenGlacier.class, "Glacier", 10, arctic.biomeID);
scrubland = registerOverworldSubBiome(BiomeGenScrubland.class, "Scrubland", 10, BiomeGenBase.savanna.biomeID);
oasis = registerOverworldSubBiome(BiomeGenOasis.class, "Oasis", 10, BiomeGenBase.desert.biomeID);
quagmire = registerOverworldSubBiome(BiomeGenQuagmire.class, "Quagmire", 10, sludgepit.biomeID);
silkglades = registerOverworldSubBiome(BiomeGenSilkglades.class, "Silkglades", 10, sludgepit.biomeID);
meadowForest = registerOverworldSubBiome(BiomeGenMeadowForest.class, "Meadow Forest", 10, meadow.biomeID);
alpsForest = registerOverworldSubBiome(BiomeGenAlpsForest.class, "Alps Forest", 10, alps.biomeID);
canyonRavine = registerOverworldSubBiome(BiomeGenCanyonRavine.class, "Canyon Ravine", 10, canyon.biomeID);
spruceWoods = registerOverworldSubBiome(BiomeGenSpruceWoods.class, "Spruce Woods", 10, BiomeGenBase.forest.biomeID);
//Ocean Biomes //Ocean Biomes
coralReef = registerOverworldSubBiome(BiomeGenCoralReef.class, "Coral Reef", 10, BiomeGenBase.ocean.biomeID); coralReef = registerOverworldSubBiome(BiomeGenCoralReef.class, "Coral Reef", 10, BiomeGenBase.ocean);
kelpForest = registerOverworldSubBiome(BiomeGenKelpForest.class, "Kelp Forest", 10, BiomeGenBase.ocean.biomeID); kelpForest = registerOverworldSubBiome(BiomeGenKelpForest.class, "Kelp Forest", 10, BiomeGenBase.ocean);
tropics = registerOverworldSubBiome(BiomeGenTropics.class, "Tropics", 10, BiomeGenBase.deepOcean.biomeID); tropics = registerOverworldSubBiome(BiomeGenTropics.class, "Tropics", 10, BiomeGenBase.deepOcean);
volcano = registerOverworldSubBiome(BiomeGenVolcano.class, "Volcano", 10, BiomeGenBase.deepOcean.biomeID); volcano = registerOverworldSubBiome(BiomeGenVolcano.class, "Volcano", 10, BiomeGenBase.deepOcean);
//Sub Biomes
alpsForest = registerOverworldSubBiome(BiomeGenAlpsForest.class, "Alps Forest", 10, alps);
canyonRavine = registerOverworldSubBiome(BiomeGenCanyonRavine.class, "Canyon Ravine", 10, canyon);
glacier = registerOverworldSubBiome(BiomeGenGlacier.class, "Glacier", 10, arctic);
mangrove = registerOverworldSubBiome(BiomeGenMangrove.class, "Mangrove", 10, tropics);
meadowForest = registerOverworldSubBiome(BiomeGenMeadowForest.class, "Meadow Forest", 10, meadow);
oasis = registerOverworldSubBiome(BiomeGenOasis.class, "Oasis", 10, BiomeGenBase.desert);
quagmire = registerOverworldSubBiome(BiomeGenQuagmire.class, "Quagmire", 10, sludgepit);
scrubland = registerOverworldSubBiome(BiomeGenScrubland.class, "Scrubland", 10, BiomeGenBase.savanna);
silkglades = registerOverworldSubBiome(BiomeGenSilkglades.class, "Silkglades", 10, sludgepit);
spruceWoods = registerOverworldSubBiome(BiomeGenSpruceWoods.class, "Spruce Woods", 10, BiomeGenBase.forest);
//Nether Biomes //Nether Biomes
corruptedSands = registerNetherBiome(BiomeGenCorruptedSands.class, "Corrupted Sands", 10); corruptedSands = registerNetherBiome(BiomeGenCorruptedSands.class, "Corrupted Sands", 10);
@ -215,8 +217,8 @@ public class BOPBiomes
undergarden = registerNetherBiome(BiomeGenUndergarden.class, "Undergarden", 10); undergarden = registerNetherBiome(BiomeGenUndergarden.class, "Undergarden", 10);
//River Biomes //River Biomes
lushRiver = registerOverworldRiverBiome(BiomeGenLushRiver.class, "Lush River", lushSwamp.biomeID, lavenderFields.biomeID, flowerField.biomeID, bambooForest.biomeID, cherryBlossomGrove.biomeID, lushDesert.biomeID, meadow.biomeID, spruceWoods.biomeID, rainforest.biomeID, BiomeGenBase.forest.biomeID, BiomeGenBase.forestHills.biomeID, BiomeGenBase.jungle.biomeID, BiomeGenBase.jungleEdge.biomeID, BiomeGenBase.jungleHills.biomeID); lushRiver = registerOverworldRiverBiome(BiomeGenLushRiver.class, "Lush River", lushSwamp, lavenderFields, flowerField, bambooForest, cherryBlossomGrove, lushDesert, meadow, spruceWoods, rainforest, BiomeGenBase.forest, BiomeGenBase.forestHills, BiomeGenBase.jungle, BiomeGenBase.jungleEdge, BiomeGenBase.jungleHills);
dryRiver = registerOverworldRiverBiome(BiomeGenDryRiver.class, "Dry River", outback.biomeID, steppe.biomeID, BiomeGenBase.desert.biomeID, BiomeGenBase.desertHills.biomeID); dryRiver = registerOverworldRiverBiome(BiomeGenDryRiver.class, "Dry River", outback, steppe, BiomeGenBase.desert, BiomeGenBase.desertHills);
} }
private static void addBiomesToDictionary() private static void addBiomesToDictionary()
@ -246,7 +248,7 @@ public class BOPBiomes
BiomeDictionary.registerBiomeType(BOPCBiomes.flowerField, Type.PLAINS); BiomeDictionary.registerBiomeType(BOPCBiomes.flowerField, Type.PLAINS);
BiomeDictionary.registerBiomeType(BOPCBiomes.frostForest, Type.FROZEN, Type.FOREST); BiomeDictionary.registerBiomeType(BOPCBiomes.frostForest, Type.FROZEN, Type.FOREST);
BiomeDictionary.registerBiomeType(BOPCBiomes.fungiForest, Type.MAGICAL, Type.MUSHROOM, Type.FOREST, Type.SWAMP); BiomeDictionary.registerBiomeType(BOPCBiomes.fungiForest, Type.MAGICAL, Type.MUSHROOM, Type.FOREST, Type.SWAMP);
//BiomeDictionary.registerBiomeType(BOPBiomeHelper.getBOPBiome("garden, Type.MAGICAL, Type.PLAINS); BiomeDictionary.registerBiomeType(BOPCBiomes.garden, Type.MAGICAL, Type.PLAINS);
BiomeDictionary.registerBiomeType(BOPCBiomes.glacier, Type.FROZEN, Type.HILLS); BiomeDictionary.registerBiomeType(BOPCBiomes.glacier, Type.FROZEN, Type.HILLS);
BiomeDictionary.registerBiomeType(BOPCBiomes.grassland, Type.PLAINS, Type.SWAMP, Type.HILLS); BiomeDictionary.registerBiomeType(BOPCBiomes.grassland, Type.PLAINS, Type.SWAMP, Type.HILLS);
BiomeDictionary.registerBiomeType(BOPCBiomes.grove, Type.FOREST, Type.PLAINS); BiomeDictionary.registerBiomeType(BOPCBiomes.grove, Type.FOREST, Type.PLAINS);
@ -256,7 +258,7 @@ public class BOPBiomes
BiomeDictionary.registerBiomeType(BOPCBiomes.lavenderFields, Type.PLAINS); BiomeDictionary.registerBiomeType(BOPCBiomes.lavenderFields, Type.PLAINS);
BiomeDictionary.registerBiomeType(BOPCBiomes.lushDesert, Type.DESERT, Type.FOREST); BiomeDictionary.registerBiomeType(BOPCBiomes.lushDesert, Type.DESERT, Type.FOREST);
BiomeDictionary.registerBiomeType(BOPCBiomes.lushSwamp, Type.SWAMP, Type.WATER); BiomeDictionary.registerBiomeType(BOPCBiomes.lushSwamp, Type.SWAMP, Type.WATER);
//BiomeDictionary.registerBiomeType(BOPBiomeHelper.getBOPBiome("mangrove, Type.WATER, Type.FOREST); BiomeDictionary.registerBiomeType(BOPCBiomes.mangrove, Type.WATER, Type.FOREST);
BiomeDictionary.registerBiomeType(BOPCBiomes.mapleWoods, Type.FOREST); BiomeDictionary.registerBiomeType(BOPCBiomes.mapleWoods, Type.FOREST);
BiomeDictionary.registerBiomeType(BOPCBiomes.marsh, Type.SWAMP, Type.WATER); BiomeDictionary.registerBiomeType(BOPCBiomes.marsh, Type.SWAMP, Type.WATER);
BiomeDictionary.registerBiomeType(BOPCBiomes.meadow, Type.FOREST, Type.PLAINS); BiomeDictionary.registerBiomeType(BOPCBiomes.meadow, Type.FOREST, Type.PLAINS);
@ -265,9 +267,8 @@ public class BOPBiomes
BiomeDictionary.registerBiomeType(BOPCBiomes.mountain, Type.MOUNTAIN); BiomeDictionary.registerBiomeType(BOPCBiomes.mountain, Type.MOUNTAIN);
BiomeDictionary.registerBiomeType(BOPCBiomes.mysticGrove, Type.MAGICAL, Type.FOREST); BiomeDictionary.registerBiomeType(BOPCBiomes.mysticGrove, Type.MAGICAL, Type.FOREST);
BiomeDictionary.registerBiomeType(BOPCBiomes.oasis, Type.DESERT, Type.JUNGLE); BiomeDictionary.registerBiomeType(BOPCBiomes.oasis, Type.DESERT, Type.JUNGLE);
//BiomeDictionary.registerBiomeType(BOPBiomeHelper.getBOPBiome("oceanAbyss, Type.WATER); BiomeDictionary.registerBiomeType(BOPCBiomes.coralReef, Type.WATER);
//BiomeDictionary.registerBiomeType(BOPBiomeHelper.getBOPBiome("oceanCoral, Type.WATER); BiomeDictionary.registerBiomeType(BOPCBiomes.kelpForest, Type.WATER, Type.FOREST);
//BiomeDictionary.registerBiomeType(BOPBiomeHelper.getBOPBiome("oceanKelp, Type.WATER, Type.FOREST);
BiomeDictionary.registerBiomeType(BOPCBiomes.ominousWoods, Type.MAGICAL); BiomeDictionary.registerBiomeType(BOPCBiomes.ominousWoods, Type.MAGICAL);
//BiomeDictionary.registerBiomeType(BOPBiomeHelper.getBOPBiome("orchard, Type.FOREST, Type.PLAINS); //BiomeDictionary.registerBiomeType(BOPBiomeHelper.getBOPBiome("orchard, Type.FOREST, Type.PLAINS);
BiomeDictionary.registerBiomeType(BOPCBiomes.outback, Type.DESERT, Type.PLAINS); BiomeDictionary.registerBiomeType(BOPCBiomes.outback, Type.DESERT, Type.PLAINS);
@ -343,7 +344,7 @@ public class BOPBiomes
return BOPBiomeManager.createAndRegisterBiome(biomeClass, "Overworld", biomeName, BOPBiomeManager.overworldBiomes[temperatureType], weight); return BOPBiomeManager.createAndRegisterBiome(biomeClass, "Overworld", biomeName, BOPBiomeManager.overworldBiomes[temperatureType], weight);
} }
private static BiomeGenBase registerOverworldSubBiome(Class<? extends BiomeGenBase> biomeClass, String biomeName, int weight, int...parents) private static BiomeGenBase registerOverworldSubBiome(Class<? extends BiomeGenBase> biomeClass, String biomeName, int weight, BiomeGenBase...parents)
{ {
BiomeGenBase biome = BOPBiomeManager.createBiome(biomeClass, biomeName); BiomeGenBase biome = BOPBiomeManager.createBiome(biomeClass, biomeName);
@ -353,11 +354,14 @@ public class BOPBiomes
if (BOPConfigurationBiomeGen.config.get("Overworld (Sub) Biomes To Generate", biome.biomeName, true).getBoolean(false)) if (BOPConfigurationBiomeGen.config.get("Overworld (Sub) Biomes To Generate", biome.biomeName, true).getBoolean(false))
{ {
for (int parent : parents) for (BiomeGenBase parent : parents)
{ {
if (BOPBiomeManager.overworldSubBiomes[parent] == null) BOPBiomeManager.overworldSubBiomes[parent] = new ArrayList(); if (parent != null)
{
if (BOPBiomeManager.overworldSubBiomes[parent.biomeID] == null) BOPBiomeManager.overworldSubBiomes[parent.biomeID] = new ArrayList();
BOPBiomeManager.overworldSubBiomes[parent].add(entry); BOPBiomeManager.overworldSubBiomes[parent.biomeID].add(entry);
}
} }
} }
@ -367,7 +371,7 @@ public class BOPBiomes
return null; return null;
} }
private static BiomeGenBase registerOverworldRiverBiome(Class<? extends BiomeGenBase> biomeClass, String biomeName, int...parents) private static BiomeGenBase registerOverworldRiverBiome(Class<? extends BiomeGenBase> biomeClass, String biomeName, BiomeGenBase...parents)
{ {
BiomeGenBase biome = BOPBiomeManager.createBiome(biomeClass, biomeName); BiomeGenBase biome = BOPBiomeManager.createBiome(biomeClass, biomeName);
@ -375,9 +379,12 @@ public class BOPBiomes
{ {
if (BOPConfigurationBiomeGen.config.get("Overworld (River) Biomes To Generate", biome.biomeName, true).getBoolean(false)) if (BOPConfigurationBiomeGen.config.get("Overworld (River) Biomes To Generate", biome.biomeName, true).getBoolean(false))
{ {
for (int parent : parents) for (BiomeGenBase parent : parents)
{ {
BOPBiomeManager.overworldRiverBiomes[parent] = biome; if (parent != null)
{
BOPBiomeManager.overworldRiverBiomes[parent.biomeID] = biome;
}
} }
} }
} }

View file

@ -2,7 +2,6 @@ package biomesoplenty.common.core;
import biomesoplenty.api.BOPBlockHelper; import biomesoplenty.api.BOPBlockHelper;
import biomesoplenty.api.BOPItemHelper; import biomesoplenty.api.BOPItemHelper;
import biomesoplenty.api.content.BOPCBiomes;
import biomesoplenty.common.configuration.BOPConfigurationMisc; import biomesoplenty.common.configuration.BOPConfigurationMisc;
import biomesoplenty.common.entities.projectiles.dispenser.DispenserBehaviourDart; import biomesoplenty.common.entities.projectiles.dispenser.DispenserBehaviourDart;
import biomesoplenty.common.entities.projectiles.dispenser.DispenserBehaviourMudball; import biomesoplenty.common.entities.projectiles.dispenser.DispenserBehaviourMudball;

View file

@ -0,0 +1,171 @@
package biomesoplenty.common.world.features.trees;
import java.util.Random;
import biomesoplenty.api.BOPBlockHelper;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
import net.minecraft.world.gen.feature.WorldGenerator;
public class WorldGenMangrove extends WorldGenAbstractTree
{
public WorldGenMangrove()
{
super(false);
}
@Override
public boolean generate(World world, Random random, int x, int y, int z)
{
int height = random.nextInt(3) + 4;
boolean generate = true;
if (y >= 1 && y + height + 1 <= 256)
{
byte width;
for (int yi = y; yi <= y + 1 + height; ++yi)
{
width = 1;
if (yi == y)
{
width = 0;
}
if (yi >= y + 1 + height - 2)
{
width = 2;
}
for (int xi = x - width; xi <= x + width && generate; ++xi)
{
for (int zi = z - width; zi <= z + width && generate; ++zi)
{
if (yi >= 0 && yi < 256)
{
if (!this.isReplaceable(world, xi, yi, zi))
{
generate = false;
}
}
else
{
generate = false;
}
}
}
}
if (!generate)
{
return false;
}
else
{
Block soilBlock = world.getBlock(x, y - 1, z);
if ((soilBlock == Blocks.sand || soilBlock == Blocks.water || soilBlock == Blocks.flowing_water) && y < 256 - height - 1)
{
byte leavesHeight = 1;
byte var18 = 0;
//Height = 7
//y 7 - Loop End
//y 6 - Loop Start
//y 5
//y 4
//y 3
//y 2
//y 1
//y 0 - Base
//y -1
//Starts from the beginning of the leaves
for (int yi = y + height - leavesHeight; yi <= y + height; ++yi)
{
int delta = yi - (y + height);
int l1 = var18 + 1 - delta;
for (int xi = x - l1; xi <= x + l1; ++xi)
{
int j2 = xi - x;
for (int zi = z - l1; zi <= z + l1; ++zi)
{
int l2 = zi - z;
// When yi == y + height
if (Math.abs(j2) != l1 || Math.abs(l2) != l1 || random.nextInt(2) != 0 && delta != 0)
{
Block block = world.getBlock(xi, yi, zi);
if (block.isAir(world, xi, yi, zi) || block.isLeaves(world, xi, yi, zi))
{
this.setBlockAndNotifyAdequately(world, xi, yi, zi, BOPBlockHelper.get("colorizedLeaves1"), 1);
this.setBlockAndNotifyAdequately(world, xi, yi - 1, zi, BOPBlockHelper.get("colorizedLeaves1"), 1);
this.setBlockAndNotifyAdequately(world, x + 1, (y + height) - 3, z, BOPBlockHelper.get("colorizedLeaves1"), 1);
this.setBlockAndNotifyAdequately(world, x - 1, (y + height) - 3, z, BOPBlockHelper.get("colorizedLeaves1"), 1);
this.setBlockAndNotifyAdequately(world, x, (y + height) - 3, z + 1, BOPBlockHelper.get("colorizedLeaves1"), 1);
this.setBlockAndNotifyAdequately(world, x, (y + height) - 3, z - 1, BOPBlockHelper.get("colorizedLeaves1"), 1);
}
}
}
}
}
for (int yi = 0; yi < height; ++yi)
{
Block block = world.getBlock(x, y + yi, z);
if (block.isAir(world, x, y + yi, z) || block.isLeaves(world, x, y + yi, z))
{
this.setBlockAndNotifyAdequately(world, x, y + yi, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 1, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 2, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x - 1, y, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x + 1, y, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y, z - 1, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y, z + 1, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x - 1, y - 1, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x + 1, y - 1, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 1, z - 1, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 1, z + 1, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x - 1, y - 2, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x + 1, y - 2, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 2, z - 1, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 2, z + 1, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x - 2, y - 3, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x + 2, y - 3, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 3, z - 2, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 3, z + 2, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x - 2, y - 4, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x + 2, y - 4, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 4, z - 2, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 4, z + 2, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x - 3, y - 5, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x + 3, y - 5, z, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 5, z - 3, BOPBlockHelper.get("logs2"), 2);
this.setBlockAndNotifyAdequately(world, x, y - 5, z + 3, BOPBlockHelper.get("logs2"), 2);
}
}
return true;
}
}
}
return false;
}
}

View file

@ -12,7 +12,6 @@ import net.minecraft.world.gen.layer.GenLayerBiome;
import net.minecraft.world.gen.layer.IntCache; import net.minecraft.world.gen.layer.IntCache;
import biomesoplenty.api.BOPBiomeManager; import biomesoplenty.api.BOPBiomeManager;
import biomesoplenty.api.BOPBiomeManager.BiomeEntry; import biomesoplenty.api.BOPBiomeManager.BiomeEntry;
import biomesoplenty.api.content.BOPCBiomes;
import biomesoplenty.common.configuration.BOPConfigurationBiomeGen; import biomesoplenty.common.configuration.BOPConfigurationBiomeGen;
import biomesoplenty.common.core.BOPBiomes; import biomesoplenty.common.core.BOPBiomes;