Mods / Additional Spawn Constraints

Category: #Tweak #Utility
Author: Zach2039
Side: Both
Created: May 21st at 11:17 PM
Last modified: May 23rd at 8:05 PM
Downloads: 320
Follow Unfollow 9

Latest file for Various v1.19.x:
additionalspawnconstraints_1.0.1.zip 1-click install


Additional Spawn Constraints

A server-side dependency mod that allows JSON mods and patching to control various spawn conditions; does nothing on its own!

Overview

AdditionalSpawnConstraints will look for an additionalSpawnConstraints object inside an entity's /attributes object. This can be included on new entity JSON files, or patched in via JSON.

An example for some properties is below, applied via a patch to drifter.json:

[
	{
		"side": "Server",
		"file": "game:entities/land/drifter.json",
		"op": "addmerge",
		"path": "/attributes/additionalSpawnConstraints",
		"value": {
			"changeTemporalStormSpawnMechanics": true,
			"canSpawnOn":[
				"game:sand-*",
				"game:gravel-*",
				"game:dirtygravel",
				"game:sludgygravel",
				"game:muddygravel",
				"game:soil-*",
				"game:forestfloor-*",
				"game:peat-*",
				"game:rock-*",
				"game:crackedrock-*",
				"game:regolith-*",
				"game:ore-gem-*",
				"game:ore-graded-*",
				"game:ore-ungraded-*"
			]
		}
	}
]

The properties that can be set within additionalSpawnConstraints are:

  • "minRegionStability" : The minimum region stablity required when spawning the entity; does not take into account rifts nor rift proximity.

  • "maxRegionStability" : The maximum region stablity required when spawning the entity; does not take into account rifts nor rift proximity.

  • "canSpawnOn" : A list of block codes that are valid for spawning the entity on; supports globs and regex to handle variants.

  • "cannotSpawnOn" : A list of block codes that are not valid for spawning the entity on; supports globs and regex to handle variants.

  • "changeTemporalStormSpawnMechanics" : Determines if other properties can affect temporal storm spawning, where applicable; default is false if unspecified. Does not apply to "minRegionStability" or "maxRegionStability". Only affects entities that are spawned during storms.

Future Plans

  • Properties related to health scaling on spawn.

Known Issues

  • None, atm.

Mods That Use This

  • Natural Spawns : Limits drifters to spawning on soil and other natural blocks, even during storms.

Extras

  • Thanks to Thalius for testing help.

Version For Game version Downloads Release date Changelog Download 1-click mod install*
v1.0.1 193 May 23rd at 8:05 PM Show additionalspawnconstraints_1.0.1.zip Install now
v1.0.0 126 May 22nd at 1:15 AM Show additionalspawnconstraints_1.0.0.zip Install now

3 Comments (oldest first | newest first)

💬 Zach2039Author, May 22nd at 11:48 PM

Maamessu

That should be possible with vanilla's RuntimeSpawnConditions and WorldGenSpawnConditions, I think. The reason these are attributes on the entities class is I did not know how to extend SpawnConditions in an easy way.

For min/max stability properties, it is based on the vanilla's region stability. There is a heatmap of world stability that is queried with an x, y, and z coordinate. Player stability has no effect on these spawn constraint properties.

💬 Maamessu, May 22nd at 4:24 PM

Would it be possible to add a y value for spawn conditions, so that we can set spawns to be underground only, or sea level only, or mountain only, etc?

I'm also not entirely sure how min/max stability works. Is it calculating based on chunk stability or player stability?

💬 Maamessu, May 22nd at 4:14 PM

Just wanted to say I think this is super cool. Thanks for working on it!

(edit comment delete)