Package fr.fidorial.world.redstone
Redstone is not a property of every block. Stone emits nothing, a lever, a torch or a trapped
chest do, and a lamp only listens. So the redstone side of a block type is a
RedstoneBehaviour, attached to the block types that have one
in the RedstoneRegistry, next to and independently from their
BlockBehaviour. A block type with no redstone behaviour is inert,
except that it may conduct power: conduction comes from the shape of the block, not from a
behaviour.
The simulation itself, the order updates spread in, scheduled ticks and how signals are
resolved, is the RedstoneEngine
service: a plugin can replace it, or wrap the
built-in one, without touching the behaviours.
Threading
Reading signals is allowed from any thread. Changing blocks, and everything a behaviour is asked to do, happens on the thread of the region owning the block; updates reaching a block of another region are handed over to its thread.
- Since:
- 0.1.0
-
ClassDescriptionThe redstone side of a block type: whether it emits a signal, what a comparator reads out of it, and how it reacts when its surroundings change.The redstone simulation, registered as a service: how signals are resolved, the order block updates spread in, and scheduled ticks.Which block types take part in redstone, and how: the
RedstoneBehaviourattached to each of them.A world as the redstone engine drives it: the signals ofSignalGetter, plus changing blocks, telling their neighbours, and scheduling ticks.How far a block change made throughRedstoneWorld.setBlock(BlockPosition, BlockData, Update)spreads.Read access to the blocks of a world and to the redstone signals running through them.How much of a face a block must cover to hold another block against it.The order scheduled ticks due on the same game tick run in: everyTickPriority.EXTREMELY_HIGHtick first, then everyTickPriority.VERY_HIGHone, and so on.