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
4 changes: 3 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ Never hold the whole region in memory or load the seed world on a normal boot

### Finding a place to start

`/boxadmin areas find <area> [seed|random] [radius]` (`AdminAreasFindCommand`) looks for good spots in a seed. `reach/SpotFinder` searches the vanilla biomes (no chunks needed) for wooded land with water nearby; the best few are generated in a throwaway `<worldname>/finder_<time>` world, using the area's biomes file laid out around every spot at once (`AbstractSeedBiomeProvider.setCentres`), and scored by `reach/SpotSurvey` (dry middle, then the box size that takes in logs, surface water, shallow stone, iron ore and coal). The world is unloaded without saving and deleted. An area uses a spot through `centre: x,z` in `areas.yml` (`Area.centreX/centreZ`, overworld only; the Nether template is still taken from 0,0).
`/boxadmin areas find <area> [seed|random] [radius]` (`AdminAreasFindCommand`) looks for good spots in a seed. `reach/SpotFinder` searches the vanilla biomes (no chunks needed) for wooded land with water nearby; the best few are generated in a throwaway `<worldname>/finder_<time>` world, using the area's biomes file laid out around every spot at once (`AbstractSeedBiomeProvider.setCentres`), and scored by `reach/SpotSurvey` (dry middle, then the box size that takes in logs, surface water, shallow stone, iron ore and coal). The world is unloaded without saving and deleted. An area uses a spot through `centre: x,z` in `areas.yml` (`Area.centreX/centreZ`) and `nether-centre: x,z` for the Nether. Fortresses have no structure templates, so they can only come from the land: after the overworld, the command locates the nearest fortresses in a throwaway Nether, generates each and uses `reach/FortressSpot` to suggest a `nether-centre` on open ground just clear of a blaze spawner.

`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.

### Deleted boxes

Expand Down
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ You can also do the same by hand: add the area to `areas.yml` and make a bluepri
| `/boxadmin areas` | Lists the areas with their row, seed and number of boxes. |
| `/boxadmin areas tp <area>` | Takes you to the land where the area's next box will be, so you can look at it and place structures before any player has a box there. |
| `/boxadmin areas create <name> [seed]` | Makes a new area and its blueprint bundle. Needs a restart. |
| `/boxadmin areas rebuild <area> [regenerate]` | Builds the area's land again at the next restart. With `regenerate` the seed worlds are thrown away first, which is needed after changing the area's seed, centre or biomes. Without it, the land is rebuilt from the seed worlds as they are, which keeps changes made to them by hand. |
| `/boxadmin areas rebuild <area> [regenerate]` | Builds the area's land again at the next restart. With `regenerate` the seed worlds are thrown away first, which is needed after changing the area's seed, centres or biomes. Without it, the land is rebuilt from the seed worlds as they are, which keeps changes made to them by hand. |
| `/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). |
Expand Down Expand Up @@ -182,7 +182,19 @@ The three best places are shown and the full list is written to `areas/<area>/sp
dry land (100% dry), wood at size 4, water at size 14, stone at size 1, iron ore at size 2, coal at size 2
```

To use a place, set the area's `seed` and `centre` in `areas.yml`, run `/boxadmin areas rebuild <area> regenerate` and restart the server. Boxes that players have already explored do not change, so do this before the area is in use. `centre` moves the overworld only. The Nether of an area is always taken from 0,0 of its seed.
To use a place, set the area's `seed` and `centre` in `areas.yml`, run `/boxadmin areas rebuild <area> regenerate` and restart the server. Boxes that players have already explored do not change, so do this before the area is in use. `centre` moves the overworld only. The Nether has its own setting, `nether-centre`.

#### The Nether fortress

Blaze rods and wither skulls only come from a fortress, and a fortress cannot be placed with `/boxadmin place` the way a bastion can, because the game builds fortresses from code and not from structure files. The only way to give boxes a fortress is to take the Nether from a part of the seed that has one. The search does this for you: it finds the fortresses nearest the middle of the seed's Nether and, for each, lists a `nether-centre` on open ground a short way from a blaze spawner:

```
nether-centre: 272,128 (fortress at size 12, blaze spawner at size 34)
```

If you move the Nether, structures you placed there by hand (the bastion in the default `structures.yml`, for example) will need to be placed again to suit the new land.

The Nether of a box is a copy, so the game does not know the fortress is there and would never spawn its mobs. Boxed does it instead: some of the mobs that spawn on nether bricks in the Nether become wither skeletons, blazes and skeletons, as often as they would in a real fortress. Blaze spawners are copied with the land and work as normal. Turn this off with `world.nether.fortress-mobs` in `config.yml`.

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.

Expand Down
9 changes: 6 additions & 3 deletions src/main/java/world/bentobox/boxed/Boxed.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
import world.bentobox.boxed.listeners.AdvancementListener;
import world.bentobox.boxed.listeners.BoxCleaner;
import world.bentobox.boxed.listeners.EnderPearlListener;
import world.bentobox.boxed.listeners.FortressMobsListener;
import world.bentobox.boxed.listeners.NewAreaListener;

