(fix) emote repeating

This commit is contained in:
kirillsaint 2024-02-09 12:32:45 +06:00
parent 3c5c343fa4
commit 4668c67cb1
100 changed files with 29 additions and 159 deletions

View File

@ -501,7 +501,7 @@ public class AnimatorController {
}
if(repeat && this.emote.isFinished()) {
this.emote.ticks = 0;
this.setEmote(entitylivingbase, this.entry, true);
}
if((flag1 || entitylivingbase.isSneaking()) && repeat) {
@ -547,10 +547,14 @@ public class AnimatorController {
}
public void setEmote(EntityLivingBase entitylivingbase, String s) {
this.setEmote(entitylivingbase, PlayerModelManager.get().getEmote(s));
this.setEmote(entitylivingbase, PlayerModelManager.get().getEmote(s), false);
}
public void setEmote(EntityLivingBase entitylivingbase, Emote emotex) {
this.setEmote(entitylivingbase, emotex, false);
}
public void setEmote(EntityLivingBase entitylivingbase, Emote emotex, boolean ignorePerspective) {
if (emotex != null) {
BOBJAction bobjaction = this.animation.data.actions.get(emotex.getActionName());
if (bobjaction != null && emotex != null) {
@ -572,7 +576,7 @@ public class AnimatorController {
this.emote = actionplayback;
this.entry = emotex;
this.entry.startAnimation(this.accessor);
if (this.mc.gameSettings.thirdPersonView != EmotesMod.getEmotePerspective() && entitylivingbase == this.mc.thePlayer) {
if (!ignorePerspective && this.mc.gameSettings.thirdPersonView != EmotesMod.getEmotePerspective() && entitylivingbase == this.mc.thePlayer) {
this.mc.gameSettings.thirdPersonView = EmotesMod.getEmotePerspective();
this.resetThirdView = true;
}

View File

@ -4,7 +4,7 @@ import net.minecraft.client.gui.Gui;
import net.minecraft.util.ResourceLocation;
public class Icon {
public static final Icon DEFAULT = new Icon(new ResourceLocation("blc/textures/slideout/emotes/emote-icon.png"), 53, 85);
public static final Icon DEFAULT = new Icon(new ResourceLocation("silentclient/emotes/icons/1.png"), 53, 85);
public ResourceLocation icon;
public int width;
public int height;

View File

@ -5,6 +5,8 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.emotes.PlayerModelManager;
import net.silentclient.client.emotes.emoticons.Emote;
import net.silentclient.client.emotes.socket.EmoteSocket;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.elements.IconButton;
@ -66,6 +68,15 @@ public class EmoteMenuGui extends SilentScreen {
float emoteY = y + 20 + scrollY;
int emoteIndex = 0;
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
String emoteName = PlayerModelManager.get().map.get(emote.id);
if(emoteName == null) {
continue;
}
Emote emoteInstance = PlayerModelManager.get().getEmote(emoteName);
if(emoteInstance == null) {
continue;
}
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, emoteX, emoteY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
if(isHovered) {
cursorType = MouseCursorHandler.CursorType.POINTER;
@ -86,6 +97,8 @@ public class EmoteMenuGui extends SilentScreen {
RenderUtil.drawImage(new ResourceLocation(favorite ? "silentclient/icons/star.png" : "silentclient/icons/star_outline.png"), emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
RenderUtil.drawImage(emoteInstance.icon.icon, emoteX + 3 + 37 - 28 , emoteY + 16, 56, 56);
emoteIndex += 1;
if(emoteIndex == 3) {
emoteIndex = 0;
@ -120,6 +133,14 @@ public class EmoteMenuGui extends SilentScreen {
float emoteY = (int) (y + 20 + scrollHelper.getScroll());
int emoteIndex = 0;
for(PlayerResponse.Account.Cosmetics.CosmeticItem emote : Client.getInstance().getCosmetics().getMyEmotes()) {
String emoteName = PlayerModelManager.get().map.get(emote.id);
if(emoteName == null) {
continue;
}
Emote emoteInstance = PlayerModelManager.get().getEmote(emoteName);
if(emoteInstance == null) {
continue;
}
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, emoteX, emoteY, 80, 80) && !MouseUtils.isInside(mouseX, mouseY, emoteX + 80 - 3 - 10, emoteY + 3, 10, 10);
if(isHovered) {

View File

@ -1,155 +0,0 @@
package net.silentclient.client.emotes.ui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.MathHelper;
import net.silentclient.client.Client;
import net.silentclient.client.emotes.socket.EmoteSocket;
import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.utils.MouseCursorHandler;
import net.silentclient.client.utils.types.PlayerResponse;
import org.lwjgl.input.Mouse;
import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.function.Consumer;
public class ScreenEmoteWheel extends SilentScreen {
int accept;
protected boolean hovered;
private final HashMap<String, Consumer<Boolean>> handlers = new HashMap<>();
private String foc;
private int page = 1;
private void handleScroll() {
int maxPage = (int) Math.ceil((double) Client.getInstance().getCosmetics().getMyEmotes().size() / 6);
int scroll = Mouse.getEventDWheel();
if (scroll > 0 && this.page > 1) {
this.initGui();
--this.page;
}
if (scroll < 0 && this.page < maxPage) {
this.initGui();
++this.page;
}
}
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
this.handleScroll();
}
@Override
protected void mouseReleased(int mouseX, int mouseY, int state) {
super.mouseReleased(mouseX, mouseY, state);
if (this.foc != null) {
this.mc.displayGuiScreen(null);
this.handlers.get(this.foc).accept(true);
}
}
@Override
public void initGui() {
this.handlers.clear();
int index = (6 * page) - 6;
int currentIndex = 0;
for(PlayerResponse.Account.Cosmetics.CosmeticItem item : Client.getInstance().getCosmetics().getMyEmotes()) {
if(currentIndex >= index) {
this.handlers.put(item.getName(), (emote) -> EmoteSocket.get().startEmote(item.getId()));
if(this.handlers.size() == 6) {
break;
}
}
currentIndex++;
}
this.defaultCursor = false;
}
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
ScaledResolution resolution = new ScaledResolution(this.mc);
int centerY = resolution.getScaledHeight() / 2;
int centerX = resolution.getScaledWidth() / 2;
super.drawScreen(mouseX, mouseY, partialTicks);
this.foc = null;
int count = this.handlers.size();
float radius = (float)resolution.getScaledHeight() * 2.0F / 5.0F;
float i = 0.0F;
MouseCursorHandler.CursorType cursorType = getCursor(this.silentInputs, this.buttonList);
Client.getInstance().getSilentFontRenderer().drawString("Scroll to view more.", 1, 1, 14, SilentFontRenderer.FontType.TITLE);
for(String s : this.handlers.keySet()) {
GL11.glPushMatrix();
GL11.glEnable(3042);
GL11.glDisable(3553);
GL11.glBlendFunc(770, 771);
GL11.glHint(3152, 4354);
GL11.glBegin(6);
GlStateManager.resetColor();
float startTheta = (float)((double)(i / (float)count) * Math.PI * 2.0);
float endTheta = (float)((double)((i + 1.0F) / (float)count) * Math.PI * 2.0);
float diff = endTheta - startTheta;
int mouseDeltaX = mouseX - centerX;
int mouseDeltaY = mouseY - centerY;
double sqrt = Math.sqrt(Math.pow((double)mouseDeltaX, 2.0) + Math.pow((double)mouseDeltaY, 2.0));
boolean hovered = false;
if (sqrt <= (double)radius) {
double mouseTheta = MathHelper.atan2((double)mouseDeltaX, (double)mouseDeltaY);
if (mouseTheta < 0.0) {
mouseTheta += Math.PI * 2;
}
if (mouseTheta > (double)startTheta && mouseTheta < (double)endTheta) {
this.foc = s;
hovered = true;
cursorType = MouseCursorHandler.CursorType.POINTER;
}
}
Color tmp = new Color(12, 12, 12, hovered ? 40 : 20);
GlStateManager.color((float)tmp.getRed() / 255.0F, (float)tmp.getGreen() / 255.0F, (float)tmp.getBlue() / 255.0F, (float)tmp.getAlpha() / 255.0F);
GL11.glVertex3d((double)centerX, (double)centerY, 0.0);
for(float j = 0.0F; j <= 50.0F; ++j) {
float x = (float)centerX + radius * MathHelper.sin(startTheta + diff * j / 50.0F);
float y = (float)centerY + radius * MathHelper.cos(startTheta + diff * j / 50.0F);
GL11.glVertex2f(x, y);
}
GL11.glEnd();
GL11.glEnable(3553);
GL11.glDisable(3042);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
float middle = (startTheta + endTheta) / 2.0F;
List<String> strings = this.fontRendererObj.listFormattedStringToWidth(s, 50);
int textCenterX = (int)((float)centerX + radius * MathHelper.sin(middle) / 3.0F * 2.0F);
int textCenterY = (int)((float)centerY + radius * MathHelper.cos(middle) / 3.0F * 2.0F);
textCenterY -= strings.size() * 15;
for(String string : strings) {
textCenterY += 15;
this.drawScaledText(string, textCenterX, textCenterY, -1);
}
GL11.glPopMatrix();
++i;
}
Client.getInstance().getMouseCursorHandler().enableCursor(cursorType);
}
protected void drawScaledText(String text, int trueX, int trueY, int color) {
GlStateManager.pushMatrix();
GlStateManager.scale(1.2, 1.2, 1.2);
this.fontRendererObj
.drawString(text, (float)((double)trueX / 1.2) - (float)this.fontRendererObj.getStringWidth(text) / 2.0F, (float)((double)trueY / 1.2), color, false);
GlStateManager.popMatrix();
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB