SpongeAPI icon indicating copy to clipboard operation
SpongeAPI copied to clipboard

Clean up redstone-power related data and properties

Open Aaron1011 opened this issue 9 years ago • 1 comments

Currently, redstone power levels are represented in the API through a combination of PoweredData, RedstonePoweredData, PoweredProperty, and IndirectlyPoweredProperty.

PoweredData and RedstonePoweredData are not clearly defined as to whether they deal with input or output power. As a consequence, they are implemented differently depending on the block, making it difficult to determine what they actually mean.

PoweredProperty and IndirectlyPoweredProperty do function properly, but their usefulness is greatly decreased by the fact that they deliberately hide the actual value, instead only returning a boolean.

As it stands currently, the represntation of redstone power in the API needs a general overhaul, both to improve usability and clearly define what is actually being represented.

Aaron1011 avatar Jan 09 '16 01:01 Aaron1011

I've had a go at this here, https://github.com/SpongePowered/SpongeAPI/compare/feature/clean-redstone

I feel PoweredData makes sense, because it states if a lever, button etc is currently in its powered state.

As for RedstonePoweredData, I changed that to RedstoneOutputData, as that's what it signifies.

As for the two properties, I changed them to integers and clarified in the javadocs what they do, and that they aren't applicable to all blocks.

me4502 avatar May 02 '16 03:05 me4502