mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-19 11:49:14 +00:00
Fix Additive Production (#55)
* Fixed Secondary Species Primary Production Calling Math.round on probabilities is a logical error * gradle spotlessApply * Fixed computation of BeeModifiers to be consistent with additive modifiers Needs work in other mods (Binnie and MagicBees) * Fixed doubled base production modifier, fixed tooltips for frames with negative modifiers * Fixed floating point bug if productionModifier is negative * Fixed floating point bug if productionModifier + tier is negative * Float constant suffix * Actually fix base production modifier * Improve tooltip coloring, correct production modifier self capping, add float suffixes * More tooltip improvments * Nerf base production (apiaries in shambles) * Halve forestry frame production boost Co-authored-by: Jakub <[email protected]> * Added flowering modifier to tooltips I believe one of the blood magic frames has a non-default flowering modifier * Fixed flowering modifier in tooltip and made default values visible --------- Co-authored-by: Jakub <[email protected]>
This commit is contained in:
1 parent
6292b4569f
commit
afc859c6e9
9 files changed
+70
-35
No files matched your search
@@ -34,19 +34,31 @@ public class EventHandlerApiculture {
|
||||
tooltip.add(StringUtil.localize("frame.tooltip.durability") + getDurabilityFormatted(durability));
|
||||
|
||||
float territory = modifier.getTerritoryModifier(null, 1.0F);
|
||||
tooltip.add(StringUtil.localize("frame.tooltip.territory") + getColorFormatted(territory));
|
||||
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.territory")
|
||||
+ getModifierFormatted(territory, false, false));
|
||||
float mutation = modifier.getMutationModifier(null, null, 1.0F);
|
||||
tooltip.add(StringUtil.localize("frame.tooltip.mutationRate") + getColorFormatted(mutation));
|
||||
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.mutationRate")
|
||||
+ getModifierFormatted(mutation, false, false));
|
||||
float lifespan = modifier.getLifespanModifier(null, null, 1.0F);
|
||||
tooltip.add(StringUtil.localize("frame.tooltip.lifespan") + getColorFormatted(lifespan));
|
||||
|
||||
float production = modifier.getProductionModifier(null, 1.0F);
|
||||
tooltip.add(StringUtil.localize("frame.tooltip.production") + getColorFormatted(production, true));
|
||||
|
||||
// lower lifespan is better
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.lifespan")
|
||||
+ getModifierFormatted(lifespan, false, true));
|
||||
float production = modifier.getProductionModifier(null, 0.0F);
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.production")
|
||||
+ getModifierFormatted(production, true, false));
|
||||
float flowering = modifier.getFloweringModifier(null, 1.0F);
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.flowering")
|
||||
+ getModifierFormatted(flowering, false, false));
|
||||
float decay = modifier.getGeneticDecay(null, 1.0F);
|
||||
tooltip.add(StringUtil.localize("frame.tooltip.geneticDecay") + getColorFormatted(decay));
|
||||
// lower genetic decay is better
|
||||
tooltip.add(
|
||||
StringUtil.localize("frame.tooltip.geneticDecay")
|
||||
+ getModifierFormatted(decay, false, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -68,15 +80,27 @@ public class EventHandlerApiculture {
|
||||
return color + " " + durability;
|
||||
}
|
||||
|
||||
private static String getColorFormatted(float value, boolean additive) {
|
||||
private static String getModifierFormatted(float value, boolean additive, boolean undesireable) {
|
||||
EnumChatFormatting color;
|
||||
if (value <= 0.5F) {
|
||||
float lo_threshold = 0.5F, mid_threshold = 1.0F, hi_threshold = 2.0F;
|
||||
float discriminant = value;
|
||||
if (additive) {
|
||||
lo_threshold = -1.0F;
|
||||
mid_threshold = 0.0F;
|
||||
hi_threshold = 2.0F; // this one is the same
|
||||
if (undesireable) {
|
||||
discriminant = -value;
|
||||
}
|
||||
} else if (undesireable) {
|
||||
discriminant = 1.0F / value;
|
||||
}
|
||||
if (discriminant <= lo_threshold) {
|
||||
color = EnumChatFormatting.DARK_RED; // "bad" stat
|
||||
} else if (value < 1.0F) {
|
||||
} else if (discriminant < mid_threshold) {
|
||||
color = EnumChatFormatting.RED; // "below average" stat
|
||||
} else if (value == 1.0F) {
|
||||
} else if (discriminant == mid_threshold) {
|
||||
color = EnumChatFormatting.GOLD; // "average" stat
|
||||
} else if (value <= 2.0F) {
|
||||
} else if (discriminant <= hi_threshold) {
|
||||
color = EnumChatFormatting.GREEN; // "above average" stat
|
||||
} else {
|
||||
color = EnumChatFormatting.AQUA; // "great" stat
|
||||
@@ -84,10 +108,12 @@ public class EventHandlerApiculture {
|
||||
String formatted = color.toString();
|
||||
|
||||
// Set symbol for if this value is additive or multiplicative
|
||||
if (additive) {
|
||||
if (!additive) {
|
||||
formatted += " x";
|
||||
} else if (value >= 0.0F) {
|
||||
formatted += " +";
|
||||
} else {
|
||||
formatted += " x";
|
||||
formatted += " "; // the "-" will be applied, but we still need a space or minecraft will crash
|
||||
}
|
||||
|
||||
// trim trailing zeroes if no decimal-precision is needed
|
||||
@@ -96,8 +122,4 @@ public class EventHandlerApiculture {
|
||||
}
|
||||
return formatted + value;
|
||||
}
|
||||
|
||||
private static String getColorFormatted(float value) {
|
||||
return getColorFormatted(value, false);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user