diff options
Diffstat (limited to 'src/main/java/gregtech/common/GT_Proxy.java')
-rw-r--r-- | src/main/java/gregtech/common/GT_Proxy.java | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 5b3c4e8b79..bf79b49133 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -8,6 +8,9 @@ import cpw.mods.fml.common.network.FMLNetworkEvent; import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
+import forestry.api.genetics.AlleleManager;
+import forestry.apiculture.genetics.Bee;
+import forestry.core.genetics.alleles.AlleleHelper;
import gregtech.api.GregTech_API;
import gregtech.api.enums.*;
import gregtech.api.enums.TC_Aspects.TC_AspectStack;
@@ -44,6 +47,7 @@ import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.nbt.NBTTagList;
import net.minecraft.potion.Potion;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
@@ -72,6 +76,7 @@ import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
+import org.apache.commons.lang3.text.WordUtils;
import static gregtech.GT_Mod.GT_FML_LOGGER;
@@ -136,6 +141,7 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { public boolean mHardcoreCables = false;
public boolean mDisableVanillaOres = true;
public boolean mHardMachineCasings = true;
+ public boolean mAllowSmallBoilerAutomation = false;
public boolean mNerfDustCrafting = true;
public boolean mSortToTheEnd = true;
public boolean mCraftingUnification = true;
@@ -1312,6 +1318,104 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { tCount += tStack.stackSize * 64 / Math.max(1, tStack.getMaxStackSize());
}
if (this.mInventoryUnification) {
+
+ if (tStack.getTagCompound()!= null && (tStack.getTagCompound().getTag("Mate")!= null || tStack.getTagCompound().getTag("Genome")!= null )) {
+
+ String orgMate = "";
+ if(tStack.getTagCompound().getTag("Mate")!= null)
+ orgMate = (tStack.getTagCompound().getCompoundTag("Mate")).getTagList("Chromosomes",10).getCompoundTagAt(0).getString("UID1");
+
+ String orgGen = orgMate;
+
+ if(tStack.getTagCompound().getTag("Genome")!= null)
+ orgGen = (tStack.getTagCompound().getCompoundTag("Genome")).getTagList("Chromosomes",10).getCompoundTagAt(0).getString("UID1");
+
+ final boolean[] yn = {orgMate.contains("gendustry"),orgGen.contains("gendustry")};
+
+ if (yn[0] || yn[1]) {
+
+ final NBTTagCompound NBTTAGCOMPOUND = (NBTTagCompound) tStack.getTagCompound().copy();
+
+ //MATE
+ if (yn[0]) {
+ final NBTTagCompound MATE = NBTTAGCOMPOUND.getCompoundTag("Mate");
+ final NBTTagList chromosomesMate = MATE.getTagList("Chromosomes", 10);
+ final NBTTagCompound species = chromosomesMate.getCompoundTagAt(0);
+
+ String ident1 = species.getString("UID1");
+ final String[] split = ident1.split("[.]");
+ ident1 = "gregtech.bee.species" + WordUtils.capitalize(split[2].toLowerCase(Locale.ENGLISH));
+
+ if (AlleleManager.alleleRegistry.getAllele(ident1) == null)
+ return;
+
+ String ident2 = species.getString("UID0");
+ final String[] split2 = ident2.split("[.]");
+ ident2 = "gregtech.bee.species"+WordUtils.capitalize(split2[2].toLowerCase(Locale.ENGLISH));
+
+ if (AlleleManager.alleleRegistry.getAllele(ident2) == null)
+ return;
+
+ final NBTTagCompound nuspeciesmate = new NBTTagCompound();
+ nuspeciesmate.setString("UID1", ident1);
+ nuspeciesmate.setString("UID0", ident2);
+ nuspeciesmate.setByte("Slot", (byte) 0);
+
+ final NBTTagCompound nuMate2 = new NBTTagCompound();
+ final NBTTagList nuMate = new NBTTagList();
+ nuMate.appendTag(nuspeciesmate);
+
+ for (int j = 1; j < chromosomesMate.tagCount(); j++) {
+ nuMate.appendTag(chromosomesMate.getCompoundTagAt(j));
+ }
+
+ nuMate2.setTag("Chromosomes", nuMate);
+ NBTTAGCOMPOUND.removeTag("Mate");
+ NBTTAGCOMPOUND.setTag("Mate", nuMate2);
+ }
+ if (yn[1]) {
+ //Genome
+ final NBTTagCompound genome = NBTTAGCOMPOUND.getCompoundTag("Genome");
+ final NBTTagList chromosomesGenome = genome.getTagList("Chromosomes", 10);
+ final NBTTagCompound speciesGenome = chromosomesGenome.getCompoundTagAt(0);
+
+ String ident1Genome = speciesGenome.getString("UID1");
+ final String[] splitGenome = ident1Genome.split("[.]");
+ ident1Genome = "gregtech.bee.species" + WordUtils.capitalize(splitGenome[2].toLowerCase(Locale.ENGLISH));
+
+ if (AlleleManager.alleleRegistry.getAllele(ident1Genome) == null)
+ return;
+
+ String ident2Genome = speciesGenome.getString("UID0");
+ final String[] splitGenome2 = ident2Genome.split("[.]");
+ ident2Genome = "gregtech.bee.species" + WordUtils.capitalize(splitGenome2[2].toLowerCase(Locale.ENGLISH));
+
+ if (AlleleManager.alleleRegistry.getAllele(ident2Genome) == null)
+ return;
+
+ final NBTTagCompound nuspeciesgenome = new NBTTagCompound();
+ nuspeciesgenome.setString("UID1", ident1Genome);
+ nuspeciesgenome.setString("UID0", ident2Genome);
+ nuspeciesgenome.setByte("Slot", (byte) 0);
+
+ final NBTTagCompound nugenome2 = new NBTTagCompound();
+ final NBTTagList nuGenome = new NBTTagList();
+ nuGenome.appendTag(nuspeciesgenome);
+
+ for (int j = 1; j < chromosomesGenome.tagCount(); j++) {
+ nuGenome.appendTag(chromosomesGenome.getCompoundTagAt(j));
+ }
+
+ nugenome2.setTag("Chromosomes", nuGenome);
+ NBTTAGCOMPOUND.removeTag("Genome");
+ NBTTAGCOMPOUND.setTag("Genome", nugenome2);
+ }
+ tStack.setTagCompound(new NBTTagCompound());
+ tStack.setTagCompound(NBTTAGCOMPOUND);
+ }
+ else return;
+ }
+
GT_OreDictUnificator.setStack(true, tStack);
}
}
|