(feature) new pack badge
This commit is contained in:
parent
829d192992
commit
7a0903cef8
|
@ -374,6 +374,17 @@ public class Client {
|
||||||
Client.logger.info("STARTING > config-manager-post-init");
|
Client.logger.info("STARTING > config-manager-post-init");
|
||||||
configManager.postInit();
|
configManager.postInit();
|
||||||
|
|
||||||
|
if(!globalSettings.isResourcePacksFetched()) {
|
||||||
|
Client.logger.info("STARTING > resource-packs-fetching");
|
||||||
|
if(Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks() != null && Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks().listFiles() != null) {
|
||||||
|
for (File file : Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks().listFiles()) {
|
||||||
|
globalSettings.addToUsedResourcePacks(file.getName());
|
||||||
|
}
|
||||||
|
globalSettings.setResourcePacksFetched(true);
|
||||||
|
globalSettings.save();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(!globalSettings.isDisplayedTutorial()) {
|
if(!globalSettings.isDisplayedTutorial()) {
|
||||||
Minecraft.getMinecraft().displayGuiScreen(new UserTutorial());
|
Minecraft.getMinecraft().displayGuiScreen(new UserTutorial());
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,6 +26,7 @@ import java.awt.*;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
@ -170,6 +171,12 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||||
{
|
{
|
||||||
this.mc.fontRendererObj.drawStringWithShadow(list.get(l), x + 5 + 31 + 3, itemY + 3 + 12 + 10 * l, 8421504);
|
this.mc.fontRendererObj.drawStringWithShadow(list.get(l), x + 5 + 31 + 3, itemY + 3 + 12 + 10 * l, 8421504);
|
||||||
}
|
}
|
||||||
|
if(!Client.getInstance().getGlobalSettings().getUsedResourcePacks().contains(entry.getResourcePackName())) {
|
||||||
|
RenderUtil.drawRoundedRect(x + 187 - 23, itemY + 35 - 12, 23, 10, 8, new Color(255, 255, 255).getRGB());
|
||||||
|
ColorUtils.setColor(new Color(0, 0, 0).getRGB());
|
||||||
|
Client.getInstance().getSilentFontRenderer().drawCenteredString("NEW", (int) x + 187 - 23 + (23 / 2), (int) (itemY + 35 - 12 + 10 - 9), 8, SilentFontRenderer.FontType.HEADER);
|
||||||
|
ColorUtils.resetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
itemY += 37;
|
itemY += 37;
|
||||||
}
|
}
|
||||||
|
@ -256,6 +263,12 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||||
{
|
{
|
||||||
this.mc.fontRendererObj.drawStringWithShadow(list.get(l), x + 5 + 31 + 3, itemY + 3 + 12 + 10 * l, 8421504);
|
this.mc.fontRendererObj.drawStringWithShadow(list.get(l), x + 5 + 31 + 3, itemY + 3 + 12 + 10 * l, 8421504);
|
||||||
}
|
}
|
||||||
|
if(!Client.getInstance().getGlobalSettings().getUsedResourcePacks().contains(entry.getResourcePackName())) {
|
||||||
|
RenderUtil.drawRoundedRect(x + 187 - 23, itemY + 35 - 12, 23, 10, 8, new Color(255, 255, 255).getRGB());
|
||||||
|
ColorUtils.setColor(new Color(0, 0, 0).getRGB());
|
||||||
|
Client.getInstance().getSilentFontRenderer().drawCenteredString("NEW", (int) x + 187 - 23 + (23 / 2), (int) (itemY + 35 - 12 + 10 - 9), 8, SilentFontRenderer.FontType.HEADER);
|
||||||
|
ColorUtils.resetColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
itemY += 37;
|
itemY += 37;
|
||||||
packIndex++;
|
packIndex++;
|
||||||
|
@ -329,7 +342,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||||
for (ResourcePackRepository.Entry resourcepackrepository$entry : list)
|
for (ResourcePackRepository.Entry resourcepackrepository$entry : list)
|
||||||
{
|
{
|
||||||
this.mc.gameSettings.resourcePacks.add(resourcepackrepository$entry.getResourcePackName());
|
this.mc.gameSettings.resourcePacks.add(resourcepackrepository$entry.getResourcePackName());
|
||||||
|
Client.getInstance().getGlobalSettings().addToUsedResourcePacks(resourcepackrepository$entry.getResourcePackName());
|
||||||
if (resourcepackrepository$entry.func_183027_f() != 1)
|
if (resourcepackrepository$entry.func_183027_f() != 1)
|
||||||
{
|
{
|
||||||
this.mc.gameSettings.incompatibleResourcePacks.add(resourcepackrepository$entry.getResourcePackName());
|
this.mc.gameSettings.incompatibleResourcePacks.add(resourcepackrepository$entry.getResourcePackName());
|
||||||
|
@ -341,6 +354,7 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||||
this.initGui();
|
this.initGui();
|
||||||
this.scrollHelper2.resetScroll();
|
this.scrollHelper2.resetScroll();
|
||||||
this.scrollHelper.resetScroll();
|
this.scrollHelper.resetScroll();
|
||||||
|
Client.getInstance().getGlobalSettings().save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -428,7 +442,19 @@ public class SilentResourcePacksGui extends SilentScreen {
|
||||||
this.selectedResourcePacks.clear();
|
this.selectedResourcePacks.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourcePackRepository.Entry randomPack = this.availableResourcePacks.get(random.nextInt(this.availableResourcePacks.size()));
|
ArrayList<ResourcePackRepository.Entry> newPacks = new ArrayList<>();
|
||||||
|
for(ResourcePackRepository.Entry entry : this.availableResourcePacks) {
|
||||||
|
if(!Client.getInstance().getGlobalSettings().getUsedResourcePacks().contains(entry.getResourcePackName())) {
|
||||||
|
newPacks.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ResourcePackRepository.Entry randomPack;
|
||||||
|
|
||||||
|
if(!newPacks.isEmpty()) {
|
||||||
|
randomPack = newPacks.get(random.nextInt(newPacks.size()));
|
||||||
|
} else {
|
||||||
|
randomPack = this.availableResourcePacks.get(random.nextInt(this.availableResourcePacks.size()));
|
||||||
|
}
|
||||||
|
|
||||||
if(randomPack != null) {
|
if(randomPack != null) {
|
||||||
this.selectedResourcePacks.add(0, randomPack);
|
this.selectedResourcePacks.add(0, randomPack);
|
||||||
|
|
|
@ -67,8 +67,8 @@ public class RawInputHandler {
|
||||||
if (Thread.currentThread().isInterrupted()) {
|
if (Thread.currentThread().isInterrupted()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
reload();
|
// reload();
|
||||||
rescan();
|
// rescan();
|
||||||
if (mouse != null && Minecraft.getMinecraft().currentScreen == null) {
|
if (mouse != null && Minecraft.getMinecraft().currentScreen == null) {
|
||||||
mouse.poll();
|
mouse.poll();
|
||||||
dx += (int)mouse.getX().getPollData();
|
dx += (int)mouse.getX().getPollData();
|
||||||
|
|
|
@ -15,6 +15,8 @@ public class GlobalSettings {
|
||||||
public boolean packsPanoramaEnabled;
|
public boolean packsPanoramaEnabled;
|
||||||
public ArrayList<FeaturedServers.FeaturedServerInfo> savedFeaturedServers;
|
public ArrayList<FeaturedServers.FeaturedServerInfo> savedFeaturedServers;
|
||||||
public ArrayList<GlobalSettings.CustomColor> latestColors;
|
public ArrayList<GlobalSettings.CustomColor> latestColors;
|
||||||
|
public boolean resourcePacksFetched;
|
||||||
|
public ArrayList<String> usedResourcePacks;
|
||||||
|
|
||||||
|
|
||||||
public GlobalSettings() {
|
public GlobalSettings() {
|
||||||
|
@ -24,6 +26,8 @@ public class GlobalSettings {
|
||||||
this.packsPanoramaEnabled = true;
|
this.packsPanoramaEnabled = true;
|
||||||
this.savedFeaturedServers = new ArrayList<>();
|
this.savedFeaturedServers = new ArrayList<>();
|
||||||
this.latestColors = new ArrayList<>();
|
this.latestColors = new ArrayList<>();
|
||||||
|
this.resourcePacksFetched = false;
|
||||||
|
this.usedResourcePacks = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getConfig() {
|
public String getConfig() {
|
||||||
|
@ -107,6 +111,27 @@ public class GlobalSettings {
|
||||||
latestColors.add(0, new CustomColor(color));
|
latestColors.add(0, new CustomColor(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isResourcePacksFetched() {
|
||||||
|
return resourcePacksFetched;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setResourcePacksFetched(boolean resourcePacksFetched) {
|
||||||
|
this.resourcePacksFetched = resourcePacksFetched;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<String> getUsedResourcePacks() {
|
||||||
|
if(usedResourcePacks == null) {
|
||||||
|
this.usedResourcePacks = new ArrayList<>();
|
||||||
|
}
|
||||||
|
return usedResourcePacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addToUsedResourcePacks(String pack) {
|
||||||
|
if(!this.usedResourcePacks.contains(pack)) {
|
||||||
|
this.usedResourcePacks.add(pack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void save() {
|
public void save() {
|
||||||
try {
|
try {
|
||||||
FileOutputStream outputStream = new FileOutputStream(Client.getInstance().getGlobalSettingsFile());
|
FileOutputStream outputStream = new FileOutputStream(Client.getInstance().getGlobalSettingsFile());
|
||||||
|
|
Loading…
Reference in New Issue