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-05-02 21:31:20 +02:00
*
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 java.lang.reflect.Field ;
import net.minecraft.block.Block ;
import net.minecraft.item.ItemStack ;
import net.minecraftforge.common.BiomeDictionary ;
import forestry.api.genetics.AlleleManager ;
import forestry.api.genetics.IMutation ;
import forestry.apiculture.genetics.AlleleBeeSpecies ;
import forestry.apiculture.genetics.BeeTemplates ;
import forestry.apiculture.genetics.IJubilanceProvider ;
import forestry.apiculture.genetics.JubilanceReqRes ;
import forestry.apiculture.genetics.MutationEMC ;
import forestry.core.config.Defaults ;
import forestry.core.genetics.Allele ;
import forestry.core.proxy.Proxies ;
2014-09-20 22:43:13 -07:00
@Plugin ( pluginID = "EqEx2" , name = "Equivalent Exchange 2" , author = "SirSengir" , url = Defaults . URL , description = "Compatibility plugin for Equivalent Exchange 2. Enables the Omega branch of bees. Requires Apiculture to be enabled." )
public class PluginEE extends ForestryPlugin {
2014-05-02 21:31:20 +02:00
public IMutation darkenedA ;
public IMutation reddenedA ;
public IMutation omegaA ;
public ItemStack eeBlock1 ;
public ItemStack eeBlock2 ;
public Class <?> eeRelay2Class ;
public Class <?> eeRelay3Class ;
public Field eeRelay2EMCField ;
public Field eeRelay3EMCField ;
@Override
public boolean isAvailable () {
2014-09-20 22:43:13 -07:00
return Proxies . common . isModLoaded ( "mod_EE" );
}
@Override
public String getFailMessage () {
return "Equivalent Exchange not found" ;
2014-05-02 21:31:20 +02:00
}
@Override
public void postInit () {
try {
eeBlock1 = new ItemStack (( Block ) Class . forName ( "ee.EEBlock" ). getField ( "eeStone" ). get ( null ), 1 , 8 );
eeBlock2 = new ItemStack (( Block ) Class . forName ( "ee.EEBlock" ). getField ( "eeStone" ). get ( null ), 1 , 9 );
eeRelay2Class = Class . forName ( "ee.TileRelay2" );
eeRelay2EMCField = eeRelay2Class . getField ( "scaledEnergy" );
eeRelay3Class = Class . forName ( "ee.TileRelay3" );
eeRelay3EMCField = eeRelay3Class . getField ( "scaledEnergy" );
} catch ( Exception ex ) {
Proxies . log . fine ( "Necessary block/classes from EE were not found" );
return ;
}
IJubilanceProvider jubilanceProviderDarkened = new JubilanceReqRes ( eeBlock1 );
IJubilanceProvider jubilanceProviderReddened = new JubilanceReqRes ( eeBlock2 );
(( AlleleBeeSpecies ) AlleleManager . alleleRegistry . getAllele ( "forestry.speciesDarkened" )). jubilanceProvider = jubilanceProviderDarkened ;
(( AlleleBeeSpecies ) AlleleManager . alleleRegistry . getAllele ( "forestry.speciesReddened" )). jubilanceProvider = jubilanceProviderReddened ;
(( AlleleBeeSpecies ) AlleleManager . alleleRegistry . getAllele ( "forestry.speciesOmega" )). jubilanceProvider = jubilanceProviderReddened ;
darkenedA = new MutationEMC ( Allele . speciesModest , Allele . speciesWintry , BeeTemplates . getDarkenedTemplate (), 100 , eeBlock1 , eeRelay2Class ,
eeRelay2EMCField , 139264 );
reddenedA = new MutationEMC ( Allele . speciesDarkened , Allele . speciesTropical , BeeTemplates . getReddenedTemplate (), 100 , eeBlock2 , eeRelay3Class ,
eeRelay3EMCField , 466944 );
omegaA = new MutationEMC ( Allele . speciesDarkened , Allele . speciesReddened , BeeTemplates . getOmegaTemplate (), 100 , eeBlock2 , eeRelay3Class ,
2014-08-07 16:59:08 -04:00
eeRelay3EMCField , 933888 ). restrictBiomeType ( BiomeDictionary . Type . NETHER ). restrictBiomeType ( BiomeDictionary . Type . SANDY );
2014-05-02 21:31:20 +02:00
}
}