Clean up widgets and OpenGL gui lighting issues

This commit is contained in:
mezz committed 2015-11-13 23:12:40 -08:00
1 parent 430115a7d4
commit 5f2de3026e
32 files changed
+642 -700

No files matched your search

+3 -38
View File
@@ -22,8 +22,6 @@ import org.lwjgl.opengl.GL11;
import forestry.api.mail.EnumAddressee;
import forestry.api.mail.IMailAddress;
import forestry.api.mail.IPostalCarrier;
import forestry.api.mail.PostManager;
import forestry.core.config.Constants;
import forestry.core.config.SessionVars;
import forestry.core.gui.GuiForestry;
@@ -31,8 +29,8 @@ import forestry.core.gui.GuiTextBox;
import forestry.core.gui.widgets.ItemStackWidget;
import forestry.core.gui.widgets.Widget;
import forestry.core.proxy.Proxies;
import forestry.core.render.SpriteSheet;
import forestry.core.utils.StringUtil;
import forestry.mail.gui.widgets.AddresseeSlot;
import forestry.mail.inventory.ItemInventoryLetter;
import forestry.mail.network.PacketLetterInfoRequest;
@@ -55,7 +53,7 @@ public class GuiLetter extends GuiForestry<ContainerLetter, ItemInventoryLetter>
this.ySize = 227;
this.isProcessedLetter = container.getLetter().isProcessed();
this.widgetManager.add(new AddresseeSlot(16, 12));
this.widgetManager.add(new AddresseeSlot(widgetManager, 16, 12, container));
this.tradeInfoWidgets = new ArrayList<>();
}
@@ -181,9 +179,8 @@ public class GuiLetter extends GuiForestry<ContainerLetter, ItemInventoryLetter>
addTradeInfoWidget(new ItemStackWidget(widgetManager, x, y + 10, container.getTradeInfo().tradegood));
GL11.glDisable(GL11.GL_LIGHTING);
fontRendererObj.drawString(StringUtil.localize("gui.mail.foreveryattached"), guiLeft + x, guiTop + y + 28, fontColor.get("gui.mail.lettertext"));
GL11.glEnable(GL11.GL_LIGHTING);
for (int i = 0; i < container.getTradeInfo().required.length; i++) {
addTradeInfoWidget(new ItemStackWidget(widgetManager, x + i * 18, y + 38, container.getTradeInfo().required[i]));
}
@@ -252,36 +249,4 @@ public class GuiLetter extends GuiForestry<ContainerLetter, ItemInventoryLetter>
container.setText(this.text.getText());
}
protected class AddresseeSlot extends Widget {
public AddresseeSlot(int xPos, int yPos) {
super(widgetManager, xPos, yPos);
this.width = 26;
this.height = 15;
}
@Override
public void draw(int startX, int startY) {
IPostalCarrier carrier = PostManager.postRegistry.getCarrier(container.getCarrierType());
if (carrier != null) {
GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0F);
Proxies.render.bindTexture(SpriteSheet.ITEMS);
drawTexturedModelRectFromIcon(startX + xPos, startY + yPos - 5, carrier.getIcon(), 26, 26);
}
}
@Override
protected String getLegacyTooltip(EntityPlayer player) {
return StringUtil.localize("gui.addressee." + container.getCarrierType().toString());
}
@Override
public void handleMouseClick(int mouseX, int mouseY, int mouseButton) {
if (!isProcessedLetter) {
container.advanceCarrierType();
}
}
}
}