package com.ferreusveritas.dynamictrees.worldgen;

import com.ferreusveritas.dynamictrees.ModConfigs;

import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.biome.Biome;
import net.minecraftforge.common.BiomeDictionary;
import net.minecraftforge.common.BiomeDictionary.Type;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.fml.common.eventhandler.Event.Result;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class DecorateEventHandler {

	@SubscribeEvent(priority=EventPriority.NORMAL, receiveCanceled=true)
	public void onEvent(DecorateBiomeEvent.Decorate event) {
		if(!ModConfigs.dimensionBlacklist.contains(event.getWorld().provider.getDimension())) {
			switch(event.getType()) {
				case CACTUS: if(ModConfigs.vanillaCactusWorldGen) { break; } 
				case TREE:
					Biome biome = event.getWorld().getBiome(event.getPos());
					if(TreeGenerator.getTreeGenerator().biomeDataBase.getEntry(biome).shouldCancelVanillaTreeGen()) {
						event.setResult(Result.DENY);
					}
					TreeGenerator.getTreeGenerator().generate(event.getWorld(), biome, new ChunkPos(event.getPos()));
					break;
				case BIG_SHROOM:
					//We need to disable Giant Mushroom creation until after the trees are built
					if(BiomeDictionary.hasType(event.getWorld().getBiome(event.getPos()), Type.SPOOKY)) {
						event.setResult(Result.DENY);//Disable shrooms for roofedForest only
					}
				default: break;
			}
		}
	}
}
@@ -796,16 +796,76 @@
 n())) %7B%0A
+%09%09%09Biome biome = event.getWorld().getBiome(event.getPos());%0A
 %09%09%09switc
@@ -905,12 +905,18 @@
 TUS:
- 
+%0A%09%09%09%09%09
 if(
+!
 ModC
@@ -947,21 +947,162 @@
 dGen
-) %7B 
+ && TreeGenerator.getTreeGenerator().biomeDataBase.getEntry(biome).shouldCancelVanillaTreeGen()) %7B%0A%09%09%09%09%09%09event.setResult(Result.DENY);%0A%09%09%09%09%09%7D %0A%09%09%09%09%09
 break;
- %7D 
 %0A%09%09%09
@@ -1116,70 +1116,51 @@
 REE:
-%0A%09%09%09%09%09Biome biome = event.getWorld().getBiome(event.getPos());
+//Cactus is also done by the tree generator
 %0A%09%09%09
@@ -1556,49 +1556,13 @@
 ype(
-event.getWorld().getBiome(event.getPos())
+biome
 , Ty

Fix decorator