Show live Minecraft weather in dashboard
This commit is contained in:
1 parent
ce3be28d0c
commit
95e6d5e275
7 files changed
+94
-2
No files matched your search
@@ -80,6 +80,13 @@
|
||||
return `${String(hour12).padStart(2, '0')}:${String(minute).padStart(2, '0')} ${period}`;
|
||||
}
|
||||
|
||||
function formatWeather(weather) {
|
||||
const labels = {
|
||||
clear: 'Clear', rain: 'Rain', thunderstorm: 'Thunderstorm'
|
||||
};
|
||||
return labels[weather] || '—';
|
||||
}
|
||||
|
||||
function minimapBlockColor(name) {
|
||||
const block = String(name || '').replace(/^minecraft:/, '').toLowerCase();
|
||||
if (/water|bubble_column/.test(block)) return '#3979a5';
|
||||
@@ -644,6 +651,7 @@
|
||||
$('world-time').textContent = Number.isFinite(worldTime)
|
||||
? `${Math.floor(worldTime).toLocaleString()} t · ${formatWorldClock(worldTime)}`
|
||||
: '—';
|
||||
$('world-weather').textContent = online ? formatWeather(state.weather) : '—';
|
||||
if (lastMinimapData?.ready) {
|
||||
lastMinimapData.yaw = Number(state.yaw || 0);
|
||||
drawMinimap(lastMinimapData);
|
||||
|
||||
@@ -101,6 +101,7 @@
|
||||
<dl class="runtime-list">
|
||||
<div><dt>Game mode</dt><dd id="game-mode">—</dd></div>
|
||||
<div><dt>Time</dt><dd id="world-time">—</dd></div>
|
||||
<div><dt>Weather</dt><dd id="world-weather">—</dd></div>
|
||||
<div><dt>Active job</dt><dd id="job-state">IDLE</dd></div>
|
||||
<div><dt>Path nodes</dt><dd id="path-length">0</dd></div>
|
||||
<div><dt>Entities</dt><dd id="entity-count">0 mobs · 0 drops</dd></div>
|
||||
|
||||
Reference in new issue
Block a user