aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/gui/modularui/GT_CoverUIBuildContext.java
blob: 62a933cfa61b37e919744fc6d4e36f8bf35e9bb4 (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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package gregtech.api.gui.modularui;

import net.minecraft.entity.player.EntityPlayer;

import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import gregtech.api.interfaces.tileentity.ICoverable;

public class GT_CoverUIBuildContext extends UIBuildContext {

    // cover data is not synced to client, while ID is
    private final int coverID;
    private final byte side;
    private final ICoverable tile;
    private final boolean anotherWindow;
    private final int guiColorization;

    /**
     * @param player          Player opened this UI
     * @param coverID         See {@link ICoverable#getCoverIDAtSide}
     * @param side            Side this cover is attached to
     * @param tile            Tile this cover is attached to
     * @param anotherWindow   If cover UI is shown on top of another window
     * @param guiColorization The color used to render machine's GUI
     */
    public GT_CoverUIBuildContext(EntityPlayer player, int coverID, byte side, ICoverable tile, boolean anotherWindow,
        int guiColorization) {
        super(player);
        this.coverID = coverID;
        this.side = side;
        this.tile = tile;
        this.anotherWindow = anotherWindow;
        this.guiColorization = guiColorization;
    }

    /**
     * @param player        Player opened this UI
     * @param coverID       See {@link ICoverable#getCoverIDAtSide}
     * @param side          Side this cover is attached to
     * @param tile          Tile this cover is attached to
     * @param anotherWindow If cover GUI is shown in opened on top of another window
     */
    public GT_CoverUIBuildContext(EntityPlayer player, int coverID, byte side, ICoverable tile, boolean anotherWindow) {
        this(player, coverID, side, tile, anotherWindow, tile.getGUIColorization());
    }

    public int getCoverID() {
        return coverID;
    }

    public byte getCoverSide() {
        return side;
    }

    /**
     * Note that this will return different object between client v.s. server side on SP.
     */
    public ICoverable getTile() {
        return tile;
    }

    /**
     * If cover GUI is shown in opened on top of another window.
     */
    public boolean isAnotherWindow() {
        return anotherWindow;
    }

    public int getGuiColorization() {
        return guiColorization;
    }
}