Added a way to view the progress towards the next upgrade level
Override `getProgress()` and return a value between 0.0 (0%) and 1.0 (100%)
This commit is contained in:
parent
3ad0969644
commit
7516f9c5d3
24 changed files with 187 additions and 1 deletions
|
@ -199,6 +199,16 @@ public class Utils
|
|||
return false;
|
||||
}
|
||||
|
||||
public static double calculateStandardProgress(Number currentValue, int[] requiredValues, int currentLevel)
|
||||
{
|
||||
int nextLevel = currentLevel + 1;
|
||||
if (nextLevel >= requiredValues.length)
|
||||
return 1.0D;
|
||||
|
||||
int required = requiredValues[nextLevel];
|
||||
return Double.parseDouble("" + currentValue) / (double) required;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static IItemHandler getInventory(TileEntity tile, @Nullable EnumFacing facing)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue