Package commoble.exmachina.engine.api

# Interface DynamicProperty

All Known Implementing Classes:
  `NoneDynamicProperty`

public interface DynamicProperty
Dynamic properties are assigned to blocks as part of their circuit element definition. They allow the existence of blocks whose power characteristics change somewhat frequently and in a manner unrelated to their blockstates (e.g. a block entity whose power output depends on its inventory). If the value of a dynamic property of a block in the world changes, it must notify the circuit manager capability of a dynamic update. Subcodecs of DynamicProperty can be registered to `ExMachinaRegistries.DYNAMIC_PROPERTY_TYPE`.

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

## Field Summary

Fields
Modifier and Type
Field
Description
`static final com.mojang.serialization.Codec<DynamicProperty>`
`CODEC`

## Method Summary

Modifier and Type
Method
Description
`com.mojang.serialization.Codec<? extends DynamicProperty>`
`codec()`
Returns Codec registered to `ExMachinaRegistries.DYNAMIC_PROPERTY_TYPE`..
`double`
`getValue(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)`
`default boolean`
`isPresent()`
Returns boolean indicating whether this property exists. If false, dynamic values will not be checked for the associated block. Consider using `NoneDynamicProperty.INSTANCE` instead of overriding this..

## Field Details

### CODEC

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

## Method Details

### getValue

double getValue(net.minecraft.world.level.LevelReader level, net.minecraft.core.BlockPos pos, net.minecraft.world.level.block.state.BlockState state)

Parameters:
  `level` - LevelReader to read level data with.
  `pos` -
  `state` -
Returns:
  double value of this property given the provided context.

### codec

com.mojang.serialization.Codec<? extends DynamicProperty> codec()
Returns Codec registered to `ExMachinaRegistries.DYNAMIC_PROPERTY_TYPE`..

Returns:
  Codec registered to `ExMachinaRegistries.DYNAMIC_PROPERTY_TYPE`.

### isPresent

default boolean isPresent()
Returns boolean indicating whether this property exists. If false, dynamic values will not be checked for the associated block. Consider using `NoneDynamicProperty.INSTANCE` instead of overriding this..

Returns:
  boolean indicating whether this property exists. If false, dynamic values will not be checked for the associated block. Consider using `NoneDynamicProperty.INSTANCE` instead of overriding this.