Files
CC-Tweaked/projects/core-api
Jonathan Coates 807ab862b6 Standardise peripheral targets
Currently IPeripheral.getTarget() can return an aribtrary value. This
means producers often have little guidance of what to return, and
consumers have to handle many values. In most cases, both ends just use
the BlockEntity, but this is often insufficient (e.g. when we also need
the side, or for blocks which don't have a BE). This commit tries to add
some standardised types and helpers for handling this.

 - Add a new BlockPeripheralTarget class, used to describe the
   block/block entity a peripheral targets. Unlike the raw BE, this also
   captures the direction the peripheral comes from (if known).

 - Add a new BlockPeripheral subclass, whose getTarget() method always
   returns a BlockPeripheralTarget. In future versions our peripheral
   capability/lookup will always return a BlockPeripheral.

   We do *not* implement this on our own peripherals right now, as this
   will break any mods that only handle a BE.

 - Add several helper methods for extracting a BlockPeripheralTarget
   from a peripheral, as well as loader-specific capabilities/lookups.
2026-11-07 12:23:43 +00:00
..
2026-09-11 20:10:58 +01:00