diff options
author | bartimaeusnek <33183715+bartimaeusnek@users.noreply.github.com> | 2018-10-03 14:27:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-03 14:27:30 +0200 |
commit | 9818187298627ab73dd9afd17f4356067c3bd296 (patch) | |
tree | 634a8883437022e4dfb97df40de01c1e80203b0d /src/main/java/gregtech/common | |
parent | 9b8b93fad5b4d1d7984fb11d2202a4057bc14fe4 (diff) | |
parent | 18f8b557e6614ee3f76a28d90f8d22185256331c (diff) | |
download | GT5-Unofficial-9818187298627ab73dd9afd17f4356067c3bd296.tar.gz GT5-Unofficial-9818187298627ab73dd9afd17f4356067c3bd296.tar.bz2 GT5-Unofficial-9818187298627ab73dd9afd17f4356067c3bd296.zip |
Merge pull request #153 from GTNewHorizons/GT_Bees_Dev
refined automatic bee exchange
Diffstat (limited to 'src/main/java/gregtech/common')
-rw-r--r-- | src/main/java/gregtech/common/GT_Proxy.java | 134 |
1 files changed, 76 insertions, 58 deletions
diff --git a/src/main/java/gregtech/common/GT_Proxy.java b/src/main/java/gregtech/common/GT_Proxy.java index 1e9db7931e..100b5016ab 100644 --- a/src/main/java/gregtech/common/GT_Proxy.java +++ b/src/main/java/gregtech/common/GT_Proxy.java @@ -1320,81 +1320,99 @@ public abstract class GT_Proxy implements IGT_Mod, IGuiHandler, IFuelHandler { if (tStack.getTagCompound()!= null && (tStack.getTagCompound().getTag("Mate")!= null || tStack.getTagCompound().getTag("Genome")!= null )) {
- String identifier = "";
+ String orgMate = "";
if(tStack.getTagCompound().getTag("Mate")!= null)
- identifier = (tStack.getTagCompound().getCompoundTag("Mate")).getTagList("Chromosomes",10).getCompoundTagAt(0).getString("UID1");
+ orgMate = (tStack.getTagCompound().getCompoundTag("Mate")).getTagList("Chromosomes",10).getCompoundTagAt(0).getString("UID1");
- String identifier2 = identifier;
+ String orgGen = orgMate;
if(tStack.getTagCompound().getTag("Genome")!= null)
- identifier2 = (tStack.getTagCompound().getCompoundTag("Genome")).getTagList("Chromosomes",10).getCompoundTagAt(0).getString("UID1");
+ orgGen = (tStack.getTagCompound().getCompoundTag("Genome")).getTagList("Chromosomes",10).getCompoundTagAt(0).getString("UID1");
- if (identifier.contains("gendustry") || identifier2.contains("gendustry")) {
+ final boolean[] yn = {orgMate.contains("gendustry"),orgGen.contains("gendustry")};
+
+ if (yn[0] || yn[1]) {
final NBTTagCompound NBTTAGCOMPOUND = (NBTTagCompound) tStack.getTagCompound().copy();
//MATE
- final NBTTagCompound MATE = NBTTAGCOMPOUND.getCompoundTag("Mate");
- final NBTTagList chromosomesMate = MATE.getTagList("Chromosomes",10);
- final NBTTagCompound species = chromosomesMate.getCompoundTagAt(0);
+ 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));
+ 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;
+ 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));
-
- final NBTTagCompound nuspeciesmate = new NBTTagCompound();
- nuspeciesmate.setString("UID1", ident1);
- nuspeciesmate.setString("UID0", ident2);
- nuspeciesmate.setByte("Slot", (byte) 0);
-
- //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));
- String ident2Genome = speciesGenome.getString("UID0");
- final String[] splitGenome2 = ident2Genome.split("[.]");
- ident2Genome = "gregtech.bee.species"+WordUtils.capitalize(splitGenome2[2].toLowerCase(Locale.ENGLISH));
-
- final NBTTagCompound nuspeciesgenome = new NBTTagCompound();
- nuspeciesgenome.setString("UID1", ident1Genome);
- nuspeciesgenome.setString("UID0", ident2Genome);
- nuspeciesgenome.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);
-
- 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));
+ 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);
}
- nugenome2.setTag("Chromosomes", nuGenome);
- NBTTAGCOMPOUND.removeTag("Genome");
- NBTTAGCOMPOUND.setTag("Genome", nugenome2);
+ 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);
|