diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-08-22 19:58:44 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2019-08-22 19:58:44 -0400 |
| commit | 0880617e020f01b783a52e287d83e17e6f40d3a5 (patch) | |
| tree | 27050dafa402cb72320040e8f93b048b5640d8dd | |
| parent | 9a4d1e95ea7784f0f98ea2913701a3a3c28aefaa (diff) | |
Speed up loading
| -rwxr-xr-x | src/main/java/darkknight/jewelrycraft/api/Curse.java | 2 | ||||
| -rwxr-xr-x | src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java | 121 |
2 files changed, 19 insertions, 104 deletions
diff --git a/src/main/java/darkknight/jewelrycraft/api/Curse.java b/src/main/java/darkknight/jewelrycraft/api/Curse.java index c3af0f0..dd220f1 100755 --- a/src/main/java/darkknight/jewelrycraft/api/Curse.java +++ b/src/main/java/darkknight/jewelrycraft/api/Curse.java @@ -21,7 +21,9 @@ import net.minecraftforge.event.world.BlockEvent; public abstract class Curse {
protected int textureID, ticksActive;
protected String name, description, texturePackName;
+
protected Random rand = new Random();
+
private static ArrayList<Curse> curses = new ArrayList<>();
public static ArrayList<Curse> availableCurses = new ArrayList<>();
diff --git a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java index bab97d1..397f501 100755 --- a/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java +++ b/src/main/java/darkknight/jewelrycraft/util/JewelrycraftUtil.java @@ -84,40 +84,20 @@ public class JewelrycraftUtil { jewelry.add(new ItemStack(ItemList.bracelet));
jewelry.add(new ItemStack(ItemList.earrings));
- // Add random modifiers
- for (Object item : GameData.getItemRegistry()) {
- if (item != null) {
- if (Loader.isModLoaded("Mantle")
- && ((Item) item).getUnlocalizedName()
- .equals("Mantle:item.mantle.manual")) {
- continue;
- }
-
- try {
- if (itemHasSubtypes(item)) {
- ((Item) item).getSubItems(
- (Item) item,
- null,
- items);
- } else {
- objects.add(new ItemStack(
- (Item) item));
- }
-
- if (!items.isEmpty()) {
- objects.addAll(items);
- }
+ for(ItemStack is : gem) {
+ objects.add(is.copy());
+ }
- items.removeAll(items);
- } catch (Exception e) {
- JewelrycraftMod.logger.info(
- "Error, tried to add subtypes of item "
- + ((Item) item).getUnlocalizedName()
- + "\nItem is not added in the list.");
- }
- }
+ for(ItemStack is : metal) {
+ objects.add(is.copy());
}
+ objects.add(new ItemStack(Items.blaze_powder));
+ 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 {
for (Field f : Generation.class
@@ -139,6 +119,10 @@ public class JewelrycraftUtil { @SideOnly(Side.CLIENT)
public static void generateColors() {
+ /*
+ * Doesn't seem to do much of anything
+ */
+ /*
for (Object item : GameData.getItemRegistry()) {
if (item != null) {
if (Loader.isModLoaded("Mantle")
@@ -177,6 +161,7 @@ public class JewelrycraftUtil { }
}
}
+ */
}
@SideOnly(Side.CLIENT)
@@ -206,36 +191,6 @@ public class JewelrycraftUtil { return (int) Math.random() * 16777215;
}
- // This takes too long for me
- // IResourceManager rm =
- // Minecraft.getMinecraft().getResourceManager();
- // ResourceLocation ingot;
- // BufferedImage icon;
- // try {
- // ingot = getLocation(stack);
- // } catch (Exception e) {
- // ingot = new
- // ResourceLocation("textures/items/apple.png");
- // }
- // icon =
- // ImageIO.read(rm.getResource(ingot).getInputStream());
- // int height = icon.getHeight();
- // int width = icon.getWidth();
- // Map m = new HashMap();
- // for (int i = 0; i < width; i++)
- // for (int j = 0; j < height; j++) {
- // int rgb = icon.getRGB(i, j);
- // int red = rgb >> 16 & 0xff;
- // int green = rgb >> 8 & 0xff;
- // int blue = rgb & 0xff;
- // int[] rgbArr = { red, green, blue };
- // int Cmax = Math.max(red, Math.max(green, blue));
- // int Cmin = Math.min(red, Math.min(green, blue));
- // if (!isGray(rgbArr))
- // m.put(rgb, (Cmax + Cmin) / 2);
- // }
- // return getMostCommonColour(m);
-
return stack.getItem().getColorFromItemStack(stack,
pass);
}
@@ -437,49 +392,7 @@ public class JewelrycraftUtil { * Links ores with their appropriate ingot
*/
public static void addMetals() {
- /*
- * int index = 0;
- *
- * while (index < OreDictionary.getOreNames().length) {
- * Iterator<ItemStack> i = OreDictionary
- * .getOres(OreDictionary.getOreNames()[index])
- * .iterator();
- *
- * while (i.hasNext()) { ItemStack nextStack = i.next();
- *
- * String stackName =
- * nextStack.getItem().getUnlocalizedName() .toLowerCase();
- *
- * if ((stackName.contains("ingot") ||
- * stackName.contains("alloy")) &&
- * !metal.contains(nextStack)) { metal.add(nextStack); }
- *
- * if
- * (nextStack.getItem().getUnlocalizedName().toLowerCase()
- * .contains("ore") && !ores.contains(nextStack)) {
- * ItemStack ingot = FurnaceRecipes.smelting()
- * .getSmeltingResult(nextStack);
- *
- * if (ingot != null && (ingot.getItem()
- * .getUnlocalizedName().toLowerCase() .contains("ingot")
- * || ingot.getItem().getUnlocalizedName()
- * .toLowerCase().contains("alloy"))) {
- * ores.add(nextStack);
- *
- * oreToIngot.put(nextStack, ingot);
- *
- * JewelrycraftMod.logger.info(nextStack + " Adding " +
- * nextStack.getDisplayName() + " with damage value " +
- * nextStack.getItemDamage() + " and with " +
- * nextStack.stackSize + " in stack");
- *
- * JewelrycraftMod.logger.info(ingot + " Adding ingot " +
- * ingot.getDisplayName() + " with damage value " +
- * ingot.getItemDamage() + " and with " + ingot.stackSize +
- * " in stack"); } } }
- *
- * index++; }
- */
+ /* Doesn't do anything, because I've disabled the ingot cast */
}
/**
|
