summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java')
-rwxr-xr-xsrc/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java93
1 files changed, 36 insertions, 57 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
index 1592609..7a85cff 100755
--- a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
+++ b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java
@@ -1,5 +1,6 @@
package darkknight.jewelrycraft.util;
+import java.awt.Color;
import java.lang.reflect.Field;
import java.util.*;
@@ -58,13 +59,32 @@ public class JewelrycraftUtil {
* Adds gems and jewelry to their appropriate lists
*/
public static void addStuff() {
+ // Metals
+ metal.add(new ItemStack(Items.bone));
+ metal.add(new ItemStack(Items.brick));
+ metal.add(new ItemStack(Items.gold_ingot));
+ metal.add(new ItemStack(Items.iron_ingot));
+ metal.add(new ItemStack(Items.paper));
+ metal.add(new ItemStack(Items.netherbrick));
+ metal.add(new ItemStack(Blocks.clay));
+ metal.add(new ItemStack(Blocks.cobblestone));
+ metal.add(new ItemStack(Blocks.glass));
+ metal.add(new ItemStack(Blocks.ice));
+ metal.add(new ItemStack(Blocks.mossy_cobblestone));
+ metal.add(new ItemStack(Blocks.netherrack));
+ metal.add(new ItemStack(Blocks.obsidian));
+ metal.add(new ItemStack(Blocks.sandstone));
+ metal.add(new ItemStack(Blocks.stone));
+
// Jewels
for (int i = 0; i < 16; i++) {
gem.add(new ItemStack(BlockList.crystal, 1, i));
}
+ gem.add(new ItemStack(Blocks.glowstone));
gem.add(new ItemStack(Blocks.redstone_block));
gem.add(new ItemStack(Blocks.lapis_block));
+ gem.add(new ItemStack(Items.quartz));
gem.add(new ItemStack(Blocks.obsidian));
gem.add(new ItemStack(Items.diamond));
gem.add(new ItemStack(Items.emerald));
@@ -89,7 +109,6 @@ public class JewelrycraftUtil {
objects.add(new ItemStack(Items.ender_eye));
objects.add(new ItemStack(Items.ender_pearl));
objects.add(new ItemStack(Items.feather));
- objects.add(new ItemStack(Blocks.obsidian));
// Structures
try {
@@ -106,7 +125,20 @@ public class JewelrycraftUtil {
@SideOnly(Side.CLIENT)
public static void generateColors() {
+ for (ItemStack is : objects) {
+ int rgb = getRandomRGBColor();
+ colors.put(is, rgb);
+ }
+ }
+
+ public static int getRandomRGBColor() {
+ float r = rand.nextFloat();
+ float g = rand.nextFloat();
+ float b = rand.nextFloat();
+ Color clr = new Color(r, g, b);
+ int rgb = clr.getRGB();
+ return rgb;
}
@SideOnly(Side.CLIENT)
@@ -121,7 +153,9 @@ public class JewelrycraftUtil {
}
}
- return 0xFFFFFF;
+ int rgb = getRandomRGBColor();
+ colors.put(item, rgb);
+ return rgb;
}
@SideOnly(Side.CLIENT)
@@ -139,61 +173,6 @@ public class JewelrycraftUtil {
return (int) Math.random() * 16777215;
}
- public static ResourceLocation getLocation(ItemStack item) {
- String domain = "";
-
- String texture;
-
- IIcon itemIcon = item.getItem().getIcon(item, 0);
-
- if (isValidBlockFromItem(item)) {
- itemIcon = Block.getBlockFromItem(item.getItem()).getIcon(0, item.getItemDamage());
- }
-
- String iconName = itemIcon.getIconName();
-
- if (iconName.substring(0, iconName.indexOf(":") + 1) != "") {
- domain = iconName.substring(0, iconName.indexOf(":") + 1).replace(":", " ").trim();
- } else {
- domain = "minecraft";
- }
-
- texture = iconName.substring(iconName.lastIndexOf(":") + 1) + ".png";
-
- ResourceLocation textureLocation = null;
-
- TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
-
- String textureBase = texturemanager.getResourceLocation(item.getItemSpriteNumber()).toString();
-
- if (textureBase.contains("items")) {
- textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/items/" + texture);
- } else {
- textureLocation = new ResourceLocation(domain.toLowerCase(), "textures/blocks/" + texture);
- }
-
- return textureLocation;
- }
-
- private static boolean isValidBlockFromItem(ItemStack item) {
- boolean isAirBlock = Block.getBlockFromItem(item.getItem()) instanceof BlockAir;
- boolean isSoulSand = Block.getBlockFromItem(item.getItem()).getIcon(0, item.getItemDamage()).getIconName()
- .equals("soul_sand");
-
- return !(isAirBlock || isSoulSand);
- }
-
- @SideOnly(Side.CLIENT)
- public static boolean isGray(int[] rgbArr) {
- int rgbSum = rgbArr[0] + rgbArr[1] + rgbArr[2];
-
- if (rgbSum > 0 && rgbSum < 256 * 3) {
- return false;
- }
-
- return true;
- }
-
public static WeightedRandomCurse[] getCurses(World world, EntityPlayer player, Random random) {
WeightedRandomCurse[] curses = new WeightedRandomCurse[Curse.availableCurses.size()];