diff --git a/core/src/main/java/art/arcane/iris/studio/bridge/StudioBridge.java b/core/src/main/java/art/arcane/iris/studio/bridge/StudioBridge.java index b889ad70c..e93b4d670 100644 --- a/core/src/main/java/art/arcane/iris/studio/bridge/StudioBridge.java +++ b/core/src/main/java/art/arcane/iris/studio/bridge/StudioBridge.java @@ -312,6 +312,7 @@ public final class StudioBridge implements AutoCloseable { world.name(), engine.getDimension().getLoadKey(), engine.getDimension().getName(), + engine.getDimension().getVersion(), Long.toString(engine.getWorld().getRawWorldSeed()), engine.getMinHeight(), engine.getHeight(), @@ -819,7 +820,7 @@ public final class StudioBridge implements AutoCloseable { } /** @param seed as text, as JavaScript numbers cannot hold every long */ - private record WorldInfo(String world, String dimension, String dimensionName, String seed, int minY, int height, + private record WorldInfo(String world, String dimension, String dimensionName, int packVersion, String seed, int minY, int height, int fluidHeight, int tileSize, boolean hasPlayers, boolean hydrology, List views) { } diff --git a/studio/src/renderer/src/bridge/types.ts b/studio/src/renderer/src/bridge/types.ts index 178f6cb5d..5beaef684 100644 --- a/studio/src/renderer/src/bridge/types.ts +++ b/studio/src/renderer/src/bridge/types.ts @@ -305,6 +305,8 @@ export interface WorldInfo { world: string dimension: string dimensionName: string + /** The dimension's `version`; absent from a server that does not send it. */ + packVersion?: number seed: string minY: number height: number diff --git a/studio/src/renderer/src/studio/MapStudio.tsx b/studio/src/renderer/src/studio/MapStudio.tsx index 658595876..b774da892 100644 --- a/studio/src/renderer/src/studio/MapStudio.tsx +++ b/studio/src/renderer/src/studio/MapStudio.tsx @@ -1,6 +1,6 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' import type { BridgeClient, MapLayerQuery, WorldRect } from '../bridge/BridgeClient' -import type { MapHover, MapLabel, Marker, ModuleViewInfo, PickDisplay, ServerUsage, ViewInfo, WorldInfo } from '../bridge/types' +import type { MapHover, MapLabel, Marker, ModuleViewInfo, ServerUsage, ViewInfo, WorldInfo } from '../bridge/types' import type { Share } from '../map/census' import type { MapController, MapStatus, MapToggles } from '../map/MapController' import type { Highlight } from '../map/tileStyle' @@ -9,7 +9,7 @@ import { HelpDialog } from './HelpDialog' import { HoverCard } from './HoverCard' import { Legend } from './Legend' import { MapCanvas, type CanvasPoint } from './MapCanvas' -import { PickInspector } from './PickInspector' +import { PickInspector, hasPickSections } from './PickInspector' import { RegionPreviewList } from './RegionPreviewList' import { ImageMapStudio } from './ImageMapStudio' import { NoiseStudio } from './NoiseStudio' @@ -65,7 +65,6 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps const [notice, setNotice] = useState(null) const [connected, setConnected] = useState(true) const [preview, setPreview] = useState(null) - const [pickDisplay, setPickDisplay] = useState('picks') const [area, setArea] = useState(null) const [packRevision, setPackRevision] = useState(0) const [sceneSummary, setSceneSummary] = useState(null) @@ -100,7 +99,6 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps }, [notice]) useEffect(() => controller.current?.setView(layer.view, layer.preview), [layer]) - useEffect(() => controller.current?.setPickDisplay(pickDisplay), [pickDisplay]) useEffect(() => controller.current?.setToggles(toggles), [toggles]) useEffect(() => controller.current?.setHighlight(highlight), [highlight]) useEffect(() => controller.current?.setMarkers(players, toggles.entities ? entities : []), [players, entities, toggles.entities]) @@ -300,13 +298,9 @@ export function MapStudio({ client, world, theme, onDisconnect }: MapStudioProps )}
- {inspectsPicks && ( + {inspectsPicks && hasPickSections(inspection) && ( - + )} diff --git a/studio/src/renderer/src/studio/PickInspector.tsx b/studio/src/renderer/src/studio/PickInspector.tsx index be59df832..9936f2d4d 100644 --- a/studio/src/renderer/src/studio/PickInspector.tsx +++ b/studio/src/renderer/src/studio/PickInspector.tsx @@ -1,17 +1,13 @@ import { useState } from 'react' import { ScrollArea } from '@/components/ui/scroll-area' -import { ToggleGroup, ToggleGroupItem } from '@/components/ui/toggle-group' -import type { PickDisplay, PickInspection, PickSection } from '../bridge/types' +import type { PickInspection, PickSection } from '../bridge/types' import { Glyph } from './Glyph' import { hexColor } from './colors' import { NoiseChart, percent } from './NoiseChart' -/** How the map draws the picks, for a view that recolours its tiles. */ -export interface PickDisplayChoice { - /** What the map shows when it draws the picks: "Regions" or "Biomes". */ - picksLabel: string - value: PickDisplay - onChange(display: PickDisplay): void +/** Whether a measurement has anything to chart; a server that does not measure picks answers with no sections. */ +export function hasPickSections(inspection: PickInspection | null): inspection is PickInspection { + return inspection !== null && inspection.sections.length > 0 } interface PickInspectorProps { @@ -19,40 +15,15 @@ interface PickInspectorProps { title: string /** The latest measurement of the view; null until the first one arrives. */ inspection: PickInspection | null - /** Absent in a view that draws no map tiles, such as the 3D world. */ - display?: PickDisplayChoice } -/** - * How noise picks the regions or biomes in view, measured against what is in view, with a switch for how the map - * draws the picks. - */ -export function PickInspector({ title, inspection, display }: PickInspectorProps): React.JSX.Element { +/** How noise picks the regions or biomes in view, measured against what is in view. */ +export function PickInspector({ title, inspection }: PickInspectorProps): React.JSX.Element { return (

{title}

{inspection?.detail ?? 'Measuring what is in view…'}

- {display !== undefined && ( - value !== '' && display.onChange(value as PickDisplay)} - > - - {display.picksLabel} - - - Noise - - - Both - - - )}
{inspection !== null && }
diff --git a/studio/src/renderer/src/studio/StudioToolbar.tsx b/studio/src/renderer/src/studio/StudioToolbar.tsx index f39eaedfc..ebea95756 100644 --- a/studio/src/renderer/src/studio/StudioToolbar.tsx +++ b/studio/src/renderer/src/studio/StudioToolbar.tsx @@ -18,17 +18,17 @@ interface StudioToolbarProps { onDisconnect(): void } -/** The window's bar: the world the studio is connected to, which leads back to the world list, and the studio's own buttons. */ +/** The window's bar: the pack the studio is connected to, which leads back to the world list, and the studio's own buttons. */ export function StudioToolbar({ world, onHelp, onSettings, onDisconnect }: StudioToolbarProps): React.JSX.Element { return (
diff --git a/studio/src/renderer/src/studio/WorldStudio3D.tsx b/studio/src/renderer/src/studio/WorldStudio3D.tsx index e8ddb5a13..b671644d8 100644 --- a/studio/src/renderer/src/studio/WorldStudio3D.tsx +++ b/studio/src/renderer/src/studio/WorldStudio3D.tsx @@ -13,7 +13,7 @@ import { TerrainMeshWorkers } from '../scene/terrainMeshWorkers' import { focusAround, type TerrainStyle } from '../scene/terrainStream' import { TILE_COLUMNS } from '../scene/terrainTiles' import { Legend } from './Legend' -import { PickInspector } from './PickInspector' +import { PickInspector, hasPickSections } from './PickInspector' import { SceneViewport } from './SceneViewport' import { usePickInspection } from './usePickInspection' import { useSpotActions } from './useSpotActions' @@ -162,7 +162,7 @@ export function WorldStudio3D({ title, client, world, mapArea, packRevision, onS {showsCaves ? ( - ) : inspectsPicks ? ( + ) : inspectsPicks && hasPickSections(inspection) ? ( ) : (