diff options
| author | Martin Robertz <dream-master@gmx.net> | 2022-01-30 09:57:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-30 09:57:25 +0100 |
| commit | 69834eef41c6cb12d69b1963603f7426e0736682 (patch) | |
| tree | 4b3e3887be059a2e3373a89e7aa8ffa996478a05 /src/main/java/gtPlusPlus/xmod/forestry | |
| parent | 8cc0619706f93b4e81fb930ec7fb85cdcbd5d734 (diff) | |
| parent | 1d983706ef427b1d008787843ac23529e43cc659 (diff) | |
| download | GT5-Unofficial-69834eef41c6cb12d69b1963603f7426e0736682.tar.gz GT5-Unofficial-69834eef41c6cb12d69b1963603f7426e0736682.tar.bz2 GT5-Unofficial-69834eef41c6cb12d69b1963603f7426e0736682.zip | |
Merge pull request #102 from GTNewHorizons/St00f
St00f
Diffstat (limited to 'src/main/java/gtPlusPlus/xmod/forestry')
15 files changed, 1221 insertions, 10 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java b/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java index 05d00b06d9..694613c3ab 100644 --- a/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java +++ b/src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java @@ -4,14 +4,13 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import cpw.mods.fml.common.Optional; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.util.reflect.ReflectionUtils; 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; +import net.minecraft.block.Block; +import net.minecraft.world.World; public class HANDLER_FR { @@ -23,13 +22,13 @@ public class HANDLER_FR { public static void Init(){ if (LoadedMods.Forestry){ - //new GTPP_Bees(); TODO- Will Investigate this properly later. } } public static void postInit(){ if (LoadedMods.Forestry){ FR_Gregtech_Recipes.registerItems(); + new GTPP_Bees(); } } diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java new file mode 100644 index 0000000000..488ef2ea0b --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java @@ -0,0 +1,57 @@ +package gtPlusPlus.xmod.forestry.bees.handler; + +import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; +import net.minecraft.item.ItemStack; + +public enum GTPP_CombType { + + DRAGONBLOOD(0, "Dragon Blood", true, 30, Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20)), + FORCE(1, "Force", true, 30, Utils.rgbtoHexValue(250, 250, 20), Utils.rgbtoHexValue(200, 200, 5)); + + public boolean mShowInList; + public Material mMaterial; + public int mChance; + public int mID; + + private String mName; + private String mNameUnlocal; + private int[] mColour; + + private static void map(int aId, GTPP_CombType aType) { + GTPP_Bees.sCombMappings.put(aId, aType); + } + + public static GTPP_CombType get(int aID) { + return GTPP_Bees.sCombMappings.get(aID); + } + + GTPP_CombType(int aID, String aName, boolean aShow, int aChance, int... aColour) { + this.mID = aID; + this.mName = aName; + this.mNameUnlocal = aName.toLowerCase().replaceAll(" ", ""); + this.mChance = aChance; + this.mShowInList = aShow; + this.mColour = aColour; + map(aID, this); + this.mMaterial = GTPP_Bees.sMaterialMappings.get(aName.toLowerCase().replaceAll(" ", "")); + } + + public void setHidden() { + this.mShowInList = false; + } + + public String getName() { + return GT_LanguageManager.addStringLocalization("comb." + this.mNameUnlocal, this.mName + " Comb"); + } + + public int[] getColours() { + return mColour == null || mColour.length != 2 ? new int[]{0, 0} : mColour; + } + + public ItemStack getStackForType(int count) { + return new ItemStack(GTPP_Bees.combs, count, mID); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java new file mode 100644 index 0000000000..60b8a18e48 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java @@ -0,0 +1,56 @@ +package gtPlusPlus.xmod.forestry.bees.handler; + +import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; +import net.minecraft.item.ItemStack; + +public enum GTPP_DropType { + + DRAGONBLOOD(0, "Dragon Blood", true, Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20)), + FORCE(1, "Force", true, Utils.rgbtoHexValue(250, 250, 20), Utils.rgbtoHexValue(200, 200, 5)); + + public boolean mShowInList; + public Material mMaterial; + public int mChance; + public int mID; + + private String mName; + private String mNameUnlocal; + private int[] mColour; + + private static void map(int aId, GTPP_DropType aType) { + GTPP_Bees.sDropMappings.put(aId, aType); + } + + public static GTPP_DropType get(int aID) { + return GTPP_Bees.sDropMappings.get(aID); + } + + private GTPP_DropType(int aID, String aName, boolean aShow, int... aColour) { + this.mID = aID; + this.mName = aName; + this.mNameUnlocal = aName.toLowerCase().replaceAll(" ", ""); + this.mShowInList = aShow; + this.mColour = aColour; + map(aID, this); + this.mMaterial = GTPP_Bees.sMaterialMappings.get(aName.toLowerCase().replaceAll(" ", "")); + } + + public void setHidden() { + this.mShowInList = false; + } + + public String getName() { + return GT_LanguageManager.addStringLocalization("drop." + this.mNameUnlocal, this.mName + " Drop"); + } + + public int[] getColours() { + return mColour; + } + + public ItemStack getStackForType(int count) { + return new ItemStack(GTPP_Bees.drop, count, mID); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java new file mode 100644 index 0000000000..70dae45d06 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java @@ -0,0 +1,55 @@ +package gtPlusPlus.xmod.forestry.bees.handler; + +import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; +import net.minecraft.item.ItemStack; + +public enum GTPP_PollenType { + + DRAGONBLOOD(0, "Dragon Blood", true, Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20)); + + public boolean mShowInList; + public Material mMaterial; + public int mChance; + public int mID; + + private String mName; + private String mNameUnlocal; + private int[] mColour; + + private static void map(int aId, GTPP_PollenType aType) { + GTPP_Bees.sPollenMappings.put(aId, aType); + } + + public static GTPP_PollenType get(int aID) { + return GTPP_Bees.sPollenMappings.get(aID); + } + + private GTPP_PollenType(int aID, String aName, boolean aShow, int... aColour) { + this.mID = aID; + this.mName = aName; + this.mNameUnlocal = aName.toLowerCase().replaceAll(" ", ""); + this.mShowInList = aShow; + this.mColour = aColour; + map(aID, this); + this.mMaterial = GTPP_Bees.sMaterialMappings.get(aName.toLowerCase().replaceAll(" ", "")); + } + + public void setHidden() { + this.mShowInList = false; + } + + public String getName() { + return GT_LanguageManager.addStringLocalization("pollen." + this.mNameUnlocal, this.mName + " Pollen"); + } + + public int[] getColours() { + return mColour; + } + + public ItemStack getStackForType(int count) { + return new ItemStack(GTPP_Bees.pollen, count, mID); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java new file mode 100644 index 0000000000..20e4f31008 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java @@ -0,0 +1,56 @@ +package gtPlusPlus.xmod.forestry.bees.handler; + +import gregtech.api.util.GT_LanguageManager; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; +import net.minecraft.item.ItemStack; + +public enum GTPP_PropolisType { + + DRAGONBLOOD(0, "Dragon Blood", true, Utils.rgbtoHexValue(220, 20, 20)), + FORCE(1, "Force", true, Utils.rgbtoHexValue(250, 250, 20)); + + public boolean mShowInList; + public Material mMaterial; + public int mChance; + public int mID; + + private String mName; + private String mNameUnlocal; + private int mColour; + + private static void map(int aId, GTPP_PropolisType aType) { + GTPP_Bees.sPropolisMappings.put(aId, aType); + } + + public static GTPP_PropolisType get(int aID) { + return GTPP_Bees.sPropolisMappings.get(aID); + } + + private GTPP_PropolisType(int aID, String aName, boolean aShow, int aColour) { + this.mID = aID; + this.mName = aName; + this.mNameUnlocal = aName.toLowerCase().replaceAll(" ", ""); + this.mShowInList = aShow; + this.mColour = aColour; + map(aID, this); + this.mMaterial = GTPP_Bees.sMaterialMappings.get(aName.toLowerCase().replaceAll(" ", "")); + } + + public void setHidden() { + this.mShowInList = false; + } + + public String getName() { + return GT_LanguageManager.addStringLocalization("propolis." + this.mNameUnlocal, this.mName + " Propolis"); + } + + public int getColours() { + return mColour; + } + + public ItemStack getStackForType(int count) { + return new ItemStack(GTPP_Bees.propolis, count, mID); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_CustomBee.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_CustomBee.java deleted file mode 100644 index 7d9a9e231b..0000000000 --- a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_CustomBee.java +++ /dev/null @@ -1,5 +0,0 @@ -package gtPlusPlus.xmod.forestry.bees.items; - -public class FR_CustomBee { - -} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Comb.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Comb.java new file mode 100644 index 0000000000..26b32c8b22 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Comb.java @@ -0,0 +1,138 @@ +package gtPlusPlus.xmod.forestry.bees.items.output; + +import static gregtech.api.enums.GT_Values.L; +import static gregtech.api.enums.GT_Values.NF; +import static gregtech.api.enums.GT_Values.NI; +import static gregtech.api.enums.GT_Values.RA; +import static gregtech.api.enums.GT_Values.V; + +import java.util.Arrays; +import java.util.List; + +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableMap.Builder; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import forestry.api.core.Tabs; +import forestry.api.recipes.RecipeManagers; +import gregtech.GT_Mod; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType; +import gtPlusPlus.xmod.forestry.bees.handler.GTPP_DropType; +import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PropolisType; +import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + +public class GTPP_Comb extends Item { + + @SideOnly(Side.CLIENT) + private IIcon secondIcon; + + public GTPP_Comb() { + super(); + this.setCreativeTab(Tabs.tabApiculture); + this.setHasSubtypes(true); + this.setUnlocalizedName("gtpp.comb"); + GameRegistry.registerItem(this, "gtpp.comb", CORE.MODID); + } + + public ItemStack getStackForType(GTPP_CombType type) { + return new ItemStack(this, 1, type.mID); + } + + public ItemStack getStackForType(GTPP_CombType type, int count) { + return new ItemStack(this, count, type.mID); + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tabs, List list) { + for (GTPP_CombType type : GTPP_CombType.values()) { + if (type.mShowInList) { + list.add(this.getStackForType(type)); + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + public int getRenderPasses(int meta) { + return 2; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + this.itemIcon = par1IconRegister.registerIcon("forestry:beeCombs.0"); + this.secondIcon = par1IconRegister.registerIcon("forestry:beeCombs.1"); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return (pass == 0) ? itemIcon : secondIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int pass) { + int colour = GTPP_CombType.get(stack.getItemDamage()).getColours()[0]; + + if (pass >= 1) { + colour = GTPP_CombType.get(stack.getItemDamage()).getColours()[1]; + } + + return colour; + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + return GTPP_CombType.get(stack.getItemDamage()).getName(); + } + + public static void initCombsRecipes() { + + addChemicalRecipe(GTPP_CombType.DRAGONBLOOD, new ItemStack[]{GT_ModHandler.getModItem("Forestry", "refractoryWax", 1L, 0), GTPP_Bees.propolis.getStackForType(GTPP_PropolisType.DRAGONBLOOD), GTPP_Bees.drop.getStackForType(GTPP_DropType.DRAGONBLOOD)}, new int[]{3000, 1500, 500}); + addChemicalRecipe(GTPP_CombType.FORCE, new ItemStack[]{GT_ModHandler.getModItem("Forestry", "beeswax", 1L, 0), GTPP_Bees.propolis.getStackForType(GTPP_PropolisType.FORCE), GTPP_Bees.drop.getStackForType(GTPP_DropType.FORCE)}, new int[]{5000, 3000, 1000}); + + } + + public static void addChemicalRecipe(GTPP_CombType aInputStack, ItemStack[] aOutputs, int[] aChances) { + Material aMat = aInputStack.mMaterial; + long aEU = aMat.vVoltageMultiplier; + int aTier = Math.max(aMat.vTier/2, 1); + CORE.RA.addChemicalPlantRecipe( + new ItemStack[] { + aInputStack.getStackForType(aTier), + }, + new FluidStack[] {}, + aOutputs, + new FluidStack[] {}, + aChances, + aTier * 20 * 60, + aEU, + aTier); + + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Drop.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Drop.java new file mode 100644 index 0000000000..922adad277 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Drop.java @@ -0,0 +1,113 @@ +package gtPlusPlus.xmod.forestry.bees.items.output; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import forestry.api.core.Tabs; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.forestry.bees.handler.GTPP_DropType; +import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; +import net.minecraftforge.fluids.FluidStack; + +public class GTPP_Drop extends Item { + + @SideOnly(Side.CLIENT) + private IIcon secondIcon; + + public GTPP_Drop() { + super(); + this.setCreativeTab(Tabs.tabApiculture); + this.setHasSubtypes(true); + this.setUnlocalizedName("gtpp.drop"); + GameRegistry.registerItem(this, "gtpp.drop", CORE.MODID); + } + + public ItemStack getStackForType(GTPP_DropType type) { + return new ItemStack(this, 1, type.mID); + } + + public ItemStack getStackForType(GTPP_DropType type, int count) { + return new ItemStack(this, count, type.mID); + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tabs, List list) { + for (GTPP_DropType type : GTPP_DropType.values()) { + if (type.mShowInList) { + list.add(this.getStackForType(type)); + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + public int getRenderPasses(int meta) { + return 2; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + this.itemIcon = par1IconRegister.registerIcon("forestry:honeyDrop.0"); + this.secondIcon = par1IconRegister.registerIcon("forestry:honeyDrop.1"); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return (pass == 0) ? itemIcon : secondIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int pass) { + int colour = GTPP_DropType.get(stack.getItemDamage()).getColours()[0]; + + if (pass >= 1) { + colour = GTPP_DropType.get(stack.getItemDamage()).getColours()[1]; + } + + return colour; + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + return GTPP_DropType.get(stack.getItemDamage()).getName(); + } + + private static final int[] sFluidOutputs = new int[] { + 144, 136, 128, 120, 112, 104, 96, 88, 80, 72, 64, 48, 32, 16, 8, 4 + }; + + public static void initDropsRecipes() { + ItemStack tDrop; + Logger.BEES("Processing recipes for "+GTPP_Bees.sDropMappings.size()+" Drops."); + for (GTPP_DropType aDrop : GTPP_Bees.sDropMappings.values()) { + tDrop = aDrop.getStackForType(1); + if (addProcess(tDrop, new FluidStack(aDrop.mMaterial.getFluid(), sFluidOutputs[aDrop.mMaterial.vTier]), aDrop.mMaterial.vTier * 20 * 30, aDrop.mMaterial.vVoltageMultiplier)) { + Logger.BEES("Added Drop extraction recipe for: "+aDrop.getName()); + } + else { + Logger.BEES("Failed to add Drop extraction recipe for: "+aDrop.getName()); + } + } + } + + public static boolean addProcess(ItemStack tDrop, FluidStack aOutput, int aDuration, int aEUt) { + return GT_Values.RA.addFluidExtractionRecipe(tDrop, null, aOutput, 10000, aDuration, aEUt); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Pollen.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Pollen.java new file mode 100644 index 0000000000..9d13ca7ebd --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Pollen.java @@ -0,0 +1,89 @@ +package gtPlusPlus.xmod.forestry.bees.items.output; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import forestry.api.core.Tabs; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PollenType; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class GTPP_Pollen extends Item { + + @SideOnly(Side.CLIENT) + private IIcon secondIcon; + + public GTPP_Pollen() { + super(); + this.setCreativeTab(Tabs.tabApiculture); + this.setHasSubtypes(true); + this.setUnlocalizedName("gtpp.pollen"); + GameRegistry.registerItem(this, "gtpp.pollen", CORE.MODID); + } + + public ItemStack getStackForType(GTPP_PollenType type) { + return new ItemStack(this, 1, type.mID); + } + + public ItemStack getStackForType(GTPP_PollenType type, int count) { + return new ItemStack(this, count, type.mID); + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tabs, List list) { + for (GTPP_PollenType type : GTPP_PollenType.values()) { + if (type.mShowInList) { + list.add(this.getStackForType(type)); + } + } + } + + @Override + @SideOnly(Side.CLIENT) + public boolean requiresMultipleRenderPasses() { + return true; + } + + @Override + public int getRenderPasses(int meta) { + return 2; + } + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + this.itemIcon = par1IconRegister.registerIcon("forestry:pollen.0"); + this.secondIcon = par1IconRegister.registerIcon("forestry:pollen.1"); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return (pass == 0) ? itemIcon : secondIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int pass) { + int colour = GTPP_PollenType.get(stack.getItemDamage()).getColours()[0]; + + if (pass >= 1) { + colour = GTPP_PollenType.get(stack.getItemDamage()).getColours()[1]; + } + + return colour; + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + return GTPP_PollenType.get(stack.getItemDamage()).getName(); + } + + +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Propolis.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Propolis.java new file mode 100644 index 0000000000..fef721839b --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Propolis.java @@ -0,0 +1,91 @@ +package gtPlusPlus.xmod.forestry.bees.items.output; + +import java.util.List; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import forestry.api.core.Tabs; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.forestry.bees.handler.GTPP_PropolisType; +import gtPlusPlus.xmod.forestry.bees.registry.GTPP_Bees; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.IIcon; + +public class GTPP_Propolis extends Item { + + @SideOnly(Side.CLIENT) + private IIcon secondIcon; + + public GTPP_Propolis() { + super(); + this.setCreativeTab(Tabs.tabApiculture); + this.setHasSubtypes(true); + this.setUnlocalizedName("gtpp.propolis"); + GameRegistry.registerItem(this, "gtpp.propolis", CORE.MODID); + } + + public ItemStack getStackForType(GTPP_PropolisType type) { + return new ItemStack(this, 1, type.mID); + } + + public ItemStack getStackForType(GTPP_PropolisType type, int count) { + return new ItemStack(this, count, type.mID); + } + + @Override + @SideOnly(Side.CLIENT) + public void getSubItems(Item item, CreativeTabs tabs, List list) { + for (GTPP_PropolisType type : GTPP_PropolisType.values()) { + if (type.mShowInList) { + list.add(this.getStackForType(type)); + } + } + } + + + @Override + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister par1IconRegister) { + this.itemIcon = par1IconRegister.registerIcon("forestry:propolis.0"); + } + + @Override + public IIcon getIcon(ItemStack stack, int pass) { + return itemIcon; + } + + @Override + @SideOnly(Side.CLIENT) + public int getColorFromItemStack(ItemStack stack, int pass) { + return GTPP_PropolisType.get(stack.getItemDamage()).getColours(); + } + + @Override + public String getItemStackDisplayName(ItemStack stack) { + return GTPP_PropolisType.get(stack.getItemDamage()).getName(); + } + + public static void initPropolisRecipes() { + ItemStack tDrop; + Logger.BEES("Processing recipes for "+GTPP_Bees.sPropolisMappings.size()+" Propolis."); + for (GTPP_PropolisType aProp : GTPP_Bees.sPropolisMappings.values()) { + tDrop = aProp.getStackForType(1); + if (addProcess(tDrop, aProp.mMaterial.getDust(1), Math.min(Math.max(10000-(aProp.mMaterial.vTier*625), 100), 10000), aProp.mMaterial.vTier * 20 * 15, aProp.mMaterial.vVoltageMultiplier)) { + Logger.BEES("Added Propolis extraction recipe for: "+aProp.getName()); + } + else { + Logger.BEES("Failed to add Propolis extraction recipe for: "+aProp.getName()); + } + } + } + + public static boolean addProcess(ItemStack tDrop, ItemStack aOutput, int aChance, int aDuration, int aEUt) { + return CORE.RA.addExtractorRecipe(tDrop, aOutput, aChance, aDuration, aEUt); + } +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java new file mode 100644 index 0000000000..222b1215eb --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java @@ -0,0 +1,40 @@ +package gtPlusPlus.xmod.forestry.bees.registry; + +import forestry.api.apiculture.EnumBeeChromosome; +import forestry.api.apiculture.IAlleleBeeSpeciesCustom; +import forestry.api.genetics.AlleleManager; +import forestry.api.genetics.IClassification; +import forestry.apiculture.genetics.alleles.AlleleBeeSpecies; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; + +public class GTPP_AlleleBeeSpecies extends AlleleBeeSpecies { + + public GTPP_AlleleBeeSpecies(String uid, boolean dominant, String unlocalizedName, String authority, String unlocalizedDescription, IClassification branch, String binomial, int primaryColor, int secondaryColor) { + super(uid, unlocalizedName, authority, unlocalizedDescription, dominant, branch, binomial, primaryColor, secondaryColor); + AlleleManager.alleleRegistry.registerAllele(this, EnumBeeChromosome.SPECIES); + } + + @Override + public IAlleleBeeSpeciesCustom addProduct(ItemStack product, Float chance) { + if (product == null || product.getItem() == null) { + product = new ItemStack(Items.boat); + } + if (chance <= 0.0f || chance > 1.0f) { + chance = 0.1f; + } + return super.addProduct(product, chance); + } + + @Override + public IAlleleBeeSpeciesCustom addSpecialty(ItemStack specialty, Float chance) { + if (specialty == null || specialty.getItem() == null) { + specialty = new ItemStack(Items.boat); + } + if (chance <= 0.0f || chance > 1.0f) { + chance = 0.1f; + } + return super.addSpecialty(specialty, chance); + } + +} diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java new file mode 100644 index 0000000000..f94a178007 --- /dev/null +++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java @@ -0,0 +1,294 @@ +package gtPlusPlus.xmod.forestry.bees.registry; + +import static forestry.api.apiculture.EnumBeeChromosome.*; +import static forestry.api.core.EnumHumidity.ARID; + +import java.lang.reflect.Field; +import java.util.Arrays; +import java.util.Locale; +import java.util.function.Consumer; + +import org.apache.commons.lang3.text.WordUtils; + +import forestry.api.apiculture.*; +import forestry.api.core.EnumHumidity; +import forestry.api.core.EnumTemperature; +import forestry.api.genetics.*; +import forestry.apiculture.genetics.*; +import forestry.apiculture.genetics.alleles.AlleleEffect; +import forestry.core.genetics.alleles.AlleleHelper; +import forestry.core.genetics.alleles.EnumAllele.Lifespan; +import forestry.core.genetics.alleles.EnumAllele.Tolerance; +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_ModHandler; +import gregtech.common.items.CombType; +import gregtech.loaders.misc.GT_Bees; +import gtPlusPlus.core.material.ELEMENT.STANDALONE; +import gtPlusPlus.core.material.Material; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.BiomeDictionary.Type; + +public enum GTPP_BeeDefinition implements IBeeDefinition { + + DRAGONBLOOD(GTPP_BranchDefinition.LEGENDARY, "Dragon Blood", STANDALONE.DRAGON_METAL, true, Utils.rgbtoHexValue(220, 20, 20), Utils.rgbtoHexValue(20, 20, 20), + beeSpecies -> { + beeSpecies.addProduct(GT_ModHandler.getModItem(GT_Values.MOD_ID_FR, "beeCombs", 1, 8), 0.30f); + beeSpecies.addSpecialty(GTPP_Bees.combs.getStackForType(GTPP_CombType.DRAGONBLOOD), 0.10f); + beeSpecies.setHumidity(ARID); + beeSpecies.setTemperature(EnumTemperature.NORMAL); + beeSpecies.setHasEffect(); + }, + template -> { + AlleleHelper.instance.set(template, LIFESPAN, Lifespan.LONGER); + AlleleHelper.instance.set(template, EFFECT, AlleleEffect.effectAggressive); + AlleleHelper.instance.set(template, TEMPERATURE_TOLERANCE, Tolerance.BOTH_3); + AlleleHelper.instance.set(template, HUMIDITY_TOLERANCE, Tolerance.BOTH_3); + }, + dis -> { + IBeeMutationCustom tMutation = dis.registerMutation("DRAGONESSENCE", "NEUTRONIUM", 2); + tMutation.restrictHumidity(ARID); + tMutation.requireResource(STANDALONE.DRAGON_METAL.getBlock(), 1); + tMutation.addMutationCondition(new GT_Bees.DimensionMutationCondition(1, "End"));//End Dim + } + ), + FORCE(GTPP_BranchDefinition.LEGENDARY, "Force", STANDALONE.FORCE, true, Utils.rgbtoHexValue(250, 250, 20), Utils.rgbtoHexValue(200, 200, 5), + beeSpecies -> { + beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.STONE), 0.30f); + beeSpecies.addProduct(GT_Bees.combs.getStackForType(CombType.SALT |
