Fixes Crash without CodeChickenLib installed closes #94

This commit is contained in:
modmuss50 2015-08-05 15:10:29 +01:00
parent f8803f3be1
commit 79f14f8be6
3 changed files with 33 additions and 4 deletions

View file

@ -1,10 +1,12 @@
package techreborn.client;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.IIcon;
public class GuiUtil {
public static void drawRepeated(IIcon icon, double x, double y, double width, double height, double z)
{
double iconWidthStep = (icon.getMaxU() - icon.getMinU()) / 16.0D;
@ -31,4 +33,32 @@ public class GuiUtil {
}
tessellator.draw();
}
public static void drawTooltipBox(int x, int y, int w, int h) {
int bg = 0xf0100010;
drawGradientRect(x + 1, y, w - 1, 1, bg, bg);
drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg);
drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);//center
drawGradientRect(x, y + 1, 1, h - 1, bg, bg);
drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg);
int grad1 = 0x505000ff;
int grad2 = 0x5028007F;
drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2);
drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2);
drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1);
drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2);
}
public static void drawGradientRect(int x, int y, int w, int h, int colour1, int colour2) {
new GuiHook().drawGradientRect(x, y, x + w, y + h, colour1, colour2);
}
public static class GuiHook extends Gui
{
@Override
public void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
super.drawGradientRect(par1, par2, par3, par4, par5, par6);
}
}
}

View file

@ -1,11 +1,11 @@
package techreborn.client.gui;
import codechicken.lib.gui.GuiDraw;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import techreborn.client.GuiUtil;
import techreborn.client.container.ContainerBlastFurnace;
import techreborn.lib.ModInfo;
import techreborn.tiles.TileBlastFurnace;
@ -45,7 +45,7 @@ public class GuiBlastFurnace extends GuiContainer {
if(containerBlastFurnace.heat == 0)
{
GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(ModInfo.MISSING_MULTIBLOCK, k + 38, l + 52 + 12 - 0, -1);
}

View file

@ -1,6 +1,5 @@
package techreborn.client.gui;
import codechicken.lib.gui.GuiDraw;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n;
@ -79,7 +78,7 @@ public class GuiIndustrialSawmill extends GuiContainer {
if(sawmill.getMutliBlock() != true)
{
GuiDraw.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
GuiUtil.drawTooltipBox(k + 30, l + 50 + 12 - 0, 114, 10);
this.fontRendererObj.drawString(ModInfo.MISSING_MULTIBLOCK, k + 38, l + 52 + 12 - 0, -1);
}