Skip to content

Commit

Permalink
Merge pull request RebelKeithy#76 from BlockAcquisitionConsortium/war…
Browse files Browse the repository at this point in the history
…nings

Clean up
  • Loading branch information
odininon committed Oct 4, 2013
2 parents de495e1 + f973602 commit e4f9d9c
Show file tree
Hide file tree
Showing 27 changed files with 94 additions and 131 deletions.
2 changes: 1 addition & 1 deletion common/rebelkeithy/mods/metallurgy/api/MetallurgyAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public static IMetalSet getMetalSet(String name)
{
try
{
final Class metallurgyMetals = Class.forName("rebelkeithy.mods.metallurgy.metals.MetallurgyMetals");
final Class<?> metallurgyMetals = Class.forName("rebelkeithy.mods.metallurgy.metals.MetallurgyMetals");
final Field set = metallurgyMetals.getField(name + "Set");
return (IMetalSet) set.get(null);
} catch (final NoSuchFieldException e)
Expand Down
10 changes: 5 additions & 5 deletions common/rebelkeithy/mods/metallurgy/core/MetallurgyCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ public void preInit(FMLPreInitializationEvent event)

log = event.getModLog();

for (final MetalSet set : getMetalSetList())
{
// set.initConfig();
// set.init();
}
// for (final MetalSet set : getMetalSetList())
// {
// // set.initConfig();
// // set.init();
// }

initConfig();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public void addHitListener(ISwordHitListener hl)
hlList.add(hl);
}

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public void addRecipes()
{
// System.out.println("Adding alloy recipe " + alloyRecipe[0] +
// " + " + alloyRecipe[1] + " for " + name);
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(dust, 2), alloyRecipe));
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(dust, 2), (Object[])alloyRecipe));
}
}

Expand Down
34 changes: 0 additions & 34 deletions common/rebelkeithy/mods/metallurgy/core/metalsets/SortedList.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.Mod.PreInit;
import cpw.mods.fml.common.ModMetadata;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
package rebelkeithy.mods.metallurgy.machines.abstractor;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

import net.minecraft.item.ItemStack;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Maps;
import com.google.common.collect.Table;

