Added an interface to the API to allow a world provider to not generate Botania flowers

Signed-off-by: Justin Wiblin <[email protected]>
This commit is contained in:
Justin Wiblin committed 2014-10-19 00:50:18 +01:00
1 parent 0992daaf84
commit 9d3db1ef70
2 files changed
+9 -1

No files matched your search

@@ -0,0 +1,7 @@
package vazkii.botania.api.item;
/**
* A World Provider that implements this will not have Botania flowers generated.
*/
public interface IFlowerlessWorld {
}
@@ -13,6 +13,7 @@ package vazkii.botania.common.core.handler;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent.Decorate.EventType;
import vazkii.botania.api.item.IFlowerlessWorld;
import vazkii.botania.common.block.ModBlocks;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.EventPriority;
@@ -34,7 +35,7 @@ public class BiomeDecorationHandler {
int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4);
int z1 = z + event.rand.nextInt(8) - event.rand.nextInt(8);
if(event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1))
if(!(event.world.provider instanceof IFlowerlessWorld) && event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1))
event.world.setBlock(x1, y1, z1, ModBlocks.flower, color, 2);
}
}