跳转至

End spike feature

The end_spike feature can be used to place end spikes (also known as obsidian pillars) in the world.

Configuration

The following configuration options are available:

Option Type Description
crystal_invulnerable (optional in Json, defaults to false) boolean Whether the crystals on top of the end spikes should be invulnerable.
spikes A List of EndSpikes. See below for more information The spikes to place. If the array is empty, the default end spikes are placed
crystal_beam_target (optional) A BlockPos (In Json, the BlockPos is represented via an array of coordinates. First element is the x coordinate and so on.) The target of the crystal beam.

In code, the SpikeConfiguration class is used to configure the feature.

EndSpikes

The EndSpikes can be configured with the following options:

Option Type Description
centerX (optional in Json, defaults to 0) int The x coordinate of the center of the spike.
centerZ (optional in Json, defaults to 0) int The z coordinate of the center of the spike.
radius (optional in Json, defaults to 0) int The radius of the spike.
height (optional in Json, defaults to 0) int The height of the spike.
guarded (optional in Json, defaults to false) boolean Whether iron bars should be placed around the end crystal

The SpikeFeature.EndSpike class is used to configure the spikes in code.

Examples

As an example, here's the configured feature used to place the default end spikes on the main island:

ConfiguredFeatures.kt
@OptIn(ExperimentalWorldGen::class)
@Init(stage = InitStage.POST_PACK_PRE_WORLD)
object ConfiguredFeatures : FeatureRegistry by ExampleAddon.registry {

    val END_SPIKE = registerConfiguredFeature(
        "end_spike",
        Feature.END_SPIKE,
        SpikeConfiguration(false, emptyList(), null) 
    )

}
configured_feature/end_spike.json
{
  "type": "minecraft:end_spike",
  "config": {
    "crystal_invulnerable": false,
    "spikes": [] 
  }
}
Example with a filled array
ConfiguredFeatures.kt
val END_SPIKE = registerConfiguredFeature(
    "end_spike",
    Feature.END_SPIKE,
    SpikeConfiguration(
        false, 
        listOf(
            EndSpike(42, 0, 2, 82, true), 
            EndSpike(33, 24, 4, 94, false),
            EndSpike(12, 39, 5, 103, false),
            EndSpike(-13, 39, 2, 79, true),
            EndSpike(-34, 24, 4, 97, false),
            EndSpike(-42, -1, 3, 88, false),
            EndSpike(-34, -25, 3, 91, false),
            EndSpike(-13, -40, 3, 85, false),
            EndSpike(12, -40, 4, 100, false),
            EndSpike(33, -25, 2, 76, false)
        ),
        null 
    )
)
configured_feature/end_spike.json
{
  "type": "minecraft:end_spike",
  "config": {
    "crystal_invulnerable": false,
    "spikes": [
      {
        "centerX": 42,
        "centerZ": 0,
        "radius": 2,
        "height": 82,
        "guarded": true
      },
      {
        "centerX": 33,
        "centerZ": 24,
        "radius": 4,
        "height": 94,
        "guarded": false
      },
      {
        "centerX": 12,
        "centerZ": 39,
        "radius": 5,
        "height": 103,
        "guarded": false
      },
      {
        "centerX": -13,
        "centerZ": 39,
        "radius": 2,
        "height": 79,
        "guarded": true
      },
      {
        "centerX": -34,
        "centerZ": 24,
        "radius": 4,
        "height": 97,
        "guarded": false
      },
      {
        "centerX": -42,
        "centerZ": -1,
        "radius": 3,
        "height": 88,
        "guarded": false
      },
      {
        "centerX": -34,
        "centerZ": -25,
        "radius": 3,
        "height": 91,
        "guarded": false
      },
      {
        "centerX": -13,
        "centerZ": -40,
        "radius": 3,
        "height": 85,
        "guarded": false
      },
      {
        "centerX": 12,
        "centerZ": -40,
        "radius": 4,
        "height": 100,
        "guarded": false
      },
      {
        "centerX": 33,
        "centerZ": -25,
        "radius": 2,
        "height": 76,
        "guarded": false
      }
    ]
  }
}
PlacedFeatures.kt
@OptIn(ExperimentalWorldGen::class)
object PlacedFeatures : FeatureRegistry by ExampleAddon.registry {

    val END_SPIKE = placedFeature("end_spike", ConfiguredFeatures.END_SPIKE)
        .biomeFilter() 
        .register()

}
placed_feature/end_spike.json
{
  "feature": "minecraft:end_spike",
  "placement": [
    {
      "type": "minecraft:biome" 
    }
  ]
}

Result

Example