From 31647d09a397da746791c6784826155fb66d8dcd Mon Sep 17 00:00:00 2001 From: noil Date: Sun, 9 Apr 2023 20:06:09 -0400 Subject: [PATCH] Fixes rare ColorsComponent crash, Changes to access transformer --- .../gui/hud/component/ColorsComponent.java | 60 +++++++++++-------- src/main/resources/seppuku_at.cfg | 4 ++ 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/ColorsComponent.java b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/ColorsComponent.java index f0df814..15937e4 100644 --- a/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/ColorsComponent.java +++ b/src/main/java/me/rigamortis/seppuku/impl/gui/hud/component/ColorsComponent.java @@ -119,42 +119,50 @@ public final class ColorsComponent extends ResizableHudComponent { GL11.glEnable(GL11.GL_SCISSOR_TEST); RenderUtil.glScissor(this.getX() + BORDER, this.getY() + offsetY + BORDER, this.getX() + this.getW() - BORDER - SCROLL_WIDTH, this.getY() + this.getH() - BORDER, sr); for (HudComponent component : Seppuku.INSTANCE.getHudManager().getComponentList()) { - if (component != this && component.getValueList().size() > 0) { + if (component == null) + continue; + + if (component != this && !component.getValueList().isEmpty()) { for (Value value : component.getValueList()) { - if (value.getValue().getClass() != Color.class) - continue; + if (value.getValue() != null) { + if (value.getValue().getClass() == Color.class) { + RenderUtil.drawRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x45303030); + final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll); + if (insideComponent) { + RenderUtil.drawGradientRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x30909090, 0x00101010); + } - RenderUtil.drawRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x45303030); - final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll); - if (insideComponent) { - RenderUtil.drawGradientRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x30909090, 0x00101010); + // draw button text + final int valueColor = ((Color) value.getValue()).getRGB(); + mc.fontRenderer.drawStringWithShadow(ChatFormatting.GRAY + component.getName() + ": " + ChatFormatting.RESET + value.getName(), this.getX() + BORDER + TEXT_GAP + 1, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, valueColor); + + offsetY += mc.fontRenderer.FONT_HEIGHT + TEXT_GAP; + } } - - // draw button text - final int valueColor = ((Color) value.getValue()).getRGB(); - mc.fontRenderer.drawStringWithShadow(ChatFormatting.GRAY + component.getName() + ": " + ChatFormatting.RESET + value.getName(), this.getX() + BORDER + TEXT_GAP + 1, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, valueColor); - - offsetY += mc.fontRenderer.FONT_HEIGHT + TEXT_GAP; } } } for (Module module : Seppuku.INSTANCE.getModuleManager().getModuleList()) { - if (module.getValueList().size() > 0) { + if (module == null) + continue; + + if (!module.getValueList().isEmpty()) { for (Value value : module.getValueList()) { - if (value.getValue().getClass() != Color.class) - continue; + if (value.getValue() != null) { + if (value.getValue().getClass() == Color.class) { + RenderUtil.drawRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x45303030); + final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll); + if (insideComponent) { + RenderUtil.drawGradientRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x30909090, 0x00101010); + } - RenderUtil.drawRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x45303030); - final boolean insideComponent = mouseX >= (this.getX() + BORDER) && mouseX <= (this.getX() + this.getW() - BORDER - SCROLL_WIDTH) && mouseY >= (this.getY() + BORDER + mc.fontRenderer.FONT_HEIGHT + 1 + offsetY - this.scroll - mc.fontRenderer.FONT_HEIGHT + 1) && mouseY <= (this.getY() + BORDER + (mc.fontRenderer.FONT_HEIGHT) + 1 + offsetY - this.scroll); - if (insideComponent) { - RenderUtil.drawGradientRect(this.getX() + BORDER + TEXT_GAP, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, this.getX() + BORDER + TEXT_GAP + this.getW() - BORDER - SCROLL_WIDTH - BORDER - 2, this.getY() + offsetY + BORDER + TEXT_GAP + mc.fontRenderer.FONT_HEIGHT - this.scroll, 0x30909090, 0x00101010); + // draw button text + final int valueColor = ((Color) value.getValue()).getRGB(); + mc.fontRenderer.drawStringWithShadow(ChatFormatting.GRAY + module.getDisplayName() + ": " + ChatFormatting.RESET + value.getName(), this.getX() + BORDER + TEXT_GAP + 1, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, valueColor); + + offsetY += mc.fontRenderer.FONT_HEIGHT + TEXT_GAP; + } } - - // draw button text - final int valueColor = ((Color) value.getValue()).getRGB(); - mc.fontRenderer.drawStringWithShadow(ChatFormatting.GRAY + module.getDisplayName() + ": " + ChatFormatting.RESET + value.getName(), this.getX() + BORDER + TEXT_GAP + 1, this.getY() + offsetY + BORDER + TEXT_GAP - this.scroll, valueColor); - - offsetY += mc.fontRenderer.FONT_HEIGHT + TEXT_GAP; } } } diff --git a/src/main/resources/seppuku_at.cfg b/src/main/resources/seppuku_at.cfg index 41d0342..f4965d2 100644 --- a/src/main/resources/seppuku_at.cfg +++ b/src/main/resources/seppuku_at.cfg @@ -124,3 +124,7 @@ public net.minecraft.network.play.client.CPacketCloseWindow field_149556_a public net.minecraft.client.renderer.RenderGlobal field_175008_n # ViewFrustum viewFrustum public net.minecraft.client.renderer.ViewFrustum func_178161_a(Lnet.minecraft.util.math.BlockPos;)Lnet.minecraft.client.renderer.chunk.RenderChunk; # ViewFrustum getRenderChunk public-f net.minecraft.client.renderer.BlockRendererDispatcher field_175025_e # BlockFluidRenderer fluidRenderer + #updateActiveHand + public net.minecraft.entity.EntityLivingBase func_184608_ct()V + #updateItemUse + public net.minecraft.entity.EntityLivingBase func_184584_a(Lnet.minecraft.item.ItemStack;I)V