Merge pull request #12 from Silent-Client/TEST2

Fixes for Premium Cosmetics
This commit is contained in:
kirillsaint 2023-08-01 22:33:18 +06:00 committed by GitHub
commit 02d3704c3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 20 deletions

View File

@ -292,15 +292,6 @@ public class Client {
mod.setEnabled(!mod.isEnabled()); mod.setEnabled(!mod.isEnabled());
}); });
if(!Client.getInstance().getAccount().getClaimedPremiumCosmetics()) {
Client.logger.info("STARTING > premium-cosmetics");
PremiumCosmeticsResponse premiumCosmetics = PremiumUtils.getPremiumCosmetics();
if(premiumCosmetics != null) {
Minecraft.getMinecraft().displayGuiScreen(new PremiumCosmeticsGui(premiumCosmetics));
}
}
Client.logger.info("STARTING > launching-detector"); Client.logger.info("STARTING > launching-detector");
Requests.post("https://api.silentclient.net/_next/launch_v2", new JSONObject().put("branch", getBuildData().getBranch()).toString()); Requests.post("https://api.silentclient.net/_next/launch_v2", new JSONObject().put("branch", getBuildData().getBranch()).toString());
@ -325,6 +316,15 @@ public class Client {
Minecraft.getMinecraft().displayGuiScreen(new MainMenuConcept()); Minecraft.getMinecraft().displayGuiScreen(new MainMenuConcept());
} }
if(!Client.getInstance().getAccount().getClaimedPremiumCosmetics()) {
Client.logger.info("STARTING > premium-cosmetics");
PremiumCosmeticsResponse premiumCosmetics = PremiumUtils.getPremiumCosmetics();
if(premiumCosmetics != null) {
Minecraft.getMinecraft().displayGuiScreen(new PremiumCosmeticsGui(premiumCosmetics));
}
}
if(!globalSettings.displayedTutorial) { if(!globalSettings.displayedTutorial) {
Minecraft.getMinecraft().displayGuiScreen(new UserTutorial()); Minecraft.getMinecraft().displayGuiScreen(new UserTutorial());
} }

View File

@ -18,10 +18,8 @@ import net.minecraft.util.ResourceLocation;
import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldSettings;
import net.silentclient.client.Client; import net.silentclient.client.Client;
import net.silentclient.client.event.impl.*; import net.silentclient.client.event.impl.*;
import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.lite.LiteMainMenu; import net.silentclient.client.gui.lite.LiteMainMenu;
import net.silentclient.client.gui.silentmainmenu.MainMenuConcept; import net.silentclient.client.gui.silentmainmenu.MainMenuConcept;
import net.silentclient.client.gui.silentmainmenu.SilentMainMenu;
import net.silentclient.client.gui.util.BackgroundPanorama; import net.silentclient.client.gui.util.BackgroundPanorama;
import net.silentclient.client.hooks.MinecraftHook; import net.silentclient.client.hooks.MinecraftHook;
import net.silentclient.client.mods.player.ZoomMod; import net.silentclient.client.mods.player.ZoomMod;
@ -38,7 +36,9 @@ import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.io.File; import java.io.File;
@ -62,9 +62,9 @@ public abstract class MinecraftMixin {
if(Client.backgroundPanorama == null) { if(Client.backgroundPanorama == null) {
Client.backgroundPanorama = new BackgroundPanorama(Minecraft.getMinecraft()); Client.backgroundPanorama = new BackgroundPanorama(Minecraft.getMinecraft());
} }
if(Client.getInstance().getGlobalSettings() != null) { // if(Client.getInstance().getGlobalSettings() != null) {
displayGuiScreen(Client.getInstance().getGlobalSettings().isLite() ? new GuiNews() : new MainMenuConcept()); // displayGuiScreen(Client.getInstance().getGlobalSettings().isLite() ? new GuiNews() : new MainMenuConcept());
} // }
} }
@Inject(method = "shutdownMinecraftApplet", at = @At("HEAD")) @Inject(method = "shutdownMinecraftApplet", at = @At("HEAD"))

View File

@ -1,8 +1,5 @@
package net.silentclient.client.premium; package net.silentclient.client.premium;
import java.io.IOException;
import java.time.LocalDate;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
@ -10,12 +7,16 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client; import net.silentclient.client.Client;
import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.font.SilentFontRenderer.FontType; import net.silentclient.client.gui.font.SilentFontRenderer.FontType;
import net.silentclient.client.gui.lite.GuiNews;
import net.silentclient.client.gui.silentmainmenu.MainMenuConcept;
import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.utils.types.PremiumCosmeticsResponse; import net.silentclient.client.utils.types.PremiumCosmeticsResponse;
import java.io.IOException;
import java.time.LocalDate;
public class PremiumCosmeticsGui extends GuiScreen { public class PremiumCosmeticsGui extends GuiScreen {
private final PremiumCosmeticsResponse response; private final PremiumCosmeticsResponse response;
@ -104,7 +105,7 @@ public class PremiumCosmeticsGui extends GuiScreen {
super.actionPerformed(button); super.actionPerformed(button);
if(button.id == 1) { if(button.id == 1) {
Client.getInstance().getAccount().claimPremiumCosmetics(); Client.getInstance().getAccount().claimPremiumCosmetics();
mc.displayGuiScreen(new GuiNews()); mc.displayGuiScreen(Client.getInstance().getGlobalSettings().isLite() ? new GuiNews() : new MainMenuConcept());
} }
} }