Clean up null issues, add more annotations (#3590)

This commit is contained in:
James Mitchell authored and LexManos committed 2017-01-11 15:17:56 -08:00
1 parent 43efa3cfc4
commit c545b8ecd4
130 files changed
+629 -262

No files matched your search

@@ -30,6 +30,7 @@ import java.util.Set;
import net.minecraft.block.BlockPrismarine;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.ModContainer;
import org.apache.logging.log4j.Level;
import net.minecraft.block.Block;
@@ -608,9 +609,11 @@ public class OreDictionary
int hash;
if (registryName == null)
{
ModContainer modContainer = Loader.instance().activeModContainer();
String modContainerName = modContainer == null ? null : modContainer.getName();
FMLLog.bigWarning("A broken ore dictionary registration with name %s has occurred. It adds an item (type: %s) which is currently unknown to the game registry. This dictionary item can only support a single value when"
+ " registered with ores like this, and NO I am not going to turn this spam off. Just register your ore dictionary entries after the GameRegistry.\n"
+ "TO USERS: YES this is a BUG in the mod "+Loader.instance().activeModContainer().getName()+" report it to them!", name, ore.getItem().getClass());
+ "TO USERS: YES this is a BUG in the mod " + modContainerName + " report it to them!", name, ore.getItem().getClass());
hash = -1;
}
else
@@ -47,6 +47,9 @@ import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.item.crafting.ShieldRecipes;
import net.minecraft.item.crafting.RecipesBanners.RecipeAddPattern;
import net.minecraft.item.crafting.RecipesBanners.RecipeDuplicatePattern;
import javax.annotation.Nullable;
import static net.minecraftforge.oredict.RecipeSorter.Category.*;
public class RecipeSorter implements Comparator<IRecipe>
@@ -64,12 +67,13 @@ public class RecipeSorter implements Comparator<IRecipe>
private static class SortEntry
{
private String name;
@Nullable
private Class<?> cls;
private Category cat;
List<String> before = Lists.newArrayList();
List<String> after = Lists.newArrayList();
private SortEntry(String name, Class<?> cls, Category cat, String deps)
private SortEntry(String name, @Nullable Class<?> cls, Category cat, String deps)
{
this.name = name;
this.cls = cls;
@@ -42,6 +42,7 @@ public class ShapedOreRecipe implements IRecipe
public static final int MAX_CRAFT_GRID_WIDTH = 3;
public static final int MAX_CRAFT_GRID_HEIGHT = 3;
@Nonnull
protected ItemStack output = ItemStack.EMPTY;
protected Object[] input = null;
protected int width = 0;
@@ -175,12 +176,14 @@ public class ShapedOreRecipe implements IRecipe
}
@Override
public ItemStack getCraftingResult(InventoryCrafting var1){ return output.copy(); }
@Nonnull
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1){ return output.copy(); }
@Override
public int getRecipeSize(){ return input.length; }
@Override
@Nonnull
public ItemStack getRecipeOutput(){ return output; }
@Override
@@ -37,6 +37,7 @@ import javax.annotation.Nonnull;
public class ShapelessOreRecipe implements IRecipe
{
@Nonnull
protected ItemStack output = ItemStack.EMPTY;
protected NonNullList<Object> input = NonNullList.create();
@@ -100,10 +101,12 @@ public class ShapelessOreRecipe implements IRecipe
public int getRecipeSize(){ return input.size(); }
@Override
@Nonnull
public ItemStack getRecipeOutput(){ return output; }
@Override
public ItemStack getCraftingResult(InventoryCrafting var1){ return output.copy(); }
@Nonnull
public ItemStack getCraftingResult(@Nonnull InventoryCrafting var1){ return output.copy(); }
@SuppressWarnings("unchecked")
@Override
@@ -169,6 +172,7 @@ public class ShapelessOreRecipe implements IRecipe
}
@Override
@Nonnull
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) //getRecipeLeftovers
{
return ForgeHooks.defaultRecipeGetRemainingItems(inv);