Merge remote-tracking branch 'origin/master' into Telepad

Conflicts:
	src/main/java/crazypants/gui/GuiContainerBase.java
This commit is contained in:
tterrag1098 committed 2015-02-14 00:41:37 -05:00
commit de55e3336c
21 files changed
+936 -69

No files matched your search

@@ -153,33 +153,42 @@ public abstract class GuiMachineBase<T extends AbstractMachineEntity> extends Gu
addToolTip(tt);
}
private void updateProgressTooltips(int progress) {
if(lastProgressTooltipValue == progress || progressTooltips == null) {
private void updateProgressTooltips(int scaledProgress, float progress) {
if(lastProgressTooltipValue == scaledProgress || progressTooltips == null) {
return;
}
lastProgressTooltipValue = progress;
lastProgressTooltipValue = scaledProgress;
if(progress < 0) {
if(scaledProgress < 0) {
for(GuiToolTip tt : progressTooltips) {
tt.setVisible(false);
}
return;
}
String msg = MessageFormat.format(Lang.localize("gui.progress"), progress);
String msg = formatProgressTooltip(scaledProgress, progress);
String[] tooltip = msg.split("\\|");
for(GuiToolTip tt : progressTooltips) {
tt.setToolTipText(msg);
tt.setToolTipText(tooltip);
tt.setVisible(true);
}
}
protected String formatProgressTooltip(int scaledProgress, float progress) {
return MessageFormat.format(Lang.localize("gui.progress"), scaledProgress);
}
protected int scaleProgressForTooltip(float progress) {
return (int)(progress * 100);
}
protected boolean shouldRenderProgress() {
float progress = tileEntity.getProgress();
if(progress > 0 && progress < 1) {
updateProgressTooltips((int)(progress * 100));
updateProgressTooltips(scaleProgressForTooltip(progress), progress);
return true;
} else {
updateProgressTooltips(-1);
updateProgressTooltips(-1, -1);
return false;
}
}