mirror of
https://github.com/GTNewHorizons/BloodMagic.git
synced 2026-11-19 03:39:20 +00:00
Add estimated amount display for meteor NEI (#31)
This commit is contained in:
1 parent
3994b2510e
commit
82d7520944
2 files changed
+10
-2
No files matched your search
@@ -51,8 +51,11 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
stack = new ItemStack(Blocks.fire);
|
||||
tooltips.add(String.format("no entries found for oredict \"%s\"", component.getOreDictName()));
|
||||
}
|
||||
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(component.getChance() / totalMeteorWeight)));
|
||||
float chance = component.getChance() / totalMeteorWeight;
|
||||
tooltips.add(I18n.format("nei.recipe.meteor.chance", getFormattedChance(chance)));
|
||||
tooltips.add(I18n.format("nei.recipe.meteor.amount", getEstimatedAmount(chance, meteor.radius)));
|
||||
this.outputs.add(new TooltipStack(stack, xPos, yPos, tooltips));
|
||||
|
||||
col++;
|
||||
if (col > 8) {
|
||||
col = 0;
|
||||
@@ -197,7 +200,11 @@ public class NEIMeteorRecipeHandler extends TemplateRecipeHandler {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private String getFormattedChance(double chance) {
|
||||
private String getFormattedChance(float chance) {
|
||||
return new DecimalFormat("0.##").format(chance * 100);
|
||||
}
|
||||
|
||||
private int getEstimatedAmount(float chance, int radius) {
|
||||
return (int) Math.ceil(3f / 4 * Math.PI * Math.pow(radius, 3) * chance);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user