add tooltips to filler and emerald transport pipe

This commit is contained in:
Adrian 2015-06-16 17:16:15 +02:00
parent 6abc40ed48
commit 1e58f6f69e
5 changed files with 53 additions and 6 deletions

View file

@ -472,6 +472,9 @@ tip.PipePowerWood=Power Input Pipe
tip.PipeStructureCobblestone=Support pipe
tip.deprecated=Deprecated
tip.filler.excavate.on=Excavate
tip.filler.excavate.off=Do Not Excavate
tip.shift.PipeFluidsDiamond=GUI accepts any fluid containers
tip.shift.PipeFluidsEmerald=GUI accepts any fluid container
tip.shift.PipeItemsClay=Prioritizes machines and chests\nover neighbouring pipes.
@ -481,6 +484,9 @@ tip.shift.PipeItemsLapis=Sneak-click to change color
tip.shift.PipeItemsObsidian=Power with an engine\nMore power - greater distance
tip.shift.PipePowerIron=Change the limit with a wrench or gates
tip.PipeItemsEmerald.whitelist=Whitelist
tip.PipeItemsEmerald.blacklist=Blacklist
tip.PipeItemsEmerald.roundrobin=Round Robin (In Order)
tip.tool.add=Add
tip.tool.fullscreen=Fullscreen

View file

@ -2,6 +2,10 @@ Additions:
* Excavation toggle in the Filler! Finally! (asie)
Improvements:
* Tooltips in Emerald Transport Pipe (asie)
Bugs fixed:
* Crash in rotateLeft (asie)

View file

