SpongePowered / SpongeAPI

A Minecraft plugin API
http://www.spongepowered.org/
MIT License
1.14k stars 342 forks source link

Clean up redstone-power related data and properties #1023

Open Aaron1011 opened 8 years ago

Aaron1011 commented 8 years ago

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.

me4502 commented 8 years ago

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.