Package net.commoble.exmachina.api

# Interface MechanicalComponent

All Known Implementing Classes:
  `MultipartMechanicalComponent`, `NoneMechanicalComponent`, `VariantsMechanicalComponent`

public interface MechanicalComponent

A MechanicalComponent is a mechanical graph component assignable to Blocks, which

- Can be connected to by the graph
- Can connect to further graph nodes
- Can be notified of mechanical power updates
- Exists at a unique node (level + BlockPos + NodeShape) in any graph

MechanicalComponents can be assigned to blocks via the exmachina:mechanical_component block datamap:

     data/exmachina/data_maps/block/mechanical_component.json
     [
       "namespace:blockid": {
         "type": "namespace:mechanical_component_type_id", // referring to a registered mechanical_component_type (a MechanicalComponent codec)
         // additional fields
       }
     ]

## Field Summary

Fields
Modifier and Type
Field
Description
`static final com.mojang.serialization.Codec<MechanicalComponent>`
`CODEC`
{ "type": "namespace:subcodec", // additional fields specified by subcodec }

## Method Summary

Modifier and Type
Method
Description
`com.mojang.serialization.DataResult<MechanicalBlockComponent>`
`bake(net.minecraft.world.level.block.Block block, net.minecraft.core.RegistryAccess registries)`
Validates and bakes a MechanicalBlockComponent for this component's associated block.
`com.mojang.serialization.MapCodec<? extends MechanicalComponent>`
`codec()`
Returns registerd MapCodec for this subclass.

## Field Details

### CODEC

static final com.mojang.serialization.Codec<MechanicalComponent> CODEC

     {
       "type": "namespace:subcodec",
       // additional fields specified by subcodec
     }

## Method Details

### codec

com.mojang.serialization.MapCodec<? extends MechanicalComponent> codec()
Returns registerd MapCodec for this subclass.

Returns:
  registerd MapCodec for this subclass

### bake

com.mojang.serialization.DataResult<MechanicalBlockComponent> bake(net.minecraft.world.level.block.Block block, net.minecraft.core.RegistryAccess registries)
Validates and bakes a MechanicalBlockComponent for this component's associated block. Invoked on server start.

Parameters:
  `block` - Block which this MechanicalComponent shares an id with
  `registries` - RegistryAccess containing the datapack registries, if needed
Returns:
  DataResult containing the baked and validated block component, or an error result if validation failed