mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-16 10:34:53 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f691d8e588 | ||
|
|
274dd90030 | ||
|
|
3cef725be3 | ||
|
|
47a7aa82b1 | ||
|
|
1e206e4f81 | ||
|
|
10b7c54b02 | ||
|
|
7549707704 | ||
|
|
37a3de11b6 |
No files matched your search
+1
-1
@@ -3,7 +3,7 @@
|
||||
dependencies {
|
||||
api('curse.maven:cofh-lib-220333:2388748')
|
||||
compileOnlyApi('com.github.GTNewHorizons:Angelica:1.0.0-alpha52:api')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.11-GTNH:dev')
|
||||
devOnlyNonPublishable('com.github.GTNewHorizons:NotEnoughItems:2.6.5-GTNH:dev')
|
||||
compileOnly('com.github.GTNewHorizons:inventory-tweaks:1.6.2:api')
|
||||
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.39:api')
|
||||
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
|
||||
|
||||
@@ -8,9 +8,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import static forestry.core.utils.MathUtil.safeAdd;
|
||||
import static forestry.core.utils.MathUtil.safeMultiply;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -702,9 +699,9 @@ public class Bee extends IndividualLiving implements IBee {
|
||||
|
||||
// boost chance for researched mutations
|
||||
if (breedingTracker.isResearched(beeMutation)) {
|
||||
float mutationBoost = safeMultiply(chance, Config.researchMutationBoostMultiplier - 1.0f);
|
||||
float mutationBoost = chance * (Config.researchMutationBoostMultiplier - 1.0f);
|
||||
mutationBoost = Math.min(Config.maxResearchMutationBoostPercent, mutationBoost);
|
||||
chance = safeAdd(chance, mutationBoost);
|
||||
chance += mutationBoost;
|
||||
}
|
||||
|
||||
if (chance > world.rand.nextFloat() * 100) {
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.genetics;
|
||||
|
||||
import static forestry.core.utils.MathUtil.safeMultiply;
|
||||
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -51,12 +49,8 @@ public class BeeMutation extends Mutation implements IBeeMutationCustom {
|
||||
IBeeModifier beeHousingModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
|
||||
IBeeModifier beeModeModifier = BeeManager.beeRoot.getBeekeepingMode(world).getBeeModifier();
|
||||
|
||||
processedChance = safeMultiply(
|
||||
processedChance,
|
||||
beeHousingModifier.getMutationModifier(genome0, genome1, processedChance));
|
||||
processedChance = safeMultiply(
|
||||
processedChance,
|
||||
beeModeModifier.getMutationModifier(genome0, genome1, processedChance));
|
||||
processedChance *= beeHousingModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
processedChance *= beeModeModifier.getMutationModifier(genome0, genome1, processedChance);
|
||||
|
||||
return processedChance;
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
|
||||
// Don't destroy blocks in the protected 3x3x4 area if housing is an Alveary.
|
||||
// Stops the bee destroying itself. Silly behaviour.
|
||||
if (isInAlvearyProtectedArea(posHousing, posBlock)) {
|
||||
if (isAlveary && isInAlvearyProtectedArea(posHousing, posBlock)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.genetics.mutations;
|
||||
|
||||
import static forestry.core.utils.MathUtil.safeMultiply;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@@ -128,9 +126,7 @@ public abstract class Mutation implements IMutationCustom {
|
||||
IGenome genome1, IClimateProvider climate) {
|
||||
float mutationChance = chance;
|
||||
for (IMutationCondition mutationCondition : mutationConditions) {
|
||||
mutationChance = safeMultiply(
|
||||
mutationChance,
|
||||
mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate));
|
||||
mutationChance *= mutationCondition.getChance(world, x, y, z, allele0, allele1, genome0, genome1, climate);
|
||||
if (mutationChance == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
package forestry.core.utils;
|
||||
|
||||
public class MathUtil {
|
||||
|
||||
public static float safeMultiply(float a, float b) {
|
||||
if (a > 0 && b > 0 && a > Float.MAX_VALUE / b) {
|
||||
return Float.MAX_VALUE;
|
||||
} else if (a > 0 && b < 0 && a > Float.MIN_VALUE / b) {
|
||||
return Float.MIN_VALUE;
|
||||
} else if (a < 0 && b > 0 && a < Float.MIN_VALUE / b) {
|
||||
return Float.MIN_VALUE;
|
||||
} else if (a < 0 && b < 0 && a < Float.MAX_VALUE / b) {
|
||||
return Float.MAX_VALUE;
|
||||
} else {
|
||||
return a * b;
|
||||
}
|
||||
}
|
||||
|
||||
public static float safeAdd(float a, float b) {
|
||||
if (a > 0 && b > 0 && a > Float.MAX_VALUE - b) {
|
||||
return Float.MAX_VALUE;
|
||||
} else if (a < 0 && b < 0 && a < Float.MIN_VALUE - b) {
|
||||
return Float.MIN_VALUE;
|
||||
} else {
|
||||
return a + b;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -192,24 +192,14 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
int[] oreIds = OreDictionary.getOreIDs(itemStack);
|
||||
for (int oreId : oreIds) {
|
||||
if (validOreIds.contains(oreId)) {
|
||||
if (meta != OreDictionary.WILDCARD_VALUE) {
|
||||
String itemStackString = itemStackStringWild + ':' + meta;
|
||||
validItemStacks.add(itemStackString);
|
||||
} else {
|
||||
validItemStacks.add(itemStackStringWild);
|
||||
}
|
||||
validItemStacks.add(itemStackStringWild);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (Class<?> itemClass : validItemClasses) {
|
||||
if (itemClass.isInstance(item)) {
|
||||
if (meta != OreDictionary.WILDCARD_VALUE) {
|
||||
String itemStackString = itemStackStringWild + ':' + meta;
|
||||
validItemStacks.add(itemStackString);
|
||||
} else {
|
||||
validItemStacks.add(itemStackStringWild);
|
||||
}
|
||||
validItemStacks.add(itemStackStringWild);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -218,12 +208,7 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
if (block != null) {
|
||||
for (Class<?> blockClass : validBlockClasses) {
|
||||
if (blockClass.isInstance(block)) {
|
||||
if (meta != OreDictionary.WILDCARD_VALUE) {
|
||||
String itemStackString = itemStackStringWild + ':' + meta;
|
||||
validItemStacks.add(itemStackString);
|
||||
} else {
|
||||
validItemStacks.add(itemStackStringWild);
|
||||
}
|
||||
validItemStacks.add(itemStackStringWild);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user