Fix #135 Feature for adding Forestry resources to existing chunks

This commit is contained in:
mezz committed 2015-01-11 19:33:37 -08:00
1 parent b3fbadce84
commit d94a688f28
11 files changed
+184 -28

No files matched your search

@@ -22,6 +22,7 @@ import java.util.EnumSet;
import java.util.Random;
import net.minecraft.command.ICommand;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
public abstract class ForestryPlugin {
@@ -65,7 +66,10 @@ public abstract class ForestryPlugin {
return null;
}
public void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGeneratedZ) {
}
public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
}
public IPacketHandler getPacketHandler() {
@@ -11,6 +11,7 @@
package forestry.plugins;
import java.util.ArrayList;
import java.util.Random;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -25,6 +26,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
import net.minecraft.util.IIcon;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.BiomeDictionary;
@@ -336,10 +339,6 @@ public class PluginApiculture extends ForestryPlugin {
Proxies.render.registerVillagerSkin(Defaults.ID_VILLAGER_BEEKEEPER, Defaults.TEXTURE_SKIN_BEEKPEEPER);
VillagerRegistry.instance().registerVillageTradeHandler(Defaults.ID_VILLAGER_BEEKEEPER, villageHandler);
// Register world gen
if (Config.generateBeehives)
MinecraftForge.EVENT_BUS.register(HiveDecorator.instance());
proxy.initializeRendering();
}
@@ -1243,6 +1242,18 @@ public class PluginApiculture extends ForestryPlugin {
return null;
}
@Override
public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
if (Config.generateBeehives)
HiveDecorator.instance().decorateHives(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
}
@Override
public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
if (Config.generateBeehives)
HiveDecorator.instance().decorateHives(world, rand, chunkX, chunkZ);
}
@Override
public boolean processIMCMessage(IMCMessage message) {
if (message.key.equals("add-candle-lighting-id")) {
@@ -35,6 +35,8 @@ import net.minecraft.command.ICommand;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.common.config.Property;
@@ -288,10 +290,17 @@ public class PluginManager {
}
}
public static void generateSurface(World world, Random rand, int chunkX, int chunkZ) {
public static void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
for (Module m : loadedModules) {
ForestryPlugin plugin = m.instance;
plugin.generateSurface(world, rand, chunkX, chunkZ);
plugin.populateChunk(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
}
}
public static void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
for (Module m : loadedModules) {
ForestryPlugin plugin = m.instance;
plugin.populateChunkRetroGen(world, rand, chunkX, chunkZ);
}
}