Move hives into biome decoration generation

fixes #1760
This commit is contained in:
Robert Obermeier authored and mezz committed 2017-07-24 22:33:21 -07:00
1 parent 73db1a608a
commit b4d71543db
5 files changed
+25 -2

No files matched your search

@@ -898,9 +898,11 @@ public class PluginApiculture extends BlankForestryPlugin {
}
@Override
public void populateChunk(IChunkGenerator chunkGenerator, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
public void decorateBiome(World world, Random rand, BlockPos pos) {
if (Config.getBeehivesAmount() > 0.0) {
HiveDecorator.decorateHives(chunkGenerator, world, rand, chunkX, chunkZ, hasVillageGenerated);
int chunkX = pos.getX() >> 4;
int chunkZ = pos.getZ() >> 4;
HiveDecorator.decorateHives(world, rand, chunkX, chunkZ);
}
}
@@ -21,6 +21,7 @@ import net.minecraft.world.gen.IChunkGenerator;
import net.minecraft.world.gen.feature.WorldGenMinable;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.terraingen.DecorateBiomeEvent;
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
import net.minecraftforge.fml.common.IWorldGenerator;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -54,6 +55,11 @@ public class WorldGenerator implements IWorldGenerator {
PluginManager.populateChunk(event.getGen(), event.getWorld(), event.getRand(), event.getChunkX(), event.getChunkZ(), event.isHasVillageGenerated());
}
@SubscribeEvent
public void decorateBiome(DecorateBiomeEvent.Post event) {
PluginManager.decorateBiome(event.getWorld(), event.getRand(), event.getPos());
}
public void retroGen(Random random, int chunkX, int chunkZ, World world) {
generateWorld(random, chunkX, chunkZ, world);
PluginManager.populateChunkRetroGen(world, random, chunkX, chunkZ);
@@ -18,6 +18,7 @@ import java.util.Set;
import net.minecraft.command.ICommand;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.IChunkGenerator;
@@ -111,6 +112,10 @@ public abstract class BlankForestryPlugin implements IForestryPlugin {
public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
}
@Override
public void decorateBiome(World world, Random rand, BlockPos pos) {
}
@Override
public void getHiddenItems(List<ItemStack> hiddenItems) {
}
@@ -7,6 +7,7 @@ import java.util.Set;
import net.minecraft.command.ICommand;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.IChunkGenerator;
@@ -58,6 +59,8 @@ public interface IForestryPlugin {
void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ);
void decorateBiome(World world, Random rand, BlockPos pos);
void getHiddenItems(List<ItemStack> hiddenItems);
@Nullable
@@ -28,6 +28,7 @@ import net.minecraft.command.CommandHandler;
import net.minecraft.command.ICommand;
import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.gen.IChunkGenerator;
@@ -286,6 +287,12 @@ public class PluginManager {
}
}
public static void decorateBiome(World world, Random rand, BlockPos pos) {
for (IForestryPlugin plugin : loadedPlugins) {
plugin.decorateBiome(world, rand, pos);
}
}
public static void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
for (IForestryPlugin plugin : loadedPlugins) {
plugin.populateChunkRetroGen(world, rand, chunkX, chunkZ);