Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
50 changes: 50 additions & 0 deletions openspec/specs/brush-menu/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,53 @@ Menu titles, item names and lore SHALL be resolved from the translation bundles.
#### Scenario: German client
- **WHEN** a German client opens the brush menu and a German bundle is installed
- **THEN** titles and item texts are German

### Requirement: Menu inventory is created on first open
The plugin SHALL NOT create a menu inventory for a player who has not opened the menu.

#### Scenario: Painting without the menu
- **WHEN** a player right-clicks with the brush item and paints, never opening the menu
- **THEN** no menu inventory has been created for that player

#### Scenario: First open
- **WHEN** the player opens the menu for the first time
- **THEN** exactly one menu inventory is created and rendered

### Requirement: Rendered menu text is cached
The plugin SHALL NOT render the same translation again for the same locale while neither the
translations nor the shown setting changed.

#### Scenario: Open twice
- **WHEN** a player opens the menu twice without changing any setting
- **THEN** the second open triggers no translation render

#### Scenario: Translations reloaded
- **WHEN** the translation bundles are reloaded and the player opens the menu
- **THEN** the text is rendered again

### Requirement: Updates need a viewer
A settings change SHALL NOT render the menu while the owner is not viewing it, and SHALL write only
the slots whose content changed while the owner is viewing it.

#### Scenario: Change while closed
- **WHEN** a setting changes and the menu is closed
- **THEN** no render happens until the next open, which shows the new value

#### Scenario: Change while open
- **WHEN** the player changes the brush size in the open menu
- **THEN** only the slots that show the size are written

### Requirement: Picker is built once per locale
The brush picker content SHALL be built once per locale, and every viewer SHALL get an inventory of
their own.

#### Scenario: Two players, same locale
- **WHEN** two players with the same locale open the picker
- **THEN** the content is built once and the two inventories are different instances

### Requirement: Equal heads are equal
Heads created from the same texture SHALL be equal.

#### Scenario: Same texture
- **WHEN** two heads are created from the same texture
- **THEN** the two item stacks are equal
93 changes: 93 additions & 0 deletions openspec/specs/brush-painting/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,96 @@ which thread computes the stroke.
#### Scenario: Deterministic test
- **WHEN** a brush runs twice against identical in-memory extents with the same seed
- **THEN** both runs change exactly the same positions to the same blocks

### Requirement: Stroke points are bounded
The Paint Brush SHALL store at most 256 points of an unfinished stroke per player and SHALL refuse
further points with a message while keeping the stored ones.

#### Scenario: Limit reached
- **WHEN** a player who already stored 256 points clicks again without sneaking
- **THEN** the point is not stored and the player receives the limit message

#### Scenario: Finish at the limit
- **WHEN** a player at the limit sneaks and clicks
- **THEN** the stroke is painted with the 256 stored points

### Requirement: Quitting releases brush state
When a player quits, the plugin SHALL remove that player's brush settings and unfinished stroke.

#### Scenario: Quit mid stroke
- **WHEN** a player with stored stroke points quits
- **THEN** neither the player brush nor the stroke points remain

### Requirement: Each world position is read at most once per stroke
A brush stroke SHALL read the block at any given position through the extent at most once while it
selects its candidates, regardless of how many filters (air, mask, surface, thickness) inspect it.

#### Scenario: Sphere with mask and surface filter
- **WHEN** a Spray brush stroke with a mask and the DIRECT surface mode runs against a counting extent
- **THEN** no position is read more than once

#### Scenario: Overlay with thickness
- **WHEN** an Overlay brush stroke with thickness 3 runs against a counting extent
- **THEN** no position is read more than once

#### Scenario: Bucket flood fill
- **WHEN** a Bucket brush stroke fills a connected region
- **THEN** each candidate position is read at most once

### Requirement: Paint brush computes its curve once per stroke
The Paint Brush SHALL derive the relative curve and its sample offsets once per stroke and SHALL
reuse them, translated, for every candidate block. Each position SHALL be placed at most once.

#### Scenario: Many candidates
- **WHEN** a Paint Brush stroke with several hundred candidate blocks runs
- **THEN** the curve is constructed exactly once

#### Scenario: Same result as per-block curves
- **WHEN** a Paint Brush stroke runs with a fixed seed
- **THEN** the set of positions on each candidate's curve equals the set the per-block construction produced

### Requirement: Height results are shared within a stroke
A stroke SHALL scan a given world column for a given height query at most once, and a brush SHALL
compute the self height of a candidate once.

#### Scenario: Fracture brush
- **WHEN** a Fracture brush stroke runs against a counting extent
- **THEN** no column scan for the same query repeats and the self height of each candidate is computed once

### Requirement: Random filters run before world reads
A brush whose candidate filter depends only on random numbers and geometry SHALL apply that filter
before any mask, surface or other world-reading filter. The probability that a candidate is
selected SHALL be unchanged; the sequence of random draws consumed MAY differ from earlier versions.

