Update buildscript & apply automatic formatting rules

This commit is contained in:
Raven Szewczyk authored and Jason Mitchell committed 2022-06-27 10:23:18 -07:00
1 parent a7683b885d
commit f7a900e910
173 files changed
+4581 -5321

No files matched your search

@@ -4,31 +4,29 @@ import codechicken.nei.NEIClientConfig;
import codechicken.nei.NEIClientUtils;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import java.util.ArrayList;
import java.util.Arrays;
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.ShapelessRecipes;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ShapelessRecipeHandler extends ShapedRecipeHandler {
public int[][] stackorder = new int[][] {
{0, 0},
{1, 0},
{0, 1},
{1, 1},
{0, 2},
{1, 2},
{2, 0},
{2, 1},
{2, 2}
};
public class ShapelessRecipeHandler extends ShapedRecipeHandler
{
public int[][] stackorder = new int[][]{
{0, 0},
{1, 0},
{0, 1},
{1, 1},
{0, 2},
{1, 2},
{2, 0},
{2, 1},
{2, 2}};
public class CachedShapelessRecipe extends CachedRecipe
{
public class CachedShapelessRecipe extends CachedRecipe {
public CachedShapelessRecipe() {
ingredients = new ArrayList<>();
}
@@ -51,11 +49,13 @@ public class ShapelessRecipeHandler extends ShapedRecipeHandler
ingredients.clear();
int itemsSize = items.size();
if (itemsSize > stackorder.length) {
NEIClientConfig.logger.error("RECIPE BUG: Too many items (" + itemsSize + ") for " + this.result.toString());
NEIClientConfig.logger.error(
"RECIPE BUG: Too many items (" + itemsSize + ") for " + this.result.toString());
itemsSize = stackorder.length;
}
for (int ingred = 0; ingred < itemsSize; ingred++) {
PositionedStack stack = new PositionedStack(items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
PositionedStack stack = new PositionedStack(
items.get(ingred), 25 + stackorder[ingred][0] * 18, 6 + stackorder[ingred][1] * 18);
stack.setMaxSize(1);
ingredients.add(stack);
}
@@ -89,13 +89,11 @@ public class ShapelessRecipeHandler extends ShapedRecipeHandler
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
if (irecipe instanceof ShapelessRecipes) recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
if (recipe == null)
continue;
if (recipe == null) continue;
arecipes.add(recipe);
}
@@ -110,13 +108,11 @@ public class ShapelessRecipeHandler extends ShapedRecipeHandler
for (IRecipe irecipe : allrecipes) {
if (NEIServerUtils.areStacksSameTypeCrafting(irecipe.getRecipeOutput(), result)) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
if (irecipe instanceof ShapelessRecipes) recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
if (recipe == null)
continue;
if (recipe == null) continue;
arecipes.add(recipe);
}
@@ -128,13 +124,10 @@ public class ShapelessRecipeHandler extends ShapedRecipeHandler
List<IRecipe> allrecipes = CraftingManager.getInstance().getRecipeList();
for (IRecipe irecipe : allrecipes) {
CachedShapelessRecipe recipe = null;
if (irecipe instanceof ShapelessRecipes)
recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe)
recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
if (irecipe instanceof ShapelessRecipes) recipe = shapelessRecipe((ShapelessRecipes) irecipe);
else if (irecipe instanceof ShapelessOreRecipe) recipe = forgeShapelessRecipe((ShapelessOreRecipe) irecipe);
if (recipe == null)
continue;
if (recipe == null) continue;
if (recipe.contains(recipe.ingredients, ingredient)) {
recipe.setIngredientPermutation(recipe.ingredients, ingredient);
@@ -144,12 +137,12 @@ public class ShapelessRecipeHandler extends ShapedRecipeHandler
}
private CachedShapelessRecipe shapelessRecipe(ShapelessRecipes recipe) {
if(recipe.recipeItems == null) //because some mod subclasses actually do this
return null;
if (recipe.recipeItems == null) // because some mod subclasses actually do this
return null;
try {
return new CachedShapelessRecipe(recipe.recipeItems, recipe.getRecipeOutput());
} catch (ClassCastException e) { //because some mod subclasses put whatever they want in recipeItems
} catch (ClassCastException e) { // because some mod subclasses put whatever they want in recipeItems
return null;
}
}
@@ -158,8 +151,8 @@ public class ShapelessRecipeHandler extends ShapedRecipeHandler
ArrayList<Object> items = recipe.getInput();
for (Object item : items)
if (item instanceof List && ((List<?>) item).isEmpty())//ore handler, no ores
return null;
if (item instanceof List && ((List<?>) item).isEmpty()) // ore handler, no ores
return null;
try {
return new CachedShapelessRecipe(items, recipe.getRecipeOutput());