-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGuiMEItemOutputBus.java
More file actions
77 lines (64 loc) · 2.72 KB
/
Copy pathGuiMEItemOutputBus.java
File metadata and controls
77 lines (64 loc) · 2.72 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package github.kasuminova.mmce.client.gui;
import appeng.api.config.ActionItems;
import appeng.api.config.Settings;
import appeng.client.gui.widgets.GuiImgButton;
import appeng.core.localization.GuiText;
import github.kasuminova.mmce.common.container.ContainerMEItemOutputBus;
import github.kasuminova.mmce.common.network.PktSwitchGuiMEOutputBus;
import github.kasuminova.mmce.common.tile.MEItemOutputBus;
import hellfirepvp.modularmachinery.ModularMachinery;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import org.jetbrains.annotations.NotNull;
import java.io.IOException;
public class GuiMEItemOutputBus extends GuiMEItemBus {
private static final ResourceLocation TEXTURES_OUTPUT_BUS = new ResourceLocation("appliedenergistics2", "textures/guis/skychest.png");
private CustomStackSizeButton stackSizeBtn;
private final MEItemOutputBus outputBus;
public GuiMEItemOutputBus(final MEItemOutputBus te, final EntityPlayer player) {
super(new ContainerMEItemOutputBus(te, player));
this.outputBus = te;
this.ySize = 195;
}
@Override
public void initGui() {
super.initGui();
this.stackSizeBtn = new CustomStackSizeButton(
this.guiLeft - 18,
this.guiTop + 8
);
this.buttonList.add(this.stackSizeBtn);
}
@Override
protected void actionPerformed(@NotNull final GuiButton btn) throws IOException {
super.actionPerformed(btn);
if (btn == this.stackSizeBtn) {
ModularMachinery.NET_CHANNEL.sendToServer(
new PktSwitchGuiMEOutputBus(this.outputBus.getPos(), 1)
);
}
}
@Override
public void drawFG(int offsetX, int offsetY, int mouseX, int mouseY) {
this.fontRenderer.drawString(I18n.format("gui.meitemoutputbus.title"), 8, 8, 0x404040);
this.fontRenderer.drawString(GuiText.inventory.getLocal(), 8, this.ySize - 96 + 2, 0x404040);
}
@Override
public void drawBG(int offsetX, int offsetY, int mouseX, int mouseY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(TEXTURES_OUTPUT_BUS);
this.drawTexturedModalRect(offsetX, offsetY, 0, 0, this.xSize, this.ySize);
}
private static class CustomStackSizeButton extends GuiImgButton {
public CustomStackSizeButton(int x, int y) {
super(x, y, Settings.ACTIONS, ActionItems.WRENCH);
}
@Override
public String getMessage() {
return I18n.format("gui.meitembus.stack_size.config");
}
}
}