mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 08:44:50 +00:00
Place and locate structures through the api instead of the engine
Structure placement, its locator, the cave anchor resolver and the native start planner now take the pack world and its running world, and StructurePlacing writes through the mantle stage context and the placement graph. Terrain carving draws its noise from the pack's noise factory. The api gains clearBlock/clearAttached on PlacementTerrain, RunningWorld.carvedAt and VanillaStructureContext.world; modules get the host's seed purposes through their world view.
This commit is contained in:
1 parent
5ab99210b2
commit
3d209b393c
47 files changed
+1957
-1127
No files matched your search
@@ -48,6 +48,26 @@ public interface PlacementTerrain {
|
||||
*/
|
||||
void recordPlacement(int x, int y, int z, PlacementRecord placement);
|
||||
|
||||
/**
|
||||
* Takes back the block written at the position, so the terrain shows through there. The block entity, placement
|
||||
* record and markers kept beside it stay ({@link #clearAttached}).
|
||||
*
|
||||
* @throws UnsupportedOperationException when this terrain cannot take blocks back
|
||||
*/
|
||||
default void clearBlock(int x, int y, int z) {
|
||||
throw new UnsupportedOperationException("This terrain cannot take blocks back");
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes back the block entity, placement record and markers the host kept beside the block, whether or not a block
|
||||
* is still written there.
|
||||
*
|
||||
* @throws UnsupportedOperationException when this terrain cannot take them back
|
||||
*/
|
||||
default void clearAttached(int x, int y, int z) {
|
||||
throw new UnsupportedOperationException("This terrain cannot take what is kept beside a block back");
|
||||
}
|
||||
|
||||
/** The placement recorded at the block ({@link #recordPlacement}); empty when none is. */
|
||||
Optional<PlacementRecord> placementAt(int x, int y, int z);
|
||||
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.volmit.vanilla;
|
||||
|
||||
import com.volmit.config.PackSettings;
|
||||
import com.volmit.resource.PackResources;
|
||||
import com.volmit.world.PackWorld;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
/** The world a {@link com.volmit.service.VanillaStructures} provider decides for. Valid only while the provider runs. */
|
||||
public interface VanillaStructureContext {
|
||||
@@ -10,4 +13,9 @@ public interface VanillaStructureContext {
|
||||
|
||||
/** The module settings the world's dimension declares: its own, and every region and biome it can reach. */
|
||||
PackSettings settings();
|
||||
|
||||
/** The world the provider decides for; empty when it decides before any world exists, such as for the setup of a dimension. */
|
||||
default Optional<PackWorld> world() {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.volmit.world;
|
||||
import com.volmit.config.FeatureSettings;
|
||||
import com.volmit.data.SavedKey;
|
||||
import com.volmit.geometry.BlockPosition;
|
||||
import com.volmit.mantle.CarvedVoid;
|
||||
import com.volmit.placement.PlacementRecord;
|
||||
import com.volmit.resource.ResourceId;
|
||||
import java.util.List;
|
||||
@@ -43,6 +44,15 @@ public interface RunningWorld {
|
||||
*/
|
||||
Optional<PlacementRecord> placementAt(int worldX, int y, int worldZ);
|
||||
|
||||
/**
|
||||
* The void the cave carver planned at the block, as the world holds it now; empty where none was, or when the block's
|
||||
* chunk keeps no generation data any more, and on a platform that cannot read it. Y is the height above the
|
||||
* dimension's bottom.
|
||||
*/
|
||||
default Optional<CarvedVoid> carvedAt(int worldX, int y, int worldZ) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
/**
|
||||
* The value the module keeps with this world across restarts under {@code key}: the host's one instance of it for
|
||||
* the world, read from the world's storage the first time anyone asks (or {@code key.initial()} when none was
|
||||
|
||||
Reference in new issue
Block a user