Localization and refactoring (#77)

* Some refactoring for bee production

* Code cleanup

* Code cleanup

* Added some localization

* Fix wrong dropped class

* Added some localization

* Added some localization

* Added some localization

* Fix wrong import
This commit is contained in:
Alexander Kornilov authored and mezz committed 2017-05-23 23:58:13 -07:00
1 parent 68bbe7710c
commit 1ea7b62e5f
157 files changed
+3240 -5045

No files matched your search

@@ -0,0 +1,37 @@
package binnie.genetics.machine.splicer;
import binnie.genetics.api.IGene;
import forestry.api.apiculture.EnumBeeChromosome;
import forestry.api.apiculture.IBeeRoot;
import forestry.api.genetics.IAllele;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class Splicer {
public static final int SLOT_SERUM_VIAL = 0;
public static final int[] SLOT_SERUM_RESERVE = new int[]{1, 2};
public static final int[] SLOT_SERUM_EXPENDED = new int[]{3, 4};
public static final int[] SLOT_RESERVE = new int[]{5, 6, 7, 8, 9};
public static final int SLOT_TARGET = 9;
public static final int[] SLOT_FINISHED = new int[]{10, 11, 12, 13};
public static void setGene(IGene gene, ItemStack target, int chromoN) {
int chromosomeID = gene.getChromosome().ordinal();
if (chromosomeID >= EnumBeeChromosome.HUMIDITY.ordinal() && gene.getSpeciesRoot() instanceof IBeeRoot) {
chromosomeID--;
}
Class<? extends IAllele> cls = gene.getChromosome().getAlleleClass();
if (!cls.isInstance(gene.getAllele())) {
return;
}
NBTTagCompound beeNBT = target.getTagCompound();
NBTTagCompound genomeNBT = beeNBT.getCompoundTag("Genome");
NBTTagList chromosomes = genomeNBT.getTagList("Chromosomes", 10);
NBTTagCompound chromosomeNBT = chromosomes.getCompoundTagAt(chromosomeID);
chromosomeNBT.setString("UID" + chromoN, gene.getAllele().getUID());
target.setTagCompound(beeNBT);
}
}