Refactor locationToName method for improved readability and performance and update license
This commit is contained in:
parent
a8347a5126
commit
aaa11a11ac
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -20,14 +20,21 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
/**
|
/**
|
||||||
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
* Copyright (c) 2024 lax1dude. All Rights Reserved.
|
||||||
*
|
*
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
* DISCLAIMED.
|
||||||
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
* DIRECT,
|
||||||
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
* (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
* DATA, OR
|
||||||
|
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||||
|
* LIABILITY,
|
||||||
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||||
|
* OTHERWISE)
|
||||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
* POSSIBILITY OF SUCH DAMAGE.
|
* POSSIBILITY OF SUCH DAMAGE.
|
||||||
*
|
*
|
||||||
|
@ -57,72 +64,76 @@ public class GuiUpdateCheckerOverlay extends Gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setResolution(Minecraft mc, int w, int h) {
|
public void setResolution(Minecraft mc, int w, int h) {
|
||||||
if(!UpdateService.supported()) {
|
if (!UpdateService.supported()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.mc = mc;
|
this.mc = mc;
|
||||||
this.width = w;
|
this.width = w;
|
||||||
this.height = h;
|
this.height = h;
|
||||||
checkForUpdatesButton = new GuiButton(0, 0, 0, 150, 20, I18n.format("update.button") + " " + I18n.format(mc.gameSettings.enableUpdateSvc ? "gui.yes" : "gui.no"));
|
checkForUpdatesButton = new GuiButton(0, 0, 0, 150, 20, I18n.format("update.button") + " "
|
||||||
|
+ I18n.format(mc.gameSettings.enableUpdateSvc ? "gui.yes" : "gui.no"));
|
||||||
startDownloadButton = new GuiButton(1, 1, 0, 115, 20, I18n.format("update.startDownload"));
|
startDownloadButton = new GuiButton(1, 1, 0, 115, 20, I18n.format("update.startDownload"));
|
||||||
viewAllUpdatesButton = new GuiButton(2, 1, 0, 115, 20, I18n.format("update.viewAll", 0));
|
viewAllUpdatesButton = new GuiButton(2, 1, 0, 115, 20, I18n.format("update.viewAll", 0));
|
||||||
dismissUpdatesButton = new GuiButton(3, 1, 0, 115, 20, I18n.format("update.dismiss"));
|
dismissUpdatesButton = new GuiButton(3, 1, 0, 115, 20, I18n.format("update.dismiss"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawScreen(int mx, int my, float partialTicks) {
|
public void drawScreen(int mx, int my, float partialTicks) {
|
||||||
if(!UpdateService.supported()) {
|
if (!UpdateService.supported()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateProgressStruct progressState = UpdateService.getUpdatingStatus();
|
UpdateProgressStruct progressState = UpdateService.getUpdatingStatus();
|
||||||
if(progressState.isBusy) {
|
if (progressState.isBusy) {
|
||||||
drawScreenBusy(mx, my, partialTicks, progressState);
|
drawScreenBusy(mx, my, partialTicks, progressState);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkForUpdatesButton.visible = isIngame;
|
checkForUpdatesButton.visible = isIngame;
|
||||||
startDownloadButton.visible = false;
|
startDownloadButton.visible = false;
|
||||||
viewAllUpdatesButton.visible = false;
|
viewAllUpdatesButton.visible = false;
|
||||||
dismissUpdatesButton.visible = false;
|
dismissUpdatesButton.visible = false;
|
||||||
totalHeightOffset = 0;
|
totalHeightOffset = 0;
|
||||||
|
|
||||||
int i = UpdateService.getAvailableUpdates().size();
|
int i = UpdateService.getAvailableUpdates().size();
|
||||||
boolean shownSP = i > 0 || !mc.isSingleplayer() || LANServerController.isHostingLAN();
|
boolean shownSP = i > 0 || !mc.isSingleplayer() || LANServerController.isHostingLAN();
|
||||||
checkForUpdatesButton.visible &= shownSP;
|
checkForUpdatesButton.visible &= shownSP;
|
||||||
|
|
||||||
if(mc.gameSettings.enableUpdateSvc) {
|
if (mc.gameSettings.enableUpdateSvc) {
|
||||||
|
|
||||||
String str;
|
String str;
|
||||||
UpdateCertificate cert = UpdateService.getLatestUpdateFound();
|
UpdateCertificate cert = UpdateService.getLatestUpdateFound();
|
||||||
if(cert != null) {
|
if (cert != null) {
|
||||||
startDownloadButton.visible = true;
|
startDownloadButton.visible = true;
|
||||||
viewAllUpdatesButton.visible = true;
|
viewAllUpdatesButton.visible = true;
|
||||||
dismissUpdatesButton.visible = true;
|
dismissUpdatesButton.visible = true;
|
||||||
viewAllUpdatesButton.displayString = I18n.format("update.viewAll", i);
|
viewAllUpdatesButton.displayString = I18n.format("update.viewAll", i);
|
||||||
str = I18n.format("update.found");
|
str = I18n.format("update.found");
|
||||||
mc.fontRendererObj.drawStringWithShadow(str, 3, 22, 0xFFFFAA);
|
mc.fontRendererObj.drawStringWithShadow(str, 3, 22, 0xFFFFAA);
|
||||||
|
|
||||||
int embedY = 35;
|
int embedY = 35;
|
||||||
int embedWidth = 115;
|
int embedWidth = 115;
|
||||||
int embedWidth2 = (int)(embedWidth / 0.75f);
|
int embedWidth2 = (int) (embedWidth / 0.75f);
|
||||||
|
|
||||||
List<String> lst = cert.bundleVersionComment.length() == 0 ? null : mc.fontRendererObj.listFormattedStringToWidth(cert.bundleVersionComment, embedWidth2 - 14);
|
List<String> lst = cert.bundleVersionComment.length() == 0 ? null
|
||||||
|
: mc.fontRendererObj.listFormattedStringToWidth(cert.bundleVersionComment, embedWidth2 - 14);
|
||||||
|
|
||||||
int embedHeight = 44;
|
int embedHeight = 44;
|
||||||
if(lst != null) {
|
if (lst != null) {
|
||||||
embedHeight += 3 + lst.size() * 6;
|
embedHeight += 3 + lst.size() * 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.translate(1.0f, embedY, 0.0f);
|
GlStateManager.translate(1.0f, embedY, 0.0f);
|
||||||
GlStateManager.scale(0.75f, 0.75f, 0.75f);
|
GlStateManager.scale(0.75f, 0.75f, 0.75f);
|
||||||
|
|
||||||
int embedHeight2 = (int)(embedHeight / 0.75f);
|
int embedHeight2 = (int) (embedHeight / 0.75f);
|
||||||
|
|
||||||
drawGradientRect(1, 1, embedWidth2 - 1, embedHeight2 - 1, 0xFFFFFFAA, 0xFFFFFFAA);
|
drawGradientRect(1, 1, embedWidth2 - 1, embedHeight2 - 1, 0xFFFFFFAA, 0xFFFFFFAA);
|
||||||
drawGradientRect(0, 1, embedWidth2, 2, 0xFF000000, 0xFF000000);
|
drawGradientRect(0, 1, embedWidth2, 2, 0xFF000000, 0xFF000000);
|
||||||
drawGradientRect(0, embedHeight2 - 1, embedWidth2, embedHeight2, 0xFF000000, 0xFF000000);
|
drawGradientRect(0, embedHeight2 - 1, embedWidth2, embedHeight2, 0xFF000000, 0xFF000000);
|
||||||
drawGradientRect(0, 1, 1, embedHeight2 - 1, 0xFF000000, 0xFF000000);
|
drawGradientRect(0, 1, 1, embedHeight2 - 1, 0xFF000000, 0xFF000000);
|
||||||
drawGradientRect(embedWidth2 - 1, 1, embedWidth2, embedHeight2 - 1, 0xFF000000, 0xFF000000);
|
drawGradientRect(embedWidth2 - 1, 1, embedWidth2, embedHeight2 - 1, 0xFF000000, 0xFF000000);
|
||||||
|
|
||||||
mc.getTextureManager().bindTexture(eaglerIcons);
|
mc.getTextureManager().bindTexture(eaglerIcons);
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
GlStateManager.scale(0.3f, 0.3f, 0.3f);
|
GlStateManager.scale(0.3f, 0.3f, 0.3f);
|
||||||
|
@ -131,34 +142,37 @@ public class GuiUpdateCheckerOverlay extends Gui {
|
||||||
drawTexturedModalRect(25, 25, 156, 0, 100, 100);
|
drawTexturedModalRect(25, 25, 156, 0, 100, 100);
|
||||||
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
EaglercraftGPU.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
mc.fontRendererObj.drawString(EnumChatFormatting.UNDERLINE + cert.bundleDisplayName, 45, 11, 0x000000);
|
mc.fontRendererObj.drawString(EnumChatFormatting.UNDERLINE + cert.bundleDisplayName, 45, 11, 0x000000);
|
||||||
mc.fontRendererObj.drawString(I18n.format("update.update") + " " + EnumChatFormatting.DARK_RED + cert.bundleDisplayVersion, 45, 25, 0x000000);
|
mc.fontRendererObj.drawString(
|
||||||
|
I18n.format("update.update") + " " + EnumChatFormatting.DARK_RED + cert.bundleDisplayVersion,
|
||||||
if(lst != null) {
|
45, 25, 0x000000);
|
||||||
for(int j = 0, l = lst.size(); j < l; ++j) {
|
|
||||||
|
if (lst != null) {
|
||||||
|
for (int j = 0, l = lst.size(); j < l; ++j) {
|
||||||
mc.fontRendererObj.drawString(lst.get(j), 5, 42 + j * 8, 0x000000);
|
mc.fontRendererObj.drawString(lst.get(j), 5, 42 + j * 8, 0x000000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mc.fontRendererObj.drawString(I18n.format("update.author") + " " + cert.bundleAuthorName, 5, 44 + (lst == null ? 0 : (3 + lst.size() * 8)), 0x777777);
|
mc.fontRendererObj.drawString(I18n.format("update.author") + " " + cert.bundleAuthorName, 5,
|
||||||
|
44 + (lst == null ? 0 : (3 + lst.size() * 8)), 0x777777);
|
||||||
|
|
||||||
startDownloadButton.yPosition = embedHeight + embedY + 5;
|
startDownloadButton.yPosition = embedHeight + embedY + 5;
|
||||||
viewAllUpdatesButton.yPosition = startDownloadButton.yPosition + 22;
|
viewAllUpdatesButton.yPosition = startDownloadButton.yPosition + 22;
|
||||||
dismissUpdatesButton.yPosition = viewAllUpdatesButton.yPosition + 22;
|
dismissUpdatesButton.yPosition = viewAllUpdatesButton.yPosition + 22;
|
||||||
totalHeightOffset = dismissUpdatesButton.yPosition + 20;
|
totalHeightOffset = dismissUpdatesButton.yPosition + 20;
|
||||||
|
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
}else if(isIngame) {
|
} else if (isIngame) {
|
||||||
if(shownSP) {
|
if (shownSP) {
|
||||||
str = I18n.format("update.noneNew");
|
str = I18n.format("update.noneNew");
|
||||||
mc.fontRendererObj.drawString(str, 3, 22, 0xDDDDDD);
|
mc.fontRendererObj.drawString(str, 3, 22, 0xDDDDDD);
|
||||||
if(i > 0) {
|
if (i > 0) {
|
||||||
viewAllUpdatesButton.yPosition = 40;
|
viewAllUpdatesButton.yPosition = 40;
|
||||||
viewAllUpdatesButton.visible = true;
|
viewAllUpdatesButton.visible = true;
|
||||||
viewAllUpdatesButton.displayString = I18n.format("update.viewAll", i);
|
viewAllUpdatesButton.displayString = I18n.format("update.viewAll", i);
|
||||||
totalHeightOffset = 60;
|
totalHeightOffset = 60;
|
||||||
}else {
|
} else {
|
||||||
totalHeightOffset = 32;
|
totalHeightOffset = 32;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -172,7 +186,7 @@ public class GuiUpdateCheckerOverlay extends Gui {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawScreenBusy(int mx, int my, float partialTicks, UpdateProgressStruct progressState) {
|
public void drawScreenBusy(int mx, int my, float partialTicks, UpdateProgressStruct progressState) {
|
||||||
if(!UpdateService.supported()) {
|
if (!UpdateService.supported()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
checkForUpdatesButton.visible = false;
|
checkForUpdatesButton.visible = false;
|
||||||
|
@ -185,12 +199,12 @@ public class GuiUpdateCheckerOverlay extends Gui {
|
||||||
mc.fontRendererObj.drawStringWithShadow(str, 2, 2, 0xFFFFAA);
|
mc.fontRendererObj.drawStringWithShadow(str, 2, 2, 0xFFFFAA);
|
||||||
GlStateManager.translate(0.0f, 14.0f, 0.0f);
|
GlStateManager.translate(0.0f, 14.0f, 0.0f);
|
||||||
GlStateManager.scale(0.75f, 0.75f, 0.75f);
|
GlStateManager.scale(0.75f, 0.75f, 0.75f);
|
||||||
if(!StringUtils.isAllBlank(progressState.statusString1)) {
|
if (!StringUtils.isAllBlank(progressState.statusString1)) {
|
||||||
str = progressState.statusString1;
|
str = progressState.statusString1;
|
||||||
mc.fontRendererObj.drawStringWithShadow(str, 3, 0, 0xFFFFFF);
|
mc.fontRendererObj.drawStringWithShadow(str, 3, 0, 0xFFFFFF);
|
||||||
}
|
}
|
||||||
int cc = isIngame ? 0xBBBBBB : 0xFFFFFF;
|
int cc = isIngame ? 0xBBBBBB : 0xFFFFFF;
|
||||||
if(!StringUtils.isAllBlank(progressState.statusString2)) {
|
if (!StringUtils.isAllBlank(progressState.statusString2)) {
|
||||||
str = progressState.statusString2;
|
str = progressState.statusString2;
|
||||||
mc.fontRendererObj.drawStringWithShadow(str, 3, 11, cc);
|
mc.fontRendererObj.drawStringWithShadow(str, 3, 11, cc);
|
||||||
}
|
}
|
||||||
|
@ -199,56 +213,58 @@ public class GuiUpdateCheckerOverlay extends Gui {
|
||||||
int progX2 = 135;
|
int progX2 = 135;
|
||||||
int progY2 = 32;
|
int progY2 = 32;
|
||||||
float prog = progressState.progressBar;
|
float prog = progressState.progressBar;
|
||||||
if(prog >= 0.0f) {
|
if (prog >= 0.0f) {
|
||||||
int bk = 0xFFBBBBBB;
|
int bk = 0xFFBBBBBB;
|
||||||
int fg = 0xFFDD0000;
|
int fg = 0xFFDD0000;
|
||||||
drawGradientRect(progX1 + 1, progY1 + 1, progX1 + (int)((progX2 - progX1 - 1) * prog), progY2 - 1, fg, fg);
|
drawGradientRect(progX1 + 1, progY1 + 1, progX1 + (int) ((progX2 - progX1 - 1) * prog), progY2 - 1, fg, fg);
|
||||||
drawGradientRect(progX1 + (int)((progX2 - progX1 - 1) * prog), progY1 + 1, progX2 - 1, progY2 - 1, bk, bk);
|
drawGradientRect(progX1 + (int) ((progX2 - progX1 - 1) * prog), progY1 + 1, progX2 - 1, progY2 - 1, bk, bk);
|
||||||
drawGradientRect(progX1, progY1, progX2, progY1 + 1, 0xFF000000, 0xFF000000);
|
drawGradientRect(progX1, progY1, progX2, progY1 + 1, 0xFF000000, 0xFF000000);
|
||||||
drawGradientRect(progX1, progY2 - 1, progX2, progY2, 0xFF000000, 0xFF000000);
|
drawGradientRect(progX1, progY2 - 1, progX2, progY2, 0xFF000000, 0xFF000000);
|
||||||
drawGradientRect(progX1, progY1 + 1, progX1 + 1, progY2 - 1, 0xFF000000, 0xFF000000);
|
drawGradientRect(progX1, progY1 + 1, progX1 + 1, progY2 - 1, 0xFF000000, 0xFF000000);
|
||||||
drawGradientRect(progX2 - 1, progY1 + 1, progX2, progY2 - 1, 0xFF000000, 0xFF000000);
|
drawGradientRect(progX2 - 1, progY1 + 1, progX2, progY2 - 1, 0xFF000000, 0xFF000000);
|
||||||
}
|
}
|
||||||
totalHeightOffset = 32;
|
totalHeightOffset = 32;
|
||||||
if(!StringUtils.isAllBlank(progressState.statusString3)) {
|
if (!StringUtils.isAllBlank(progressState.statusString3)) {
|
||||||
GlStateManager.translate(0.0f, progY2 + 2, 0.0f);
|
GlStateManager.translate(0.0f, progY2 + 2, 0.0f);
|
||||||
GlStateManager.scale(0.66f, 0.66f, 0.66f);
|
GlStateManager.scale(0.66f, 0.66f, 0.66f);
|
||||||
str = progressState.statusString3;
|
str = progressState.statusString3;
|
||||||
List<String> wrappedURL = mc.fontRendererObj.listFormattedStringToWidth(str, (int)((progX2 - progX1) * 1.5f));
|
List<String> wrappedURL = mc.fontRendererObj.listFormattedStringToWidth(str,
|
||||||
for(int i = 0, l = wrappedURL.size(); i < l; ++i) {
|
(int) ((progX2 - progX1) * 1.5f));
|
||||||
|
for (int i = 0, l = wrappedURL.size(); i < l; ++i) {
|
||||||
str = wrappedURL.get(i);
|
str = wrappedURL.get(i);
|
||||||
mc.fontRendererObj.drawStringWithShadow(str, 5, i * 11, cc);
|
mc.fontRendererObj.drawStringWithShadow(str, 5, i * 11, cc);
|
||||||
}
|
}
|
||||||
totalHeightOffset += (int)(wrappedURL.size() * 5.5f);
|
totalHeightOffset += (int) (wrappedURL.size() * 5.5f);
|
||||||
}
|
}
|
||||||
GlStateManager.popMatrix();
|
GlStateManager.popMatrix();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseClicked(int mx, int my, int btn) {
|
public void mouseClicked(int mx, int my, int btn) {
|
||||||
if(!UpdateService.supported()) {
|
if (!UpdateService.supported()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (btn == 0) {
|
if (btn == 0) {
|
||||||
if(checkForUpdatesButton.mousePressed(mc, mx, my)) {
|
if (checkForUpdatesButton.mousePressed(mc, mx, my)) {
|
||||||
mc.gameSettings.enableUpdateSvc = !mc.gameSettings.enableUpdateSvc;
|
mc.gameSettings.enableUpdateSvc = !mc.gameSettings.enableUpdateSvc;
|
||||||
mc.gameSettings.saveOptions();
|
mc.gameSettings.saveOptions();
|
||||||
checkForUpdatesButton.displayString = I18n.format("update.button") + " " + I18n.format(mc.gameSettings.enableUpdateSvc ? "gui.yes" : "gui.no");
|
checkForUpdatesButton.displayString = I18n.format("update.button") + " "
|
||||||
|
+ I18n.format(mc.gameSettings.enableUpdateSvc ? "gui.yes" : "gui.no");
|
||||||
}
|
}
|
||||||
if(startDownloadButton.mousePressed(mc, mx, my)) {
|
if (startDownloadButton.mousePressed(mc, mx, my)) {
|
||||||
if(!UpdateService.getUpdatingStatus().isBusy) {
|
if (!UpdateService.getUpdatingStatus().isBusy) {
|
||||||
UpdateCertificate cert = UpdateService.getLatestUpdateFound();
|
UpdateCertificate cert = UpdateService.getLatestUpdateFound();
|
||||||
if(cert != null) {
|
if (cert != null) {
|
||||||
UpdateService.startClientUpdateFrom(cert);
|
UpdateService.startClientUpdateFrom(cert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(viewAllUpdatesButton.mousePressed(mc, mx, my)) {
|
if (viewAllUpdatesButton.mousePressed(mc, mx, my)) {
|
||||||
mc.displayGuiScreen(new GuiUpdateVersionList(backScreen));
|
mc.displayGuiScreen(new GuiUpdateVersionList(backScreen));
|
||||||
}
|
}
|
||||||
if(dismissUpdatesButton.mousePressed(mc, mx, my)) {
|
if (dismissUpdatesButton.mousePressed(mc, mx, my)) {
|
||||||
UpdateCertificate cert = UpdateService.getLatestUpdateFound();
|
UpdateCertificate cert = UpdateService.getLatestUpdateFound();
|
||||||
if(cert != null) {
|
if (cert != null) {
|
||||||
UpdateService.dismiss(cert);
|
UpdateService.dismiss(cert);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,7 @@ public class UpdateService {
|
||||||
}
|
}
|
||||||
byte[] latestUpdate = PlatformApplication.getLocalStorage(EaglercraftVersion.updateLatestLocalStorageKey,
|
byte[] latestUpdate = PlatformApplication.getLocalStorage(EaglercraftVersion.updateLatestLocalStorageKey,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
if (latestUpdate != null) {
|
if (latestUpdate != null) {
|
||||||
addCertificateToSet(latestUpdate, false);
|
addCertificateToSet(latestUpdate, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,8 +56,13 @@ public abstract class AbstractResourcePack implements IResourcePack {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String locationToName(ResourceLocation location) {
|
private static String locationToName(ResourceLocation location) {
|
||||||
return HString.format("%s/%s/%s",
|
String namespace = location.getResourceDomain();
|
||||||
new Object[] { "assets", location.getResourceDomain(), location.getResourcePath() });
|
String path = location.getResourcePath();
|
||||||
|
// uses a StringBuilder internally
|
||||||
|
return "assets/" +
|
||||||
|
namespace +
|
||||||
|
'/' +
|
||||||
|
path;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputStream getInputStream(ResourceLocation location) throws IOException {
|
public InputStream getInputStream(ResourceLocation location) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue