still struggling to get the placement right, just need to commit for right now
BIN
art/mockups/rename_docked_compact.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
art/mockups/rename_docked_normal.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
art/mockups/rename_floating_horizontal_compact.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
art/mockups/rename_floating_horizontal_normal.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
327
scripts/generate_tab_mockups.ps1
Normal file
@@ -0,0 +1,327 @@
|
|||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
|
||||||
|
Add-Type -AssemblyName System.Drawing
|
||||||
|
|
||||||
|
$root = Split-Path -Parent $PSScriptRoot
|
||||||
|
$guiDir = Join-Path $root 'src\main\resources\assets\bagtabs\textures\gui'
|
||||||
|
$itemDir = Join-Path $root 'src\main\resources\assets\bagtabs\textures\item'
|
||||||
|
$outDir = Join-Path $root 'art\mockups'
|
||||||
|
New-Item -ItemType Directory -Force -Path $outDir | Out-Null
|
||||||
|
|
||||||
|
function New-Bitmap {
|
||||||
|
param([int]$Width, [int]$Height)
|
||||||
|
return [System.Drawing.Bitmap]::new($Width, $Height, [System.Drawing.Imaging.PixelFormat]::Format32bppArgb)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Load-Bitmap {
|
||||||
|
param([string]$Path)
|
||||||
|
return [System.Drawing.Bitmap]::new($Path)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Get-Half {
|
||||||
|
param(
|
||||||
|
[System.Drawing.Bitmap]$Image,
|
||||||
|
[bool]$RightHalf = $false
|
||||||
|
)
|
||||||
|
|
||||||
|
$halfWidth = [int]($Image.Width / 2)
|
||||||
|
$sourceX = if ($RightHalf) { $halfWidth } else { 0 }
|
||||||
|
$bmp = New-Bitmap $halfWidth $Image.Height
|
||||||
|
$graphics = [System.Drawing.Graphics]::FromImage($bmp)
|
||||||
|
try {
|
||||||
|
$graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::NearestNeighbor
|
||||||
|
$graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::Half
|
||||||
|
$graphics.DrawImage(
|
||||||
|
$Image,
|
||||||
|
[System.Drawing.Rectangle]::new(0, 0, $halfWidth, $Image.Height),
|
||||||
|
[System.Drawing.Rectangle]::new($sourceX, 0, $halfWidth, $Image.Height),
|
||||||
|
[System.Drawing.GraphicsUnit]::Pixel
|
||||||
|
)
|
||||||
|
} finally {
|
||||||
|
$graphics.Dispose()
|
||||||
|
}
|
||||||
|
return $bmp
|
||||||
|
}
|
||||||
|
|
||||||
|
function Tint-Bitmap {
|
||||||
|
param(
|
||||||
|
[System.Drawing.Bitmap]$Image,
|
||||||
|
[Nullable[int]]$Rgb
|
||||||
|
)
|
||||||
|
|
||||||
|
$bmp = New-Bitmap $Image.Width $Image.Height
|
||||||
|
$tr = if ($Rgb.HasValue) { (($Rgb.Value -shr 16) -band 0xFF) / 255.0 } else { 1.0 }
|
||||||
|
$tg = if ($Rgb.HasValue) { (($Rgb.Value -shr 8) -band 0xFF) / 255.0 } else { 1.0 }
|
||||||
|
$tb = if ($Rgb.HasValue) { ($Rgb.Value -band 0xFF) / 255.0 } else { 1.0 }
|
||||||
|
|
||||||
|
for ($x = 0; $x -lt $Image.Width; $x++) {
|
||||||
|
for ($y = 0; $y -lt $Image.Height; $y++) {
|
||||||
|
$src = $Image.GetPixel($x, $y)
|
||||||
|
if ($src.A -eq 0) {
|
||||||
|
$bmp.SetPixel($x, $y, $src)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
$r = [Math]::Min(255, [int]($src.R * $tr))
|
||||||
|
$g = [Math]::Min(255, [int]($src.G * $tg))
|
||||||
|
$b = [Math]::Min(255, [int]($src.B * $tb))
|
||||||
|
$bmp.SetPixel($x, $y, [System.Drawing.Color]::FromArgb($src.A, $r, $g, $b))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $bmp
|
||||||
|
}
|
||||||
|
|
||||||
|
function Compose-Layered {
|
||||||
|
param(
|
||||||
|
[System.Drawing.Bitmap]$Base,
|
||||||
|
[System.Drawing.Bitmap]$Overlay
|
||||||
|
)
|
||||||
|
|
||||||
|
$bmp = New-Bitmap $Base.Width $Base.Height
|
||||||
|
$graphics = [System.Drawing.Graphics]::FromImage($bmp)
|
||||||
|
try {
|
||||||
|
$graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::NearestNeighbor
|
||||||
|
$graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::Half
|
||||||
|
$graphics.DrawImage($Base, 0, 0, $Base.Width, $Base.Height)
|
||||||
|
$graphics.DrawImage($Overlay, 0, 0, $Overlay.Width, $Overlay.Height)
|
||||||
|
} finally {
|
||||||
|
$graphics.Dispose()
|
||||||
|
}
|
||||||
|
return $bmp
|
||||||
|
}
|
||||||
|
|
||||||
|
function Draw-ScaledBitmap {
|
||||||
|
param(
|
||||||
|
[System.Drawing.Graphics]$Graphics,
|
||||||
|
[System.Drawing.Bitmap]$Bitmap,
|
||||||
|
[int]$X,
|
||||||
|
[int]$Y,
|
||||||
|
[int]$Width,
|
||||||
|
[int]$Height
|
||||||
|
)
|
||||||
|
|
||||||
|
$Graphics.DrawImage(
|
||||||
|
$Bitmap,
|
||||||
|
[System.Drawing.Rectangle]::new($X, $Y, $Width, $Height),
|
||||||
|
[System.Drawing.Rectangle]::new(0, 0, $Bitmap.Width, $Bitmap.Height),
|
||||||
|
[System.Drawing.GraphicsUnit]::Pixel
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
function Draw-Pin {
|
||||||
|
param([System.Drawing.Graphics]$Graphics, [int]$X, [int]$Y)
|
||||||
|
$yellow = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(255, 235, 205, 86))
|
||||||
|
$red = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(255, 205, 55, 44))
|
||||||
|
try {
|
||||||
|
$Graphics.FillRectangle($yellow, $X + 1, $Y + 1, 3, 5)
|
||||||
|
$Graphics.FillRectangle($yellow, $X + 2, $Y + 6, 2, 1)
|
||||||
|
$Graphics.FillRectangle($red, $X, $Y + 2, 1, 1)
|
||||||
|
} finally {
|
||||||
|
$yellow.Dispose()
|
||||||
|
$red.Dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Draw-Fullness {
|
||||||
|
param(
|
||||||
|
[System.Drawing.Graphics]$Graphics,
|
||||||
|
[int]$X,
|
||||||
|
[int]$Y,
|
||||||
|
[int]$Width,
|
||||||
|
[int]$Height,
|
||||||
|
[double]$Percent
|
||||||
|
)
|
||||||
|
|
||||||
|
$back = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(255, 40, 40, 40))
|
||||||
|
$fill = [System.Drawing.SolidBrush]::new([System.Drawing.Color]::FromArgb(255, 105, 180, 90))
|
||||||
|
try {
|
||||||
|
$Graphics.FillRectangle($back, $X, $Y, $Width, $Height)
|
||||||
|
$fillHeight = [Math]::Max(1, [int]([Math]::Round($Height * $Percent)))
|
||||||
|
$Graphics.FillRectangle($fill, $X, $Y + ($Height - $fillHeight), $Width, $fillHeight)
|
||||||
|
} finally {
|
||||||
|
$back.Dispose()
|
||||||
|
$fill.Dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Draw-BagItem {
|
||||||
|
param(
|
||||||
|
[System.Drawing.Graphics]$Graphics,
|
||||||
|
[System.Drawing.Bitmap]$BagBase,
|
||||||
|
[System.Drawing.Bitmap]$BagOverlay,
|
||||||
|
[Nullable[int]]$Color,
|
||||||
|
[int]$X,
|
||||||
|
[int]$Y,
|
||||||
|
[int]$Size
|
||||||
|
)
|
||||||
|
|
||||||
|
$tinted = Tint-Bitmap $BagBase $Color
|
||||||
|
$bag = Compose-Layered $tinted $BagOverlay
|
||||||
|
try {
|
||||||
|
Draw-ScaledBitmap $Graphics $bag $X $Y $Size $Size
|
||||||
|
} finally {
|
||||||
|
$tinted.Dispose()
|
||||||
|
$bag.Dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function Draw-CompactText {
|
||||||
|
param(
|
||||||
|
[System.Drawing.Graphics]$Graphics,
|
||||||
|
[string]$Line1,
|
||||||
|
[string]$Line2,
|
||||||
|
[int]$X,
|
||||||
|
[int]$Y,
|
||||||
|
[int]$Width,
|
||||||
|
[int]$Height,
|
||||||
|
[System.Drawing.Color]$Color
|
||||||
|
)
|
||||||
|
|
||||||
|
$font = [System.Drawing.Font]::new('Microsoft Sans Serif', 5.5, [System.Drawing.FontStyle]::Bold, [System.Drawing.GraphicsUnit]::Pixel)
|
||||||
|
$brush = [System.Drawing.SolidBrush]::new($Color)
|
||||||
|
$format = [System.Drawing.StringFormat]::new()
|
||||||
|
$format.Alignment = [System.Drawing.StringAlignment]::Center
|
||||||
|
$format.LineAlignment = [System.Drawing.StringAlignment]::Center
|
||||||
|
try {
|
||||||
|
$Graphics.TextRenderingHint = [System.Drawing.Text.TextRenderingHint]::SingleBitPerPixelGridFit
|
||||||
|
$Graphics.DrawString($Line1, $font, $brush, [System.Drawing.RectangleF]::new($X, $Y - 1, $Width, [int]($Height / 2)), $format)
|
||||||
|
$Graphics.DrawString($Line2, $font, $brush, [System.Drawing.RectangleF]::new($X, $Y + [int]($Height / 2) - 2, $Width, [int]($Height / 2) + 2), $format)
|
||||||
|
} finally {
|
||||||
|
$font.Dispose()
|
||||||
|
$brush.Dispose()
|
||||||
|
$format.Dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function New-Canvas {
|
||||||
|
param([int]$Width, [int]$Height)
|
||||||
|
$bmp = New-Bitmap $Width $Height
|
||||||
|
$graphics = [System.Drawing.Graphics]::FromImage($bmp)
|
||||||
|
$graphics.InterpolationMode = [System.Drawing.Drawing2D.InterpolationMode]::NearestNeighbor
|
||||||
|
$graphics.PixelOffsetMode = [System.Drawing.Drawing2D.PixelOffsetMode]::Half
|
||||||
|
$graphics.Clear([System.Drawing.Color]::FromArgb(255, 48, 48, 52))
|
||||||
|
return @{ Bitmap = $bmp; Graphics = $graphics }
|
||||||
|
}
|
||||||
|
|
||||||
|
$bagNamer = Load-Bitmap (Join-Path $guiDir 'bag_namer.png')
|
||||||
|
$tabBase = Get-Half (Load-Bitmap (Join-Path $guiDir 'bag_tabs_base.png'))
|
||||||
|
$tabOverlay = Get-Half (Load-Bitmap (Join-Path $guiDir 'bag_tabs_overlay.png'))
|
||||||
|
$compactBase = Get-Half (Load-Bitmap (Join-Path $guiDir 'bag_tabs_compact_base.png'))
|
||||||
|
$compactOverlay = Get-Half (Load-Bitmap (Join-Path $guiDir 'bag_tabs_compact_overlay.png'))
|
||||||
|
$dockTab = Load-Bitmap (Join-Path $guiDir 'bag_tabs_dock.png')
|
||||||
|
$gear = Load-Bitmap (Join-Path $guiDir 'dock_gear.png')
|
||||||
|
$lock = Load-Bitmap (Join-Path $guiDir 'dock_lock.png')
|
||||||
|
$prev = Load-Bitmap (Join-Path $guiDir 'dock_prev.png')
|
||||||
|
$next = Load-Bitmap (Join-Path $guiDir 'dock_next.png')
|
||||||
|
$bagBase = Load-Bitmap (Join-Path $itemDir 'bag.png')
|
||||||
|
$bagOverlay = Load-Bitmap (Join-Path $itemDir 'bag_overlay.png')
|
||||||
|
|
||||||
|
$bagColors = @($null, 0x8032A8, 0xE4E5DE)
|
||||||
|
$bagFullness = @(0.82, 0.56, 0.31)
|
||||||
|
$compactNames = @(
|
||||||
|
@{ Line1 = 'Canvas'; Line2 = 'Bag' },
|
||||||
|
@{ Line1 = 'Purple'; Line2 = 'Bag' },
|
||||||
|
@{ Line1 = 'Pale'; Line2 = 'Bag' }
|
||||||
|
)
|
||||||
|
|
||||||
|
function Draw-StandardStrip {
|
||||||
|
param(
|
||||||
|
[System.Drawing.Graphics]$Graphics,
|
||||||
|
[int]$X,
|
||||||
|
[int]$Y,
|
||||||
|
[bool]$Compact
|
||||||
|
)
|
||||||
|
|
||||||
|
Draw-ScaledBitmap $Graphics $dockTab $X $Y 18 22
|
||||||
|
Draw-ScaledBitmap $Graphics $gear ($X + 5) ($Y + 2) 8 8
|
||||||
|
Draw-ScaledBitmap $Graphics $lock ($X + 5) ($Y + 12) 8 8
|
||||||
|
|
||||||
|
$tabStep = 21
|
||||||
|
$tabX = $X + 17
|
||||||
|
for ($i = 0; $i -lt 3; $i++) {
|
||||||
|
if ($Compact) {
|
||||||
|
$tintedBase = Tint-Bitmap $compactBase $bagColors[$i]
|
||||||
|
$tab = Compose-Layered $tintedBase $compactOverlay
|
||||||
|
try {
|
||||||
|
Draw-ScaledBitmap $Graphics $tab ($tabX + ($i * $tabStep)) ($Y + 11) 22 11
|
||||||
|
} finally {
|
||||||
|
$tintedBase.Dispose()
|
||||||
|
$tab.Dispose()
|
||||||
|
}
|
||||||
|
$textColor = if ($bagColors[$i] -eq $null -or $bagColors[$i] -gt 0x7F7F7F) {
|
||||||
|
[System.Drawing.Color]::FromArgb(255, 30, 30, 30)
|
||||||
|
} else {
|
||||||
|
[System.Drawing.Color]::White
|
||||||
|
}
|
||||||
|
Draw-CompactText $Graphics $compactNames[$i].Line1 $compactNames[$i].Line2 ($tabX + ($i * $tabStep) + 2) ($Y + 11) 18 10 $textColor
|
||||||
|
Draw-Fullness $Graphics ($tabX + ($i * $tabStep) + 18) ($Y + 12) 2 8 $bagFullness[$i]
|
||||||
|
} else {
|
||||||
|
$tintedBase = Tint-Bitmap $tabBase $bagColors[$i]
|
||||||
|
$tab = Compose-Layered $tintedBase $tabOverlay
|
||||||
|
try {
|
||||||
|
Draw-ScaledBitmap $Graphics $tab ($tabX + ($i * $tabStep)) $Y 22 22
|
||||||
|
} finally {
|
||||||
|
$tintedBase.Dispose()
|
||||||
|
$tab.Dispose()
|
||||||
|
}
|
||||||
|
Draw-BagItem $Graphics $bagBase $bagOverlay $bagColors[$i] ($tabX + ($i * $tabStep) + 3) ($Y + 2) 16
|
||||||
|
Draw-Fullness $Graphics ($tabX + ($i * $tabStep) + 18) ($Y + 3) 2 15 $bagFullness[$i]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw-Pin $Graphics ($tabX + 1) ($Y + 1)
|
||||||
|
|
||||||
|
$scrollX = $tabX + (3 * $tabStep)
|
||||||
|
Draw-ScaledBitmap $Graphics $dockTab $scrollX $Y 18 22
|
||||||
|
Draw-ScaledBitmap $Graphics $prev ($scrollX + 5) ($Y + 2) 8 8
|
||||||
|
Draw-ScaledBitmap $Graphics $next ($scrollX + 5) ($Y + 12) 8 8
|
||||||
|
}
|
||||||
|
|
||||||
|
function Save-Mockup {
|
||||||
|
param(
|
||||||
|
[string]$Name,
|
||||||
|
[bool]$Compact,
|
||||||
|
[bool]$Floating
|
||||||
|
)
|
||||||
|
|
||||||
|
$canvas = New-Canvas 260 220
|
||||||
|
$bmp = $canvas.Bitmap
|
||||||
|
$graphics = $canvas.Graphics
|
||||||
|
try {
|
||||||
|
$guiX = 42
|
||||||
|
$guiY = 28
|
||||||
|
Draw-ScaledBitmap $graphics $bagNamer $guiX $guiY $bagNamer.Width $bagNamer.Height
|
||||||
|
|
||||||
|
if ($Floating) {
|
||||||
|
$stripX = $guiX + 18
|
||||||
|
$stripY = $guiY + $bagNamer.Height + 12
|
||||||
|
} else {
|
||||||
|
$stripX = $guiX + 2
|
||||||
|
$stripY = if ($Compact) { $guiY + $bagNamer.Height - 2 } else { $guiY + $bagNamer.Height - 3 }
|
||||||
|
}
|
||||||
|
|
||||||
|
Draw-StandardStrip $graphics $stripX $stripY $Compact
|
||||||
|
$bmp.Save((Join-Path $outDir $Name), [System.Drawing.Imaging.ImageFormat]::Png)
|
||||||
|
} finally {
|
||||||
|
$graphics.Dispose()
|
||||||
|
$bmp.Dispose()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Save-Mockup 'rename_docked_normal.png' $false $false
|
||||||
|
Save-Mockup 'rename_docked_compact.png' $true $false
|
||||||
|
Save-Mockup 'rename_floating_horizontal_normal.png' $false $true
|
||||||
|
Save-Mockup 'rename_floating_horizontal_compact.png' $true $true
|
||||||
|
|
||||||
|
$bagNamer.Dispose()
|
||||||
|
$tabBase.Dispose()
|
||||||
|
$tabOverlay.Dispose()
|
||||||
|
$compactBase.Dispose()
|
||||||
|
$compactOverlay.Dispose()
|
||||||
|
$dockTab.Dispose()
|
||||||
|
$gear.Dispose()
|
||||||
|
$lock.Dispose()
|
||||||
|
$prev.Dispose()
|
||||||
|
$next.Dispose()
|
||||||
|
$bagBase.Dispose()
|
||||||
|
$bagOverlay.Dispose()
|
||||||
@@ -49,6 +49,9 @@ public final class BagTabOverlay {
|
|||||||
private static final ResourceLocation PREV_ICON_TEXTURE = BagTabs.id("textures/gui/dock_prev.png");
|
private static final ResourceLocation PREV_ICON_TEXTURE = BagTabs.id("textures/gui/dock_prev.png");
|
||||||
private static final ResourceLocation NEXT_ICON_TEXTURE = BagTabs.id("textures/gui/dock_next.png");
|
private static final ResourceLocation NEXT_ICON_TEXTURE = BagTabs.id("textures/gui/dock_next.png");
|
||||||
private static final ResourceLocation POPUP_TEXTURE = BagTabs.id("textures/gui/dock_config_popup.png");
|
private static final ResourceLocation POPUP_TEXTURE = BagTabs.id("textures/gui/dock_config_popup.png");
|
||||||
|
private static final ResourceLocation BOOKMARK_TEXTURE = BagTabs.id("textures/gui/bookmark.png");
|
||||||
|
private static final ResourceLocation NORMAL_FILL_GAUGE_TEXTURE = BagTabs.id("textures/gui/normal_fill_gauge.png");
|
||||||
|
private static final ResourceLocation NORMAL_ACTIVE_TAB_TEXTURE = BagTabs.id("textures/gui/normal_active_tab.png");
|
||||||
private static final int BASE_TAB_WIDTH = 22;
|
private static final int BASE_TAB_WIDTH = 22;
|
||||||
private static final int BASE_TAB_HEIGHT = 22;
|
private static final int BASE_TAB_HEIGHT = 22;
|
||||||
private static final int BASE_COMPACT_TAB_WIDTH = 22;
|
private static final int BASE_COMPACT_TAB_WIDTH = 22;
|
||||||
@@ -59,6 +62,12 @@ public final class BagTabOverlay {
|
|||||||
private static final int POPUP_WIDTH = 140;
|
private static final int POPUP_WIDTH = 140;
|
||||||
private static final int POPUP_HEIGHT = 160;
|
private static final int POPUP_HEIGHT = 160;
|
||||||
private static final int POPUP_TITLE_HEIGHT = 16;
|
private static final int POPUP_TITLE_HEIGHT = 16;
|
||||||
|
private static final int BOOKMARK_WIDTH = 3;
|
||||||
|
private static final int BOOKMARK_HEIGHT = 7;
|
||||||
|
private static final int NORMAL_FILL_GAUGE_WIDTH = 2;
|
||||||
|
private static final int NORMAL_FILL_GAUGE_HEIGHT = 18;
|
||||||
|
private static final int NORMAL_ACTIVE_TAB_WIDTH = 20;
|
||||||
|
private static final int NORMAL_ACTIVE_TAB_HEIGHT = 4;
|
||||||
private static final int TAB_GAP = 0;
|
private static final int TAB_GAP = 0;
|
||||||
private static final int TAB_Y_OFFSET = -3;
|
private static final int TAB_Y_OFFSET = -3;
|
||||||
private static final int TAB_X_OFFSET = -6;
|
private static final int TAB_X_OFFSET = -6;
|
||||||
@@ -629,6 +638,11 @@ public final class BagTabOverlay {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void renderFullnessIndicator(GuiGraphics g, RenderedTab tab, float fullness) {
|
private static void renderFullnessIndicator(GuiGraphics g, RenderedTab tab, float fullness) {
|
||||||
|
if (!tab.compact()) {
|
||||||
|
renderNormalFullnessIndicator(g, tab, fullness);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
int color = interpolateColor(0xFF65D96D, 0xFFD94A4A, fullness);
|
int color = interpolateColor(0xFF65D96D, 0xFFD94A4A, fullness);
|
||||||
if (tab.isVertical()) {
|
if (tab.isVertical()) {
|
||||||
int trackHeight = tab.height() <= 11 ? 1 : 2;
|
int trackHeight = tab.height() <= 11 ? 1 : 2;
|
||||||
@@ -659,6 +673,88 @@ public final class BagTabOverlay {
|
|||||||
g.fill(trackX + trackWidth, trackY, trackX + trackWidth + 1, trackY + trackHeight, 0xFF000000);
|
g.fill(trackX + trackWidth, trackY, trackX + trackWidth + 1, trackY + trackHeight, 0xFF000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void renderNormalFullnessIndicator(GuiGraphics g, RenderedTab tab, float fullness) {
|
||||||
|
int color = interpolateColor(0xFF6CCBFF, 0xFF2E86FF, fullness);
|
||||||
|
g.pose().pushPose();
|
||||||
|
g.pose().translate(0.0F, 0.0F, 10_000.0F);
|
||||||
|
if (tab.isVertical()) {
|
||||||
|
int gaugeX = tab.x() + Math.max(0, (tab.width() - NORMAL_FILL_GAUGE_HEIGHT) / 2);
|
||||||
|
int gaugeY = tab.y() + tab.height() - NORMAL_FILL_GAUGE_WIDTH - 1;
|
||||||
|
g.pose().pushPose();
|
||||||
|
g.pose().translate(gaugeX + (NORMAL_FILL_GAUGE_HEIGHT / 2.0F), gaugeY + (NORMAL_FILL_GAUGE_WIDTH / 2.0F), 0.0F);
|
||||||
|
g.pose().mulPose(Axis.ZP.rotationDegrees(-90.0F));
|
||||||
|
g.blit(
|
||||||
|
NORMAL_FILL_GAUGE_TEXTURE,
|
||||||
|
-(NORMAL_FILL_GAUGE_WIDTH / 2),
|
||||||
|
-(NORMAL_FILL_GAUGE_HEIGHT / 2),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NORMAL_FILL_GAUGE_WIDTH,
|
||||||
|
NORMAL_FILL_GAUGE_HEIGHT,
|
||||||
|
NORMAL_FILL_GAUGE_WIDTH,
|
||||||
|
NORMAL_FILL_GAUGE_HEIGHT
|
||||||
|
);
|
||||||
|
|
||||||
|
int usableHeight = NORMAL_FILL_GAUGE_HEIGHT - 2;
|
||||||
|
int fillHeight = Math.max(0, Math.min(usableHeight, Math.round(usableHeight * fullness)));
|
||||||
|
if (fillHeight > 0) {
|
||||||
|
int localLeft = -(NORMAL_FILL_GAUGE_WIDTH / 2) + 1;
|
||||||
|
int localTop = -(NORMAL_FILL_GAUGE_HEIGHT / 2) + 1 + (usableHeight - fillHeight);
|
||||||
|
int localBottom = -(NORMAL_FILL_GAUGE_HEIGHT / 2) + 1 + usableHeight;
|
||||||
|
g.fill(localLeft, localTop, localLeft + 1, localBottom, color);
|
||||||
|
}
|
||||||
|
g.pose().popPose();
|
||||||
|
g.pose().popPose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int gaugeX = tab.x() + tab.width() - NORMAL_FILL_GAUGE_WIDTH - 1;
|
||||||
|
int gaugeY = isFlippedHorizontalShell(tab) ? tab.y() + tab.height() - NORMAL_FILL_GAUGE_HEIGHT : tab.y();
|
||||||
|
boolean flippedVertical = isFlippedHorizontalShell(tab);
|
||||||
|
if (flippedVertical) {
|
||||||
|
g.pose().pushPose();
|
||||||
|
g.pose().translate(gaugeX + (NORMAL_FILL_GAUGE_WIDTH / 2.0F), gaugeY + (NORMAL_FILL_GAUGE_HEIGHT / 2.0F), 0.0F);
|
||||||
|
g.pose().scale(1.0F, -1.0F, 1.0F);
|
||||||
|
g.blit(
|
||||||
|
NORMAL_FILL_GAUGE_TEXTURE,
|
||||||
|
-(NORMAL_FILL_GAUGE_WIDTH / 2),
|
||||||
|
-(NORMAL_FILL_GAUGE_HEIGHT / 2),
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NORMAL_FILL_GAUGE_WIDTH,
|
||||||
|
NORMAL_FILL_GAUGE_HEIGHT,
|
||||||
|
NORMAL_FILL_GAUGE_WIDTH,
|
||||||
|
NORMAL_FILL_GAUGE_HEIGHT
|
||||||
|
);
|
||||||
|
g.pose().popPose();
|
||||||
|
} else {
|
||||||
|
g.blit(
|
||||||
|
NORMAL_FILL_GAUGE_TEXTURE,
|
||||||
|
gaugeX,
|
||||||
|
gaugeY,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NORMAL_FILL_GAUGE_WIDTH,
|
||||||
|
NORMAL_FILL_GAUGE_HEIGHT,
|
||||||
|
NORMAL_FILL_GAUGE_WIDTH,
|
||||||
|
NORMAL_FILL_GAUGE_HEIGHT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
int usableHeight = NORMAL_FILL_GAUGE_HEIGHT - 2;
|
||||||
|
int fillHeight = Math.max(0, Math.min(usableHeight, Math.round(usableHeight * fullness)));
|
||||||
|
if (fillHeight > 0) {
|
||||||
|
if (flippedVertical) {
|
||||||
|
int fillTop = gaugeY + 1 + (usableHeight - fillHeight);
|
||||||
|
g.fill(gaugeX + 1, fillTop, gaugeX + 2, gaugeY + 1 + usableHeight, color);
|
||||||
|
} else {
|
||||||
|
int fillTop = gaugeY + 1 + (usableHeight - fillHeight);
|
||||||
|
g.fill(gaugeX + 1, fillTop, gaugeX + 2, gaugeY + 1 + usableHeight, color);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
g.pose().popPose();
|
||||||
|
}
|
||||||
|
|
||||||
private static int interpolateColor(int start, int end, float t) {
|
private static int interpolateColor(int start, int end, float t) {
|
||||||
float clamped = Math.max(0.0F, Math.min(1.0F, t));
|
float clamped = Math.max(0.0F, Math.min(1.0F, t));
|
||||||
int sr = (start >> 16) & 0xFF;
|
int sr = (start >> 16) & 0xFF;
|
||||||
@@ -982,18 +1078,81 @@ public final class BagTabOverlay {
|
|||||||
if (!tab.pinned()) {
|
if (!tab.pinned()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int x = tab.x() + 2;
|
|
||||||
int y = tab.y() + 2;
|
g.pose().pushPose();
|
||||||
g.fill(x, y, x + 4, y + 1, 0xFFFFDA6B);
|
g.pose().translate(0.0F, 0.0F, 10_000.0F);
|
||||||
g.fill(x + 1, y + 1, x + 3, y + 4, 0xFFFFDA6B);
|
if (!tab.compact()) {
|
||||||
g.fill(x + 2, y + 4, x + 3, y + 5, 0xFFD94A4A);
|
if (!tab.isVertical()) {
|
||||||
|
int bookmarkX = tab.x() + 1;
|
||||||
|
int bookmarkY = isFlippedHorizontalShell(tab) ? tab.y() + tab.height() - BOOKMARK_HEIGHT : tab.y();
|
||||||
|
if (isFlippedHorizontalShell(tab)) {
|
||||||
|
g.blit(
|
||||||
|
BOOKMARK_TEXTURE,
|
||||||
|
bookmarkX,
|
||||||
|
bookmarkY,
|
||||||
|
0,
|
||||||
|
BOOKMARK_HEIGHT,
|
||||||
|
BOOKMARK_WIDTH,
|
||||||
|
-BOOKMARK_HEIGHT,
|
||||||
|
BOOKMARK_WIDTH,
|
||||||
|
BOOKMARK_HEIGHT
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
g.blit(
|
||||||
|
BOOKMARK_TEXTURE,
|
||||||
|
bookmarkX,
|
||||||
|
bookmarkY,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
BOOKMARK_WIDTH,
|
||||||
|
BOOKMARK_HEIGHT,
|
||||||
|
BOOKMARK_WIDTH,
|
||||||
|
BOOKMARK_HEIGHT
|
||||||
|
);
|
||||||
|
}
|
||||||
|
g.pose().popPose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
g.pose().pushPose();
|
||||||
|
pushTabTransform(g, tab);
|
||||||
|
g.blit(
|
||||||
|
BOOKMARK_TEXTURE,
|
||||||
|
1,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
BOOKMARK_WIDTH,
|
||||||
|
BOOKMARK_HEIGHT,
|
||||||
|
BOOKMARK_WIDTH,
|
||||||
|
BOOKMARK_HEIGHT
|
||||||
|
);
|
||||||
|
g.pose().popPose();
|
||||||
|
g.pose().popPose();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g.pose().pushPose();
|
||||||
|
pushTabTransform(g, tab);
|
||||||
|
blitScaled(g, BOOKMARK_TEXTURE, 1, 0, 2, 5, 0, 0, BOOKMARK_WIDTH, BOOKMARK_HEIGHT, BOOKMARK_WIDTH, BOOKMARK_HEIGHT);
|
||||||
|
g.pose().popPose();
|
||||||
|
g.pose().popPose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void renderSelectedIndicator(GuiGraphics g, RenderedTab tab, int baseWidth, int baseHeight) {
|
private static void renderSelectedIndicator(GuiGraphics g, RenderedTab tab, int baseWidth, int baseHeight) {
|
||||||
if (!tab.compact()) {
|
if (!tab.compact()) {
|
||||||
int highlightTop = Math.max(baseHeight - 3, 1);
|
int activeX = Math.max(0, (baseWidth - NORMAL_ACTIVE_TAB_WIDTH) / 2);
|
||||||
int highlightBottom = Math.max(baseHeight - 1, highlightTop + 1);
|
int activeY = baseHeight - NORMAL_ACTIVE_TAB_HEIGHT + 3;
|
||||||
g.fill(3, highlightTop, baseWidth - 3, highlightBottom, 0xFFD94A4A);
|
g.blit(
|
||||||
|
NORMAL_ACTIVE_TAB_TEXTURE,
|
||||||
|
activeX,
|
||||||
|
activeY,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
NORMAL_ACTIVE_TAB_WIDTH,
|
||||||
|
NORMAL_ACTIVE_TAB_HEIGHT,
|
||||||
|
NORMAL_ACTIVE_TAB_WIDTH,
|
||||||
|
NORMAL_ACTIVE_TAB_HEIGHT
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1006,6 +1165,10 @@ public final class BagTabOverlay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isFlippedHorizontalShell(RenderedTab tab) {
|
||||||
|
return !tab.isVertical() && Math.round(tab.rotationDegrees()) % 360 != 0;
|
||||||
|
}
|
||||||
|
|
||||||
private static void renderCompactLabel(GuiGraphics g, RenderedTab tab) {
|
private static void renderCompactLabel(GuiGraphics g, RenderedTab tab) {
|
||||||
Minecraft minecraft = Minecraft.getInstance();
|
Minecraft minecraft = Minecraft.getInstance();
|
||||||
int maxTextWidth = Math.max(8, tab.width() - 4);
|
int maxTextWidth = Math.max(8, tab.width() - 4);
|
||||||
|
|||||||
BIN
src/main/resources/assets/bagtabs/textures/gui/bookmark.png
Normal file
|
After Width: | Height: | Size: 399 B |
|
After Width: | Height: | Size: 399 B |
|
After Width: | Height: | Size: 362 B |