forked from CleanroomMC/BetterQuesting
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPanelFluidSlot.java
More file actions
50 lines (40 loc) · 1.95 KB
/
Copy pathPanelFluidSlot.java
File metadata and controls
50 lines (40 loc) · 1.95 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
43
44
45
46
47
48
49
50
package betterquesting.api2.client.gui.panels.content;
import betterquesting.api2.client.gui.controls.PanelButtonStorage;
import betterquesting.api2.client.gui.misc.GuiPadding;
import betterquesting.api2.client.gui.misc.IGuiRect;
import betterquesting.api2.client.gui.resources.textures.ColorTexture;
import betterquesting.api2.client.gui.resources.textures.FluidTexture;
import betterquesting.api2.client.gui.resources.textures.LayeredTexture;
import betterquesting.api2.client.gui.themes.presets.PresetColor;
import betterquesting.api2.client.gui.themes.presets.PresetTexture;
import net.minecraft.util.text.TextFormatting;
import net.minecraftforge.fluids.FluidStack;
import java.util.ArrayList;
import java.util.List;
public class PanelFluidSlot extends PanelButtonStorage<FluidStack> {
private final boolean showCount;
public PanelFluidSlot(IGuiRect rect, int id, FluidStack value) {
this(rect, id, value, false);
}
public PanelFluidSlot(IGuiRect rect, int id, FluidStack value, boolean showCount) {
super(rect, id, "", null); // Value will be set by setStoredValue()
this.showCount = showCount;
this.setTextures(PresetTexture.ITEM_FRAME.getTexture(), PresetTexture.ITEM_FRAME.getTexture(), new LayeredTexture(PresetTexture.ITEM_FRAME.getTexture(), new ColorTexture(PresetColor.ITEM_HIGHLIGHT.getColor(), new GuiPadding(1, 1, 1, 1))));
this.setStoredValue(value);
}
@Override
public PanelFluidSlot setStoredValue(FluidStack value) {
super.setStoredValue(value);
if (value != null) {
this.setIcon(new FluidTexture(value, showCount, true), 1);
List<String> tooltip = new ArrayList<>();
tooltip.add(value.getLocalizedName());
tooltip.add(TextFormatting.GRAY.toString() + value.amount + "mB");
this.setTooltip(tooltip);
} else {
this.setIcon(null);
this.setTooltip(null);
}
return this;
}
}