|
| 1 | +# BasicRedstone |
| 2 | + |
| 3 | +[](LICENSE) |
| 4 | + |
| 5 | +BasicRedstone is a **very** basic redstone implementation for Minestom. |
| 6 | +It does not intend to be a fully featured extension, however, |
| 7 | +it might be just right for some server owners. |
| 8 | + |
| 9 | +It is mainly developed for minigame servers that want basic redstone support (to open doors by a lever, for example). |
| 10 | + |
| 11 | +## Table of Contents |
| 12 | + |
| 13 | +- [Features](#features) |
| 14 | +- [Usage](#usage) |
| 15 | +- [Customization](#customization) |
| 16 | +- [Contributing](#contributing) |
| 17 | + |
| 18 | +## Features |
| 19 | + |
| 20 | +This extension only has very basic features. |
| 21 | + |
| 22 | +- Manual door/trapdoor opening and closing (by hand) |
| 23 | +- Redstone powering directly or through blocks |
| 24 | +- Redstone components (doors and trapdoors are builtin) |
| 25 | +- Redstone sources (buttons and levers are builtin) |
| 26 | + |
| 27 | +Note: currently, every block is a conductor (including air and glass-like blocks). |
| 28 | +This may change in the future. |
| 29 | + |
| 30 | +## Usage |
| 31 | + |
| 32 | +To use this extension, you can either build a jar file |
| 33 | +and put it in your extensions folder, or shade it as a library in your server. |
| 34 | + |
| 35 | +The extension will not work by itself, you have to enable separate features. |
| 36 | + |
| 37 | +### Enabling events |
| 38 | + |
| 39 | +You can get an `EventNode` with all events listening by using `BasicRedstoneExtension.events()`. |
| 40 | +You can add this node as a child to any other node, and the redstone will work in the scope. |
| 41 | +You can also get a node with separated events of this extension. |
| 42 | + |
| 43 | +`buttonEvents()` creates an EventNode with the events for button pressing and breaking. |
| 44 | + |
| 45 | +`leverEvents()` creates an EventNode with the events for lever pulling and breaking. |
| 46 | + |
| 47 | +`doorEvents()` creates an EventNode with the events for manual (no redstone) door interaction. |
| 48 | + |
| 49 | +`trapdoorEvents()` creates an EventNode with the events for manual (no redstone) trapdoor interaction. |
| 50 | + |
| 51 | +### Using redstone components |
| 52 | + |
| 53 | +For every new instance created, you have to specify which redstone components to use in this instance. |
| 54 | + |
| 55 | +For example: |
| 56 | +```java |
| 57 | +Instance instance; |
| 58 | +PowerNet powerNet = Redstone.getPowerNet(instance); |
| 59 | +powerNet.useBuiltinComponents(); |
| 60 | +``` |
| 61 | + |
| 62 | +`useBuiltinComponents()` will add doors and trapdoors to the instance. |
| 63 | + |
| 64 | +## Customization |
| 65 | + |
| 66 | +It is possible to create your own redstone components, just implement `RedstoneComponent` |
| 67 | +and use `PowerNet.useComponent(...)` to add it to an instance. |
| 68 | + |
| 69 | +It is also possible (but slightly more difficult) to create your own redstone sources (like buttons and levers). |
| 70 | +To do so, take a look at how the builtin sources do it. |
| 71 | + |
| 72 | +## Contributing |
| 73 | + |
| 74 | +I don't want to add a lot of features, but if you found a bug, an issue or a pull request is welcome! |
0 commit comments