Auto formatted, and cleaned imports

This commit is contained in:
Modmuss50 2015-04-15 16:23:12 +01:00
parent c001231216
commit 8e7d6b011e
64 changed files with 2268 additions and 2587 deletions

View file

@ -6,15 +6,13 @@ import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
public class CraftingHelper {
public static void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs)
{
CraftingManager.getInstance().getRecipeList() .add(new ShapedOreRecipe(outputItemStack, objectInputs));
}
public static void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs)
{
CraftingManager.getInstance().getRecipeList() .add(new ShapelessOreRecipe(outputItemStack, objectInputs));
}
public static void addShapedOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
CraftingManager.getInstance().getRecipeList().add(new ShapedOreRecipe(outputItemStack, objectInputs));
}
public static void addShapelessOreRecipe(ItemStack outputItemStack, Object... objectInputs) {
CraftingManager.getInstance().getRecipeList().add(new ShapelessOreRecipe(outputItemStack, objectInputs));
}
}

View file

@ -7,27 +7,27 @@ import net.minecraftforge.oredict.OreDictionary;
* Created by mark on 12/04/15.
*/
public class ItemUtils {
public static boolean isItemEqual(final ItemStack a, final ItemStack b, final boolean matchDamage, final boolean matchNBT) {
if (a == null || b == null)
return false;
if (a.getItem() != b.getItem())
return false;
if (matchNBT && !ItemStack.areItemStackTagsEqual(a, b))
return false;
if (matchDamage && a.getHasSubtypes()) {
if (isWildcard(a) || isWildcard(b))
return true;
if (a.getItemDamage() != b.getItemDamage())
return false;
}
return true;
}
public static boolean isItemEqual(final ItemStack a, final ItemStack b, final boolean matchDamage, final boolean matchNBT) {
if (a == null || b == null)
return false;
if (a.getItem() != b.getItem())
return false;
if (matchNBT && !ItemStack.areItemStackTagsEqual(a, b))
return false;
if (matchDamage && a.getHasSubtypes()) {
if (isWildcard(a) || isWildcard(b))
return true;
if (a.getItemDamage() != b.getItemDamage())
return false;
}
return true;
}
public static boolean isWildcard(ItemStack stack) {
return isWildcard(stack.getItemDamage());
}
public static boolean isWildcard(ItemStack stack) {
return isWildcard(stack.getItemDamage());
}
public static boolean isWildcard(int damage) {
return damage == -1 || damage == OreDictionary.WILDCARD_VALUE;
}
public static boolean isWildcard(int damage) {
return damage == -1 || damage == OreDictionary.WILDCARD_VALUE;
}
}

View file

@ -1,55 +1,45 @@
package techreborn.util;
import org.apache.logging.log4j.Level;
import techreborn.lib.ModInfo;
import cpw.mods.fml.common.FMLLog;
import org.apache.logging.log4j.Level;
import techreborn.lib.ModInfo;
public class LogHelper {
public static void log(Level logLevel, Object object)
{
FMLLog.log(ModInfo.MOD_NAME, logLevel, String.valueOf(object));
}
public static void all(Object object)
{
log(Level.ALL, object);
}
public static void log(Level logLevel, Object object) {
FMLLog.log(ModInfo.MOD_NAME, logLevel, String.valueOf(object));
}
public static void debug(Object object)
{
log(Level.DEBUG, object);
}
public static void all(Object object) {
log(Level.ALL, object);
}
public static void error(Object object)
{
log(Level.ERROR, object);
}
public static void debug(Object object) {
log(Level.DEBUG, object);
}
public static void fatal(Object object)
{
log(Level.FATAL, object);
}
public static void error(Object object) {
log(Level.ERROR, object);
}
public static void info(Object object)
{
log(Level.INFO, object);
}
public static void fatal(Object object) {
log(Level.FATAL, object);
}
public static void off(Object object)
{
log(Level.OFF, object);
}
public static void info(Object object) {
log(Level.INFO, object);
}
public static void trace(Object object)
{
log(Level.TRACE, object);
}
public static void off(Object object) {
log(Level.OFF, object);
}
public static void trace(Object object) {
log(Level.TRACE, object);
}
public static void warn(Object object) {
log(Level.WARN, object);
}
public static void warn(Object object)
{
log(Level.WARN, object);
}
}

View file

@ -1,50 +1,41 @@
package techreborn.util;
import java.util.List;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.ShapedRecipes;
public class RecipeRemover
{
public static void removeShapedRecipes(List<ItemStack> removelist)
{
for (ItemStack stack : removelist)
removeShapedRecipe(stack);
}
import java.util.List;
public static void removeAnyRecipe(ItemStack resultItem)
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++)
{
IRecipe tmpRecipe = recipes.get(i);
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
{
recipes.remove(i--);
}
}
}
public class RecipeRemover {
public static void removeShapedRecipes(List<ItemStack> removelist) {
for (ItemStack stack : removelist)
removeShapedRecipe(stack);
}
public static void removeShapedRecipe(ItemStack resultItem)
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++)
{
IRecipe tmpRecipe = recipes.get(i);
if (tmpRecipe instanceof ShapedRecipes)
{
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
ItemStack recipeResult = recipe.getRecipeOutput();
public static void removeAnyRecipe(ItemStack resultItem) {
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++) {
IRecipe tmpRecipe = recipes.get(i);
ItemStack recipeResult = tmpRecipe.getRecipeOutput();
if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
recipes.remove(i--);
}
}
}
if (ItemStack.areItemStacksEqual(resultItem, recipeResult))
{
recipes.remove(i++);
}
}
}
}
public static void removeShapedRecipe(ItemStack resultItem) {
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++) {
IRecipe tmpRecipe = recipes.get(i);
if (tmpRecipe instanceof ShapedRecipes) {
ShapedRecipes recipe = (ShapedRecipes) tmpRecipe;
ItemStack recipeResult = recipe.getRecipeOutput();
if (ItemStack.areItemStacksEqual(resultItem, recipeResult)) {
recipes.remove(i++);
}
}
}
}
}

View file

@ -9,10 +9,8 @@ import net.minecraftforge.event.ForgeEventFactory;
public class TorchHelper {
public static boolean placeTorch(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset)
{
for (int i = 0; i < player.inventory.mainInventory.length; i++)
{
public static boolean placeTorch(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float xOffset, float yOffset, float zOffset) {
for (int i = 0; i < player.inventory.mainInventory.length; i++) {
ItemStack torchStack = player.inventory.mainInventory[i];
if (torchStack == null || !torchStack.getUnlocalizedName().toLowerCase().contains("torch")) continue;
Item item = torchStack.getItem();
@ -20,12 +18,10 @@ public class TorchHelper {
int oldMeta = torchStack.getItemDamage();
int oldSize = torchStack.stackSize;
boolean result = torchStack.tryPlaceItemIntoWorld(player, world, x, y, z, side, xOffset, yOffset, zOffset);
if (player.capabilities.isCreativeMode)
{
if (player.capabilities.isCreativeMode) {
torchStack.setItemDamage(oldMeta);
torchStack.stackSize = oldSize;
} else if (torchStack.stackSize <= 0)
{
} else if (torchStack.stackSize <= 0) {
ForgeEventFactory.onPlayerDestroyItem(player, torchStack);
player.inventory.mainInventory[i] = null;
}