Fixed or suppressed warnings for rawtypes and unchecked

This commit is contained in:
mezz committed 2014-09-21 01:52:57 -07:00
1 parent d314642d77
commit 2ae2cf8896
27 files changed
+54 -40

No files matched your search

@@ -65,7 +65,8 @@ public class BeekeepingLogic implements IBeekeepingLogic {
nbttagcompound.setInteger("BreedingTime", breedingTime);
nbttagcompound.setInteger("Throttle", throttle);
Stack<ItemStack> spawnCopy = (Stack)spawn.clone();
Stack<ItemStack> spawnCopy = new Stack<ItemStack>();
spawnCopy.addAll(spawn);
NBTTagList nbttaglist = new NBTTagList();
while (!spawnCopy.isEmpty()) {
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
@@ -338,9 +338,8 @@ public class Bee extends IndividualLiving implements IBee {
return biomeIdsTemp;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void addTooltip(List list) {
public void addTooltip(List<String> list) {
// No info 4 u!
if (!isAnalyzed) {
@@ -27,6 +27,7 @@ import net.minecraftforge.event.terraingen.TerrainGen;
*/
public class HiveDecorator {
@SuppressWarnings("rawtypes")
public static final EventType EVENT_TYPE = EnumHelper.addEnum(EventType.class, "FORESTRY_HIVES", new Class[0], new Object[0]);
private static HiveDecorator instance;
private final WorldGenHiveForest forest = new WorldGenHiveForest();
@@ -21,7 +21,7 @@ import forestry.plugins.PluginArboriculture;
public class WorldGenHelper implements IWorldGenInterface {
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public Class<? extends WorldGenerator>[] getTreeGenerators(String ident) {
@@ -187,6 +187,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
}
@Override
@SuppressWarnings("rawtypes")
public WorldGenerator getGenerator(ITree tree, World world, int x, int y, int z) {
try {
return generatorClass.getConstructor(new Class[] { ITreeGenData.class }).newInstance(new Object[] { tree });
@@ -195,7 +196,7 @@ public class AlleleTreeSpecies extends AlleleSpecies implements IAlleleTreeSpeci
}
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public Class<? extends WorldGenerator>[] getGeneratorClasses() {
return new Class[] { generatorClass };
@@ -1,5 +1,6 @@
package forestry.core;
public interface IItemTyped {
@SuppressWarnings("rawtypes")
public Enum getTypeFromMeta(int meta);
}
@@ -53,9 +53,8 @@ public abstract class Circuit implements ICircuit {
return "circuit." + this.uid;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void addTooltip(List list) {
public void addTooltip(List<String> list) {
list.add(StringUtil.localize(getName()));
int i = 1;
@@ -48,9 +48,8 @@ public class CircuitBoard implements ICircuitBoard {
return type.secondaryColor;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void addTooltip(List list) {
public void addTooltip(List<String> list) {
if (layout != null)
list.add("\u00A76" + layout.getUsage() + ":");
@@ -98,7 +98,6 @@ public class Config {
public static HashMap<String, String[]> hints = new HashMap<String, String[]>();
public static boolean disableEnergyStat = false;
@SuppressWarnings({ "all" })
public static void load() {
setDebugMode();
@@ -25,6 +25,8 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ICrafting;
import net.minecraft.nbt.NBTTagCompound;
@@ -170,21 +172,19 @@ public class TankManager extends ForwardingList<StandardTank> implements IFluidH
Proxies.net.sendToPlayer(packet, (EntityPlayerMP)player);
}
public void updateGuiData(Container container, List crafters) {
public void updateGuiData(Container container, List<EntityPlayerMP> crafters) {
for (StandardTank tank : tanks)
updateGuiData(container, crafters, tank.getTankIndex());
}
public void updateGuiData(Container container, List crafters, int tankIndex) {
public void updateGuiData(Container container, List<EntityPlayerMP> crafters, int tankIndex) {
StandardTank tank = tanks.get(tankIndex);
FluidStack fluidStack = tank.getFluid();
FluidStack prev = prevFluidStacks.get(tankIndex);
int color = tank.getColor();
int pColor = prevColor.get(tankIndex);
for (Object crafter1 : crafters) {
ICrafting crafter = (ICrafting) crafter1;
EntityPlayerMP player = (EntityPlayerMP) crafter1;
for (EntityPlayerMP player : crafters) {
if (fluidStack == null ^ prev == null) {
int fluidId = -1;
int fluidAmount = 0;
@@ -192,12 +192,12 @@ public class TankManager extends ForwardingList<StandardTank> implements IFluidH
fluidId = fluidStack.fluidID;
fluidAmount = fluidStack.amount;
}
crafter.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId);
player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidId);
PacketGuiInteger packet = new PacketGuiInteger(container.windowId, tankIndex * NETWORK_DATA + 1, fluidAmount);
Proxies.net.sendToPlayer(packet, player);
} else if (fluidStack != null && prev != null) {
if (fluidStack.getFluid() != prev.getFluid())
crafter.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidStack.fluidID);
player.sendProgressBarUpdate(container, tankIndex * NETWORK_DATA + 0, fluidStack.fluidID);
if (fluidStack.amount != prev.amount) {
PacketGuiInteger packet = new PacketGuiInteger(container.windowId, tankIndex * NETWORK_DATA + 1, fluidStack.amount);
Proxies.net.sendToPlayer(packet, player);
@@ -211,8 +211,7 @@ public class ItemResearchNote extends ItemForestry {
compound.setTag("INN", inner);
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public void addTooltip(List list) {
public void addTooltip(List<String> list) {
ArrayList<String> tooltips = type.getTooltip(inner);
if(tooltips.size() <= 0) {
list.add("\u00A7o\u00A7c" + StringUtil.localize("researchNote.error.0"));
@@ -239,7 +238,7 @@ public class ItemResearchNote extends ItemForestry {
return StringUtil.localizeAndFormatRaw(getUnlocalizedName(itemstack) + ".name", note.researcher.getName());
}
@SuppressWarnings("rawtypes")
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean flag) {
ResearchNote note = new ResearchNote(itemstack.getTagCompound());
@@ -78,6 +78,7 @@ public class ContainerLiquidTanks extends ContainerForestry {
}
@Override
@SuppressWarnings("unchecked")
public void detectAndSendChanges() {
super.detectAndSendChanges();
tile.getTankManager().updateGuiData(this, crafters);
@@ -15,6 +15,7 @@ public class ItemTypedBlock extends ItemForestryBlock {
}
@Override
@SuppressWarnings("rawtypes")
public String getUnlocalizedName(ItemStack itemstack) {
Block block = getBlock();
if (block instanceof IItemTyped) {
@@ -10,6 +10,7 @@
******************************************************************************/
package forestry.factory.recipes;
import java.util.ArrayList;
import java.util.Map.Entry;
import net.minecraft.item.ItemStack;
@@ -49,11 +50,13 @@ public class CraftGuideCentrifuge implements RecipeProvider {
for (MachineCentrifuge.Recipe recipe : MachineCentrifuge.RecipeManager.recipes) {
Object[] array = new Object[11];
@SuppressWarnings("unchecked")
Entry<ItemStack, Integer>[] entries = recipe.products.entrySet().toArray(new Entry[0]);
for (int i = 0; i < Math.min(entries.length, 9); i++)
array[i] = entries[i].getValue() > 0 ? new Object[]{entries[i].getKey(), entries[i].getValue()} : null;
ArrayList<Entry<ItemStack, Integer>> entries = new ArrayList<Entry<ItemStack, Integer>>(recipe.products.entrySet());
for (int i = 0; i < Math.min(entries.size(), 9); i++) {
Entry<ItemStack, Integer> entry = entries.get(i);
array[i] = entry.getValue() > 0 ? new Object[]{entry.getKey(), entry.getValue()} : null;
}
array[9] = recipe.resource;
array[10] = machine;
@@ -40,6 +40,7 @@ public class CircuitFarmLogic extends Circuit {
}
@Override
@SuppressWarnings("rawtypes")
public void onInsertion(int slot, TileEntity tile) {
if (!isCircuitable(tile))
return;
@@ -123,6 +123,7 @@ public class BlockMushroom extends BlockSapling implements IItemTyped {
}
/* ICONS */
@SuppressWarnings({"unchecked", "rawtypes"})
@SideOnly(Side.CLIENT)
@Override
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
@@ -133,6 +133,7 @@ public class ContainerFarm extends ContainerSocketed {
}
@Override
@SuppressWarnings("unchecked")
public void detectAndSendChanges() {
super.detectAndSendChanges();
TankManager tankManager = tile.getTankManager();
+1 -2
View File
@@ -250,9 +250,8 @@ public class Letter implements ILetter, INBTTagable {
return text;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public void addTooltip(List list) {
public void addTooltip(List<String> list) {
if (this.sender != null && StringUtils.isNotBlank(this.sender.getName()))
list.add(StringUtil.localize("gui.mail.from") + ": " + this.sender.getName());
if (this.recipient != null && this.recipient.length > 0)
@@ -46,7 +46,7 @@ public class ContainerCatalogue extends ContainerForestry implements IGuiSelecta
private int currentFilter = 1;
private static final String[] FILTER_NAMES = new String[] { "all", "online", "offline" };
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
private static final Set<EnumStationState>[] FILTERS = new EnumSet[] {
EnumSet.noneOf(EnumStationState.class),
EnumSet.of(EnumStationState.OK),
@@ -20,6 +20,7 @@ import forestry.plugins.PluginApiculture;
public class GuiHandlerPipes implements IGuiHandler {
@SuppressWarnings("rawtypes")
private Pipe getPipe(World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile == null)
@@ -32,6 +33,7 @@ public class GuiHandlerPipes implements IGuiHandler {
}
@Override
@SuppressWarnings("rawtypes")
public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) {
if (id >= GuiId.values().length)
@@ -31,11 +31,13 @@ import forestry.core.proxy.Proxies;
public class PipeLogicPropolis {
@SuppressWarnings("rawtypes")
private Pipe pipe;
private EnumFilterType[] typeFilter = new EnumFilterType[6];
private IAllele[][][] genomeFilter = new IAllele[6][3][2];
@SuppressWarnings("rawtypes")
public PipeLogicPropolis(Pipe pipe) {
this.pipe = pipe;
for (int i = 0; i < typeFilter.length; i++)
@@ -113,7 +115,7 @@ public class PipeLogicPropolis {
}
public ArrayList<IAllele[]> getGenomeFilters(ForgeDirection orientation) {
ArrayList<IAllele[]> filters = new ArrayList();
ArrayList<IAllele[]> filters = new ArrayList<IAllele[]>();
for (int i = 0; i < 3; i++)
if (genomeFilter[orientation.ordinal()][i] != null
@@ -17,7 +17,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.GL11;
import buildcraft.transport.Pipe;
import forestry.api.apiculture.IAlleleBeeSpecies;
import forestry.api.apiculture.IApiaristTracker;
import forestry.api.genetics.AlleleManager;
@@ -27,6 +26,7 @@ import forestry.apiculture.items.ItemBeeGE;
import forestry.core.config.Config;
import forestry.core.config.Defaults;
import forestry.core.config.ForestryItem;
import forestry.core.gadgets.TileForestry;
import forestry.core.genetics.ItemGE;
import forestry.core.gui.widgets.Widget;
import forestry.core.gui.GuiForestry;
@@ -43,7 +43,7 @@ import forestry.plugins.PluginApiculture;
*
* @author SirSengir
*/
public class GuiPropolisPipe extends GuiForestry {
public class GuiPropolisPipe<T extends TileForestry> extends GuiForestry<T> {
class TypeFilterSlot extends Widget {
@@ -164,9 +164,7 @@ public class GuiPropolisPipe extends GuiForestry {
change = null;
else if (getSpecies() == null) {
Iterator it = AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet().iterator();
while (it.hasNext()) {
Entry<String, IAllele> entry = (Entry<String, IAllele>) it.next();
for (Entry<String, IAllele> entry : AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet()) {
if (!(entry.getValue() instanceof IAlleleBeeSpecies))
continue;
@@ -176,9 +174,9 @@ public class GuiPropolisPipe extends GuiForestry {
} else {
Iterator it = AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet().iterator();
Iterator<Entry<String, IAllele>> it = AlleleManager.alleleRegistry.getRegisteredAlleles().entrySet().iterator();
while (it.hasNext()) {
Entry<String, IAllele> entry = (Entry<String, IAllele>) it.next();
Entry<String, IAllele> entry = it.next();
if (!(entry.getValue() instanceof IAlleleBeeSpecies))
continue;
@@ -187,7 +185,7 @@ public class GuiPropolisPipe extends GuiForestry {
continue;
while (it.hasNext()) {
Entry<String, IAllele> entry2 = (Entry<String, IAllele>) it.next();
Entry<String, IAllele> entry2 = it.next();
if (!(entry2.getValue() instanceof IAlleleBeeSpecies))
continue;
@@ -27,6 +27,7 @@ import forestry.pipes.gui.ContainerPropolisPipe;
public class PacketHandlerPipes implements IPacketHandler {
@SuppressWarnings("rawtypes")
private Pipe getPipe(World world, int x, int y, int z) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile == null)
@@ -83,6 +84,7 @@ public class PacketHandlerPipes implements IPacketHandler {
}
}
@SuppressWarnings("rawtypes")
private void onTypeFilterChange(EntityPlayer player, PacketUpdate packet) {
Pipe pipe = getPipe(player.worldObj, packet.posX, packet.posY, packet.posZ);
@@ -94,6 +96,7 @@ public class PacketHandlerPipes implements IPacketHandler {
}
@SuppressWarnings("rawtypes")
private void onGenomeFilterChange(EntityPlayer player, PacketUpdate packet) {
Pipe pipe = getPipe(player.worldObj, packet.posX, packet.posY, packet.posZ);
@@ -104,6 +107,7 @@ public class PacketHandlerPipes implements IPacketHandler {
((PipeItemsPropolis) pipe).pipeLogic.handleGenomeFilterChange(packet.payload);
}
@SuppressWarnings("rawtypes")
private void onRequestFilterSet(EntityPlayer player, PacketCoordinates packet) {
Pipe pipe = getPipe(player.worldObj, packet.posX, packet.posY, packet.posZ);
@@ -31,6 +31,7 @@ public class ProxyPipes {
PluginPropolisPipe.pipeItemsPropolis = createPipe(PipeItemsPropolis.class, CreativeTabBuildCraft.PIPES);
}
@SuppressWarnings("rawtypes")
public Item createPipe(Class<? extends Pipe> clas, CreativeTabBuildCraft creativeTab) {
return registerPipe(clas, creativeTab);
@@ -39,6 +40,7 @@ public class ProxyPipes {
/**
* Overriding the method in BlockGenericPipe to fix localizations.
*/
@SuppressWarnings("rawtypes")
public static ItemPipe registerPipe(Class<? extends Pipe> clas, CreativeTabBuildCraft creativeTab) {
ItemPipe item = null;
try {
+2 -2
View File
@@ -179,7 +179,7 @@ public class PluginApiculture extends ForestryPlugin {
public static MachineDefinition definitionChest;
public static MachineDefinition definitionBeehouse;
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public void preInit() {
super.preInit();
@@ -750,7 +750,7 @@ public class PluginApiculture extends ForestryPlugin {
return beeItem;
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
private void createHiveDropArrays() {
BeeManager.hiveDrops = new ArrayList[8];
@@ -483,7 +483,7 @@ public class PluginStorage extends ForestryPlugin implements IOreDictionaryHandl
}
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "rawtypes"})
private void createBackpackArrays() {
if (BackpackManager.backpackItems != null)