#### Scenario: Chance filter rejects first
- **WHEN** a Spray brush runs with chance 0 against a counting extent
- **THEN** no mask or surface read happens and no block changes

#### Scenario: Chance 100
- **WHEN** a Spray brush runs with chance 100
- **THEN** every candidate that passes the mask and surface checks is selected

#### Scenario: Seeded output may differ from earlier versions
- **WHEN** a Spray, Splatter or Gradient stroke runs with the same seed as in an earlier version
- **THEN** the positions MAY differ, while every selected position passes the mask and lies inside the sphere

### Requirement: Sphere selection is unchanged
Sphere selection SHALL include exactly the positions whose distance to the middle point is
strictly less than `size / 2`, SHALL exclude positions outside the build limits and, unless air is
requested, air positions.

#### Scenario: Boundary voxel
- **WHEN** a voxel lies exactly `size / 2` from the middle point
- **THEN** it is not selected

#### Scenario: Equivalence for several sizes
- **WHEN** sphere selection runs for sizes 1 through 21 around a fixed middle point
- **THEN** the selected set equals the set produced by the strict distance definition

### Requirement: Brush jitter does not use a cryptographic generator
A stroke SHALL take its random numbers from a fast seeded generator created per stroke, and
`StrokeContext` SHALL accept an injected generator so tests can fix the sequence.

#### Scenario: Injected random
- **WHEN** a test builds a stroke context with a seeded random and runs the same brush twice
- **THEN** both runs select the same positions
14 changes: 14 additions & 0 deletions openspec/specs/build-verification/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,17 @@ Every Java source file SHALL carry the GPL license header from `HEADER.txt`.
#### Scenario: New file without header
- **WHEN** a Java file without the header is added
- **THEN** `./gradlew build` fails in `spotlessJavaCheck` and `./gradlew spotlessApply` adds the header

### Requirement: Hot-path behaviour is verified without timing
The build SHALL verify the brush hot-path rules (read counts, curve computed once, sphere
equivalence, random filter order) with unit tests that count calls and compare selections. These
tests SHALL NOT sleep, read the system clock or assert elapsed time, and SHALL use fixed seeds and
a fresh extent per test.

#### Scenario: Extra world read introduced
- **WHEN** a change makes a stroke read one position twice
- **THEN** `./gradlew test` fails and names the position-count test

#### Scenario: Timing is never asserted
- **WHEN** the hot-path tests are searched for `Thread.sleep`, `System.nanoTime` and `Instant.now`
- **THEN** none is found
10 changes: 8 additions & 2 deletions openspec/specs/platform-compatibility/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,22 @@ supports, and how the plugin reacts when it is started in an unsuitable environm

### Requirement: Supported Minecraft versions
The plugin SHALL be published for, and SHALL load on, Paper for every Minecraft version in the
supported-versions list. The list SHALL contain 26.1.1, 26.1.2 and 26.2.
supported-versions list. The list SHALL contain 26.1.1, 26.1.2, 26.2 and 26.3. A Minecraft
version SHALL be added to the list once the current FastAsyncWorldEdit release supports it, and
not before. Minecraft versions below 26.1 SHALL NOT be supported.

#### Scenario: Release lists supported versions
- **WHEN** a release is published to Hangar and Modrinth
- **THEN** the release lists exactly the Minecraft versions of the supported-versions list

#### Scenario: Plugin loads on a supported version
- **WHEN** the plugin jar is placed on a Paper 26.2 server running Java 25 with FastAsyncWorldEdit 2.16.1
- **WHEN** the plugin jar is placed on a Paper 26.3 server running Java 25 with FastAsyncWorldEdit 2.16.1
- **THEN** the plugin enables without errors

#### Scenario: Version without FAWE support is not listed
- **WHEN** a Minecraft version has no adapter in the current FastAsyncWorldEdit release
- **THEN** it is not part of the supported-versions list

### Requirement: Java runtime
The plugin SHALL require Java 25 at runtime.

Expand Down
11 changes: 11 additions & 0 deletions openspec/specs/update-notification/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,14 @@ A failed or unparsable update check SHALL NOT log a stack trace at WARN or ERROR
#### Scenario: Invalid response
- **WHEN** Hangar answers with a body that is not a version
- **THEN** the plugin logs one debug line and keeps running

### Requirement: No HTTP client while checks are disabled
The plugin SHALL NOT create an HTTP client when `generic.check-for-updates` is `false`.

#### Scenario: Disabled
- **WHEN** `generic.check-for-updates` is `false` and the plugin enables
- **THEN** no HTTP client has been created

#### Scenario: Enabled
- **WHEN** `generic.check-for-updates` is `true` and the first check runs
- **THEN** one HTTP client is created and closed on shutdown
Loading