mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 03:39:09 +00:00
#260 Expose basic hive gen in the API
This commit is contained in:
1 parent
8816a5fea8
commit
4b2336bae2
13 files changed
+253
-250
No files matched your search
@@ -10,17 +10,22 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveManager;
|
||||
import forestry.api.apiculture.hives.IHive;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.Defaults;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType;
|
||||
import net.minecraftforge.event.terraingen.TerrainGen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author CovertJaguar <http://www.railcraft.info/>
|
||||
@@ -30,13 +35,6 @@ public class HiveDecorator {
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static final EventType EVENT_TYPE = EnumHelper.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0], new Object[0]);
|
||||
private static HiveDecorator instance;
|
||||
private final WorldGenHiveForest forest = new WorldGenHiveForest();
|
||||
private final WorldGenHiveJungle jungle = new WorldGenHiveJungle();
|
||||
private final WorldGenHiveMeadows meadows = new WorldGenHiveMeadows();
|
||||
private final WorldGenHiveParched parched = new WorldGenHiveParched();
|
||||
private final WorldGenHiveEnd end = new WorldGenHiveEnd();
|
||||
private final WorldGenHiveSnow snow = new WorldGenHiveSnow();
|
||||
private final WorldGenHiveSwamp swamp = new WorldGenHiveSwamp();
|
||||
|
||||
public static HiveDecorator instance() {
|
||||
if (instance == null) {
|
||||
@@ -57,25 +55,60 @@ public class HiveDecorator {
|
||||
}
|
||||
|
||||
private void decorateHives(World world, Random rand, int worldX, int worldZ) {
|
||||
genHive(world, rand, worldX, worldZ, 3, forest);
|
||||
genHive(world, rand, worldX, worldZ, 4, jungle);
|
||||
genHive(world, rand, worldX, worldZ, 1, meadows);
|
||||
genHive(world, rand, worldX, worldZ, 1, parched);
|
||||
genHive(world, rand, worldX, worldZ, 4, end);
|
||||
genHive(world, rand, worldX, worldZ, 2, snow);
|
||||
genHive(world, rand, worldX, worldZ, 2, swamp);
|
||||
for (IHive hive : HiveManager.getHives())
|
||||
genHive(world, rand, worldX, worldZ, hive);
|
||||
}
|
||||
|
||||
private void genHive(World world, Random rand, int worldX, int worldZ, int probability, WorldGenHive gen) {
|
||||
if (probability < rand.nextInt(128))
|
||||
private void genHive(World world, Random rand, int worldX, int worldZ, IHive hive) {
|
||||
if (hive.genChance() < rand.nextFloat() * 128.0f)
|
||||
return;
|
||||
|
||||
BiomeGenBase biome = world.getBiomeGenForCoords(worldX, worldZ);
|
||||
EnumTemperature temperature = EnumTemperature.getFromValue(biome.temperature);
|
||||
EnumHumidity humidity = EnumHumidity.getFromValue(biome.rainfall);
|
||||
|
||||
if (!hive.isGoodClimate(biome, temperature, humidity))
|
||||
return;
|
||||
|
||||
for (int tries = 0; tries < 4; tries ++) {
|
||||
int randPosX = worldX + rand.nextInt(16);
|
||||
int randPosZ = worldZ + rand.nextInt(16);
|
||||
int x = worldX + rand.nextInt(16);
|
||||
int z = worldZ + rand.nextInt(16);
|
||||
|
||||
if (gen.generate(world, rand, randPosX, 0, randPosZ))
|
||||
if (tryGenHive(world, x, z, hive))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean tryGenHive(World world, int x, int z, IHive hive) {
|
||||
|
||||
int y = hive.getYForHive(world, x, z);
|
||||
|
||||
if (y < 0)
|
||||
return false;
|
||||
|
||||
if (!hive.canReplace(world, x, y, z))
|
||||
return false;
|
||||
|
||||
if (!hive.isGoodLocation(world, x, y, z))
|
||||
return false;
|
||||
|
||||
return setHive(world, x, y, z, hive);
|
||||
}
|
||||
|
||||
protected boolean setHive(World world, int x, int y, int z, IHive hive) {
|
||||
Block hiveBlock = hive.getHiveBlock();
|
||||
boolean placed = world.setBlock(x, y, z, hiveBlock, hive.getHiveMeta(), Defaults.FLAG_BLOCK_SYNCH);
|
||||
if (!placed)
|
||||
return false;
|
||||
|
||||
Block placedBlock = world.getBlock(x, y, z);
|
||||
if (!Block.isEqualTo(hiveBlock, placedBlock))
|
||||
return false;
|
||||
|
||||
hiveBlock.onBlockAdded(world, x, y, z);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
|
||||
hive.postGen(world, x, y, z);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+12
-15
@@ -4,30 +4,27 @@
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveJungle extends WorldGenHive {
|
||||
public class HiveEnd extends HiveGround {
|
||||
|
||||
public HiveEnd(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 5, genChance, Blocks.end_stone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.WARM
|
||||
|| EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.DAMP)
|
||||
return false;
|
||||
|
||||
return tryPlaceTreeHive(world, x, z, 4);
|
||||
public boolean isGoodClimate(BiomeGenBase biome, EnumTemperature temperature, EnumHumidity humidity) {
|
||||
return biome.biomeID == BiomeGenBase.sky.biomeID;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+11
-16
@@ -4,31 +4,26 @@
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveTree;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveForest extends WorldGenHive {
|
||||
public class HiveForest extends HiveTree {
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.NORMAL ||
|
||||
EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.NORMAL)
|
||||
return false;
|
||||
|
||||
return tryPlaceTreeHive(world, x, z, 1);
|
||||
public HiveForest(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 1, genChance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodClimate(BiomeGenBase biome, EnumTemperature temperature, EnumHumidity humidity) {
|
||||
return temperature == EnumTemperature.NORMAL && humidity == EnumHumidity.NORMAL;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveTree;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class HiveJungle extends HiveTree {
|
||||
|
||||
public HiveJungle(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 4, genChance);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodClimate(BiomeGenBase biome, EnumTemperature temperature, EnumHumidity humidity) {
|
||||
return temperature == EnumTemperature.WARM && humidity == EnumHumidity.DAMP;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+12
-16
@@ -4,31 +4,27 @@
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveSwamp extends WorldGenHive {
|
||||
public class HiveMeadows extends HiveGround {
|
||||
|
||||
public HiveMeadows(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 2, genChance, Blocks.dirt, Blocks.grass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.NORMAL
|
||||
|| EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.DAMP)
|
||||
return false;
|
||||
|
||||
return tryPlaceGroundHive(world, x, z, 7, Blocks.dirt, Blocks.grass);
|
||||
public boolean isGoodClimate(BiomeGenBase biome, EnumTemperature temperature, EnumHumidity humidity) {
|
||||
return temperature == EnumTemperature.NORMAL && humidity == EnumHumidity.NORMAL;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+12
-16
@@ -4,31 +4,27 @@
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveParched extends WorldGenHive {
|
||||
public class HiveParched extends HiveGround {
|
||||
|
||||
public HiveParched(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 3, genChance, Blocks.sand, Blocks.sandstone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.HOT
|
||||
|| EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.ARID)
|
||||
return false;
|
||||
|
||||
return tryPlaceGroundHive(world, x, z, 3, Blocks.sand, Blocks.sandstone);
|
||||
public boolean isGoodClimate(BiomeGenBase biome, EnumTemperature temperature, EnumHumidity humidity) {
|
||||
return temperature == EnumTemperature.HOT && humidity == EnumHumidity.ARID;
|
||||
}
|
||||
}
|
||||
Executable → Regular
+14
-17
@@ -4,36 +4,33 @@
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.core.EnumTemperature;
|
||||
public class HiveSnow extends HiveGround {
|
||||
|
||||
public class WorldGenHiveSnow extends WorldGenHive {
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.ICY
|
||||
&& EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.COLD)
|
||||
return false;
|
||||
|
||||
return tryPlaceGroundHive(world, x, z, 6, Blocks.dirt, Blocks.grass, Blocks.snow);
|
||||
public HiveSnow(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 6, genChance, Blocks.dirt, Blocks.grass, Blocks.snow);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void postGen(World world, int x, int y, int z, int meta) {
|
||||
super.postGen(world, x, y, z, meta);
|
||||
public boolean isGoodClimate(BiomeGenBase biome, EnumTemperature temperature, EnumHumidity humidity) {
|
||||
return temperature == EnumTemperature.COLD || temperature == EnumTemperature.ICY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postGen(World world, int x, int y, int z) {
|
||||
if (world.isAirBlock(x, y + 1, z))
|
||||
world.setBlock(x, y + 1, z, Blocks.snow_layer, 0, 0);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import forestry.api.apiculture.hives.HiveGround;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.core.config.ForestryBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class HiveSwamp extends HiveGround {
|
||||
|
||||
public HiveSwamp(float genChance) {
|
||||
super(ForestryBlock.beehives.block(), 7, genChance, Blocks.dirt, Blocks.grass);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGoodClimate(BiomeGenBase biome, EnumTemperature temperature, EnumHumidity humidity) {
|
||||
return temperature == EnumTemperature.NORMAL && humidity == EnumHumidity.DAMP;
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@ package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
|
||||
@@ -25,60 +23,6 @@ public abstract class WorldGenHive extends WorldGenerator {
|
||||
@Override
|
||||
public abstract boolean generate(World world, Random random, int x, int y, int z);
|
||||
|
||||
protected boolean tryPlaceTreeHive(World world, int x, int z, int meta) {
|
||||
|
||||
int y = getTopLeafHeight(world, x, z);
|
||||
if (y == -1)
|
||||
return false;
|
||||
|
||||
// get to the bottom of the leaves
|
||||
do { y--; } while (world.getBlock(x, y, z).isLeaves(world, x, y, z));
|
||||
|
||||
if (isReplaceableByHive(world, x, y, z)) {
|
||||
setHive(world, x, y, z, meta);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getTopLeafHeight(World world, int x, int z) {
|
||||
int y = world.getHeightValue(x, z) - 1;
|
||||
if (world.getBlock(x, y, z).isLeaves(world, x, y, z))
|
||||
return y;
|
||||
return -1;
|
||||
}
|
||||
|
||||
protected boolean tryPlaceGroundHive(World world, int x, int z, int meta, Block... groundBlocks) {
|
||||
|
||||
int y = world.getHeightValue(x, z);
|
||||
|
||||
if (isReplaceableByHive(world, x, y, z) && isAcceptableGround(world, x, y - 1, z, groundBlocks)) {
|
||||
setHive(world, x, y, z, meta);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean isReplaceableByHive(World world, int x, int y, int z) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
Material material = block.getMaterial();
|
||||
return (material.isReplaceable() && !material.isLiquid()) ||
|
||||
material == Material.air ||
|
||||
material == Material.grass ||
|
||||
material == Material.plants;
|
||||
}
|
||||
|
||||
private boolean isAcceptableGround(World world, int x, int y, int z, Block... blocks) {
|
||||
Block block = world.getBlock(x, y, z);
|
||||
if (block == null)
|
||||
return false;
|
||||
for (Block testBlock : blocks)
|
||||
if (block.getMaterial() == testBlock.getMaterial())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void setHive(World world, int x, int y, int z, int meta) {
|
||||
boolean placed = world.setBlock(x, y, z, ForestryBlock.beehives.block(), meta, Defaults.FLAG_BLOCK_SYNCH);
|
||||
if (!placed)
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
public class WorldGenHiveEnd extends WorldGenHive {
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (biome.biomeID != BiomeGenBase.sky.biomeID)
|
||||
return false;
|
||||
|
||||
return tryPlaceGroundHive(world, x, z, 5, Blocks.end_stone);
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.worldgen;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
|
||||
public class WorldGenHiveMeadows extends WorldGenHive {
|
||||
|
||||
@Override
|
||||
public boolean generate(World world, Random random, int x, int y, int z) {
|
||||
|
||||
BiomeGenBase biome = world.getWorldChunkManager().getBiomeGenAt(x, z);
|
||||
if (EnumTemperature.getFromValue(biome.temperature) != EnumTemperature.NORMAL
|
||||
|| EnumHumidity.getFromValue(biome.rainfall) != EnumHumidity.NORMAL)
|
||||
return false;
|
||||
|
||||
return tryPlaceGroundHive(world, x, z, 2, Blocks.dirt, Blocks.grass);
|
||||
}
|
||||
}
|
||||
@@ -10,23 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.plugins;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.SidedProxy;
|
||||
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
|
||||
@@ -37,13 +20,6 @@ import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import forestry.api.apiculture.BeeManager;
|
||||
import forestry.api.apiculture.EnumBeeType;
|
||||
import forestry.api.apiculture.FlowerManager;
|
||||
@@ -51,6 +27,8 @@ import forestry.api.apiculture.IBee;
|
||||
import forestry.api.apiculture.IBeeGenome;
|
||||
import forestry.api.apiculture.IBeeRoot;
|
||||
import forestry.api.apiculture.IHiveDrop;
|
||||
import forestry.api.apiculture.hives.HiveManager;
|
||||
import forestry.api.apiculture.hives.IHive;
|
||||
import forestry.api.core.EnumHumidity;
|
||||
import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.Tabs;
|
||||
@@ -128,6 +106,13 @@ import forestry.apiculture.items.ItemWaxCast;
|
||||
import forestry.apiculture.proxy.ProxyApiculture;
|
||||
import forestry.apiculture.trigger.TriggerNoFrames;
|
||||
import forestry.apiculture.worldgen.HiveDecorator;
|
||||
import forestry.apiculture.worldgen.HiveEnd;
|
||||
import forestry.apiculture.worldgen.HiveForest;
|
||||
import forestry.apiculture.worldgen.HiveJungle;
|
||||
import forestry.apiculture.worldgen.HiveMeadows;
|
||||
import forestry.apiculture.worldgen.HiveParched;
|
||||
import forestry.apiculture.worldgen.HiveSnow;
|
||||
import forestry.apiculture.worldgen.HiveSwamp;
|
||||
import forestry.core.GameMode;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Configuration;
|
||||
@@ -152,6 +137,27 @@ import forestry.core.render.EntitySnowFX;
|
||||
import forestry.core.triggers.Trigger;
|
||||
import forestry.core.utils.LiquidHelper;
|
||||
import forestry.core.utils.ShapedRecipeCustom;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.command.ICommand;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.IRecipe;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.WeightedRandomChestContent;
|
||||
import net.minecraftforge.client.event.TextureStitchEvent;
|
||||
import net.minecraftforge.common.BiomeDictionary;
|
||||
import net.minecraftforge.common.ChestGenHooks;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@Plugin(pluginID = "Apiculture", name = "Apiculture", author = "SirSengir", url = Defaults.URL, unlocalizedDescription = "for.plugin.apiculture.description")
|
||||
public class PluginApiculture extends ForestryPlugin {
|
||||
@@ -238,6 +244,8 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 7);
|
||||
ForestryBlock.beehives.block().setHarvestLevel("scoop", 0, 8);
|
||||
|
||||
createHives();
|
||||
|
||||
// Init bee interface
|
||||
AlleleManager.alleleRegistry.registerSpeciesRoot(PluginApiculture.beeInterface = new BeeHelper());
|
||||
BeeManager.villageBees = new ArrayList[]{new ArrayList<IBeeGenome>(), new ArrayList<IBeeGenome>()};
|
||||
@@ -345,7 +353,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
public void postInit() {
|
||||
super.postInit();
|
||||
registerDungeonLoot();
|
||||
|
||||
updateHiveDrops();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -777,6 +785,7 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
}
|
||||
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
@Deprecated // deprecated since 3.1. remove when BeeManager.hiveDrops is removed
|
||||
private void createHiveDropArrays() {
|
||||
|
||||
BeeManager.hiveDrops = new ArrayList[8];
|
||||
@@ -806,6 +815,47 @@ public class PluginApiculture extends ForestryPlugin {
|
||||
BeeManager.hiveDrops[7] = swarmDrops;
|
||||
}
|
||||
|
||||
private void createHives() {
|
||||
HiveManager.addHive(new HiveForest(3));
|
||||
HiveManager.addHive(new HiveMeadows(1));
|
||||
HiveManager.addHive(new HiveParched(1));
|
||||
HiveManager.addHive(new HiveJungle(4));
|
||||
HiveManager.addHive(new HiveEnd(4));
|
||||
HiveManager.addHive(new HiveSnow(2));
|
||||
HiveManager.addHive(new HiveSwamp(2));
|
||||
}
|
||||
|
||||
@Deprecated // deprecated since 3.1. remove when BeeManager.hiveDrops is removed
|
||||
private void updateHiveDrops() {
|
||||
IHive hive = HiveManager.getForestHive();
|
||||
for (IHiveDrop drop : forestDrops)
|
||||
hive.addDrop(drop);
|
||||
|
||||
hive = HiveManager.getMeadowsHive();
|
||||
for (IHiveDrop drop : meadowsDrops)
|
||||
hive.addDrop(drop);
|
||||
|
||||
hive = HiveManager.getDesertHive();
|
||||
for (IHiveDrop drop : desertDrops)
|
||||
hive.addDrop(drop);
|
||||
|
||||
hive = HiveManager.getJungleHive();
|
||||
for (IHiveDrop drop : jungleDrops)
|
||||
hive.addDrop(drop);
|
||||
|
||||
hive = HiveManager.getEndHive();
|
||||
for (IHiveDrop drop : endDrops)
|
||||
hive.addDrop(drop);
|
||||
|
||||
hive = HiveManager.getSnowHive();
|
||||
for (IHiveDrop drop : snowDrops)
|
||||
hive.addDrop(drop);
|
||||
|
||||
hive = HiveManager.getSwampHive();
|
||||
for (IHiveDrop drop : swampDrops)
|
||||
hive.addDrop(drop);
|
||||
}
|
||||
|
||||
private void createAlleles() {
|
||||
|
||||
IClassification hymnoptera = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.ORDER, "hymnoptera", "Hymnoptera");
|
||||
|
||||
Reference in new issue
Block a user