private Map<String, Boolean> hasDecorationBegun = new HashMap<String, Boolean>();
@Override
public boolean onResourceProcess(Resource resource, LocalWorld localWorld, Random random, boolean villageInChunk, int chunkX, int chunkZ, boolean isCancelled)
{
ForgeWorld world = (ForgeWorld) localWorld;
int blockX = chunkX * CHUNK_X_SIZE;
int blockZ = chunkZ * CHUNK_Z_SIZE;
// Convert to Forge event and fire
if (resource instanceof DungeonGen ||
resource instanceof SmallLakeGen ||
resource instanceof UndergroundLakeGen ||
resource instanceof LiquidGen ||
resource instanceof CustomObjectGen)
{
// Fire population event
Populate.EventType forgeEvent = getPopulateEventType(resource.getMaterial());
return TerrainGen.populate(world.getChunkGenerator(), world.getWorld(), random, blockX, blockZ,
villageInChunk, forgeEvent);
} else if (resource instanceof OreGen || resource instanceof VeinGen)
{
if (!hasOreGenerationBegun(world))
{
// Fire ore generation start event
MinecraftForge.ORE_GEN_BUS
.post(new OreGenEvent.Pre(world.getWorld(), random, blockX, blockZ));
setOreGenerationBegun(world, true);
}
// Fire ore generation event
GenerateMinable.EventType forgeEvent = getOreEventType(resource.getMaterial());
return TerrainGen.generateOre(world.getWorld(), random, null, blockX, blockZ, forgeEvent);
} else
{
if (!hasDecorationBegun(world))
{
// Fire decoration start event
MinecraftForge.EVENT_BUS.post(new DecorateBiomeEvent.Pre(world.getWorld(), random, blockX, chunkZ
* CHUNK_Z_SIZE));
setDecorationBegun(world, true);
}
// Fire decoration event
Decorate.EventType forgeEvent = getDecorateEventType(resource.getMaterial());
return TerrainGen.decorate(world.getWorld(), random, blockX, blockZ, forgeEvent);
}
}