Skip to content

Block JSON Processor

Robert WC Seifert edited this page Sep 6, 2017 · 1 revision

The Block JSON processor is a processor pre-implement by Voltz Engine for loading Blocks and Tiles from JSON data.

Format

"block": {
    "name": "translation.name.of.your.block",
    "id": "registryname",
    "mod": "modname",
    "material": "materialKey"
    }

This is the minimal requirement for any block being created via the JSON system. Additional data can be provided but is optional beyond this example.

Required Data

  • name - translation key that will be loaded from your translation file. Will be prefixed by "tile.modname:" and suffixed by ".name"
  • id - key used to register the block. Needs to be unique within your mod as forge will prefix it with your modname
  • mod - id/domain of the mod that will claim this block. Must match a mod in order for the block to be registered.
  • material - key to match a registered material, materials control how the block behaves when mined, walked on, broken, etc

Recommended Data

TODO add

Optional Data

TODO add

Tile Entity

"tileEntity": {
      "id": "registryname",
      "class": "path.to.your.tile.nameOfTileClass"
    }

This allows a logical TileEntity to be created when the block is added to a world. Currently, this requires defining a globally unique registry name and detailing the class file to load. During runtime, the TileEntity will be registered and data setup to create the tile.

In the future, this will likely be phased out for a cleaner solution that uses a key system. Mostly this will involve using an @Annotation or data created by a code generator program.

Listeners

Listeners are a great way to modify the logic of a block without coding directly for the block. By default, Voltz Engine includes a wide range of listeners to complete basic tasks.

In order to load listeners with a block the following segment needs to be added

    "listeners": [
      "listenerKey",
      "listenerKey2",
      "listenerKey3",
      {
          "id":"listenerKey4",
          "data": "value"
      }
    ]

Each listener will have a unique key telling Voltz Engine what to load. Along with this, some listeners may provide the option for additional data as seen in "listenerKey4". In order to provide the data, the system provides the ability to list listeners as objects by including them inside {}.

Clone this wiki locally