Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display markers for signs #40

Merged
merged 43 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f79edb4
core/common: add better explanation to file meta version definitions
neocturne Jan 8, 2024
0988ebe
core/tile_mipmapper: fix file meta version for mipmap tiles
neocturne Jan 8, 2024
f78dd79
world/de: add deserialization of sign block entities
neocturne Nov 24, 2023
61d4568
world: implement decoding raw JSON text into a linear list of formatt…
neocturne Nov 25, 2023
638d504
world/chunk: change Chunk into a struct
neocturne Nov 25, 2023
f0e0db6
world: process sign data, prepare for serialization
neocturne Nov 25, 2023
5d40d06
io/storage: split out inner part of read/write
neocturne Nov 26, 2023
c44f6ab
io/storage: add JSON support
neocturne Nov 26, 2023
7297c03
core/region_processor: store processed block entities for each region
neocturne Nov 25, 2023
825cf70
core: split TileCollector trait out of TileMipmapper
neocturne Nov 26, 2023
e36ae46
world: add Eq + Ord to all block entity types
neocturne Nov 26, 2023
7740ce0
core/region_processor: sort processed block entities
neocturne Nov 26, 2023
0f30878
core: split TileMerger out of TileMipmapper
neocturne Nov 26, 2023
1143396
core: use debug format for logging errors
neocturne Nov 26, 2023
cde6a4b
core: merge entity data for all regions into one file
neocturne Nov 26, 2023
d29c0df
core/metadata_writer: write entity list for viewer
neocturne Nov 26, 2023
1874d30
resource: fix typo in doc comment
neocturne Dec 29, 2023
8814dcf
resource: split BlockType in Copy and !Copy parts
neocturne Dec 30, 2023
abf87e7
resource: add sign material to block types
neocturne Dec 29, 2023
48a6e24
resource: add WallSign flag to block types
neocturne Dec 30, 2023
9aacd9c
resource: make regular signs transparent
neocturne Jan 5, 2024
fb36114
world: add sign position and material information to block entities
neocturne Dec 30, 2023
6da921c
core: wrap long help texts
neocturne Jan 4, 2024
9fd5689
core: add sign pattern command line argument handling
neocturne Jan 4, 2024
a1dd77c
world/sign: implement Display for SignText
neocturne Jan 5, 2024
87d4371
core/metadata_writer: implement filtering for signs
neocturne Jan 5, 2024
dca9c39
viewer: display markers for signs
neocturne Nov 26, 2023
7834315
viewer: add sign images
neocturne Jan 6, 2024
43d7dc7
viewer: allow zooming to level 5
neocturne Jan 6, 2024
989428f
viewer: use sign icons instead of default markers
neocturne Jan 6, 2024
ac0fd06
viewer: add icon shadows
neocturne Jan 7, 2024
31de0dc
viewer: sign popup styling
neocturne Jan 7, 2024
76df56c
viewer: sort signs at the same x/z coordinates from top to bottom
neocturne Jan 7, 2024
7b3ac86
viewer: store URL paramters in a 'params' variable
neocturne Jan 7, 2024
7daddd6
viewer: include open marker in URL
neocturne Jan 7, 2024
625f2a1
core/metadata_writer: add enabled features to metadata
neocturne Jan 7, 2024
08f84fa
viewer: do not show sign layer when the feature is disabled
neocturne Jan 7, 2024
3d024c6
viewer: update opened marker popup on URL hash change
neocturne Jan 7, 2024
643035e
viewer: switch to modern fetch API, do not cache metadata and entity …
neocturne Jan 7, 2024
0352168
README.md: add description of sign feature
neocturne Jan 10, 2024
6299c87
CHANGELOG.md: add sign layer
neocturne Jan 10, 2024
05d8fae
resource: README.md: sign-related updates
neocturne Jan 11, 2024
e18761a
resource: extract.py: pass directory of unpacked Minecraft JAR, not f…
neocturne Jan 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## [Unreleased] - ReleaseDate

### Added

- Added sign layer

This feature is disabled by default. Use the `--sign-prefix` and `--sign-filter` options to
configure which signs to show on the map.

### Changed

