mirror of
https://github.com/GTNewHorizons/waila.git
synced 2026-11-21 20:52:40 +00:00
NEI is now a weak dependency.
This commit is contained in:
1 parent
f46ac15842
commit
0476bca1bf
14 files changed
+241
-144
No files matched your search
@@ -44,7 +44,7 @@ import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.client.KeyEvent;
|
||||
import mcp.mobius.waila.commands.CommandDumpHandlers;
|
||||
|
||||
@Mod(modid="Waila", name="Waila", version="1.5.8", dependencies="required-after:NotEnoughItems@[1.0.4.0,)", acceptableRemoteVersions="*")
|
||||
@Mod(modid="Waila", name="Waila", version="1.5.8", dependencies="after:NotEnoughItems@[1.0.4.0,)", acceptableRemoteVersions="*")
|
||||
/*
|
||||
@NetworkMod(channels = {"Waila"},clientSideRequired=false, serverSideRequired=false, connectionHandler = WailaConnectionHandler.class,
|
||||
packetHandler = WailaPacketHandler.class, versionBounds="[1.5.0,)")
|
||||
|
||||
@@ -8,6 +8,7 @@ import mcp.mobius.waila.Waila;
|
||||
import mcp.mobius.waila.api.IWailaBlock;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.IWailaEntityProvider;
|
||||
import mcp.mobius.waila.cbcore.Layout;
|
||||
import mcp.mobius.waila.network.Message0x01TERequest;
|
||||
import mcp.mobius.waila.network.Message0x03EntRequest;
|
||||
import mcp.mobius.waila.network.WailaPacketHandler;
|
||||
@@ -20,7 +21,6 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import codechicken.nei.api.ItemInfo.Layout;
|
||||
|
||||
public class MetaDataProvider{
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package mcp.mobius.waila.cbcore;
|
||||
|
||||
public enum Layout
|
||||
{
|
||||
HEADER, BODY, FOOTER
|
||||
}
|
||||
@@ -4,17 +4,13 @@ import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.gui.screens.config.ScreenConfig;
|
||||
import mcp.mobius.waila.handlers.nei.HandlerEnchants;
|
||||
import mcp.mobius.waila.overlay.RayTracing;
|
||||
import mcp.mobius.waila.utils.Constants;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -32,7 +28,6 @@ public class KeyEvent {
|
||||
public static KeyBinding key_liquid;
|
||||
public static KeyBinding key_recipe;
|
||||
public static KeyBinding key_usage;
|
||||
static boolean firstInventory = true;
|
||||
|
||||
@SubscribeEvent
|
||||
public void onKeyEvent(KeyInputEvent event){
|
||||
@@ -60,11 +55,19 @@ public class KeyEvent {
|
||||
}
|
||||
|
||||
else if (key == key_recipe.getKeyCode()){
|
||||
this.openRecipeGUI(true);
|
||||
if (Loader.isModLoaded("NotEnoughItems")){
|
||||
try{
|
||||
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler").getDeclaredMethod("openRecipeGUI", boolean.class).invoke(null, true);
|
||||
} catch (Exception e){}
|
||||
}
|
||||
}
|
||||
|
||||
else if (key == key_usage.getKeyCode()){
|
||||
this.openRecipeGUI(false);
|
||||
if (Loader.isModLoaded("NotEnoughItems")){
|
||||
try{
|
||||
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler").getDeclaredMethod("openRecipeGUI", boolean.class).invoke(null, false);
|
||||
} catch (Exception e){}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -81,8 +84,6 @@ public class KeyEvent {
|
||||
ClientRegistry.registerKeyBinding(KeyEvent.key_liquid);
|
||||
ClientRegistry.registerKeyBinding(KeyEvent.key_recipe);
|
||||
ClientRegistry.registerKeyBinding(KeyEvent.key_usage);
|
||||
GuiContainerManager.addInputHandler(new HandlerEnchants());
|
||||
API.addKeyBind(Constants.BIND_SCREEN_ENCH, Keyboard.KEY_I);
|
||||
|
||||
/*
|
||||
Minecraft.getMinecraft().gameSettings.keyBindings = (KeyBinding[])ArrayUtils.addAll(
|
||||
@@ -90,43 +91,4 @@ public class KeyEvent {
|
||||
Minecraft.getMinecraft().gameSettings.keyBindings);
|
||||
*/
|
||||
}
|
||||
|
||||
public void openRecipeGUI(boolean recipe){
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
boolean uiResult;
|
||||
String msg;
|
||||
|
||||
if ((RayTracing.instance().getTarget() != null) && (RayTracing.instance().getTarget().typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)){
|
||||
List<ItemStack> stacks = RayTracing.instance().getIdentifierItems();
|
||||
if (stacks.size() > 0){
|
||||
mc.displayGuiScreen(new GuiInventory(mc.thePlayer));
|
||||
if (firstInventory){
|
||||
try {Thread.sleep(1000);} catch (Exception e){};
|
||||
firstInventory = false;
|
||||
}
|
||||
|
||||
if(recipe)
|
||||
if(!GuiCraftingRecipe.openRecipeGui("item", stacks.get(0).copy())){
|
||||
ItemStack target = stacks.get(0).copy();
|
||||
target.setItemDamage(0);
|
||||
if(!GuiCraftingRecipe.openRecipeGui("item", target)){
|
||||
mc.thePlayer.addChatMessage(new ChatComponentTranslation("\u00a7f\u00a7o" + LangUtil.translateG("client.msg.norecipe")));
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipe)
|
||||
if(!GuiUsageRecipe.openRecipeGui("item", stacks.get(0).copy())){
|
||||
ItemStack target = stacks.get(0).copy();
|
||||
target.setItemDamage(0);
|
||||
if(!GuiUsageRecipe.openRecipeGui("item", target)){
|
||||
mc.thePlayer.addChatMessage(new ChatComponentTranslation("\u00a7f\u00a7o" + LangUtil.translateG("client.msg.nousage")));
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
package mcp.mobius.waila.client;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import mcp.mobius.waila.gui.truetyper.FontLoader;
|
||||
import mcp.mobius.waila.gui.truetyper.TrueTypeFont;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerBlocks;
|
||||
import mcp.mobius.waila.handlers.HUDHandlerEntities;
|
||||
import mcp.mobius.waila.handlers.nei.ModNameFilter;
|
||||
import mcp.mobius.waila.handlers.nei.OreDictFilter;
|
||||
//import mcp.mobius.waila.handlers.SummaryProviderDefault;
|
||||
import mcp.mobius.waila.handlers.nei.TooltipHandlerWaila;
|
||||
import mcp.mobius.waila.server.ProxyServer;
|
||||
import mcp.mobius.waila.utils.Constants;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -19,9 +18,7 @@ import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
|
||||
public class ProxyClient extends ProxyServer {
|
||||
@@ -42,22 +39,11 @@ public class ProxyClient extends ProxyServer {
|
||||
|
||||
//TickRegistry.registerTickHandler(WailaTickHandler.instance(), Side.CLIENT);
|
||||
|
||||
//GuiContainerManager.addTooltipHandler(new TooltipHandlerWaila());
|
||||
if (ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_NEWFILTERS, true)){
|
||||
API.addSearchProvider(new ModNameFilter());
|
||||
API.addSearchProvider(new OreDictFilter());
|
||||
if (Loader.isModLoaded("NotEnoughItems")){
|
||||
try{
|
||||
Class.forName("mcp.mobius.waila.handlers.nei.NEIHandler").getDeclaredMethod("register").invoke(null);
|
||||
} catch (Exception e){}
|
||||
}
|
||||
|
||||
GuiContainerManager.addTooltipHandler(new TooltipHandlerWaila());
|
||||
|
||||
//KeyBindingRegistry.registerKeyBinding(new ConfigKeyHandler());
|
||||
|
||||
// We mute the default keybind for displaying the tooltip
|
||||
NEIClientConfig.getSetting(Constants.BIND_NEI_SHOW).setIntValue(Keyboard.KEY_NONE);
|
||||
NEIClientConfig.getSetting(Constants.CFG_NEI_SHOW).setBooleanValue(false);
|
||||
|
||||
//API.addKeyBind(Constants.BIND_WIKI, "Display wiki", Keyboard.KEY_RSHIFT);
|
||||
//API.addKeyBind(Constants.BIND_TECH, "Display techtree", Keyboard.KEY_RSHIFT);
|
||||
|
||||
ModuleRegistrar.instance().registerHeadProvider(new HUDHandlerBlocks(), Block.class);
|
||||
ModuleRegistrar.instance().registerTailProvider(new HUDHandlerBlocks(), Block.class);
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
package mcp.mobius.waila.gui.widgets;
|
||||
|
||||
import mcp.mobius.waila.gui.interfaces.IWidget;
|
||||
import mcp.mobius.waila.overlay.DisplayUtil;
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.util.Point;
|
||||
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
public class ItemStackDisplay extends WidgetBase {
|
||||
|
||||
ItemStack stack = null;
|
||||
@@ -42,7 +41,7 @@ public class ItemStackDisplay extends WidgetBase {
|
||||
GL11.glScalef(scaleX, scaleY, 1.0f);
|
||||
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
GuiContainerManager.drawItem((int)(pos.getX()/scaleX), (int)(pos.getY()/scaleX), this.stack);
|
||||
DisplayUtil.renderStack((int)(pos.getX()/scaleX), (int)(pos.getY()/scaleX), this.stack);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@ package mcp.mobius.waila.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
import mcp.mobius.waila.api.IWailaConfigHandler;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.overlay.DisplayUtil;
|
||||
import mcp.mobius.waila.utils.Constants;
|
||||
import mcp.mobius.waila.utils.ModIdentification;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -31,7 +32,7 @@ public class HUDHandlerBlocks implements IWailaDataProvider {
|
||||
String name = null;
|
||||
try
|
||||
{
|
||||
String s = GuiContainerManager.itemDisplayNameShort(itemStack);
|
||||
String s = DisplayUtil.itemDisplayNameShort(itemStack);
|
||||
if(s != null && !s.endsWith("Unnamed"))
|
||||
name = s;
|
||||
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package mcp.mobius.waila.handlers.nei;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.cbcore.LangUtil;
|
||||
import mcp.mobius.waila.overlay.RayTracing;
|
||||
import mcp.mobius.waila.utils.Constants;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import codechicken.nei.NEIClientConfig;
|
||||
import codechicken.nei.api.API;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import codechicken.nei.recipe.GuiCraftingRecipe;
|
||||
import codechicken.nei.recipe.GuiUsageRecipe;
|
||||
|
||||
public class NEIHandler {
|
||||
public static void register(){
|
||||
//GuiContainerManager.addTooltipHandler(new TooltipHandlerWaila());
|
||||
if (ConfigHandler.instance().getConfig(Configuration.CATEGORY_GENERAL, Constants.CFG_WAILA_NEWFILTERS, true)){
|
||||
API.addSearchProvider(new ModNameFilter());
|
||||
API.addSearchProvider(new OreDictFilter());
|
||||
}
|
||||
|
||||
GuiContainerManager.addTooltipHandler(new TooltipHandlerWaila());
|
||||
|
||||
//KeyBindingRegistry.registerKeyBinding(new ConfigKeyHandler());
|
||||
|
||||
// We mute the default keybind for displaying the tooltip
|
||||
NEIClientConfig.getSetting(Constants.BIND_NEI_SHOW).setIntValue(Keyboard.KEY_NONE);
|
||||
NEIClientConfig.getSetting(Constants.CFG_NEI_SHOW).setBooleanValue(false);
|
||||
|
||||
//API.addKeyBind(Constants.BIND_WIKI, "Display wiki", Keyboard.KEY_RSHIFT);
|
||||
//API.addKeyBind(Constants.BIND_TECH, "Display techtree", Keyboard.KEY_RSHIFT);
|
||||
|
||||
GuiContainerManager.addInputHandler(new HandlerEnchants());
|
||||
API.addKeyBind(Constants.BIND_SCREEN_ENCH, Keyboard.KEY_I);
|
||||
}
|
||||
|
||||
public static boolean firstInventory = true;
|
||||
public static void openRecipeGUI(boolean recipe){
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
boolean uiResult;
|
||||
String msg;
|
||||
|
||||
if ((RayTracing.instance().getTarget() != null) && (RayTracing.instance().getTarget().typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)){
|
||||
List<ItemStack> stacks = RayTracing.instance().getIdentifierItems();
|
||||
if (stacks.size() > 0){
|
||||
mc.displayGuiScreen(new GuiInventory(mc.thePlayer));
|
||||
if (firstInventory){
|
||||
try {Thread.sleep(1000);} catch (Exception e){};
|
||||
firstInventory = false;
|
||||
}
|
||||
|
||||
if(recipe)
|
||||
if(!GuiCraftingRecipe.openRecipeGui("item", stacks.get(0).copy())){
|
||||
ItemStack target = stacks.get(0).copy();
|
||||
target.setItemDamage(0);
|
||||
if(!GuiCraftingRecipe.openRecipeGui("item", target)){
|
||||
mc.thePlayer.addChatMessage(new ChatComponentTranslation("\u00a7f\u00a7o" + LangUtil.translateG("client.msg.norecipe")));
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
|
||||
if(!recipe)
|
||||
if(!GuiUsageRecipe.openRecipeGui("item", stacks.get(0).copy())){
|
||||
ItemStack target = stacks.get(0).copy();
|
||||
target.setItemDamage(0);
|
||||
if(!GuiUsageRecipe.openRecipeGui("item", target)){
|
||||
mc.thePlayer.addChatMessage(new ChatComponentTranslation("\u00a7f\u00a7o" + LangUtil.translateG("client.msg.nousage")));
|
||||
mc.displayGuiScreen((GuiScreen)null);
|
||||
mc.setIngameFocus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package mcp.mobius.waila.overlay;
|
||||
import static mcp.mobius.waila.api.SpecialChars.*;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@@ -13,14 +15,19 @@ import mcp.mobius.waila.api.impl.DataAccessorCommon;
|
||||
import mcp.mobius.waila.api.impl.ModuleRegistrar;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.RenderItem;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
|
||||
public class DisplayUtil {
|
||||
public static FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
private static FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
private static TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
|
||||
private static RenderItem renderItem = new RenderItem();
|
||||
|
||||
public static int getDisplayWidth(String s) {
|
||||
if (s == null || s.equals(""))
|
||||
@@ -58,35 +65,102 @@ public class DisplayUtil {
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
protected void drawGradientRect(int p_73733_1_, int p_73733_2_, int p_73733_3_, int p_73733_4_, int p_73733_5_, int p_73733_6_)
|
||||
{
|
||||
float f = (float)(p_73733_5_ >> 24 & 255) / 255.0F;
|
||||
float f1 = (float)(p_73733_5_ >> 16 & 255) / 255.0F;
|
||||
float f2 = (float)(p_73733_5_ >> 8 & 255) / 255.0F;
|
||||
float f3 = (float)(p_73733_5_ & 255) / 255.0F;
|
||||
float f4 = (float)(p_73733_6_ >> 24 & 255) / 255.0F;
|
||||
float f5 = (float)(p_73733_6_ >> 16 & 255) / 255.0F;
|
||||
float f6 = (float)(p_73733_6_ >> 8 & 255) / 255.0F;
|
||||
float f7 = (float)(p_73733_6_ & 255) / 255.0F;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(f1, f2, f3, f);
|
||||
tessellator.addVertex((double)p_73733_3_, (double)p_73733_2_, (double)this.zLevel);
|
||||
tessellator.addVertex((double)p_73733_1_, (double)p_73733_2_, (double)this.zLevel);
|
||||
tessellator.setColorRGBA_F(f5, f6, f7, f4);
|
||||
tessellator.addVertex((double)p_73733_1_, (double)p_73733_4_, (double)this.zLevel);
|
||||
tessellator.addVertex((double)p_73733_3_, (double)p_73733_4_, (double)this.zLevel);
|
||||
tessellator.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
public static void renderStack(int x, int y, ItemStack stack){
|
||||
enable3DRender();
|
||||
renderItem.renderItemAndEffectIntoGUI(fontRenderer, textureManager, stack, x, y);
|
||||
renderItem.renderItemOverlayIntoGUI(fontRenderer, textureManager, stack, x, y);
|
||||
enable2DRender();
|
||||
}
|
||||
*/
|
||||
|
||||
public static void enable3DRender() {
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
public static void enable2DRender() {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
public static void drawGradientRect(int x, int y, int w, int h, int grad1, int grad2)
|
||||
{
|
||||
float zLevel = 0.0f;
|
||||
|
||||
float f = (float)(grad1 >> 24 & 255) / 255.0F;
|
||||
float f1 = (float)(grad1 >> 16 & 255) / 255.0F;
|
||||
float f2 = (float)(grad1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (float)(grad1 & 255) / 255.0F;
|
||||
float f4 = (float)(grad2 >> 24 & 255) / 255.0F;
|
||||
float f5 = (float)(grad2 >> 16 & 255) / 255.0F;
|
||||
float f6 = (float)(grad2 >> 8 & 255) / 255.0F;
|
||||
float f7 = (float)(grad2 & 255) / 255.0F;
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorRGBA_F(f1, f2, f3, f);
|
||||
tessellator.addVertex((double)(x+w), (double)y, (double)zLevel);
|
||||
tessellator.addVertex((double)x, (double)y, (double)zLevel);
|
||||
tessellator.setColorRGBA_F(f5, f6, f7, f4);
|
||||
tessellator.addVertex((double)x, (double)(y+h), (double)zLevel);
|
||||
tessellator.addVertex((double)(x+w), (double)(y+h), (double)zLevel);
|
||||
tessellator.draw();
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(int x, int y, int u, int v, int w, int h, int tw, int th)
|
||||
{
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
float zLevel = 0.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.addVertexWithUV(x + 0, y + h, zLevel, (u + 0) * f, (v + th) * f1);
|
||||
tessellator.addVertexWithUV(x + w, y + h, zLevel, (u + tw) * f, (v + th) * f1);
|
||||
tessellator.addVertexWithUV(x + w, y + 0, zLevel, (u + tw) * f, (v + 0) * f1);
|
||||
tessellator.addVertexWithUV(x + 0, y + 0, zLevel, (u + 0) * f, (v + 0) * f1);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public static void drawString(String text, int x, int y, int colour, boolean shadow) {
|
||||
if (shadow)
|
||||
fontRenderer.drawStringWithShadow(text, x, y, colour);
|
||||
else
|
||||
fontRenderer.drawString(text, x, y, colour);
|
||||
}
|
||||
|
||||
public static List<String> itemDisplayNameMultiline(ItemStack itemstack) {
|
||||
List<String> namelist = null;
|
||||
try {
|
||||
namelist = itemstack.getTooltip(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
|
||||
} catch (Throwable ignored) {}
|
||||
|
||||
if (namelist == null)
|
||||
namelist = new ArrayList<String>();
|
||||
|
||||
if (namelist.size() == 0)
|
||||
namelist.add("Unnamed");
|
||||
|
||||
if (namelist.get(0) == null || namelist.get(0).equals(""))
|
||||
namelist.set(0, "Unnamed");
|
||||
|
||||
namelist.set(0, itemstack.getRarity().rarityColor.toString() + namelist.get(0));
|
||||
for (int i = 1; i < namelist.size(); i++)
|
||||
namelist.set(i, "\u00a77" + namelist.get(i));
|
||||
|
||||
return namelist;
|
||||
}
|
||||
|
||||
public static String itemDisplayNameShort(ItemStack itemstack) {
|
||||
List<String> list = itemDisplayNameMultiline(itemstack);
|
||||
return list.get(0);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package mcp.mobius.waila.overlay;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.lwjgl.opengl.GL12;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import codechicken.nei.guihook.GuiContainerManager;
|
||||
import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.utils.Constants;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -25,7 +23,6 @@ public class OverlayRenderer {
|
||||
protected static boolean hasRescaleNormal;
|
||||
protected static boolean hasColorMaterial;
|
||||
protected static int boundTexIndex;
|
||||
protected static RenderItem renderItem = new RenderItem();
|
||||
|
||||
public static void renderOverlay()
|
||||
{
|
||||
@@ -78,7 +75,8 @@ public class OverlayRenderer {
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
if (tooltip.hasIcon && tooltip.stack != null && tooltip.stack.getItem() != null)
|
||||
GuiContainerManager.drawItem(tooltip.x+5, tooltip.y+tooltip.h/2-8, tooltip.stack);
|
||||
DisplayUtil.renderStack(tooltip.x+5, tooltip.y+tooltip.h/2-8, tooltip.stack);
|
||||
|
||||
|
||||
loadGLState();
|
||||
GL11.glPopMatrix();
|
||||
@@ -114,33 +112,18 @@ public class OverlayRenderer {
|
||||
public static void drawTooltipBox(int x, int y, int w, int h, int bg, int grad1, int grad2)
|
||||
{
|
||||
//int bg = 0xf0100010;
|
||||
GuiDraw.drawGradientRect(x + 1, y, w - 1, 1, bg, bg);
|
||||
GuiDraw.drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg);
|
||||
GuiDraw.drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);//center
|
||||
GuiDraw.drawGradientRect(x, y + 1, 1, h - 1, bg, bg);
|
||||
GuiDraw.drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg);
|
||||
DisplayUtil.drawGradientRect(x + 1, y, w - 1, 1, bg, bg);
|
||||
DisplayUtil.drawGradientRect(x + 1, y + h, w - 1, 1, bg, bg);
|
||||
DisplayUtil.drawGradientRect(x + 1, y + 1, w - 1, h - 1, bg, bg);//center
|
||||
DisplayUtil.drawGradientRect(x, y + 1, 1, h - 1, bg, bg);
|
||||
DisplayUtil.drawGradientRect(x + w, y + 1, 1, h - 1, bg, bg);
|
||||
//int grad1 = 0x505000ff;
|
||||
//int grad2 = 0x5028007F;
|
||||
GuiDraw.drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2);
|
||||
GuiDraw.drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2);
|
||||
DisplayUtil.drawGradientRect(x + 1, y + 2, 1, h - 3, grad1, grad2);
|
||||
DisplayUtil.drawGradientRect(x + w - 1, y + 2, 1, h - 3, grad1, grad2);
|
||||
|
||||
GuiDraw.drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1);
|
||||
GuiDraw.drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2);
|
||||
}
|
||||
|
||||
public static void drawTexturedModalRect(int x, int y, int u, int v, int w, int h, int tw, int th)
|
||||
{
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
float zLevel = 0.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setColorOpaque_F(1, 1, 1);
|
||||
tessellator.addVertexWithUV(x + 0, y + h, zLevel, (u + 0) * f, (v + th) * f1);
|
||||
tessellator.addVertexWithUV(x + w, y + h, zLevel, (u + tw) * f, (v + th) * f1);
|
||||
tessellator.addVertexWithUV(x + w, y + 0, zLevel, (u + tw) * f, (v + 0) * f1);
|
||||
tessellator.addVertexWithUV(x + 0, y + 0, zLevel, (u + 0) * f, (v + 0) * f1);
|
||||
tessellator.draw();
|
||||
DisplayUtil.drawGradientRect(x + 1, y + 1, w - 1, 1, grad1, grad1);
|
||||
DisplayUtil.drawGradientRect(x + 1, y + h - 1, w - 1, 1, grad2, grad2);
|
||||
}
|
||||
|
||||
public static void renderIcon(int x, int y, int sx, int sy, IconUI icon){
|
||||
@@ -150,7 +133,7 @@ public class OverlayRenderer {
|
||||
return;
|
||||
|
||||
if (icon.bu != -1)
|
||||
drawTexturedModalRect(x, y, icon.bu, icon.bv, sx, sy, icon.bsu, icon.bsv);
|
||||
drawTexturedModalRect(x, y, icon.u, icon.v, sx, sy, icon.su, icon.sv);
|
||||
DisplayUtil.drawTexturedModalRect(x, y, icon.bu, icon.bv, sx, sy, icon.bsu, icon.bsv);
|
||||
DisplayUtil.drawTexturedModalRect(x, y, icon.u, icon.v, sx, sy, icon.su, icon.sv);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package mcp.mobius.waila.overlay;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -9,7 +10,6 @@ import java.awt.Point;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import scala.actors.threadpool.Arrays;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import mcp.mobius.waila.api.IWailaCommonAccessor;
|
||||
|
||||
@@ -8,6 +8,7 @@ import mcp.mobius.waila.api.impl.ConfigHandler;
|
||||
import mcp.mobius.waila.api.impl.DataAccessorCommon;
|
||||
import mcp.mobius.waila.api.impl.MetaDataProvider;
|
||||
import mcp.mobius.waila.api.impl.TipList;
|
||||
import mcp.mobius.waila.cbcore.Layout;
|
||||
import mcp.mobius.waila.client.KeyEvent;
|
||||
import mcp.mobius.waila.utils.Constants;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -18,7 +19,6 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import codechicken.nei.api.ItemInfo.Layout;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
@@ -2,7 +2,6 @@ package mcp.mobius.waila.overlay.tooltiprenderers;
|
||||
|
||||
import java.awt.Dimension;
|
||||
|
||||
import codechicken.lib.gui.GuiDraw;
|
||||
import mcp.mobius.waila.api.IWailaCommonAccessor;
|
||||
import mcp.mobius.waila.api.IWailaDataAccessor;
|
||||
import mcp.mobius.waila.api.IWailaTooltipRenderer;
|
||||
@@ -26,7 +25,7 @@ public class TTRenderString implements IWailaTooltipRenderer{
|
||||
|
||||
@Override
|
||||
public void draw(String[] params, IWailaCommonAccessor accessor) {
|
||||
GuiDraw.drawString(data, 0, 0, OverlayConfig.fontcolor, true);
|
||||
DisplayUtil.drawString(data, 0, 0, OverlayConfig.fontcolor, true);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user