<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sasgaming.net/index.php?action=history&amp;feed=atom&amp;title=Minecraft%3ADensity_function</id>
	<title>Minecraft:Density function - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sasgaming.net/index.php?action=history&amp;feed=atom&amp;title=Minecraft%3ADensity_function"/>
	<link rel="alternate" type="text/html" href="https://wiki.sasgaming.net/index.php?title=Minecraft:Density_function&amp;action=history"/>
	<updated>2026-04-29T19:32:01Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.8</generator>
	<entry>
		<id>https://wiki.sasgaming.net/index.php?title=Minecraft:Density_function&amp;diff=102597&amp;oldid=prev</id>
		<title>SyncBot: Sync: new page from Minecraft</title>
		<link rel="alternate" type="text/html" href="https://wiki.sasgaming.net/index.php?title=Minecraft:Density_function&amp;diff=102597&amp;oldid=prev"/>
		<updated>2026-04-29T11:03:33Z</updated>

		<summary type="html">&lt;p&gt;Sync: new page from Minecraft&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Exclusive|java}}&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Density functions&amp;#039;&amp;#039;&amp;#039; make up mathematical expressions to obtain a number from a position, stored as [[Minecraft:JSON]] files within a [[Minecraft:data pack]] in the path &amp;lt;code&amp;gt;data/&amp;lt;namespace&amp;gt;/worldgen/density_function&amp;lt;/code&amp;gt;. They are referenced from the [[Minecraft:noise router]] in [[Minecraft:noise settings]].&lt;br /&gt;
