Removing the now unnecessary CustomItemRarity piece

This commit is contained in:
pahimar 2013-04-02 15:51:27 -04:00
parent bf09bdb8a6
commit e5228cb697
8 changed files with 23 additions and 144 deletions

View file

@ -112,9 +112,6 @@ public class EquivalentExchange3 {
@Init @Init
public void load(FMLInitializationEvent event) { public void load(FMLInitializationEvent event) {
// Initialize the custom item rarity types
proxy.initCustomRarityTypes();
// Register the GUI Handler // Register the GUI Handler
NetworkRegistry.instance().registerGuiHandler(instance, proxy); NetworkRegistry.instance().registerGuiHandler(instance, proxy);

View file

@ -1,32 +1,9 @@
package com.pahimar.ee3.core.proxy; package com.pahimar.ee3.core.proxy;
import static com.pahimar.ee3.lib.CustomItemRarity.COLOR_EPIC;
import static com.pahimar.ee3.lib.CustomItemRarity.COLOR_JUNK;
import static com.pahimar.ee3.lib.CustomItemRarity.COLOR_LEGENDARY;
import static com.pahimar.ee3.lib.CustomItemRarity.COLOR_MAGICAL;
import static com.pahimar.ee3.lib.CustomItemRarity.COLOR_NORMAL;
import static com.pahimar.ee3.lib.CustomItemRarity.COLOR_RARE;
import static com.pahimar.ee3.lib.CustomItemRarity.COLOR_UNCOMMON;
import static com.pahimar.ee3.lib.CustomItemRarity.DISPLAY_NAME_EPIC;
import static com.pahimar.ee3.lib.CustomItemRarity.DISPLAY_NAME_JUNK;
import static com.pahimar.ee3.lib.CustomItemRarity.DISPLAY_NAME_LEGENDARY;
import static com.pahimar.ee3.lib.CustomItemRarity.DISPLAY_NAME_MAGICAL;
import static com.pahimar.ee3.lib.CustomItemRarity.DISPLAY_NAME_NORMAL;
import static com.pahimar.ee3.lib.CustomItemRarity.DISPLAY_NAME_RARE;
import static com.pahimar.ee3.lib.CustomItemRarity.DISPLAY_NAME_UNCOMMON;
import static com.pahimar.ee3.lib.CustomItemRarity.EPIC;
import static com.pahimar.ee3.lib.CustomItemRarity.JUNK;
import static com.pahimar.ee3.lib.CustomItemRarity.LEGENDARY;
import static com.pahimar.ee3.lib.CustomItemRarity.MAGICAL;
import static com.pahimar.ee3.lib.CustomItemRarity.NORMAL;
import static com.pahimar.ee3.lib.CustomItemRarity.RARE;
import static com.pahimar.ee3.lib.CustomItemRarity.UNCOMMON;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.client.EnumHelperClient;
import net.minecraftforge.client.MinecraftForgeClient; import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
@ -105,28 +82,6 @@ public class ClientProxy extends CommonProxy {
MinecraftForge.EVENT_BUS.register(new SoundHandler()); MinecraftForge.EVENT_BUS.register(new SoundHandler());
} }
@Override
public void initCustomRarityTypes() {
EnumHelperClient.addRarity(JUNK, COLOR_JUNK, DISPLAY_NAME_JUNK);
EnumHelperClient.addRarity(NORMAL, COLOR_NORMAL, DISPLAY_NAME_NORMAL);
EnumHelperClient.addRarity(UNCOMMON, COLOR_UNCOMMON, DISPLAY_NAME_UNCOMMON);
EnumHelperClient.addRarity(MAGICAL, COLOR_MAGICAL, DISPLAY_NAME_MAGICAL);
EnumHelperClient.addRarity(RARE, COLOR_RARE, DISPLAY_NAME_RARE);
EnumHelperClient.addRarity(EPIC, COLOR_EPIC, DISPLAY_NAME_EPIC);
EnumHelperClient.addRarity(LEGENDARY, COLOR_LEGENDARY, DISPLAY_NAME_LEGENDARY);
}
@Override
public EnumRarity getCustomRarityType(String customRarity) {
for (EnumRarity rarity : EnumRarity.class.getEnumConstants()) {
if (rarity.name().equals(customRarity))
return rarity;
}
return EnumRarity.common;
}
@Override @Override
public void initRenderingAndTextures() { public void initRenderingAndTextures() {

View file

@ -1,7 +1,6 @@
package com.pahimar.ee3.core.proxy; package com.pahimar.ee3.core.proxy;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection; import net.minecraftforge.common.ForgeDirection;
@ -58,15 +57,6 @@ public class CommonProxy implements IGuiHandler {
} }
public void initCustomRarityTypes() {
}
public EnumRarity getCustomRarityType(String customRarity) {
return null;
}
public void initRenderingAndTextures() { public void initRenderingAndTextures() {
} }

View file

@ -4,13 +4,12 @@ import java.util.List;
import net.minecraft.client.renderer.texture.IconRegister; import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.Icon; import net.minecraft.util.Icon;
import net.minecraft.util.MathHelper; import net.minecraft.util.MathHelper;
import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.lib.CustomItemRarity;
import com.pahimar.ee3.lib.Reference; import com.pahimar.ee3.lib.Reference;
import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Strings;
@ -82,30 +81,28 @@ public class ItemAlchemicalDust extends ItemEE {
else else
return false; return false;
} }
@Override @Override
@SideOnly(Side.CLIENT) public String getItemDisplayName(ItemStack itemStack) {
public EnumRarity getRarity(ItemStack stack) {
int meta = MathHelper.clamp_int(itemStack.getItemDamage(), 0, 5);
int meta = MathHelper.clamp_int(stack.getItemDamage(), 0, 11);
switch (meta) { switch (meta) {
case 0: case 0:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.NORMAL); return EnumChatFormatting.WHITE + super.getItemDisplayName(itemStack);
case 1: case 1:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.NORMAL); return EnumChatFormatting.WHITE + super.getItemDisplayName(itemStack);
case 2: case 2:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.UNCOMMON); return EnumChatFormatting.GREEN + super.getItemDisplayName(itemStack);
case 3: case 3:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.MAGICAL); return EnumChatFormatting.BLUE + super.getItemDisplayName(itemStack);
case 4: case 4:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.EPIC); return EnumChatFormatting.DARK_PURPLE + super.getItemDisplayName(itemStack);
case 5: case 5:
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.LEGENDARY); return EnumChatFormatting.GOLD + super.getItemDisplayName(itemStack);
default: default:
return EnumRarity.common; return EnumChatFormatting.WHITE + super.getItemDisplayName(itemStack);
} }
} }
@Override @Override