- Without `--verbose`, only a single warning is printed at the end of
Expand Down
102 changes: 98 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pre-release-replacements = [
[dependencies]
anyhow = "1.0.68"
bincode = "1.3.3"
clap = { version = "4.1.4", features = ["derive"] }
clap = { version = "4.1.4", features = ["derive", "wrap_help"] }
fastnbt = "2.3.2"
futures-util = "0.3.28"
git-version = "0.3.5"
Expand All @@ -52,6 +52,7 @@ minedmap-types = { version = "0.1.2", path = "crates/types" }
num-integer = "0.1.45"
num_cpus = "1.16.0"
rayon = "1.7.0"
regex = "1.10.2"
rustc-hash = "1.1.0"
serde = { version = "1.0.152", features = ["rc", "derive"] }
serde_json = "1.0.99"
Expand Down
30 changes: 29 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ based on [Leaflet](https://leafletjs.com/). The map renderer is heavily inspired
## How to use

Minecraft stores its save data in a directory `~/.minecraft/saves` on Linux,
and `C:\Users\<username>\AppData\Roaming\.minecraft\saves`. To generate minedmap
and `C:\Users\<username>\AppData\Roaming\.minecraft\saves`. To generate MinedMap
tile data from a save game called "World", use the a command like the following
(replacing the first argument with the path to your save data; `viewer` refers
to the directory where you unpacked the MinedMap viewer):
Expand All @@ -47,6 +47,34 @@ This test server is very slow and cannot handle multiple requests concurrently,
a proper webserver like [nginx](https://nginx.org/) or upload the viewer together with
the generated map files to public webspace to make the map available to others.

### Signs

![Sign screenshot](https://raw.githubusercontent.com/neocturne/MinedMap/e5d9c813ba3118d04dc7e52e3dc6f48808a69120/docs/images/signs.png)

MinedMap can display sign markers on the map, which will open a popup showing
the sign text when clicked.

Generation of the sign layer is disabled by default. It can be enabled by passing
the `--sign-prefix` or `--sign-filter` options to MinedMap. The options allow
to configure which signs should be displayed, and they can be passed multiple
times to show every sign that matches at least one prefix or filter.

`--sign-prefix` will make all signs visible the text of which starts with the
given prefix, so something like `--sign-prefix '[Map]'` would allow to put up
signs that start with "\[Map\]" in Minecraft to add markers to the map. An
empty prefix (`--sign-prefix ''`) can be used to make *all* signs visible on
the map.

`--sign-filter` can be used for more advanced filters based on regular expressions.
`--sign-filter '\[Map\]'` would show all signs that contain "\[Map\]"
anywhere in their text, and `--sign-filter '.'` makes all non-empty signs (signs
containing at least one character) visible. See the documentation of the
[regex crate](https://docs.rs/regex) for more information on the supported syntax.

All prefixes and filters are applied to the front and back text separately, but
both the front and the back text will be shown in the popup when one of them
matches.

## Installation

Binary builds of the map generator for Linux and Windows, as well as an archive
Expand Down
10 changes: 5 additions & 5 deletions crates/resource/src/block_color.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Functions for computations of block colors

use super::{Biome, BlockType, Color, Colorf};
use super::{Biome, BlockColor, Color, Colorf};

/// Converts an u8 RGB color to a float vector
fn color_vec_unscaled(color: Color) -> Colorf {
Expand Down Expand Up @@ -91,18 +91,18 @@ const BIRCH_COLOR: Colorf = Colorf::new(0.502, 0.655, 0.333); // == color_vec(Co
/// Color multiplier for spruce leaves
const EVERGREEN_COLOR: Colorf = Colorf::new(0.380, 0.600, 0.380); // == color_vec(Color([97, 153, 97]))

/// Determined if calling [block_color] for a given [BlockType] needs biome information
pub fn needs_biome(block: BlockType) -> bool {
/// Determined if calling [block_color] for a given [BlockColor] needs biome information
pub fn needs_biome(block: BlockColor) -> bool {
use super::BlockFlag::*;

block.is(Grass) || block.is(Foliage) || block.is(Water)
}

/// Determined the block color to display for a given [BlockType]
/// Determined the block color to display for a given [BlockColor]
///
/// [needs_biome] must be used to determine whether passing a [Biome] is necessary.
/// Will panic if a [Biome] is necessary, but none is passed.
pub fn block_color(block: BlockType, biome: Option<&Biome>, depth: f32) -> Colorf {
pub fn block_color(block: BlockColor, biome: Option<&Biome>, depth: f32) -> Colorf {
use super::BlockFlag::*;

let get_biome = || biome.expect("needs biome to determine block color");
Expand Down
Loading
Loading