Merge pull request #47 from Silent-Client/TEST2

Test2
This commit is contained in:
kirillsaint 2023-09-30 16:22:17 +06:00 committed by GitHub
commit 5c27fd962a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 165 additions and 160 deletions

View File

@ -5,6 +5,7 @@ import com.google.gson.GsonBuilder;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.resources.data.IMetadataSerializer;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.config.ConfigManager;
@ -91,6 +92,7 @@ public class Client {
private GlobalSettings globalSettings;
private File globalSettingsFile;
private AccountManager accountManager;
public ServerData lastServerData;
public static void memoryDebug(String paramString) {
LogManager.getLogger().info("-- Start Memory Debug -- " + paramString);
@ -266,10 +268,10 @@ public class Client {
}
});
logger.info("STARTING > servers");
FeaturedServersResponse servers = FeaturedServers.get();
ArrayList<FeaturedServers.FeaturedServerInfo> servers = FeaturedServers.get();
featuredServers.clear();
if(servers != null && servers.getServers() != null) {
servers.getServers().forEach(server -> {
if(servers != null && servers != null) {
servers.forEach(server -> {
featuredServers.add(new ServerDataFeature(server.getName(), server.getIp()));
});
}
@ -500,8 +502,9 @@ public class Client {
playersCount = 0;
nextPing = 10;
this.updateUserInformation();
Client.logger.info("Update Connection Server: " + event.getIp());
silentSocket.getSocket().emit("update_information", event.getIp());
Client.logger.info("Update Connection Server: " + event.getServerData().serverIP);
silentSocket.getSocket().emit("update_information", event.getServerData().serverIP);
lastServerData = event.getServerData();
}
@EventTarget

View File

@ -1,16 +1,17 @@
package net.silentclient.client.event.impl;
import net.minecraft.client.multiplayer.ServerData;
import net.silentclient.client.event.Event;
public class ConnectToServerEvent extends Event {
private final String ip;
private final ServerData serverData;
public ConnectToServerEvent(String ip) {
this.ip = ip;
public ConnectToServerEvent(ServerData serverData) {
this.serverData = serverData;
}
public String getIp() {
return ip;
public ServerData getServerData() {
return serverData;
}
}

View File

@ -46,4 +46,8 @@ public class SilentScreen extends GuiScreen {
super.onGuiClosed();
Client.getInstance().getMouseCursorHandler().disableCursor();
}
public int getFpsLimit() {
return 120;
}
}

View File

@ -45,7 +45,7 @@ public class HUDConfigScreen extends GuiScreen {
this.mod = null;
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
this.buttonList.add(new IconButton(0, scaledresolution.getScaledWidth() / 2 - 10, scaledresolution.getScaledHeight() - 80, 30, 30, 22, 22, new ResourceLocation("silentclient/icons/back.png")));
this.buttonList.add(new IconButton(0, scaledresolution.getScaledWidth() / 2 - 15, scaledresolution.getScaledHeight() - 80, 30, 30, 18, 18, new ResourceLocation("silentclient/icons/back.png")));
this.font = new CustomFontRenderer();
font.setRenderMode(RenderMode.CUSTOM);

View File

@ -87,7 +87,7 @@ public class GuiConnecting extends SilentScreen
GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN));
GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
new ConnectToServerEvent(serverData.serverIP).call();
new ConnectToServerEvent(serverData).call();
}
catch (UnknownHostException unknownhostexception)
{
@ -153,7 +153,7 @@ public class GuiConnecting extends SilentScreen
GuiConnecting.this.networkManager.setNetHandler(new NetHandlerLoginClient(GuiConnecting.this.networkManager, GuiConnecting.this.mc, GuiConnecting.this.previousGuiScreen));
GuiConnecting.this.networkManager.sendPacket(new C00Handshake(47, ip, port, EnumConnectionState.LOGIN));
GuiConnecting.this.networkManager.sendPacket(new C00PacketLoginStart(GuiConnecting.this.mc.getSession().getProfile()));
new ConnectToServerEvent(ip).call();
new ConnectToServerEvent(new ServerData("Minecraft Server", ip, false)).call();
}
catch (UnknownHostException unknownhostexception)
{

View File

@ -9,6 +9,7 @@ import net.minecraft.client.multiplayer.ServerList;
import net.minecraft.client.network.OldServerPinger;
import net.minecraft.client.renderer.GlStateManager;
import net.silentclient.client.Client;
import net.silentclient.client.ServerDataFeature;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.elements.Button;
@ -64,13 +65,7 @@ public class SilentMultiplayerGui extends SilentScreen {
this.savedServerList = new ServerList(this.mc);
this.savedServerList.loadServerList();
servers.clear();
for (int i = 0; i < savedServerList.countServers(); ++i)
{
ServerData serverData = savedServerList.getServerData(i);
servers.add(new ServerComponent(this, serverData));
}
this.getServers();
}
this.silentInputs.clear();
@ -93,6 +88,19 @@ public class SilentMultiplayerGui extends SilentScreen {
this.selectServer(-1);
}
public void getServers() {
servers.clear();
for(ServerDataFeature serverDataFeature : Client.getInstance().getFeaturedServers()) {
servers.add(new ServerComponent(this, serverDataFeature));
}
for (int i = 0; i < savedServerList.countServers(); ++i)
{
ServerData serverData = savedServerList.getServerData(i);
servers.add(new ServerComponent(this, serverData));
}
}
public void selectServer(int index)
{
this.selectedServer = index;
@ -105,8 +113,10 @@ public class SilentMultiplayerGui extends SilentScreen {
if(serverComponent != null) {
this.btnSelectServer.enabled = true;
this.btnEditServer.enabled = true;
this.btnDeleteServer.enabled = true;
if(!(serverComponent.getServer() instanceof ServerDataFeature)) {
this.btnEditServer.enabled = true;
this.btnDeleteServer.enabled = true;
}
} else {
Client.logger.info("Server " + index + " not found!");
}
@ -158,9 +168,9 @@ public class SilentMultiplayerGui extends SilentScreen {
}
public void connectToSelected() {
ServerData server = savedServerList.getServerData(selectedServer);
ServerComponent server = servers.get(selectedServer);
if(server != null) {
this.connect(new ServerData(server.serverName, server.serverIP, false));
this.connect(new ServerData(server.getServer().serverName, server.getServer().serverIP, false));
}
}
@ -174,16 +184,17 @@ public class SilentMultiplayerGui extends SilentScreen {
public boolean canUpSwap(int index)
{
return index > 0;
return index > Client.getInstance().getFeaturedServers().size();
}
public boolean canDownSwap(int index)
{
return index < this.savedServerList.countServers() - 1;
return (index - Client.getInstance().getFeaturedServers().size()) < this.savedServerList.countServers() - 1;
}
public void swapUp(int index, boolean fullSwap)
{
index = index - (Client.getInstance().getFeaturedServers().size());
int i = fullSwap ? 0 : index - 1;
this.savedServerList.swapServers(index, i);
@ -192,17 +203,12 @@ public class SilentMultiplayerGui extends SilentScreen {
this.selectServer(i);
}
servers.clear();
for (int i1 = 0; i1 < savedServerList.countServers(); ++i1)
{
ServerData serverData = savedServerList.getServerData(i1);
servers.add(new ServerComponent(this, serverData));
}
getServers();
}
public void swapDown(int index, boolean fullSwap)
{
index = index - (Client.getInstance().getFeaturedServers().size());
int i = fullSwap ? this.savedServerList.countServers() - 1 : index + 1;
this.savedServerList.swapServers(index, i);
@ -211,13 +217,7 @@ public class SilentMultiplayerGui extends SilentScreen {
this.selectServer(i);
}
servers.clear();
for (int i1 = 0; i1 < savedServerList.countServers(); ++i1)
{
ServerData serverData = savedServerList.getServerData(i1);
servers.add(new ServerComponent(this, serverData));
}
getServers();
}
@Override
@ -273,6 +273,7 @@ public class SilentMultiplayerGui extends SilentScreen {
Client.logger.info("Saving server list...");
newServerList.saveServerList();
getServers();
}
@Override

View File

@ -16,6 +16,7 @@ import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.ServerDataFeature;
import net.silentclient.client.gui.elements.Tooltip;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.multiplayer.SilentMultiplayerGui;
@ -54,6 +55,7 @@ public class ServerComponent {
public MouseCursorHandler.CursorType draw(int serverIndex, int mouseX, int mouseY, float x, float y, boolean isSelected) {
MouseCursorHandler.CursorType cursorType = null;
boolean featured = this.server instanceof ServerDataFeature;
if (!this.server.field_78841_f)
{
this.server.field_78841_f = true;
@ -97,7 +99,7 @@ public class ServerComponent {
RenderUtil.drawImage(this.field_148305_h != null ? serverIcon : UNKNOWN_SERVER, x + 2, y + 2, 31, 31, false);
if(MouseUtils.isInside(mouseX, mouseY, x + 2, y + 2, 31, 31)) {
if(MouseUtils.isInside(mouseX, mouseY, x + 2, y + 2, 31, 31) && !featured) {
if(this.owner.canUpSwap(serverIndex)) {
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/page-up.png"), x + 2 + (31 / 2) - (15 / 2), y + 2, 15, 15, true, MouseUtils.isInside(mouseX, mouseY, x + 2 + (31 / 2) - (15 / 2), y + 2, 15, 15) ? new Color(255, 255, 255).getRGB() : Theme.borderColor().getRGB());
}
@ -120,7 +122,7 @@ public class ServerComponent {
boolean flag2 = flag || flag1;
String s2 = flag2 ? EnumChatFormatting.DARK_RED + this.server.gameVersion : this.server.populationInfo;
int j = this.mc.fontRendererObj.getStringWidth(s2);
this.mc.fontRendererObj.drawString(s2, (int) x + 240 - j - 15 - 2, (int) y + 3, -1);
this.mc.fontRendererObj.drawString(s2, (int) x + 240 - j - 15 - 2 - (featured ? 10 : 0), (int) y + 3, -1);
int k = 0;
String s = null;
int l;
@ -184,8 +186,13 @@ public class ServerComponent {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(Gui.icons);
Gui.drawModalRectWithCustomSizedTexture((int) x + 240 - 15, (int) y + 2, (float)(k * 10), (float)(176 + l * 8), 10, 8, 256.0F, 256.0F);
Tooltip.render(mouseX, mouseY, x + 240 - 15, y + 2, 10, 8, s1);
Gui.drawModalRectWithCustomSizedTexture((int) x + 240 - 15 - (featured ? 10 : 0), (int) y + 2, (float)(k * 10), (float)(176 + l * 8), 10, 8, 256.0F, 256.0F);
Tooltip.render(mouseX, mouseY, x + 240 - 15 - (featured ? 10 : 0), y + 2, 10, 8, s1);
if(this.server instanceof ServerDataFeature) {
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/star.png"), x + 240 - 13, y + 2, 8, 8);
Tooltip.render(mouseX, mouseY, x + 240 - 13, y + 2, 8, 8, "Featured Server");
}
return cursorType;
}
@ -193,7 +200,7 @@ public class ServerComponent {
public boolean mouseClicked(int serverIndex, int mouseX, int mouseY, float x, float y, boolean isSelected) {
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, x, y, 240, 35);
if(isHovered) {
if(MouseUtils.isInside(mouseX, mouseY, x + 2, y + 2, 31, 31)) {
if(MouseUtils.isInside(mouseX, mouseY, x + 2, y + 2, 31, 31) && !(this.server instanceof ServerDataFeature)) {
if(this.owner.canUpSwap(serverIndex) && MouseUtils.isInside(mouseX, mouseY, x + 2 + (31 / 2) - (15 / 2), y + 2, 15, 15)) {
Client.logger.info("Swapping server " + serverIndex + " to up");
this.owner.swapUp(serverIndex, GuiScreen.isShiftKeyDown());

View File

@ -1,17 +1,11 @@
package net.silentclient.client.mixin.mixins;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.ArmorStandRenderer;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.client.renderer.entity.RendererLivingEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.mods.render.NametagsMod;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

View File

@ -1,16 +1,27 @@
package net.silentclient.client.mixin.mixins;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.IChatComponent;
import net.silentclient.client.Client;
import net.silentclient.client.event.impl.ServerLeaveEvent;
import net.silentclient.client.gui.minecraft.GuiConnecting;
import net.silentclient.client.gui.multiplayer.SilentMultiplayerGui;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
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 java.util.List;
@Mixin(GuiDisconnected.class)
public class GuiDisconnectedMixin {
public class GuiDisconnectedMixin extends GuiScreen {
@Shadow private int field_175353_i;
@Inject(method = "<init>", at = @At("RETURN"))
private void init(GuiScreen screen,
String reasonLocalizationKey,
@ -18,4 +29,22 @@ public class GuiDisconnectedMixin {
CallbackInfo ci) {
new ServerLeaveEvent().call();
}
@Redirect(method = "initGui", at = @At(value = "INVOKE", target = "Ljava/util/List;add(Ljava/lang/Object;)Z"))
public <E> boolean addButtons(List instance, E e) {
if(Client.getInstance().lastServerData != null) {
instance.add(new GuiButton(1, this.width / 2 - 100, this.height / 2 + field_175353_i / 2 + this.fontRendererObj.FONT_HEIGHT, "Retry"));
}
instance.add(new GuiButton(0, this.width / 2 - 100, this.height / 2 + field_175353_i / 2 + this.fontRendererObj.FONT_HEIGHT + (Client.getInstance().lastServerData != null ? 23 : 0), I18n.format("gui.toMenu", new Object[0])));
return false;
}
@Inject(method = "actionPerformed", at = @At("HEAD"), cancellable = true)
public void reconnect(GuiButton button, CallbackInfo ci) {
if(button.id == 1 && Client.getInstance().lastServerData != null) {
this.mc.displayGuiScreen(new GuiConnecting(new SilentMultiplayerGui(Client.getInstance().getMainMenu()), this.mc, Client.getInstance().lastServerData));
ci.cancel();
}
}
}

View File

@ -14,9 +14,6 @@ import net.silentclient.client.mixin.accessors.MinecraftAccessor;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.awt.*;

View File

@ -266,7 +266,6 @@ public abstract class MinecraftMixin implements MinecraftExt {
at = @At(value = "INVOKE", target = "Ljava/lang/System;gc()V")
)
private void optimizedWorldSwapping() {
System.gc();
}
//#if MC==10809
@ -318,13 +317,13 @@ public abstract class MinecraftMixin implements MinecraftExt {
@Overwrite
public int getLimitFramerate()
{
if (this.theWorld == null && this.currentScreen != null) return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate;
if (this.theWorld == null && this.currentScreen != null) return this.currentScreen instanceof SilentScreen ? ((SilentScreen) this.currentScreen).getFpsLimit() : 30;
if(!Display.isActive()) {
return 60;
}
return this.theWorld == null && this.currentScreen != null ? 30 : this.gameSettings.limitFramerate;
return this.gameSettings.limitFramerate;
}
@Override

View File

@ -71,21 +71,27 @@ public class RendererLivingEntityMixin<T extends EntityLivingBase> {
event.call();
if(event.isCancelable()) {
ci.cancel();
return;
}
final float entityDistance = entity.getDistanceToEntity(Minecraft.getMinecraft().thePlayer);
if (EntityCulling.shouldPerformCulling) {
if (entity instanceof IMob && entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hostile Entity Render Distance").getValInt()) {
ci.cancel();
return;
} else if ((entity instanceof EntityAnimal || entity instanceof EntityAmbientCreature || entity instanceof EntityWaterMob) && entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Passive Entity Render Distance").getValInt()) {
ci.cancel();
return;
} else if (entity instanceof EntityPlayer && entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Player Render Distance").getValInt()) {
ci.cancel();
return;
} else if (entityDistance > Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Misc. Entity Render Distance").getValInt()) {
ci.cancel();
return;
}
}
if(Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hide Armor Stands").getValBoolean() && entity instanceof EntityArmorStand) {
if(entity instanceof EntityArmorStand && Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hide Armor Stands").getValBoolean()) {
((RendererLivingEntity<EntityArmorStand>) (Object) this).renderName((EntityArmorStand) entity, x, y, z);
ci.cancel();
}
}

View File

@ -1,26 +0,0 @@
package net.silentclient.client.mixin.optifine;
import net.silentclient.client.Client;
import net.silentclient.client.mixin.SilentClientTweaker;
import net.silentclient.client.mixin.accessors.optifine.ConfigAccessor;
import net.silentclient.client.mixin.accessors.optifine.CustomColorsAccessor;
public class OptiFineFontRendererHandler {
private static boolean caughtError = false;
public static int getTextColor(int index, int originalColor) {
if (caughtError) return originalColor;
try {
if (!SilentClientTweaker.hasOptifine) {
return originalColor;
}
if (ConfigAccessor.invokeIsCustomColors()) {
return CustomColorsAccessor.invokeGetTextColor(index, originalColor);
}
return originalColor;
} catch (Throwable t) {
caughtError = true;
Client.logger.error("Unable to get OptiFine's Custom Color", t);
return originalColor;
}
}
}

View File

@ -1,10 +1,10 @@
package net.silentclient.client.mods;
import java.awt.Color;
import net.silentclient.client.Client;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.hud.ScreenPosition;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import java.awt.*;
public class HudMod extends ModDraggable {
@ -21,6 +21,11 @@ public class HudMod extends ModDraggable {
@Override
public void setup() {
setupWithAfterValue();
this.addInputSetting("Text After Value", this, getDefautPostText(), true);
}
public void setupWithAfterValue() {
super.setup();
this.addBooleanSetting("Background", this, true);
this.addColorSetting("Background Color", this, new Color(0, 0, 0), 127);
@ -28,7 +33,6 @@ public class HudMod extends ModDraggable {
this.addBooleanSetting("Font Shadow", this, true);
this.addBooleanSetting("Brackets", this, false);
this.addBooleanSetting("Fancy Font", this, false);
this.addInputSetting("Text After Value", this, getDefautPostText(), true);
}
public String getText() {

View File

@ -32,10 +32,14 @@ public abstract class ModDraggable extends Mod implements IRenderer {
private HUDConfigScreen.CornerScalingType cornerScalingType;
public ModDraggable(String name, ModCategory category, String icon) {
super(name, category, icon);
public ModDraggable(String name, ModCategory category, String icon, boolean defaultEnabled) {
super(name, category, icon, defaultEnabled);
this.pos = ScreenPosition.fromRelativePosition(0, 0);
}
public ModDraggable(String name, ModCategory category, String icon) {
this(name, category, icon, false);
}
@Override
public void setup() {

View File

@ -1,13 +1,13 @@
package net.silentclient.client.mods.hud;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import net.silentclient.client.Client;
import net.silentclient.client.mods.HudMod;
import net.silentclient.client.mods.ModCategory;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
public class ClockMod extends HudMod {
public ClockMod() {
super("Clock", ModCategory.MODS, "silentclient/icons/mods/clock.png", false);
@ -15,7 +15,7 @@ public class ClockMod extends HudMod {
@Override
public void setup() {
super.setup();
super.setupWithAfterValue();
this.addBooleanSetting("24 Hour Format", this, false);
}

View File

@ -1,11 +1,6 @@
package net.silentclient.client.mods.hud;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.texture.DynamicTexture;
@ -18,6 +13,10 @@ import net.silentclient.client.mods.CustomFontRenderer;
import net.silentclient.client.mods.HudMod;
import net.silentclient.client.mods.ModCategory;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class PackDisplayMod extends HudMod {
private ResourceLocation defaultIcon;
@ -28,7 +27,7 @@ public class PackDisplayMod extends HudMod {
@Override
public void setup() {
super.setup();
super.setupWithAfterValue();
this.addBooleanSetting("Pack Icon", this, true);
ArrayList<String> options = new ArrayList<>();

View File

@ -1,20 +1,37 @@
package net.silentclient.client.utils;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.silentclient.client.utils.types.FeaturedServersResponse;
import java.lang.reflect.Type;
import java.util.ArrayList;
public class FeaturedServers {
public static FeaturedServersResponse get() {
public static ArrayList<FeaturedServerInfo> get() {
try {
String content = Requests.get("https://api.silentclient.net/_next/servers.json");
String content = Requests.get("https://assets.silentclient.net/client/servers.json");
GsonBuilder builder = new GsonBuilder();
Gson gson = builder.create();
FeaturedServersResponse response = gson.fromJson(content.toString(), FeaturedServersResponse.class);
Type listType = new TypeToken<ArrayList<FeaturedServerInfo>>(){}.getType();
ArrayList<FeaturedServerInfo> response = gson.fromJson(content.toString(), listType);
return response;
} catch (Exception e) {
return null;
}
}
public class FeaturedServerInfo {
public String name;
public String ip;
public String getName() {
return name;
}
public String getIp() {
return ip;
}
}
}

View File

@ -1,18 +1,5 @@
package net.silentclient.client.utils.culling;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import net.silentclient.client.mixin.accessors.RenderManagerAccessor;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL33;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.multiplayer.WorldClient;
@ -33,7 +20,15 @@ import net.silentclient.client.event.EventTarget;
import net.silentclient.client.event.impl.ClientTickEvent;
import net.silentclient.client.event.impl.RenderLivingEvent;
import net.silentclient.client.event.impl.RenderTickEvent;
import net.silentclient.client.mixin.accessors.RenderManagerAccessor;
import net.silentclient.client.mods.settings.FPSBoostMod;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL15;
import org.lwjgl.opengl.GL33;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
public class EntityCulling {
private static final Minecraft mc = Minecraft.getMinecraft();
@ -191,22 +186,19 @@ public class EntityCulling {
return;
}
if (entity instanceof EntityPlayer) {
//#if MC==10809
double x = event.x;
double y = event.y;
double z = event.z;
RendererLivingEntity<EntityLivingBase> renderer = event.getRenderer();
//#else
//$$ double x = event.getX();
//$$ double y = event.getY();
//$$ double z = event.getZ();
//$$ RenderLivingBase<EntityLivingBase> renderer = event.getRenderer();
//#endif
//#if MC==10809
double x = event.x;
double y = event.y;
double z = event.z;
RendererLivingEntity<EntityLivingBase> renderer = event.getRenderer();
//#else
//$$ double x = event.getX();
//$$ double y = event.getY();
//$$ double z = event.getZ();
//$$ RenderLivingBase<EntityLivingBase> renderer = event.getRenderer();
//#endif
renderer.renderName(entity, x, y, z);
}
renderer.renderName(entity, x, y, z);
}
}

View File

@ -1,26 +0,0 @@
package net.silentclient.client.utils.types;
import java.util.ArrayList;
import net.silentclient.client.utils.reply.AbstractReply;
public class FeaturedServersResponse extends AbstractReply {
public ArrayList<FeaturedServerInfo> servers = new ArrayList<FeaturedServerInfo>();
public ArrayList<FeaturedServerInfo> getServers() {
return servers;
}
public class FeaturedServerInfo {
public String name;
public String ip;
public String getName() {
return name;
}
public String getIp() {
return ip;
}
}
}