Compare commits

...
2 Commits
Author SHA1 Message Date
Martin Robertz 32b7efcd15 update 2024-12-22 01:17:03 +01:00
Guillaume Mercier 7059206cb0 prevent npe and log bad requests (#55) 2024-12-21 10:35:14 -06:00
5 changed files with 25 additions and 7 deletions

No files matched your search

+3 -3
View File
@@ -1,10 +1,10 @@
// Add your dependencies here
dependencies {
api('com.github.GTNewHorizons:ForestryMC:4.9.16:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.5.20:dev')
api('com.github.GTNewHorizons:ForestryMC:4.10.0:dev')
implementation('com.github.GTNewHorizons:GTNHLib:0.6.0:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.44-GTNH:dev')
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.7.0-GTNH:dev')
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
Binary file not shown.
+1 -1
View File
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
+1 -1
View File
@@ -17,5 +17,5 @@ pluginManagement {
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.29'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.30'
}
@@ -4,6 +4,9 @@ import java.util.Random;
import net.minecraft.item.ItemStack;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import binnie.core.genetics.Gene;
import binnie.core.machines.Machine;
import binnie.core.machines.inventory.IChargedSlots;
@@ -20,6 +23,8 @@ import forestry.api.genetics.ISpeciesRoot;
public class IsolatorComponentLogic extends ComponentProcessSetCost implements IProcess {
private static final Logger LOG = LogManager.getLogger("Genetics");
protected float enzymePerProcess = 0.5f;
protected float ethanolPerProcess = 10.0f;
@@ -79,8 +84,21 @@ public class IsolatorComponentLogic extends ComponentProcessSetCost implements I
final IChromosomeType[] karyo = root.getKaryotype();
final IChromosomeType chromosome = karyo[rand.nextInt(karyo.length)];
final IAllele allele = rand.nextBoolean() ? individual.getGenome().getActiveAllele(chromosome)
: individual.getGenome().getInactiveAllele(chromosome);
final IAllele allele;
try {
allele = rand.nextBoolean() ? individual.getGenome().getActiveAllele(chromosome)
: individual.getGenome().getInactiveAllele(chromosome);
} catch (NullPointerException npe) {
// just return and eat the power without eating the rest of it
LOG.warn(
"NPE occurred on unknown gene: name: " + chromosome.getName()
+ " | ordinal: "
+ chromosome.ordinal()
+ " | is null? "
+ (individual.getGenome().getChromosomes()[chromosome.ordinal()] == null ? "true"
: "false"));
return;
}
final Gene gene = new Gene(allele, chromosome, root);
ItemStack serum = ItemSequence.create(gene);