aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/util/IMachineMessage.java
blob: 8b5c3e090fa45993685f2af0077ddcd3896a7b65 (plain)
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
43
44
45
46
47
48
49
50
package gregtech.api.util;

import javax.annotation.Nonnull;

import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.PacketBuffer;

import org.jetbrains.annotations.NotNull;

public interface IMachineMessage<T extends IMachineMessage<T>> {

    /**
     * @return Unique registry ID
     */
    @Nonnull
    String getID();

    /**
     * @return Actual text to show on client GUI
     */
    @Nonnull
    String getDisplayString();

    /**
     * Save info to NBT.
     */
    @NotNull
    NBTTagCompound writeToNBT(@Nonnull NBTTagCompound tag);

    /**
     * Read info from NBT.
     */
    void readFromNBT(@Nonnull NBTTagCompound tag);

    /**
     * Create new instance to receive packet.
     */
    @Nonnull
    T newInstance();

    /**
     * Encode value to sync.
     */
    void encode(@Nonnull PacketBuffer buffer);

    /**
     * Decode synced value.
     */
    void decode(PacketBuffer buffer);
}