mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Batch 6 part 3: structure locating, decoding contract, minor cuts
Finding 45: StructureLocator is the one locating service (startedStructures, locatableStarts, locateStart, ChunkFilter moved from VanillaStructures). StartMemo is one opaque non-empty text. VanillaStructureStart.identity is deleted; the host only stored it. useExpansionHack and legacyAir stay: both mirror platform structure behaviour any structure module needs. Finding 46: DESIGN.md documents one decoding contract (fields read by name, absent or null members keep the initialiser, unknown enum names are errors, the host never writes null). Value type getters stop null-guarding. NoiseStyle.cacheSize is deleted. @Desc texts rewritten. multiplier stays on NoiseStyle: it is also an object placement's warp strength. Finding 47: LinkedBiomes moves to world and takes the dimension's settings as PackSettings. Optional packages move from ModuleInfo to the jar manifest (Iris-Optional-Packages); PackageName moves into the host. PlacementRequest.id is dropped (nothing read it).
This commit is contained in:
1 parent
6b24e6f150
commit
1bc91df048
30 files changed
+308
-314
No files matched your search
@@ -5,10 +5,11 @@ import com.volmit.resource.ResourceId;
|
||||
import com.volmit.world.PackWorld;
|
||||
import java.util.Set;
|
||||
|
||||
/** Finds the structures a module places, for the host's structure commands and index. Structures are named by their
|
||||
* ids: a pack's own structure by the id {@link PackResources#idOf} gives its key ({@code overworld:villages/plains}),
|
||||
/** Finds the structures a module places, for the host's structure commands, index and locate. Structures are named by
|
||||
* their ids: a pack's own structure by the id {@link PackResources#idOf} gives its key ({@code overworld:villages/plains}),
|
||||
* a platform structure by the platform's id ({@code minecraft:ancient_city}). The host asks the providers in order and
|
||||
* sends an id to the first that places it in the world ({@link #placed}).
|
||||
* sends an id to the first that places it in the world: {@link #placed} for the structures the module places itself,
|
||||
* {@link #locatableStarts} for the platform structures it starts ({@link VanillaStructures#starts}).
|
||||
*/
|
||||
@Service(Providers.FIRST)
|
||||
public interface StructureLocator {
|
||||
@@ -37,4 +38,37 @@ public interface StructureLocator {
|
||||
* host calls it off the server's main thread.
|
||||
*/
|
||||
LocateResult locate(PackWorld world, ResourceId structure, int fromX, int fromZ, int maxRadiusChunks);
|
||||
|
||||
/** The platform structures this module starts itself in {@code world} ({@link VanillaStructures#starts}), wherever
|
||||
* its own placements put them. The host's locate and structure commands send them to {@link #locateStart}.
|
||||
*/
|
||||
default Set<ResourceId> startedStructures(PackWorld world) {
|
||||
return Set.of();
|
||||
}
|
||||
|
||||
/** Those of {@link #startedStructures} whose starts {@link #locateStart} can find in {@code world}: a start whose
|
||||
* placement can never start in the world's height, for one, cannot be searched for.
|
||||
*/
|
||||
default Set<ResourceId> locatableStarts(PackWorld world) {
|
||||
return Set.of();
|
||||
}
|
||||
|
||||
/**
|
||||
* The start of the platform structure {@code structure} this module makes nearest to the column {@code fromX},
|
||||
* {@code fromZ} (world coordinates), searched ring by ring outward through its placements' grids up to {@code maxRings}
|
||||
* rings: the nearest start of the first ring that has one. The position is the start's origin: world X and Z, and Y the
|
||||
* height above the dimension's bottom of its base. Only chunks {@code accepts} allows count; the host checks the start
|
||||
* the platform made there and searches again without a chunk it refuses. An exception {@code accepts} throws ends the
|
||||
* search and reaches the caller. Called with a structure from {@link #locatableStarts}, off the server's main thread.
|
||||
*/
|
||||
default LocateResult locateStart(PackWorld world, ResourceId structure, int fromX, int fromZ, int maxRings,
|
||||
ChunkFilter accepts) {
|
||||
return LocateResult.NOT_FOUND;
|
||||
}
|
||||
|
||||
/** Which chunks a {@link #locateStart} search may answer with. */
|
||||
@FunctionalInterface
|
||||
interface ChunkFilter {
|
||||
boolean accepts(int chunkX, int chunkZ);
|
||||
}
|
||||
}
|
||||
@@ -10,10 +10,8 @@ import com.volmit.vanilla.VanillaStructureRule;
|
||||
import com.volmit.vanilla.VanillaStructureSetup;
|
||||
import com.volmit.vanilla.VanillaStructureStart;
|
||||
import com.volmit.vanilla.VanillaStructureStartContext;
|
||||
import com.volmit.world.PackWorld;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
/** A module's say over the platform's own structures, the ones Minecraft, data packs and mods register, in the pack's
|
||||
* worlds. The host asks every provider, in module id order:
|
||||
@@ -32,7 +30,8 @@ import java.util.Set;
|
||||
* from the pack (its settings and resources) and never from where a start would be. Rules combine with
|
||||
* {@link VanillaStructureRule#and}: any module may block the platform's starts. Shifts add up; reaches are all covered;
|
||||
* setups combine with {@link VanillaStructureSetup#and}. Every method may be called from any thread, concurrently, but
|
||||
* one chunk's {@link StructureFit} is used on one thread.
|
||||
* one chunk's {@link StructureFit} is used on one thread. Finding the starts a module makes is
|
||||
* {@link StructureLocator}'s, the one service that locates structures.
|
||||
*/
|
||||
@Service(Providers.ALL)
|
||||
public interface VanillaStructures {
|
||||
@@ -93,37 +92,4 @@ public interface VanillaStructures {
|
||||
default VanillaStructureSetup setup(VanillaStructureContext context) {
|
||||
return VanillaStructureSetup.UNCHANGED;
|
||||
}
|
||||
|
||||
/** The platform structures this module starts itself in {@code world} ({@link #starts}), wherever its own placements put
|
||||
* them. The host's locate and structure commands send them to {@link #locateStart}.
|
||||
*/
|
||||
default Set<ResourceId> startedStructures(PackWorld world) {
|
||||
return Set.of();
|
||||
}
|
||||
|
||||
/** Those of {@link #startedStructures} whose starts {@link #locateStart} can find in {@code world}: a start whose
|
||||
* placement can never start in the world's height, for one, cannot be searched for.
|
||||
*/
|
||||
default Set<ResourceId> locatableStarts(PackWorld world) {
|
||||
return Set.of();
|
||||
}
|
||||
|
||||
/**
|
||||
* The start of the platform structure {@code structure} this module makes nearest to the column {@code fromX},
|
||||
* {@code fromZ} (world coordinates), searched ring by ring outward through its placements' grids up to {@code maxRings}
|
||||
* rings: the nearest start of the first ring that has one. The position is the start's origin: world X and Z, and Y the
|
||||
* height above the dimension's bottom of its base. Only chunks {@code accepts} allows count; the host checks the start
|
||||
* the platform made there and searches again without a chunk it refuses. An exception {@code accepts} throws ends the
|
||||
* search and reaches the caller. Called with a structure from {@link #locatableStarts}, off the server's main thread.
|
||||
*/
|
||||
default LocateResult locateStart(PackWorld world, ResourceId structure, int fromX, int fromZ, int maxRings,
|
||||
ChunkFilter accepts) {
|
||||
return LocateResult.NOT_FOUND;
|
||||
}
|
||||
|
||||
/** Which chunks a {@link #locateStart} search may answer with. */
|
||||
@FunctionalInterface
|
||||
interface ChunkFilter {
|
||||
boolean accepts(int chunkX, int chunkZ);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user