Skip to content

Commit

Permalink
Fix background container rendering in Better Tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
MineGame159 committed Dec 6, 2024
1 parent e1e2644 commit 2025a1c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public class BetterTooltips extends Module {
.build()
);

public final Setting<Boolean> echest = sgPreviews.add(new BoolSetting.Builder()
private final Setting<Boolean> echest = sgPreviews.add(new BoolSetting.Builder()
.name("echests")
.description("Shows a preview of your echest when hovering over it in an inventory.")
.defaultValue(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,16 @@ public static Color getShulkerColor(ItemStack shulkerItem) {
if (shulkerItem.getItem() instanceof BlockItem blockItem) {
Block block = blockItem.getBlock();
if (block == Blocks.ENDER_CHEST) return BetterTooltips.ECHEST_COLOR;

if (block instanceof ShulkerBoxBlock shulkerBlock) {
DyeColor dye = shulkerBlock.getColor();
if (dye == null) return WHITE;

final int color = dye.getEntityColor();
return new Color((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, 1f);
return new Color((color >> 16) & 0xFF, (color >> 8) & 0xFF, color & 0xFF, 255);
}
}

return WHITE;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package meteordevelopment.meteorclient.utils.tooltip;

import com.mojang.blaze3d.systems.RenderSystem;
import meteordevelopment.meteorclient.MeteorClient;
import meteordevelopment.meteorclient.utils.render.RenderUtils;
import meteordevelopment.meteorclient.utils.render.color.Color;
Expand Down Expand Up @@ -44,15 +43,13 @@ public int getWidth(TextRenderer textRenderer) {

@Override
public void drawItems(TextRenderer textRenderer, int x, int y, int width, int height, DrawContext context) {

// Background
RenderSystem.setShaderColor(color.r / 255f, color.g / 255f, color.b / 255f, color.a / 255f);
context.drawTexture(RenderLayer::getGuiTextured, TEXTURE_CONTAINER_BACKGROUND, x, y, 0, 0, 0, 176, 67, 176, 67);
RenderSystem.setShaderColor(1, 1, 1, 1);
context.drawTexture(RenderLayer::getGuiTextured, TEXTURE_CONTAINER_BACKGROUND, x, y, 0, 0, 176, 67, 176, 67, color.getPacked());

//Contents
// Contents
int row = 0;
int i = 0;

for (ItemStack itemStack : items) {
RenderUtils.drawItem(context, itemStack, x + 8 + i * 18, y + 7 + row * 18, 1, true);

Expand Down

0 comments on commit 2025a1c

Please sign in to comment.