com.yungnickyoung.minecraft.yungsapi.api.YungJigsawManager Maven / Gradle / Ivy
Show all versions of YungsApi-1.21-Fabric Show documentation
package com.yungnickyoung.minecraft.yungsapi.api;
import com.yungnickyoung.minecraft.yungsapi.world.structure.jigsaw.JigsawManager;
import com.yungnickyoung.minecraft.yungsapi.world.structure.jigsaw.element.YungJigsawPoolElement;
import java.util.Optional;
import net.minecraft.class_2338;
import net.minecraft.class_2902;
import net.minecraft.class_2960;
import net.minecraft.class_3195;
import net.minecraft.class_3778;
import net.minecraft.class_3785;
import net.minecraft.class_6880;
import net.minecraft.class_9778;
import net.minecraft.class_9822;
/**
* No longer required as of 1.19.2 now that structures can be done in JSON. Instead, you can simply set the
* type
field in your structure JSON to yungsapi:yung_jigsaw
.
* An enhanced alternative to vanilla's {@link class_3778}.
*
* Uses an optimized piece selection algorithm, allowing much larger pool element weights without any performance cost.
* Includes additional pool element types to choose from for maximum flexibility when creating structures.
*
*
* The main feature of this algorithm is the addition of the {@link YungJigsawPoolElement} element types.
* These element types support additional behaviors such as limiting piece counts to a certain maximum, bounding possible y-values
* on a per-piece basis, and enforcing arbitrary piece placement conditions.
* For more information, see {@link YungJigsawPoolElement} and its subclasses.
*
*
* The {@link YungJigsawPoolElement} pool element subtypes should always be preferred over vanilla types.
* The MaxCount types are considered deprecated and should no longer be used. The {@link YungJigsawPoolElement} types
* now natively support max count limiting, and are more flexible.
*/
public class YungJigsawManager {
/**
* Entrypoint for assembling Jigsaw structures with YUNG's Jigsaw Manager.
*
* @param generationContext The generation context.
* @param startPool The StructureTemplatePool of the starting piece.
* @param startJigsawNameOptional An optional Resource Location specifying the Name field of a jigsaw block in the starting pool.
* If specified, the position of a matching jigsaw block will be used as the structure's starting position
* when generating the structure. This will become the target position of the /locate command.
* Ancient Cities use this to mark the city center as the starting position.
* @param maxDepth The max depth, in Jigsaw pieces, the structure can generate before stopping.
* @param startPos Position from which generation of this structure will start
* @param useExpansionHack Whether boundary adjustments should be performed on this structure.
* In vanilla, only villages and pillager outposts have this enabled.
* @param projectStartToHeightmap Heightmap to use for determining y-position. If provided, the startPos
* y-coordinate acts as an offset to this heightmap; otherwise, the startPos
* y-coordinate is an absolute world coordinate.
* @param maxDistanceFromCenter The radius of the maximum bounding box for the structure. Typical is 80.
* May need to be increased if your structure is particularly large.
* @param maxY Optional integer for specifying the max possible y-value of the structure.
* If provided, no pieces of the structure will generate above this value.
* @param minY Optional integer for specifying the min possible y-value of the structure.
* If provided, no pieces of the structure will generate below this value.
* @param dimensionPadding Dimension padding for the structure.
* @param liquidSettings Liquid settings for the structure.
*/
public static Optional assembleJigsawStructure(
class_3195.class_7149 generationContext,
class_6880 startPool,
Optional startJigsawNameOptional,
int maxDepth,
class_2338 startPos,
boolean useExpansionHack,
Optional projectStartToHeightmap,
int maxDistanceFromCenter,
Optional maxY,
Optional minY,
class_9778 dimensionPadding,
class_9822 liquidSettings
) {
return JigsawManager.assembleJigsawStructure(generationContext, startPool, startJigsawNameOptional, maxDepth,
startPos, useExpansionHack, projectStartToHeightmap, maxDistanceFromCenter, maxY, minY, dimensionPadding, liquidSettings);
}
}