mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-26 06:42:56 +00:00
add explicit dump button to infusion factories. Closes #5630
This commit is contained in:
1 parent
6abe348d28
commit
bfb3b93401
1 file changed
+34
@@ -25,6 +25,10 @@ import mekanism.common.tier.FactoryTier;
|
||||
import mekanism.common.tile.TileEntityFactory;
|
||||
import mekanism.common.util.LangUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiButtonImage;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
@@ -38,6 +42,8 @@ import org.lwjgl.input.Keyboard;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class GuiFactory extends GuiMekanismTile<TileEntityFactory> {
|
||||
|
||||
private GuiButton infuserDumpButton = null;
|
||||
|
||||
public GuiFactory(InventoryPlayer inventory, TileEntityFactory tile) {
|
||||
super(tile, new ContainerFactory(inventory, tile));
|
||||
ySize += 11;
|
||||
@@ -56,6 +62,24 @@ public class GuiFactory extends GuiMekanismTile<TileEntityFactory> {
|
||||
}, this, resource));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
this.buttonList.add(this.infuserDumpButton = new GuiButtonImage(1, this.guiLeft+6, this.guiTop+44, 21, 10, 147, 72, 0, MekanismUtils.getResource(ResourceType.GUI, "GuiMetallurgicInfuser.png")){
|
||||
@Override
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY, float partialTicks) {
|
||||
if (GuiFactory.this.tileEntity.getRecipeType() == RecipeType.INFUSING) {
|
||||
super.drawButton(mc, mouseX, mouseY, partialTicks);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||
return GuiFactory.this.tileEntity.getRecipeType() == RecipeType.INFUSING && super.mousePressed(mc, mouseX, mouseY);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
||||
fontRenderer.drawString(tileEntity.getName(), (xSize / 2) - (fontRenderer.getStringWidth(tileEntity.getName()) / 2), 4, 0x404040);
|
||||
@@ -134,4 +158,14 @@ public class GuiFactory extends GuiMekanismTile<TileEntityFactory> {
|
||||
protected ResourceLocation getGuiLocation() {
|
||||
return tileEntity.tier.guiLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) throws IOException {
|
||||
super.actionPerformed(button);
|
||||
if (button == this.infuserDumpButton) {
|
||||
TileNetworkList data = TileNetworkList.withContents(1);
|
||||
Mekanism.packetHandler.sendToServer(new TileEntityMessage(tileEntity, data));
|
||||
SoundHandler.playSound(SoundEvents.UI_BUTTON_CLICK);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user