This commit is contained in:
Lizbeth Rika committed 2014-12-20 16:48:20 +00:00
commit edc9757012
5 files changed
+37 -3

No files matched your search

@@ -0,0 +1,22 @@
/**
* This class was created by <SpitefulFox>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania 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)
*
* File Created @ [? (GMT)]
*/
package vazkii.botania.api.item;
import net.minecraft.world.World;
/**
* A BiomeGenBase that implements this will not have Botania flowers generated.
*/
public interface IFlowerlessBiome {
/**
* @return Should this world be allowed to generate flowers?
*/
public boolean canGenerateFlowers(World world, int x, int z);
}
@@ -21,5 +21,5 @@ public interface IFlowerlessWorld {
/**
* @return Should this world be allowed to generate flowers?
*/
public boolean generateFlowers(World world);
public boolean canGenerateFlowers(World world);
}
@@ -1,4 +1,4 @@
@API(owner = "Botania", apiVersion = "25", provides = "BotaniaAPI")
@API(owner = "Botania", apiVersion = "26", provides = "BotaniaAPI")
package vazkii.botania.api;
import cpw.mods.fml.common.API;
@@ -102,5 +102,14 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
int meta = world.getBlockMetadata(x, y, z);
return meta == 0 ? LexiconData.pureDaisy : LexiconData.decorativeBlocks;
}
@Override
public boolean canSustainLeaves(IBlockAccess world, int x, int y, int z)
{
if(world.getBlockMetadata(x, y, z) == 0)
return true;
else
return false;
}
}
@@ -14,6 +14,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.api.item.IFlowerlessBiome;
import vazkii.botania.common.block.ModBlocks;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.EventPriority;
@@ -26,7 +27,9 @@ public class BiomeDecorationHandler {
if((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS) {
boolean flowers = true;
if(event.world.provider instanceof IFlowerlessWorld)
flowers = ((IFlowerlessWorld) event.world.provider).generateFlowers(event.world);
flowers = ((IFlowerlessWorld) event.world.provider).canGenerateFlowers(event.world);
else if(event.world.getBiomeGenForCoords(event.chunkX, event.chunkZ) instanceof IFlowerlessBiome)
flowers = ((IFlowerlessBiome)event.world.getBiomeGenForCoords(event.chunkX, event.chunkZ)).canGenerateFlowers(event.world, event.chunkX, event.chunkZ);
if(!flowers)
return;