From 1b820de08a05070909a267e17f033fcf58ac8710 Mon Sep 17 00:00:00 2001 From: NotAPenguin Date: Mon, 2 Sep 2024 23:17:17 +0200 Subject: The Great Renaming (#3014) * move kekztech to a single root dir * move detrav to a single root dir * move gtnh-lanthanides to a single root dir * move tectech and delete some gross reflection in gt++ * remove more reflection inside gt5u * delete more reflection in gt++ * fix imports * move bartworks and bwcrossmod * fix proxies * move galactigreg and ggfab * move gtneioreplugin * try to fix gt++ bee loader * apply the rename rules to BW * apply rename rules to bwcrossmod * apply rename rules to detrav scanner mod * apply rename rules to galacticgreg * apply rename rules to ggfab * apply rename rules to goodgenerator * apply rename rules to gtnh-lanthanides * apply rename rules to gt++ * apply rename rules to kekztech * apply rename rules to kubatech * apply rename rules to tectech * apply rename rules to gt apply the rename rules to gt * fix tt import * fix mui hopefully * fix coremod except intergalactic * rename assline recipe class * fix a class name i stumbled on * rename StructureUtility to GTStructureUtility to prevent conflict with structurelib * temporary rename of GTTooltipDataCache to old name * fix gt client/server proxy names --- .../gtPlusPlus/xmod/forestry/ForestryHandler.java | 24 + .../xmod/forestry/ForestryTreeHandler.java | 6 +- .../java/gtPlusPlus/xmod/forestry/HANDLER_FR.java | 24 - .../xmod/forestry/bees/custom/CustomCombs.java | 8 +- .../forestry/bees/custom/GTPPBeeDefinition.java | 604 +++++++++++++++++++++ .../xmod/forestry/bees/custom/GTPPBees.java | 172 ++++++ .../forestry/bees/custom/GTPPBranchDefinition.java | 76 +++ .../forestry/bees/custom/GTPP_Bee_Definition.java | 604 --------------------- .../xmod/forestry/bees/custom/GTPP_Bees.java | 172 ------ .../bees/custom/GTPP_Branch_Definition.java | 76 --- .../xmod/forestry/bees/custom/ItemCustomComb.java | 30 +- .../xmod/forestry/bees/handler/GTPPCombType.java | 62 +++ .../xmod/forestry/bees/handler/GTPPDropType.java | 61 +++ .../xmod/forestry/bees/handler/GTPPPollenType.java | 60 ++ .../forestry/bees/handler/GTPPPropolisType.java | 61 +++ .../xmod/forestry/bees/handler/GTPP_CombType.java | 62 --- .../xmod/forestry/bees/handler/GTPP_DropType.java | 61 --- .../forestry/bees/handler/GTPP_PollenType.java | 60 -- .../forestry/bees/handler/GTPP_PropolisType.java | 61 --- .../xmod/forestry/bees/items/FRItemRegistry.java | 120 ++++ .../xmod/forestry/bees/items/FRStringUtil.java | 14 + .../xmod/forestry/bees/items/FR_ItemRegistry.java | 120 ---- .../xmod/forestry/bees/items/FR_StringUtil.java | 14 - .../xmod/forestry/bees/items/MBFrameType.java | 126 +++++ .../xmod/forestry/bees/items/MBItemFrame.java | 142 +++++ .../xmod/forestry/bees/items/MB_FrameType.java | 126 ----- .../xmod/forestry/bees/items/MB_ItemFrame.java | 142 ----- .../xmod/forestry/bees/items/output/GTPPComb.java | 131 +++++ .../xmod/forestry/bees/items/output/GTPPDrop.java | 131 +++++ .../forestry/bees/items/output/GTPPPollen.java | 92 ++++ .../forestry/bees/items/output/GTPPPropolis.java | 110 ++++ .../xmod/forestry/bees/items/output/GTPP_Comb.java | 131 ----- .../xmod/forestry/bees/items/output/GTPP_Drop.java | 131 ----- .../forestry/bees/items/output/GTPP_Pollen.java | 92 ---- .../forestry/bees/items/output/GTPP_Propolis.java | 110 ---- .../forestry/bees/recipe/FRGregTechRecipes.java | 134 +++++ .../forestry/bees/recipe/FR_Gregtech_Recipes.java | 134 ----- .../bees/registry/GTPPAlleleBeeSpecies.java | 50 ++ .../forestry/bees/registry/GTPPBeeMutation.java | 85 +++ .../bees/registry/GTPP_AlleleBeeSpecies.java | 50 -- .../forestry/bees/registry/GTPP_BeeDefinition.java | 49 +- .../forestry/bees/registry/GTPP_Bee_Mutation.java | 86 --- .../xmod/forestry/bees/registry/GTPP_Bees.java | 61 ++- 43 files changed, 2332 insertions(+), 2333 deletions(-) create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/ForestryHandler.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBeeDefinition.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBees.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBranchDefinition.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bees.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Branch_Definition.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPPCombType.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPPDropType.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPPPollenType.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPPPropolisType.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/FRItemRegistry.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/FRStringUtil.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_ItemRegistry.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_StringUtil.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/MBFrameType.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/MBItemFrame.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/MB_FrameType.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/MB_ItemFrame.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPPComb.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPPDrop.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPPPollen.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPPPropolis.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Comb.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Drop.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Pollen.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Propolis.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/recipe/FRGregTechRecipes.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/recipe/FR_Gregtech_Recipes.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPPAlleleBeeSpecies.java create mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPPBeeMutation.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java delete mode 100644 src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java (limited to 'src/main/java/gtPlusPlus/xmod/forestry') diff --git a/src/main/java/gtPlusPlus/xmod/forestry/ForestryHandler.java b/src/main/java/gtPlusPlus/xmod/forestry/ForestryHandler.java new file mode 100644 index 0000000000..963c793cee --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/ForestryHandler.java @@ -0,0 +1,24 @@ +package gtPlusPlus.xmod.forestry; + +import static gregtech.api.enums.Mods.Forestry; + +import gtPlusPlus.xmod.forestry.bees.items.FRItemRegistry; +import gtPlusPlus.xmod.forestry.bees.recipe.FRGregTechRecipes; +import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; + +public class ForestryHandler { + + public static void preInit() { + if (Forestry.isModLoaded()) { + FRItemRegistry.Register(); + } + } + + public static void postInit() { + if (Forestry.isModLoaded()) { + FRGregTechRecipes.registerItems(); + new GTPP_Bees(); + } + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/ForestryTreeHandler.java b/src/main/java/gtPlusPlus/xmod/forestry/ForestryTreeHandler.java index 1f64eacb5c..49b048977e 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/ForestryTreeHandler.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/ForestryTreeHandler.java @@ -11,7 +11,7 @@ import forestry.api.arboriculture.TreeManager; import forestry.arboriculture.genetics.TreeDefinition; import forestry.plugins.PluginArboriculture; import gtPlusPlus.core.util.reflect.ReflectionUtils; -import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntityTreeFarm; +import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.MTETreeFarm; public class ForestryTreeHandler { @@ -45,7 +45,7 @@ public class ForestryTreeHandler { } } - GregtechMetaTileEntityTreeFarm.registerForestryTree( + MTETreeFarm.registerForestryTree( speciesUID, sapling == null ? null : sapling.copy(), log == null ? null : log.copy(), @@ -83,7 +83,7 @@ public class ForestryTreeHandler { } } - GregtechMetaTileEntityTreeFarm.registerForestryTree( + MTETreeFarm.registerForestryTree( speciesUID, sapling == null ? null : sapling.copy(), log == null ? null : log.copy(), diff --git a/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java b/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java deleted file mode 100644 index dc2d277283..0000000000 --- a/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java +++ /dev/null @@ -1,24 +0,0 @@ -package gtPlusPlus.xmod.forestry; - -import static gregtech.api.enums.Mods.Forestry; - -import gtPlusPlus.xmod.forestry.bees.items.FR_ItemRegistry; -import gtPlusPlus.xmod.forestry.bees.recipe.FR_Gregtech_Recipes; -import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; - -public class HANDLER_FR { - - public static void preInit() { - if (Forestry.isModLoaded()) { - FR_ItemRegistry.Register(); - } - } - - public static void postInit() { - if (Forestry.isModLoaded()) { - FR_Gregtech_Recipes.registerItems(); - new GTPP_Bees(); - } - } - -} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java index d908850658..05ab3c8711 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/CustomCombs.java @@ -1,7 +1,7 @@ package gtPlusPlus.xmod.forestry.bees.custom; import gregtech.api.enums.Materials; -import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GTLanguageManager; import gtPlusPlus.core.util.Utils; public enum CustomCombs { @@ -11,8 +11,8 @@ public enum CustomCombs { SILICON("silicon", true, Materials.Silicon, 100), RUBBER("rubber", true, Materials.Rubber, 100), PLASTIC("polyethylene", true, Materials.Plastic, 75), - PTFE("polytetrafluoroethylene", true, GTPP_Bees.PTFE, 50), - PBS("styrene-butadiene", true, GTPP_Bees.PBS, 25), + PTFE("polytetrafluoroethylene", true, GTPPBees.PTFE, 50), + PBS("styrene-butadiene", true, GTPPBees.PBS, 25), // Fuels BIOMASS("biomass", true, Materials.Biomass, 100), @@ -82,7 +82,7 @@ public enum CustomCombs { public String getName() { // return "gt.comb."+this.name; - return GT_LanguageManager.addStringLocalization( + return GTLanguageManager.addStringLocalization( "comb." + this.name, this.name.substring(0, 1) .toUpperCase() + this.name.substring(1) + " Comb"); diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBeeDefinition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBeeDefinition.java new file mode 100644 index 0000000000..7f7553bf1d --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBeeDefinition.java @@ -0,0 +1,604 @@ +package gtPlusPlus.xmod.forestry.bees.custom; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Locale; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.BiomeDictionary.Type; + +import org.apache.commons.lang3.reflect.FieldUtils; +import org.apache.commons.lang3.text.WordUtils; + +import forestry.api.apiculture.BeeManager; +import forestry.api.apiculture.EnumBeeChromosome; +import forestry.api.apiculture.EnumBeeType; +import forestry.api.apiculture.IAlleleBeeSpecies; +import forestry.api.apiculture.IAlleleBeeSpeciesCustom; +import forestry.api.apiculture.IBee; +import forestry.api.apiculture.IBeeGenome; +import forestry.api.apiculture.IBeeMutationCustom; +import forestry.api.core.EnumHumidity; +import forestry.api.core.EnumTemperature; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IAllele; +import forestry.apiculture.genetics.Bee; +import forestry.apiculture.genetics.BeeDefinition; +import forestry.apiculture.genetics.BeeVariation; +import forestry.apiculture.genetics.IBeeDefinition; +import forestry.core.genetics.alleles.AlleleHelper; +import gregtech.loaders.misc.GTBeeDefinition; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + +public enum GTPPBeeDefinition implements IBeeDefinition { + + SILICON(GTPPBranchDefinition.ORGANIC, "Silicon", true, Utils.rgbtoHexValue(75, 75, 75), + Utils.rgbtoHexValue(125, 125, 125)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(getSlagComb(), 0.10f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.SILICON), 0.20f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation( + getGregtechBeeType("SLIMEBALL"), + getGregtechBeeType("STICKYRESIN"), + 10); + } + }, + + RUBBER(GTPPBranchDefinition.ORGANIC, "Rubber", true, Utils.rgbtoHexValue(55, 55, 55), + Utils.rgbtoHexValue(75, 75, 75)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(getSlagComb(), 0.10f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.RUBBER), 0.30f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation( + getGregtechBeeType("SLIMEBALL"), + getGregtechBeeType("STICKYRESIN"), + 10); + } + }, + + PLASTIC(GTPPBranchDefinition.ORGANIC, "Plastic", true, Utils.rgbtoHexValue(245, 245, 245), + Utils.rgbtoHexValue(175, 175, 175)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(getStoneComb(), 0.30f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.PLASTIC), 0.15f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation(RUBBER.species, getGregtechBeeType("OIL"), 10); + } + }, + + PTFE(GTPPBranchDefinition.ORGANIC, "Ptfe", true, Utils.rgbtoHexValue(150, 150, 150), + Utils.rgbtoHexValue(75, 75, 75)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(getStoneComb(), 0.30f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.PTFE), 0.10f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation(RUBBER.species, PLASTIC.species, 10); + } + }, + + PBS(GTPPBranchDefinition.ORGANIC, "Pbs", true, Utils.rgbtoHexValue(33, 26, 24), Utils.rgbtoHexValue(23, 16, 14)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(getStoneComb(), 0.30f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.PBS), 0.10f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation(PTFE.species, PLASTIC.species, 10); + } + }, + + /** + * Fuels + */ + BIOMASS(GTPPBranchDefinition.ORGANIC, "Biomass", true, Utils.rgbtoHexValue(33, 225, 24), + Utils.rgbtoHexValue(23, 175, 14)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.SAND), 0.40f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.BIOMASS), 0.20f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation(getSpecies("Industrious"), getSpecies("Rural"), 10); + tMutation.restrictBiomeType(Type.FOREST); + } + }, + + ETHANOL(GTPPBranchDefinition.ORGANIC, "Ethanol", true, Utils.rgbtoHexValue(255, 128, 0), + Utils.rgbtoHexValue(220, 156, 32)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.SAND), 0.40f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.ETHANOL), 0.20f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation(BIOMASS.species, getSpecies("Farmerly"), 5); + tMutation.restrictBiomeType(Type.FOREST); + } + }, + + /** + * Materials + */ + FLUORINE(GTPPBranchDefinition.ORGANIC, "Fluorine", true, Utils.rgbtoHexValue(30, 230, 230), + Utils.rgbtoHexValue(10, 150, 150)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(getStoneComb(), 0.40f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.FLUORINE), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.COLD); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation( + getGregtechBeeType("LAPIS"), + getGregtechBeeType("SAPPHIRE"), + 5); + tMutation.restrictBiomeType(Type.COLD); + } + }, + + // Coke + + // Force + FORCE(GTPPBranchDefinition.METAL, "Force", true, Utils.rgbtoHexValue(250, 250, 20), + Utils.rgbtoHexValue(200, 200, 5)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(getStoneComb(), 0.30f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.SAND), 0.25f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.FORCE), 0.25f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.SALT), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.HOT); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation( + getGregtechBeeType("STEEL"), + getGregtechBeeType("GOLD"), + 10); + tMutation.restrictBiomeType(Type.HOT); + } + }, + + // Nikolite + NIKOLITE(GTPPBranchDefinition.METAL, "Nikolite", true, Utils.rgbtoHexValue(60, 180, 200), + Utils.rgbtoHexValue(40, 150, 170)) { + + @Override + protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + beeSpecies.addProduct(getStoneComb(), 0.30f); + beeSpecies.addProduct(GTPPBees.combs.getStackForType(CustomCombs.NIKOLITE), 0.05f); + beeSpecies.setHumidity(EnumHumidity.NORMAL); + beeSpecies.setTemperature(EnumTemperature.HOT); + } + + @Override + protected void setAlleles(IAllele[] template) { + template = BeeDefinition.COMMON.getTemplate(); + } + + @Override + protected void registerMutations() { + IBeeMutationCustom tMutation = registerMutation( + getGregtechBeeType("ALUMINIUM"), + getGregtechBeeType("SILVER"), + 8); + tMutation.restrictBiomeType(Type.HOT); + } + }, + + /* + * CLAY(GTPP_Branch_Definition.ORGANIC, "Clay", true, 0x19d0ec, 0xffdc16) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.30f); + * beeSpecies.addProduct(new ItemStack(Items.clay_ball, 1), 0.15f); beeSpecies.setHumidity(EnumHumidity.DAMP); + * beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.MEADOWS.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = + * registerMutation(getSpecies("Industrious"), getSpecies("Diligent"), 20); } }, + * SLIMEBALL(GTPP_Branch_Definition.ORGANIC, "SlimeBall", true, 0x4E9E55, 0x00FF15) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 15), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STICKY), 0.30f); + * beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.MARSHY.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = + * registerMutation(getSpecies("Marshy"), CLAY.species, 15); } }, PEAT(GTPP_Branch_Definition.ORGANIC, "Peat", true, + * 0x906237, 0x58300B) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.LIGNIE), 0.30f); + * beeSpecies.addProduct(GTModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.RURAL.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = + * registerMutation(getSpecies("Rural"), CLAY.species, 20); } }, STICKYRESIN(GTPP_Branch_Definition.ORGANIC, + * "StickyResin", true, 0x2E8F5B, 0xDCC289) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.30f); + * beeSpecies.addProduct(ItemList.IC2_Resin.get(1, new Object[0]), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.MEADOWS.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(SLIMEBALL.species, + * PEAT.species, 25); } }, COAL(GTPP_Branch_Definition.ORGANIC, "Coal", true, 0x666666, 0x525252) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.LIGNIE), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.COAL), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.AUSTERE.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = + * registerMutation(getSpecies("Industrious"), PEAT.species, 18); } }, OIL(GTPP_Branch_Definition.ORGANIC, "Oil", + * true, 0x4C4C4C, 0x333333) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 0), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.OIL), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setTemperature(EnumTemperature.NORMAL); + * beeSpecies.setNocturnal(); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.MEADOWS.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(COAL.species, + * STICKYRESIN.species, 8); } }, REDSTONE(GTPP_Branch_Definition.GEM, "Redstone", true, 0x7D0F0F, 0xD11919) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.REDSTONE), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = + * registerMutation(getSpecies("Industrious"), getSpecies("Demonic"), 20); } }, LAPIS(GTPP_Branch_Definition.GEM, + * "Lapis", true, 0x1947D1, 0x476CDA) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.LAPIS), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = + * registerMutation(getSpecies("Demonic"), getSpecies("Imperial"), 20); } }, CERTUS(GTPP_Branch_Definition.GEM, + * "CertusQuartz", true, 0x57CFFB, 0xBBEEFF) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.CERTUS), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = + * registerMutation(getSpecies("Hermitic"), LAPIS.species, 20); } }, RUBY(GTPP_Branch_Definition.GEM, "Ruby", true, + * 0xE6005C, 0xCC0052) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.RUBY), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(REDSTONE.species, + * DIAMOND.species, 10); } }, SAPPHIRE(GTPP_Branch_Definition.GEM, "Sapphire", true, 0x0033CC, 0x00248F) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SAPPHIRE), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CERTUS.species, + * LAPIS.species, 10); } }, DIAMOND(GTPP_Branch_Definition.GEM, "Diamond", true, 0xCCFFFF, 0xA3CCCC) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.DIAMOND), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CERTUS.species, + * COAL.species, 6); } }, OLIVINE(GTPP_Branch_Definition.GEM, "Olivine", true, 0x248F24, 0xCCFFCC) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.OLIVINE), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CERTUS.species, + * getSpecies("Ended"), 10); } }, EMERALD(GTPP_Branch_Definition.GEM, "Emerald", true, 0x248F24, 0x2EB82E) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STONE), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.EMERALD), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.COLD); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(OLIVINE.species, + * DIAMOND.species, 8); } }, COPPER(GTPP_Branch_Definition.METAL, "Copper", true, 0xFF6600, 0xE65C00) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.COPPER), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = + * registerMutation(getSpecies("Majestic"), CLAY.species, 25); } }, TIN(GTPP_Branch_Definition.METAL, "Tin", true, + * 0xD4D4D4, 0xDDDDDD) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.TIN), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(CLAY.species, + * getSpecies("Diligent"), 25); } }, LEAD(GTPP_Branch_Definition.METAL, "Lead", true, 0x666699, 0xA3A3CC) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.LEAD), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.DAMP); beeSpecies.setTemperature(EnumTemperature.WARM); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(COAL.species, + * COPPER.species, 25); } }, IRON(GTPP_Branch_Definition.METAL, "Iron", true, 0xDA9147, 0xDE9C59) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.IRON), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(TIN.species, + * COPPER.species, 25); } }, STEEL(GTPP_Branch_Definition.METAL, "Steel", true, 0x808080, 0x999999) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.STEEL), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(IRON.species, + * COAL.species, 20); } }, NICKEL(GTPP_Branch_Definition.METAL, "Nickel", true, 0x8585AD, 0x8585AD) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.NICKEL), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(IRON.species, + * COPPER.species, 25); } }, ZINC(GTPP_Branch_Definition.METAL, "Zinc", true, 0xF0DEF0, 0xF2E1F2) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.ZINC), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(IRON.species, + * TIN.species, 20); } }, SILVER(GTPP_Branch_Definition.METAL, "Silver", true, 0xC2C2D6, 0xCECEDE) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SILVER), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(LEAD.species, + * TIN.species, 20); } }, GOLD(GTPP_Branch_Definition.METAL, "Gold", true, 0xEBC633, 0xEDCC47) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.GOLD), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.NORMAL); beeSpecies.setTemperature(EnumTemperature.NORMAL); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(LEAD.species, + * COPPER.species, 20); } }, ALUMINIUM(GTPP_Branch_Definition.RAREMETAL, "Aluminium", true, 0xB8B8FF, 0xD6D6FF) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.ALUMINIUM), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.ARID); beeSpecies.setTemperature(EnumTemperature.HOT); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(NICKEL.species, + * ZINC.species, 18); } }, TITANIUM(GTPP_Branch_Definition.RAREMETAL, "Titanium", true, 0xCC99FF, 0xDBB8FF) { + * @Override protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SLAG), 0.30f); + * beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.TITANIUM), 0.15f); + * beeSpecies.setHumidity(EnumHumidity.ARID); beeSpecies.setTemperature(EnumTemperature.HOT); } + * @Override protected void setAlleles(IAllele[] template) { template = BeeDefinition.COMMON.getTemplate(); } + * @Override protected void registerMutations() { IBeeMutationCustom tMutation = registerMutation(REDSTONE.species, + * ALUMINIUM.species, 5); } } + */ + + ; + + private final GTPPBranchDefinition branch; + private final IAlleleBeeSpeciesCustom species; + + private IAllele[] template; + private IBeeGenome genome; + + GTPPBeeDefinition(GTPPBranchDefinition branch, String binomial, boolean dominant, int primary, int secondary) { + String lowercaseName = this.toString() + .toLowerCase(Locale.ENGLISH); + String species = "species" + WordUtils.capitalize(lowercaseName); + + String uid = "forestry." + species; + String description = "for.description." + species; + String name = "for.bees.species." + lowercaseName; + + this.branch = branch; + this.species = BeeManager.beeFactory.createSpecies( + uid, + dominant, + "Sengir", + name, + description, + branch.getBranch(), + binomial, + primary, + secondary); + } + + public static void initBees() { + for (GTPPBeeDefinition bee : values()) { + bee.init(); + } + for (GTPPBeeDefinition bee : values()) { + bee.registerMutations(); + } + } + + private static IAlleleBeeSpecies getSpecies(String name) { + return (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele( + (new StringBuilder()).append("forestry.species") + .append(name) + .toString()); + } + + protected abstract void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies); + + protected abstract void setAlleles(IAllele[] template); + + protected abstract void registerMutations(); + + private void init() { + setSpeciesProperties(species); + + template = branch.getTemplate(); + AlleleHelper.instance.set(template, EnumBeeChromosome.SPECIES, species); + setAlleles(template); + + genome = BeeManager.beeRoot.templateAsGenome(template); + + BeeManager.beeRoot.registerTemplate(template); + } + + protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, + int chance) { + IAllele[] template = getTemplate(); + Logger.DEBUG_BEES("parent1: " + (parent1 != null)); + Logger.DEBUG_BEES("parent2: " + (parent2 != null)); + Logger.DEBUG_BEES("chance: " + (chance)); + Logger.DEBUG_BEES("template: " + (template != null)); + return BeeManager.beeMutationFactory.createMutation(parent1, parent2, template, chance); + } + + @Override + public final IAllele[] getTemplate() { + return Arrays.copyOf(template, template.length); + } + + @Override + public final IBeeGenome getGenome() { + return genome; + } + + @Override + public final IBee getIndividual() { + return new Bee(genome); + } + + @Override + public final ItemStack getMemberStack(EnumBeeType beeType) { + IBee bee = getIndividual(); + return BeeManager.beeRoot.getMemberStack(bee, beeType.ordinal()); + } + + public final IBeeDefinition getRainResist() { + return new BeeVariation.RainResist(this); + } + + private static ItemStack getSlagComb() { + return issStackValid(ItemUtils.getSimpleStack(GTPPBees.Comb_Slag, 1)); + } + + private static ItemStack getStoneComb() { + return issStackValid(ItemUtils.getSimpleStack(GTPPBees.Comb_Stone, 1)); + } + + private static ItemStack issStackValid(ItemStack result) { + if (result == null) { + return ItemUtils.getErrorStack(1); + } + return result; + } + + public static IAlleleBeeSpecies getGregtechBeeType(String name) { + try { + Enum gtBeeEnumObject = Enum.valueOf(GTBeeDefinition.class, name); + Field gtBeesField = FieldUtils.getDeclaredField(GTBeeDefinition.class, "species", true); + gtBeesField.setAccessible(true); + ReflectionUtils.makeFieldAccessible(gtBeesField); + Object beeType = gtBeesField.get(gtBeeEnumObject); + return (IAlleleBeeSpecies) beeType; + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } + return null; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBees.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBees.java new file mode 100644 index 0000000000..f0cd284bdf --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBees.java @@ -0,0 +1,172 @@ +package gtPlusPlus.xmod.forestry.bees.custom; + +import static gregtech.api.enums.Mods.Forestry; +import static gregtech.api.recipe.RecipeMaps.fluidExtractionRecipes; +import static gregtech.api.util.GTRecipeBuilder.SECONDS; +import static gregtech.api.util.GTRecipeBuilder.TICKS; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +import org.apache.commons.lang3.reflect.FieldUtils; + +import gregtech.GTMod; +import gregtech.api.enums.GTValues; +import gregtech.api.enums.Materials; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.item.base.ingots.BaseItemIngotOld; +import gtPlusPlus.core.item.base.misc.BaseItemMisc; +import gtPlusPlus.core.item.base.misc.BaseItemMisc.MiscTypes; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; + +public class GTPPBees { + + // Custom Comb Drop Base Items + public static Item dropForceGem; + public static Item dropBiomassBlob; + public static Item dropEthanolBlob; + public static Item dropNikoliteDust; + public static Item dropFluorineBlob; + + // Base Comb Item + public static ItemCustomComb combs; + + // Combs obtained via reflection + public static ItemStack Comb_Slag; + public static ItemStack Comb_Stone; + + // Materials obtained via reflection + public static Materials PTFE; + public static Materials PBS; + + // public static GTPP_Branch_Definition definition; + + public GTPPBees() { + if (Forestry.isModLoaded()) { + + // Set Materials and Comb stacks from GT via Reflection + setMaterials(); + setCustomItems(); + + try { + combs = new ItemCustomComb(); + combs.initCombsRecipes(); + GTPPBeeDefinition.initBees(); + } catch (Throwable t) { + Logger.BEES("Failed to load bees, probably due to an ancient forestry version"); + t.printStackTrace(); + } + } + } + + private void setCustomItems() { + dropForceGem = new BaseItemMisc("Force", new short[] { 250, 250, 20 }, 64, MiscTypes.GEM, null); + dropBiomassBlob = new BaseItemMisc("Biomass", new short[] { 33, 225, 24 }, 64, MiscTypes.DROP, null); + dropEthanolBlob = new BaseItemMisc("Ethanol", new short[] { 255, 128, 0 }, 64, MiscTypes.DROP, null); + + // Nikolite may not exist, so lets make it. + dropNikoliteDust = ItemUtils + .generateSpecialUseDusts("Nikolite", "Nikolite", Utils.rgbtoHexValue(60, 180, 200))[2]; + + if (ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotNikolite", 1) == null) { + new BaseItemIngotOld("itemIngotNikolite", "Nikolite", Utils.rgbtoHexValue(60, 180, 200), 0); + } + + dropFluorineBlob = new BaseItemMisc("Fluorine", new short[] { 30, 230, 230 }, 64, MiscTypes.DROP, null); + addRecipes(); + } + + private void addRecipes() { + addExtractorRecipe(ItemUtils.getSimpleStack(dropBiomassBlob), FluidUtils.getFluidStack("biomass", 30)); + addExtractorRecipe(ItemUtils.getSimpleStack(dropEthanolBlob), FluidUtils.getFluidStack("ethanol", 6)); + addExtractorRecipe(ItemUtils.getSimpleStack(dropFluorineBlob), FluidUtils.getFluidStack("fluorine", 4)); + } + + private void addExtractorRecipe(ItemStack input, FluidStack output) { + GTValues.RA.stdBuilder() + .itemInputs(input) + .fluidOutputs(output) + .duration(1 * SECONDS + 10 * TICKS) + .eut(8) + .addTo(fluidExtractionRecipes); + } + + private static boolean tryGetBeesBoolean() { + try { + Class mProxy = Class.forName("gregtech.GTMod.gregtechproxy"); + Field mNerf = FieldUtils.getDeclaredField(mProxy, "mGTBees", true); + boolean returnValue = (boolean) mNerf.get(GTMod.gregtechproxy); + return returnValue; + } catch (ClassNotFoundException | IllegalArgumentException | IllegalAccessException e) { + return false; + } + } + + private void setMaterials() { + try { + + Class gtBees = Class.forName("gregtech.loaders.misc.GTBees"); + Class gtCombItemClass = Class.forName("gregtech.common.items.ItemComb"); + Class gtCombEnumClass = Class.forName("gregtech.common.items.CombType"); + Field gtCombs = FieldUtils.getDeclaredField(gtBees, "combs", true); + gtCombs.setAccessible(true); + ReflectionUtils.makeFieldAccessible(gtCombs); + Enum gtCombTypeSlag = Enum.valueOf(gtCombEnumClass, "SLAG"); + Enum gtCombTypeStone = Enum.valueOf(gtCombEnumClass, "STONE"); + Object oCombObject = gtCombs.get(null); + + Logger.DEBUG_BEES("Field getModifiers: " + gtCombs.getModifiers()); + Logger.DEBUG_BEES("Field toGenericString: " + gtCombs.toGenericString()); + Logger.DEBUG_BEES("Field getClass: " + gtCombs.getClass()); + Logger.DEBUG_BEES("Field isEnumConstant: " + gtCombs.isEnumConstant()); + Logger.DEBUG_BEES("Field isSynthetic: " + gtCombs.isSynthetic()); + Logger.DEBUG_BEES("Field get(gtBees) != null: " + (gtCombs.get(gtBees) != null)); + Logger.DEBUG_BEES("Field isAccessible: " + gtCombs.isAccessible()); + + Logger.BEES("gtBees: " + (gtBees != null)); + Logger.BEES("gtCombItemClass: " + (gtCombItemClass != null)); + Logger.BEES("gtCombEnumClass: " + (gtCombEnumClass != null)); + Logger.BEES("gtCombs: " + (gtCombs != null)); + Logger.BEES("gtCombTypeSlag: " + (gtCombTypeSlag != null)); + Logger.BEES("gtCombTypeStone: " + (gtCombTypeStone != null)); + Logger.BEES("oCombObject: " + (oCombObject != null)); + + // if (gtCombItemClass.isInstance(oCombObject)){ + Method getStackForType; + getStackForType = gtCombItemClass.getDeclaredMethod("getStackForType", gtCombEnumClass); + + if (getStackForType != null) { + Logger.BEES("Found Method: getStackForType"); + } + if (Comb_Slag == null) { + Comb_Slag = (ItemStack) getStackForType.invoke(gtBees, gtCombTypeSlag); + } + if (Comb_Stone == null) { + Comb_Stone = (ItemStack) getStackForType.invoke(gtBees, gtCombTypeStone); + } + + } catch (NullPointerException | ClassNotFoundException | IllegalArgumentException | IllegalAccessException + | NoSuchMethodException | SecurityException | InvocationTargetException e) { + Logger.BEES("Bad Reflection. setMaterials()"); + } + + PTFE = trySetValue("Polytetrafluoroethylene"); + PBS = trySetValue("StyreneButadieneRubber"); + } + + private Materials trySetValue(String material) { + Materials mTemp = Materials.get(material); + if (mTemp != Materials._NULL) { + return mTemp; + } + return Materials._NULL; + } +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBranchDefinition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBranchDefinition.java new file mode 100644 index 0000000000..ca35849172 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPPBranchDefinition.java @@ -0,0 +1,76 @@ +package gtPlusPlus.xmod.forestry.bees.custom; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; + +import forestry.api.genetics.IAllele; +import forestry.api.genetics.IClassification; +import gtPlusPlus.api.objects.Logger; + +public enum GTPPBranchDefinition { + + ORGANIC("ORGANIC"), + GEM("GEM"), + METAL("METAL"), + RAREMETAL("RAREMETAL"), + RADIOACTIVE("RADIOACTIVE"); + + final String mFieldName; + final Enum mActualValues; + + GTPPBranchDefinition(String mValue) { + this.mFieldName = mValue; + this.mActualValues = setEnumVar(mValue); + } + + public final IAllele[] getTemplate() { + Class gtBranchDefClass; + try { + gtBranchDefClass = Class.forName("gregtech.loaders.misc.GTBranchDefinition"); + Enum enumA = mActualValues; + Method methodMyMethod = gtBranchDefClass.getMethod("getTemplate"); + + Logger.INFO("[Bees] gtBranchDefClass: " + (gtBranchDefClass != null)); + Logger.INFO("[Bees] enumA: " + (enumA != null)); + Logger.INFO("[Bees] methodMyMethod: " + (methodMyMethod != null)); + + return (IAllele[]) methodMyMethod.invoke(enumA); + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { + Logger.INFO("[Bees] Bad Reflection. getTemplate()"); + e.printStackTrace(); + // gregtech.loaders.misc.GT_BranchDefinition.getTemplate() + return null; + } + } + + public final IClassification getBranch() { + Class gtBranchDefClass; + try { + gtBranchDefClass = Class.forName("gregtech.loaders.misc.GTBranchDefinition"); + Enum enum_MY_SAMPLE_ENUM = mActualValues; + Method methodMyMethod = gtBranchDefClass.getMethod("getBranch"); + + Logger.INFO("[Bees] gtBranchDefClass: " + (gtBranchDefClass != null)); + Logger.INFO("[Bees] enum_MY_SAMPLE_ENUM: " + (enum_MY_SAMPLE_ENUM != null)); + Logger.INFO("[Bees] methodMyMethod: " + (methodMyMethod != null)); + + return (IClassification) methodMyMethod.invoke(enum_MY_SAMPLE_ENUM); + } catch (ClassNotFoundException | NoSuchMethodException | SecurityException | IllegalAccessException + | IllegalArgumentException | InvocationTargetException e) { + Logger.INFO("[Bees] Bad Reflection. getBranch()"); + e.printStackTrace(); + return null; + } + } + + private Enum setEnumVar(String value) { + try { + Class gtBranchDefClass = Class.forName("gregtech.loaders.misc.GTBranchDefinition"); + Enum branchDef = Enum.valueOf(gtBranchDefClass, value); + return branchDef; + } catch (ClassNotFoundException e) { + return null; + } + } +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java deleted file mode 100644 index 0cdb49a9b5..0000000000 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/custom/GTPP_Bee_Definition.java +++ /dev/null @@ -1,604 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.custom; - -import java.lang.reflect.Field; -import java.util.Arrays; -import java.util.Locale; - -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.BiomeDictionary.Type; - -import org.apache.commons.lang3.reflect.FieldUtils; -import org.apache.commons.lang3.text.WordUtils; - -import forestry.api.apiculture.BeeManager; -import forestry.api.apiculture.EnumBeeChromosome; -import forestry.api.apiculture.EnumBeeType; -import forestry.api.apiculture.IAlleleBeeSpecies; -import forestry.api.apiculture.IAlleleBeeSpeciesCustom; -import forestry.api.apiculture.IBee; -import forestry.api.apiculture.IBeeGenome; -import forestry.api.apiculture.IBeeMutationCustom; -import forestry.api.core.EnumHumidity; -import forestry.api.core.EnumTemperature; -import forestry.api.genetics.AlleleManager; -import forestry.api.genetics.IAllele; -import forestry.apiculture.genetics.Bee; -import forestry.apiculture.genetics.BeeDefinition; -import forestry.apiculture.genetics.BeeVariation; -import forestry.apiculture.genetics.IBeeDefinition; -import forestry.core.genetics.alleles.AlleleHelper; -import gregtech.loaders.misc.GT_BeeDefinition; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.ItemUtils; -import gtPlusPlus.core.util.reflect.ReflectionUtils; - -public enum GTPP_Bee_Definition implements IBeeDefinition { - - SILICON(GTPP_Branch_Definition.ORGANIC, "Silicon", true, Utils.rgbtoHexValue(75, 75, 75), - Utils.rgbtoHexValue(125, 125, 125)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getSlagComb(), 0.10f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SILICON), 0.20f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation( - getGregtechBeeType("SLIMEBALL"), - getGregtechBeeType("STICKYRESIN"), - 10); - } - }, - - RUBBER(GTPP_Branch_Definition.ORGANIC, "Rubber", true, Utils.rgbtoHexValue(55, 55, 55), - Utils.rgbtoHexValue(75, 75, 75)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getSlagComb(), 0.10f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.RUBBER), 0.30f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation( - getGregtechBeeType("SLIMEBALL"), - getGregtechBeeType("STICKYRESIN"), - 10); - } - }, - - PLASTIC(GTPP_Branch_Definition.ORGANIC, "Plastic", true, Utils.rgbtoHexValue(245, 245, 245), - Utils.rgbtoHexValue(175, 175, 175)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getStoneComb(), 0.30f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.PLASTIC), 0.15f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(RUBBER.species, getGregtechBeeType("OIL"), 10); - } - }, - - PTFE(GTPP_Branch_Definition.ORGANIC, "Ptfe", true, Utils.rgbtoHexValue(150, 150, 150), - Utils.rgbtoHexValue(75, 75, 75)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getStoneComb(), 0.30f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.PTFE), 0.10f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(RUBBER.species, PLASTIC.species, 10); - } - }, - - PBS(GTPP_Branch_Definition.ORGANIC, "Pbs", true, Utils.rgbtoHexValue(33, 26, 24), Utils.rgbtoHexValue(23, 16, 14)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(getStoneComb(), 0.30f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.PBS), 0.10f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(PTFE.species, PLASTIC.species, 10); - } - }, - - /** - * Fuels - */ - BIOMASS(GTPP_Branch_Definition.ORGANIC, "Biomass", true, Utils.rgbtoHexValue(33, 225, 24), - Utils.rgbtoHexValue(23, 175, 14)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SAND), 0.40f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.BIOMASS), 0.20f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); - } - - @Override - protected void setAlleles(IAllele[] template) { - template = BeeDefinition.COMMON.getTemplate(); - } - - @Override - protected void registerMutations() { - IBeeMutationCustom tMutation = registerMutation(getSpecies("Industrious"), getSpecies("Rural"), 10); - tMutation.restrictBiomeType(Type.FOREST); - } - }, - - ETHANOL(GTPP_Branch_Definition.ORGANIC, "Ethanol", true, Utils.rgbtoHexValue(255, 128, 0), - Utils.rgbtoHexValue(220, 156, 32)) { - - @Override - protected void setSpeciesProperties(IAlleleBeeSpeciesCustom beeSpecies) { - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.SAND), 0.40f); - beeSpecies.addProduct(GTPP_Bees.combs.getStackForType(CustomCombs.ETHANOL), 0.20f); - beeSpecies.setHumidity(EnumHumidity.NORMAL); - beeSpecies.setTemperature(EnumTemperature.NORMAL); -