Package net.commoble.exmachina.api

# Record Class MechanicalNode

java.lang.Object
java.lang.Record
net.commoble.exmachina.api.MechanicalNode

Record Components:
  `shape` - NodeShape of this node. Must be unique per position in a given level.
  `torque` - double value (in Newton-meters) of the "active torque" provided by this node (such as from a windmill or motor). Torque values are signed with a right-hand rule; if positive, the node is rotating in the direction a right hand's fingers are pointing while the thumb points to the positive direction of the axis of rotation (up, south, east). If negative, the node points to the negative direction of the axis (down, north, west).
  `positiveCounterTorque` - double value of passive/load torque to subtract from system's total active torque while total active torque is positive. This represents e.g. friction or maybe rocks being crushed by a grinder.
  `negativeCounterTorque` - double value of passive/load torque to add to total active torque while total active torque is negative.
  `inertia` - double value of node's inertia (in kilogram-meters^2). Higher inertia slows down the rotation of the entire system and causes more power to be weighted to this node.
  `connectableNodes` - Map of the nodes this node will attempt to form connections to, and the properties of that connection. Nodes must mutually connect to each other for a connection to form.
  `graphListener` - BiConsumer to invoke when a mechanical update occurs (e.g. to store power/velocity in an associated blockentity)

public record MechanicalNode(NodeShape shape, double torque, double positiveCounterTorque, double negativeCounterTorque, double inertia, Map<MechanicalGraphKey,MechanicalConnection> connectableNodes, BiConsumer<net.minecraft.world.level.LevelAccessor,MechanicalState> graphListener) extends Record
Represents a node in the mechanical graph. Multiple nodes can exist in the same BlockPos.

## Constructor Summary

Constructors
Constructor
Description
`MechanicalNode(NodeShape shape, double torque, double positiveCounterTorque, double negativeCounterTorque, double inertia, Map<MechanicalGraphKey,MechanicalConnection> connectableNodes, BiConsumer<net.minecraft.world.level.LevelAccessor,MechanicalState> graphListener)`
Creates an instance of a `MechanicalNode` record class.

## Method Summary

Modifier and Type
Method
Description
`Map<MechanicalGraphKey,MechanicalConnection>`
`connectableNodes()`
Returns the value of the `connectableNodes` record component.
`final boolean`
`equals(Object o)`
Indicates whether some other object is "equal to" this one.
`BiConsumer<net.minecraft.world.level.LevelAccessor,MechanicalState>`
`graphListener()`
Returns the value of the `graphListener` record component.
`final int`
`hashCode()`
Returns a hash code value for this object.
`double`
`inertia()`
Returns the value of the `inertia` record component.
`double`
`negativeCounterTorque()`
Returns the value of the `negativeCounterTorque` record component.
`double`
`positiveCounterTorque()`
Returns the value of the `positiveCounterTorque` record component.
`NodeShape`
`shape()`
Returns the value of the `shape` record component.
`double`
`torque()`
Returns the value of the `torque` record component.
`final String`
`toString()`
Returns a string representation of this record class.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

## Constructor Details

### MechanicalNode

public MechanicalNode(NodeShape shape, double torque, double positiveCounterTorque, double negativeCounterTorque, double inertia, Map<MechanicalGraphKey,MechanicalConnection> connectableNodes, BiConsumer<net.minecraft.world.level.LevelAccessor,MechanicalState> graphListener)
Creates an instance of a `MechanicalNode` record class.

Parameters:
  `shape` - the value for the `shape` record component
  `torque` - the value for the `torque` record component
  `positiveCounterTorque` - the value for the `positiveCounterTorque` record component
  `negativeCounterTorque` - the value for the `negativeCounterTorque` record component
  `inertia` - the value for the `inertia` record component
  `connectableNodes` - the value for the `connectableNodes` record component
  `graphListener` - the value for the `graphListener` record component

## Method Details

### toString

public final String toString()
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.

Specified by:
  `toString` in class `Record`
Returns:
  a string representation of this object

### hashCode

public final int hashCode()
Returns a hash code value for this object. The value is derived from the hash code of each of the record components.

Specified by:
  `hashCode` in class `Record`
Returns:
  a hash code value for this object

### equals

public final boolean equals(Object o)
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with `Objects::equals(Object,Object)`; primitive components are compared with '=='.

Specified by:
  `equals` in class `Record`
Parameters:
  `o` - the object with which to compare
Returns:
  `true` if this object is the same as the `o` argument; `false` otherwise.

### shape

public NodeShape shape()
Returns the value of the `shape` record component.

Returns:
  the value of the `shape` record component

### torque

public double torque()
Returns the value of the `torque` record component.

Returns:
  the value of the `torque` record component

### positiveCounterTorque

public double positiveCounterTorque()
Returns the value of the `positiveCounterTorque` record component.

Returns:
  the value of the `positiveCounterTorque` record component

### negativeCounterTorque

public double negativeCounterTorque()
Returns the value of the `negativeCounterTorque` record component.

Returns:
  the value of the `negativeCounterTorque` record component

### inertia

public double inertia()
Returns the value of the `inertia` record component.

Returns:
  the value of the `inertia` record component

### connectableNodes

public Map<MechanicalGraphKey,MechanicalConnection> connectableNodes()
Returns the value of the `connectableNodes` record component.

Returns:
  the value of the `connectableNodes` record component

### graphListener

public BiConsumer<net.minecraft.world.level.LevelAccessor,MechanicalState> graphListener()
Returns the value of the `graphListener` record component.

Returns:
  the value of the `graphListener` record component