pick 97420a31d The big reformat of 2020

This commit is contained in:
yueh
2020-06-16 21:41:28 +02:00
parent 5304b3febe
commit 5225ea426b
2252 changed files with 95466 additions and 118582 deletions
@@ -1,6 +1,9 @@
package appeng.recipes.handlers;
import java.util.List;
import com.google.common.collect.ImmutableList;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
@@ -11,8 +14,6 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import java.util.List;
public class GrinderRecipe implements IRecipe<IInventory> {
public static IRecipeType<GrinderRecipe> TYPE;
@@ -25,7 +26,8 @@ public class GrinderRecipe implements IRecipe<IInventory> {
private final List<GrinderOptionalResult> optionalResults;
private final int turns;
public GrinderRecipe(ResourceLocation id, String group, Ingredient ingredient, int ingredientCount, ItemStack result, int turns, List<GrinderOptionalResult> optionalResults) {
public GrinderRecipe(ResourceLocation id, String group, Ingredient ingredient, int ingredientCount,
ItemStack result, int turns, List<GrinderOptionalResult> optionalResults) {
this.id = id;
this.group = group;
this.ingredient = ingredient;
@@ -1,10 +1,15 @@
package appeng.recipes.handlers;
import appeng.core.AEConfig;
import appeng.core.AppEng;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.Ingredient;
@@ -14,12 +19,11 @@ import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nullable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import appeng.core.AEConfig;
import appeng.core.AppEng;
public class GrinderRecipeSerializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<GrinderRecipe> {
public class GrinderRecipeSerializer extends ForgeRegistryEntry<IRecipeSerializer<?>>
implements IRecipeSerializer<GrinderRecipe> {
public static final GrinderRecipeSerializer INSTANCE = new GrinderRecipeSerializer();
@@ -1,19 +1,20 @@
package appeng.recipes.handlers;
import javax.annotation.Nullable;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.world.World;
import javax.annotation.Nullable;
public final class GrinderRecipes {
private GrinderRecipes() {
}
/**
* Search all available Grinder recipes for a recipe matching the given input or null;
* Search all available Grinder recipes for a recipe matching the given input or
* null;
*/
@Nullable
public static GrinderRecipe findForInput(World world, ItemStack input) {
@@ -27,7 +28,8 @@ public final class GrinderRecipes {
}
/**
* Checks if the given item stack is an ingredient in any grinder recipe, disregarding its current size.
* Checks if the given item stack is an ingredient in any grinder recipe,
* disregarding its current size.
*/
public static boolean isValidIngredient(World world, ItemStack stack) {
for (IRecipe<IInventory> recipe : world.getRecipeManager().getRecipes(GrinderRecipe.TYPE).values()) {
@@ -1,6 +1,7 @@
package appeng.recipes.handlers;
import appeng.api.features.InscriberProcessType;
import javax.annotation.Nullable;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
@@ -11,7 +12,7 @@ import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import javax.annotation.Nullable;
import appeng.api.features.InscriberProcessType;
public class InscriberRecipe implements IRecipe<IInventory> {
@@ -26,7 +27,8 @@ public class InscriberRecipe implements IRecipe<IInventory> {
private ItemStack output;
private InscriberProcessType processType;
public InscriberRecipe(ResourceLocation id, String group, Ingredient middleInput, ItemStack output, Ingredient topOptional, Ingredient bottomOptional, InscriberProcessType processType) {
public InscriberRecipe(ResourceLocation id, String group, Ingredient middleInput, ItemStack output,
Ingredient topOptional, Ingredient bottomOptional, InscriberProcessType processType) {
this.id = id;
this.group = group;
this.middleInput = middleInput;
@@ -1,8 +1,9 @@
package appeng.recipes.handlers;
import appeng.api.features.InscriberProcessType;
import appeng.core.AppEng;
import javax.annotation.Nullable;
import com.google.gson.JsonObject;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.Ingredient;
@@ -12,9 +13,11 @@ import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nullable;
import appeng.api.features.InscriberProcessType;
import appeng.core.AppEng;
public class InscriberRecipeSerializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<InscriberRecipe> {
public class InscriberRecipeSerializer extends ForgeRegistryEntry<IRecipeSerializer<?>>
implements IRecipeSerializer<InscriberRecipe> {
public static final InscriberRecipeSerializer INSTANCE = new InscriberRecipeSerializer();
@@ -26,7 +29,7 @@ public class InscriberRecipeSerializer extends ForgeRegistryEntry<IRecipeSeriali
}
private static InscriberProcessType getMode(JsonObject json) {
String mode = JSONUtils.getString( json, "mode", "inscribe" );
String mode = JSONUtils.getString(json, "mode", "inscribe");
switch (mode) {
case "inscribe":
return InscriberProcessType.INSCRIBE;
@@ -47,18 +50,16 @@ public class InscriberRecipeSerializer extends ForgeRegistryEntry<IRecipeSeriali
ItemStack result = ShapedRecipe.deserializeItem(JSONUtils.getJsonObject(json, "result"));
// Deserialize the three parts of the input
JsonObject ingredients = JSONUtils.getJsonObject( json, "ingredients" );
Ingredient middle = Ingredient.deserialize( ingredients.get( "middle" ) );
Ingredient top = Ingredient.EMPTY;
if( ingredients.has( "top" ) )
{
top = Ingredient.deserialize( ingredients.get( "top" ) );
}
Ingredient bottom = Ingredient.EMPTY;
if( ingredients.has( "bottom" ) )
{
bottom = Ingredient.deserialize( ingredients.get( "bottom" ) );
}
JsonObject ingredients = JSONUtils.getJsonObject(json, "ingredients");
Ingredient middle = Ingredient.deserialize(ingredients.get("middle"));
Ingredient top = Ingredient.EMPTY;
if (ingredients.has("top")) {
top = Ingredient.deserialize(ingredients.get("top"));
}
Ingredient bottom = Ingredient.EMPTY;
if (ingredients.has("bottom")) {
bottom = Ingredient.deserialize(ingredients.get("bottom"));
}
return new InscriberRecipe(recipeId, group, middle, result, top, bottom, mode);
}