Skip to content

Commit 44486a1

Browse files
committed
idk why this breaks so many things
1 parent 53dee4a commit 44486a1

File tree

1 file changed

+37
-24
lines changed

1 file changed

+37
-24
lines changed

src/main/java/org/polyfrost/chatting/mixin/GuiNewChatMixin.java

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -319,39 +319,52 @@ private void chatScale(CallbackInfoReturnable<Float> cir) {
319319
GlStateManager.translate(chatting$config().getChatWindow().getPaddingX() * chatting$config().getChatWindow().getScale(), 0f, 0f);
320320
}
321321
if (chatting$config().getChatCopy()) {
322-
chatting$drawButton(chatting$COPY, posLeft, top, posRight);
322+
mc.getTextureManager().bindTexture(chatting$COPY);
323+
chatting$right = right;
324+
boolean hovered = chatting$isHovered(posLeft, top, posRight - posLeft, 9);
325+
OneColor color = hovered ? chatting$config().getChatButtonHoveredBackgroundColor() : chatting$config().getChatButtonBackgroundColor();
326+
drawRect(posLeft, top, posRight, top + 9, color.getRGB());
327+
color = hovered ? chatting$config().getChatButtonHoveredColor() : chatting$config().getChatButtonColor();
328+
GlStateManager.pushMatrix();
329+
GlStateManager.enableAlpha();
330+
GlStateManager.enableBlend();
331+
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
332+
if (chatting$config().getButtonShadow()) {
333+
GlStateManager.color(0f, 0f, 0f, color.getAlpha() / 255f);
334+
drawModalRectWithCustomSizedTexture(posLeft + 1, top + 1, 0f, 0f, 9, 9, 9, 9);
335+
}
336+
GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f);
337+
drawModalRectWithCustomSizedTexture(posLeft, top, 0f, 0f, 9, 9, 9, 9);
338+
GlStateManager.disableAlpha();
339+
GlStateManager.disableBlend();
340+
GlStateManager.popMatrix();
323341
posLeft += 10;
324342
posRight += 10;
325343
}
326344
if (chatting$config().getChatDelete()) {
327-
chatting$drawButton(chatting$DELETE, posLeft, top, posRight);
345+
mc.getTextureManager().bindTexture(chatting$DELETE);
346+
boolean hovered = chatting$isHovered(posLeft, top, posRight - posLeft, 9);
347+
OneColor color = hovered ? chatting$config().getChatButtonHoveredBackgroundColor() : chatting$config().getChatButtonBackgroundColor();
348+
drawRect(posLeft, top, posRight, top + 9, color.getRGB());
349+
color = hovered ? chatting$config().getChatButtonHoveredColor() : chatting$config().getChatButtonColor();
350+
GlStateManager.pushMatrix();
351+
GlStateManager.enableAlpha();
352+
GlStateManager.enableBlend();
353+
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
354+
if (chatting$config().getButtonShadow()) {
355+
GlStateManager.color(0f, 0f, 0f, color.getAlpha() / 255f);
356+
drawModalRectWithCustomSizedTexture(posLeft + 1, top + 1, 0f, 0f, 9, 9, 9, 9);
357+
}
358+
GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f);
359+
drawModalRectWithCustomSizedTexture(posLeft, top, 0f, 0f, 9, 9, 9, 9);
360+
GlStateManager.disableAlpha();
361+
GlStateManager.disableBlend();
362+
GlStateManager.popMatrix();
328363
}
329364
GlStateManager.disableLighting();
330365
GlStateManager.popMatrix();
331366
}
332367

333-
@Unique
334-
private void chatting$drawButton(ResourceLocation location, int left, int top, int right) {
335-
mc.getTextureManager().bindTexture(location);
336-
boolean hovered = chatting$isHovered(left, top, 9, 9);
337-
OneColor color = hovered ? chatting$config().getChatButtonHoveredBackgroundColor() : chatting$config().getChatButtonBackgroundColor();
338-
drawRect(left, top, right, top + 9, color.getRGB());
339-
color = hovered ? chatting$config().getChatButtonHoveredColor() : chatting$config().getChatButtonColor();
340-
GlStateManager.pushMatrix();
341-
GlStateManager.enableAlpha();
342-
GlStateManager.enableBlend();
343-
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
344-
if (chatting$config().getButtonShadow()) {
345-
GlStateManager.color(0f, 0f, 0f, color.getAlpha() / 255f);
346-
drawModalRectWithCustomSizedTexture(left + 1, top + 1, 0f, 0f, 9, 9, 9, 9);
347-
}
348-
GlStateManager.color(color.getRed() / 255f, color.getGreen() / 255f, color.getBlue() / 255f, color.getAlpha() / 255f);
349-
drawModalRectWithCustomSizedTexture(left, top, 0f, 0f, 9, 9, 9, 9);
350-
GlStateManager.disableAlpha();
351-
GlStateManager.disableBlend();
352-
GlStateManager.popMatrix();
353-
}
354-
355368
@Override
356369
public ChatLine chatting$getHoveredLine(int mouseY) {
357370
if (this.getChatOpen()) {

0 commit comments

Comments
 (0)