/**
Expand Down Expand Up @@ -153,7 +154,8 @@ private boolean loadSettings() {
generatorMaps.put(area.seedWorldName(worldName, false), new BoxedSeedChunkGenerator(this,
Environment.NORMAL, new SeedBiomeGenerator(this, area.biomes(), area.centreX(), area.centreZ())));
generatorMaps.put(area.seedWorldName(worldName, true), new BoxedSeedChunkGenerator(this,
Environment.NETHER, new NetherSeedBiomeGenerator(this, area.biomes())));
Environment.NETHER, new NetherSeedBiomeGenerator(this, area.biomes(), area.netherCentreX(),
area.netherCentreZ())));
}

return true;
Expand Down Expand Up @@ -184,6 +186,7 @@ public void onEnable() {
// Register listeners
this.registerListener(new AdvancementListener(this));
this.registerListener(new EnderPearlListener(this));
this.registerListener(new FortressMobsListener(this));
newAreaListener = new NewAreaListener(this);
this.registerListener(newAreaListener);
boxCleaner = new BoxCleaner(this);
Expand Down Expand Up @@ -231,8 +234,8 @@ public void createWorlds() {
boolean regenerate = checkRebuildRequest(area);
loadTemplate(area, worldName, Environment.NORMAL, area.centreX(), area.centreZ(), regenerate);
if (settings.isNetherGenerate()) {
loadTemplate(area, worldName, Environment.NETHER, settings.getNetherSeedX(),
settings.getNetherSeedZ(), regenerate);
loadTemplate(area, worldName, Environment.NETHER, area.netherCentreX(), area.netherCentreZ(),
regenerate);
}
}
// Create overworld
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/world/bentobox/boxed/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,13 @@ public class Settings implements WorldSettings {
@ConfigEntry(path = "world.nether.generate")
private boolean netherGenerate = true;

@ConfigComment("Spawn fortress mobs in the Nether. The Nether of a box is copied block by block, so the")
@ConfigComment("game does not know where its fortress is and would never spawn wither skeletons there.")
@ConfigComment("With this on, some of the mobs that spawn on nether bricks become wither skeletons,")
@ConfigComment("blazes and skeletons, as often as they would in a real fortress.")
@ConfigEntry(path = "world.nether.fortress-mobs", since = "3.5.0")
private boolean netherFortressMobs = true;

@ConfigComment("This option indicates if nether portals should be linked via dimensions.")
@ConfigComment("Option will simulate vanilla portal mechanics that links portals together")
@ConfigComment("or creates a new portal, if there is not a portal in that dimension.")
Expand Down Expand Up @@ -640,6 +647,20 @@ public boolean isNetherGenerate() {
return netherGenerate;
}

/**
* @return true if fortress mobs are spawned on nether bricks in the Nether
*/
public boolean isNetherFortressMobs() {
return netherFortressMobs;
}

/**
* @param netherFortressMobs true to spawn fortress mobs on nether bricks in the Nether
*/
public void setNetherFortressMobs(boolean netherFortressMobs) {
this.netherFortressMobs = netherFortressMobs;
}

/**
* @return the netherIslands
*/
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/world/bentobox/boxed/areas/Area.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
* 0 means that just having a box in the area is enough.
* @param centreX block x in the overworld seed world that the middle of every box is taken from
* @param centreZ block z in the overworld seed world that the middle of every box is taken from
* @param netherCentreX block x in the Nether seed world that the middle of every box is taken from
* @param netherCentreZ block z in the Nether seed world that the middle of every box is taken from
* @author tastybento
*/
public record Area(String id, long seed, String biomes, String structures, int row, boolean enabled,
String requires, int unlockSize, int centreX, int centreZ) {
String requires, int unlockSize, int centreX, int centreZ,
int netherCentreX, int netherCentreZ) {

/**
* Name of the area that always exists
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/world/bentobox/boxed/areas/AreaManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ public AreaManager(YamlConfiguration config, File gridFile, long defaultSeed,
}
String requires = getRequirement(s, id, ids, errorLog);
int[] centre = parseCentre(s.getString("centre", s.getString("center", "")), id, errorLog);
int[] netherCentre = parseCentre(s.getString("nether-centre", s.getString("nether-center", "")), id,
errorLog);
Area area = new Area(id, s.getLong("seed", defaultSeed), s.getString("biomes", "biomes.yml"),
s.getString("structures", "structures.yml"), grid.getInt(path), s.getBoolean("enabled", true),
requires, Math.max(0, s.getInt("unlocks-next-at", 0)), centre[0], centre[1]);
requires, Math.max(0, s.getInt("unlocks-next-at", 0)), centre[0], centre[1], netherCentre[0], netherCentre[1]);
areas.put(id, area);
areaByRow.put(area.row(), area);
}
Expand Down
Loading
Loading