{"action":"created","issue":{"url":"https://api.github.com/repos/SpongePowered/Sponge/issues/328","labels_url":"https://api.github.com/repos/SpongePowered/Sponge/issues/328/labels{/name}","comments_url":"https://api.github.com/repos/SpongePowered/Sponge/issues/328/comments","events_url":"https://api.github.com/repos/SpongePowered/Sponge/issues/328/events","html_url":"https://github.com/SpongePowered/Sponge/issues/328","id":102055849,"number":328,"title":"Redstone Event Structure Idea","user":{"login":"LinkTheProgrammer","id":7664085,"avatar_url":"https://avatars.githubusercontent.com/u/7664085?v=3","gravatar_id":"","url":"https://api.github.com/users/LinkTheProgrammer","html_url":"https://github.com/LinkTheProgrammer","followers_url":"https://api.github.com/users/LinkTheProgrammer/followers","following_url":"https://api.github.com/users/LinkTheProgrammer/following{/other_user}","gists_url":"https://api.github.com/users/LinkTheProgrammer/gists{/gist_id}","starred_url":"https://api.github.com/users/LinkTheProgrammer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LinkTheProgrammer/subscriptions","organizations_url":"https://api.github.com/users/LinkTheProgrammer/orgs","repos_url":"https://api.github.com/users/LinkTheProgrammer/repos","events_url":"https://api.github.com/users/LinkTheProgrammer/events{/privacy}","received_events_url":"https://api.github.com/users/LinkTheProgrammer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/api%20pending","name":"api pending","color":"D1C48D"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/events","name":"events","color":"050085"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/help%20wanted","name":"help wanted","color":"fef2c0"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/high-priority","name":"high-priority","color":"e11d21"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/implementation-needed","name":"implementation-needed","color":"009800"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/input%20wanted","name":"input wanted","color":"fbca04"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/major%20feature","name":"major feature","color":"bfd4f2"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/needs%20review","name":"needs review","color":"eb6420"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/needs%20testing","name":"needs testing","color":"73737D"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/PEBKAC","name":"PEBKAC","color":"f7c6c7"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/pull-request-to-forge","name":"pull-request-to-forge","color":"5319e7"},{"url":"https://api.github.com/repos/SpongePowered/Sponge/labels/question","name":"question","color":"035E15"}],"state":"closed","locked":false,"assignee":{"login":"Zidane","id":744482,"avatar_url":"https://avatars.githubusercontent.com/u/744482?v=3","gravatar_id":"","url":"https://api.github.com/users/Zidane","html_url":"https://github.com/Zidane","followers_url":"https://api.github.com/users/Zidane/followers","following_url":"https://api.github.com/users/Zidane/following{/other_user}","gists_url":"https://api.github.com/users/Zidane/gists{/gist_id}","starred_url":"https://api.github.com/users/Zidane/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zidane/subscriptions","organizations_url":"https://api.github.com/users/Zidane/orgs","repos_url":"https://api.github.com/users/Zidane/repos","events_url":"https://api.github.com/users/Zidane/events{/privacy}","received_events_url":"https://api.github.com/users/Zidane/received_events","type":"User","site_admin":false},"milestone":null,"comments":11,"created_at":"2015-08-20T04:08:02Z","updated_at":"2015-09-16T21:22:04Z","closed_at":"2015-09-16T16:07:00Z","body":"I actually got this idea from just happening to be in the teamspeak while some sponge devs were talking about how they were going to design the redstone event structure.\r\n\r\nThis is my idea:\r\n\r\nNew Objects:\r\nRedstonePath\r\n\r\nOverview of RedstonePath:\r\nContains redstone objects (in an ArrayList<> most likely so it can be expanded).\r\nA second List of redstone objects that will actually have their state updated from an event.\r\n\r\nLogic:\r\n\r\nWhenever redstone dust is placed down, you check the neighboring blocks and create a new RedstonePath or merge onto a neighboring RedstonePath if it exists (probably through a path \"filesystem\" so to speak, ordered by chunk). You must check for redstone blocks, redstone dust, and redstone peripherals only.\r\n\r\nWhenever redstone dust is destroyed: if it was a segment in a RedstonePath, you split the path into separate segments (6 total possible). Else, set the reference to the RedstonePath that held the redstone to null and let GC do it's work (unless of course you put the path into an ObjectPool to circumvent GC).\r\n\r\nWhenever a redstone event is triggered the first time, it should propagate the full redstone circuit within a RedstonePath, and any non-redstone blocks should be added to the second List for blocks to be updated. The redstone dust need only be graphically updated as you can calculate the power of the next peripheral or block at any time, in any redstone state. \r\n\r\nWhenever a redstone event superseding the first is triggered, the second List in the path will be updated rather than the first.\r\n\r\nThis is very much an implementation of a state machine. Quite efficient since it skips updating the state of unnecessary blocks such as redstone dust and peripherals. There is still the problem of pistons and how it will affect the implementation of RedstonePaths, but this should suffice for now. Really, you could turn minecraft into a FSM and you wouldn't need to make redstone an FSM, plus it would solve the piston problem on it's own.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/SpongePowered/Sponge/issues/comments/140898582","html_url":"https://github.com/SpongePowered/Sponge/issues/328#issuecomment-140898582","issue_url":"https://api.github.com/repos/SpongePowered/Sponge/issues/328","id":140898582,"user":{"login":"DDoS","id":1250647,"avatar_url":"https://avatars.githubusercontent.com/u/1250647?v=3","gravatar_id":"","url":"https://api.github.com/users/DDoS","html_url":"https://github.com/DDoS","followers_url":"https://api.github.com/users/DDoS/followers","following_url":"https://api.github.com/users/DDoS/following{/other_user}","gists_url":"https://api.github.com/users/DDoS/gists{/gist_id}","starred_url":"https://api.github.com/users/DDoS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DDoS/subscriptions","organizations_url":"https://api.github.com/users/DDoS/orgs","repos_url":"https://api.github.com/users/DDoS/repos","events_url":"https://api.github.com/users/DDoS/events{/privacy}","received_events_url":"https://api.github.com/users/DDoS/received_events","type":"User","site_admin":false},"created_at":"2015-09-16T21:22:04Z","updated_at":"2015-09-16T21:22:04Z","body":"Good luck, but keep in mind that this is likely to break and cause compatibility issues in the future. We won't pull it if we can't properly manage these problems."}}