Auto format code

This commit is contained in:
modmuss50 2017-06-12 14:23:32 +01:00
parent fc4d8686b8
commit b25742dde0
No known key found for this signature in database
GPG key ID: 203A5ED4D3E48BEA
175 changed files with 527 additions and 737 deletions

View file

@ -35,14 +35,9 @@ import net.minecraft.item.crafting.ShapelessRecipes;
import net.minecraft.util.NonNullList;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.oredict.ShapedOreRecipe;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.apache.commons.lang3.Validate;
import reborncore.common.util.CraftingHelper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
public class RollingMachineRecipe {
@ -50,21 +45,21 @@ public class RollingMachineRecipe {
private final HashMap<ResourceLocation, IRecipe> recipes = new HashMap<>();
public void addShapedOreRecipe(ResourceLocation resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
// Validate.notNull(outputItemStack);
// Validate.notNull(outputItemStack.getItem());
// if (objectInputs.length == 0) {
// Validate.notNull(null); //Quick way to crash
// }
// recipes.put(resourceLocation, new ShapedOreRecipe(resourceLocation, outputItemStack, objectInputs));
// Validate.notNull(outputItemStack);
// Validate.notNull(outputItemStack.getItem());
// if (objectInputs.length == 0) {
// Validate.notNull(null); //Quick way to crash
// }
// recipes.put(resourceLocation, new ShapedOreRecipe(resourceLocation, outputItemStack, objectInputs));
}
public void addShapelessOreRecipe(ResourceLocation resourceLocation, ItemStack outputItemStack, Object... objectInputs) {
// Validate.notNull(outputItemStack);
// Validate.notNull(outputItemStack.getItem());
// if (objectInputs.length == 0) {
// Validate.notNull(null); //Quick way to crash
// }
// recipes.put(resourceLocation, new ShapelessOreRecipe(resourceLocation, outputItemStack, objectInputs));
// Validate.notNull(outputItemStack);
// Validate.notNull(outputItemStack.getItem());
// if (objectInputs.length == 0) {
// Validate.notNull(null); //Quick way to crash
// }
// recipes.put(resourceLocation, new ShapelessOreRecipe(resourceLocation, outputItemStack, objectInputs));
}
public void addRecipe(ResourceLocation resourceLocation, ItemStack output, Object... components) {
@ -115,7 +110,7 @@ public class RollingMachineRecipe {
recipes.put(resourceLocation, new ShapedRecipes("", j, k, recipeArray, output));
}
public void addShapelessRecipe(ResourceLocation resourceLocation,ItemStack output, Object... components) {
public void addShapelessRecipe(ResourceLocation resourceLocation, ItemStack output, Object... components) {
NonNullList<Ingredient> ingredients = NonNullList.create();
for (int j = 0; j < components.length; j++) {
ingredients.add(CraftingHelper.toIngredient(components[j]));

View file

@ -44,15 +44,15 @@ public final class TechRebornAPI {
}
public static void addShapelessOreRollingMachinceRecipe(ResourceLocation resourceLocation, ItemStack output, Object... components) {
RollingMachineRecipe.instance.addShapelessOreRecipe(resourceLocation,output, components);
RollingMachineRecipe.instance.addShapelessOreRecipe(resourceLocation, output, components);
}
public static void addRollingMachinceRecipe(ResourceLocation resourceLocation, ItemStack output, Object... components) {
RollingMachineRecipe.instance.addRecipe(resourceLocation,output, components);
RollingMachineRecipe.instance.addRecipe(resourceLocation, output, components);
}
public static void addShapelessRollingMachinceRecipe(ResourceLocation resourceLocation, ItemStack output, Object... components) {
RollingMachineRecipe.instance.addShapelessRecipe(resourceLocation,output, components);
RollingMachineRecipe.instance.addShapelessRecipe(resourceLocation, output, components);
}
/**

View file

@ -28,12 +28,14 @@ import javax.annotation.Nonnull;
public enum EFluidGenerator {
THERMAL("TechReborn.ThermalGenerator"), GAS("TechReborn.GasGenerator"), DIESEL(
"TechReborn.DieselGenerator"), SEMIFLUID("TechReborn.SemifluidGenerator");
"TechReborn.DieselGenerator"), SEMIFLUID("TechReborn.SemifluidGenerator");
@Nonnull
private final String recipeID;
private EFluidGenerator(@Nonnull String recipeID) {
private EFluidGenerator(
@Nonnull
String recipeID) {
this.recipeID = recipeID;
}

View file

@ -30,9 +30,8 @@ public class FluidGeneratorRecipe {
private final EFluidGenerator generatorType;
private final Fluid fluid;
private final int energyPerMb;
public FluidGeneratorRecipe(Fluid fluid, int energyPerMb, EFluidGenerator generatorType)
{
public FluidGeneratorRecipe(Fluid fluid, int energyPerMb, EFluidGenerator generatorType) {
this.fluid = fluid;
this.energyPerMb = energyPerMb;
this.generatorType = generatorType;
@ -41,6 +40,7 @@ public class FluidGeneratorRecipe {
public Fluid getFluid() {
return fluid;
}
public int getEnergyPerMb() {
return energyPerMb;
}
@ -52,7 +52,7 @@ public class FluidGeneratorRecipe {
@Override
public String toString() {
return "FluidGeneratorRecipe [generatorType=" + generatorType + ", fluid=" + fluid + ", energyPerMb="
+ energyPerMb + "]";
+ energyPerMb + "]";
}
@Override

View file

@ -25,33 +25,29 @@
package techreborn.api.generator;
import com.google.common.collect.Sets;
import net.minecraftforge.fluids.Fluid;
import java.util.HashSet;
import java.util.Optional;
import net.minecraftforge.fluids.Fluid;
public class FluidGeneratorRecipeList {
private HashSet<FluidGeneratorRecipe> recipes;
public FluidGeneratorRecipeList(FluidGeneratorRecipe... recipes)
{
public FluidGeneratorRecipeList(FluidGeneratorRecipe... recipes) {
this.recipes = Sets.newHashSet(recipes);
}
public boolean addRecipe(FluidGeneratorRecipe fluidGeneratorRecipe) {
if(!this.getRecipeForFluid(fluidGeneratorRecipe.getFluid()).isPresent())
if (!this.getRecipeForFluid(fluidGeneratorRecipe.getFluid()).isPresent())
return this.getRecipes().add(fluidGeneratorRecipe);
return false;
}
public boolean removeRecipe(FluidGeneratorRecipe fluidGeneratorRecipe)
{
public boolean removeRecipe(FluidGeneratorRecipe fluidGeneratorRecipe) {
return this.getRecipes().remove(fluidGeneratorRecipe);
}
public Optional<FluidGeneratorRecipe> getRecipeForFluid(Fluid fluid)
{
public Optional<FluidGeneratorRecipe> getRecipeForFluid(Fluid fluid) {
return this.recipes.stream().filter(recipe -> recipe.getFluid().equals(fluid)).findAny();
}

View file

@ -24,10 +24,10 @@
package techreborn.api.generator;
import java.util.EnumMap;
import net.minecraftforge.fluids.Fluid;
import java.util.EnumMap;
public class GeneratorRecipeHelper {
/**
@ -36,19 +36,17 @@ public class GeneratorRecipeHelper {
* FluidGeneratorRecipe.
*/
public static EnumMap<EFluidGenerator, FluidGeneratorRecipeList> fluidRecipes = new EnumMap<>(
EFluidGenerator.class);
EFluidGenerator.class);
/**
* Register a Fluid energy recipe.
*
* @param generatorType
* A value of the EFluidGenerator type in which the fluid is
* allowed to be consumed.
*
* @param generatorType A value of the EFluidGenerator type in which the fluid is
* allowed to be consumed.
* @param fluidType
* @param energyPerMb
* Represent the energy / MILLI_BUCKET the fluid will produce.
* Some generators use this value to alter their fluid decay
* speed to match their maximum energy output.
* @param energyPerMb Represent the energy / MILLI_BUCKET the fluid will produce.
* Some generators use this value to alter their fluid decay
* speed to match their maximum energy output.
*/
public static void registerFluidRecipe(EFluidGenerator generatorType, Fluid fluidType, int energyPerMb) {
fluidRecipes.putIfAbsent(generatorType, new FluidGeneratorRecipeList());
@ -56,12 +54,10 @@ public class GeneratorRecipeHelper {
}
/**
*
* @param generatorType
* A value of the EFluidGenerator type in which the fluid is
* allowed to be consumed.
* @param generatorType A value of the EFluidGenerator type in which the fluid is
* allowed to be consumed.
* @return An object holding a set of availables recipes for this type of
* FluidGenerator.
* FluidGenerator.
*/
public static FluidGeneratorRecipeList getFluidRecipesForGenerator(EFluidGenerator generatorType) {
return fluidRecipes.get(generatorType);

View file

@ -130,12 +130,12 @@ public abstract class BaseRecipe implements IBaseRecipeType, Cloneable {
if (inuput == null) {
throw new InvalidParameterException("input is invalid!");
}
if(inuput instanceof ItemStack){
if(((ItemStack) inuput).isEmpty()){
if (inuput instanceof ItemStack) {
if (((ItemStack) inuput).isEmpty()) {
throw new InvalidParameterException("input is invalid!");
}
}
if(RecipeTranslator.getStackFromObject(inuput) == null){
if (RecipeTranslator.getStackFromObject(inuput) == null) {
throw new InvalidParameterException("Could not determin recipe input for " + inuput);
}
inputs.add(inuput);