aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gtPlusPlus/xmod
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2022-01-30 09:57:25 +0100
committerGitHub <noreply@github.com>2022-01-30 09:57:25 +0100
commit69834eef41c6cb12d69b1963603f7426e0736682 (patch)
tree4b3e3887be059a2e3373a89e7aa8ffa996478a05 /src/main/java/gtPlusPlus/xmod
parent8cc0619706f93b4e81fb930ec7fb85cdcbd5d734 (diff)
parent1d983706ef427b1d008787843ac23529e43cc659 (diff)
downloadGT5-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')
-rw-r--r--src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java2
-rw-r--r--src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Force.java53
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/HANDLER_FR.java9
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_CombType.java57
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_DropType.java56
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PollenType.java55
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/handler/GTPP_PropolisType.java56
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/items/FR_CustomBee.java5
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Comb.java138
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Drop.java113
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Pollen.java89
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/items/output/GTPP_Propolis.java91
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_AlleleBeeSpecies.java40
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BeeDefinition.java294
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java80
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java74
-rw-r--r--src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java74
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java71
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java27
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java1
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java4
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java82
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java50
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java1
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java462
-rw-r--r--src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java33
27 files changed, 1787 insertions, 232 deletions
diff --git a/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java b/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java
index 48813310d2..033aaac663 100644
--- a/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java
+++ b/src/main/java/gtPlusPlus/xmod/bartcrops/LoaderOfTheCrops.java
@@ -5,6 +5,7 @@ import java.util.List;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import gtPlusPlus.core.util.minecraft.ItemUtils;
+import gtPlusPlus.xmod.bartcrops.crops.Crop_Force;
import gtPlusPlus.xmod.bartcrops.crops.Crop_Hemp;
import ic2.api.crops.CropCard;
import ic2.api.crops.Crops;
@@ -48,6 +49,7 @@ public class LoaderOfTheCrops {
List<LoaderOfTheCrops> p = new ArrayList<LoaderOfTheCrops>();
p.add(new LoaderOfTheCrops(new Crop_Hemp(), new ItemStack(Item.getItemById(111), 3)));
+ p.add(new LoaderOfTheCrops(new Crop_Force(), new ItemStack(Item.getItemById(111), 3)));
return p;
}
diff --git a/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java b/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java
index ca2a044564..0f590dcf2b 100644
--- a/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java
+++ b/src/main/java/gtPlusPlus/xmod/bartcrops/abstracts/BaseCrop.java
@@ -14,10 +14,10 @@ import net.minecraft.util.IIcon;
import speiger.src.crops.api.ICropCardInfo;
public abstract class BaseCrop extends CropCard implements ICropCardInfo {
+
@SideOnly(Side.CLIENT)
public void registerSprites(IIconRegister iconRegister) {
this.textures = new IIcon[this.maxSize()];
-
for (int i = 1; i <= this.textures.length; ++i) {
this.textures[i - 1] = iconRegister.registerIcon(CORE.MODID+":crop/blockCrop." + this.name() + "." + i);
}
diff --git a/src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Force.java b/src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Force.java
new file mode 100644
index 0000000000..06238a4589
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/bartcrops/crops/Crop_Force.java
@@ -0,0 +1,53 @@
+package gtPlusPlus.xmod.bartcrops.crops;
+
+import gtPlusPlus.core.material.ELEMENT.STANDALONE;
+import gtPlusPlus.core.util.math.MathUtils;
+import gtPlusPlus.preloader.CORE_Preloader;
+import gtPlusPlus.xmod.bartcrops.abstracts.BaseAestheticCrop;
+import ic2.api.crops.ICropTile;
+import net.minecraft.item.ItemStack;
+
+public class Crop_Force extends BaseAestheticCrop {
+
+ public int tier() {
+ return 4;
+ }
+
+ public String name() {
+ return "Force";
+ }
+
+ public String discoveredBy() {
+ return "Alkalus";
+ }
+
+ public int growthDuration(ICropTile crop) {
+ int ret = 800;
+
+ /*if (crop.isBlockBelow(Blocks.dirt) || crop.isBlockBelow(Blocks.flowing_water)) {
+ ret = 225;
+ }*/
+
+ if (CORE_Preloader.DEBUG_MODE) {
+ ret = 1;
+ }
+
+ return ret;
+ }
+
+ public String[] attributes() {
+ return new String[]{"Power", "Soil", "Yellow", "Gold"};
+ }
+
+ public ItemStack getGain(ICropTile crop) {
+ ItemStack ret = this.getDisplayItem();
+ if (MathUtils.randInt(0, 10) > 8) {
+ ret = STANDALONE.FORCE.getNugget(MathUtils.randInt(4, 8));
+ }
+ return ret;
+ }
+
+ public ItemStack getDisplayItem() {
+ return STANDALONE.FORCE.getNugget(0);
+ }
+} \ No newline at end of file
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), 0.15f);
+ beeSpecies.addSpecialty(GTPP_Bees.combs.getStackForType(GTPP_CombType.FORCE), 0.10f);
+ beeSpecies.setHumidity(EnumHumidity.NORMAL);
+ beeSpecies.setTemperature(EnumTemperature.HOT);
+ beeSpecies.setHasEffect();
+ },
+ template -> {
+ AlleleHelper.instance.set(template, LIFESPAN, Lifespan.NORMAL);
+ AlleleHelper.instance.set(template, EFFECT, AlleleEffect.effectAggressive);
+ AlleleHelper.instance.set(template, TEMPERATURE_TOLERANCE, Tolerance.BOTH_1);
+ AlleleHelper.instance.set(template, HUMIDITY_TOLERANCE, Tolerance.BOTH_1);
+ },
+ dis -> {
+ IBeeMutationCustom tMutation = dis.registerMutation("STEEL", "GOLD", 10);
+ tMutation.restrictHumidity(ARID);
+ tMutation.restrictBiomeType(Type.HOT);
+ }
+ ),
+
+ ;
+ private final GTPP_BranchDefinition branch;
+ private final GTPP_AlleleBeeSpecies species;
+ private final Consumer<GTPP_AlleleBeeSpecies> mSpeciesProperties;
+ private final Consumer<IAllele[]> mAlleles;
+ private final Consumer<GTPP_BeeDefinition> mMutations;
+ private IAllele[] template;
+ private IBeeGenome genome;
+
+ GTPP_BeeDefinition(GTPP_BranchDefinition branch, String binomial, Materials aMat, boolean dominant, int primary, int secondary, Consumer<GTPP_AlleleBeeSpecies> aSpeciesProperties, Consumer<IAllele[]> aAlleles, Consumer<GTPP_BeeDefinition> aMutations) {
+ this(branch, binomial, MaterialUtils.generateMaterialFromGtENUM(aMat), dominant, primary, secondary, aSpeciesProperties, aAlleles, aMutations);
+ }
+
+ GTPP_BeeDefinition(GTPP_BranchDefinition branch, String binomial, Material aMat, boolean dominant, int primary, int secondary, Consumer<GTPP_AlleleBeeSpecies> aSpeciesProperties, Consumer<IAllele[]> aAlleles, Consumer<GTPP_BeeDefinition> aMutations) {
+ this.mAlleles = aAlleles;
+ this.mMutations = aMutations;
+ this.mSpeciesProperties = aSpeciesProperties;
+ String lowercaseName = this.toString().toLowerCase(Locale.ENGLISH);
+ String species = WordUtils.capitalize(binomial);
+ String uid = "gtpp.bee.species" + species;
+ String description = "for.description." + species;
+ String name = "for.bees.species." + lowercaseName;
+ GT_LanguageManager.addStringLocalization("for.bees.species." + lowercaseName, species, true);
+ GTPP_Bees.sMaterialMappings.put(binomial.toLowerCase().replaceAll(" ", ""), aMat);
+ this.branch = branch;
+ this.species = new GTPP_AlleleBeeSpecies(uid, dominant, name, "GT++", description, branch.getBranch(), binomial, primary, secondary);
+ }
+
+ public static void initBees() {
+ for (GTPP_BeeDefinition bee : values()) { bee.init(); }
+ for (GTPP_BeeDefinition bee : values()) { bee.registerMutations(); }
+ }
+
+ protected static IAlleleBeeEffect getEffect(byte modid, String name) {
+ String s;
+ switch (modid) {
+ case GTPP_Bees.EXTRABEES :
+ s = "extrabees.effect." + name;
+ break;
+ case GTPP_Bees.GENDUSTRY :
+ s = "gendustry.effect." + name;
+ break;
+ case GTPP_Bees.MAGICBEES :
+ s = "magicbees.effect" + name;
+ break;
+ case GTPP_Bees.GREGTECH :
+ s = "gregtech.effect" + name;
+ break;
+ default :
+ s = "forestry.effect" + name;
+ break;
+
+ }
+ return (IAlleleBeeEffect) AlleleManager.alleleRegistry.getAllele(s);
+ }
+
+ protected static IAlleleFlowers getFlowers(byte modid, String name) {
+ String s;
+ switch (modid) {
+ case GTPP_Bees.EXTRABEES :
+ s = "extrabees.flower." + name;
+ break;
+ case GTPP_Bees.GENDUSTRY :
+ s = "gendustry.flower." + name;
+ break;
+ case GTPP_Bees.MAGICBEES :
+ s = "magicbees.flower" + name;
+ break;
+ case GTPP_Bees.GREGTECH :
+ s = "gregtech.flower" + name;
+ break;
+ default :
+ s = "forestry.flowers" + name;
+ break;
+
+ }
+ return (IAlleleFlowers) AlleleManager.alleleRegistry.getAllele(s);
+ }
+
+ protected static IAlleleBeeSpecies getSpecies(byte modid, String name) {
+ String s;
+ switch (modid) {
+ case GTPP_Bees.EXTRABEES :
+ s = "extrabees.species." + name;
+ break;
+ case GTPP_Bees.GENDUSTRY :
+ s = "gendustry.bee." + name;
+ break;
+ case GTPP_Bees.MAGICBEES :
+ s = "magicbees.species" + name;
+ break;
+ case GTPP_Bees.GREGTECH :
+ s = "gregtech.species" + name;
+ break;
+ default :
+ s = "forestry.species" + name;
+ break;
+
+ }
+ IAlleleBeeSpecies ret = (IAlleleBeeSpecies) AlleleManager.alleleRegistry.getAllele(s);
+ return ret;
+ }
+
+ protected final void setSpeciesProperties(GTPP_AlleleBeeSpecies species2) {
+ this.mSpeciesProperties.accept(species2);
+ }
+
+ protected final void setAlleles(IAllele[] template) {
+ this.mAlleles.accept(template);
+ }
+
+ protected final void registerMutations() {
+ this.mMutations.accept(this);
+ }
+
+ private void init() {
+ setSpeciesProperties(species);
+
+ template = branch.getTemplate();
+ AlleleHelper.instance.set(template, SPECIES, species);
+ setAlleles(template);
+
+ genome = BeeManager.beeRoot.templateAsGenome(template);
+
+ BeeManager.beeRoot.registerTemplate(template);
+ }
+
+ protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance) {
+ return registerMutation(parent1, parent2, chance, 1f);
+ }
+
+ protected final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance) {
+ return registerMutation(parent1, parent2, chance, 1f);
+ }
+
+ protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, int chance) {
+ return registerMutation(parent1, parent2, chance, 1f);
+ }
+
+ protected final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, int chance) {
+ return registerMutation(parent1, parent2, chance, 1f);
+ }
+
+ protected final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance) {
+ return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, 1f);
+ }
+
+ /**
+ * Diese neue Funtion erlaubt Mutationsraten unter 1%. Setze dazu die
+ * Mutationsrate als Bruch mit chance / chancedivider This new function
+ * allows Mutation percentages under 1%. Set them as a fraction with chance
+ * / chancedivider
+ */
+ protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, IAlleleBeeSpecies parent2, int chance, float chancedivider) {
+ return new GTPP_Bee_Mutation(parent1, parent2, this.getTemplate(), chance, chancedivider);
+ }
+
+ protected final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, IAlleleBeeSpecies parent2, int chance, float chancedivider) {
+ return registerMutation(parent1.species, parent2, chance, chancedivider);
+ }
+
+ protected final IBeeMutationCustom registerMutation(IAlleleBeeSpecies parent1, GTPP_BeeDefinition parent2, int chance, float chancedivider) {
+ return registerMutation(parent1, parent2.species, chance, chancedivider);
+ }
+
+ protected final IBeeMutationCustom registerMutation(GTPP_BeeDefinition parent1, GTPP_BeeDefinition parent2, int chance, float chancedivider) {
+ return registerMutation(parent1.species, parent2, chance, chancedivider);
+ }
+
+ protected final IBeeMutationCustom registerMutation(String parent1, String parent2, int chance, float chancedivider) {
+ return registerMutation(getGregtechBeeType(parent1), getGregtechBeeType(parent2), chance, chancedivider);
+ }
+
+ @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) {
+ return BeeManager.beeRoot.getMemberStack(getIndividual(), beeType.ordinal());
+ }
+
+ public final IBeeDefinition getRainResist() {
+ return new BeeVariation.RainResist(this);
+ }
+
+ private static final Class sGtBees = ReflectionUtils.getClass("gregtech.loaders.misc.GT_BeeDefinition");
+
+ public static IAlleleBeeSpecies getGregtechBeeType(String name) {
+ try {
+ Enum aBeeObject = ReflectionUtils.getEnum(sGtBees, name);
+ Field gtBeesField = ReflectionUtils.getField(sGtBees, "species");
+ IAlleleBeeSpecies beeType = ReflectionUtils.getFieldValue(gtBeesField, aBeeObject);
+ return beeType != null ? beeType : null;
+ }
+ catch (Throwable t) {
+ t.printStackTrace();
+ return null;
+ }
+
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java
new file mode 100644
index 0000000000..92a2a9fb30
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bee_Mutation.java
@@ -0,0 +1,80 @@
+package gtPlusPlus.xmod.forestry.bees.registry;
+
+import forestry.api.apiculture.*;
+import forestry.api.core.IClimateProvider;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IGenome;
+import forestry.api.genetics.IMutationCondition;
+import forestry.apiculture.genetics.BeeMutation;
+import forestry.core.genetics.mutations.Mutation;
+import net.minecraft.util.ChunkCoordinates;
+import net.minecraft.world.World;
+import org.apache.commons.lang3.reflect.FieldUtils;
+
+import java.lang.reflect.Field;
+import java.util.List;
+
+
+public class GTPP_Bee_Mutation extends BeeMutation {
+
+ private final float split;
+
+ public GTPP_Bee_Mutation(IAlleleBeeSpecies bee0, IAlleleBeeSpecies bee1, IAllele[] result, int chance, float split) {
+ super(bee0, bee1, result, chance);
+ this.split = split;
+ BeeManager.beeRoot.registerMutation(this);
+ }
+
+ @Override
+ public float getBaseChance() {
+ return super.getBaseChance() / split;
+ }
+
+ @Override
+ public float getChance(IBeeHousing housing, IAlleleBeeSpecies allele0, IAlleleBeeSpecies allele1, IBeeGenome genome0, IBeeGenome genome1) {
+ World world = housing != null ? housing.getWorld() : null;
+ ChunkCoordinates housingCoordinates = housing != null ? housing.getCoordinates() : null;
+ int x = housingCoordinates != null ? housingCoordinates.posX : 0;
+ int y = housingCoordinates != null ? housingCoordinates.posY : 0;
+ int z = housingCoordinates != null ? housingCoordinates.posZ : 0;
+
+ float processedChance = getBasicChance(world, x, y, z, allele0, allele1, genome0, genome1, housing);
+
+ if (processedChance <= 0f) {
+ return 0f;
+ }
+
+ IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
+ IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world).getBeeModifier();
+
+ processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
+ processedChance *= beeModeModifier.getMutationModifier(genome0, genome1, processedChance);
+
+ return processedChance;
+ }
+
+ @SuppressWarnings("unchecked")
+ private float getBasicChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0, IGenome genome1, IClimateProvider climate) {
+ float mutationChance = this.getBaseChance();
+ List<IMutationCondition> mutationConditions = null;
+ Field f = FieldUtils.getDeclaredField(Mutation.class, "mutationConditions", true);
+ if (f == null)
+ f = FieldUtils.getField(Mutation.class, "mutationConditions", true);
+ if (f == null)
+ return mutationChance;
+ try {
+ mutationConditions = f.get(this) instanceof List ? (List<IMutationCondition>) f.get(this) : null;
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ if (mutationConditions != null)
+ for (IMutationCondition mutationCondition : mutationConditions) {
+ mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate);
+ if (mutationChance == 0) {
+ return 0;
+ }
+ }
+ return mutationChance;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java
new file mode 100644
index 0000000000..14b5a7e8ea
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_Bees.java
@@ -0,0 +1,74 @@
+package gtPlusPlus.xmod.forestry.bees.registry;
+
+import static gregtech.api.enums.GT_Values.MOD_ID_FR;
+
+import java.util.HashMap;
+
+import cpw.mods.fml.common.Loader;
+import gregtech.GT_Mod;
+import gtPlusPlus.api.objects.Logger;
+import gtPlusPlus.core.lib.CORE;
+import gtPlusPlus.core.material.Material;
+import gtPlusPlus.core.util.reflect.ReflectionUtils;
+import gtPlusPlus.xmod.forestry.bees.handler.*;
+import gtPlusPlus.xmod.forestry.bees.items.output.*;
+
+public class GTPP_Bees {
+
+ public final static byte FORESTRY = 0;
+ public final static byte EXTRABEES = 1;
+ public final static byte GENDUSTRY = 2;
+ public final static byte MAGICBEES = 3;
+ public final static byte GREGTECH = 4;
+
+ public static GTPP_Propolis propolis;
+ public static GTPP_Pollen pollen;
+ public static GTPP_Drop drop;
+ public static GTPP_Comb combs;
+
+
+ public static HashMap<String, Material> sMaterialMappings = new HashMap<String, Material>();
+ public static HashMap<Integer, GTPP_PropolisType> sPropolisMappings = new HashMap<Integer, GTPP_PropolisType>();
+ public static HashMap<Integer, GTPP_PollenType> sPollenMappings = new HashMap<Integer, GTPP_PollenType>();
+ public static HashMap<Integer, GTPP_DropType> sDropMappings = new HashMap<Integer, GTPP_DropType>();
+ public static HashMap<Integer, GTPP_CombType> sCombMappings = new HashMap<Integer, GTPP_CombType>();
+
+ public GTPP_Bees() {
+ if (Loader.isModLoaded(MOD_ID_FR) && GT_Mod.gregtechproxy.mGTBees) {
+
+ if (!ReflectionUtils.doesClassExist("gregtech.loaders.misc.GT_BeeDefinition")) {
+ CORE.crash("Missing gregtech.loaders.misc.GT_BeeDefinition.");
+ }
+ else {
+ Logger.BEES("Loading GT++ Bees!");
+ }
+
+ Logger.BEES("Creating required items.");
+ propolis = new GTPP_Propolis();
+ pollen = new GTPP_Pollen();
+ drop = new GTPP_Drop();
+ combs = new GTPP_Comb();
+
+ Logger.BEES("Loading types.");
+ initTypes();
+
+ Logger.BEES("Adding recipes.");
+ GTPP_Drop.initDropsRecipes();
+ GTPP_Propolis.initPropolisRecipes();
+ GTPP_Comb.initCombsRecipes();
+
+ Logger.BEES("Initialising bees.");
+ GTPP_BeeDefinition.initBees();
+
+ Logger.BEES("Done!");
+ }
+ }
+
+ private static void initTypes() {
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.registry.GTPP_BeeDefinition");
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_CombType");
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_DropType");
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_PollenType");
+ ReflectionUtils.loadClass("gtPlusPlus.xmod.forestry.bees.handler.GTPP_PropolisType");
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java
new file mode 100644
index 0000000000..3c7630a434
--- /dev/null
+++ b/src/main/java/gtPlusPlus/xmod/forestry/bees/registry/GTPP_BranchDefinition.java
@@ -0,0 +1,74 @@
+package gtPlusPlus.xmod.forestry.bees.registry;
+
+import static forestry.api.apiculture.EnumBeeChromosome.*;
+
+import java.util.Arrays;
+import java.util.function.Consumer;
+
+import forestry.api.apiculture.BeeManager;
+import forestry.api.apiculture.EnumBeeChromosome;
+import forestry.api.genetics.IAllele;
+import forestry.api.genetics.IClassification;
+import forestry.apiculture.genetics.alleles.AlleleEffect;
+import forestry.core.genetics.alleles.AlleleHelper;
+import forestry.core.genetics.alleles.EnumAllele.*;
+
+public enum GTPP_BranchDefinition {
+
+ LEGENDARY("gtpp.legendary", "Summa Potestas", alleles -> {
+ AlleleHelper.instance.set(alleles, TEMPERATURE_TOLERANCE, Tolerance.BOTH_2);
+ AlleleHelper.instance.set(alleles, HUMIDITY_TOLERANCE, Tolerance.BOTH_2);
+ AlleleHelper.instance.set(alleles, TOLERANT_FLYER, true);
+ AlleleHelper.instance.set(alleles, NOCTURNAL, true);
+ AlleleHelper.instance.set(alleles, FLOWER_PROVIDER, Flowers.END);
+ AlleleHelper.instance.set(alleles, LIFESPAN, Lifespan.SHORT);
+ AlleleHelper.instance.set(alleles, FLOWERING, Flowering.SLOW);
+ AlleleHelper.instance.set(alleles, SPEED, Speed.FASTEST);
+ AlleleHelper.instance.set(alleles, TERRITORY, Territory.LARGER);
+ }
+ )
+ ;
+
+ private static IAllele[] defaultTemplate;
+ private final IClassification branch;
+ private final Consumer<IAllele[]> mBranchProperties;
+
+ GTPP_BranchDefinition(String internal, String scientific, Consumer<IAllele[]> aBranchProperties) {
+ this.branch = BeeManager.beeFactory.createBranch(internal.toLowerCase(), scientific);
+ this.mBranchProperties = aBranchProperties;
+ }
+
+ private static IAllele[] getDefaultTemplate() {
+ if (defaultTemplate == null) {
+ defaultTemplate = new IAllele[EnumBeeChromosome.values().length];
+
+ AlleleHelper.instance.set(defaultTemplate, SPEED, Speed.SLOWEST);
+ AlleleHelper.instance.set(defaultTemplate, LIFESPAN, Lifespan.SHORTER);
+ AlleleHelper.instance.set(defaultTemplate, FERTILITY, Fertility.NORMAL);
+ AlleleHelper.instance.set(defaultTemplate, TEMPERATURE_TOLERANCE, Tolerance.NONE);
+ AlleleHelper.instance.set(defaultTemplate, NOCTURNAL, false);
+ AlleleHelper.instance.set(defaultTemplate, HUMIDITY_TOLERANCE, Tolerance.NONE);
+ AlleleHelper.instance.set(defaultTemplate, TOLERANT_FLYER, false);
+ AlleleHelper.instance.set(defaultTemplate, CAVE_DWELLING, false);
+ AlleleHelper.instance.set(defaultTemplate, FLOWER_PROVIDER, Flowers.VANILLA);
+ AlleleHelper.instance.set(defaultTemplate, FLOWERING, Flowering.SLOWEST);
+ AlleleHelper.instance.set(defaultTemplate, TERRITORY, Territory.AVERAGE);
+ AlleleHelper.instance.set(defaultTemplate, EFFECT, AlleleEffect.effectNone);
+ }
+ return Arrays.copyOf(defaultTemplate, defaultTemplate.length);
+ }
+
+ protected final void setBranchProperties(IAllele[] template) {
+ this.mBranchProperties.accept(template);
+ }
+
+ public final IAllele[] getTemplate() {
+ IAllele[] template = getDefaultTemplate();
+ setBranchProperties(template);
+ return template;
+ }
+
+ public final IClassification getBranch() {
+ return branch;
+ }
+}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java
index 808eb90728..93591b2aaf 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/CONTAINER_MatterFab.java
@@ -1,11 +1,15 @@
package gtPlusPlus.xmod.gregtech.api.gui;
-import net.minecraft.entity.player.InventoryPlayer;
+import java.util.Iterator;
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
import gregtech.api.gui.GT_ContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gtPlusPlus.core.slots.SlotNoInput;
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.GregtechMetaTileEntity_MassFabricator;
+import net.minecraft.entity.player.InventoryPlayer;
+import net.minecraft.inventory.ICrafting;
/**
* NEVER INCLUDE THIS FILE IN YOUR MOD!!!
@@ -13,9 +17,12 @@ import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.Gr
* The Container I use for all my Basic Machines
*/
public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine {
-
- public int mUUA_USED = ((GregtechMetaTileEntity_MassFabricator)this.mTileEntity.getMetaTileEntity()).getAmplifierUsed();
- public int mUUM_MADE = ((GregtechMetaTileEntity_MassFabricator)this.mTileEntity.getMetaTileEntity()).getMatterProduced();
+
+ public int mMatterProduced = 0;
+ public int mScrapProduced = 0;
+ public int mAmplifierProduced = 0;
+ public int mScrapUsed = 0;
+ public int mAmplifierUsed = 0;
public CONTAINER_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity) {
super(aInventoryPlayer, aTileEntity);
@@ -39,4 +46,58 @@ public class CONTAINER_MatterFab extends GT_ContainerMetaTile_Machine {
public int getShiftClickSlotCount() {
return 0;
}
+
+ @Override
+ public void detectAndSendChanges() {
+ super.detectAndSendChanges();
+ if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) {
+ return;
+ }
+ GregtechMetaTileEntity_MassFabricator aTile = ((GregtechMetaTileEntity_MassFabricator)this.mTileEntity.getMetaTileEntity());
+
+ mAmplifierProduced = aTile.mAmplifierProduced;
+ mAmplifierUsed = aTile.mAmplifierUsed;
+ mMatterProduced = aTile.mMatterProduced;
+ mScrapProduced = aTile.mScrapProduced;
+ mScrapUsed = aTile.mScrapUsed;
+
+ Iterator var2 = this.crafters.iterator();
+ while (var2.hasNext()) {
+ ICrafting var1 = (ICrafting) var2.next();
+ var1.sendProgressBarUpdate(this, 201, mAmplifierProduced);
+ var1.sendProgressBarUpdate(this, 202, mAmplifierUsed);
+ var1.sendProgressBarUpdate(this, 203, mMatterProduced);
+ var1.sendProgressBarUpdate(this, 204, mScrapProduced);
+ var1.sendProgressBarUpdate(this, 205, mScrapUsed);
+ }
+ }
+
+ @Override
+ public void addCraftingToCrafters(ICrafting par1ICrafting) {
+ super.addCraftingToCrafters(par1ICrafting);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void updateProgressBar(int par1, int par2) {
+ super.updateProgressBar(par1, par2);
+ switch (par1) {
+ case 201:
+ mAmplifierProduced = (par2);
+ break;
+ case 202:
+ mAmplifierUsed = (par2);
+ break;
+ case 203:
+ mMatterProduced = (par2);
+ break;
+ case 204:
+ mScrapProduced = (par2);
+ break;
+ case 205:
+ mScrapUsed = (par2);
+ break;
+ }
+ }
+
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java
index 95bde9fd9f..f7869bff60 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/GUI_MatterFab.java
@@ -5,7 +5,7 @@ import net.minecraft.entity.player.InventoryPlayer;
import gregtech.api.gui.GT_GUIContainerMetaTile_Machine;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-
+import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.lib.CORE;
/**
@@ -18,8 +18,11 @@ import gtPlusPlus.core.lib.CORE;
public class GUI_MatterFab extends GT_GUIContainerMetaTile_Machine {
String mName = "";
- int uuaUsed = 0;
- int uumMade = 0;
+ public int mMatterProduced = 0;
+ public int mScrapProduced = 0;
+ public int mAmplifierProduced = 0;
+ public int mScrapUsed = 0;
+ public int mAmplifierUsed = 0;
public GUI_MatterFab(final InventoryPlayer aInventoryPlayer, final IGregTechTileEntity aTileEntity, final String aName, final String aTextureFile) {
super(new CONTAINER_MatterFab(aInventoryPlayer, aTileEntity), CORE.RES_PATH_GUI + (aTextureFile == null ? "MultiblockDisplay" : aTextureFile));
@@ -61,11 +64,21 @@ public class GUI_MatterFab extends GT_GUIContainerMetaTile_Machine {
this.fontRendererObj.drawString("to (re-)start the Machine", 10, 24, 16448255);
this.fontRendererObj.drawString("if it doesn't start.", 10, 32, 16448255);
} else {
- this.uuaUsed = ((CONTAINER_MatterFab) this.mContainer).mUUA_USED;
- this.uumMade = ((CONTAINER_MatterFab) this.mContainer).mUUM_MADE;
+ CONTAINER_MatterFab aContainer = (CONTAINER_MatterFab) this.mContainer;
+
+ this.mMatterProduced = aContainer.mMatterProduced;
+ this.mAmplifierProduced = aContainer.mAmplifierProduced;
+ this.mAmplifierUsed = aContainer.mAmplifierUsed;
+ this.mScrapProduced = aContainer.mScrapProduced;
+ this.mScrapUsed = aContainer.mScrapUsed;
+
this.fontRendererObj.drawString("Running perfectly.", 10, 16, 16448255);
- this.fontRendererObj.drawString("UU-Amplifier Used: "+this.uuaUsed, 10, 24, 16448255);
- this.fontRendererObj.drawString("UU-Matter Fabricated: "+this.uumMade, 10, 32, 16448255);
+
+ this.fontRendererObj.drawString("Scrap Made: "+this.mScrapProduced, 10, 32, 16448255);
+ this.fontRendererObj.drawString("Scrap Used: "+this.mScrapUsed, 10, 40, 16448255);
+ this.fontRendererObj.drawString("UUA Made: "+this.mAmplifierProduced, 10, 48, 16448255);
+ this.fontRendererObj.drawString("UUA Used: "+this.mAmplifierUsed, 10, 56, 16448255);
+ this.fontRendererObj.drawString("UUM Made: "+this.mMatterProduced, 10, 64, 16448255);
}
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java
index 79d1033bd0..e4dc7835cb 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/gui/basic/CONTAINER_PollutionCleaner.java
@@ -58,6 +58,7 @@ public class CONTAINER_PollutionCleaner extends GT_Container_BasicTank {
super.detectAndSendChanges();
if (mTileEntity.isClientSide() || mTileEntity.getMetaTileEntity() == null) return;
+ Logger.INFO("TEST");
mReduction = ((GregtechMetaAtmosphericReconditioner) mTileEntity.getMetaTileEntity()).mPollutionReduction;
Iterator var2 = this.crafters.iterator();
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
index 0ed4a690bb..a72c6e98f3 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/interfaces/internal/IGregtech_RecipeAdder.java
@@ -313,7 +313,9 @@ public interface IGregtech_RecipeAdder {
public boolean addPyrolyseRecipe(ItemStack aInput, FluidStack aFluidInput, int intCircuit, ItemStack aOutput, FluidStack aFluidOutput, int aDuration, int aEUt);
- public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt);
+ public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt);
+
+ public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aChance, int aDuration, int aEUt);
public boolean addDistilleryRecipe(ItemStack aCircuit, FluidStack aInput, FluidStack aOutput, ItemStack aSolidOutput, int aDuration, int aEUt, boolean aHidden);
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
index b27cb95ca4..d0682b85e8 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java
@@ -6,16 +6,13 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GT_Utility;
import gregtech.api.util.extensions.ArrayExt;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.ItemUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
-import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_InputBus {
public GT_MetaTileEntity_SuperBus_Input(int aID, String aName, String aNameRegional, int aTier) {
@@ -72,54 +69,10 @@ public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_In
return null;
}
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTimer) {
- if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.hasInventoryBeenModified()) {
- this.fillStacksIntoFirstSlots();
- }
-
- }
-
- public void updateSlots() {
- for (int i = 0; i < this.mInventory.length; ++i) {
- if (this.mInventory[i] != null && this.mInventory[i].stackSize <= 0) {
- this.mInventory[i] = null;
- }
- }
-
- this.fillStacksIntoFirstSlots();
- }
-
- protected void fillStacksIntoFirstSlots() {
- for (int i = 0; i < this.mInventory.length; ++i) {
- for (int j = i + 1; j < this.mInventory.length; ++j) {
- if (this.mInventory[j] != null && (this.mInventory[i] == null
- || GT_Utility.areStacksEqual(this.mInventory[i], this.mInventory[j]))) {
- GT_Utility.moveStackFromSlotAToSlotB((IInventory) this.getBaseMetaTileEntity(), (IInventory) this.getBaseMetaTileEntity(), j, i, (byte) 64, (byte) 1, (byte) 64, (byte) 1);
- }
- }
- }
-
- }
-
public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
return aSide == this.getBaseMetaTileEntity().getFrontFacing();
}
- public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) {
- return aSide == this.getBaseMetaTileEntity().getFrontFacing()
- && (this.mRecipeMap == null || this.mRecipeMap.containsInput(aStack));
- }
-
- @Override
- public void saveNBTData(NBTTagCompound aNBT) {
- super.saveNBTData(aNBT);
- }
-
- @Override
- public void loadNBTData(NBTTagCompound aNBT) {
- super.loadNBTData(aNBT);
- }
-
@Override
public String[] getDescription() {
String[] aDesc = new String[] {
@@ -192,39 +145,4 @@ public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_In
}
- @Override
- public int getMaxItemCount() {
- // TODO Auto-generated method stub
- return super.getMaxItemCount();
- }
-
- @Override
- public int getSizeInventory() {
- // TODO Auto-generated method stub
- return super.getSizeInventory();
- }
-
- @Override
- public ItemStack getStackInSlot(int aIndex) {
- // TODO Auto-generated method stub
- return super.getStackInSlot(aIndex);
- }
-
- @Override
- public boolean canInsertItem(int aIndex, ItemStack aStack, int aSide) {
- // TODO Auto-generated method stub
- return super.canInsertItem(aIndex, aStack, aSide);
- }
-
- @Override
- public boolean canExtractItem(int aIndex, ItemStack aStack, int aSide) {
- // TODO Auto-generated method stub
- return super.canExtractItem(aIndex, aStack, aSide);
- }
-
- @Override
- public ItemStack[] getRealInventory() {
- // TODO Auto-generated method stub
- return super.getRealInventory();
- }
} \ No newline at end of file
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
index b50031ac00..6f0176da25 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaWirelessCharger.java
@@ -1,23 +1,15 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.EntityPlayer;
-import net.minecraft.entity.player.EntityPlayerMP;
-import net.minecraft.item.ItemStack;
-import net.minecraft.nbt.NBTTagCompound;
+import java.util.*;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Textures;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.BaseMetaTileEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
-import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.lib.CORE;
import gtPlusPlus.core.util.minecraft.EntityUtils;
@@ -25,12 +17,18 @@ import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTileEntity;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper;
+import net.minecraft.entity.Entity;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.entity.player.EntityPlayerMP;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
private boolean mHasBeenMapped = false;
private int mCurrentDimension = 0;
public int mMode = 0;
+ public boolean mLocked = true;
public GregtechMetaWirelessCharger(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) {
super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription);
@@ -43,6 +41,9 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
@Override
public String[] getDescription() {
return new String[] {this.mDescription,
+ "Can be locked to the owner by sneaking with a screwdriver",
+ "Can also be locked with a lock upgrade",
+ "",
"3 Modes, Long-Range, Local and Mixed.",
"Long-Range: Can supply 2A of power to a single player up to "+(GT_Values.V[this.mTier]*4)+"m away.",
"Local: Can supply several Amps to each player within "+this.mTier*20+"m.",
@@ -151,6 +152,11 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
mWirelessChargingMap.clear();
mLocalChargingMap.clear();
+ if (aPlayer.isSneaking()) {
+ mLocked = !mLocked;
+ PlayerUtils.messagePlayer(aPlayer, mLocked ? "Locked to owner." : "Unlocked.");
+ }
+
if (!this.getBaseMetaTileEntity().getWorld().playerEntities.isEmpty()){
for (Object mTempPlayer : this.getBaseMetaTileEntity().getWorld().playerEntities){
if (mTempPlayer instanceof EntityPlayer || mTempPlayer instanceof EntityPlayerMP){
@@ -349,12 +355,14 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
@Override
public void saveNBTData(final NBTTagCompound aNBT) {
+ aNBT.setBoolean("mLocked", this.mLocked);
aNBT.setInteger("mMode", this.mMode);
aNBT.setInteger("mCurrentDimension", this.mCurrentDimension);
}
@Override
public void loadNBTData(final NBTTagCompound aNBT) {
+ this.mLocked = aNBT.getBoolean("mLocked");
this.mMode = aNBT.getInteger("mMode");
this.mCurrentDimension = aNBT.getInteger("mCurrentDimension");
}
@@ -364,9 +372,21 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
super.onFirstTick(aBaseMetaTileEntity);
}
-
private Map<String, UUID> mWirelessChargingMap = new HashMap<String, UUID>();
private Map<String, UUID> mLocalChargingMap = new HashMap<String, UUID>();
+
+ private boolean isValidPlayer(EntityPlayer aPlayer) {
+ BaseMetaTileEntity aTile = (BaseMetaTileEntity) this.getBaseMetaTileEntity();
+ if (mLocked || ( aTile != null && aTile.privateAccess())) {
+ if (aPlayer.getUniqueID().equals(getBaseMetaTileEntity().getOwnerUuid())){
+ return true;
+ }
+ else {
+ return false;
+ }
+ }
+ return true;
+ }
@Override
public void onPostTick(final IGregTechTileEntity aBaseMetaTileEntity, final long aTick) {
@@ -380,7 +400,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
if (!mHasBeenMapped && ChargingHelper.addEntry(getTileEntityPosition(), this)){
mHasBeenMapped = true;
}
-
+
if (aTick % 20 == 0 && mHasBeenMapped){
if (!aBaseMetaTileEntity.getWorld().playerEntities.isEmpty()){
for (Object mTempPlayer : aBaseMetaTileEntity.getWorld().playerEntities){
@@ -390,7 +410,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
if (this.mMode == 1 || this.mMode == 2){
int tempRange = (this.mMode == 1 ? this.mTier*20 : this.mTier*10);
if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) < tempRange){
- if (!mLocalChargingMap.containsKey(mTemp.getDisplayName())){
+ if (isValidPlayer(mTemp) && !mLocalChargingMap.containsKey(mTemp.getDisplayName())){
mLocalChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID());
ChargingHelper.addValidPlayer(mTemp, this);
//PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Local].");
@@ -409,7 +429,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
int tempRange = (int) (this.mMode == 0 ? 4*GT_Values.V[this.mTier] : 2*GT_Values.V[this.mTier]);
if (getDistanceBetweenTwoPositions(getTileEntityPosition(), getPositionOfEntity(mTemp)) <= tempRange){
if (!mWirelessChargingMap.containsKey(mTemp.getDisplayName())){
- if (mTemp.getDisplayName().equalsIgnoreCase(this.getBaseMetaTileEntity().getOwnerName())) {
+ if (isValidPlayer(mTemp)) {
mWirelessChargingMap.put(mTemp.getDisplayName(), mTemp.getPersistentID());
ChargingHelper.addValidPlayer(mTemp, this);
PlayerUtils.messagePlayer(mTemp, "You have entered charging range. ["+tempRange+"m - Long-Range].");
@@ -424,7 +444,7 @@ public class GregtechMetaWirelessCharger extends GregtechMetaTileEntity {
}
}
}
- if (mWirelessChargingMap.containsKey(mTemp.getDisplayName()) && !mTemp.getDisplayName().equalsIgnoreCase(this.getBaseMetaTileEntity().getOwnerName())){
+ if (mWirelessChargingMap.containsKey(mTemp.getDisplayName())){
if (mWirelessChargingMap.remove(mTemp.getDisplayName()) != null){
ChargingHelper.removeValidPlayer(mTemp, this);
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
index 09bee76272..1b24b8f264 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_Cyclotron.java
@@ -364,6 +364,7 @@ public class GregtechMetaTileEntity_Cyclotron extends GregtechMeta_MultiBlockBas
this.mOutputItems = outputs;
this.mOutputFluids = new FluidStack[] {tRecipe.getFluidOutput(0)};
+ this.updateSlots();
return true;
}
}
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
index 7a703e5bc5..253d70d275 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/production/GregtechMetaTileEntity_MassFabricator.java
@@ -1,45 +1,29 @@
package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
+import static gtPlusPlus.core.util.data.ArrayUtils.removeNulls;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.*;
+
+import org.apache.commons.lang3.ArrayUtils;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
-import gregtech.api.enums.ConfigCategories;
-import gregtech.api.enums.ItemList;
-import gregtech.api.enums.Materials;
-import gregtech.api.enums.TAE;
-import gregtech.api.enums.Textures;
+import gregtech.api.enums.*;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Energy;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Input;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_InputBus;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffler;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Output;
-import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_OutputBus;
+import gregtech.api.metatileentity.implementations.*;
import gregtech.api.objects.GT_RenderedTexture;
-import gregtech.api.util.GTPP_Recipe;
-import gregtech.api.util.GT_Config;
-import gregtech.api.util.GT_ModHandler;
-import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
-import gregtech.api.util.GT_Recipe;
+import gregtech.api.util.*;
import gregtech.api.util.GT_Recipe.GT_Recipe_Map;
-import gregtech.api.util.GT_Utility;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.core.block.ModBlocks;
import gtPlusPlus.core.lib.CORE;
-import gtPlusPlus.core.util.minecraft.ItemUtils;
-import gtPlusPlus.core.util.minecraft.PlayerUtils;
+import gtPlusPlus.core.util.minecraft.*;
+import gtPlusPlus.xmod.gregtech.api.gui.CONTAINER_MatterFab;
import gtPlusPlus.xmod.gregtech.api.gui.GUI_MatterFab;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMeta_MultiBlockBase;
import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock;
@@ -55,11 +39,11 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
public static int sUUASpeedBonus = 4;
public static int sDurationMultiplier = 3200;
- private int mMatterProduced = 0;
- private int mScrapProduced = 0;
- private int mAmplifierProduced = 0;
- private int mScrapUsed = 0;
- private int mAmplifierUsed = 0;
+ public int mMatterProduced = 0;
+ public int mScrapProduced = 0;
+ public int mAmplifierProduced = 0;
+ public int mScrapUsed = 0;
+ public int mAmplifierUsed = 0;
public static String mCasingName1 = "Matter Fabricator Casing";
public static String mCasingName2 = "Containment Casing";
@@ -85,6 +69,10 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
return this.mMatterProduced;
}
+ public int getScrapProduced(){
+ return this.mScrapProduced;
+ }
+
public GregtechMetaTileEntity_MassFabricator(final int aID, final String aName, final String aNameRegional) {
super(aID, aName, aNameRegional);
}
@@ -144,25 +132,17 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
return "MatterFabricator";
}
- public static ItemStack getScrapPile() {
- if (mScrap[0] == null) {
- mScrap[0] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrap"));
- }
- return mScrap[0];
- }
- public static ItemStack getScrapBox() {
- if (mScrap[1] == null) {
- mScrap[1] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrapbox"));
- }
- return mScrap[1];
- }
-
@Override
public Object getClientGUI(final int aID, final InventoryPlayer aPlayerInventory, final IGregTechTileEntity aBaseMetaTileEntity) {
return new GUI_MatterFab(aPlayerInventory, aBaseMetaTileEntity, this.getLocalName(), "MatterFabricator.png");
}
@Override
+ public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) {
+ return new CONTAINER_MatterFab(aPlayerInventory, aBaseMetaTileEntity);
+ }
+
+ @Override
public void onConfigLoad(final GT_Config aConfig) {
super.onConfigLoad(aConfig);
sDurationMultiplier = aConfig.get(ConfigCategories.machineconfig, "Massfabricator.UUM_Duration_Multiplier", sDurationMultiplier);
@@ -178,9 +158,30 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
ArrayList<FluidStack> tFluids = getStoredFluids();
ItemStack[] tItemInputs = tItems.toArray(new ItemStack[tItems.size()]);
FluidStack[] tFluidInputs = tFluids.toArray(new FluidStack[tFluids.size()]);
- return checkRecipeGeneric(tItemInputs, tFluidInputs, getMaxParallelRecipes(), 80, 100, 100);
+ init();
+ return checkRecipeGeneric(tItemInputs, tFluidInputs, 4, 80, 00, 100);
}
+ public static boolean sInit = false;
+
+ public static void init() {
+ if (!sInit) {
+ if (mScrap[0] == null) {
+ mScrap[0] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrap"));
+ }
+ if (mScrap[1] == null) {
+ mScrap[1] = ItemUtils.getSimpleStack(ItemUtils.getItemFromFQRN("IC2:itemScrapbox"));
+ }
+ if (mUU[0] == null) {
+ mUU[0] = Materials.UUAmplifier.getFluid(100);
+ }
+ if (mUU[1] == null) {
+ mUU[1] = Materials.UUMatter.getFluid(100);
+ }
+ sInit = true;
+ }
+ }
+
@Override
public IStructureDefinition<GregtechMetaTileEntity_MassFabricator> getStructureDefinition() {
if (STRUCTURE_DEFINITION == null) {
@@ -282,28 +283,6 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
return new GregtechMetaTileEntity_MassFabricator(this.mName);
}
- public boolean doesHatchContainUUA() {
- if (mUU[0] == null) {
- mUU[0] = Materials.UUAmplifier.getFluid(100);
- }
- if (mUU[1] == null) {
- mUU[1] = Materials.UUMatter.getFluid(100);
- }
-
- if (mUU[0] != null && mUU[1] != null) {
- for (GT_MetaTileEntity_Hatch_Input g : this.mInputHatches) {
- if (g.getFluid() != null) {
- if (g.mFluid.isFluidEqual(mUU[0])) {
- return true;
- }
- }
- }
- }
-
- return false;
- }
-
-
/**
* Special Recipe Handling
*/
@@ -316,55 +295,332 @@ public class GregtechMetaTileEntity_MassFabricator extends GregtechMeta_MultiBlo
}
@Override
- public boolean checkRecipeGeneric(
+ public boolean checkRecipeGeneric(ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll) {
+ if (this.mMode == MODE_SCRAP) {
+ return checkRecipeScrap(aItemInputs, aFluidInputs, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll);
+ }
+ else {
+ return checkRecipeUU(aItemInputs, aFluidInputs, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll);
+ }
+ }
+
+ public boolean checkRecipeScrap(
+ ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
+ int aMaxParallelRecipes, int aEUPercent,
+ int aSpeedBonusPercent, int aOutputChanceRoll) {
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ ItemStack aPotentialOutput = GT_ModHandler.getRecyclerOutput(GT_Utility.copyAmount(1, aItemInputs[0]), 0);
+ GT_Recipe tRecipe = new GTPP_Recipe(false, new ItemStack[]{GT_Utility.copyAmount(1, aItemInputs[0])}, aPotentialOutput == null ? null : new ItemStack[]{aPotentialOutput}, null, new int[]{2000}, null, null, 40, MaterialUtils.getVoltageForTier(1), 0);
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ int parallelRecipes = 0;
+ // Count recipes to do in parallel, consuming input items and fluids and
+ // considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
+ break;
+ }
+ log("Bumped EU from " + tTotalEUt + " to " + (tTotalEUt + tRecipeEUt) + ". ");
+ tTotalEUt += tRecipeEUt;
+ }
+ log("Broke at " + parallelRecipes + ".");
+ if (parallelRecipes > 0) {
+ // -- Try not to fail after this point - inputs have already been
+ // consumed! --
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe
+ // duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int) (tRecipe.mDuration * tTimeFactor);
+ this.mEUt = (int) Math.ceil(tTotalEUt);
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ }
+ else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 4;
+ }
+ }
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
+ }
+ }
+ }
+ tOutputItems = removeNulls(tOutputItems);
+ for (ItemStack aOutputStack : tOutputItems) {
+ if (aOutputStack != null) {
+ mScrapProduced += aOutputStack.stackSize;
+ }
+ }
+ // Sanitize item stack size, splitting any stacks greater than max
+ // stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0)
+ tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ updateSlots();
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+ return true;
+ }
+ return false;
+ }
+
+ public boolean checkRecipeUU(
ItemStack[] aItemInputs, FluidStack[] aFluidInputs,
int aMaxParallelRecipes, int aEUPercent,
int aSpeedBonusPercent, int aOutputChanceRoll) {
- if (this.mMode == MODE_SCRAP) {
- long tVoltage = getMaxInputVoltage();
- byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
- long tEnergy = getMaxInputEnergy();
- GT_Recipe c = new GTPP_Recipe(false, new ItemStack[] { GT_Utility.copyAmount(1, aItemInputs[0]) },
- GT_ModHandler.getRecyclerOutput(GT_Utility.copyAmount(64, aItemInputs[0]), 0) == null ? null
- : new ItemStack[] { ItemList.IC2_Scrap.get(1) },
- null, new int[] { 2000 }, null, null, 100,
- (int) gregtech.api.enums.GT_Values.V[2], 0);
-
- // EU discount
- float tRecipeEUt = (c.mEUt * aEUPercent) / 100.0f;
- float tTotalEUt = 0.0f;
-
- int parallelRecipes = 0;
- // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
- for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
- if (!c.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) {
- log("Broke at "+parallelRecipes+".");
- break;
+ // Based on the Processing Array. A bit overkill, but very flexible.
+
+ // Reset outputs and progress stats
+ this.mEUt = 0;
+ this.mMaxProgresstime = 0;
+ this.mOutputItems = new ItemStack[]{};
+ this.mOutputFluids = new FluidStack[]{};
+
+ long tVoltage = getMaxInputVoltage();
+ byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage));
+ long tEnergy = getMaxInputEnergy();
+ log("Running checkRecipeGeneric(0)");
+
+ GT_Recipe tRecipe = findRecipe(
+ getBaseMetaTileEntity(), mLastRecipe, false,
+ gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs);
+
+ log("Running checkRecipeGeneric(1)");
+ // Remember last recipe - an optimization for findRecipe()
+ this.mLastRecipe = tRecipe;
+
+ if (tRecipe == null) {
+ log("BAD RETURN - 1");
+ return false;
+ }
+
+ aMaxParallelRecipes = this.canBufferOutputs(tRecipe, aMaxParallelRecipes);
+ if (aMaxParallelRecipes == 0) {
+ log("BAD RETURN - 2");
+ return false;
+ }
+
+ // EU discount
+ float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f;
+ float tTotalEUt = 0.0f;
+
+ int parallelRecipes = 0;
+
+ log("parallelRecipes: "+parallelRecipes);
+ log("aMaxParallelRecipes: "+aMaxParallelRecipes);
+ log("tTotalEUt: "+tTotalEUt);
+ log("tVoltage: "+tVoltage);
+ log("tRecipeEUt: "+tRecipeEUt);
+ // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits
+ for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tEnergy - tRecipeEUt); parallelRecipes++) {
+ if (!tRecipe.isRecipeInputEqual(true, true, aFluidInputs, aItemInputs)) {
+ break;
+ }
+ log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
+ tTotalEUt += tRecipeEUt;
+ }
+
+ log("Broke at "+parallelRecipes+".");
+ if (parallelRecipes == 0) {
+ log("BAD RETURN - 3");
+ return false;
+ }
+
+ // -- Try not to fail after this point - inputs have already been consumed! --
+
+
+
+ // Convert speed bonus to duration multiplier
+ // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration.
+ aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent);
+ float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent);
+ this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor);
+
+ this.mEUt = (int)Math.ceil(tTotalEUt);
+
+ this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000);
+ this.mEfficiencyIncrease = 10000;
+
+ // Overclock
+ if (this.mEUt <= 16) {
+ this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1));
+ this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1));
+ } else {
+ while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) {
+ this.mEUt *= 4;
+ this.mMaxProgresstime /= 4;
+ }
+ }
+
+ if (this.mEUt > 0) {
+ this.mEUt = (-this.mEUt);
+ }
+
+ this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime);
+
+ // Collect fluid outputs
+ FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length];
+ for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) {
+ if (tRecipe.getFluidOutput(h) != null) {
+ tOutputFluids[h] = tRecipe.getFluidOutput(h).copy();
+ tOutputFluids[h].amount *= parallelRecipes;
+ }
+ }
+
+ // Collect output item types
+ ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length];
+ for (int h = 0; h < tRecipe.mOutputs.length; h++) {
+ if (tRecipe.getOutput(h) != null) {
+ tOutputItems[h] = tRecipe.getOutput(h).copy();
+ tOutputItems[h].stackSize = 0;
+ }
+ }
+
+ // Set output item stack sizes (taking output chance into account)
+ for (int f = 0; f < tOutputItems.length; f++) {
+ if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) {
+ for (int g = 0; g < parallelRecipes; g++) {
+ if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f))
+ tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize;
}
- log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+".");
- tTotalEUt += tRecipeEUt;
}
+ }
- if (parallelRecipes == 0) {
- this.mEUt = (int) gregtech.api.enums.GT_Values.V[tTier];
- this.mMaxProgresstime = 10;
- return true;
+ tOutputItems = removeNulls(tOutputItems);
+
+
+ int aMatterProduced = 0;
+ int aAmplifierProduced = 0;
+ int aScrapUsed = 0;
+ int aAmplifierUsed = 0;
+
+ for (int i=0; i<parallelRecipes; i++) {
+ //Logger.INFO("Trying to bump stats "+i);
+ for (ItemStack aInput : tRecipe.mInputs) {
+ if (aInput != null && GT_Utility.areStacksEqual(aInput, mScrap[0], true)) {
+ aScrapUsed += aInput.stackSize;
+ //Logger.INFO("Found Scrap to use.");
+ }
+ }
+ for (FluidStack aInput : tRecipe.mFluidInputs) {
+ if (aInput != null && GT_Utility.areFluidsEqual(aInput, mUU[0], true)) {
+ aAmplifierUsed += aInput.amount;
+ //Logger.INFO("Found UU-A to use.");
+ }
+ }
+ for (FluidStack aOutput : tRecipe.mFluidOutputs) {
+ if (aOutput != null && GT_Utility.areFluidsEqual(aOutput, mUU[0], true)) {
+ aAmplifierProduced += aOutput.amount;
+ //Logger.INFO("Found UU-A as Output.");
+ }
+ if (aOutput != null && GT_Utility.areFluidsEqual(aOutput, mUU[1], true)) {
+ aMatterProduced += aOutput.amount;
+ //Logger.INFO("Found UU-M as Output.");
+ }
}
-
- return super.checkRecipeGeneric(c, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll);
}
+
+ this.mMatterProduced += aMatterProduced;
+ this.mAmplifierProduced += aAmplifierProduced;
+ this.mScrapUsed += aScrapUsed;
+ this.mAmplifierUsed += aAmplifierUsed;
+
+ // Sanitize item stack size, splitting any stacks greater than max stack size
+ List<ItemStack> splitStacks = new ArrayList<ItemStack>();
+ for (ItemStack tItem : tOutputItems) {
+ while (tItem.getMaxStackSize() < tItem.stackSize) {
+ ItemStack tmp = tItem.copy();
+ tmp.stackSize = tmp.getMaxStackSize();
+ tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize();
+ splitStacks.add(tmp);
+ }
+ }
+
+ if (splitStacks.size() > 0) {
+ ItemStack[] tmp = new ItemStack[splitStacks.size()];
+ tmp = splitStacks.toArray(tmp);
+ tOutputItems = ArrayUtils.addAll(tOutputItems, tmp);
+ }
+
+ // Strip empty stacks
+ List<ItemStack> tSList = new ArrayList<ItemStack>();
+ for (ItemStack tS : tOutputItems) {
+ if (tS.stackSize > 0) tSList.add(tS);
+ }
+ tOutputItems = tSList.toArray(new ItemStack[tSList.size()]);
+
+ // Commit outputs
+ this.mOutputItems = tOutputItems;
+ this.mOutputFluids = tOutputFluids;
- //Return normal Recipe handling
- return super.checkRecipeGeneric(aItemInputs, aFluidInputs, getMaxParallelRecipes(), getEuDiscountForParallelism(), aSpeedBonusPercent, aOutputChanceRoll);
- }
-
- @Override
- public boolean hasPerfectOverclock() {
+ updateSlots();
+
+ // Play sounds (GT++ addition - GT multiblocks play no sounds)
+ startProcess();
+
+ log("GOOD RETURN - 1");
return true;
+
}
-
+
@Override
public int getMaxParallelRecipes() {
return this.mMode == MODE_SCRAP ? 64 : 8 * (Math.max(1, GT_Utility.getTier(getMaxInputVoltage())));
diff --git a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
index 2b8a110b09..79a9f788df 100644
--- a/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
+++ b/src/main/java/gtPlusPlus/xmod/gregtech/recipes/GregtechRecipeAdder.java
@@ -1578,15 +1578,32 @@ public class GregtechRecipeAdder implements IGregtech_RecipeAdder {
@Override
public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aDuration, int aEUt) {
+ return addExtractorRecipe(aInput, aOutput, 10000, aDuration, aEUt);
+ }
+
+ @Override
+ public boolean addExtractorRecipe(ItemStack aInput, ItemStack aOutput, int aChance, int aDuration, int aEUt) {
if (aInput != null && aOutput != null) {
- if ((aDuration = GregTech_API.sRecipeFile.get("extractor", aInput, aDuration)) <= 0) {
- return false;
- } else {
- GT_Recipe_Map.sExtractorRecipes.addRecipe(true, new ItemStack[]{aInput}, new ItemStack[]{aOutput},
- (Object) null, (FluidStack[]) null, (FluidStack[]) null, aDuration, aEUt, 0);
- return true;
- }
- } else {
+ GT_Recipe aRecipe = new GTPP_Recipe(
+ false,
+ new ItemStack[] {
+ aInput.copy()
+ },
+ new ItemStack[] {
+ aOutput.copy()
+ },
+ null,
+ new int[] {aChance},
+ null,
+ null,
+ aDuration,
+ aEUt,
+ 0);
+ int aSize = GT_Recipe_Map.sExtractorRecipes.mRecipeList.size();
+ GT_Recipe_Map.sExtractorRecipes.add(aRecipe);
+ return GT_Recipe_Map.sExtractorRecipes.mRecipeList.size() > aSize;
+ }
+ else {
return false;
}
}