Merge pull request #25 from Silent-Client/TEST2

Test2
This commit is contained in:
kirillsaint 2023-08-21 15:30:04 +06:00 committed by GitHub
commit e31992a9a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 243 additions and 10 deletions

View File

@ -10,6 +10,7 @@ import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.lite.LiteAccountPicker;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.theme.Theme;
@ -55,11 +56,18 @@ public class FriendsListOverlay extends GuiScreen {
GlStateManager.pushMatrix();
int width = 150;
GlStateManager.translate(this.introAnimation.getValue(), 0, 0);
this.introAnimation.setAnimation(0, 30);
this.introAnimation.setValue(0);
RenderUtils.drawRect(0, 0, width, height, Theme.backgroundColor().getRGB());
RenderUtil.drawImage(Client.getInstance().getAccount().getSelectedIcon() != 0 && !Client.getInstance().getAccount().plusIcon() ? Client.getInstance().getCosmetics().getIconById(Client.getInstance().getAccount().getSelectedIcon()).getLocation() : new ResourceLocation(Client.getInstance().getAccount().plusIcon() ? "silentclient/icons/plus_icon.png" : "silentclient/icons/player_icon.png"), 3, 5, 18, 18, false);
if(!LiteAccountPicker.avatars.containsKey(Client.getInstance().getAccount().original_username)) {
LiteAccountPicker.avatars.put(Client.getInstance().getAccount().original_username, new LiteAccountPicker.MinecraftAvatar(Client.getInstance().getAccount().original_username));
}
if(!LiteAccountPicker.avatars.get(Client.getInstance().getAccount().original_username).initSkin) {
LiteAccountPicker.avatars.get(Client.getInstance().getAccount().original_username).loadSkin();
}
RenderUtil.drawImage(LiteAccountPicker.avatars.get(Client.getInstance().getAccount().original_username).imageLocation, 3, 5, 18, 18, false);
ColorUtils.setColor(new Color(9, 165, 51).getRGB());
font.drawString(Client.getInstance().getAccount().original_username, 23, 5 - 2, 12, SilentFontRenderer.FontType.TITLE);
font.drawString(Client.getInstance().getAccount().original_username, 23, 5 - 1, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB());
font.drawString(mc.getCurrentServerData() == null ? "Online" : "Playing on " + mc.getCurrentServerData().serverIP, 23, 5 + 8, 10, SilentFontRenderer.FontType.TITLE, 90);
super.drawScreen(mouseX, mouseY, partialTicks);
@ -73,13 +81,20 @@ public class FriendsListOverlay extends GuiScreen {
GL11.glScissor(0 * s, translatedY * s, width * s, listHeight * s);
if(!showRequests) {
for(FriendsResponse.Friend friend : Client.getInstance().getFriends().getFriends()) {
RenderUtil.drawImage(friend.getIcon().getLocation(), 3, friendY, 18, 18, false);
if(!LiteAccountPicker.avatars.containsKey(friend.username)) {
LiteAccountPicker.avatars.put(friend.username, new LiteAccountPicker.MinecraftAvatar(friend.username));
}
if(!LiteAccountPicker.avatars.get(friend.username).initSkin) {
LiteAccountPicker.avatars.get(friend.username).loadSkin();
}
RenderUtil.drawImage(LiteAccountPicker.avatars.get(friend.username).imageLocation, 3, friendY, 18, 18, false);
if(friend.isOnline()) {
ColorUtils.setColor(new Color(9, 165, 51).getRGB());
} else {
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
}
font.drawString(friend.getUsername(), 23, friendY - 2, 12, SilentFontRenderer.FontType.TITLE);
font.drawString(friend.getUsername(), 23, friendY - 1, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB());
font.drawString(friend.isOnline() ? friend.getCurrentServer().equals("") ? "Online" : "Playing on " + friend.getCurrentServer() : "Offline", 23, friendY + 8, 10, SilentFontRenderer.FontType.TITLE, 108);
RenderUtil.drawImage(new ResourceLocation("silentclient/icons/cross.png"), 135, friendY + 3, 12, 12, false);
@ -87,9 +102,16 @@ public class FriendsListOverlay extends GuiScreen {
}
} else {
for(FriendsResponse.Request request : Client.getInstance().getFriends().getRequests()) {
RenderUtil.drawImage(request.getIcon().getLocation(), 3, friendY, 18, 18, false);
if(!LiteAccountPicker.avatars.containsKey(request.username)) {
LiteAccountPicker.avatars.put(request.username, new LiteAccountPicker.MinecraftAvatar(request.username));
}
if(!LiteAccountPicker.avatars.get(request.username).initSkin) {
LiteAccountPicker.avatars.get(request.username).loadSkin();
}
RenderUtil.drawImage(LiteAccountPicker.avatars.get(request.username).imageLocation, 3, friendY, 18, 18, false);
ColorUtils.setColor(new Color(255, 255, 255).getRGB());
font.drawString(request.getUsername(), 23, friendY - 2, 12, SilentFontRenderer.FontType.TITLE);
font.drawString(request.getUsername(), 23, friendY - 1, 12, SilentFontRenderer.FontType.TITLE);
ColorUtils.setColor(new Color(255, 255, 255, 127).getRGB());
font.drawString(request.isIncoming() ? "Incoming Friend Request" : "Outgoing Friend Request", 23, friendY + 8, 10, SilentFontRenderer.FontType.TITLE);
if(request.isIncoming()) {

View File

@ -118,7 +118,7 @@ public class LiteAccountPicker extends AccountPicker {
this.open = false;
}
public class MinecraftAvatar {
public static class MinecraftAvatar {
public ResourceLocation imageLocation = new ResourceLocation("silentclient/images/steve_head.png");
public BufferedImage image = null;
public boolean initSkin = false;

View File

@ -0,0 +1,12 @@
package net.silentclient.client.math;
public class JavaMath {
public static float sin(float radians) {
return (float) Math.sin((double) radians);
}
public static float cos(float radians) {
return (float) Math.cos((double) radians);
}
}

View File

@ -0,0 +1,29 @@
package net.silentclient.client.math;
public class LibGDXMath {
public static final float BF_PI = 3.1415927F;
public static final float BF_degreesToRadians = 0.017453292F;
private static final float[] BF_table = new float[16384];
public static float sin(float radians) {
return LibGDXMath.BF_table[(int) (radians * 2607.5945F) & 16383];
}
public static float cos(float radians) {
return LibGDXMath.BF_table[(int) ((radians + 1.5707964F) * 2607.5945F) & 16383];
}
static {
int i;
for (i = 0; i < 16384; ++i) {
LibGDXMath.BF_table[i] = (float) Math.sin((double) (((float) i + 0.5F) / 16384.0F * 6.2831855F));
}
for (i = 0; i < 360; i += 90) {
LibGDXMath.BF_table[(int) ((float) i * 45.511112F) & 16383] = (float) Math.sin((double) ((float) i * 0.017453292F));
}
}
}

View File

@ -0,0 +1,12 @@
package net.silentclient.client.math;
public class RandomMath {
public static float sin(float radians) {
return (float) Math.random() * radians;
}
public static float cos(float radians) {
return (float) Math.random() * radians;
}
}

View File

@ -0,0 +1,27 @@
package net.silentclient.client.math;
public class RivensFullMath {
private static final float BF_SIN_TO_COS = 1.5707964F;
private static final int BF_SIN_BITS = 12;
private static final int BF_SIN_MASK = ~(-1 << RivensFullMath.BF_SIN_BITS);
private static final int BF_SIN_COUNT = RivensFullMath.BF_SIN_MASK + 1;
private static final float BF_radFull = 6.2831855F;
private static final float BF_radToIndex = (float) RivensFullMath.BF_SIN_COUNT / RivensFullMath.BF_radFull;
private static final float[] BF_sinFull = new float[RivensFullMath.BF_SIN_COUNT];
public static float sin(float rad) {
return RivensFullMath.BF_sinFull[(int) (rad * RivensFullMath.BF_radToIndex) & RivensFullMath.BF_SIN_MASK];
}
public static float cos(float rad) {
return sin(rad + RivensFullMath.BF_SIN_TO_COS);
}
static {
for (int i = 0; i < RivensFullMath.BF_SIN_COUNT; ++i) {
RivensFullMath.BF_sinFull[i] = (float) Math.sin(((double) i + (double) Math.min(1, i % (RivensFullMath.BF_SIN_COUNT / 4)) * 0.5D) / (double) RivensFullMath.BF_SIN_COUNT * (double) RivensFullMath.BF_radFull);
}
}
}

View File

@ -0,0 +1,33 @@
package net.silentclient.client.math;
public class RivensHalfMath {
private static final float BF_SIN_TO_COS = 1.5707964F;
private static final int BF_SIN_BITS = 12;
private static final int BF_SIN_MASK = ~(-1 << RivensHalfMath.BF_SIN_BITS);
private static final int BF_SIN_MASK2 = RivensHalfMath.BF_SIN_MASK >> 1;
private static final int BF_SIN_COUNT = RivensHalfMath.BF_SIN_MASK + 1;
private static final int BF_SIN_COUNT2 = RivensHalfMath.BF_SIN_MASK2 + 1;
private static final float BF_radFull = 6.2831855F;
private static final float BF_radToIndex = (float) RivensHalfMath.BF_SIN_COUNT / RivensHalfMath.BF_radFull;
private static final float[] BF_sinHalf = new float[RivensHalfMath.BF_SIN_COUNT2];
public static float sin(float rad) {
int index1 = (int) (rad * RivensHalfMath.BF_radToIndex) & RivensHalfMath.BF_SIN_MASK;
int index2 = index1 & RivensHalfMath.BF_SIN_MASK2;
int mul = index1 == index2 ? 1 : -1;
return RivensHalfMath.BF_sinHalf[index2] * (float) mul;
}
public static float cos(float rad) {
return sin(rad + RivensHalfMath.BF_SIN_TO_COS);
}
static {
for (int i = 0; i < RivensHalfMath.BF_SIN_COUNT2; ++i) {
RivensHalfMath.BF_sinHalf[i] = (float) Math.sin(((double) i + (double) Math.min(1, i % (RivensHalfMath.BF_SIN_COUNT / 4)) * 0.5D) / (double) RivensHalfMath.BF_SIN_COUNT * (double) RivensHalfMath.BF_radFull);
}
}
}

View File

@ -0,0 +1,37 @@
package net.silentclient.client.math;
public class RivensMath {
private static final int BF_SIN_BITS = 12;
private static final int BF_SIN_MASK = ~(-1 << RivensMath.BF_SIN_BITS);
private static final int BF_SIN_COUNT = RivensMath.BF_SIN_MASK + 1;
private static final float BF_radFull = 6.2831855F;
private static final float BF_radToIndex = (float) RivensMath.BF_SIN_COUNT / RivensMath.BF_radFull;
private static final float BF_degFull = 360.0F;
private static final float BF_degToIndex = (float) RivensMath.BF_SIN_COUNT / RivensMath.BF_degFull;
private static final float[] BF_sin = new float[RivensMath.BF_SIN_COUNT];
private static final float[] BF_cos = new float[RivensMath.BF_SIN_COUNT];
public static float sin(float rad) {
return RivensMath.BF_sin[(int) (rad * RivensMath.BF_radToIndex) & RivensMath.BF_SIN_MASK];
}
public static float cos(float rad) {
return RivensMath.BF_cos[(int) (rad * RivensMath.BF_radToIndex) & RivensMath.BF_SIN_MASK];
}
static {
int i;
for (i = 0; i < RivensMath.BF_SIN_COUNT; ++i) {
RivensMath.BF_sin[i] = (float) Math.sin((double) (((float) i + 0.5F) / (float) RivensMath.BF_SIN_COUNT * RivensMath.BF_radFull));
RivensMath.BF_cos[i] = (float) Math.cos((double) (((float) i + 0.5F) / (float) RivensMath.BF_SIN_COUNT * RivensMath.BF_radFull));
}
for (i = 0; i < 360; i += 90) {
RivensMath.BF_sin[(int) ((float) i * RivensMath.BF_degToIndex) & RivensMath.BF_SIN_MASK] = (float) Math.sin((double) i * 3.141592653589793D / 180.0D);
RivensMath.BF_cos[(int) ((float) i * RivensMath.BF_degToIndex) & RivensMath.BF_SIN_MASK] = (float) Math.cos((double) i * 3.141592653589793D / 180.0D);
}
}
}

View File

@ -0,0 +1,33 @@
package net.silentclient.client.math;
public class TaylorMath {
private static final float BF_SIN_TO_COS = 1.5707964F;
public static float sin(float rad) {
double x = (double) rad;
double x2 = x * x;
double x3 = x2 * x;
double x5 = x2 * x3;
double x7 = x2 * x5;
double x9 = x2 * x7;
double x11 = x2 * x9;
double x13 = x2 * x11;
double x15 = x2 * x13;
double x17 = x2 * x15;
double val = x - x3 * 0.16666666666666666D;
val += x5 * 0.008333333333333333D;
val -= x7 * 1.984126984126984E-4D;
val += x9 * 2.7557319223985893E-6D;
val -= x11 * 2.505210838544172E-8D;
val += x13 * 1.6059043836821613E-10D;
val -= x15 * 7.647163731819816E-13D;
val += x17 * 2.8114572543455206E-15D;
return (float) val;
}
public static float cos(float rad) {
return sin(rad + TaylorMath.BF_SIN_TO_COS);
}
}

View File

@ -178,7 +178,7 @@ public abstract class GuiPlayerTabOverlayMixin {
{
EntityPlayer entityplayer = this.mc.theWorld.getPlayerEntityByUUID(gameprofile.getId());
try {
isSilent = Boolean.parseBoolean(Players.getPlayerStatus(entityplayer == mc.thePlayer, entityplayer.getName().toString(), entityplayer.getUniqueID(), (AbstractClientPlayer) entityplayer));
isSilent = Boolean.parseBoolean(Players.getPlayerStatus(entityplayer == mc.thePlayer, entityplayer.getName().toString(), entityplayer.getUniqueID(), (AbstractClientPlayer) entityplayer)) && Client.getInstance().getModInstances().getModByClass(TabMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(TabMod.class, "Show Nametag Icons").getValBoolean();
} catch (Exception e) {
isSilent = false;
}

View File

@ -0,0 +1,27 @@
package net.silentclient.client.mixin.mixins;
import net.minecraft.util.MathHelper;
import net.silentclient.client.math.RivensHalfMath;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
@Mixin(MathHelper.class)
public class MathHelperMixin {
/**
* @author kirillsaint
* @reason custom math (faster)
*/
@Overwrite
public static float sin(float param) {
return RivensHalfMath.sin(param);
}
/**
* @author kirillsaint
* @reason custom math (faster)
*/
@Overwrite
public static float cos(float param) {
return RivensHalfMath.cos(param);
}
}

View File

@ -114,6 +114,7 @@
"accessors.optifine.CustomColorsAccessor",
"accessors.optifine.ConfigAccessor",
"mixins.NetworkPlayerInfoMixin",
"accessors.NetworkPlayerInfoAccessor"
"accessors.NetworkPlayerInfoAccessor",
"mixins.MathHelperMixin"
]
}