public class AbstractorRecipes
{
private static final AbstractorRecipes smeltingBase = new AbstractorRecipes();

/** The list of smelting results. */
private static Map smeltingList = new HashMap();
private static Map metaSmeltingList = new HashMap();
private static Map fuelList = new HashMap();
private static Map<Integer, Integer> smeltingList = Maps.newHashMap();
private static Table<Integer, Integer, Integer> metaSmeltingList = HashBasedTable.create();
private static Table<Integer, Integer, Integer> fuelList = HashBasedTable.create();

/**
* Add a metadata-sensitive furnace recipe
Expand All @@ -27,12 +29,12 @@ public class AbstractorRecipes
*/
public static void addEssence(int itemID, int metadata, int amount)
{
metaSmeltingList.put(Arrays.asList(itemID, metadata), amount);
metaSmeltingList.put(itemID, metadata, amount);
}

public static void addFuel(int itemID, int metadata, int amount)
{
fuelList.put(Arrays.asList(itemID, metadata), amount);
fuelList.put(itemID, metadata, amount);
}

/**
Expand All @@ -45,9 +47,9 @@ public static final AbstractorRecipes essence()

public static int getFuelAmount(ItemStack itemStack)
{
if (fuelList.containsKey(Arrays.asList(itemStack.itemID, itemStack.getItemDamage())))
if (fuelList.contains(itemStack.itemID, itemStack.getItemDamage()))
{
return (Integer) fuelList.get(Arrays.asList(itemStack.itemID, itemStack.getItemDamage()));
return (Integer) fuelList.get(itemStack.itemID, itemStack.getItemDamage());
}
else
{
Expand All @@ -67,7 +69,7 @@ public void addEssenceAmount(int itemID, int amount)
smeltingList.put(Integer.valueOf(itemID), amount);
}

public Map getEssenceList()
public Map<Integer, Integer> getEssenceList()
{
return smeltingList;
}
Expand All @@ -85,7 +87,7 @@ public int getEssenceResult(ItemStack item)
{
return 0;
}
Integer ret = (Integer) metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
Integer ret = (Integer) metaSmeltingList.get(item.itemID, item.getItemDamage());
if (ret != null)
{
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.List;
import java.util.Random;

import net.minecraft.entity.item.EntityXPOrb;
Expand All @@ -13,7 +12,6 @@
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.network.packet.Packet250CustomPayload;
import rebelkeithy.mods.keithyutils.Coord;
import rebelkeithy.mods.metallurgy.core.MetallurgyCore;
import rebelkeithy.mods.metallurgy.machines.ConfigMachines;
import rebelkeithy.mods.metallurgy.machines.TileEntityMachineBase;
Expand Down Expand Up @@ -457,7 +455,7 @@ public void smeltItem()
furnaceItemStacks[0] = null;
}

final List<Coord> coords = Coord.get4AdjacentSides(xCoord, yCoord, zCoord);
// final List<Coord> coords = Coord.get4AdjacentSides(xCoord, yCoord, zCoord);

// for (final Coord coord : coords)
// {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class BlockPreciousChest extends BlockContainer
*/
private static boolean isOcelotBlockingChest(World par0World, int par1, int par2, int par3)
{
final Iterator var4 = par0World.getEntitiesWithinAABB(EntityOcelot.class, AxisAlignedBB.getAABBPool().getAABB(par1, par2 + 1, par3, par1 + 1, par2 + 2, par3 + 1))
final Iterator<?> var4 = par0World.getEntitiesWithinAABB(EntityOcelot.class, AxisAlignedBB.getAABBPool().getAABB(par1, par2 + 1, par3, par1 + 1, par2 + 2, par3 + 1))
.iterator();
EntityOcelot var6;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public ItemBlockPreciousChest(int i)
setHasSubtypes(true);
}

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
package rebelkeithy.mods.metallurgy.machines.crusher;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import rebelkeithy.mods.metallurgy.machines.MetallurgyMachines;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import rebelkeithy.mods.metallurgy.machines.MetallurgyMachines;

import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Maps;
import com.google.common.collect.Table;

public class CrusherRecipes
{
private static final CrusherRecipes smeltingBase = new CrusherRecipes();

/** The list of smelting results. */
private static Map smeltingList = new HashMap();
private static Map metaSmeltingList = new HashMap();
private static Map<Integer, ItemStack> smeltingList = Maps.newHashMap();
private static Table<Integer, Integer, ItemStack> metaSmeltingList = HashBasedTable.create();

/**
* Add a metadata-sensitive furnace recipe
Expand All @@ -30,7 +32,7 @@ public class CrusherRecipes
*/
public static void addCrushing(int itemID, int metadata, ItemStack itemstack)
{
metaSmeltingList.put(Arrays.asList(itemID, metadata), itemstack);
metaSmeltingList.put(itemID, metadata, itemstack);
}

/**
Expand All @@ -53,7 +55,7 @@ public void addCrushing(int par1, ItemStack par2ItemStack)
smeltingList.put(Integer.valueOf(par1), par2ItemStack);
}

public Map getCrushingList()
public Map<Integer, ItemStack> getCrushingList()
{
return smeltingList;
}
Expand All @@ -65,7 +67,7 @@ public Map getCrushingList()
@Deprecated
public ItemStack getCrushingResult(int par1)
{
return (ItemStack) smeltingList.get(Integer.valueOf(par1));
return smeltingList.get(Integer.valueOf(par1));
}

/**
Expand All @@ -82,14 +84,14 @@ public ItemStack getCrushingResult(ItemStack item)
return null;
}

ItemStack ret = (ItemStack) metaSmeltingList.get(Arrays.asList(item.itemID, item.getItemDamage()));
ItemStack ret = metaSmeltingList.get(item.itemID, item.getItemDamage());

if (ret != null)
{
return ret;
}

ret = (ItemStack) smeltingList.get(Integer.valueOf(item.itemID));
ret = smeltingList.get(Integer.valueOf(item.itemID));
if (ret != null)
{
return ret;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ else if (item.itemID == MetallurgyMetals.fantasySet.getOreInfo("Carmot").dust.it
}
}

final List list = MaxEnchanterHelper.buildEnchantmentList(rand, itemstack, enchantLevels, catalyst);
final List<EnchantmentData> list = MaxEnchanterHelper.buildEnchantmentList(rand, itemstack, enchantLevels, catalyst);
final boolean flag = itemstack.itemID == Item.book.itemID;

if (list != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.model.ModelBook;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
Expand All @@ -28,8 +27,6 @@ public class GuiMetallurgyEnchantment extends GuiContainer
private static final ResourceLocation background = new ResourceLocation("metallurgy:textures/guis/enchant.png");
private static final ResourceLocation book = new ResourceLocation("textures/entity/enchanting_table_book.png");

/** The book model used on the GUI. */
private static ModelBook bookModel = new ModelBook();
private final Random rand = new Random();

/** ContainerEnchantment object associated with this gui */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import java.util.Map;
import java.util.Random;

import com.google.common.collect.Lists;

import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentData;
import net.minecraft.item.Item;
Expand All @@ -23,7 +25,7 @@ public class MaxEnchanterHelper
*
* @param catalyst
*/
public static List buildEnchantmentList(Random par0Random, ItemStack par1ItemStack, int par2, int catalyst)
public static List<EnchantmentData> buildEnchantmentList(Random par0Random, ItemStack par1ItemStack, int par2, int catalyst)
{
final Item item = par1ItemStack.getItem();
int j = item.getItemEnchantability();
Expand All @@ -45,33 +47,33 @@ public static List buildEnchantmentList(Random par0Random, ItemStack par1ItemSta
l = 1;
}

ArrayList arraylist = null;
final Map map = mapEnchantmentData(l, par1ItemStack);
ArrayList<EnchantmentData> arraylist = null;
final Map<Integer, EnchantmentData> map = mapEnchantmentData(l, par1ItemStack);

if (map != null && !map.isEmpty())
{
final EnchantmentData enchantmentdata = (EnchantmentData) WeightedRandom.getRandomItem(par0Random, map.values());

if (enchantmentdata != null)
{
arraylist = new ArrayList();
arraylist = Lists.newArrayList();
arraylist.add(enchantmentdata);

for (int i1 = l; par0Random.nextInt(50) <= i1; i1 >>= 1)
{
final Iterator iterator = map.keySet().iterator();
final Iterator<Integer> iterator = map.keySet().iterator();

while (iterator.hasNext())
{
final Integer integer = (Integer) iterator.next();
final Integer integer = iterator.next();
boolean flag = true;
final Iterator iterator1 = arraylist.iterator();
final Iterator<EnchantmentData> iterator1 = arraylist.iterator();

while (true)
{
if (iterator1.hasNext())
{
final EnchantmentData enchantmentdata1 = (EnchantmentData) iterator1.next();
final EnchantmentData enchantmentdata1 = iterator1.next();

if (enchantmentdata1.enchantmentobj.canApplyTogether(Enchantment.enchantmentsList[integer.intValue()]))
{
Expand Down Expand Up @@ -132,10 +134,10 @@ public static int calcItemStackEnchantability(Random par0Random, int shelves, It
* Creates a 'Map' of EnchantmentData (enchantments) possible to add on the
* ItemStack and the enchantability level passed.
*/
public static Map mapEnchantmentData(int par0, ItemStack par1ItemStack)
public static Map<Integer, EnchantmentData> mapEnchantmentData(int par0, ItemStack par1ItemStack)
{
par1ItemStack.getItem();
HashMap hashmap = null;
HashMap<Integer, EnchantmentData> hashmap = null;
final boolean flag = par1ItemStack.itemID == Item.book.itemID;
final Enchantment[] aenchantment = Enchantment.enchantmentsList;
final int j = aenchantment.length;
Expand All @@ -154,7 +156,7 @@ public static Map mapEnchantmentData(int par0, ItemStack par1ItemStack)
{
if (hashmap == null)
{
hashmap = new HashMap();
hashmap = new HashMap<Integer, EnchantmentData>();
}

hashmap.put(Integer.valueOf(enchantment.effectId), new EnchantmentData(enchantment, l));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public int getMetadata(int i)
return i;
}

@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public int getMetadata(int i)
return i;
}

@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
/**
* returns a list of items with the same ID, but different meta (eg: dye returns 16 items)
Expand Down
Loading

0 comments on commit e4f9d9c

Please sign in to comment.