-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDataProviderComponent.java
More file actions
42 lines (36 loc) · 1.49 KB
/
Copy pathDataProviderComponent.java
File metadata and controls
42 lines (36 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package io.github.cottonmc.component.data;
import io.github.cottonmc.component.data.api.DataElement;
import io.github.cottonmc.component.data.api.Unit;
import dev.onyxstudios.cca.api.v3.component.Component;
import net.minecraft.nbt.NbtCompound;
import javax.annotation.Nullable;
import java.util.List;
/**
* Component representing an object's ability to provide detailed information to some kind of probe or UI element. The
* simple case is something like WAILA, HWYLA, or TheOneProbe. However, this API could be used by snap-on monitor
* blocks, remote monitoring systems, or data-based automation. Picture this: "activate redstone when bar labeled
* 'temperature' is greater than 80%". Structured data is very useful data.
*
* <p>This interface addresses how you get the data. What you do with it is up to you.
*
* <p>Probes and other devices should gather data only on the server Side. Implementors are encouraged to ignore
* clientside probe requests.
*/
public interface DataProviderComponent extends Component {
/**
* Append all data to the provided list.
* @param data The list of data to append to.
*/
void provideData(List<DataElement> data);
/**
* Get a data element of a specific unit, for easier interaction.
* @param unit The unit this element should be in.
* @return The data element for this unit type.
*/
@Nullable
DataElement getElementFor(Unit unit);
@Override
default void readFromNbt(NbtCompound tag) { }
@Override
default void writeToNbt(NbtCompound tag) { }
}