Package net.commoble.exmachina.api

# Interface StaticProperty

All Known Implementing Classes:
  `BlockStateProperty`, `ConstantProperty`

public interface StaticProperty
Static Properties are assigned to blocks as part of their circuit component definition. They can only vary by blockstate, but are more efficient to calculate for large circuits. Subcodecs of StaticProperty can be registered to `ExMachinaRegistries.STATIC_PROPERTY_TYPE`.

    {
            "type": "modid:registered_type_id",
            // the rest of the subtype fields
    }

StaticProperties can also be inlined as a constant, e.g. "static_load": 5.0

## Nested Class Summary

Nested Classes
Modifier and Type
Interface
Description
`static interface`
`StaticProperty.BakedStaticProperty`
StaticProperty cached for a particular Block

## Field Summary

Fields
Modifier and Type
Field
Description
`static final com.mojang.serialization.Codec<StaticProperty>`
`CODEC`
Master dispatch codec for StaticProperty(s).

## Method Summary

Modifier and Type
Method
Description
`com.mojang.serialization.DataResult<StaticProperty.BakedStaticProperty>`
`bake(net.minecraft.world.level.block.Block block)`
Returns DataResult success holding a state-to-double function if block is valid, error result otherwise.
`com.mojang.serialization.MapCodec<? extends StaticProperty>`
`codec()`
Returns Codec registered to `ExMachinaRegistries.STATIC_PROPERTY_TYPE`..
`default boolean`
`isPresent()`
Returns whether blocks with this property have this property.

## Field Details

### CODEC

static final com.mojang.serialization.Codec<StaticProperty> CODEC
Master dispatch codec for StaticProperty(s).

## Method Details

### bake

com.mojang.serialization.DataResult<StaticProperty.BakedStaticProperty> bake(net.minecraft.world.level.block.Block block)
Returns DataResult success holding a state-to-double function if block is valid, error result otherwise.

Parameters:
  `block` - Block this StaticProperty is associated with.
Returns:
  DataResult success holding a state-to-double function if block is valid, error result otherwise

### isPresent

default boolean isPresent()
Returns whether blocks with this property have this property. If false, blocks with this property will be ignored when calculating the total value (saves us from having to add 100 zeros together). Consider using `ConstantProperty.zero()` instead of overriding.

Returns:
  Whether blocks with this property can provide a value to the circuit

### codec

com.mojang.serialization.MapCodec<? extends StaticProperty> codec()
Returns Codec registered to `ExMachinaRegistries.STATIC_PROPERTY_TYPE`..

Returns:
  Codec registered to `ExMachinaRegistries.STATIC_PROPERTY_TYPE`.