Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
fix inventory index drift (#103)
Browse files Browse the repository at this point in the history
* fix inventory index drift

* address even more id drift

Former-commit-id: df6d2caa2fa4328cec81bbf34d42eebb92b455b1
  • Loading branch information
Glease authored Mar 7, 2022
1 parent 9227ebd commit 95960bf
Showing 1 changed file with 43 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,26 +93,26 @@ public int checkRecipe(boolean skipOC) {
int damage = this.getSpecialSlot().getItemDamage();
switch (damage) {
case DNA_EXTRACTION_MODULE:
if (GT_Utility.isStackValid(this.mInventory[4]) && this.mInventory[4].getItem() instanceof LabParts && this.mInventory[4].getItemDamage() == 0 && this.mInventory[4].getTagCompound() != null && //checks if it is a Culture
GT_Utility.isStackValid(this.mInventory[5]) && this.mInventory[5].getItem() instanceof LabParts && this.mInventory[5].getItemDamage() == 1 && this.mInventory[5].getTagCompound() == null &&
GT_Utility.isStackValid(this.mInventory[6]) && this.mInventory[6].getItem() instanceof LabParts && this.mInventory[6].getItemDamage() == 3 &&
GT_Utility.areStacksEqual(this.mInventory[7], Materials.Ethanol.getCells(1)) &&
if (GT_Utility.isStackValid(this.mInventory[getInputSlot()]) && this.mInventory[getInputSlot()].getItem() instanceof LabParts && this.mInventory[getInputSlot()].getItemDamage() == 0 && this.mInventory[getInputSlot()].getTagCompound() != null && //checks if it is a Culture
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 1]) && this.mInventory[getInputSlot() + 1].getItem() instanceof LabParts && this.mInventory[getInputSlot() + 1].getItemDamage() == 1 && this.mInventory[getInputSlot() + 1].getTagCompound() == null &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 2]) && this.mInventory[getInputSlot() + 2].getItem() instanceof LabParts && this.mInventory[getInputSlot() + 2].getItemDamage() == 3 &&
GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 3], Materials.Ethanol.getCells(1)) &&
this.mFluid != null && this.mFluid.isFluidEqual(FluidRegistry.getFluidStack("ic2distilledwater", 1000)) && this.mFluid.amount >= 1000
) {

NBTTagCompound DNABioDataTag = this.mInventory[4].getTagCompound().getCompoundTag("DNA");
NBTTagCompound DNABioDataTag = this.mInventory[getInputSlot()].getTagCompound().getCompoundTag("DNA");
if (DNABioDataTag == null)
return super.checkRecipe(skipOC);
BioData cultureDNABioData = BioData.getBioDataFromName(this.mInventory[4].getTagCompound().getCompoundTag("DNA").getString("Name"));
BioData cultureDNABioData = BioData.getBioDataFromName(this.mInventory[getInputSlot()].getTagCompound().getCompoundTag("DNA").getString("Name"));
if (cultureDNABioData == null)
return super.checkRecipe(skipOC);

if (this.mTier < rTier + cultureDNABioData.getTier())
return GT_MetaTileEntity_BasicMachine.FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;

for (int i = 4; i < 8; i++) {
if (this.mInventory[i] != null)
this.mInventory[i].stackSize--;
for (int i = 0; i < 4; i++) {
if (this.mInventory[getInputSlot() + i] != null)
this.mInventory[getInputSlot() + i].stackSize--;
}

this.mFluid.amount -= 1000;
Expand All @@ -127,12 +127,12 @@ public int checkRecipe(boolean skipOC) {
}
break;
case PCR_THERMOCYCLE_MODULE: {
if (GT_Utility.isStackValid(this.mInventory[4]) && this.mInventory[4].getItem() instanceof LabParts && this.mInventory[4].getItemDamage() == 1 && this.mInventory[4].getTagCompound() != null && //checks if it is a Culture
GT_Utility.isStackValid(this.mInventory[7]) && GT_Utility.areStacksEqual(this.mInventory[7], ItemList.Tool_DataOrb.get(1L)) &&
GT_Utility.isStackValid(this.mInventory[5]) && GT_Utility.areStacksEqual(this.mInventory[5], FluidLoader.BioLabFluidCells[0]) &&
GT_Utility.isStackValid(this.mInventory[6]) && GT_Utility.areStacksEqual(this.mInventory[6], FluidLoader.BioLabFluidCells[3]) &&
if (GT_Utility.isStackValid(this.mInventory[getInputSlot()]) && this.mInventory[getInputSlot()].getItem() instanceof LabParts && this.mInventory[getInputSlot()].getItemDamage() == 1 && this.mInventory[getInputSlot()].getTagCompound() != null && //checks if it is a Culture
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 3]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 3], ItemList.Tool_DataOrb.get(1L)) &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 1]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 1], FluidLoader.BioLabFluidCells[0]) &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 2]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 2], FluidLoader.BioLabFluidCells[3]) &&
this.mFluid != null && this.mFluid.isFluidEqual(dnaFluid) && this.mFluid.amount >= 1000) {
NBTTagCompound DNABioDataTag = this.mInventory[4].getTagCompound();
NBTTagCompound DNABioDataTag = this.mInventory[getInputSlot()].getTagCompound();
if (DNABioDataTag == null)
return super.checkRecipe(skipOC);
BioData cultureDNABioData = BioData.getBioDataFromName(DNABioDataTag.getString("Name"));
Expand All @@ -142,9 +142,9 @@ public int checkRecipe(boolean skipOC) {
if (this.mTier < 1 + rTier + cultureDNABioData.getTier())
return GT_MetaTileEntity_BasicMachine.FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;

for (int i = 4; i < 8; i++) {
if (this.mInventory[i] != null)
this.mInventory[i].stackSize--;
for (int i = 0; i < 4; i++) {
if (this.mInventory[getInputSlot() + i] != null)
this.mInventory[getInputSlot() + i].stackSize--;
}

this.mFluid.amount -= 1000;
Expand All @@ -171,20 +171,20 @@ public int checkRecipe(boolean skipOC) {
Behaviour_DataOrb.setDataTitle(inp2, "DNA Sample");
Behaviour_DataOrb.setDataName(inp2, BioCultureLoader.BIO_DATA_BETA_LACMATASE.getName());
if (
GT_Utility.isStackValid(this.mInventory[4]) && GT_Utility.areStacksEqual(FluidLoader.BioLabFluidCells[1], this.mInventory[4]) && //checks if it is a Culture
GT_Utility.isStackValid(this.mInventory[5]) && GT_Utility.areStacksEqual(this.mInventory[5], BioItemList.getPlasmidCell(null)) &&
GT_Utility.isStackValid(this.mInventory[6]) && GT_Utility.areStacksEqual(this.mInventory[6], ItemList.Tool_DataOrb.get(1L), true) &&
Behaviour_DataOrb.getDataTitle(this.mInventory[6]).equals("DNA Sample") && (!(Behaviour_DataOrb.getDataName(this.mInventory[6]).isEmpty())) &&
GT_Utility.isStackValid(this.mInventory[7]) && GT_Utility.areStacksEqual(this.mInventory[7], inp2) &&
GT_Utility.isStackValid(this.mInventory[getInputSlot()]) && GT_Utility.areStacksEqual(FluidLoader.BioLabFluidCells[1], this.mInventory[getInputSlot()]) && //checks if it is a Culture
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 1]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 1], BioItemList.getPlasmidCell(null)) &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 2]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 2], ItemList.Tool_DataOrb.get(1L), true) &&
Behaviour_DataOrb.getDataTitle(this.mInventory[getInputSlot() + 2]).equals("DNA Sample") && (!(Behaviour_DataOrb.getDataName(this.mInventory[getInputSlot() + 2]).isEmpty())) &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 3]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 3], inp2) &&
this.mFluid != null && this.mFluid.isFluidEqual(dnaFluid) && (this.mFluid.amount >= 1000)) {
BioData cultureDNABioData = BioData.getBioDataFromName(Behaviour_DataOrb.getDataName(this.mInventory[6]));
BioData cultureDNABioData = BioData.getBioDataFromName(Behaviour_DataOrb.getDataName(this.mInventory[getInputSlot() + 2]));
if (cultureDNABioData == null)
return super.checkRecipe(skipOC);
if (this.mTier < 1 + rTier + cultureDNABioData.getTier())
return GT_MetaTileEntity_BasicMachine.FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
for (int i = 4; i < 6; i++) {
if (this.mInventory[i] != null)
this.mInventory[i].stackSize--;
for (int i = 0; i < 2; i++) {
if (this.mInventory[getInputSlot() + i] != null)
this.mInventory[getInputSlot() + i].stackSize--;
}
this.mFluid.amount -= 1000;
if (cultureDNABioData.getChance() > new XSTR().nextInt(10000)) {
Expand All @@ -199,19 +199,19 @@ public int checkRecipe(boolean skipOC) {
break;
case TRANSFORMATION_MODULE: {
if (
GT_Utility.isStackValid(this.mInventory[4]) && GT_Utility.areStacksEqual(this.mInventory[4], BioItemList.getPetriDish(null), true) && this.mInventory[4].getTagCompound() != null &&
GT_Utility.isStackValid(this.mInventory[5]) && GT_Utility.areStacksEqual(this.mInventory[5], BioItemList.getPlasmidCell(null), true) && this.mInventory[5].getTagCompound() != null &&
GT_Utility.isStackValid(this.mInventory[6]) && GT_Utility.areStacksEqual(this.mInventory[6], FluidLoader.BioLabFluidCells[2]) &&
GT_Utility.isStackValid(this.mInventory[getInputSlot()]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot()], BioItemList.getPetriDish(null), true) && this.mInventory[getInputSlot()].getTagCompound() != null &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 1]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 1], BioItemList.getPlasmidCell(null), true) && this.mInventory[getInputSlot() + 1].getTagCompound() != null &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 2]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 2], FluidLoader.BioLabFluidCells[2]) &&
this.mFluid != null && this.mFluid.isFluidEqual(FluidRegistry.getFluidStack("ic2distilledwater", 1000)) && this.mFluid.amount >= 1000) {
BioData cultureDNABioData = BioData.getBioDataFromNBTTag(this.mInventory[5].getTagCompound());
BioCulture bioCulture = BioCulture.getBioCultureFromNBTTag(this.mInventory[4].getTagCompound());
BioData cultureDNABioData = BioData.getBioDataFromNBTTag(this.mInventory[getInputSlot() + 1].getTagCompound());
BioCulture bioCulture = BioCulture.getBioCultureFromNBTTag(this.mInventory[getInputSlot()].getTagCompound());
if (cultureDNABioData == null || bioCulture == null)
return super.checkRecipe(skipOC);
if (this.mTier < 3 + rTier + cultureDNABioData.getTier())
return GT_MetaTileEntity_BasicMachine.FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
for (int i = 4; i < 7; i++) {
if (this.mInventory[i] != null)
this.mInventory[i].stackSize--;
for (int i = 0; i < 3; i++) {
if (this.mInventory[getInputSlot() + i] != null)
this.mInventory[getInputSlot() + i].stackSize--;
}
this.mFluid.amount -= 1000;
bioCulture = bioCulture.setPlasmid(BioPlasmid.convertDataToPlasmid(cultureDNABioData));
Expand All @@ -230,20 +230,20 @@ public int checkRecipe(boolean skipOC) {
Behaviour_DataOrb.setDataTitle(Outp, "DNA Sample");

if (
GT_Utility.isStackValid(this.mInventory[4]) && GT_Utility.areStacksEqual(this.mInventory[4], BioItemList.getPetriDish(null)) &&
GT_Utility.isStackValid(this.mInventory[5]) && GT_Utility.areStacksEqual(this.mInventory[5], BioItemList.getOther(4)) &&
GT_Utility.isStackValid(this.mInventory[6]) && GT_Utility.areStacksEqual(this.mInventory[6], ItemList.Circuit_Chip_Stemcell.get(2L)) &&
GT_Utility.isStackValid(this.mInventory[7]) && GT_Utility.areStacksEqual(this.mInventory[7], ItemList.Tool_DataOrb.get(1L), true) &&
Behaviour_DataOrb.getDataTitle(this.mInventory[7]).equals("DNA Sample") && this.mFluid.isFluidEqual(dnaFluid) && (this.mFluid.amount >= 8000)) {
GT_Utility.isStackValid(this.mInventory[getInputSlot()]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot()], BioItemList.getPetriDish(null)) &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 1]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 1], BioItemList.getOther(4)) &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 2]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 2], ItemList.Circuit_Chip_Stemcell.get(2L)) &&
GT_Utility.isStackValid(this.mInventory[getInputSlot() + 3]) && GT_Utility.areStacksEqual(this.mInventory[getInputSlot() + 3], ItemList.Tool_DataOrb.get(1L), true) &&
Behaviour_DataOrb.getDataTitle(this.mInventory[getInputSlot() + 3]).equals("DNA Sample") && this.mFluid.isFluidEqual(dnaFluid) && (this.mFluid.amount >= 8000)) {

BioData cultureDNABioData = BioData.getBioDataFromName(Behaviour_DataOrb.getDataName(this.mInventory[7]));
BioData cultureDNABioData = BioData.getBioDataFromName(Behaviour_DataOrb.getDataName(this.mInventory[getInputSlot() + 3]));
if (cultureDNABioData == null)
return super.checkRecipe(skipOC);
if (this.mTier < 3 + rTier + cultureDNABioData.getTier())
return GT_MetaTileEntity_BasicMachine.FOUND_RECIPE_BUT_DID_NOT_MEET_REQUIREMENTS;
for (int i = 4; i < 7; i++) {
if (this.mInventory[i] != null)
this.mInventory[i].stackSize--;
for (int i = 0; i < 3; i++) {
if (this.mInventory[getInputSlot() + i] != null)
this.mInventory[getInputSlot() + i].stackSize--;
}
this.mFluid.amount -= 8000;
if (cultureDNABioData.getChance() > new XSTR().nextInt(10000)) {
Expand Down

0 comments on commit 95960bf

Please sign in to comment.