Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class NecromodStructures {
- public static final DeferredRegister<Structure<?>> DEFERRED_REGISTRY_STRUCTURE = DeferredRegister.create(ForgeRegistries.STRUCTURE_FEATURES, Necromod.MODID);
- public static IStructurePieceType Secret_Room_Piece;
- public static final RegistryObject<Structure<NoFeatureConfig>> SECRET_ROOM = DEFERRED_REGISTRY_STRUCTURE.register("secret_room", () -> (new SecretRoomStructure(NoFeatureConfig.CODEC)));
- public static void setupStructures()
- {
- setupMapSpacingAndLand(
- SECRET_ROOM.get(), /* The instance of the structure */
- new StructureSeparationSettings(200 /* average distance apart in chunks between spawn attempts */,
- 100 /* minimum distance apart in chunks between spawn attempts. MUST BE LESS THAN ABOVE VALUE*/,
- 1234567890 /* this modifies the seed of the structure so no two structures always spawn over each-other. Make this large and unique. */),
- true);
- }
- public static <F extends Structure<?>> void setupMapSpacingAndLand(F structure, StructureSeparationSettings structureSeparationSettings, boolean transformSurroundingLand)
- {
- Structure.STRUCTURES_REGISTRY.put(structure.getRegistryName().toString(), structure);
- if(transformSurroundingLand){
- Structure.NOISE_AFFECTING_FEATURES =
- ImmutableList.<Structure<?>>builder()
- .addAll(Structure.NOISE_AFFECTING_FEATURES)
- .add(structure)
- .build();
- }
- DimensionStructuresSettings.DEFAULTS =
- ImmutableMap.<Structure<?>, StructureSeparationSettings>builder()
- .putAll(DimensionStructuresSettings.DEFAULTS)
- .put(structure, structureSeparationSettings)
- .build();
- WorldGenRegistries.NOISE_GENERATOR_SETTINGS.entrySet().forEach(settings -> {
- Map<Structure<?>, StructureSeparationSettings> structureMap = settings.getValue().structureSettings().structureConfig();
- if(structureMap instanceof ImmutableMap){
- Map<Structure<?>, StructureSeparationSettings> tempMap = new HashMap<>(structureMap);
- tempMap.put(structure, structureSeparationSettings);
- settings.getValue().structureSettings().structureConfig = tempMap;
- }
- else{
- structureMap.put(structure, structureSeparationSettings);
- }
- });
- }
- public static void registerStructurePieces()
- {
- Secret_Room_Piece = Registry.register(Registry.STRUCTURE_PIECE, new ResourceLocation(Necromod.MODID, "secret_room_template"), SecretRoomPiece.Piece::new);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement