Skip to content

Commit

Permalink
Minor formatting, readme update
Browse files Browse the repository at this point in the history
  • Loading branch information
WesCook committed May 30, 2017
1 parent 9e98b3f commit eb0725d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#Forge/Gradle
run
out
build
classes
.gradle

# IntelliJ IDEA
*.ipr
*.iws
*.iml
.idea
.gradle

# eclipse
# Eclipse
bin
*.launch
.settings
Expand Down
11 changes: 11 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,27 @@ Mods that are supported with the default five-food group system include:

* [Animania](https://minecraft.curseforge.com/projects/animania)
* [Better with Mods](https://minecraft.curseforge.com/projects/better-with-mods)
* [Biomes O' Plenty](https://minecraft.curseforge.com/projects/biomes-o-plenty)
* [Edible Bugs](https://minecraft.curseforge.com/projects/edible-bugs)
* [Food Expansion](https://minecraft.curseforge.com/projects/food-expansion)
* [Forestry](https://minecraft.curseforge.com/projects/forestry)
* [Grim Pack](https://minecraft.curseforge.com/projects/grim-pack)
* [Natura](https://minecraft.curseforge.com/projects/natura)
* [Pam's HarvestCraft](https://minecraft.curseforge.com/projects/pams-harvestcraft)
* [Roots](https://minecraft.curseforge.com/projects/roots)
* [Simple Corn](https://minecraft.curseforge.com/projects/simple-corn)
* [Simply Tea!](https://minecraft.curseforge.com/projects/simply-tea)
* [Tinkers Construct](https://minecraft.curseforge.com/projects/tinkers-construct)

Mod support contributions are welcome! Please create a [Pull Request](https://github.com/WesCook/Nutrition/pulls) or an [Issue](https://github.com/WesCook/Nutrition/issues) with the related .json files.

## Changelog

[v1.1.0](https://github.com/WesCook/Nutrition/releases/tag/v1.1.0) - 2017-05-30

* Added support for Biomes O' Plenty, Forestry, Natura, Roots, Simply Tea!, and Tinkers Construct (contribution from KnightMiner)
* Nutrient field can now be negated from other detection modes (contribution from KnightMiner)

[v1.0.1](https://github.com/WesCook/Nutrition/releases/tag/v1.0.1) - 2017-05-28

* Improved detection when attaching capability
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ca/wescook/nutrition/effects/EffectsList.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public static void parseJson() {
effect.maximum = effectRaw.maximum;
effect.detect = effectRaw.detect;

// assign the tag for exclusion/only nutrient
// Assign the tag for exclusion/only nutrient
effect.nutrient = NutrientList.getByName(effectRaw.nutrient);

// error if missing the nutrient when the mode is nutrient
// Error if missing the nutrient when the mode is nutrient
if (effect.detect.equals("nutrient")) {
if (effect.nutrient == null) {
Log.error("Detect mode is set to 'nutrient', but nutrient is not set. (" + effect.name + ")");
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/ca/wescook/nutrition/effects/EffectsManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private static List<Effect> getEffectsInThreshold(EntityPlayer player) {
// Loop all nutrients
for (Map.Entry<Nutrient, Float> entry : playerNutrition.entrySet()) {
// If any are found within threshold
if (!entry.getKey().equals(effect.nutrient) // skip if excluded
if (!entry.getKey().equals(effect.nutrient) // Skip if excluded
&& entry.getValue() >= effect.minimum && entry.getValue() <= effect.maximum) {
effectsInThreshold.add(effect); // Add effect, once
break;
Expand All @@ -57,15 +57,15 @@ private static List<Effect> getEffectsInThreshold(EntityPlayer player) {

// Loop all nutrients
for (Map.Entry<Nutrient, Float> entry : playerNutrition.entrySet()) {
if(!entry.getKey().equals(effect.nutrient)) // skip if excluded
if(!entry.getKey().equals(effect.nutrient)) // Skip if excluded
total += entry.getValue(); // Add each value to total
}

// remove the excluded nutrient from the size count
// Remove the excluded nutrient from the size count
int size = playerNutrition.size();
if(effect.nutrient != null) {
if (effect.nutrient != null)
size--;
}

// Divide by number of nutrients for average (division by zero check)
average = (size != 0) ? total / size : -1f;

Expand All @@ -82,7 +82,7 @@ private static List<Effect> getEffectsInThreshold(EntityPlayer player) {

// Loop all nutrients
for (Map.Entry<Nutrient, Float> entry : playerNutrition.entrySet()) {
if (!entry.getKey().equals(effect.nutrient) // skip if excluded
if (!entry.getKey().equals(effect.nutrient) // Skip if excluded
&& !(entry.getValue() >= effect.minimum && entry.getValue() <= effect.maximum)) // If nutrient isn't within threshold
allWithinThreshold = false; // Fail check
}
Expand All @@ -101,7 +101,7 @@ private static List<Effect> getEffectsInThreshold(EntityPlayer player) {
// Loop all nutrients
for (Map.Entry<Nutrient, Float> entry : playerNutrition.entrySet()) {
// If any are found within threshold
if (!entry.getKey().equals(effect.nutrient) // skip if excluded
if (!entry.getKey().equals(effect.nutrient) // Skip if excluded
&& entry.getValue() >= effect.minimum && entry.getValue() <= effect.maximum)
cumulativeCount++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
// 'cumulative': For each nutrient within the threshold, the amplifier increases by one
// 'nutrient': A specific nutrient must be in the threshold (see below)
"nutrient": "", // If detect=nutrient, this defines the nutrient ID checked against
// If detect!=nutrient, this defines the nutrient ID that is excluded from the average or threshold
// If detect!=nutrient, this defines the nutrient ID that is excluded from other detection modes
"enabled": false // Will this effect be active or not
}

0 comments on commit eb0725d

Please sign in to comment.