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
6 changes: 6 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ Never hold the whole region in memory or load the seed world on a normal boot

`listeners/FortressMobsListener` makes a copied fortress work: natural spawns on nether bricks in the game Nether are swapped for wither skeletons, blazes and skeletons at vanilla fortress weights (`world.nether.fortress-mobs`). `LandSurvey` records spawners as the mob they make, and `requirements.yml` treats nether bricks as the fortress.

### Biome styles and the area workshop

`generators/biomes/BiomeLayout` reads one dimension of a biomes file and answers "which chosen biome is at dx,dz from the middle" (null = the seed's own). It supports per-quarter lists, `rings`, random `patches`, and `blend` (noise that bends the edges). `AbstractSeedBiomeProvider` only adds the centres and the vanilla fallback. `biomes.yml` is the "original" style; `biomes/*.yml` are the others (`workshop/BiomeStyles` maps names to files). With `blend: 0` the original layout must stay exactly as it was, because existing areas depend on it.

`workshop/WorkshopManager` runs the one workshop: temporary worlds `<worldname>/workshop` and `/workshop_nether` (folders inside the game world's folder, like seed worlds) made with the seed generator, peaceful, spawn limits 0. Its state (`workshop/Workshop`: seed, biomes file, source area, centres, the players inside and the game mode each had outside) is saved to `areas/workshop.yml` on every change and reloaded, with the worlds, in `onEnable`. `listeners/WorkshopListener` forces creative on entry, restores the game mode on exit, respawns in place, and sends players home if the workshop was discarded while they were offline (`areas/displaced.yml`). `/boxadmin areas edit` (`AdminAreasEditCommand`) holds the logic and can be typed; `WorkshopDialogs` is only the Paper dialog UI on top, and cannot be unit tested under MockBukkit. Still to build: spot scanning in the workshop, choosing the centre, structure logging and turning the workshop into an area without a restart.

### Deleted boxes

`listeners/BoxCleaner` restores a deleted (soft-deleted, `isDeletable()`) box's whole position from the template — generated chunks only, both dimensions, within a 10 ms per tick budget — then removes the island record so `AreaLocationStrategy` can hand the position out again (it always takes the first position in the row with no record). Do not rely on BentoBox's region-file purge for Boxed: it only deletes a region when every position overlapping it is deletable, and 640-block positions always share 512-block regions with neighbours. Deleted boxes are re-queued from the island cache on `BentoBoxReadyEvent`, so no extra persistence is needed.
Expand Down
58 changes: 52 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ You can also do the same by hand: add the area to `areas.yml` and make a bluepri
| `/boxadmin areas clean [x z]` | Puts the land of the box position you are in (or the one at x, z) back the way it was. Use it after trying out structures in a position nobody has a box in. Positions with a box in use are refused. |
| `/boxadmin areas check <area>` | Plays out how a box grows in the area and reports where players get stuck. See [Checking that an area can be played](#checking-that-an-area-can-be-played). |
| `/boxadmin areas find <area> [seed\|random] [radius]` | Looks through a seed for good places to start a box. See [Finding a good place to start](#finding-a-good-place-to-start). |
| `/boxadmin areas edit` | Opens the area workshop, where a new area is tried out in a temporary world. See [The area workshop](#the-area-workshop). |

Areas can be chained so that a player's box in one area has to reach a certain size before the next area is unlocked, and can be closed to new boxes:

Expand Down Expand Up @@ -199,15 +200,60 @@ The Nether of a box is a copy, so the game does not know the fortress is there a
A good start does not mean the area can be finished. Run `/boxadmin areas check <area>` after the restart to see how far a box there can grow.


### biomes.yml
The player's land has biomes and they are defined here. It's not possible to define where the biomes are right now, only what affect they have on the terrain.
### The area workshop

* height: the default height is 8. Lower numbers will produce lower land, higher higher land.
* scale: this is how smooth the land will be. Smaller numbers are more jagged, larger numbers are flatter.
The workshop is a set of temporary worlds for trying out a seed and a biome style before they become an area. **It is not finished yet:** today it makes the worlds and lets you look around and build in them. Picking the middle of the box, placing structures and turning the result into an area are still to come.

Setting ocean biomes to higher height numbers will result in the ocean floor being above the sea level and creating land.
Run `/boxadmin areas edit`. A dialog box asks for:

A lot of these numbers are rough guesses right now and if you come up with better values, please share them!
* **Area** - a new area, or an existing one to start from.
* **Seed** - leave it empty for a random seed, or to keep the seed of the area you picked. `-1` is always a random seed.
* **Biome style** - see [Biome styles](#biome-styles).

You are then taken to the temporary world. While you are there:

* Everyone who comes in is put in creative mode and gets their old game mode back when they leave. If you switch to survival and die, you come back where you died, in creative mode.
* The world is peaceful and nothing spawns, so nothing changes the land except you.
* You can leave and come back. The workshop, and everything built in it, stays until you discard it, including over a server restart. There is one workshop at a time, and other admins can join it.
* If you start from an existing area without changing its seed or biome style, the workshop starts as a copy of the land that area was built from, so changes made to it by hand are kept.

Run `/boxadmin areas edit` again to go back to it, go to its Nether, or discard it. Discarding sends everyone inside to their box (or to spawn if they have none) and deletes the temporary worlds. Players who were inside but offline are sent to their box when they next join.

Everything can also be typed, which is the only way from the console:

| Command | Description |
|---------|-------------|
| `/boxadmin areas edit start <seed\|random\|same> [biome style\|same] [area]` | Starts work on an area. `same` keeps the seed or biome style of the area named. |
| `/boxadmin areas edit go [nether]` | Goes to the area being worked on. From the console it just makes the world. |
| `/boxadmin areas edit discard confirm` | Throws away the area being worked on. |

The permission is `boxed.admin.areas.edit`.

### Biome styles

A box is small, so Boxed lays chosen biomes out around the middle of it to give players variety: snow, ice, desert, jungle and their plants and animals, all within reach. A biome style is a file that says how. The styles that come with Boxed are:

| Style | File | What it does |
|-------|------|--------------|
| `original` | `biomes.yml` | Each quarter of the box (north-east, south-east, north-west, south-west) has its own list of biomes by distance from the middle. The edges between biomes are straight. |
| `natural` | `biomes/natural.yml` | The same biomes as `original`, with the edges blended so that there are no straight lines. |
| `rings` | `biomes/rings.yml` | Biomes in rings around the middle, the same all the way round. |
| `random` | `biomes/random.yml` | Patches of biomes picked at random from a list. |
| `none` | `biomes/none.yml` | No chosen biomes. Every box has the biomes the seed has at that place. |

To make your own style, copy one of the files in the `biomes` folder, give it a new name and change it. It then appears in the workshop under that name. An area uses a style through its `biomes` setting in `areas.yml`, for example `biomes: biomes/natural.yml`.

A style file has a `distribution` section with a part for the `overworld` and a part for the `nether`. Each part uses one of:

* `north-east`, `south-east`, `north-west` and `south-west` - a list for each quarter of the box.
* `rings` - one list used all the way round.
* `patches` - a `size` in blocks and a list of `biomes`. Each patch gets one of the biomes at random. The patch in the middle always gets the first in the list. List a biome twice to make it twice as common.

The lists for quarters and rings are entries of `distance:BIOME`. The distance is a fraction of the area's radius (`world.area-radius` in `config.yml`), so `1.0` is the edge of the biggest possible box, and biomes can be set as far as `2.0`. `CUSTOM` means "leave the biome the seed has".

`blend` at the top of the file is how many blocks the edges between biomes wander. `0`, or leaving it out, gives straight edges.

Biomes are fixed when the land is generated. Changing a style does nothing to an area that is already built until you run `/boxadmin areas rebuild <area> regenerate` and restart.

### structures.yml
This file records which Minecraft structures should be placed in each new player's box when their area is first created. Structures are stored relative to the island center and are placed in overworld (`normal`) and nether sections.
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/world/bentobox/boxed/Boxed.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import java.util.Comparator;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;
Expand Down Expand Up @@ -65,6 +66,9 @@
import world.bentobox.boxed.listeners.EnderPearlListener;
import world.bentobox.boxed.listeners.FortressMobsListener;
import world.bentobox.boxed.listeners.NewAreaListener;
import world.bentobox.boxed.listeners.WorkshopListener;
import world.bentobox.boxed.workshop.BiomeStyles;
import world.bentobox.boxed.workshop.WorkshopManager;

/**
* Main Boxed class - provides a survival game inside a box
Expand Down Expand Up @@ -95,6 +99,7 @@ public class Boxed extends GameModeAddon {
private BoxCleaner boxCleaner;
private AbstractBoxedChunkGenerator netherGen;
private AreaManager areas;
private WorkshopManager workshop;


private final Config<Settings> configObject = new Config<>(this, Settings.class);
Expand All @@ -109,6 +114,10 @@ public void onLoad() {
saveDefaultConfig();
// Load settings from config.yml. This will check if there are any issues with it too.
loadSettings();
// The biome styles that come with Boxed. Admins add their own to the same folder.
for (String style : List.of("natural", "rings", "random", "none")) {
saveResource(BiomeStyles.FOLDER + "/" + style + ".yml", false);
}

// Register commands
playerCommand = new DefaultPlayerCommand(this) {};
Expand Down Expand Up @@ -191,6 +200,10 @@ public void onEnable() {
this.registerListener(newAreaListener);
boxCleaner = new BoxCleaner(this);
this.registerListener(boxCleaner);
// An area that was being worked on when the server stopped is still there
workshop = new WorkshopManager(this);
workshop.load();
this.registerListener(new WorkshopListener(this, workshop));

// Register placeholders
PlaceholdersManager phManager = new PlaceholdersManager(this);
Expand Down Expand Up @@ -367,6 +380,13 @@ public AreaManager getAreas() {
return areas;
}

/**
* @return the workshop, where admins make new areas
*/
public WorkshopManager getWorkshop() {
return workshop;
}

/**
* Gets the area that a chunk of the game world is in.
* @param chunkZ chunk z in the game world
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public void setup() {
new Clean(this);
new Check(this);
new AdminAreasFindCommand(this);
new AdminAreasEditCommand(this);
}

@Override
Expand Down
Loading
Loading