mojira.dev
MCPE-242145

Scatter interface grid distribution extents not offset properly

Scatter interfaces are used in feature rules and scatter features to distribute some child. These interfaces support grid distributions (fixed_grid and jittered_grid) for forming sequential 1D, 2D, and 3D forms. Unfortunately, the associated extents of these grid types can be misaligned. This occurs when the range given does not pass through 0. This makes working with scatter grids (an extremely common need in world generation) quite painful.

Demonstration

The attached video demonstrates this issue. 2 different scatter features are attempted. Both attempt to offset a grid (2, 0, 2) away from the input position (player’s feet), but both fail.

The first one attempts a basic, sensible extent for x and z: [2, 4] each. This should mean a 3 by 3 grid is created (2, 0, 2) away from the input position. But this does not work: both extents are being remapped to [0, 2].

{
	"format_version": "1.26.50",
	"minecraft:scatter_feature": {
		"description": {"identifier": "bug_features:glowstone_grid_1"},
		
		"places_feature": "bug_features:glowstone",
		"distribution": {
			"iterations": 9,
			"x": {"distribution": "fixed_grid", "extent": [2, 4]},
			"z": {"distribution": "fixed_grid", "extent": [2, 4]},
			"y": 0
		}
	}
}

The second one attempts the same but uses a grid_offset strategy. However, grid_offset doesn’t actually offset the whole alignment of the grid; such a property would be useless. Instead, it just changes where in the extent the offset begins. Since 9 features are placed over the 3 by 3 grid, this starting point information is lost, but it doesn’t serve to offset the grid as desired anyway.

{
  "format_version": "1.26.50",
  "minecraft:scatter_feature": {
    "description": {"identifier": "bug_features:glowstone_grid_2"},
    
    "places_feature": "bug_features:glowstone",
    "distribution": {
      "iterations": 9,
      "x": {"distribution": "fixed_grid", "extent": [0, 2], "grid_offset": 2},
      "z": {"distribution": "fixed_grid", "extent": [0, 2], "grid_offset": 2},
      "y": 0
    }
  }
}

Reproduction

The demo video and code are taken from the behavior pack in the attached world for convenience. This world can be opened (in Minecraft Preview) for inspection or unzipped to access the code associated with such.

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media][media]

Ciosciaa

(Unassigned)

Unconfirmed

Multiple

26.50.27 Preview

Retrieved