View file

@ -1,15 +1,14 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.configuration.ConfigurationSettings; import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.core.helper.NBTHelper;
import com.pahimar.ee3.core.helper.TransmutationHelper; import com.pahimar.ee3.core.helper.TransmutationHelper;
import com.pahimar.ee3.lib.CustomItemRarity;
import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Strings;
@ -41,12 +40,11 @@ public class ItemMiniumStone extends ItemEE implements ITransmutationStone, IKey
return NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN) || NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN); return NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN) || NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
} }
@Override @Override
@SideOnly(Side.CLIENT) public String getItemDisplayName(ItemStack itemStack) {
public EnumRarity getRarity(ItemStack stack) {
return EnumChatFormatting.DARK_PURPLE + super.getItemDisplayName(itemStack);
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.MAGICAL);
} }
@Override @Override

View file

@ -1,15 +1,14 @@
package com.pahimar.ee3.item; package com.pahimar.ee3.item;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumRarity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World; import net.minecraft.world.World;
import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.EquivalentExchange3;
import com.pahimar.ee3.configuration.ConfigurationSettings; import com.pahimar.ee3.configuration.ConfigurationSettings;
import com.pahimar.ee3.core.helper.NBTHelper; import com.pahimar.ee3.core.helper.NBTHelper;
import com.pahimar.ee3.core.helper.TransmutationHelper; import com.pahimar.ee3.core.helper.TransmutationHelper;
import com.pahimar.ee3.lib.CustomItemRarity;
import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.GuiIds;
import com.pahimar.ee3.lib.Sounds; import com.pahimar.ee3.lib.Sounds;
import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Strings;
@ -49,12 +48,11 @@ public class ItemPhilosophersStone extends ItemEE
return NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN) || NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN); return NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_CRAFTING_GUI_OPEN) || NBTHelper.hasTag(itemStack, Strings.NBT_ITEM_TRANSMUTATION_GUI_OPEN);
} }
@Override @Override
@SideOnly(Side.CLIENT) public String getItemDisplayName(ItemStack itemStack) {
public EnumRarity getRarity(ItemStack itemStack) {
return EquivalentExchange3.proxy.getCustomRarityType(CustomItemRarity.RARE); return EnumChatFormatting.BLUE + super.getItemDisplayName(itemStack);
} }
@Override @Override

View file

@ -1,56 +0,0 @@
package com.pahimar.ee3.lib;
/**
* Equivalent-Exchange-3
*
* CustomItemRarity
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
public class CustomItemRarity {
// Colour Value Guide
// 0 = Black
// 1 = Dark Blue
// 2 = Green
// 3 = Cyan
// 4 = Dark Red
// 5 = Purple
// 6 = Orange
// 7 = Light Grey
// 8 = Dark Grey
// 9 = Blue
// 10 = Light Green
// 11 = Light Cyan
// 12 = Light Red
// 13 = Pink
// 14 = Yellow
// 15 = White
public static final int COLOR_JUNK = 7;
public static final int COLOR_NORMAL = 15;
public static final int COLOR_UNCOMMON = 10;
public static final int COLOR_MAGICAL = 9;
public static final int COLOR_RARE = 14;
public static final int COLOR_EPIC = 5;
public static final int COLOR_LEGENDARY = 6;
public static final String JUNK = "custom_junk";
public static final String NORMAL = "custom_normal";
public static final String UNCOMMON = "custom_uncommon";
public static final String MAGICAL = "custom_magical";
public static final String RARE = "custom_rare";
public static final String EPIC = "custom_epic";
public static final String LEGENDARY = "custom_legendary";
public static final String DISPLAY_NAME_JUNK = "Junk";
public static final String DISPLAY_NAME_NORMAL = "Normal";
public static final String DISPLAY_NAME_UNCOMMON = "Uncommon";
public static final String DISPLAY_NAME_MAGICAL = "Magical";
public static final String DISPLAY_NAME_RARE = "Rare";
public static final String DISPLAY_NAME_EPIC = "Epic";
public static final String DISPLAY_NAME_LEGENDARY = "Legendary";
}

View file

@ -15,7 +15,7 @@ public class Face {
public void addFaceForRender(Tessellator tessellator) { public void addFaceForRender(Tessellator tessellator) {
addFaceForRender(tessellator, 0.0002F); addFaceForRender(tessellator, 0.0005F);
} }
public void addFaceForRender(Tessellator tessellator, float textureOffset) { public void addFaceForRender(Tessellator tessellator, float textureOffset) {