150 lines
No EOL
4.9 KiB
Markdown
150 lines
No EOL
4.9 KiB
Markdown
# Polyenergy
|
|
|
|
A dead-simple energy mod for Fabric.
|
|
|
|
## Features
|
|
|
|
- Totally server-side
|
|
- Polymer-compatible
|
|
- Supports entities and networks of any size
|
|
|
|
## Usage
|
|
|
|
### Installation
|
|
|
|
The mod is available on [Modrinth](https://modrinth.com/project/polyenergy). You can download it from there or build it
|
|
yourself.
|
|
|
|
### API
|
|
|
|
#### Installation
|
|
|
|
To use the API, add the following to your `build.gradle`:
|
|
|
|
```groovy
|
|
repositories {
|
|
maven {
|
|
name = "Arzumify's Maven"
|
|
url = "https://maven.ailur.dev"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
modImplementation "arzumify.cursedenergy:cursedenergy:{version}"
|
|
}
|
|
```
|
|
|
|
To get the latest version, check the [Maven repository](https://maven.ailur.dev/arzumify/polyenergy/).
|
|
|
|
#### Providers
|
|
|
|
Providers are the source of energy in the game. They can be blocks, entities, or any other object that can provide
|
|
energy.
|
|
|
|
To create a provider, implement the `EnergyProvider` interface. This interface has two methods:
|
|
|
|
- `void exists(EnergyReceiver receiver);`
|
|
|
|
This method is called when the matchmaking service finds a receiver that can receive energy from this provider. The
|
|
provider should check if this receiver meets all of its requirements, then call the Ready() method on the receiver to
|
|
make a connection.
|
|
|
|
- `long extract(long amount, EnergyReceiver receiver);`
|
|
|
|
Once a receiver is connected to a provider, it can call extract() to request energy. The provider should return the
|
|
amount of energy it was able to provide, which may be less than the requested amount.
|
|
|
|
#### Receivers
|
|
|
|
Receivers are the destination of energy in the game. They can be blocks, entities, or any other object that can receive
|
|
energy.
|
|
|
|
To create a receiver, implement the `EnergyReceiver` interface. This interface has one method:
|
|
|
|
- `void ready(EnergyProvider provider);`
|
|
|
|
This method is called by the provider when it has accepted the receiver as a valid destination for energy. The receiver
|
|
should store the provider for future extraction requests.
|
|
|
|
#### Matchmaking
|
|
|
|
The matchmaking service is responsible for finding providers and receivers that can be connected.
|
|
Currently, implemented matchmaking services are:
|
|
|
|
- `CoordinateMatchMaker`
|
|
|
|
To use the matchmaking service, create a new instance of `ProviderDetails` or `ReceiverDetails` and pass it to the
|
|
matchmaking service using `matchMaker.addProvider()` or `matchMaker.addReceiver()`. The matchmaking service will then
|
|
attempt to find a match between the two and call the `exists()` method on the provider when an appropriate receiver is
|
|
found.
|
|
|
|
#### Energy
|
|
|
|
Energy is stored in the unit "PolyWatts" (pW). Use metric prefixes to represent larger or smaller amounts of energy. For
|
|
example, 1,000,000 pW is 1 kpW.
|
|
|
|
To keep things consistent across different mods, here are some basic conversions:
|
|
|
|
- 4000E (TechReborn) = 16 pW = 8 items processed (at a rate of 200 ticks per item)
|
|
- 1 Coal = 16 pW = 8 items processed (at a rate of 200 ticks per item)
|
|
- 1 Lava Bucket = 200 pW = 100 items processed (at a rate of 200 ticks per item)
|
|
|
|
##### Technical Details
|
|
|
|
The amount of energy generated should be equal to the burn time of the fuel in ticks divided by 100. For example, one
|
|
coal burns for 1600 ticks, so it should generate 16 pW.
|
|
16 pW should equal the approximate amount of work done by the amount of items burnt by coal (8 items) in a furnace.
|
|
The default rate for machines is 200 ticks per item, equivalent to how long it takes furnaces to smelt items. However,
|
|
these machines may be configured to act faster at the expense of taking more energy.
|
|
|
|
## License
|
|
|
|
This mod is licensed under the GPL-3.0 License. See the LICENSE file for more information.
|
|
|
|
## TL;DR (not legal advice):
|
|
|
|
You CAN:
|
|
|
|
- Redistribute this mod
|
|
- Modify this mod
|
|
- Use this mod in a modpack
|
|
- Use this mod in a video or stream
|
|
- Sell this mod as part of a larger work
|
|
- Use this mod for any purpose
|
|
|
|
You CANNOT:
|
|
|
|
- Hold the author liable
|
|
- Claim this mod as your own
|
|
- Change the license of this mod
|
|
- Redistribute the mod without the source code
|
|
- Modify the mod without sharing the source code
|
|
|
|
You MUST:
|
|
|
|
- Share the source code of this mod
|
|
- Include the license with any redistribution
|
|
- Include the source code with any redistribution
|
|
- Reproduce the below disclaimer in any redistribution
|
|
|
|
Thank you for keeping the modding community open and free!
|
|
|
|
## Disclaimer
|
|
|
|
```
|
|
Polyenergy - A dead-simple energy mod for Fabric.
|
|
Copyright (C) 2025 Arzumify
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
``` |