public abstract class StructureFeature<C extends FeatureConfig> extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
StructureFeature.StructureStartFactory<C extends FeatureConfig> |
Constructor and Description |
---|
StructureFeature(com.mojang.serialization.Codec<C> codec) |
Modifier and Type | Method and Description |
---|---|
ConfiguredStructureFeature<C,? extends StructureFeature<C>> |
configure(C config) |
private StructureStart<C> |
createStart(int chunkX,
int chunkZ,
BlockBox boundingBox,
int referenceCount,
long worldSeed) |
com.mojang.serialization.Codec<ConfiguredStructureFeature<C,StructureFeature<C>>> |
getCodec() |
List<SpawnSettings.SpawnEntry> |
getCreatureSpawns() |
GenerationStep.Feature |
getGenerationStep()
Gets the step during which this structure will participate in world generation.
|
List<SpawnSettings.SpawnEntry> |
getMonsterSpawns() |
String |
getName() |
ChunkPos |
getStartChunk(StructureConfig config,
long worldSeed,
ChunkRandom placementRandom,
int chunkX,
int chunkY)
Determines the cell of the structure placement grid a chunk belongs to, and
returns the chunk within that cell, that this structure will actually be placed at.
|
abstract StructureFeature.StructureStartFactory<C> |
getStructureStartFactory() |
protected boolean |
isUniformDistribution()
If true, this structure's start position will be uniformly distributed within
a placement grid cell.
|
BlockPos |
locateStructure(WorldView world,
StructureAccessor structureAccessor,
BlockPos searchStartPos,
int searchRadius,
boolean skipExistingChunks,
long worldSeed,
StructureConfig config)
Tries to find the closest structure of this type near a given block.
|
static void |
method_28664() |
static StructureStart<?> |
readStructureStart(StructureManager manager,
CompoundTag tag,
long worldSeed) |
private static <F extends StructureFeature<?>> |
register(String name,
F structureFeature,
GenerationStep.Feature step) |
protected boolean |
shouldStartAt(ChunkGenerator chunkGenerator,
BiomeSource biomeSource,
long worldSeed,
ChunkRandom random,
int chunkX,
int chunkZ,
Biome biome,
ChunkPos chunkPos,
C config)
Checks if this structure can actually be placed at a potential structure position determined via
getStartChunk(net.minecraft.world.gen.chunk.StructureConfig, long, net.minecraft.world.gen.ChunkRandom, int, int) . |
StructureStart<?> |
tryPlaceStart(DynamicRegistryManager dynamicRegistryManager,
ChunkGenerator chunkGenerator,
BiomeSource biomeSource,
StructureManager structureManager,
long worldSeed,
ChunkPos chunkPos,
Biome biome,
int referenceCount,
ChunkRandom chunkRandom,
StructureConfig structureConfig,
C c)
Tries to place a starting point for this type of structure in the given chunk.
|
public static final BiMap<String,StructureFeature<?>> STRUCTURES
private static final Map<StructureFeature<?>,GenerationStep.Feature> STRUCTURE_TO_GENERATION_STEP
private static final Logger LOGGER
public static final StructureFeature<StructurePoolFeatureConfig> PILLAGER_OUTPOST
public static final StructureFeature<MineshaftFeatureConfig> MINESHAFT
public static final StructureFeature<DefaultFeatureConfig> MANSION
public static final StructureFeature<DefaultFeatureConfig> JUNGLE_PYRAMID
public static final StructureFeature<DefaultFeatureConfig> DESERT_PYRAMID
public static final StructureFeature<DefaultFeatureConfig> IGLOO
public static final StructureFeature<RuinedPortalFeatureConfig> RUINED_PORTAL
public static final StructureFeature<ShipwreckFeatureConfig> SHIPWRECK
public static final SwampHutFeature SWAMP_HUT
public static final StructureFeature<DefaultFeatureConfig> STRONGHOLD
public static final StructureFeature<DefaultFeatureConfig> MONUMENT
public static final StructureFeature<OceanRuinFeatureConfig> OCEAN_RUIN
public static final StructureFeature<DefaultFeatureConfig> FORTRESS
public static final StructureFeature<DefaultFeatureConfig> END_CITY
public static final StructureFeature<ProbabilityConfig> BURIED_TREASURE
public static final StructureFeature<StructurePoolFeatureConfig> VILLAGE
public static final StructureFeature<DefaultFeatureConfig> NETHER_FOSSIL
public static final StructureFeature<StructurePoolFeatureConfig> BASTION_REMNANT
public static final List<StructureFeature<?>> JIGSAW_STRUCTURES
private static final Identifier JIGSAW_ID
private static final Map<Identifier,Identifier> field_25839
private final com.mojang.serialization.Codec<ConfiguredStructureFeature<C extends FeatureConfig,StructureFeature<C extends FeatureConfig>>> codec
public StructureFeature(com.mojang.serialization.Codec<C> codec)
private static <F extends StructureFeature<?>> F register(String name, F structureFeature, GenerationStep.Feature step)
public GenerationStep.Feature getGenerationStep()
public static void method_28664()
@Nullable public static StructureStart<?> readStructureStart(StructureManager manager, CompoundTag tag, long worldSeed)
public com.mojang.serialization.Codec<ConfiguredStructureFeature<C,StructureFeature<C>>> getCodec()
public ConfiguredStructureFeature<C,? extends StructureFeature<C>> configure(C config)
@Nullable public BlockPos locateStructure(WorldView world, StructureAccessor structureAccessor, BlockPos searchStartPos, int searchRadius, boolean skipExistingChunks, long worldSeed, StructureConfig config)
This method relies on the given world generation settings (seed and placement configuration) to match the time at which the structure was generated, otherwise it will not be found.
New chunks will only be generated up to the ChunkStatus.STRUCTURE_STARTS
phase by this method.
searchRadius
- The search radius in chunks around the chunk the given block position is in. A radius of 0 will only search in the given chunk.null
if no structure could be found within the given search radiusprotected boolean isUniformDistribution()
public final ChunkPos getStartChunk(StructureConfig config, long worldSeed, ChunkRandom placementRandom, int chunkX, int chunkY)
If the StructureConfig
uses a separation setting greater than 0, the
placement will be constrained to [0, spacing - separation] within the grid cell.
If a non-uniform distribution is used for placement isUniformDistribution()
,
then this also moves the center towards the origin.
protected boolean shouldStartAt(ChunkGenerator chunkGenerator, BiomeSource biomeSource, long worldSeed, ChunkRandom random, int chunkX, int chunkZ, Biome biome, ChunkPos chunkPos, C config)
getStartChunk(net.minecraft.world.gen.chunk.StructureConfig, long, net.minecraft.world.gen.ChunkRandom, int, int)
. Specific structures override this method to reduce the spawn probability or
restrict the spawn in some other way.private StructureStart<C> createStart(int chunkX, int chunkZ, BlockBox boundingBox, int referenceCount, long worldSeed)
public StructureStart<?> tryPlaceStart(DynamicRegistryManager dynamicRegistryManager, ChunkGenerator chunkGenerator, BiomeSource biomeSource, StructureManager structureManager, long worldSeed, ChunkPos chunkPos, Biome biome, int referenceCount, ChunkRandom chunkRandom, StructureConfig structureConfig, C c)
If this structure doesn't have a starting point in the chunk, StructureStart.DEFAULT
will be returned.
public abstract StructureFeature.StructureStartFactory<C> getStructureStartFactory()
public String getName()
public List<SpawnSettings.SpawnEntry> getMonsterSpawns()
public List<SpawnSettings.SpawnEntry> getCreatureSpawns()