Files
ForestryMC/src/main/java/forestry/plugins/PluginApiculture.java
T

1114 lines
49 KiB
Java
Raw Normal View History

2014-05-02 21:31:20 +02:00
/*******************************************************************************
2014-08-07 08:29:25 +02:00
* 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
2014-08-07 02:56:58 -07:00
* http://www.gnu.org/licenses/lgpl-3.0.txt
*
2014-08-07 08:29:25 +02:00
* Various Contributors including, but not limited to:
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
2014-05-02 21:31:20 +02:00
******************************************************************************/
package forestry.plugins;
import com.google.common.collect.ImmutableMap;
import java.io.File;
2014-12-26 02:13:39 -08:00
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
2015-06-29 22:15:39 -07:00
import java.util.Set;
2014-12-26 02:13:39 -08:00
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
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.minecraft.world.World;
import net.minecraft.world.chunk.IChunkProvider;
2014-12-26 02:13:39 -08:00
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.common.ChestGenHooks;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Property;
2014-12-26 02:13:39 -08:00
import net.minecraftforge.oredict.OreDictionary;
2014-05-02 21:31:20 +02:00
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInterModComms.IMCMessage;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.GameData;
2014-05-02 21:31:20 +02:00
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 forestry.Forestry;
2014-05-02 21:31:20 +02:00
import forestry.api.apiculture.BeeManager;
import forestry.api.apiculture.EnumBeeType;
import forestry.api.apiculture.FlowerManager;
import forestry.api.apiculture.IBeekeepingMode;
2014-10-03 02:08:41 -07:00
import forestry.api.apiculture.hives.HiveManager;
2014-05-02 21:31:20 +02:00
import forestry.api.core.Tabs;
import forestry.api.genetics.AlleleManager;
import forestry.api.genetics.IClassification;
import forestry.api.genetics.IClassification.EnumClassLevel;
import forestry.api.genetics.IFlower;
import forestry.api.genetics.IFlowerRegistry;
2014-05-02 21:31:20 +02:00
import forestry.api.recipes.RecipeManagers;
2014-12-26 02:13:39 -08:00
import forestry.api.storage.ICrateRegistry;
import forestry.api.storage.StorageManager;
import forestry.apiculture.ArmorApiaristHelper;
2014-05-02 21:31:20 +02:00
import forestry.apiculture.GuiHandlerApiculture;
import forestry.apiculture.SaveEventHandlerApiculture;
import forestry.apiculture.VillageHandlerApiculture;
import forestry.apiculture.blocks.BlockAlveary;
import forestry.apiculture.blocks.BlockBeehives;
import forestry.apiculture.blocks.BlockCandle;
import forestry.apiculture.blocks.BlockStump;
import forestry.apiculture.commands.CommandBee;
import forestry.apiculture.flowers.FlowerRegistry;
import forestry.apiculture.genetics.BeeBranchDefinition;
import forestry.apiculture.genetics.BeeDefinition;
import forestry.apiculture.genetics.BeeFactory;
2014-05-02 21:31:20 +02:00
import forestry.apiculture.genetics.BeeHelper;
import forestry.apiculture.genetics.BeeMutationFactory;
2014-05-02 21:31:20 +02:00
import forestry.apiculture.genetics.BeekeepingMode;
import forestry.apiculture.genetics.HiveDrop;
import forestry.apiculture.genetics.JubilanceFactory;
import forestry.apiculture.genetics.alleles.AlleleEffect;
import forestry.apiculture.genetics.alleles.AlleleEffectAggressive;
import forestry.apiculture.genetics.alleles.AlleleEffectCreeper;
import forestry.apiculture.genetics.alleles.AlleleEffectExploration;
import forestry.apiculture.genetics.alleles.AlleleEffectFertile;
import forestry.apiculture.genetics.alleles.AlleleEffectFungification;
import forestry.apiculture.genetics.alleles.AlleleEffectGlacial;
import forestry.apiculture.genetics.alleles.AlleleEffectHeroic;
import forestry.apiculture.genetics.alleles.AlleleEffectIgnition;
import forestry.apiculture.genetics.alleles.AlleleEffectMisanthrope;
import forestry.apiculture.genetics.alleles.AlleleEffectNone;
import forestry.apiculture.genetics.alleles.AlleleEffectPotion;
import forestry.apiculture.genetics.alleles.AlleleEffectRadioactive;
import forestry.apiculture.genetics.alleles.AlleleEffectRepulsion;
import forestry.apiculture.genetics.alleles.AlleleEffectResurrection;
import forestry.apiculture.genetics.alleles.AlleleEffectSnowing;
2014-05-02 21:31:20 +02:00
import forestry.apiculture.items.ItemArmorApiarist;
import forestry.apiculture.items.ItemBeeGE;
import forestry.apiculture.items.ItemBeealyzer;
import forestry.apiculture.items.ItemBlockCandle;
import forestry.apiculture.items.ItemHabitatLocator;
2014-05-02 21:31:20 +02:00
import forestry.apiculture.items.ItemHiveFrame;
import forestry.apiculture.items.ItemHoneycomb;
import forestry.apiculture.items.ItemImprinter;
import forestry.apiculture.items.ItemWaxCast;
2015-06-29 22:15:39 -07:00
import forestry.apiculture.multiblock.TileAlveary;
import forestry.apiculture.multiblock.TileAlvearyFan;
import forestry.apiculture.multiblock.TileAlvearyHeater;
import forestry.apiculture.multiblock.TileAlvearyHygroregulator;
import forestry.apiculture.multiblock.TileAlvearyPlain;
import forestry.apiculture.multiblock.TileAlvearySieve;
import forestry.apiculture.multiblock.TileAlvearyStabiliser;
import forestry.apiculture.multiblock.TileAlvearySwarmer;
import forestry.apiculture.network.PacketActiveUpdate;
import forestry.apiculture.network.PacketBeekeepingLogicActive;
import forestry.apiculture.network.PacketCandleUpdate;
import forestry.apiculture.network.PacketHabitatBiomePointer;
import forestry.apiculture.network.PacketImprintSelectionResponse;
2014-05-02 21:31:20 +02:00
import forestry.apiculture.proxy.ProxyApiculture;
import forestry.apiculture.tiles.TileApiaristChest;
import forestry.apiculture.tiles.TileApiary;
import forestry.apiculture.tiles.TileBeehouse;
import forestry.apiculture.tiles.TileCandle;
import forestry.apiculture.tiles.TileSwarm;
2014-11-26 23:40:37 -08:00
import forestry.apiculture.trigger.ApicultureTriggers;
2014-05-02 21:31:20 +02:00
import forestry.apiculture.worldgen.HiveDecorator;
import forestry.apiculture.worldgen.HiveDescription;
import forestry.apiculture.worldgen.HiveGenHelper;
import forestry.apiculture.worldgen.HiveRegistry;
import forestry.core.ISaveEventHandler;
import forestry.core.blocks.BlockBase;
2014-05-02 21:31:20 +02:00
import forestry.core.config.Config;
import forestry.core.config.Constants;
2014-05-02 21:31:20 +02:00
import forestry.core.config.ForestryBlock;
import forestry.core.config.ForestryItem;
import forestry.core.config.GameMode;
2015-06-21 22:34:42 -07:00
import forestry.core.config.LocalizedConfiguration;
import forestry.core.entities.EntityFXSnow;
2014-12-13 18:58:49 -08:00
import forestry.core.fluids.Fluids;
import forestry.core.items.ItemBlockForestry;
2014-05-02 21:31:20 +02:00
import forestry.core.items.ItemForestry;
import forestry.core.items.ItemOverlay;
import forestry.core.items.ItemOverlay.OverlayInfo;
import forestry.core.items.ItemScoop;
import forestry.core.network.PacketIdClient;
2014-05-02 21:31:20 +02:00
import forestry.core.proxy.Proxies;
2015-10-17 12:25:13 -07:00
import forestry.core.recipes.RecipeUtil;
import forestry.core.recipes.ShapedRecipeCustom;
import forestry.core.tiles.MachineDefinition;
import forestry.core.tiles.TileAnalyzer;
import forestry.core.utils.ItemStackUtil;
import forestry.core.utils.Log;
import forestry.core.utils.Stack;
2015-06-21 22:34:42 -07:00
import forestry.core.utils.StringUtil;
2014-05-02 21:31:20 +02:00
@Plugin(pluginID = "Apiculture", name = "Apiculture", author = "SirSengir", url = Constants.URL, unlocalizedDescription = "for.plugin.apiculture.description")
public class PluginApiculture extends ForestryPlugin {
2014-05-02 21:31:20 +02:00
@SidedProxy(clientSide = "forestry.apiculture.proxy.ProxyApicultureClient", serverSide = "forestry.apiculture.proxy.ProxyApiculture")
2014-05-02 21:31:20 +02:00
public static ProxyApiculture proxy;
private static final String CONFIG_CATEGORY = "apiculture";
2015-08-02 01:15:41 -07:00
private static final String[] EMPTY_STRINGS = new String[0];
2014-05-02 21:31:20 +02:00
public static String beekeepingMode = "NORMAL";
2015-06-21 22:34:42 -07:00
private static float secondPrincessChance = 0;
2015-06-29 22:15:39 -07:00
public static final int ticksPerBeeWorkCycle = 550;
2014-05-02 21:31:20 +02:00
public static boolean fancyRenderedBees = false;
2015-04-12 21:07:49 -07:00
public static HiveRegistry hiveRegistry;
2015-08-02 01:15:41 -07:00
private static MachineDefinition definitionApiary;
2015-09-23 00:24:48 -07:00
private static MachineDefinition definitionChestLegacy;
2015-08-02 01:15:41 -07:00
private static MachineDefinition definitionChest;
private static MachineDefinition definitionBeehouse;
private static MachineDefinition definitionAnalyzer;
2014-05-02 21:31:20 +02:00
2015-10-10 04:16:52 -07:00
private final Map<String, String[]> defaultAcceptedFlowers = new HashMap<>();
private final Map<String, String[]> defaultPlantableFlowers = new HashMap<>();
2014-05-02 21:31:20 +02:00
@Override
@SuppressWarnings({"unchecked"})
2015-04-05 14:16:41 -07:00
protected void setupAPI() {
super.setupAPI();
2014-05-02 21:31:20 +02:00
HiveManager.hiveRegistry = hiveRegistry = new HiveRegistry();
HiveManager.genHelper = new HiveGenHelper();
2014-05-02 21:31:20 +02:00
FlowerManager.flowerRegistry = new FlowerRegistry();
2015-10-10 04:16:52 -07:00
BeeManager.villageBees = new ArrayList[]{new ArrayList<>(), new ArrayList<>()};
2015-04-05 14:16:41 -07:00
BeeManager.beeFactory = new BeeFactory();
BeeManager.beeMutationFactory = new BeeMutationFactory();
BeeManager.jubilanceFactory = new JubilanceFactory();
BeeManager.armorApiaristHelper = new ArmorApiaristHelper();
2015-04-05 14:16:41 -07:00
// Init bee interface
BeeManager.beeRoot = new BeeHelper();
AlleleManager.alleleRegistry.registerSpeciesRoot(BeeManager.beeRoot);
2015-04-05 14:16:41 -07:00
// Modes
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.easy);
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.normal);
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.hard);
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.hardcore);
BeeManager.beeRoot.registerBeekeepingMode(BeekeepingMode.insane);
2015-04-05 14:16:41 -07:00
}
@Override
public void preInit() {
super.preInit();
MinecraftForge.EVENT_BUS.register(this);
ForestryBlock.apiculture.registerBlock(new BlockBase(Material.iron), ItemBlockForestry.class, "apiculture");
ForestryBlock.apiculture.block().setCreativeTab(Tabs.tabApiculture);
ForestryBlock.apiculture.block().setHarvestLevel("axe", 0);
ForestryBlock.apicultureChest.registerBlock(new BlockBase(Material.iron, true), ItemBlockForestry.class, "apicultureChest");
2015-09-23 00:24:48 -07:00
ForestryBlock.apicultureChest.block().setCreativeTab(Tabs.tabApiculture);
ForestryBlock.apicultureChest.block().setHarvestLevel("axe", 0);
definitionApiary = ((BlockBase) ForestryBlock.apiculture.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_APIARY_META, "forestry.Apiary", TileApiary.class,
ShapedRecipeCustom.createShapedRecipe(ForestryBlock.apiculture.getItemStack(1, Constants.DEFINITION_APIARY_META),
"XXX",
"#C#",
"###",
'X', "slabWood",
'#', "plankWood",
'C', ForestryItem.impregnatedCasing))
.setFaces(0, 1, 2, 2, 4, 4, 0, 7));
definitionChestLegacy = ((BlockBase) ForestryBlock.apiculture.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_APIARISTCHEST_LEGACY_META, "forestry.ApiaristChest", TileApiaristChest.class).setLegacy());
2015-09-23 00:24:48 -07:00
definitionChest = ((BlockBase) ForestryBlock.apicultureChest.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_APIARISTCHEST_META, "forestry.ApiaristChestNew", TileApiaristChest.class, Proxies.render.getRenderChest("apiaristchest"),
ShapedRecipeCustom.createShapedRecipe(ForestryBlock.apicultureChest.getItemStack(1, Constants.DEFINITION_APIARISTCHEST_META),
" # ",
"XYX",
"XXX",
2015-08-21 01:45:09 -05:00
'#', "blockGlass",
'X', "beeComb",
'Y', "chestWood"))
.setBoundingBox(0.0625F, 0.0F, 0.0625F, 0.9375F, 0.875F, 0.9375F));
definitionBeehouse = ((BlockBase) ForestryBlock.apiculture.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_BEEHOUSE_META, "forestry.Beehouse", TileBeehouse.class,
ShapedRecipeCustom.createShapedRecipe(ForestryBlock.apiculture.getItemStack(1, Constants.DEFINITION_BEEHOUSE_META),
"XXX",
"#C#",
"###",
'X', "slabWood",
'#', "plankWood",
'C', "beeComb"))
.setFaces(0, 1, 2, 2, 4, 4, 0, 7));
definitionAnalyzer = ((BlockBase) ForestryBlock.core.block()).addDefinition(new MachineDefinition(Constants.DEFINITION_ANALYZER_META, "forestry.Analyzer", TileAnalyzer.class,
PluginApiculture.proxy.getRendererAnalyzer(Constants.TEXTURE_PATH_BLOCKS + "/analyzer_")));
ForestryBlock.beehives.registerBlock(new BlockBeehives(), ItemBlockForestry.class, "beehives");
2014-05-02 21:31:20 +02:00
// Candles
ForestryBlock.candle.registerBlock(new BlockCandle(), ItemBlockCandle.class, "candle");
ForestryBlock.stump.registerBlock(new BlockStump(), ItemBlockForestry.class, "stump");
2014-05-02 21:31:20 +02:00
// Alveary and Components
2015-10-21 22:02:58 -07:00
ForestryBlock.alveary.registerBlock(new BlockAlveary(), ItemBlockForestry.class, "alveary");
ForestryBlock.alveary.block().setHarvestLevel("axe", 0);
2014-05-02 21:31:20 +02:00
// Add triggers
2014-11-29 19:53:40 -08:00
if (PluginManager.Module.BUILDCRAFT_STATEMENTS.isEnabled()) {
2014-11-26 23:40:37 -08:00
ApicultureTriggers.initialize();
}
2014-05-02 21:31:20 +02:00
2015-06-21 22:34:42 -07:00
if (Config.enableVillagers) {
// Register village components with the Structure registry.
VillageHandlerApiculture.registerVillageComponents();
}
2014-11-14 22:49:26 -08:00
// Commands
PluginCore.rootCommand.addChildCommand(new CommandBee());
2014-05-02 21:31:20 +02:00
}
@Override
public void doInit() {
final String oldConfig = CONFIG_CATEGORY + ".conf";
final String newConfig = CONFIG_CATEGORY + ".cfg";
2014-05-02 21:31:20 +02:00
File configFile = new File(Forestry.instance.getConfigFolder(), newConfig);
if (!configFile.exists()) {
setDefaultsForConfig();
}
File oldConfigFile = new File(Forestry.instance.getConfigFolder(), oldConfig);
if (oldConfigFile.exists()) {
loadOldConfig();
final String oldConfigRenamed = CONFIG_CATEGORY + ".conf.old";
File oldConfigFileRenamed = new File(Forestry.instance.getConfigFolder(), oldConfigRenamed);
if (oldConfigFile.renameTo(oldConfigFileRenamed)) {
Log.info("Migrated " + CONFIG_CATEGORY + " settings to the new file '" + newConfig + "' and renamed '" + oldConfig + "' to '" + oldConfigRenamed + "'.");
}
}
LocalizedConfiguration config = new LocalizedConfiguration(configFile, "2.0.0");
if (!config.getLoadedConfigVersion().equals(config.getDefinedConfigVersion())) {
boolean deleted = configFile.delete();
if (deleted) {
config = new LocalizedConfiguration(configFile, "2.0.0");
setDefaultsForConfig();
}
}
2014-05-02 21:31:20 +02:00
List<IBeekeepingMode> beekeepingModes = BeeManager.beeRoot.getBeekeepingModes();
String[] validBeekeepingModeNames = new String[beekeepingModes.size()];
for (int i = 0; i < beekeepingModes.size(); i++) {
validBeekeepingModeNames[i] = beekeepingModes.get(i).getName();
}
2015-06-21 22:34:42 -07:00
beekeepingMode = config.getStringLocalized("beekeeping", "mode", "NORMAL", validBeekeepingModeNames);
Log.finer("Beekeeping mode read from config: " + beekeepingMode);
2014-05-02 21:31:20 +02:00
2015-06-21 22:34:42 -07:00
secondPrincessChance = config.getFloatLocalized("beekeeping", "second.princess", secondPrincessChance, 0.0f, 100.0f);
String acceptedFlowerMessage = StringUtil.localize("config.beekeeping.flowers.accepted.comment");
String plantableFlowerMessage = StringUtil.localize("config.beekeeping.flowers.plantable.comment");
for (String flowerType : FlowerManager.flowerRegistry.getFlowerTypes()) {
String[] defaultAccepted = defaultAcceptedFlowers.get(flowerType);
if (defaultAccepted == null) {
defaultAccepted = EMPTY_STRINGS;
}
2015-06-21 22:34:42 -07:00
Property property = config.get("beekeeping.flowers." + flowerType, "accepted", defaultAccepted);
property.comment = acceptedFlowerMessage;
parseAcceptedFlowers(property.getStringList(), flowerType);
2014-05-02 21:31:20 +02:00
String[] defaultPlantable = defaultPlantableFlowers.get(flowerType);
if (defaultPlantable == null) {
defaultPlantable = EMPTY_STRINGS;
}
property = config.get("beekeeping.flowers." + flowerType, "plantable", defaultPlantable);
2015-06-21 22:34:42 -07:00
property.comment = plantableFlowerMessage;
parsePlantableFlowers(property, flowerType);
2015-06-29 22:15:39 -07:00
Set<IFlower> acceptableFlowers = FlowerManager.flowerRegistry.getAcceptableFlowers(flowerType);
if (acceptableFlowers == null || acceptableFlowers.size() == 0) {
Log.severe("Flower type '" + flowerType + "' has no valid flowers set in apiculture.cfg. Add valid flowers or delete the config to set it to default.");
}
}
2014-05-02 21:31:20 +02:00
2015-06-21 22:34:42 -07:00
String[] blacklist = config.getStringListLocalized("species", "blacklist", EMPTY_STRINGS);
parseBeeBlacklist(blacklist);
config.save();
2014-05-02 21:31:20 +02:00
// Genetics
createAlleles();
BeeDefinition.initBees();
AlleleManager.alleleRegistry.registerDeprecatedAlleleReplacement("forestry.speciesArgrarian", BeeDefinition.AGRARIAN.getGenome().getPrimary());
// Hives
createHives();
registerBeehiveDrops();
2014-05-02 21:31:20 +02:00
// Inducers for swarmer
BeeManager.inducers.put(ForestryItem.royalJelly.getItemStack(), 10);
GameRegistry.registerTileEntity(TileAlvearyPlain.class, "forestry.Alveary");
GameRegistry.registerTileEntity(TileSwarm.class, "forestry.Swarm");
GameRegistry.registerTileEntity(TileAlvearySwarmer.class, "forestry.AlvearySwarmer");
GameRegistry.registerTileEntity(TileAlvearyHeater.class, "forestry.AlvearyHeater");
GameRegistry.registerTileEntity(TileAlvearyFan.class, "forestry.AlvearyFan");
GameRegistry.registerTileEntity(TileAlvearyHygroregulator.class, "forestry.AlvearyHygro");
GameRegistry.registerTileEntity(TileAlvearyStabiliser.class, "forestry.AlvearyStabiliser");
GameRegistry.registerTileEntity(TileAlvearySieve.class, "forestry.AlvearySieve");
GameRegistry.registerTileEntity(TileCandle.class, "forestry.Candle");
BeeManager.villageBees[0].add(BeeDefinition.FOREST.getGenome());
BeeManager.villageBees[0].add(BeeDefinition.MEADOWS.getGenome());
BeeManager.villageBees[0].add(BeeDefinition.MODEST.getGenome());
BeeManager.villageBees[0].add(BeeDefinition.MARSHY.getGenome());
BeeManager.villageBees[0].add(BeeDefinition.WINTRY.getGenome());
BeeManager.villageBees[0].add(BeeDefinition.TROPICAL.getGenome());
BeeManager.villageBees[1].add(BeeDefinition.FOREST.getRainResist().getGenome());
BeeManager.villageBees[1].add(BeeDefinition.COMMON.getGenome());
BeeManager.villageBees[1].add(BeeDefinition.VALIANT.getGenome());
2014-05-02 21:31:20 +02:00
2015-06-21 22:34:42 -07:00
if (Config.enableVillagers) {
// Register villager stuff
VillageHandlerApiculture villageHandler = new VillageHandlerApiculture();
VillagerRegistry.instance().registerVillageCreationHandler(villageHandler);
VillagerRegistry.instance().registerVillagerId(Constants.ID_VILLAGER_BEEKEEPER);
Proxies.render.registerVillagerSkin(Constants.ID_VILLAGER_BEEKEEPER, Constants.TEXTURE_SKIN_BEEKPEEPER);
VillagerRegistry.instance().registerVillageTradeHandler(Constants.ID_VILLAGER_BEEKEEPER, villageHandler);
}
2014-05-02 21:31:20 +02:00
proxy.initializeRendering();
}
@Override
public void postInit() {
super.postInit();
registerDungeonLoot();
}
private void setDefaultsForConfig() {
IFlowerRegistry flowerRegistry = FlowerManager.flowerRegistry;
// Register acceptable plants
flowerRegistry.registerAcceptableFlower(Blocks.dragon_egg, FlowerManager.FlowerTypeEnd);
flowerRegistry.registerAcceptableFlower(Blocks.vine, FlowerManager.FlowerTypeJungle);
flowerRegistry.registerAcceptableFlower(Blocks.tallgrass, FlowerManager.FlowerTypeJungle);
flowerRegistry.registerAcceptableFlower(Blocks.wheat, FlowerManager.FlowerTypeWheat);
flowerRegistry.registerAcceptableFlower(Blocks.pumpkin_stem, FlowerManager.FlowerTypeGourd);
flowerRegistry.registerAcceptableFlower(Blocks.melon_stem, FlowerManager.FlowerTypeGourd);
flowerRegistry.registerAcceptableFlower(Blocks.nether_wart, FlowerManager.FlowerTypeNether);
flowerRegistry.registerAcceptableFlower(Blocks.cactus, FlowerManager.FlowerTypeCacti);
flowerRegistry.registerAcceptableFlower(Blocks.double_plant, 0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
flowerRegistry.registerAcceptableFlower(Blocks.double_plant, 1, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
flowerRegistry.registerAcceptableFlower(Blocks.double_plant, 4, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
flowerRegistry.registerAcceptableFlower(Blocks.double_plant, 5, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
// Register plantable plants
for (int meta = 0; meta <= 8; meta++) {
flowerRegistry.registerPlantableFlower(Blocks.red_flower, meta, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
}
flowerRegistry.registerPlantableFlower(Blocks.yellow_flower, 0, 1.0, FlowerManager.FlowerTypeVanilla, FlowerManager.FlowerTypeSnow);
flowerRegistry.registerPlantableFlower(Blocks.brown_mushroom, 0, 1.0, FlowerManager.FlowerTypeMushrooms);
flowerRegistry.registerPlantableFlower(Blocks.red_mushroom, 0, 1.0, FlowerManager.FlowerTypeMushrooms);
flowerRegistry.registerPlantableFlower(Blocks.cactus, 0, 1.0, FlowerManager.FlowerTypeCacti);
for (String flowerType : FlowerManager.flowerRegistry.getFlowerTypes()) {
2015-06-29 22:15:39 -07:00
Set<IFlower> flowers = FlowerManager.flowerRegistry.getAcceptableFlowers(flowerType);
2015-10-10 04:16:52 -07:00
List<String> acceptedFlowerNames = new ArrayList<>();
List<String> plantableFlowerNames = new ArrayList<>();
if (flowers != null) {
for (IFlower flower : flowers) {
String name = GameData.getBlockRegistry().getNameForObject(flower.getBlock());
if (name == null) {
Log.severe("Could not find name for flower: " + flower + " with type: " + flowerType);
continue;
}
int meta = flower.getMeta();
if (flower.getMeta() != OreDictionary.WILDCARD_VALUE) {
name = name + ':' + meta;
}
if (flower.isPlantable()) {
plantableFlowerNames.add(name);
} else {
acceptedFlowerNames.add(name);
}
}
}
String[] acceptedFlowerNamesArray = acceptedFlowerNames.toArray(new String[acceptedFlowerNames.size()]);
defaultAcceptedFlowers.put(flowerType, acceptedFlowerNamesArray);
String[] plantableFlowerNamesArray = plantableFlowerNames.toArray(new String[plantableFlowerNames.size()]);
defaultPlantableFlowers.put(flowerType, plantableFlowerNamesArray);
}
}
private static void loadOldConfig() {
// Config
2015-06-21 00:22:13 -07:00
forestry.core.config.deprecated.Configuration apicultureConfig = new forestry.core.config.deprecated.Configuration();
2015-08-02 01:15:41 -07:00
forestry.core.config.deprecated.Property property = apicultureConfig.get("render.bees.fancy", CONFIG_CATEGORY, fancyRenderedBees);
property.comment = "set to true to enable a fancy butterfly-like renderer for bees. (experimental!)";
fancyRenderedBees = Boolean.parseBoolean(property.value);
property = apicultureConfig.get("beekeeping.mode", CONFIG_CATEGORY, "NORMAL");
property.comment = "change beekeeping modes here. possible values EASY, NORMAL, HARD, HARDCORE, INSANE. mods may add additional modes.";
beekeepingMode = property.value.trim();
Log.finer("Beekeeping mode read from config: " + beekeepingMode);
2015-06-21 22:34:42 -07:00
property = apicultureConfig.get("beekeeping.secondprincess", CONFIG_CATEGORY, secondPrincessChance);
property.comment = "percent chance of second princess drop, for limited/skyblock maps. Acceptable values up to 2 decimals.";
secondPrincessChance = Float.parseFloat(property.value);
property = apicultureConfig.get("species.blacklist", CONFIG_CATEGORY, "");
property.comment = "add species to blacklist identified by their uid and seperated with ';'.";
parseBeeBlacklist(property.value);
}
2014-05-02 21:31:20 +02:00
@Override
public IGuiHandler getGuiHandler() {
return new GuiHandlerApiculture();
}
@Override
public void registerPacketHandlers() {
PacketIdClient.IMPRINT_SELECTION_RESPONSE.setPacketHandler(new PacketImprintSelectionResponse());
PacketIdClient.TILE_FORESTRY_ACTIVE.setPacketHandler(new PacketActiveUpdate());
PacketIdClient.BEE_LOGIC_ACTIVE.setPacketHandler(new PacketBeekeepingLogicActive());
PacketIdClient.HABITAT_BIOME_POINTER.setPacketHandler(new PacketHabitatBiomePointer());
PacketIdClient.CANDLE_UPDATE.setPacketHandler(new PacketCandleUpdate());
2014-05-02 21:31:20 +02:00
}
@Override
protected void registerItems() {
// / BEES
ForestryItem.beeQueenGE.registerItem((new ItemBeeGE(EnumBeeType.QUEEN)), "beeQueenGE");
ForestryItem.beeDroneGE.registerItem((new ItemBeeGE(EnumBeeType.DRONE)), "beeDroneGE");
ForestryItem.beePrincessGE.registerItem((new ItemBeeGE(EnumBeeType.PRINCESS)), "beePrincessGE");
ForestryItem.beeLarvaeGE.registerItem((new ItemBeeGE(EnumBeeType.LARVAE)), "beeLarvaeGE");
ForestryItem.beealyzer.registerItem((new ItemBeealyzer()), "beealyzer");
ForestryItem.habitatLocator.registerItem(new ItemHabitatLocator(), "habitatLocator");
2014-05-02 21:31:20 +02:00
ForestryItem.imprinter.registerItem((new ItemImprinter()), "imprinter");
// / COMB FRAMES
ForestryItem.frameUntreated.registerItem(new ItemHiveFrame(80, 0.9f), "frameUntreated");
ForestryItem.frameImpregnated.registerItem(new ItemHiveFrame(240, 0.4f), "frameImpregnated");
ForestryItem.frameProven.registerItem(new ItemHiveFrame(720, 0.3f), "frameProven");
// / BEE RESOURCES
ForestryItem.honeyDrop.registerItem(new ItemOverlay(Tabs.tabApiculture,
new OverlayInfo("honey", 0xecb42d, 0xe8c814),
new OverlayInfo("charged", 0x800505, 0x9c0707).setIsSecret(),
2014-05-02 21:31:20 +02:00
new OverlayInfo("omega", 0x191919, 0x4a8ca7).setIsSecret()), "honeyDrop");
OreDictionary.registerOre("dropHoney", ForestryItem.honeyDrop.getItemStack());
ForestryItem.pollenCluster.registerItem(new ItemOverlay(Tabs.tabApiculture,
new OverlayInfo("normal", 0xa28a25, 0xa28a25),
new OverlayInfo("crystalline", 0xffffff, 0xc5feff)),
2014-05-02 21:31:20 +02:00
"pollen");
OreDictionary.registerOre("itemPollen", ForestryItem.pollenCluster.getItemStack());
2014-05-02 21:31:20 +02:00
ForestryItem.propolis.registerItem(new ItemOverlay(Tabs.tabApiculture,
new OverlayInfo("normal", 0xc5b24e),
new OverlayInfo("sticky", 0xc68e57),
new OverlayInfo("pulsating", 0x2ccdb1).setIsSecret(),
new OverlayInfo("silky", 0xddff00)),
2014-05-02 21:31:20 +02:00
"propolis");
ForestryItem.honeydew.registerItem(new ItemForestry().setCreativeTab(Tabs.tabApiculture), "honeydew");
OreDictionary.registerOre("dropHoneydew", ForestryItem.honeydew.getItemStack());
ForestryItem.royalJelly.registerItem(new ItemForestry().setCreativeTab(Tabs.tabApiculture), "royalJelly");
OreDictionary.registerOre("dropRoyalJelly", ForestryItem.royalJelly.getItemStack());
ForestryItem.waxCast.registerItem(new ItemWaxCast().setCreativeTab(Tabs.tabApiculture), "waxCast");
// / BEE COMBS
ForestryItem.beeComb.registerItem(new ItemHoneycomb(), "beeCombs");
OreDictionary.registerOre("beeComb", ForestryItem.beeComb.getWildcard());
2014-05-02 21:31:20 +02:00
// / APIARIST'S CLOTHES
ForestryItem.apiaristHat.registerItem(new ItemArmorApiarist(0), "apiaristHelmet");
ForestryItem.apiaristChest.registerItem(new ItemArmorApiarist(1), "apiaristChest");
ForestryItem.apiaristLegs.registerItem(new ItemArmorApiarist(2), "apiaristLegs");
ForestryItem.apiaristBoots.registerItem(new ItemArmorApiarist(3), "apiaristBoots");
// TOOLS
ForestryItem.scoop.registerItem(new ItemScoop(), "scoop");
ForestryItem.scoop.item().setHarvestLevel("scoop", 3);
2014-05-02 21:31:20 +02:00
}
@Override
protected void registerCrates() {
2014-12-26 02:13:39 -08:00
ICrateRegistry crateRegistry = StorageManager.crateRegistry;
crateRegistry.registerCrate(ForestryItem.beeswax.getItemStack(), "cratedBeeswax");
crateRegistry.registerCrate(ForestryItem.pollenCluster.getItemStack(), "cratedPollen");
crateRegistry.registerCrate(ForestryItem.propolis.getItemStack(), "cratedPropolis");
crateRegistry.registerCrate(ForestryItem.honeydew.getItemStack(), "cratedHoneydew");
crateRegistry.registerCrate(ForestryItem.royalJelly.getItemStack(), "cratedRoyalJelly");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 0), "cratedHoneycombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 1), "cratedCocoaComb");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 2), "cratedSimmeringCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 3), "cratedStringyCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 4), "cratedFrozenCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 5), "cratedDrippingCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 6), "cratedSilkyCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 7), "cratedParchedCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 8), "cratedMysteriousCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 10), "cratedPowderyCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 14), "cratedWheatenCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 15), "cratedMossyCombs");
crateRegistry.registerCrate(ForestryItem.beeComb.getItemStack(1, 16), "cratedMellowCombs");
2014-12-26 02:13:39 -08:00
crateRegistry.registerCrate(ForestryItem.refractoryWax.getItemStack(), "cratedRefractoryWax");
2014-05-02 21:31:20 +02:00
}
@Override
protected void registerRecipes() {
// / APIARIST'S ARMOR
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.apiaristHat.getItemStack(),
2014-09-24 18:01:00 -07:00
"###", "# #",
'#', ForestryItem.craftingMaterial.getItemStack(1, 3));
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.apiaristChest.getItemStack(),
2014-09-24 18:01:00 -07:00
"# #", "###", "###",
'#', ForestryItem.craftingMaterial.getItemStack(1, 3));
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.apiaristLegs.getItemStack(),
2014-09-24 18:01:00 -07:00
"###", "# #", "# #",
'#', ForestryItem.craftingMaterial.getItemStack(1, 3));
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.apiaristBoots.getItemStack(),
2014-09-24 18:01:00 -07:00
"# #", "# #",
'#', ForestryItem.craftingMaterial.getItemStack(1, 3));
2014-05-02 21:31:20 +02:00
// / HABITAT LOCATOR
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.habitatLocator.getItemStack(),
" X ",
"X#X",
" X ",
2015-08-21 01:45:09 -05:00
'#', "dustRedstone", 'X', "ingotBronze");
2014-05-02 21:31:20 +02:00
// Bees
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.scoop.getItemStack(1),
2014-05-02 21:31:20 +02:00
"#X#", "###", " # ",
'#', "stickWood",
'X', Blocks.wool);
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(new ItemStack(Items.slime_ball),
2014-05-02 21:31:20 +02:00
"#X#", "#X#", "#X#",
'#', ForestryItem.propolis,
'X', ForestryItem.pollenCluster);
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(new ItemStack(Items.speckled_melon),
2014-05-02 21:31:20 +02:00
"#X#", "#Y#", "#X#",
'#', ForestryItem.honeyDrop,
'X', ForestryItem.honeydew,
'Y', Items.melon);
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.frameUntreated.getItemStack(),
2014-05-02 21:31:20 +02:00
"###", "#S#", "###",
'#', "stickWood",
'S', Items.string);
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.frameImpregnated.getItemStack(),
2014-05-02 21:31:20 +02:00
"###", "#S#", "###",
'#', ForestryItem.stickImpregnated,
'S', Items.string);
// FOOD STUFF
if (ForestryItem.honeyedSlice.item() != null) {
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.honeyedSlice.getItemStack(4),
2014-05-02 21:31:20 +02:00
"###", "#X#", "###",
'#', ForestryItem.honeyDrop,
'X', Items.bread);
}
if (ForestryItem.honeyPot.item() != null) {
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.honeyPot.getItemStack(1),
2014-05-02 21:31:20 +02:00
"# #", " X ", "# #",
'#', ForestryItem.honeyDrop,
'X', ForestryItem.waxCapsule);
}
if (ForestryItem.ambrosia.item() != null) {
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.ambrosia.getItemStack(),
2014-05-02 21:31:20 +02:00
"#Y#", "XXX", "###",
'#', ForestryItem.honeydew,
'X', ForestryItem.royalJelly,
'Y', ForestryItem.waxCapsule);
}
2014-05-02 21:31:20 +02:00
// / CAPSULES
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.capsule"), "###", '#', ForestryItem.beeswax);
RecipeUtil.addRecipe(GameMode.getGameMode().getStackSetting("recipe.output.refractory"), "###", '#', ForestryItem.refractoryWax);
2014-05-02 21:31:20 +02:00
// / BITUMINOUS PEAT
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.bituminousPeat.getItemStack(),
2014-09-24 18:01:00 -07:00
" # ", "XYX", " # ",
'#', "dustAsh",
'X', ForestryItem.peat,
'Y', ForestryItem.propolis);
2015-01-07 07:07:45 -08:00
2014-05-02 21:31:20 +02:00
// / TORCHES
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(new ItemStack(Blocks.torch, 3),
2014-09-24 18:01:00 -07:00
" # ", " # ", " Y ",
'#', ForestryItem.beeswax,
'Y', "stickWood");
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.craftingMaterial.getItemStack(1, 1),
2014-09-24 18:01:00 -07:00
"# #", " # ", "# #",
'#', ForestryItem.propolis.getItemStack(1, 2));
2014-05-02 21:31:20 +02:00
// / WAX CAST
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryItem.waxCast.getItemStack(),
"###",
"# #",
"###",
2014-05-02 21:31:20 +02:00
'#', ForestryItem.beeswax);
// / ALVEARY
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.PLAIN_META),
"###",
"#X#",
"###",
2014-05-02 21:31:20 +02:00
'X', ForestryItem.impregnatedCasing,
'#', ForestryItem.craftingMaterial.getItemStack(1, 6));
// SWARMER
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.SWARMER_META),
"#G#",
" X ",
"#G#",
2014-05-02 21:31:20 +02:00
'#', ForestryItem.tubes.getItemStack(1, 5),
'X', ForestryBlock.alveary,
2015-08-21 01:45:09 -05:00
'G', "ingotGold");
2014-05-02 21:31:20 +02:00
// FAN
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.FAN_META),
"I I",
" X ",
"I#I",
2014-05-02 21:31:20 +02:00
'#', ForestryItem.tubes.getItemStack(1, 4),
'X', ForestryBlock.alveary,
2015-08-21 01:45:09 -05:00
'I', "ingotIron");
2014-05-02 21:31:20 +02:00
// HEATER
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.HEATER_META),
"#I#",
" X ",
"YYY",
2014-05-02 21:31:20 +02:00
'#', ForestryItem.tubes.getItemStack(1, 4),
'X', ForestryBlock.alveary,
'I', "ingotIron", 'Y', "stone");
2014-05-02 21:31:20 +02:00
// HYGROREGULATOR
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.HYGRO_META),
"GIG",
"GXG",
"GIG",
2014-05-02 21:31:20 +02:00
'X', ForestryBlock.alveary,
2015-08-21 01:45:09 -05:00
'I', "ingotIron",
'G', "blockGlass");
2014-05-02 21:31:20 +02:00
// STABILISER
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.STABILIZER_META),
"G G",
"GXG",
"G G",
2014-05-02 21:31:20 +02:00
'X', ForestryBlock.alveary,
2015-08-21 01:45:09 -05:00
'G', "gemQuartz");
2014-05-02 21:31:20 +02:00
// SIEVE
2015-10-17 12:25:13 -07:00
RecipeUtil.addRecipe(ForestryBlock.alveary.getItemStack(1, TileAlveary.SIEVE_META),
"III",
" X ",
"WWW",
2014-05-02 21:31:20 +02:00
'X', ForestryBlock.alveary,
2015-08-21 01:45:09 -05:00
'I', "ingotIron",
2014-05-02 21:31:20 +02:00
'W', ForestryItem.craftingMaterial.getItemStack(1, 3));
2015-01-07 07:07:45 -08:00
if (PluginManager.Module.FACTORY.isEnabled()) {
// / SQUEEZER
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.honeyDrop.getItemStack()}, Fluids.HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP),
2015-01-07 07:07:45 -08:00
ForestryItem.propolis.getItemStack(), 5);
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.honeydew.getItemStack()}, Fluids.HONEY.getFluid(Constants.FLUID_PER_HONEY_DROP));
2015-01-07 07:07:45 -08:00
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.sand)}, Fluids.LAVA.getFluid(2000));
2015-08-21 01:45:09 -05:00
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.sand, 1, 1)}, Fluids.LAVA.getFluid(2000));
2015-01-07 07:07:45 -08:00
RecipeManagers.squeezerManager.addRecipe(10, new ItemStack[]{ForestryItem.phosphor.getItemStack(2), new ItemStack(Blocks.dirt)}, Fluids.LAVA.getFluid(1600));
// / CARPENTER
RecipeManagers.carpenterManager.addRecipe(100, Fluids.WATER.getFluid(2000), null, ForestryItem.beealyzer.getItemStack(),
"X#X", "X#X", "RDR",
2015-08-21 01:45:09 -05:00
'#', "paneGlass",
2015-01-07 07:07:45 -08:00
'X', "ingotTin",
2015-08-21 01:45:09 -05:00
'R', "dustRedstone",
'D', "gemDiamond");
2015-01-07 07:07:45 -08:00
RecipeManagers.carpenterManager.addRecipe(50, Fluids.HONEY.getFluid(500), null, ForestryItem.craftingMaterial.getItemStack(1, 6),
" J ", "###", "WPW",
'#', "plankWood",
'J', ForestryItem.royalJelly,
'W', ForestryItem.beeswax,
'P', ForestryItem.pollenCluster);
RecipeManagers.carpenterManager.addRecipe(30, Fluids.WATER.getFluid(600), null, ForestryBlock.candle.getItemStack(24),
" X ",
"###",
"###",
'#', ForestryItem.beeswax,
'X', Items.string);
RecipeManagers.carpenterManager.addRecipe(10, Fluids.WATER.getFluid(200), null, ForestryBlock.candle.getItemStack(6),
"#X#",
'#', ForestryItem.beeswax,
'X', ForestryItem.craftingMaterial.getItemStack(1, 2));
2015-10-17 12:25:13 -07:00
RecipeUtil.addShapelessRecipe(ForestryBlock.candle.getItemStack(), ForestryBlock.candle.getItemStack());
RecipeUtil.addShapelessRecipe(ForestryBlock.candle.getItemStack(1, 1), ForestryBlock.candle.getItemStack(1, 1));
2015-01-07 07:07:45 -08:00
// / CENTRIFUGE
// Honey combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 0), ImmutableMap.of(
ForestryItem.beeswax.getItemStack(), 1.0f,
ForestryItem.honeyDrop.getItemStack(), 0.9f
));
2015-01-07 07:07:45 -08:00
// Cocoa combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 1), ImmutableMap.of(
ForestryItem.beeswax.getItemStack(), 1.0f,
new ItemStack(Items.dye, 1, 3), 0.5f
));
2015-01-07 07:07:45 -08:00
// Simmering combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 2), ImmutableMap.of(
ForestryItem.refractoryWax.getItemStack(), 1.0f,
ForestryItem.phosphor.getItemStack(2), 0.7f
));
2015-01-07 07:07:45 -08:00
// Stringy combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 3), ImmutableMap.of(
ForestryItem.propolis.getItemStack(), 1.0f,
ForestryItem.honeyDrop.getItemStack(), 0.4f
));
// Dripping combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 5), ImmutableMap.of(
ForestryItem.honeydew.getItemStack(), 1.0f,
ForestryItem.honeyDrop.getItemStack(), 0.4f
));
2015-01-07 07:07:45 -08:00
// Frozen combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 4), ImmutableMap.of(
ForestryItem.beeswax.getItemStack(), 0.8f,
ForestryItem.honeyDrop.getItemStack(), 0.7f,
new ItemStack(Items.snowball), 0.4f,
ForestryItem.pollenCluster.getItemStack(1, 1), 0.2f
));
2015-01-07 07:07:45 -08:00
// Silky combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 6), ImmutableMap.of(
ForestryItem.honeyDrop.getItemStack(), 1.0f,
ForestryItem.propolis.getItemStack(1, 3), 0.8f
));
2015-01-07 07:07:45 -08:00
// Parched combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 7), ImmutableMap.of(
ForestryItem.beeswax.getItemStack(), 1.0f,
ForestryItem.honeyDrop.getItemStack(), 0.9f
));
2015-01-07 07:07:45 -08:00
// Mysterious combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 8), ImmutableMap.of(
ForestryItem.propolis.getItemStack(1, 2), 1.0f,
ForestryItem.honeyDrop.getItemStack(), 0.4f
));
2015-01-07 07:07:45 -08:00
// Irradiated combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 9), ImmutableMap.<ItemStack, Float>of(
));
2015-01-07 07:07:45 -08:00
// Powdery combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 10), ImmutableMap.of(
ForestryItem.honeyDrop.getItemStack(), 0.2f,
ForestryItem.beeswax.getItemStack(), 0.2f,
new ItemStack(Items.gunpowder), 0.9f
));
2015-01-07 07:07:45 -08:00
// Wheaten Combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 14), ImmutableMap.of(
ForestryItem.honeyDrop.getItemStack(), 0.2f,
ForestryItem.beeswax.getItemStack(), 0.2f,
new ItemStack(Items.wheat), 0.8f
));
2015-01-07 07:07:45 -08:00
// Mossy Combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 15), ImmutableMap.of(
ForestryItem.beeswax.getItemStack(), 1.0f,
ForestryItem.honeyDrop.getItemStack(), 0.9f
));
2015-01-07 07:07:45 -08:00
// Mellow Combs
RecipeManagers.centrifugeManager.addRecipe(20, ForestryItem.beeComb.getItemStack(1, 16), ImmutableMap.of(
ForestryItem.honeydew.getItemStack(), 0.6f,
ForestryItem.beeswax.getItemStack(), 0.2f,
new ItemStack(Items.quartz), 0.3f
));
// Silky Propolis
RecipeManagers.centrifugeManager.addRecipe(5, ForestryItem.propolis.getItemStack(1, 3), ImmutableMap.of(
ForestryItem.craftingMaterial.getItemStack(1, 2), 0.6f,
ForestryItem.propolis.getItemStack(), 0.1f
));
2015-01-07 07:07:45 -08:00
// / FERMENTER
RecipeManagers.fermenterManager.addRecipe(ForestryItem.honeydew.getItemStack(), 500, 1.0f, Fluids.SHORT_MEAD.getFluid(1), Fluids.HONEY.getFluid(1));
}
2014-05-02 21:31:20 +02:00
// ANALYZER
definitionAnalyzer.recipes = createAlyzerRecipes(ForestryBlock.core.block(), Constants.DEFINITION_ANALYZER_META);
2014-12-07 12:45:21 -08:00
definitionAnalyzer.register();
definitionApiary.register();
definitionBeehouse.register();
2015-09-23 00:24:48 -07:00
definitionChestLegacy.register();
2014-12-07 12:45:21 -08:00
definitionChest.register();
}
2015-08-02 01:15:41 -07:00
private static IRecipe[] createAlyzerRecipes(Block block, int meta) {
2015-10-10 04:16:52 -07:00
ArrayList<IRecipe> recipes = new ArrayList<>();
recipes.add(ShapedRecipeCustom.createShapedRecipe(new ItemStack(block, 1, meta), "XTX", " Y ", "X X", 'Y', ForestryItem.sturdyCasing, 'T', ForestryItem.beealyzer, 'X', "ingotBronze"));
recipes.add(ShapedRecipeCustom.createShapedRecipe(new ItemStack(block, 1, meta), "XTX", " Y ", "X X", 'Y', ForestryItem.sturdyCasing, 'T', ForestryItem.treealyzer, 'X', "ingotBronze"));
return recipes.toArray(new IRecipe[recipes.size()]);
2014-05-02 21:31:20 +02:00
}
private static void registerBeehiveDrops() {
ItemStack honeyComb = ForestryItem.beeComb.getItemStack(1, 0);
hiveRegistry.addDrops(HiveRegistry.forest,
new HiveDrop(80, BeeDefinition.FOREST, honeyComb).setIgnobleShare(0.7f),
new HiveDrop(8, BeeDefinition.FOREST.getRainResist(), honeyComb),
new HiveDrop(3, BeeDefinition.VALIANT, honeyComb)
);
hiveRegistry.addDrops(HiveRegistry.meadows,
new HiveDrop(80, BeeDefinition.MEADOWS, honeyComb).setIgnobleShare(0.7f),
new HiveDrop(3, BeeDefinition.VALIANT, honeyComb)
);
ItemStack parchedComb = ForestryItem.beeComb.getItemStack(1, 7);
hiveRegistry.addDrops(HiveRegistry.desert,
new HiveDrop(80, BeeDefinition.MODEST, parchedComb).setIgnobleShare(0.7f),
new HiveDrop(3, BeeDefinition.VALIANT, parchedComb)
);
ItemStack silkyComb = ForestryItem.beeComb.getItemStack(1, 6);
hiveRegistry.addDrops(HiveRegistry.jungle,
new HiveDrop(80, BeeDefinition.TROPICAL, silkyComb).setIgnobleShare(0.7f),
new HiveDrop(3, BeeDefinition.VALIANT, silkyComb)
);
ItemStack mysteriousComb = ForestryItem.beeComb.getItemStack(1, 8);
hiveRegistry.addDrops(HiveRegistry.end,
new HiveDrop(90, BeeDefinition.ENDED, mysteriousComb)
);
ItemStack frozenComb = ForestryItem.beeComb.getItemStack(1, 4);
hiveRegistry.addDrops(HiveRegistry.snow,
new HiveDrop(80, BeeDefinition.WINTRY, frozenComb).setIgnobleShare(0.5f),
new HiveDrop(3, BeeDefinition.VALIANT, frozenComb)
);
ItemStack mossyComb = ForestryItem.beeComb.getItemStack(1, 15);
hiveRegistry.addDrops(HiveRegistry.swamp,
new HiveDrop(80, BeeDefinition.MARSHY, mossyComb).setIgnobleShare(0.4f),
new HiveDrop(3, BeeDefinition.VALIANT, mossyComb)
);
2014-05-02 21:31:20 +02:00
}
2015-04-05 14:16:41 -07:00
private static void registerDungeonLoot() {
2014-05-02 21:31:20 +02:00
int rarity;
if (Config.dungeonLootRare) {
2014-05-02 21:31:20 +02:00
rarity = 5;
} else {
2014-05-02 21:31:20 +02:00
rarity = 10;
}
2014-05-02 21:31:20 +02:00
ChestGenHooks.addItem(ChestGenHooks.DUNGEON_CHEST, new WeightedRandomChestContent(BeeDefinition.STEADFAST.getMemberStack(EnumBeeType.DRONE), 1, 1, rarity));
2014-05-02 21:31:20 +02:00
ItemStack stack = ForestryBlock.candle.getItemStack();
2014-05-02 21:31:20 +02:00
NBTTagCompound tag = new NBTTagCompound();
tag.setInteger(BlockCandle.colourTagName, 0xffffff);
stack.setTagCompound(tag);
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(stack, 7, 12, 12));
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(ForestryItem.scoop.getItemStack(), 1, 1, 8));
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(ForestryItem.propolis.getItemStack(), 2, 4, 6));
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(ForestryItem.beeComb.getItemStack(), 4, 12, 7));
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(ForestryItem.beeComb.getItemStack(1, 4), 2, 10, 7));
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(ForestryItem.beeComb.getItemStack(1, 6), 1, 6, 7));
2014-05-02 21:31:20 +02:00
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(BeeDefinition.FOREST.getRainResist().getMemberStack(EnumBeeType.PRINCESS), 1, 1, 5));
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(BeeDefinition.COMMON.getMemberStack(EnumBeeType.DRONE), 1, 2, 8));
ChestGenHooks.addItem(Constants.CHEST_GEN_HOOK_NATURALIST_CHEST, new WeightedRandomChestContent(BeeDefinition.MEADOWS.getMemberStack(EnumBeeType.PRINCESS), 1, 1, 5));
2014-05-02 21:31:20 +02:00
}
2015-04-05 14:16:41 -07:00
private static void createHives() {
hiveRegistry.registerHive(HiveRegistry.forest, HiveDescription.FOREST);
hiveRegistry.registerHive(HiveRegistry.meadows, HiveDescription.MEADOWS);
hiveRegistry.registerHive(HiveRegistry.desert, HiveDescription.DESERT);
hiveRegistry.registerHive(HiveRegistry.jungle, HiveDescription.JUNGLE);
hiveRegistry.registerHive(HiveRegistry.end, HiveDescription.END);
hiveRegistry.registerHive(HiveRegistry.snow, HiveDescription.SNOW);
hiveRegistry.registerHive(HiveRegistry.swamp, HiveDescription.SWAMP);
2014-10-03 02:08:41 -07:00
}
2015-04-05 14:16:41 -07:00
private static void createAlleles() {
2014-05-02 21:31:20 +02:00
IClassification hymnoptera = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.ORDER, "hymnoptera", "Hymnoptera");
AlleleManager.alleleRegistry.getClassification("class.insecta").addMemberGroup(hymnoptera);
IClassification apidae = AlleleManager.alleleRegistry.createAndRegisterClassification(EnumClassLevel.FAMILY, "apidae", "Apidae");
hymnoptera.addMemberGroup(apidae);
2015-04-22 23:14:42 -07:00
for (BeeBranchDefinition beeBranch : BeeBranchDefinition.values()) {
apidae.addMemberGroup(beeBranch.getBranch());
}
2014-05-02 21:31:20 +02:00
// / BEES // EFFECTS 1800 - 1899
AlleleEffect.effectNone = new AlleleEffectNone("none", true);
AlleleEffect.effectAggressive = new AlleleEffectAggressive();
AlleleEffect.effectHeroic = new AlleleEffectHeroic();
AlleleEffect.effectBeatific = new AlleleEffectPotion("beatific", false, Potion.regeneration, 100);
AlleleEffect.effectMiasmic = new AlleleEffectPotion("miasmic", false, Potion.poison, 600, 100, 0.1f);
AlleleEffect.effectMisanthrope = new AlleleEffectMisanthrope();
AlleleEffect.effectGlacial = new AlleleEffectGlacial();
AlleleEffect.effectRadioactive = new AlleleEffectRadioactive();
AlleleEffect.effectCreeper = new AlleleEffectCreeper();
AlleleEffect.effectIgnition = new AlleleEffectIgnition();
AlleleEffect.effectExploration = new AlleleEffectExploration();
AlleleEffect.effectFestiveEaster = new AlleleEffectNone("festiveEaster", true);
AlleleEffect.effectSnowing = new AlleleEffectSnowing();
AlleleEffect.effectDrunkard = new AlleleEffectPotion("drunkard", false, Potion.confusion, 100);
AlleleEffect.effectReanimation = new AlleleEffectResurrection("reanimation", AlleleEffectResurrection.getReanimationList());
AlleleEffect.effectResurrection = new AlleleEffectResurrection("resurrection", AlleleEffectResurrection.getResurrectionList());
AlleleEffect.effectRepulsion = new AlleleEffectRepulsion();
AlleleEffect.effectFertile = new AlleleEffectFertile();
AlleleEffect.effectMycophilic = new AlleleEffectFungification();
2014-05-02 21:31:20 +02:00
}
public static double getSecondPrincessChance() {
return secondPrincessChance;
}
private static void parseAdditionalFlowers(String list, ArrayList<ItemStack> target) {
List<ItemStack> flowers = ItemStackUtil.parseItemStackStrings(list, 0);
target.addAll(flowers);
2014-05-02 21:31:20 +02:00
}
private static void parseBeeBlacklist(String list) {
2014-05-02 21:31:20 +02:00
String[] items = list.split("[;]+");
parseBeeBlacklist(items);
}
2014-05-02 21:31:20 +02:00
private static void parseBeeBlacklist(String[] items) {
2014-05-02 21:31:20 +02:00
for (String item : items) {
if (item.isEmpty()) {
2014-05-02 21:31:20 +02:00
continue;
}
2014-05-02 21:31:20 +02:00
FMLCommonHandler.instance().getFMLLogger().debug("Blacklisting bee species identified by " + item);
AlleleManager.alleleRegistry.blacklistAllele(item);
}
}
private static void parseAcceptedFlowers(String[] acceptedFlowers, String flowerType) {
List<Stack> acceptedFlowerItemStacks = Stack.parseStackStrings(acceptedFlowers, OreDictionary.WILDCARD_VALUE);
for (Stack acceptedFlower : acceptedFlowerItemStacks) {
Block acceptedFlowerBlock = acceptedFlower.getBlock();
int meta = acceptedFlower.getMeta();
if (acceptedFlowerBlock != null) {
FlowerManager.flowerRegistry.registerAcceptableFlower(acceptedFlowerBlock, meta, flowerType);
} else {
Log.warning("No block found for '" + acceptedFlower + "' in apiculture config for '" + flowerType + "'.");
}
}
}
private static void parsePlantableFlowers(Property property, String flowerType) {
for (String string : property.getStringList()) {
Stack plantableFlower = Stack.parseStackString(string, OreDictionary.WILDCARD_VALUE);
if (plantableFlower == null) {
continue;
}
Block plantableFlowerBlock = plantableFlower.getBlock();
int meta = plantableFlower.getMeta();
if (plantableFlowerBlock != null) {
FlowerManager.flowerRegistry.registerPlantableFlower(plantableFlowerBlock, meta, 1.0, flowerType);
} else {
Log.warning("No block found for '" + string + "' in config '" + property.getName() + "'.");
}
}
}
2014-05-02 21:31:20 +02:00
@Override
public ISaveEventHandler getSaveEventHandler() {
return new SaveEventHandlerApiculture();
}
@Override
public void populateChunk(IChunkProvider chunkProvider, World world, Random rand, int chunkX, int chunkZ, boolean hasVillageGenerated) {
2015-06-21 00:22:13 -07:00
if (Config.getBeehivesAmount() > 0.0) {
2015-08-02 01:15:41 -07:00
HiveDecorator.decorateHives(chunkProvider, world, rand, chunkX, chunkZ, hasVillageGenerated);
}
}
@Override
public void populateChunkRetroGen(World world, Random rand, int chunkX, int chunkZ) {
2015-06-21 00:22:13 -07:00
if (Config.getBeehivesAmount() > 0.0) {
2015-08-02 01:15:41 -07:00
HiveDecorator.decorateHives(world, rand, chunkX, chunkZ);
}
}
2014-05-02 21:31:20 +02:00
@Override
public boolean processIMCMessage(IMCMessage message) {
if (message.key.equals("add-candle-lighting-id")) {
ItemStack value = message.getItemStackValue();
if (value != null) {
BlockCandle.addItemToLightingList(value.getItem());
} else {
logInvalidIMCMessage(message);
}
2014-05-02 21:31:20 +02:00
return true;
} else if (message.key.equals("add-alveary-slab") && message.isStringMessage()) {
2015-06-29 22:15:39 -07:00
String messageString = String.format("Received a '%s' request from mod '%s'. This IMC message has been replaced with the oreDictionary for 'slabWood'. Please contact the author and report this issue.", message.key, message.getSender());
Log.warning(messageString);
return true;
}
2014-05-02 21:31:20 +02:00
return super.processIMCMessage(message);
}
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void textureHook(TextureStitchEvent.Pre event) {
if (event.map.getTextureType() == 1) {
EntityFXSnow.icons = new IIcon[3];
for (int i = 0; i < EntityFXSnow.icons.length; i++) {
EntityFXSnow.icons[i] = event.map.registerIcon("forestry:particles/snow." + (i + 1));
}
2014-05-02 21:31:20 +02:00
}
}
}