&lt;br /&gt;
{{TOC|right}}&lt;br /&gt;
&lt;br /&gt;
== JSON format ==&lt;br /&gt;
A density function can be a constant number or an object.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type.&lt;br /&gt;
** Other additional fields depend on the value of {{Nbt|string|type}}, described below.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If the {{Nbt|string|type}} is &amp;lt;code&amp;gt;constant&amp;lt;/code&amp;gt;, a shorthand format is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|double}}: A constant number. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Marker functions ==&lt;br /&gt;
=== interpolated ===&lt;br /&gt;
Interpolates at each block in one cell based on the input density function value of some cells around. The size of each cell is &amp;lt;code&amp;gt;size_horizontal * 4&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;size_vertical * 4&amp;lt;/code&amp;gt;. Used often in combination with &amp;lt;code&amp;gt;flat_cache&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;interpolated&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input to be interpolated.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== flat_cache ===&lt;br /&gt;
Calculate the value per 4×4 column (Value at each block in one column is the same). And it is calculated only once per column, at Y=0. Used often in combination with &amp;lt;code&amp;gt;interpolated&amp;lt;/code&amp;gt;.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;flat_cache&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input to be cached.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== cache_2d ===&lt;br /&gt;
Only computes the input density once per horizontal position.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;cache_2d&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input to be cached.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== cache_once ===&lt;br /&gt;
If this density function is referenced twice, it is only computed once per block position.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;cache_once&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input to be cached.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== cache_all_in_cell ===&lt;br /&gt;
Used by the game onto &amp;lt;code&amp;gt;final_density&amp;lt;/code&amp;gt; and should not be referenced in data packs.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;cache_all_in_cell&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input to be cached.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mapped density functions ==&lt;br /&gt;
=== abs ===&lt;br /&gt;
Calculates the absolute value of the input density function.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;abs&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== square ===&lt;br /&gt;
Squares the input. (&amp;lt;code&amp;gt;x^2&amp;lt;/code&amp;gt;)&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;square&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== cube ===&lt;br /&gt;
Cubes the input (&amp;lt;code&amp;gt;x^3&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;cube&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== half_negative ===&lt;br /&gt;
If the input is negative, returns half of the input. Otherwise returns the input. (&amp;lt;code&amp;gt;x &amp;lt; 0 ? x/2 : x&amp;lt;/code&amp;gt;)&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;half_negative&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== quarter_negative ===&lt;br /&gt;
If the input is negative, returns a quarter of the input. Otherwise returns the input. (&amp;lt;code&amp;gt;x &amp;lt; 0 ? x/4 : x&amp;lt;/code&amp;gt;)&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;quarter_negative&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== squeeze ===&lt;br /&gt;
First clamps the input between −1 and 1, then transforms it using x/2 - x*x*x/24.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;squeeze&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== invert ===&lt;br /&gt;
Inverts the input (&amp;lt;code&amp;gt;1/x&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;invert&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Functions with two arguments ==&lt;br /&gt;
=== add ===&lt;br /&gt;
Adds two density functions together.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;add&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument1}}: {{json ref/density function}} &amp;amp;mdash; The first input of the calculation.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument2}}: {{json ref/density function}} &amp;amp;mdash; The second input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== mul ===&lt;br /&gt;
Multiplies two inputs.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;mul&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument1}}: {{json ref/density function}} &amp;amp;mdash; The first input of the calculation.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument2}}: {{json ref/density function}} &amp;amp;mdash; The second input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== min ===&lt;br /&gt;
Returns the minimum of two inputs.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;min&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument1}}: {{json ref/density function}} &amp;amp;mdash; The first input of the calculation.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument2}}: {{json ref/density function}} &amp;amp;mdash; The second input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== max ===&lt;br /&gt;
Returns the maximum of two inputs.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;max&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument1}}: {{json ref/density function}} &amp;amp;mdash; The first input of the calculation.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument2}}: {{json ref/density function}} &amp;amp;mdash; The second input of the calculation.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Other density functions ==&lt;br /&gt;
=== blend_alpha ===&lt;br /&gt;
Used in vanilla for smooth transition to chunks generated in old versions.{{Info needed}}&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;blend_alpha&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== blend_offset ===&lt;br /&gt;
Used in vanilla for smooth transition to chunks generated in old versions.{{Info needed}}&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;blend_offset&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== blend_density ===&lt;br /&gt;
Used in vanilla for smooth transition to chunks generated in old versions.{{Info needed}}&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;blend_density&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}} &amp;amp;mdash; The desired density of new chunks.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== beardifier ===&lt;br /&gt;
Adds beards for structures (see the &amp;lt;code&amp;gt;terrain_adaptation&amp;lt;/code&amp;gt; field in [[Minecraft:Structure/JSON format|structures]]). Its value is added to the &amp;lt;code&amp;gt;final_density&amp;lt;/code&amp;gt; in noise setting by the game. Should not be referenced in data packs.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;beardifier&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== old_blended_noise ===&lt;br /&gt;
Samples a legacy noise. {{Info needed}}&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;old_blended_noise&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|double|xz_scale}}: Value between 0.001 and 1000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|double|y_scale}}: Value between 0.001 and 1000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|double|xz_factor}}: Value between 0.001 and 1000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|double|y_factor}}: Value between 0.001 and 1000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|double|smear_scale_multiplier}}: Value between 1.0 and 8.0 (both inclusive).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== noise ===&lt;br /&gt;
Samples a [[Minecraft:Custom_noise|noise]].&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;noise&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string|noise}}: {{json ref|noise|Custom noise}} &amp;amp;mdash; The noise to sample.&lt;br /&gt;
** {{Nbt|double|xz_scale}}: Scales the X and Z before sampling.&lt;br /&gt;
** {{Nbt|double|y_scale}}: Scales the Y before sampling.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== end_islands ===&lt;br /&gt;
Samples at current position using a noise algorithm used for end islands. Its minimum value is −0.84375 and its maximum value is 0.5625.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;end_islands&amp;lt;/code&amp;gt;).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== weird_scaled_sampler ===&lt;br /&gt;
{{in development|section=1|JE||26.2|removed=1}}&lt;br /&gt;
According to the input value, scales and enhances (or weakens) some regions of the specified noise, and then returns the absolute value.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;weird_scaled_sampler&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string|rarity_value_mapper}}: Can be &amp;lt;code&amp;gt;type_1&amp;lt;/code&amp;gt;（The minimum scale is 0.75, and the maximum is 2.0）or &amp;lt;code&amp;gt;type_2&amp;lt;/code&amp;gt;（The minimum scale is 0.5, and the maximum is 3.0.)&lt;br /&gt;
** {{Nbt|string|noise}}: {{json ref|noise|Custom noise}} &amp;amp;mdash; The noise to sample.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|input}}: The input density function. Can be an ID of a density function, or a density function in the form of a JSON object or a constant number.&lt;br /&gt;
&amp;lt;/div&amp;gt;&amp;lt;!--&lt;br /&gt;
TYPE2&lt;br /&gt;
			if (d &amp;lt; −0.75) {&lt;br /&gt;
				return 0.5;&lt;br /&gt;
			} else if (d &amp;lt; −0.5) {&lt;br /&gt;
				return 0.75;&lt;br /&gt;
			} else if (d &amp;lt; 0.5) {&lt;br /&gt;
				return 1.0;&lt;br /&gt;
			} else {&lt;br /&gt;
				return d &amp;lt; 0.75 ? 2.0 : 3.0;&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
TYPE1&lt;br /&gt;
			if (d &amp;lt; −0.5) {&lt;br /&gt;
				return 0.75;&lt;br /&gt;
			} else if (d &amp;lt; 0.0) {&lt;br /&gt;
				return 1.0;&lt;br /&gt;
			} else {&lt;br /&gt;
				return d &amp;lt; 0.5 ? 1.5 : 2.0;&lt;br /&gt;
			}&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== shifted_noise ===&lt;br /&gt;
Similar to &amp;lt;code&amp;gt;noise&amp;lt;/code&amp;gt;, but first shifts the input coordinates.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;shifted_noise&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string|noise}}: {{json ref|noise|Custom noise}} &amp;amp;mdash; The noise to sample.&lt;br /&gt;
** {{Nbt|double|xz_scale}}: Scales the X and Z before sampling.&lt;br /&gt;
** {{Nbt|double|y_scale}}: Scales the Y before sampling.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|shift_x}}: {{json ref/density function}} &amp;amp;mdash; offset of the position in the X direction.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|shift_y}}: {{json ref/density function}} &amp;amp;mdash; offset of the position in the Y direction.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|shift_z}}: {{json ref/density function}} &amp;amp;mdash; offset of the position in the Z direction.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== range_choice ===&lt;br /&gt;
Computes the input value, and depending on that result returns one of two other density functions. Basically an if-then-else statement.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;range_choice&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|input}}: {{json ref/density function}} &amp;amp;mdash; The value to compare&lt;br /&gt;
** {{Nbt|double|min_inclusive}}: The lower bound of the range. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|double|max_exclusive}}: The upper bound of the range. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|when_in_range}}:  {{json ref/density function}} &amp;amp;mdash; Used when the input is inside the range.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|when_out_of_range}}:  {{json ref/density function}} &amp;amp;mdash; Used when the input is outside the range.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== shift_a ===&lt;br /&gt;
Samples a noise at &amp;lt;code&amp;gt;(x/4, 0, z/4)&amp;lt;/code&amp;gt;, then multiplies it by 4.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;shift_a&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string|argument}}: {{json ref|noise|Custom noise}} &amp;amp;mdash; The noise to sample.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== shift_b ===&lt;br /&gt;
Samples a noise at &amp;lt;code&amp;gt;(z/4, x/4, 0)&amp;lt;/code&amp;gt;, then multiplies it by 4.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;shift_b&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string|argument}}: {{json ref|noise|Custom noise}} &amp;amp;mdash; The noise to sample.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== shift ===&lt;br /&gt;
Samples a noise at &amp;lt;code&amp;gt;(x/4, y/4, z/4)&amp;lt;/code&amp;gt;, then multiplies it by 4.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;shift&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string|argument}}: {{json ref|noise|Custom noise}} &amp;amp;mdash; The noise to sample.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== clamp ===&lt;br /&gt;
Clamps the input between two values.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;clamp&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|double}}{{Nbt|compound|input}}: One &amp;#039;&amp;#039;&amp;#039;density function&amp;#039;&amp;#039;&amp;#039; (a new {{Nbt|double}}{{Nbt|compound}} density function definition, an {{Nbt|string|}}[[Minecraft:resource location|ID]] is not allowed here&amp;lt;ref&amp;gt;{{cite bug|MC|252814|Clamp density function takes a direct input and doesn&amp;#039;t allow a reference|date=June 11, 2022}}&amp;lt;/ref&amp;gt;) &amp;amp;mdash; The input to clamp.&lt;br /&gt;
** {{Nbt|double|min}}: The lower bound. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|double|max}}: The upper bound. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== spline ===&lt;br /&gt;
Computes a cubic spline.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;spline&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|float}}{{Nbt|compound|spline}}: The spline. Can be either a number or an object.&lt;br /&gt;
*** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|coordinate}}: {{json ref/density function}} &amp;amp;mdash; Input determining the location on the spline.&lt;br /&gt;
*** {{Nbt|list|points}}: (Cannot be empty) List of points of the cubic spline.&lt;br /&gt;
**** {{Nbt|compound}}: A point of the cubic spline.&lt;br /&gt;
***** {{Nbt|float|location}}: The location of this point.&lt;br /&gt;
***** {{Nbt|float}}{{Nbt|compound|value}}: The value of this point. Can be either a number or a spline object.&lt;br /&gt;
***** {{Nbt|float|derivative}}: The slope at this point.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== constant ===&lt;br /&gt;
A constant value.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;constant&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|double|argument}}: A constant value. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== y_clamped_gradient ===&lt;br /&gt;
Clamps the Y coordinate between &amp;lt;code&amp;gt;from_y&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;to_y&amp;lt;/code&amp;gt; and then linearly maps it to a range.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;y_clamped_gradient&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|int|from_y}}: The value to be mapped to &amp;lt;code&amp;gt;from_value&amp;lt;/code&amp;gt;. Value between −4064 and 4062 (both inclusive).&lt;br /&gt;
** {{Nbt|int|to_y}}: The value to be mapped to &amp;lt;code&amp;gt;to_value&amp;lt;/code&amp;gt;. Value between −4064 and 4062 (both inclusive).&lt;br /&gt;
** {{Nbt|double|from_value}}: The value to map &amp;lt;code&amp;gt;from_y&amp;lt;/code&amp;gt; to. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|double|to_value}}: The value to map &amp;lt;code&amp;gt;to_y&amp;lt;/code&amp;gt; to. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== find_top_surface ===&lt;br /&gt;
Scans through a column of an input density and returns the topmost y-level that is above 0. If no such position exists withing the bounds, the {{Nbt|int|lower_bound}} is returned.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;find_top_surface&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|density}}: {{json ref/density function}} &amp;amp;mdash; The density function to scan.&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|upper_bound}}: {{json ref/density function}} &amp;amp;mdash; The y-level to start the scan at. Usually a 2D density function.&lt;br /&gt;
** {{Nbt|int|lower_bound}}: The y-level to stop the scan.&lt;br /&gt;
** {{Nbt|int|cell_height}}: The resolution of the scan. E.g. if set to &amp;lt;code&amp;gt;4&amp;lt;/code&amp;gt;, then only every 4th block is checked.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Removed density functions ==&lt;br /&gt;
{{outdated|section=1}}&lt;br /&gt;
&lt;br /&gt;
=== slide ===&lt;br /&gt;
Removed in [[Minecraft:22w12a]]&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;slide&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|argument}}: {{json ref/density function}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== The legacy &amp;quot;spline&amp;quot; ===&lt;br /&gt;
Removed in [[Minecraft:22w11a]]&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;spline&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|float}}{{Nbt|compound|spline}}: The spline. Can be either a number or an object.&lt;br /&gt;
*** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|coordinate}}: {{json ref/density function}} &amp;amp;mdash; Input determining the location on the spline.&lt;br /&gt;
*** {{Nbt|list|points}}: (Cannot be empty) List of points of the cubic spline.&lt;br /&gt;
**** {{Nbt|float|location}}: The location of this point.&lt;br /&gt;
**** {{Nbt|float}}{{Nbt|compound|value}}: The value of this point. Can be either a number or a spline object.&lt;br /&gt;
**** {{Nbt|float|derivative}}: The slope at this point.&lt;br /&gt;
** {{Nbt|double|min_value}}: The min value of the output. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|double|max_value}}: The max value of the output. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== terrain_shaper_spline ===&lt;br /&gt;
Removed in [[Minecraft:22w11a]]&lt;br /&gt;
&lt;br /&gt;
Calculate the spline from the noise settings.&lt;br /&gt;
&amp;lt;div class=&amp;quot;treeview&amp;quot;&amp;gt;&lt;br /&gt;
* {{nbt|compound}}: Root object.&lt;br /&gt;
** {{Nbt|string|type}}: The ID of the density function type (in this case, &amp;lt;code&amp;gt;terrain_shaper_spline&amp;lt;/code&amp;gt;).&lt;br /&gt;
** {{Nbt|string|spline}}: Can be &amp;lt;code&amp;gt;offset&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;factor&amp;lt;/code&amp;gt;, or&amp;lt;code&amp;gt;jaggedness&amp;lt;/code&amp;gt;.&lt;br /&gt;
** {{Nbt|double|min_value}}: The min value of the output. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|double|max_value}}: The max value of the output. Value between −1000000.0 and 1000000.0 (both inclusive).&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|continentalness}}: {{json ref/density function}}&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|erosion}}: {{json ref/density function}}&lt;br /&gt;
** {{Nbt|string}}{{Nbt|double}}{{Nbt|compound|weirdness}}: {{json ref/density function}}&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== History ==&lt;br /&gt;
{{HistoryTable&lt;br /&gt;
|{{HistoryLine|java}}&lt;br /&gt;
|{{HistoryLine||1.18.2|dev=pre1|Added density functions: {{cd|d=and|abs|add|beardifier|blend_alpha|blend_density|blend_offset|cache_2d|cache_all_in_cell|cache_once|clamp|constant|cube|end_islands|flat_cache|half_negative|interpolated|max|min|mul|noise|old_blended_noise|quarter_negative|range_choice|shift|shift_a|shift_b|shifted_noise|slide|square|squeeze|terrain_shaper_spline|weird_scaled_sampler|y_clamped_gradient}}. }}&lt;br /&gt;
|{{HistoryLine|||dev=pre2|Added density function {{cd|spline}}. }}&lt;br /&gt;
|{{HistoryLine||1.19|dev=22w11a|Removed density function {{cd|terrain_shaper_spline}}.|Removed {{cd|min_value}} and {{cd|max_value}} fields in {{cd|spline}}. }}&lt;br /&gt;
|{{HistoryLine|||dev=22w12a|Removed density function {{cd|slide}}. Instead a combination of {{cd|d=and|add|mul|y_clamped_gradient}} is used to achieve the same result.|&lt;br /&gt;
Added fields to {{cd|old_blended_noise}} density function: xz_scale, y_scale, xz_factor, y_factor, and smear_scale_multiplier.}}&lt;br /&gt;
|{{HistoryLine||1.21.9|dev=25w31a|Added density functions {{cd|minecraft:find_top_surface}} and {{cd|minecraft:invert}}.}}&lt;br /&gt;
|{{HistoryLine|java upcoming}}&lt;br /&gt;
|{{HistoryLine||26.2|dev=snap5|Added density function {{cd|minecraft:interval_select}}.|Removed density function {{cd|minecraft:weird_scale_sampler}}. Its functionality has been replaced with {{cd|interval_select}}.}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
== Issues ==&lt;br /&gt;
{{issue list|projects=MC}}&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
== External links ==&lt;br /&gt;
* [https://misode.github.io/worldgen/density-function/ Density Function Generator on misode.github.io]&lt;br /&gt;
&lt;br /&gt;
== Navigation ==&lt;br /&gt;
{{Navbox Java Edition technical|datapack}}&lt;br /&gt;
&lt;br /&gt;
[[Minecraft:de:Dichtefunktion]]&lt;br /&gt;
[[Minecraft:fr:Fonction de densité]]&lt;br /&gt;
[[Minecraft:ko:밀도 함수]]&lt;br /&gt;
[[Minecraft:pt:Função de densidade]]&lt;br /&gt;
[[Minecraft:zh:密度函数]]&lt;/div&gt;</summary>
		<author><name>SyncBot</name></author>
	</entry>
</feed>