mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2026-11-24 08:07:15 +00:00
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.