diff options
| author | HacktheTime <l4bg0jb7@duck.com> | 2023-07-14 07:41:48 +0200 |
|---|---|---|
| committer | hackthetime <l4bg0jb7@duck.com> | 2023-09-05 08:22:03 +0200 |
| commit | 7f44f53220ee6d471a51baf5c7b6a4bbc37b5d89 (patch) | |
| tree | 466d2d359707f6052aa5d1a1bee0e244fbcd1c87 /src/main/java/de/hype/bbsentials/communication | |
| parent | 2bb0bc909c95dd534b404f21e17b7985ce97777c (diff) | |
| download | BBsentials-7f44f53220ee6d471a51baf5c7b6a4bbc37b5d89.tar.gz BBsentials-7f44f53220ee6d471a51baf5c7b6a4bbc37b5d89.tar.bz2 BBsentials-7f44f53220ee6d471a51baf5c7b6a4bbc37b5d89.zip | |
General
Diffstat (limited to 'src/main/java/de/hype/bbsentials/communication')
| -rw-r--r-- | src/main/java/de/hype/bbsentials/communication/highlighter.java | 92 |
1 files changed, 0 insertions, 92 deletions
diff --git a/src/main/java/de/hype/bbsentials/communication/highlighter.java b/src/main/java/de/hype/bbsentials/communication/highlighter.java deleted file mode 100644 index 4809a5c..0000000 --- a/src/main/java/de/hype/bbsentials/communication/highlighter.java +++ /dev/null @@ -1,92 +0,0 @@ -//https://github.com/AHilyard/ItemBorders/blob/main/src/main/java/com/anthonyhilyard/itemborders/ItemBorders.java -package de.hype; - -import net.minecraft.ChatFormatting; -import net.minecraft.client.renderer.MultiBufferSource; -import net.minecraft.client.renderer.MultiBufferSource.BufferSource; -import net.minecraft.network.chat.TextColor; -import net.minecraft.world.inventory.Slot; -import net.minecraft.world.item.ItemStack; - -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.PoseStack; -import com.mojang.blaze3d.vertex.Tesselator; -import com.mojang.math.Matrix4f; - -public class ItemBorders -{ - public static void renderBorder(PoseStack poseStack, Slot slot) - { - // Container GUIs. - render(poseStack, slot.getItem(), slot.x, slot.y); - } - - public static void renderBorder(PoseStack poseStack, ItemStack item, int x, int y) - { - // If borders are enabled for the hotbar... - if (ItemBordersConfig.INSTANCE.hotBar.get()) - { - render(new PoseStack(), item, x, y); - } - } - - private static void render(PoseStack poseStack, ItemStack item, int x, int y) - { - if (item.isEmpty()) - { - return; - } - - TextColor color = ItemBordersConfig.INSTANCE.getBorderColorForItem(item); - - // If the color is null, default to white. - if (color == null) - { - color = TextColor.fromLegacyFormat(ChatFormatting.WHITE); - } - - if (color.getValue() == ChatFormatting.WHITE.getColor() && !ItemBordersConfig.INSTANCE.showForCommon.get()) - { - return; - } - - RenderSystem.disableDepthTest(); - - poseStack.pushPose(); - poseStack.translate(0, 0, ItemBordersConfig.INSTANCE.overItems.get() ? 290 : 100); - Matrix4f matrix = poseStack.last().pose(); - - int startColor = color.getValue() | 0xEE000000; - int endColor = color.getValue() & 0x00FFFFFF; - - int topColor = ItemBordersConfig.INSTANCE.fullBorder.get() ? startColor : endColor; - int bottomColor = startColor; - - int xOffset = ItemBordersConfig.INSTANCE.squareCorners.get() ? 0 : 1; - - BufferSource bufferSource = MultiBufferSource.immediate(Tesselator.getInstance().getBuilder()); - GuiUtils.drawGradientRect(matrix, -1, x, y + 1, x + 1, y + 15, topColor, bottomColor); - GuiUtils.drawGradientRect(matrix, -1, x + 15, y + 1, x + 16, y + 15, topColor, bottomColor); - - GuiUtils.drawGradientRect(matrix, -1, x + xOffset, y, x + 16 - xOffset, y + 1, topColor, topColor); - GuiUtils.drawGradientRect(matrix, -1, x + xOffset, y + 15, x + 16 - xOffset, y + 16, bottomColor, bottomColor); - - if (ItemBordersConfig.INSTANCE.extraGlow.get()) - { - int topAlpha = ((topColor >> 24) & 0xFF) / 3; - int bottomAlpha = ((bottomColor >> 24) & 0xFF) / 3; - - int topGlowColor = (topAlpha << 24) | (topColor & 0x00FFFFFF); - int bottomGlowColor = (bottomAlpha << 24) | (bottomColor & 0x00FFFFFF); - - GuiUtils.drawGradientRect(matrix, -1, x + 1, y + 1, x + 2, y + 15, topGlowColor, bottomGlowColor); - GuiUtils.drawGradientRect(matrix, -1, x + 14, y + 1, x + 15, y + 15, topGlowColor, bottomGlowColor); - - GuiUtils.drawGradientRect(matrix, -1, x + 1, y + 1, x + 15, y + 2, topGlowColor, topGlowColor); - GuiUtils.drawGradientRect(matrix, -1, x + 1, y + 14, x + 15, y + 15, bottomGlowColor, bottomGlowColor); - } - - bufferSource.endBatch(); - poseStack.popPose(); - } -}
\ No newline at end of file |