@ -13,6 +13,7 @@ import io.netty.buffer.ByteBuf;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import buildcraft.BuildCraftCore;
import buildcraft.api.filler.FillerManager;
@ -30,6 +31,8 @@ import buildcraft.core.lib.gui.buttons.ButtonTextureSet;
import buildcraft.core.lib.gui.buttons.GuiBetterButton;
import buildcraft.core.lib.gui.buttons.IButtonTextureSet;
import buildcraft.core.lib.gui.buttons.StandardButtonTextureSets;
import buildcraft.core.lib.gui.tooltips.ToolTip;
import buildcraft.core.lib.gui.tooltips.ToolTipLine;
import buildcraft.core.lib.network.command.CommandWriter;
import buildcraft.core.lib.network.command.PacketCommand;
import buildcraft.core.lib.utils.StringUtils;
@ -82,6 +85,13 @@ public class GuiFiller extends GuiAdvancedInterface {
return filler.isExcavate() ? EXCAVATE_ON : EXCAVATE_OFF;
}
private GuiBetterButton getExcavateButton() {
return new GuiBetterButton(2, guiLeft + 150, guiTop + 30, 16, getExcavateTexture(), "")
.setToolTip(new ToolTip(500, new ToolTipLine(
StatCollector.translateToLocal("tip.filler.excavate." + (filler.isExcavate() ? "on" : "off"))
)));
}
@Override
public void initGui() {
super.initGui();
@ -91,8 +101,7 @@ public class GuiFiller extends GuiAdvancedInterface {
StandardButtonTextureSets.LEFT_BUTTON, ""));
buttonList.add(new GuiBetterButton(1, guiLeft + 38 + 16 + 8, guiTop + 30, 10,
StandardButtonTextureSets.RIGHT_BUTTON, ""));
buttonList.add(new GuiBetterButton(2, guiLeft + 150, guiTop + 30, 16,
getExcavateTexture(), ""));
buttonList.add(getExcavateButton());
slots.clear();
for (int i = 0; i < 4; i++) {
@ -111,8 +120,7 @@ public class GuiFiller extends GuiAdvancedInterface {
} else if (button.id == 2) {
filler.setExcavate(!filler.isExcavate());
buttonList.set(2, new GuiBetterButton(2, guiLeft + 150, guiTop + 30, 16,
getExcavateTexture(), ""));
buttonList.set(2, getExcavateButton());
BuildCraftCore.instance.sendToServer(new PacketCommand(filler, "setFlags", new CommandWriter() {
public void write(ByteBuf data) {

View file

@ -19,10 +19,12 @@ import net.minecraft.util.ResourceLocation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import buildcraft.core.lib.gui.tooltips.IToolTipProvider;
import buildcraft.core.lib.gui.tooltips.ToolTip;
@SideOnly(Side.CLIENT)
public class GuiImageButton extends GuiButton implements IButtonClickEventTrigger {
public class GuiImageButton extends GuiButton implements IButtonClickEventTrigger, IToolTipProvider {
public enum ButtonImage {
BLANK(1, 19),
WHITE_LIST(19, 19),
@ -52,6 +54,7 @@ public class GuiImageButton extends GuiButton implements IButtonClickEventTrigge
private ArrayList<IButtonClickEventListener> listeners = new ArrayList<IButtonClickEventListener>();
private ButtonImage image = ButtonImage.BLANK;
private boolean active = false;
private ToolTip toolTip;
public GuiImageButton(int id, int x, int y, ButtonImage image) {
super(id, x, y, SIZE, SIZE, "");
@ -143,4 +146,24 @@ public class GuiImageButton extends GuiButton implements IButtonClickEventTrigge
private boolean isMouseOverButton(int mouseX, int mouseY) {
return mouseX >= xPosition && mouseY >= yPosition && mouseX < xPosition + SIZE && mouseY < yPosition + SIZE;
}
@Override
public ToolTip getToolTip() {
return toolTip;
}
public GuiImageButton setToolTip(ToolTip tips) {
this.toolTip = tips;
return this;
}
@Override
public boolean isToolTipVisible() {
return visible;
}
@Override
public boolean isMouseOver(int mouseX, int mouseY) {
return isMouseOverButton(mouseX, mouseY);
}
}

View file

@ -12,11 +12,14 @@ import org.lwjgl.opengl.GL11;
import net.minecraft.inventory.IInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import buildcraft.core.lib.gui.GuiBuildCraft;
import buildcraft.core.lib.gui.buttons.GuiImageButton;
import buildcraft.core.lib.gui.buttons.IButtonClickEventListener;
import buildcraft.core.lib.gui.buttons.IButtonClickEventTrigger;
import buildcraft.core.lib.gui.tooltips.ToolTip;
import buildcraft.core.lib.gui.tooltips.ToolTipLine;
import buildcraft.core.lib.network.PacketGuiReturn;
import buildcraft.core.lib.utils.StringUtils;
import buildcraft.transport.pipes.PipeItemsEmerald;
@ -53,14 +56,17 @@ public class GuiEmeraldPipe extends GuiBuildCraft implements IButtonClickEventLi
this.whiteListButton = new GuiImageButton(WHITE_LIST_BUTTON_ID, this.guiLeft + 7, this.guiTop + 41, GuiImageButton.ButtonImage.WHITE_LIST);
this.whiteListButton.registerListener(this);
this.whiteListButton.setToolTip(new ToolTip(500, new ToolTipLine(StatCollector.translateToLocal("tip.PipeItemsEmerald.whitelist"))));
this.buttonList.add(this.whiteListButton);
this.blackListButton = new GuiImageButton(BLACK_LIST_BUTTON_ID, this.guiLeft + 7 + 18, this.guiTop + 41, GuiImageButton.ButtonImage.BLACK_LIST);
this.blackListButton.registerListener(this);
this.blackListButton.setToolTip(new ToolTip(500, new ToolTipLine(StatCollector.translateToLocal("tip.PipeItemsEmerald.blacklist"))));
this.buttonList.add(this.blackListButton);
this.roundRobinButton = new GuiImageButton(ROUND_ROBIN_BUTTON_ID, this.guiLeft + 7 + 36, this.guiTop + 41, GuiImageButton.ButtonImage.ROUND_ROBIN);
this.roundRobinButton.registerListener(this);
this.roundRobinButton.setToolTip(new ToolTip(500, new ToolTipLine(StatCollector.translateToLocal("tip.PipeItemsEmerald.roundrobin"))));
this.buttonList.add(this.roundRobinButton);
switch (pipe.getSettings().getFilterMode()) {