Skip to content

Commit

Permalink
Removed some old fluff
Browse files Browse the repository at this point in the history
Also, fixed the text-coloration issue
  • Loading branch information
Laikulo committed Aug 9, 2014
1 parent 7f832b8 commit d9aee80
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
6 changes: 0 additions & 6 deletions src/main/java/roycurtis/EnchantIcons.java
Original file line number Diff line number Diff line change
@@ -1,26 +1,20 @@
package roycurtis;

import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import net.minecraft.init.Items;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.io.File;

@Mod(modid = EnchantIcons.MODID, version = EnchantIcons.VERSION)
public class EnchantIcons
{
public static final String MODID = "enchanticons";
public static final String VERSION = "0.0.1";

public static Logger Logger;
public static File BaseDir;
public static EnchantIconsConfiguration config;

@EventHandler
Expand Down
13 changes: 7 additions & 6 deletions src/main/java/roycurtis/EnchantIconsRenderer.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package roycurtis;

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.item.ItemEnchantedBook;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagList;
Expand Down Expand Up @@ -31,21 +31,22 @@ public boolean shouldUseRenderHelper(ItemRenderType itemRenderType, ItemStack it
@Override
public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Object... objects)
{

ItemEnchantedBook book = (ItemEnchantedBook) itemStack.getItem();
NBTTagList enchants = book.func_92110_g(itemStack);

GL11.glScalef(0.5f, 0.5f, 0.5f);
renderItem.renderItemIntoGUI(mc.fontRenderer, mc.getTextureManager(), itemStack, 0, 16, true);
GL11.glScalef(2f, 2f, 2f);


RenderHelper.disableStandardItemLighting();
if (enchants == null || enchants.tagCount() == 0)
return;

int id = enchants.getCompoundTagAt(0).getShort("id");
int level = enchants.getCompoundTagAt(0).getShort("lvl");

Enchantment enchant = Enchantment.enchantmentsList[id];

String ident = EnchantIcons.config.nameMap.get(id);
String label = enchants.tagCount() > 1
? "*"
Expand All @@ -58,10 +59,10 @@ public void renderItem(ItemRenderType itemRenderType, ItemStack itemStack, Objec
: id > 30 ? 0xFFFFCCCC
: id > 15 ? 0xFFCCCCFF
: 0xFFFFCCFF;

mc.fontRenderer.drawString(ident, 0, 0, color, true);
mc.fontRenderer.drawStringWithShadow(ident,0,0,color);
}

mc.fontRenderer.drawString(label, 16 - mc.fontRenderer.getStringWidth(label) , 16 - mc.fontRenderer.FONT_HEIGHT, 0xFFDDDDDD, true);
mc.fontRenderer.drawStringWithShadow(label, 16 - mc.fontRenderer.getStringWidth(label), 16 - mc.fontRenderer.FONT_HEIGHT, 0xFFDDDDDD);
RenderHelper.enableGUIStandardItemLighting();
}
}

0 comments on commit d9aee80

Please sign in to comment.